class Class1
{
public static void main(Args _args)
{
PurchLine upPurchLine;
InventTrans inventtrans;
InventTransWMS_Register inventTransWMS_register;
InventBatch inventBatch;
TmpInventTransWMS tmpInventTransWMS;
InventDim regInventDim;
InventBatchId inventBatchId;
try
{
ttsbegin;
upPurchLine = PurchLine::find('01PO00000122', 40);
inventTransWMS_Register = InventTransWMS_Register::newStandard(tmpInventTransWMS);
inventTrans = InventTrans::findTransId(upPurchLine.InventTransId);
tmpInventTransWMS.initFromInventTrans(inventTrans);
tmpInventTransWMS.InventQty = 2;//Purchline.Qty;
tmpInventTransWMS.LineNum = int642int(upPurchLine.LineNumber);
regInventDim.clear();
regInventDim.InventSizeId = 'AUTO';
regInventDim.InventSiteId = 'SIMPSON';
regInventDim.InventLocationId= 'DW2';
inventBatchId = 'Batch001';
InventBatch=InventBatch::find(inventBatchId,upPurchLine.itemId);
if(!InventBatch)
{
inventBatch.clear();
inventBatch.itemId = upPurchLine.ItemId;
inventBatch.inventBatchId=inventBatchId;
inventBatch.insert();
}
regInventDim.inventBatchId = inventBatch.inventBatchId;
regInventDim.wMSLocationId = 'Packing';
regInventDim.InventStatusId = 'Available';
regInventDim.LicensePlateId = '05082019';
regInventDim = InventDim::findOrCreate(regInventDim);
tmpInventTransWMS.ItemId = upPurchLine.ItemId;
tmpInventTransWMS.InventDimId = regInventDim.InventDimId;
tmpInventTransWMS.insert();
inventTransWMS_Register.writeTmpInventTransWMS(tmpInventTransWMS, inventTrans, InventDim::find(tmpInventTransWMS.InventDimId));
if (!inventTransWMS_Register.updateInvent(upPurchLine))
{
throw Error("Error during purchase order registration");
}
else
{
info("done");
}
ttscommit;
}
catch (Exception::Error)
{
ttsabort;
error("An error occurred. Please try again");
}
}
}
{
public static void main(Args _args)
{
PurchLine upPurchLine;
InventTrans inventtrans;
InventTransWMS_Register inventTransWMS_register;
InventBatch inventBatch;
TmpInventTransWMS tmpInventTransWMS;
InventDim regInventDim;
InventBatchId inventBatchId;
try
{
ttsbegin;
upPurchLine = PurchLine::find('01PO00000122', 40);
inventTransWMS_Register = InventTransWMS_Register::newStandard(tmpInventTransWMS);
inventTrans = InventTrans::findTransId(upPurchLine.InventTransId);
tmpInventTransWMS.initFromInventTrans(inventTrans);
tmpInventTransWMS.InventQty = 2;//Purchline.Qty;
tmpInventTransWMS.LineNum = int642int(upPurchLine.LineNumber);
regInventDim.clear();
regInventDim.InventSizeId = 'AUTO';
regInventDim.InventSiteId = 'SIMPSON';
regInventDim.InventLocationId= 'DW2';
inventBatchId = 'Batch001';
InventBatch=InventBatch::find(inventBatchId,upPurchLine.itemId);
if(!InventBatch)
{
inventBatch.clear();
inventBatch.itemId = upPurchLine.ItemId;
inventBatch.inventBatchId=inventBatchId;
inventBatch.insert();
}
regInventDim.inventBatchId = inventBatch.inventBatchId;
regInventDim.wMSLocationId = 'Packing';
regInventDim.InventStatusId = 'Available';
regInventDim.LicensePlateId = '05082019';
regInventDim = InventDim::findOrCreate(regInventDim);
tmpInventTransWMS.ItemId = upPurchLine.ItemId;
tmpInventTransWMS.InventDimId = regInventDim.InventDimId;
tmpInventTransWMS.insert();
inventTransWMS_Register.writeTmpInventTransWMS(tmpInventTransWMS, inventTrans, InventDim::find(tmpInventTransWMS.InventDimId));
if (!inventTransWMS_Register.updateInvent(upPurchLine))
{
throw Error("Error during purchase order registration");
}
else
{
info("done");
}
ttscommit;
}
catch (Exception::Error)
{
ttsabort;
error("An error occurred. Please try again");
}
}
}
No comments:
Post a Comment