Report Finished update in AX 2009 by Raspberry Pi 3 Model B+

Report Finished

The solution is used in production floor to report finished items. It uses barcode scanner connected to Raspberry Pi 3 Model B+ [1] with 7'' TouchScreen. The device communicates through the wireless network to Windows Service. The Windows Service through .NET Business Connector uses AX 2009 static function to process the requests.


static str updateReportFinished(str _devId, str _devName, InventLocationId _warehouse, ProdId _production, ItemId _item, inventBatchId _batch, inventSerialId _serial, str _quantity)
{
Args args;
ProdTable prodTable;
ProdMultiReportFinished prodMultiReportFinished;
ProdParmReportFinished prodParmReportFinished, prodParmreportFinishedUPD;
InventTable inventTable;
InventDim inventDim;
str ret;
b_BizConService log;
;
// find production
prodTable = ProdTable::find(_production);
if(prodTable)
{
if(prodTable.ItemId == _item)
{
// find a dimension
inventTable = InventTable::find(prodTable.ItemId);
inventDim.initFromInventTable(inventTable);
inventDim.InventLocationId = _warehouse;
inventDim.inventBatchId = _batch;
inventDim = InventDim::findOrCreate(inventDim);
//
args = new Args();
args.parmEnum(0);
args.record(prodTable);
prodMultiReportFinished = ProdMultiReportFinished::construct(args);
RunBaseMultiParm::initParm(prodMultiReportFinished);
prodParmreportFinished = ProdMultiReportFinished.defaultParmBuffer();
prodMultiReportFinished.insert(prodTable,prodParmreportFinished);
// update parameters
prodParmReportFinishedUPD = ProdParmReportFinished::find(prodParmReportFinished.ParmId, prodParmReportFinished.ProdId, True);
if(prodParmReportFinishedUPD)
{
ttsbegin;
prodParmReportFinishedUPD.InventDimId = inventDim.inventDimId;
prodParmReportFinishedUPD.QtyGood = str2num(_quantity);
prodParmReportFinishedUPD.EndRouteCard = NoYes::No;
prodParmReportFinishedUPD.RouteAutoConsump = RouteAutoConsump::Never;
prodParmReportFinishedUPD.BOMAutoConsump = BomAutoConsump::Never;
prodParmReportFinishedUPD.EndPicklist = NoYes::No;
prodParmReportFinishedUPD.EndJob = NoYes::No;
prodParmReportFinishedUPD.AcceptError = NoYes::Yes;
prodParmReportFinishedUPD.update();
ttscommit;
}
ProdMultiReportFinished.run();
ret = "OK";
}
else
{
ret = "Wrong item number";
}
}
else
{
ret = "Production is not found";
}
log.initValue();
log.devId = _devId;
log.devName = _devName;
log.JournalId = strfmt("%1", _production);
log.Command = strfmt("%1,%2,%3,%4", _warehouse, _batch, _serial, _quantity);
log.Result = ret;
log.insert();
return ret;
}

[1] https://www.raspberrypi.org
[2] Source code for Raspberry Pi device https://github.com/dzoka/ReportFinished