where status='已关闭' and ReceiveDate>=#{startDate} and #{endDate}>=ReceiveDate and MaterialSplitFlag='N'
where ( (status != '已计划' and status != '已取消' and status != '已关闭' and GetDate()> PlanStartDate ) or ( status = '已关闭' and ReceiveDate>= DateAdd(dd,-7,GetDate()) and #{endDate}>=ReceiveDate) )and MaterialSplitFlag='N'
</select>
@ -88,7 +88,7 @@
from
(
select PL.ProLineNo AS resourceId ,R.Site,isnull(Round(SUM(SR.QtyRequired),3),0) as QtyRequired,isnull(Round(SUM(SR.QtyReported),3),0) as QtyReported,isnull(Round(SUM(SR.QtyApprove),3),0) as QtyApprove,
PL.ProLineDesc as resourceDesc,isnull(Round(Round(SUM(SR.QtyRequired),3)-Round(SUM(SR.QtyReported),3),3),0) as QtyUnReported
PL.ProLineDesc as resourceDesc,isnull(Round(Round(SUM( case when 0> SR.QtyRequired-SR.QtyReported then 0 else SR.QtyRequired-SR.QtyReported end ),3),3),0) as QtyUnReported
from WorkCenter R
LEFT JOIN SOScheduledRouting SR on SR.Site=R.Site and SR.S_WorkCenterNo=R.WorkCenterNo
left join ProductionLine PL on PL.site =R.site and PL.ProLineNo=R.ProLineNo
select Round(SUM(SR.QtyRequired),3) as qty1,Round(SUM(SR.QtyRequired),3)-Round(SUM(SR.QtyReported),3) as qty4,Round(SUM(SR.QtyApprove),3) as qty2,
select Round(SUM(SR.QtyRequired),3) as qty1,Round(SUM(case when 0> SR.QtyRequired-SR.QtyReported then 0 else SR.QtyRequired-SR.QtyReported end),3) as qty4,Round(SUM(SR.QtyApprove),3) as qty2,
Round(SUM(SR.QtyReported),3) -Round(SUM(SR.QtyApprove),3) as qty3,100 as per1,
Round(Round(SUM(SR.QtyApprove),3) *100 /case when Round(SUM(SR.QtyRequired),3) =0 then 1 else Round(SUM(SR.QtyRequired),3) end ,1) as per2,
Round((Round(SUM(SR.QtyReported),3) -Round(SUM(SR.QtyApprove),3) ) *100 /case when Round(SUM(SR.QtyRequired),3) =0 then 1 else Round(SUM(SR.QtyRequired),3) end ,1) as per3,
Round((Round(SUM(SR.QtyRequired),3) -Round(SUM(SR.QtyReported),3) ) *100 /case when Round(SUM(SR.QtyRequired),3) =0 then 1 else Round(SUM(SR.QtyRequired),3) end ,1) as per4
Round((Round(SUM( case when 0> SR.QtyRequired-SR.QtyReported then 0 else SR.QtyRequired-SR.QtyReported end),3) ) *100 /case when Round(SUM(SR.QtyRequired),3) =0 then 1 else Round(SUM(SR.QtyRequired),3) end ,1) as per4
from SOScheduledRouting SR
where SR.S_ScheduledDate>DATEADD(dd, -7,#{date}) and #{date}>=SR.S_ScheduledDate and SR.ClosedFlag='Y'