วันอาทิตย์ที่ 25 พฤศจิกายน พ.ศ. 2555
update reflesh master
real SumHoldHFP(ProdJournalRoute _ProdJournalRoute)
{
real rSumQty;
SWAN_ProdJournalRoute_Hold _SWAN_ProdJournalRoute_Hold;
SWAN_Hold_Problem _SWAN_Hold_Problem;
;
select sum(Qty) from _SWAN_ProdJournalRoute_Hold
where _SWAN_ProdJournalRoute_Hold.JobId == _ProdJournalRoute.JobId
&& _SWAN_ProdJournalRoute_Hold.JournalId == _ProdJournalRoute.JournalId
&& _SWAN_ProdJournalRoute_Hold.Sequence == _ProdJournalRoute.Sequence
join _SWAN_Hold_Problem
where _SWAN_Hold_Problem.CodeHold == _SWAN_ProdJournalRoute_Hold.Code
&& _SWAN_Hold_Problem.IDHoldGroup == "HFP";
rSumQty = _SWAN_ProdJournalRoute_Hold.Qty;
/*
callerForm = element.args().caller();
callerForm.dataSource().refresh();
callerForm.dataSource().reread();
callerForm.dataSource().research();
*/
return rSumQty;
}
SWAN_ProdJournalRoute_Hold
public void refresh()
{
ProdJournalTable _ProJournalTable;
;
select _ProJournalTable
where _ProJournalTable.JournalId == ProdJournalRoute.JournalId;
if(_ProJournalTable.Posted == NoYes::No)
{
rSumHoldHFP = element.SumHoldHFP(ProdJournalRoute);
ProdJournalRoute.HoldFP = rSumHoldHFP;
rSumHoldMAT = element.SumHoldMAT(ProdJournalRoute);
ProdJournalRoute.HoldMat = rSumHoldMAT;
rSumHoldWIP = element.SumHoldWIP(ProdJournalRoute);
ProdJournalRoute.HoldProd = rSumHoldWIP;
}
super();
}
public void delete()
{
ProdJournalTable _ProJournalTable;
;
select _ProJournalTable
where _ProJournalTable.JournalId == ProdJournalRoute.JournalId;
if(_ProJournalTable.Posted == NoYes::No)
{
rSumHoldHFP = element.SumHoldHFP(ProdJournalRoute);
ProdJournalRoute.HoldFP = rSumHoldHFP;
rSumHoldMAT = element.SumHoldMAT(ProdJournalRoute);
ProdJournalRoute.HoldMat = rSumHoldMAT;
rSumHoldWIP = element.SumHoldWIP(ProdJournalRoute);
ProdJournalRoute.HoldProd = rSumHoldWIP;
}
super();
}
วันอังคารที่ 20 พฤศจิกายน พ.ศ. 2555
คืนค่า External Downtime,External Downtime,Production Time ในProdJournalRoute
Datasource :: SWAN_ProdJournalRoute_Downtime
public void delete()
{
ProdJournalTable _ProdJournalTable;
SWAN_DownTime_Problem _SWAN_DownTime_Problem;
ProdJournalRoute _ProdJournalRoute;
;
select _ProdJournalTable
where _ProdJournalTable.JournalId == ProdJournalRoute.JournalId;
if(_ProdJournalTable.Posted == NoYes::No)
{
element.Downtime();
}
// info(strfmt("%1",SWAN_ProdJournalRoute_Downtime.HoursUse));
select _SWAN_DownTime_Problem
where _SWAN_DownTime_Problem.Code == SWAN_ProdJournalRoute_Downtime.Code_Problem;
// info(strfmt("%1",_SWAN_DownTime_Problem.TimeStatus));
select _ProdJournalRoute
where _ProdJournalRoute.JournalId == SWAN_ProdJournalRoute_Downtime.JournalId
&& _ProdJournalRoute.JobId == SWAN_ProdJournalRoute_Downtime.JobId;
// && _ProdJournalRoute.Sequence == SWAN_ProdJournalRoute_Downtime.Sequence;
if(_SWAN_DownTime_Problem.TimeStatus == 1)
{
ProdJournalRoute.TimeInternal = ProdJournalRoute.TimeInternal - SWAN_ProdJournalRoute_Downtime.HoursUse;
ProdJournalRoute.update();
ProdJournalRoute.reread();
}
else if(_SWAN_DownTime_Problem.TimeStatus == 2)
{
ProdJournalRoute.TimeExternal = ProdJournalRoute.TimeExternal - SWAN_ProdJournalRoute_Downtime.HoursUse;
ProdJournalRoute.ProTime = ProdJournalRoute.ProTime + SWAN_ProdJournalRoute_Downtime.HoursUse;
ProdJournalRoute.update();
ProdJournalRoute.reread();
}
// info(strfmt("%1",_ProdJournalRoute.ProTime));
super();
}
วันศุกร์ที่ 9 พฤศจิกายน พ.ศ. 2555
Update inventTrans From InventJournalTrans(Transfer)
static void UpdateTransactionFromInventJournalTrans(Args _args)
{
InventTrans inventTrans;
InventJournalTrans injts;
InventJournalTable injt;
;
ttsbegin;
while select forupdate inventTrans
join injts
where injts.InventTransId == inventTrans.InventTransId
join injt
where injt.JournalId == injts.JournalId
//&& injt.JournalId == "IV12-32167"
&& injt.JournalNameId == "IRON-R12"
// && injt.JournalNameId == "IRON-W12"
{
print injts.InventTransId;
print inventTrans.InventTransId;
print injts.ItemId;
print inventTrans.ItemId;
print injts.VBS_2ndQty;
print inventTrans.VBS_2ndQty;
// pause;
inventTrans.VBS_2ndQty = injts.VBS_2ndQty;
inventTrans.update();
}
while select forupdate inventTrans
join injts
where injts.ToInventTransId == inventTrans.InventTransId
join injt
where injt.JournalId == injts.JournalId
// && injt.JournalId == "IV12-32167"
&& injt.JournalNameId == "IRON-R12"
// && injt.JournalNameId == "IRON-W12"
{
print injts.InventTransId;
print inventTrans.InventTransId;
print injts.ItemId;
print inventTrans.ItemId;
print -1*injts.VBS_2ndQty;
print inventTrans.VBS_2ndQty;
//pause;
inventTrans.VBS_2ndQty = -1*injts.VBS_2ndQty;
inventTrans.update();
}
ttscommit;
info("Finished");
}
วันพฤหัสบดีที่ 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)