Insufficient inventory transactions with status Picked.
But if I use an item that is not a catch weight there is no error. this is my code
private void createPickReserverSOline(salesline salesln, SalesQty qty)
{
Query inventTransQuery;
QueryRun qr;
QueryBuildDataSource qbds;
InventTrans inventTrans = null;
InventDim inventDimPick = null;
InventTransOrigin inventTransOrigin = null;
TmpInventTransWMS tmpInventTransWMS = null;
InventTransWMS_Pick inventTransWMS_Pick = null;
inventTransQuery = new Query();
qbds = inventTransQuery.addDataSource(tableNum(InventTrans));
qbds.addRange(fieldNum(InventTrans, StatusIssue)).value(queryValue(StatusIssue::OnOrder));
qbds.addRange(fieldNum(InventTrans, StatusReceipt)).value(queryValue(StatusReceipt::None));
qbds = qbds.addDataSource(tableNum(InventTransOrigin));
qbds.relations(true);
qbds.joinMode(JoinMode::InnerJoin);
qbds.addRange(fieldNum(InventTransOrigin, InventTransId)).value(salesln.InventTransId);
qr = new QueryRun(inventTransQuery);
while (qr.next())
{
inventTrans = qr.get(tableNum(InventTrans));
inventTransOrigin = qr.get(tableNum(InventTransOrigin));
// Set inventory dimensions for picking
inventDimPick = inventDim::find(salesln.InventDimId);
inventDimPick = inventDim::findOrCreate(inventDimPick);
tmpInventTransWMS.clear();
inventTransWMS_Pick = InventTransWMS_Pick::newStandard(tmpInventTransWMS, inventTransQuery);
tmpInventTransWMS.initInventDimId(inventTrans.InventDimId);
tmpInventTransWMS.UnitId = inventTrans.inventUnit();
tmpInventTransWMS.InventTrans = inventTrans.RecId;
tmpInventTransWMS.InventTransOrigin = inventTrans.InventTransOrigin;
tmpInventTransWMS.initInventQty(PdsCatchWeight::inventQty(InventTrans.ItemId, salesParmLine.PdsCWDeliverNow, InventTableModule::find(InventTrans.ItemId, ModuleInventPurchSales::Sales).UnitId),inventTrans.StatusReceipt,inventTrans.StatusIssue);
tmpInventTransWMS.initPdsCWQty(salesParmLine.PdsCWDeliverNow,inventTrans.StatusReceipt,inventTrans.StatusIssue);
tmpInventTransWMS.PDSBaseValue = inventTrans.pdsGetPotencyValue();
//tmpInventTransWMS.initFromInventTrans(InventTrans);
tmpInventTransWMS.initFromInventTransOrigin(inventTransOrigin);
tmpInventTransWMS.initFromInventDim(inventDimPick);
tmpInventTransWMS.ItemId = InventTrans.ItemId;
tmpInventTransWMS.UnitId = InventTableModule::find(InventTrans.ItemId, ModuleInventPurchSales::Sales).UnitId;
tmpInventTransWMS.PdsCWQty = salesParmLine.DeliverNow;
tmpInventTransWMS.InventQty = PdsCatchWeight::inventQty(InventTrans.ItemId, salesParmLine.PdsCWDeliverNow, InventTableModule::find(InventTrans.ItemId, ModuleInventPurchSales::Sales).UnitId);
inventTransWMS_Pick.writeTmpInventTransWMS(tmpInventTransWMS);
inventTransWMS_Pick.updateInvent();
}
}
Anybody help me? Im sorry for my bad english.