@ -96,32 +96,32 @@ RecordVersion,OutWorkOrderFlag,ProjectID,OrderType,AuthRuleID,bu)
select a.site,b.ItemNo,a.item_no_mat as BOMItemNo,a.component_partno as ComponentPartNo,
round(a.qty_assembly*b.IssureQty,2) qty_required , round(a.qty_issue,2) qty_issue,c.QtyToIssue,#{notifyNo} as notifyNo
,dbo.Get_PartDesc(a.site,a.component_partno) partDesc,Round( dbo.get_MaterialOnUse(a.site,a.order_no,a.item_no,a.component_partno),3) qtyOnHand,
round(sum(h.qty_on_hand),2) stockQty
round(sum(h.qty_on_hand),2) stockQty,c.remark
from so_bom a
left join SOIssueNotifyOrderList b on a.site=b.site and b.NotifyNo=#{notifyNo} and b.seqNo=#{seqno}
left join SOIssueNotifyOrderMaterialList c on a.site=c.site and a.item_no_mat=c.BOMItemNo and c.NotifyNo=#{notifyNo} and c.itemNo=b.itemNo
left join view_custdev_currentstock h on a.site=h.site and a.component_partno=h.part_no
<!-- left join SOIssueNotifyOrderList d on a.site=d.site and c.NotifyNo=d.NotifyNo and c.itemNo=d.itemNo -->
where a.site=#{site} and a.order_no=#{orderno} and a.item_no=#{itemno,jdbcType=DOUBLE} and a.control_mes='Y'
group by a.site,b.ItemNo,a.item_no_mat,a.component_partno,a.qty_assembly,b.IssureQty,a.qty_issue,c.QtyToIssue,a.order_no,a.item_no,a.control_mes
UNION all
select b.site,b.ItemNo,c.BOMItemNo,c.ComponentPartNo,
null as qty_required , null qty_issue,c.QtyToIssue,#{notifyNo} as notifyNo
,dbo.Get_PartDesc(c.site,c.ComponentPartNo) partDesc,Round( dbo.get_MaterialOnUse(b.site,b.SOOrderNo ,b.OpsItemNo,c.ComponentPartNo),3) qtyOnHand,
round(sum(h.qty_on_hand),2) stockQty
from SOIssueNotifyOrderList b
left join SOIssueNotifyOrderMaterialList c on b.site=c.site and c.NotifyNo=#{notifyNo} and c.itemNo=b.itemNo
left join so_bom a on a.site=b.site and a.order_no=b.SOOrderNo and a.item_no=b.OpsItemNo and a.control_mes='Y'
and a.component_partno=c.ComponentPartNo
left join view_custdev_currentstock h on c.site=h.site and c.ComponentPartNo=h.part_no
WHERE b.NotifyNo=#{notifyNo} and b.seqNo=#{seqno} and b.site=#{site} and a.item_no_mat is null and c.ComponentPartNo is not null
group by b.site,b.ItemNo,c.BOMItemNo,c.ComponentPartNo,c.QtyToIssue,c.site,b.SOOrderNo ,b.OpsItemNo
group by a.site,b.ItemNo,a.item_no_mat,a.component_partno,a.qty_assembly,b.IssureQty,a.qty_issue,c.QtyToIssue,a.order_no,a.item_no,a.control_mes,c.remark
<!-- UNION all -->
<!-- select b.site,b.ItemNo,c.BOMItemNo,c.ComponentPartNo, -->
<!-- null as qty_required , null qty_issue,c.QtyToIssue,#{notifyNo} as notifyNo -->
<!-- ,dbo.Get_PartDesc(c.site,c.ComponentPartNo) partDesc,Round( dbo.get_MaterialOnUse(b.site,b.SOOrderNo ,b.OpsItemNo,c.ComponentPartNo),3) qtyOnHand, -->
<!-- round(sum(h.qty_on_hand),2) stockQty,c.remark -->
<!-- from SOIssueNotifyOrderList b -->
<!-- left join SOIssueNotifyOrderMaterialList c on b.site=c.site and c.NotifyNo=#{notifyNo} and c.itemNo=b.itemNo -->
<!-- left join so_bom a on a.site=b.site and a.order_no=b.SOOrderNo and a.item_no=b.OpsItemNo and a.control_mes='Y' -->
<!-- and a.component_partno=c.ComponentPartNo -->
<!-- left join view_custdev_currentstock h on c.site=h.site and c.ComponentPartNo=h.part_no -->
<!-- WHERE b.NotifyNo=#{notifyNo} and b.seqNo=#{seqno} and b.site=#{site} and a.item_no_mat is null and c.ComponentPartNo is not null -->
<!-- group by b.site,b.ItemNo,c.BOMItemNo,c.ComponentPartNo,c.QtyToIssue,c.site,b.SOOrderNo ,b.OpsItemNo,c.remark -->
</select>
<select id= "searchOtherPart" resultType= "SOIssueNotifyOrderMaterialListData" >
select NotifyNo,Site,ItemNo,BOMItemNo,ComponentPartNo,QtyToIssue,QtyToIssue_Original,issueType
,dbo.Get_PartDesc(site,ComponentPartNo) partDesc
,dbo.Get_PartDesc(site,ComponentPartNo) partDesc,remark
from SOIssueNotifyOrderMaterialList where NotifyNo=#{notifyNo} and site=#{site} and issueType=#{issueType}
</select>
<select id= "getNextItemForSOIssueNotifyOrderList" resultType= "Double" >
@ -138,18 +138,18 @@ RecordVersion,OutWorkOrderFlag,ProjectID,OrderType,AuthRuleID,bu)
</delete>
<insert id= "batchSaveSOIssueNotifyOrderMaterialListData" >
insert into SOIssueNotifyOrderMaterialList (NotifyNo,Site,ItemNo,BOMItemNo,ComponentPartNo,QtyToIssue,QtyToIssue_Original,issueType)
insert into SOIssueNotifyOrderMaterialList (NotifyNo,Site,ItemNo,BOMItemNo,ComponentPartNo,QtyToIssue,QtyToIssue_Original,issueType,remark )
values
<foreach collection= "list" separator= "," item= "item" >
(#{item.notifyNo},#{item.site},#{item.itemNo},#{item.bOMItemNo},#{item.componentPartNo},#{item.qtyToIssue},0,#{item.issueType})
(#{item.notifyNo},#{item.site},#{item.itemNo},#{item.bOMItemNo},#{item.componentPartNo},#{item.qtyToIssue},0,#{item.issueType},#{item.remark} )
</foreach>
</insert>
<insert id= "saveSOIssueNotifyOrderMaterialListData" >
insert into SOIssueNotifyOrderMaterialList (NotifyNo,Site,ItemNo,BOMItemNo,ComponentPartNo,QtyToIssue,QtyToIssue_Original,issueType)
insert into SOIssueNotifyOrderMaterialList (NotifyNo,Site,ItemNo,BOMItemNo,ComponentPartNo,QtyToIssue,QtyToIssue_Original,issueType,remark )
values
(#{notifyNo},#{site},#{itemNo},#{bOMItemNo},#{componentPartNo},#{qtyToIssue},0,#{issueType})
(#{notifyNo},#{site},#{itemNo},#{bOMItemNo},#{componentPartNo},#{qtyToIssue},0,#{issueType},#{remark} )
</insert>
@ -220,11 +220,11 @@ RecordVersion,OutWorkOrderFlag,ProjectID,OrderType,AuthRuleID,bu)
<select id= "searchNotifyMaterialList" resultType= "SOIssueNotifyOrderMaterialListData" >
select a.NotifyNo,a.Site,a.ItemNo,a.BOMItemNo,a.ComponentPartNo,a.QtyToIssue,a.QtyToIssue_Original
,b.FGPartNo,b.OpsItemNo,b.SOOrderNo orderNo,b.SeqNo, dbo.Get_PartDesc(a.site,a.ComponentPartNo) partDesc
,b.locationNo,a.issueType
,b.locationNo,a.issueType,b.needDate
from SOIssueNotifyOrderMaterialList a
left join SOIssueNotifyOrderList b on a.site=b.site and a.NotifyNo=b.NotifyNo and a.ItemNo=b.ItemNo
where a.NotifyNo=#{notifyNo} and a.site=#{site}
order by a.ItemNo
order by b.needDate, a.ItemNo
</select>
<select id= "searchSumNotifyMaterialList" resultType= "SOIssueNotifyOrderMaterialListData" >