|
|
|
@ -37,26 +37,25 @@ |
|
|
|
|
|
|
|
<select id="queryPage" resultType="com.xujie.sys.modules.pms.entity.InventoryStockVoData"> |
|
|
|
SELECT |
|
|
|
A.citem_code, |
|
|
|
min(A.id) as id, |
|
|
|
A.site, |
|
|
|
min(A.warehouse_id) AS warehouse_id, |
|
|
|
A.part_no,min(A.batch_no) as batch_no, |
|
|
|
min(A.location_id) AS location_id, |
|
|
|
sum(isnull( A.in_qty , 0 )) AS inQty, |
|
|
|
sum(isnull( A.out_qty , 0 )) AS outQty, |
|
|
|
sum(isnull( A.qty_on_hand , 0 )) AS qtyOnHand, |
|
|
|
B.part_description, |
|
|
|
min(B.spec) AS spec, |
|
|
|
B.min_stock, |
|
|
|
B.max_stock, |
|
|
|
min(A.partner_id) AS partner_id, |
|
|
|
min(A.first_in_date) AS first_in_date, |
|
|
|
B.average_price, |
|
|
|
B.umid, |
|
|
|
sum(isnull(A.qty_of_po,0)) as qty_of_po, |
|
|
|
(sum(isnull( A.qty_on_hand , 0 )) * B.average_price) as totalCost, |
|
|
|
dbo.get_bu_desc( A.site,A.citem_code) buDesc |
|
|
|
a.citem_code, |
|
|
|
min(A.id) id, |
|
|
|
A.site, |
|
|
|
min(A.warehouse_id) AS warehouse_id, |
|
|
|
A.part_no,min(A.batch_no) as batch_no, |
|
|
|
min(A.location_id) AS location_id, |
|
|
|
sum(isnull( A.in_qty , 0 )) AS inQty, |
|
|
|
sum(isnull( A.out_qty , 0 )) AS outQty, |
|
|
|
sum(isnull( A.qty_on_hand , 0 )) AS qtyOnHand, |
|
|
|
B.part_description, |
|
|
|
min(B.spec) AS spec, |
|
|
|
B.min_stock, |
|
|
|
B.max_stock, |
|
|
|
min(A.partner_id) AS partner_id, |
|
|
|
min(A.first_in_date) AS first_in_date, |
|
|
|
B.average_price, |
|
|
|
B.umid, |
|
|
|
(sum(isnull( A.qty_on_hand , 0 )) * B.average_price) as totalCost, |
|
|
|
dbo.get_bu_desc( A.site,A.citem_code) buDesc |
|
|
|
from inventory_stock A |
|
|
|
left join part_spare B on A.site = B.site and A.part_no = B.part_no and a.citem_code=b.bu_no |
|
|
|
left join accessBu D on A.site=D.site and A.citem_code=d.bu_no and D.username=#{query.username} |
|
|
|
@ -66,7 +65,7 @@ |
|
|
|
<if test="query.active != null and query.active != ''"> |
|
|
|
and B.active = #{query.active} |
|
|
|
</if> |
|
|
|
<if test="query.buNo != null and query.buNo != ''"> |
|
|
|
<if test="query.buNo != null and query.buNo != ''"> |
|
|
|
and a.citem_code = #{query.buNo} |
|
|
|
</if> |
|
|
|
<if test="query.batchNo != null and query.batchNo != ''"> |
|
|
|
@ -102,12 +101,9 @@ |
|
|
|
<if test="query.safetyStock == '安全'"> |
|
|
|
and A.qty_on_hand <![CDATA[>]]> B.min_stock |
|
|
|
</if> |
|
|
|
<if test="query.safetyStock == '不安全' and (query.securityMethod == '库存' or query.securityMethod == '' or query.securityMethod == null )"> |
|
|
|
<if test="query.safetyStock == '不安全'"> |
|
|
|
and A.qty_on_hand <![CDATA[<=]]> B.min_stock |
|
|
|
</if> |
|
|
|
<if test="query.safetyStock == '不安全' and query.securityMethod == '库存和在途'"> |
|
|
|
and A.qty_on_hand + isnull(A.qty_of_po,0.0) <![CDATA[<=]]> B.min_stock |
|
|
|
</if> |
|
|
|
</where> |
|
|
|
GROUP BY |
|
|
|
<if test="query.groupType == 0"> |
|
|
|
|