Round( dbo.Get_scheduleIssure(a.Site,a.SeqNo),2) as qtyIssure,Round(a.QtyReported*dbo.Get_PartWeightFactorForReport(a.Site,a.partNo,null),2) as reportWeight,
Round(dbo.Get_scheduleIssure(a.Site,a.SeqNo) -a.QtyReported*dbo.Get_PartWeightFactorForReport(a.Site,a.partNo,null),2) as qty,
, case when isnull(a.QtyReported,0)>0 then Round(dbo.Get_scheduleIssure(a.Site,a.SeqNo) -a.QtyReported*dbo.Get_PartWeightFactorForReport(a.Site,a.partNo,null) *1000/a.QtyReported,2)
else null end as realQty ,b.itemNo,b.OperationDesc
from SOScheduledRouting a left join SoRouting b on a.site=b.site and a.orderNo=b.OrderNo and a.itemNo=b.itemNo
<where>
and a.scheduleType='生产订单派工单' and a.itemNo=10
<iftest="query.startDate != null ">
and a.S_ScheduledDate >= #{query.startDate}
</if>
<iftest="query.endDate != null ">
and #{query.endDate} >= a.S_ScheduledDate
</if>
and dbo.Get_scheduleIssure(a.Site,a.SeqNo) is not null
<iftest="query.partNo != null and query.partNo != ''">