Picking List update in AX 2009 by Raspberry Pi 3 Model B+

Picking List

The solution is used in production floor to submit parts used by production. 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 updatePickinglistLine(str _devId, str _devName, InventLocationId _warehouse, ProdId _production, ItemId _item, inventBatchId _batch, inventSerialId _serial, str _quantity)
{
ProdJournalBOM prodJournalBOM;
InventDim inventDim;
b_BizConService log;
str ret;
;
// find DimId
if(_batch)
{
select firstonly inventDim where (inventDim.inventBatchId == _batch && inventDim.InventLocationId == _warehouse && inventDim.wMSLocationId == "DEFAULT");
}
else if (_serial)
{
select firstonly inventDim where (inventDim.inventSerialId == _serial && inventDim.InventLocationId == _warehouse && inventDim.wMSLocationId == "DEFAULT");
}
if(inventDim)
{
select forupdate firstonly prodJournalBOM where (prodJournalBOM.ProdId == _production && prodJournalBOM.ItemId == _item && prodJournalBOM.Voucher == '');
if(prodJournalBOM)
{
if(prodJournalBOM.isPosted() == NoYes::No)
{
ttsbegin;
prodJournalBOM.setInventDimIdFromInventDim(inventDim);
prodJournalBOM.BOMConsump = str2num(_quantity);
prodJournalBOM.InventConsump = UnitConvert::qty(prodJournalBOM.BOMConsump,
prodJournalBOM.BOMUnitId,
InventTable::find(prodJournalBOM.ItemId).inventUnitId(),
prodJournalBOM.ItemId);
prodJournalBOM.update();
ttscommit;
ret = "OK";
}
else
{
ret = "Journal is already posted";
}
}
else
{
ret = "Item is not found";
}
}
else
{
ret = "Dimension is not found";
}
log.initValue();
log.devId = _devId;
log.devName = _devName;
log.JournalId = strfmt("%1", _production);
log.Command = strfmt("%1,%2,%3,%4", _item, _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/PickingList
[3] Short video https://www.youtube.com/watch?v=HApsfdxIvo8