วันเสาร์ที่ 27 ตุลาคม พ.ศ. 2555
Group -> ( Sum && While Select +=Sum )
static void Q_Eff_Report_Excel(Args _args)
{
// SWAN_Machine_Capacity _SWAN_Machine_Capacity;
ProdJournalTable _ProdJournalTable;
ProdJournalRoute _ProdJournalRoute;
counter counter;
ProdJournalTable _ProdJournalTable2;
ProdJournalRoute _ProdJournalRoute2;
// sum(QtyGood)
ProdJournalTable _ProdJournalTable3;
ProdJournalRoute _ProdJournalRoute3;
// sum(Target)
ProdJournalTable _ProdJournalTable4;
ProdJournalRoute _ProdJournalRoute4;
// SWAN_Machine_Capacity _SWAN_Machine_Capacity2;
;
// while
// select * from _SWAN_Machine_Capacity
// order by _SWAN_Machine_Capacity.MachineNo
// group by _SWAN_Machine_Capacity.MachineNo
// where _SWAN_Machine_Capacity.MachineNo Like "C*"
// {
// print "<---------------";
// print _SWAN_Machine_Capacity.MachineNo;
// pause;
while select _ProdJournalTable
order by _ProdJournalTable.MachineNo, _ProdJournalTable.Team, _ProdJournalRoute.ActualCap asc //, _ProdJournalRoute.WrkCtrId
group by _ProdJournalTable.MachineNo, _ProdJournalTable.Team, _ProdJournalRoute.ActualCap//, _ProdJournalRoute.WrkCtrId
where _ProdJournalTable.MachineNo Like "C*"
join _ProdJournalRoute
where _ProdJournalRoute.JournalId == _ProdJournalTable.JournalId
&& _ProdJournalRoute.JobStatus == "Working"
// && _ProdJournalRoute.TransDate == mkDate(13,07,12)
// && _ProdJournalRoute.WrkCtrId == _ProdJournalTable.WrkCtrId
{
print _ProdJournalTable.MachineNo; // << Alert! Mandatory
print _ProdJournalTable.Team; // << Alert! Mandatory
print _ProdJournalRoute.ActualCap; // << Alert! Mandatory
// print _ProdJournalRoute.JobStatus;
// print _ProdJournalRoute.WrkCtrId;
counter++;
// print "--------------->";
print "---------";
pause;
while select _ProdJournalTable2
join _ProdJournalRoute2
where _ProdJournalRoute2.JournalId == _ProdJournalTable2.JournalId
&& _ProdJournalTable2.MachineNo == _ProdJournalTable.MachineNo
&& _ProdJournalTable2.Team == _ProdJournalTable.Team
&& _ProdJournalRoute2.ActualCap == _ProdJournalRoute.ActualCap
{
print " ---------";
print _ProdJournalTable2.MachineNo; // << Alert! Mandatory
print _ProdJournalTable2.Team; // << Alert! Mandatory
print _ProdJournalRoute2.ActualCap; // << Alert! Mandatory
print "QtyGood";
print _ProdJournalRoute2.QtyGood;
print "Target";
print _ProdJournalRoute2.Target;
}
select sum(QtyGood) from _ProdJournalRoute3
where _ProdJournalRoute3.ActualCap == _ProdJournalRoute.ActualCap
join _ProdJournalTable3
where _ProdJournalRoute3.JournalId == _ProdJournalTable3.JournalId
&& _ProdJournalTable3.MachineNo == _ProdJournalTable.MachineNo
&& _ProdJournalTable3.Team == _ProdJournalTable.Team;
print "SUM(QtyGood)";
print _ProdJournalRoute3.QtyGood;
select sum(Target) from _ProdJournalRoute4
where _ProdJournalRoute4.ActualCap == _ProdJournalRoute.ActualCap
join _ProdJournalTable4
where _ProdJournalRoute4.JournalId == _ProdJournalTable4.JournalId
&& _ProdJournalTable4.MachineNo == _ProdJournalTable.MachineNo
&& _ProdJournalTable4.Team == _ProdJournalTable.Team;
print "SUM(Target)";
print _ProdJournalRoute4.Target;
print SWAN_TimePlus::Plus(0.5,0.55);
print _ProdJournalRoute.JobStatus;
pause;
/*
_JobStatusId = _ProdJournalRoute.JobStatus;
rBuffsum = rSumWorkingTime; rSumWorkingTime = 0;
rSumWorkingTime += element.TimePlus(rBuffsum, _ProdJournalRoute.SWAN_HourUse);
rSumQtyGood += _ProdJournalRoute.QtyGood;
rSumTarget += _ProdJournalRoute.Target;
rSumHoldProcess += _ProdJournalRoute.HoldProd;
rSumHoldMaterial += _ProdJournalRoute.HoldMat;
rSumWaste += _ProdJournalRoute.QtyError;
rBuffsum = rSumInternalDowntime; rSumInternalDowntime = 0;
rSumInternalDowntime += element.TimePlus(rBuffsum, _ProdJournalRoute.TimeInternal);
rBuffsum = rSumExternalDowntime; rSumExternalDowntime = 0;
rSumExternalDowntime += element.TimePlus(rBuffsum, _ProdJournalRoute.TimeExternal);
*/
}
print counter;
pause;
// }
// << What!
// How .MachineNo relation with .WrkCtrId ?
// >>
}
สมัครสมาชิก:
ส่งความคิดเห็น (Atom)
ไม่มีความคิดเห็น:
แสดงความคิดเห็น