select Site,PartNo,BatchNo from InventoryStock where Site=#{site} and partNo=#{partNo} and WarehouseID = #{warehouseId,jdbcType=VARCHAR} and #{batchNo}>BatchNo
LEFT JOIN Part P ON P.PartNo=a.PartNo AND a.site=P.Site
LEFT JOIN SORouting S on S.site=a.site and S.OrderNo=a.orderNo
LEFT JOIN ScheduleList SL on S.site=SL.site and S.OrderNo=SL.orderNo and S.ItemNo=SL.ItemNo
LEFT JOIN SORoutingOutput SOP ON a.site=SOP.site and a.OrderNo=SOP.OrderNo and SOP.itemNo=dbo.Get_SORouting_PreviousOperationItemNo(a.site,a.OrderNo,S.itemNo)
<where>
a.E_Levels in (0,2)
<iftest="site != null and site != ''">
@ -324,12 +325,15 @@
update ScheduleList set scheduledQty=scheduledQty+#{sumQty} where Site=#{site} and OrderNo=#{orderNo} and itemNo=#{itemNo} and type=#{scheduleType}
select top 1 isnull(QtyReported,0) QtyReported,isnull(lastApproveQty,0) lastApproveQty ,dbo.Get_PartWeightFactorForReport(#{site},#{partNo},#{orderNo}) as weightFactor,dbo.Get_sfdcReportedSetupTime(#{site},#{seqNo}) as timeReported from SORouting where Site=#{site} and OrderNo=#{orderNo} and itemNo=#{itemNo}
select top 1 isnull(a.QtyReported,0) QtyReported,isnull(SOP.TotalFinishedQty,0) lastApproveQty ,dbo.Get_PartWeightFactorForReport(#{site},#{partNo},#{orderNo}) as weightFactor,dbo.Get_sfdcReportedSetupTime(#{site},#{seqNo}) as timeReported
from SORouting a
LEFT JOIN SORoutingOutput SOP ON a.site=SOP.site and a.OrderNo=SOP.OrderNo and SOP.itemNo=dbo.Get_SORouting_PreviousOperationItemNo(a.site,a.OrderNo,a.itemNo)
where a.Site=#{site} and a.OrderNo=#{orderNo} and a.itemNo=#{itemNo}
select top 1 isnull(lastApproveQty,0) lastApproveQty from SORouting where Site=#{site} and OrderNo=#{orderNo} and itemNo=#{itemNo}
select top 1 isnull(TotalFinishedQty,0) lastApproveQty from SORoutingOutput where Site=#{site} and OrderNo=#{orderNo} and itemNo=dbo.Get_SORouting_PreviousOperationItemNo(#{site},#{orderNo},#{itemNo})