วันพฤหัสบดีที่ 8 พฤศจิกายน พ.ศ. 2555
Job Update2ndQty
static void Update2ndQty(Args _args)
{
inventDim inventDim;
inventSum inventSum;
unitConvert unitConvert;
inventSum inventSum2;
;
while select inventDim
where inventDim.InventLocationId == "omcan"
// iron ,mfg1,2,5
// iron24
// paiboon
// ks
// apc
// omcan
// || inventDim.InventLocationId == "MFG1"
// && inventDim.inventSerialId == "GB152957"
{
print inventDim.InventLocationId;
print inventDim.inventDimId;
print inventDim.inventBatchId;
while select inventSum
where inventSum.ItemId Like "R*"
&& inventSum.InventDimId == inventDim.inventDimId
{
// ttsbegin;
select unitConvert
where unitConvert.FromUnit == "Sheet"
&& unitConvert.ToUnit == "Ton"
&& unitConvert.ItemId == inventSum.ItemId;
print inventSum.InventDimId;
print inventSum.ItemId;
print "on order :";
print inventSum.OnOrder;
print "PostedQty :";
print inventSum.PostedQty;
print "Received :";
print inventSum.Received;
print "Deducted :";
print inventSum.Deducted;
print "Registered :";
print inventSum.Registered;
print "Picked :";
print inventSum.Picked;
print "VBS_2ndOnOrder :";
print inventSum.VBS_2ndOnOrder;
print "New VBS_2ndOnOrder: ";
print inventSum.OnOrder * unitConvert.Factor;
print unitConvert.Factor;
print unitConvert.Factor * inventSum.OnOrder;
print unitConvert.Factor * inventSum.PostedQty;
print unitConvert.Factor * inventSum.Received;
print unitConvert.Factor * inventSum.Deducted;
print unitConvert.Factor * inventSum.Registered;
print unitConvert.Factor * inventSum.Picked;
print inventSum.Arrived;
print inventSum.VBS_2ndArrived;
print inventSum.Ordered;
print inventSum.VBS_2ndOrdered;
print inventSum.ReservOrdered;
print inventSum.VBS_2ndReservOrdered;
// pause;
ttsbegin;
while select forupdate inventSum2
where inventSum2.ItemId == inventSum.ItemId
&& inventSum2.InventDimId == inventDim.inventDimId
// && inventSum2.
{
//decround (1.2 , 0)
inventSum2.VBS_2ndArrived = decround ((inventSum.Arrived * unitConvert.Factor),0);
inventSum2.VBS_2ndOrdered = decround ((inventSum.Ordered * unitConvert.Factor),0);
inventSum2.VBS_2ndReservOrdered = decround ((inventSum.ReservOrdered * unitConvert.Factor),0);
inventSum2.VBS_2ndOnOrder = decround ((inventSum.OnOrder * unitConvert.Factor),0);
inventSum2.VBS_2ndPostedQty = decround ((unitConvert.Factor * inventSum.PostedQty),0);
inventSum2.VBS_2ndReceived = decround ((unitConvert.Factor * inventSum.Received),0);
inventSum2.VBS_2ndDeducted = decround ((unitConvert.Factor * inventSum.Deducted),0);
inventSum2.VBS_2ndRegistered = decround ((unitConvert.Factor * inventSum.Registered),0);
inventSum2.VBS_2ndPicked = decround ((unitConvert.Factor * inventSum.Picked),0);
inventSum2.update();
}
ttscommit;
// ttscommit;
}
// print "---";
// return this.VBS_2ndPostedQty + this.VBS_2ndReceived - this.VBS_2ndDeducted + this.VBS_2ndRegistered - this.VBS_2ndPicked;
}
info("Finish");
}
สมัครสมาชิก:
ส่งความคิดเห็น (Atom)
ไม่มีความคิดเห็น:
แสดงความคิดเห็น