|
|
|
@ -307,69 +307,87 @@ |
|
|
|
a.PlanStartDate desc,s.itemNo |
|
|
|
</select> |
|
|
|
<select id="getShopOrderRoutingVPData" resultType="ShopOrderRoutingData"> |
|
|
|
select t.OrderNo as liuhuaOrderNo,t.site,SO.PartNo,dbo.Get_Part_SpecDesc(t.site,T.partno) as liuhuaPartDescSpec,t.partNo as liuhuaPartNo |
|
|
|
,Convert(decimal(10,2),isnull(h.OrderQty * d.QtyAssembly / (1 - d.ScraptFactor/100.0),0.0)) as QtyRequired |
|
|
|
,h.OrderDate as needDate |
|
|
|
,h.orderNo as liuhuaTaskNo |
|
|
|
,case when t.Status='已取消' then '已取消' else '' end as erpStatus |
|
|
|
, so.OrderNo,s.workCenterNo,S.ItemNo,S.OperationDesc,isnull(ROUND(P.NetWeight/1000,5),1) weightFactor, |
|
|
|
Round(isnull(ROUND(P.NetWeight/1000,5),1)*isnull(h.OrderQty * d.QtyAssembly / (1 - d.ScraptFactor/100.0),0.0),2) weight |
|
|
|
, isnull(P.spec,'') +'/'+P.PartDescription as partDescription |
|
|
|
,s.OperationDesc,s.efficiency,so.RepairSOFlag,dbo.Get_E_OriginalOrderTypeDesc(t.site, t.OrderNo) orderTypeDesc |
|
|
|
select t.OrderNo as liuhuaOrderNo |
|
|
|
, t.site |
|
|
|
, SO.PartNo |
|
|
|
, dbo.Get_Part_SpecDesc(t.site, T.partno) as liuhuaPartDescSpec |
|
|
|
, t.partNo as liuhuaPartNo |
|
|
|
, Convert(decimal (10, 2), |
|
|
|
isnull(h.OrderQty * d.QtyAssembly / (1 - d.ScraptFactor / 100.0), 0.0)) as QtyRequired |
|
|
|
, h.OrderDate as needDate |
|
|
|
, h.orderNo as liuhuaTaskNo |
|
|
|
, case when t.Status = '已取消' then '已取消' else '' end as erpStatus |
|
|
|
, so.OrderNo |
|
|
|
, s.workCenterNo |
|
|
|
, S.ItemNo |
|
|
|
, S.OperationDesc |
|
|
|
, isnull(ROUND(P.NetWeight / 1000, 5), 1) weightFactor |
|
|
|
, Round(isnull(ROUND(P.NetWeight / 1000, 5), 1) * |
|
|
|
isnull(h.OrderQty * d.QtyAssembly / (1 - d.ScraptFactor / 100.0), 0.0), 2) weight |
|
|
|
, isnull(P.spec, '') + '/' + P.PartDescription as partDescription |
|
|
|
, s.OperationDesc |
|
|
|
, s.efficiency |
|
|
|
, so.RepairSOFlag |
|
|
|
, dbo.Get_E_OriginalOrderTypeDesc(t.site, t.OrderNo) orderTypeDesc |
|
|
|
|
|
|
|
from SOTaskOrderHeader as h |
|
|
|
left join ShopOrder as t on h.Site=t.Site and h.OrderRef1=t.OrderNo ---硫化的订单t |
|
|
|
left join ShopOrder as SO on t.site=SO.Site and t.orderNo=SO.Prelev_order_no and t.E_OriginalOrderType=SO.E_OriginalOrderType |
|
|
|
and (SO.PartNo like 'VP%') -----so是vp订单 |
|
|
|
left join SOBOM as d on t.Site=D.Site and T.OrderNo=D.OrderNo and D.ComponentPartNo =SO.PartNo |
|
|
|
LEFT JOIN SORouting S on S.site=SO.site and S.OrderNo=SO.OrderNo |
|
|
|
left join user_work_center uwc on s.site=uwc.site and s.workCenterNo =uwc.WorkCenterNo and uwc.userId= 'admin' |
|
|
|
left join part P on so.site=p.site and so.partNo=p.partNo |
|
|
|
|
|
|
|
left join SOTask_VPSchedule SV on h.site=SV.site and h.OrderNo=SV.TaskOrderNo and s.itemNo=sv.itemNo and so.orderNo=SV.orderNo |
|
|
|
<where> |
|
|
|
left join ShopOrder as t on h.Site = t.Site and h.OrderRef1 = t.OrderNo ---硫化的订单t |
|
|
|
left join ShopOrder as SO on t.site = SO.Site and t.orderNo = SO.Prelev_order_no and |
|
|
|
t.E_OriginalOrderType = SO.E_OriginalOrderType |
|
|
|
and (SO.PartNo like 'VP%') -----so是vp订单 |
|
|
|
left join SOBOM as d on t.Site = D.Site and T.OrderNo = D.OrderNo and D.ComponentPartNo = SO.PartNo |
|
|
|
LEFT JOIN SORouting S on S.site = SO.site and S.OrderNo = SO.OrderNo |
|
|
|
left join user_work_center uwc |
|
|
|
on s.site = uwc.site and s.workCenterNo = uwc.WorkCenterNo and uwc.userId = 'admin' |
|
|
|
left join part P on so.site = p.site and so.partNo = p.partNo |
|
|
|
left join SOTask_VPSchedule SV |
|
|
|
on h.site = SV.site and h.OrderNo = SV.TaskOrderNo and s.itemNo = sv.itemNo and |
|
|
|
so.orderNo = SV.orderNo |
|
|
|
<where> |
|
|
|
and uwc.WorkCenterNo is not null |
|
|
|
and h.OrderRefType='生产订单' |
|
|
|
and t.partNo like 'SP%' |
|
|
|
and t.Status != '已关闭' and t.Status != '已计划' |
|
|
|
and h.OrderRefType = '生产订单' |
|
|
|
and t.partNo like 'SP%' |
|
|
|
and t.Status != '已关闭' and t.Status != '已计划' |
|
|
|
and h.Status !='已取消' and so.PartNo is not null |
|
|
|
<!-- and isnull(SL.scheduledQty,0) =0--> |
|
|
|
and SV.site is null |
|
|
|
<if test="startDate1 != null "> |
|
|
|
AND h.orderDate >= #{startDate1} |
|
|
|
<if test="startDate1 != null"> |
|
|
|
AND h.orderDate >= #{startDate1} |
|
|
|
</if> |
|
|
|
<if test="endDate1 != null "> |
|
|
|
AND #{endDate1} >= h.orderDate |
|
|
|
<if test="endDate1 != null"> |
|
|
|
AND #{endDate1} >= h.orderDate |
|
|
|
</if> |
|
|
|
<if test="site != null and site != ''"> |
|
|
|
<if test="site != null and site != ''"> |
|
|
|
AND SO.site = #{site} |
|
|
|
</if> |
|
|
|
<if test="orderNo != null and orderNo != ''"> |
|
|
|
AND SO.OrderNo LIKE #{orderNo} |
|
|
|
AND SO.OrderNo LIKE #{orderNo} |
|
|
|
</if> |
|
|
|
<if test="partDescription != null and partDescription != ''"> |
|
|
|
AND isnull(P.spec,'') +'/'+P.PartDescription LIKE #{partDescription} |
|
|
|
<if test="partDescription != null and partDescription != ''"> |
|
|
|
AND isnull(P.spec, '') +'/'+P.PartDescription LIKE #{partDescription} |
|
|
|
</if> |
|
|
|
<if test="partNo != null and partNo != ''"> |
|
|
|
AND SO.PartNo LIKE #{partNo} |
|
|
|
AND SO.PartNo LIKE #{partNo} |
|
|
|
</if> |
|
|
|
<if test="itemNo != null and itemNo != ''"> |
|
|
|
and S.ItemNo = #{itemNo} |
|
|
|
</if> |
|
|
|
<if test="partDescription != null and partDescription != ''"> |
|
|
|
and P.Spec+'/'+isnull(P.PartDescription,'') like #{partDescription} |
|
|
|
<if test="partDescription != null and partDescription != ''"> |
|
|
|
and P.Spec+'/'+isnull(P.PartDescription |
|
|
|
, '') like #{partDescription} |
|
|
|
</if> |
|
|
|
<if test="liuhuaTaskNo != null and liuhuaTaskNo != ''"> |
|
|
|
<if test="liuhuaTaskNo != null and liuhuaTaskNo != ''"> |
|
|
|
and h.orderNo like #{liuhuaTaskNo} |
|
|
|
</if> |
|
|
|
<if test="liuhuaPartNo != null and liuhuaPartNo != ''"> |
|
|
|
<if test="liuhuaPartNo != null and liuhuaPartNo != ''"> |
|
|
|
and t.partNo like #{liuhuaPartNo} |
|
|
|
</if> |
|
|
|
<if test="liuhuaPartDescSpec != null and liuhuaPartDescSpec != ''"> |
|
|
|
and dbo.Get_Part_SpecDesc(t.site,T.partno) like #{liuhuaPartDescSpec} |
|
|
|
<if test="liuhuaPartDescSpec != null and liuhuaPartDescSpec != ''"> |
|
|
|
and dbo.Get_Part_SpecDesc(t.site |
|
|
|
, T.partno) like #{liuhuaPartDescSpec} |
|
|
|
</if> |
|
|
|
</where> |
|
|
|
order by case when dbo.Get_E_OriginalOrderTypeDesc(t.site, t.OrderNo) in ('变更订单','加急订单') then 1 else 2 end , h.OrderDate ,so.partNo,s.itemNo |
|
|
|
order by case when dbo.Get_E_OriginalOrderTypeDesc(t.site, t.OrderNo) in ('变更订单', '加急订单') then 1 else 2 end , h.OrderDate ,so.partNo,s.itemNo |
|
|
|
</select> |
|
|
|
<update id="updateSOTaskCombineTime"> |
|
|
|
update SOTaskOrderHeader set CombineTime = GetDate() where site=#{site} and orderNo=#{orderNo} |
|
|
|
|