inventTransferLine.UnderDeliveryPct = 100;
public void run(InventSum inventSum = null)
{
InventTransferParmTable invTransParmTbl;
InventTransferUpd invTranUpd;
InventDim inventDim,inventDim1,inventDim2;
if(!map.exists(inventSum.InventLocationId))
{
inventTransferTable.clear();
inventTransferTable.initvalue();
numbersequencereference = inventparameters::numreftransferid();
numberseq = numberseq::newgetnumfromcode(numbersequencereference.numbersequencetable().numbersequence);
//TransferId = numberseq.num();
inventTransferTable.transferid = numberseq.num();//TransferId;
inventTransferTable.inventlocationidfrom = inventSum.InventLocationId;
inventTransferTable.modifiedfield(fieldnum(inventTransferTable, inventlocationidfrom));
inventTransferTable.inventlocationidto = getToWarehouse;
inventTransferTable.modifiedfield(fieldnum(inventTransferTable, inventlocationidto));
inventTransferTable.transferstatus = inventtransferstatus::created;
inventTransferTable.insert();
select InventLocationId from inventDim
where inventDim.inventDimId == inventSum.InventDimId;
Map.insert(inventDim.InventLocationId,inventTransferTable);
if(TransferOrderList == '')
{
TransferOrderList = inventTransferTable.transferid;
cnt++;
}
else
{
TransferOrderList = strReplace(TransferOrderList," and ",", ");
TransferOrderList = TransferOrderList + " and " + inventTransferTable.transferid;
cnt++;
}
inventTransferLine.clear();
inventTransferLine.ItemId = inventSum.ItemId;
inventTransferLine.initfrominventtable(inventtable::find(inventTransferLine.ItemId));
inventTransferLine.initfrominventTransferTable(inventTransferTable, NoYes::Yes);
inventTransferLine.qtytransfer = inventSum.AvailPhysical;
inventTransferLine.qtyremainreceive = 1;
inventTransferLine.qtyremainship = 1;
inventTransferLine.inventdimid = inventSum.inventdimid;
inventTransferLine.LineNum = 1;
inventTransferLine.insert();
invTransParmTbl.TransferId = inventTransferTable.TransferId;
invTransParmTbl.EditLines = true;
invTransParmTbl.AutoReceiveQty = false;
invTransParmTbl.UpdateType = InventTransferUpdateType::Shipment;
invTransParmTbl.ShipUpdateQty = InventTransferShipUpdateQty::All;
invTransParmTbl.TransDate = systemDateGet();
invTranUpd = InventTransferUpdShip::newParmBuffer(invTransParmTbl);
invTranUpd.run();
Info("Transfer Order: " + inventTransferTable.TransferId + " is Shipped.");
}
else
{
inventTransferTable.clear();
select InventLocationId from inventDim1
where inventDim1.inventDimId == inventSum.InventDimId;
inventTransferTable = map.lookup(inventDim1.InventLocationId);
inventTransferLineLoc.clear();
select firstonly LineNum from inventTransferLineLoc
order by inventTransferLineLoc.LineNum desc
where inventTransferLineLoc.TransferId == inventTransferTable.TransferId;
inventTransferLine.clear();
inventTransferLine.ItemId = inventSum.ItemId;
inventTransferLine.initfrominventtable(inventtable::find(inventTransferLine.ItemId));
inventTransferLine.initfrominventTransferTable(inventTransferTable, NoYes::Yes);
inventTransferLine.qtytransfer = inventSum.AvailPhysical;
inventTransferLine.qtyremainreceive = 1;
inventTransferLine.qtyremainship = 1;
inventTransferLine.inventdimid = inventSum.inventdimid;
inventTransferLine.LineNum = inventTransferLineLoc.LineNum + 1;
inventTransferLine.insert();
}
}
public void run(InventSum inventSum = null)
{
InventDim inventDim,inventDim1,inventDim2;
//info(strFmt("%1 ;%2; %3; %4; %5",dtInventorySearch.inventSerialId,dtInventorySearch.ItemId,dtInventorySearch.configId,dtInventorySearch.InventLocationId,dtInventorySearch.InventDimId));
if(!map.exists(inventSum.InventLocationId))
{
inventTransferTable.clear();
inventTransferTable.initvalue();
numbersequencereference = inventparameters::numreftransferid();
numberseq = numberseq::newgetnumfromcode(numbersequencereference.numbersequencetable().numbersequence);
//TransferId = numberseq.num();
inventTransferTable.transferid = numberseq.num();//TransferId;
inventTransferTable.inventlocationidfrom = inventSum.InventLocationId;
inventTransferTable.modifiedfield(fieldnum(inventTransferTable, inventlocationidfrom));
inventTransferTable.inventlocationidto = getToWarehouse;
inventTransferTable.modifiedfield(fieldnum(inventTransferTable, inventlocationidto));
inventTransferTable.transferstatus = inventtransferstatus::created;
inventTransferTable.insert();
select InventLocationId from inventDim
where inventDim.inventDimId == inventSum.InventDimId;
Map.insert(inventDim.InventLocationId,inventTransferTable);
if(TransferOrderList == '')
{
TransferOrderList = inventTransferTable.transferid;
cnt++;
}
else
{
TransferOrderList = strReplace(TransferOrderList," and ",", ");
TransferOrderList = TransferOrderList + " and " + inventTransferTable.transferid;
cnt++;
}
inventTransferLine.clear();
inventTransferLine.ItemId = inventSum.ItemId;
inventTransferLine.initfrominventtable(inventtable::find(inventTransferLine.ItemId));
inventTransferLine.initfrominventTransferTable(inventTransferTable, NoYes::Yes);
inventTransferLine.qtytransfer = inventSum.AvailPhysical;
inventTransferLine.qtyremainreceive = 1;
inventTransferLine.qtyremainship = 1;
inventTransferLine.inventdimid = inventSum.inventdimid;
inventTransferLine.LineNum = 1;
inventTransferLine.insert();
}
else
{
inventTransferTable.clear();
select InventLocationId from inventDim1
where inventDim1.inventDimId == inventSum.InventDimId;
inventTransferTable = map.lookup(inventDim1.InventLocationId);
inventTransferLineLoc.clear();
select firstonly LineNum from inventTransferLineLoc
order by inventTransferLineLoc.LineNum desc
where inventTransferLineLoc.TransferId == inventTransferTable.TransferId;
inventTransferLine.clear();
inventTransferLine.ItemId = inventSum.ItemId;
inventTransferLine.initfrominventtable(inventtable::find(inventTransferLine.ItemId));
inventTransferLine.initfrominventTransferTable(inventTransferTable, NoYes::Yes);
inventTransferLine.qtytransfer = inventSum.AvailPhysical;
inventTransferLine.qtyremainreceive = 1;
inventTransferLine.qtyremainship = 1;
inventTransferLine.inventdimid = inventSum.inventdimid;
inventTransferLine.LineNum = inventTransferLineLoc.LineNum + 1;
inventTransferLine.insert();
}
}
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,219 Super User 2024 Season 2
Martin Dráb 230,056 Most Valuable Professional
nmaenpaa 101,156