static void TransferOrdersImport(Args _args)
{
#define.WarehouseFrom("AHK")
#define.WarehouseTo("SIMON")
#define.ShipDate("1/1/2019")
#define.ReceiveDate("1/1/2019)
#define.ItemId("ICTest")
#define.Qty(1)
#define.Site("HK")
#define.Warehouse("AHK")
InventTransferTable inventTransferTable;
InventTransferLine inventTransferLine;
InventDim inventDim;
try
{
ttsbegin;
//Order header inventTransferTable.clear();
inventTransferTable.initValue();
inventTransferTable.TransferId = InventTransferTable::numberSeq().num();
inventTransferTable.InventLocationIdFrom = #WarehouseFrom;
inventTransferTable.InventLocationIdTo = #WarehouseTo;
inventTransferTable.DlvModeId = CustVendTransportPointLine::defaultDeliveryMode(inventTransferTable.InventLocationIdFrom,'','','','',inventTransferTable.InventLocationIdTo);
inventTransferTable.InventLocationIdTransit = InventLocation::find(inventTransferTable.InventLocationIdFrom).InventLocationIdTransit;
inventTransferTable.initFromAddress();
inventTransferTable.initToAddress();
inventTransferTable.ShipDate = str2Date(#ShipDate, 213);
inventTransferTable.ReceiveDate = str2Date(#ReceiveDate, 213);
if (inventTransferTable.validateWrite())
{
inventTransferTable.insert();
//Order line inventDim.clear();
inventDim.InventSiteId = "HK";
inventDim.InventLocationId = "AHK";
inventTransferLine.clear();
inventTransferLine.initValue();
inventTransferLine.ItemId = #ItemId;
inventTransferLine.InventDimId = InventDim::findOrCreate(inventDim).inventDimId;
inventTransferLine.QtyTransfer = #Qty;
inventTransferLine.initFromInventTableModule(InventTableModule::find(inventTransferLine.ItemId,ModuleInventPurchSales::Invent));
inventTransferLine.QtyRemainReceive = inventTransferLine.QtyTransfer;
inventTransferLine.QtyRemainShip = inventTransferLine.QtyTransfer;
inventTransferLine.ShipDate = str2Date(#ShipDate, 213);
inventTransferLine.ReceiveDate = str2Date(#ReceiveDate, 213);
inventTransferLine.initFromInventTransferTable(inventTransferTable, false);
inventTransferLine.LineNum = InventTransferLine::lastLineNum(inventTransferLine.TransferId) + 1.0;
if (inventTransferLine.validateWrite())
{
inventTransferLine.insert();
}
else
throw error("Error in Order line");
}
else
throw error("Error in Order header");
ttscommit;
}
catch {
error("Error!");
return;
}
info("Done!");
}
{
#define.WarehouseFrom("AHK")
#define.WarehouseTo("SIMON")
#define.ShipDate("1/1/2019")
#define.ReceiveDate("1/1/2019)
#define.ItemId("ICTest")
#define.Qty(1)
#define.Site("HK")
#define.Warehouse("AHK")
InventTransferTable inventTransferTable;
InventTransferLine inventTransferLine;
InventDim inventDim;
try
{
ttsbegin;
//Order header inventTransferTable.clear();
inventTransferTable.initValue();
inventTransferTable.TransferId = InventTransferTable::numberSeq().num();
inventTransferTable.InventLocationIdFrom = #WarehouseFrom;
inventTransferTable.InventLocationIdTo = #WarehouseTo;
inventTransferTable.DlvModeId = CustVendTransportPointLine::defaultDeliveryMode(inventTransferTable.InventLocationIdFrom,'','','','',inventTransferTable.InventLocationIdTo);
inventTransferTable.InventLocationIdTransit = InventLocation::find(inventTransferTable.InventLocationIdFrom).InventLocationIdTransit;
inventTransferTable.initFromAddress();
inventTransferTable.initToAddress();
inventTransferTable.ShipDate = str2Date(#ShipDate, 213);
inventTransferTable.ReceiveDate = str2Date(#ReceiveDate, 213);
if (inventTransferTable.validateWrite())
{
inventTransferTable.insert();
//Order line inventDim.clear();
inventDim.InventSiteId = "HK";
inventDim.InventLocationId = "AHK";
inventTransferLine.clear();
inventTransferLine.initValue();
inventTransferLine.ItemId = #ItemId;
inventTransferLine.InventDimId = InventDim::findOrCreate(inventDim).inventDimId;
inventTransferLine.QtyTransfer = #Qty;
inventTransferLine.initFromInventTableModule(InventTableModule::find(inventTransferLine.ItemId,ModuleInventPurchSales::Invent));
inventTransferLine.QtyRemainReceive = inventTransferLine.QtyTransfer;
inventTransferLine.QtyRemainShip = inventTransferLine.QtyTransfer;
inventTransferLine.ShipDate = str2Date(#ShipDate, 213);
inventTransferLine.ReceiveDate = str2Date(#ReceiveDate, 213);
inventTransferLine.initFromInventTransferTable(inventTransferTable, false);
inventTransferLine.LineNum = InventTransferLine::lastLineNum(inventTransferLine.TransferId) + 1.0;
if (inventTransferLine.validateWrite())
{
inventTransferLine.insert();
}
else
throw error("Error in Order line");
}
else
throw error("Error in Order header");
ttscommit;
}
catch {
error("Error!");
return;
}
info("Done!");
}
ReplyDeleteThis is an amazing blog, thank you so much for sharing such valuable information with us.
Microsoft Dynamics AX Training
MS Dynamics AX Training
MS Dynamics Training in Hyderabad
Microsoft Dynamics AX Technical Training
Microsoft Dynamics AX Technical Training in Hyderabad
MS Dynamics Technical Online Training
MS Dynamics AX Technical Training in Hyderabad
MS Dynamics AX Online Training
D365 AX Online Training
https://www.youtube.com/playlist?list=PLWSxgDbjVWTjxvgnaAZ0iK8o5dYHAYhrq
ReplyDeleteCollection of Microsoft ERP Clips || ERP Licensing, Technical, Functional ,Manager Learning Videos Listing