|
|
|
@ -307,26 +307,42 @@ |
|
|
|
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 |
|
|
|
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 |
|
|
|
, 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 |
|
|
|
, 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 |
|
|
|
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 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 |
|
|
|
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 = '生产订单' |
|
|
|
@ -357,7 +373,8 @@ |
|
|
|
and S.ItemNo = #{itemNo} |
|
|
|
</if> |
|
|
|
<if test="partDescription != null and partDescription != ''"> |
|
|
|
and P.Spec+'/'+isnull(P.PartDescription,'') like #{partDescription} |
|
|
|
and P.Spec+'/'+isnull(P.PartDescription |
|
|
|
, '') like #{partDescription} |
|
|
|
</if> |
|
|
|
<if test="liuhuaTaskNo != null and liuhuaTaskNo != ''"> |
|
|
|
and h.orderNo like #{liuhuaTaskNo} |
|
|
|
@ -366,7 +383,8 @@ |
|
|
|
and t.partNo like #{liuhuaPartNo} |
|
|
|
</if> |
|
|
|
<if test="liuhuaPartDescSpec != null and liuhuaPartDescSpec != ''"> |
|
|
|
and dbo.Get_Part_SpecDesc(t.site,T.partno) like #{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 |
|
|
|
|