P.PartDescription+'/'+isnull(P.Spec,'') PartDescription,P.Spec,isnull(SL.scheduledQty,0) as scheduledQty,s.workCenterNo,S.qtyReported,S.qtyApprove,S.machSetupTime,
P.PartDescription+'/'+isnull(P.Spec,'') PartDescription,P.Spec,isnull(SL.scheduledQty,0) as scheduledQty,s.workCenterNo,S.qtyReported,S.qtyApprove,S.machSetupTime,
LEFT JOIN Part P ON P.PartNo=a.PartNo AND a.site=P.Site
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 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 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)
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)
left join user_work_center uwc on a.site=uwc.site and s.workCenterNo =uwc.WorkCenterNo and uwc.userId=#{userId}
left join user_work_center uwc on a.site=uwc.site and s.workCenterNo =uwc.WorkCenterNo and uwc.userId=#{userId}
left join CODetail cod on a.site=cod.site and a.orderRef1=cod.OrderNo and a.orderRef2= CONVERT(VARCHAR(10),cod.ItemNo)
<where>
<where>
and uwc.WorkCenterNo is not null
and uwc.WorkCenterNo is not null
and a.E_Levels =0
and a.E_Levels =0
@ -249,6 +250,12 @@
</if>
</if>
<iftest="endDate3 != null ">
<iftest="endDate3 != null ">
AND #{endDate3} >= a.NeedDate
AND #{endDate3} >= a.NeedDate
</if>
<iftest="startDate4 != null ">
AND cod.PlanShipDate >= #{startDate4}
</if>
<iftest="endDate4 != null ">
AND #{endDate4} >= cod.PlanShipDate
</if>
</if>
<iftest="partNo != null and partNo != ''">
<iftest="partNo != null and partNo != ''">
AND a.PartNo LIKE #{partNo}
AND a.PartNo LIKE #{partNo}
@ -271,12 +278,14 @@
select a.site, a.OrderNo,a.PartNo,a.Status,a.OrderRef1,a.OrderDate,a.OrderQty as LotSize,
select a.site, a.OrderNo,a.PartNo,a.Status,a.OrderRef1,a.OrderDate,a.OrderQty as LotSize,
P.PartDescription+'/'+isnull(P.Spec,'') PartDescription,P.Spec,isnull(SL.scheduledQty,0) as scheduledQty,s.workCenterNo,S.machSetupTime,
P.PartDescription+'/'+isnull(P.Spec,'') PartDescription,P.Spec,isnull(SL.scheduledQty,0) as scheduledQty,s.workCenterNo,S.machSetupTime,
S.machRunFactor,S.factorUnit,S.ItemNo,S.OperationDesc,s.Efficiency,a.qtyfinished,a.finishFlag,ROUND(dbo.Get_PartWeightFactorForReport(a.site,a.PartNo,a.OrderRef1)*a.OrderQty,2) as weight,
S.machRunFactor,S.factorUnit,S.ItemNo,S.OperationDesc,s.Efficiency,a.qtyfinished,a.finishFlag,ROUND(dbo.Get_PartWeightFactorForReport(a.site,a.PartNo,a.OrderRef1)*a.OrderQty,2) as weight,
dbo.Get_PartWeightFactorForReport(a.site,a.PartNo,a.OrderRef1) as weightFactor,dbo.Get_PartPlanQty(a.site,a.PartNo,a.OrderRef1) partPlanQty
dbo.Get_PartWeightFactorForReport(a.site,a.PartNo,a.OrderRef1) as weightFactor,dbo.Get_PartPlanQty(a.site,a.PartNo,a.OrderRef1) partPlanQty,so.needDate,cod.PlanShipDate
FROM SOTaskOrderHeader a
FROM SOTaskOrderHeader a
LEFT JOIN Part P ON P.PartNo=a.PartNo AND a.site=P.Site
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.OrderRef1
LEFT JOIN SORouting S on S.site=a.site and S.OrderNo=a.OrderRef1
LEFT JOIN ScheduleList SL on S.site=SL.site and a.OrderNo=SL.orderNo and S.ItemNo=SL.ItemNo
LEFT JOIN ScheduleList SL on S.site=SL.site and a.OrderNo=SL.orderNo and S.ItemNo=SL.ItemNo
left join user_work_center uwc on a.site=uwc.site and s.workCenterNo =uwc.WorkCenterNo and uwc.userId=#{userId}
left join user_work_center uwc on a.site=uwc.site and s.workCenterNo =uwc.WorkCenterNo and uwc.userId=#{userId}
LEFT JOIN ShopOrder so on a.OrderRef1=so.OrderNo and a.site=so.site
left join CODetail cod on so.site=cod.site and so.orderRef1=cod.OrderNo and so.orderRef2= CONVERT(VARCHAR(10),cod.ItemNo)
<where>
<where>
and uwc.WorkCenterNo is not null
and uwc.WorkCenterNo is not null
<iftest="site != null and site != ''">
<iftest="site != null and site != ''">
@ -309,6 +318,18 @@
<iftest="finishFlag != null and finishFlag != ''">
<iftest="finishFlag != null and finishFlag != ''">