@ -365,72 +365,109 @@
</update>
</update>
<select id= "getSOTastRoutingData" resultType= "ShopOrderRoutingData" >
<select id= "getSOTastRoutingData" resultType= "ShopOrderRoutingData" >
select a.site, a.OrderNo,a.PartNo,a.Status,a.OrderRef1,a.OrderDate,a.OrderQty as LotSize,dbo.Get_PartValue(a.site,a.PartNo,'equipment') as equipment,so.RepairSOFlag,
P.Spec+'/'+isnull(P.PartDescription,'') 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(isnull(P.NetWeight/1000,1)*a.OrderQty,2) as weight,
P.NetWeight/1000 as weightFactor,dbo.Get_PartPlanQty(a.site,a.PartNo,a.OrderRef1) partPlanQty,so.needDate,cod.PlanShipDate
,a.comBineTime lastStartDate,dbo.Get_PartValue( a.site,a.PartNo,'CURING METHOD') cuiHuaJi,dbo.Get_PartValue( a.site,a.PartNo,'TIME') liuHuaShiJian,dbo.Get_PartValue( a.site,a.PartNo,'CURING METHOD') yangHuaJiType
,case when dbo.Get_PartNumberValue( a.site,a.PartNo,'PLAN-QUANTITY') is not null and dbo.Get_PartNumberValue( a.site,a.PartNo,'CAVITY') is not null
then CEILING((a.OrderQty-isnull(SL.scheduledQty,0))/(dbo.Get_PartNumberValue( a.site,a.PartNo,'PLAN-QUANTITY')*dbo.Get_PartNumberValue( a.site,a.PartNo,'CAVITY'))) else null end as banQty,
a.vpFinishFlag,dbo.Get_E_OriginalOrderTypeDesc(so.site, so.OrderNo) orderTypeDesc
select a.site,
a.OrderNo,
a.PartNo,
a.Status,
a.OrderRef1,
a.OrderDate,
a.OrderQty as LotSize,
dbo.Get_PartValue(a.site, a.PartNo, 'equipment') as equipment,
so.RepairSOFlag,
P.Spec + '/' + isnull(P.PartDescription, '') 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(isnull(P.NetWeight / 1000, 1) * a.OrderQty, 2) as weight,
P.NetWeight / 1000 as weightFactor,
dbo.Get_PartPlanQty(a.site, a.PartNo, a.OrderRef1) partPlanQty,
so.needDate,
cod.PlanShipDate
,
a.comBineTime lastStartDate,
dbo.Get_PartValue(a.site, a.PartNo, 'CURING METHOD') cuiHuaJi,
dbo.Get_PartValue(a.site, a.PartNo, 'TIME') liuHuaShiJian,
dbo.Get_PartValue(a.site, a.PartNo, 'CURING METHOD') yangHuaJiType
,
case
when dbo.Get_PartNumberValue(a.site, a.PartNo, 'PLAN-QUANTITY') is not null and
dbo.Get_PartNumberValue(a.site, a.PartNo, 'CAVITY') is not null
then CEILING((a.OrderQty - isnull(SL.scheduledQty, 0)) /
(dbo.Get_PartNumberValue(a.site, a.PartNo, 'PLAN-QUANTITY') *
dbo.Get_PartNumberValue(a.site, a.PartNo, 'CAVITY')))
else null end as banQty,
a.vpFinishFlag,
dbo.Get_E_OriginalOrderTypeDesc(so.site, so.OrderNo) orderTypeDesc
FROM SOTaskOrderHeader a
FROM SOTaskOrderHeader a
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 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 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)
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 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 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 so.status not in ('已关闭','已计划','已取消')
<if test= "site != null and site != ''" >
AND a.site = #{site}
</if>
<if test= "orderNo != null and orderNo != ''" >
AND a.OrderNo LIKE #{orderNo}
</if>
<if test= "status !=null and status != ''" >
AND a.Status IN ${status}
</if>
<if test= "startDate1 != null " >
AND a.orderDate >= #{startDate1}
</if>
<if test= "endDate1 != null " >
AND #{endDate1} >= a.orderDate
</if>
<if test= "partDescription != null and partDescription != ''" >
and P.Spec+'/'+isnull(P.PartDescription,'') like #{partDescription}
</if>
<if test= "orderRef1 != null and orderRef1 != ''" >
AND a.OrderRef1 LIKE #{orderRef1}
</if>
<if test= "partNo != null and partNo != ''" >
AND a.PartNo LIKE #{partNo}
</if>
<if test= "planStatus != null and planStatus != ''" >
and ${planStatus}
</if>
<if test= "itemNo != null and itemNo != ''" >
and S.ItemNo = #{itemNo}
</if>
<if test= "finishFlag != null and finishFlag != ''" >
AND a.FinishFlag=#{finishFlag}
</if>
<if test= "startDate3 != null " >
AND so.NeedDate >= #{startDate3}
</if>
<if test= "endDate3 != null " >
AND #{endDate3} >= so.NeedDate
</if>
<if test= "startDate4 != null " >
AND cod.PlanShipDate >= #{startDate4}
</if>
<if test= "endDate4 != null " >
AND #{endDate4} >= cod.PlanShipDate
</if>
</where>
order by case when dbo.Get_E_OriginalOrderTypeDesc(so.site, so.OrderNo) in ('变更订单','加急订单') then 1 else 2 end , a.OrderDate desc,s.itemNo
and uwc.WorkCenterNo is not null
and so.status not in ('已关闭', '已计划', '已取消')
<if test= "site != null and site != ''" >
AND a.site = #{site}
</if>
<if test= "orderNo != null and orderNo != ''" >
AND a.OrderNo LIKE #{orderNo}
</if>
<if test= "status != null and status != ''" >
AND a.Status IN ${status}
</if>
<if test= "startDate1 != null" >
AND a.orderDate >= #{startDate1}
</if>
<if test= "endDate1 != null" >
AND #{endDate1} >= a.orderDate
</if>
<if test= "partDescription != null and partDescription != ''" >
and P.Spec+'/'+isnull(P.PartDescription
, '') like #{partDescription}
</if>
<if test= "orderRef1 != null and orderRef1 != ''" >
AND a.OrderRef1 LIKE #{orderRef1}
</if>
<if test= "partNo != null and partNo != ''" >
AND a.PartNo LIKE #{partNo}
</if>
<if test= "planStatus != null and planStatus != ''" >
and ${planStatus}
</if>
<if test= "itemNo != null and itemNo != ''" >
and S.ItemNo = #{itemNo}
</if>
<if test= "finishFlag != null and finishFlag != ''" >
AND a.FinishFlag=#{finishFlag}
</if>
<if test= "startDate3 != null" >
AND so.NeedDate >= #{startDate3}
</if>
<if test= "endDate3 != null" >
AND #{endDate3} >= so.NeedDate
</if>
<if test= "startDate4 != null" >
AND cod.PlanShipDate >= #{startDate4}
</if>
<if test= "endDate4 != null" >
AND #{endDate4} >= cod.PlanShipDate
</if>
</where>
order by case when dbo.Get_E_OriginalOrderTypeDesc(so.site, so.OrderNo) in ('变更订单', '加急订单') then 1 else 2 end , a.OrderDate desc,s.itemNo
</select>
</select>
<select id= "getWorkCenterOperatorList" resultType= "OperatorData" >
<select id= "getWorkCenterOperatorList" resultType= "OperatorData" >