新增盘点单-录入产品:结余数量错误

dev
黄泽腾 2 years ago
parent c5f47f8139
commit cf543f8228

@ -6,34 +6,34 @@
<select id="filterList" resultType="com.glxp.api.res.inv.InvProductResponse" <select id="filterList" resultType="com.glxp.api.res.inv.InvProductResponse"
parameterType="com.glxp.api.req.inv.FilterInvProductRequest"> parameterType="com.glxp.api.req.inv.FilterInvProductRequest">
select ip.id, select ip.id,
ip.nameCode, ip.nameCode,
bp.cpmctymc, bp.cpmctymc,
bp.measname, bp.measname,
ip.relIdFk, ip.relIdFk,
bp.ggxh, bp.ggxh,
ip.batchNo, ip.batchNo,
ip.productionDate, ip.productionDate,
ip.expireDate, ip.expireDate,
bp.ylqxzcrbarmc, bp.ylqxzcrbarmc,
bp.zczbhhzbapzbh, bp.zczbhhzbapzbh,
sum(ip.inCount) as inCount, sum(ip.inCount) as inCount,
sum(ip.outCount) as outCount, sum(ip.outCount) as outCount,
sum(ip.reCount) as reCount, sum(ip.reCount) as reCount,
ip.customerId, ip.customerId,
basic_corp.name supName, basic_corp.name supName,
ip.supId, ip.supId,
auth_dept.name deptName, auth_dept.name deptName,
auth_warehouse.name invName, auth_warehouse.name invName,
ip.deptCode, ip.deptCode,
ip.invCode, ip.invCode,
as.name spaceName as.name spaceName
from inv_product ip from inv_product ip
inner join basic_udirel on ip.relIdFk = basic_udirel.id inner join basic_udirel on ip.relIdFk = basic_udirel.id
inner join basic_products bp on basic_udirel.uuid = bp.uuid inner join basic_products bp on basic_udirel.uuid = bp.uuid
left join basic_corp on ip.supId = basic_corp.erpId left join basic_corp on ip.supId = basic_corp.erpId
left join auth_dept on auth_dept.code = ip.deptCode left join auth_dept on auth_dept.code = ip.deptCode
left join auth_warehouse on auth_warehouse.code = ip.invCode left join auth_warehouse on auth_warehouse.code = ip.invCode
left join auth_space `as` on ip.invSpaceCode = `as`.code left join auth_space `as` on ip.invSpaceCode = `as`.code
<where> <where>
bp.diType = 1 bp.diType = 1
<if test="cpmctymc != null and cpmctymc != ''"> <if test="cpmctymc != null and cpmctymc != ''">
@ -91,26 +91,26 @@
<select id="stockStatistics" resultType="com.glxp.api.res.inv.InvProductResponse"> <select id="stockStatistics" resultType="com.glxp.api.res.inv.InvProductResponse">
select bp.cpmctymc, select bp.cpmctymc,
bp.nameCode, bp.nameCode,
bp.ylqxzcrbarmc, bp.ylqxzcrbarmc,
bp.zczbhhzbapzbh, bp.zczbhhzbapzbh,
bc.name supName, bc.name supName,
bp.ggxh, bp.ggxh,
aw.name invName, aw.name invName,
ip.batchNo, ip.batchNo,
ip.relIdFk, ip.relIdFk,
ip.productionDate, ip.productionDate,
ip.expireDate, ip.expireDate,
ip.customerId, ip.customerId,
ip.supId, ip.supId,
sum(ip.inCount) inCount, sum(ip.inCount) inCount,
sum(ip.outCount) outCount, sum(ip.outCount) outCount,
sum(ip.reCount) reCount sum(ip.reCount) reCount
from inv_product ip from inv_product ip
inner join basic_udirel bu on ip.relIdFk = bu.id inner join basic_udirel bu on ip.relIdFk = bu.id
inner join basic_products bp on bu.uuid = bp.uuid inner join basic_products bp on bu.uuid = bp.uuid
left join basic_corp bc on ip.supId = bc.erpId left join basic_corp bc on ip.supId = bc.erpId
left join auth_warehouse aw on aw.code = ip.invCode left join auth_warehouse aw on aw.code = ip.invCode
<where> <where>
bp.diType = 1 bp.diType = 1
<if test="cpmctymc != null and cpmctymc != ''"> <if test="cpmctymc != null and cpmctymc != ''">
@ -150,11 +150,11 @@
<select id="getMAInvProducts" resultType="com.glxp.api.res.inv.InvProductResponse"> <select id="getMAInvProducts" resultType="com.glxp.api.res.inv.InvProductResponse">
select ip.id, bp.nameCode, bp.cpmctymc, bp.ggxh, ip.batchNo, ip.productionDate, ip.expireDate select ip.id, bp.nameCode, bp.cpmctymc, bp.ggxh, ip.batchNo, ip.productionDate, ip.expireDate
from inv_product ip from inv_product ip
left join inv_product_detail ipd left join inv_product_detail ipd
on ip.relIdFk = ipd.relId and on ip.relIdFk = ipd.relId and
ifnull(ip.batchNo, 'empty') = ifnull(ipd.batchNo, 'empty') ifnull(ip.batchNo, 'empty') = ifnull(ipd.batchNo, 'empty')
left join basic_udirel bu on bu.id = ip.relIdFk left join basic_udirel bu on bu.id = ip.relIdFk
left join basic_products bp on bu.uuid = bp.uuid left join basic_products bp on bu.uuid = bp.uuid
<where> <where>
(ip.inCount - ip.outCount) > 0 (ip.inCount - ip.outCount) > 0
<if test="nameCode != null and nameCode != ''"> <if test="nameCode != null and nameCode != ''">
@ -182,10 +182,10 @@
<select id="selectProductInfo" resultType="com.glxp.api.entity.inv.InvProductEntity"> <select id="selectProductInfo" resultType="com.glxp.api.entity.inv.InvProductEntity">
select ip.* select ip.*
from inv_product ip from inv_product ip
left join inv_product_detail ipd on ip.relIdFk = ipd.relId left join inv_product_detail ipd on ip.relIdFk = ipd.relId
and ifnull(ip.batchNo, 'empty') = ifnull(ipd.batchNo, 'empty') and ifnull(ip.batchNo, 'empty') = ifnull(ipd.batchNo, 'empty')
and ip.deptCode = ipd.deptCode and ip.deptCode = ipd.deptCode
and ip.invCode = ipd.invCode and ip.invCode = ipd.invCode
<where> <where>
<if test="relId != null and relId != ''"> <if test="relId != null and relId != ''">
AND ip.relIdFk = #{relId} AND ip.relIdFk = #{relId}
@ -208,22 +208,23 @@
<select id="getCountInvProduct" resultType="com.glxp.api.res.inv.InvProductResponse"> <select id="getCountInvProduct" resultType="com.glxp.api.res.inv.InvProductResponse">
select inv_product_detail.id, select inv_product_detail.id,
inv_product.relIdFk, inv_product.relIdFk,
inv_product.nameCode, inv_product.nameCode,
inv_product.batchNo, inv_product.batchNo,
inv_product.productionDate, inv_product.productionDate,
inv_product.expireDate, inv_product.expireDate,
basic_products.ggxh, basic_products.ggxh,
inv_product.inCount, inv_product.inCount,
inv_product.outCount, inv_product.outCount,
sum(inv_product.inCount - inv_product.outCount) reCount, inv_product.reCount,
basic_products.cpmctymc -- sum(inv_product.inCount - inv_product.outCount) reCount,
basic_products.cpmctymc
from inv_product_detail from inv_product_detail
left join inv_product on inv_product_detail.relId = inv_product.relIdFk left join inv_product on inv_product_detail.relId = inv_product.relIdFk
and inv_product.invCode = inv_product_detail.invCode and inv_product.invCode = inv_product_detail.invCode
AND IFNULL(inv_product.batchNo, 'empty') = IFNULL(inv_product_detail.batchNo, 'empty') AND IFNULL(inv_product.batchNo, 'empty') = IFNULL(inv_product_detail.batchNo, 'empty')
left join basic_udirel on inv_product_detail.relId = basic_udirel.id left join basic_udirel on inv_product_detail.relId = basic_udirel.id
left join basic_products on basic_products.uuid = basic_udirel.uuid left join basic_products on basic_products.uuid = basic_udirel.uuid
<where> <where>
<if test="invCode != null and invCode != ''"> <if test="invCode != null and invCode != ''">
AND inv_product_detail.invCode = #{invCode} AND inv_product_detail.invCode = #{invCode}
@ -246,19 +247,19 @@
<select id="selectInvProductInfo" resultType="com.glxp.api.entity.inv.InvProductEntity"> <select id="selectInvProductInfo" resultType="com.glxp.api.entity.inv.InvProductEntity">
select ip.relIdFk, select ip.relIdFk,
ip.deptCode, ip.deptCode,
ip.invCode, ip.invCode,
ipd.invSpaceCode, ipd.invSpaceCode,
ip.batchNo, ip.batchNo,
ip.productionDate, ip.productionDate,
ip.expireDate, ip.expireDate,
ip.supId, ip.supId,
ip.inCount, ip.inCount,
ip.outCount, ip.outCount,
ip.reCount ip.reCount
from inv_product ip from inv_product ip
left join inv_product_detail ipd left join inv_product_detail ipd
on ip.relIdFk = ipd.relId and ifnull(ip.batchNo, 'empty') = ifnull(ipd.batchNo, 'empty') on ip.relIdFk = ipd.relId and ifnull(ip.batchNo, 'empty') = ifnull(ipd.batchNo, 'empty')
<where> <where>
<if test="invCode != null and invCode != ''"> <if test="invCode != null and invCode != ''">
AND ip.invCode = #{invCode} AND ip.invCode = #{invCode}
@ -276,10 +277,10 @@
<select id="filterProductNames" resultType="com.glxp.api.res.inv.InvProductResponse"> <select id="filterProductNames" resultType="com.glxp.api.res.inv.InvProductResponse">
select ip.relIdFk, bp.cpmctymc, bp.ggxh select ip.relIdFk, bp.cpmctymc, bp.ggxh
from inv_product ip from inv_product ip
left join inv_product_detail ipd on ip.relIdFk = ipd.relId and ip.invCode = ipd.invCode and left join inv_product_detail ipd on ip.relIdFk = ipd.relId and ip.invCode = ipd.invCode and
ifnull(ip.batchNo, 'empty') = ifnull(ipd.batchNo, 'empty') ifnull(ip.batchNo, 'empty') = ifnull(ipd.batchNo, 'empty')
left join basic_udirel bu on bu.id = ip.relIdFk left join basic_udirel bu on bu.id = ip.relIdFk
left join basic_products bp on bp.uuid = bu.uuid left join basic_products bp on bp.uuid = bu.uuid
<where> <where>
<if test="cpmctymc != null and cpmctymc != ''"> <if test="cpmctymc != null and cpmctymc != ''">
AND bp.cpmctymc like concat('%', #{cpmctymc}, '%') AND bp.cpmctymc like concat('%', #{cpmctymc}, '%')
@ -297,33 +298,33 @@
<select id="filterProductList" resultType="com.glxp.api.res.inv.InvProductResponse" <select id="filterProductList" resultType="com.glxp.api.res.inv.InvProductResponse"
parameterType="com.glxp.api.req.inv.FilterInvProductRequest"> parameterType="com.glxp.api.req.inv.FilterInvProductRequest">
select ip.id, select ip.id,
ip.nameCode, ip.nameCode,
bp.cpmctymc, bp.cpmctymc,
ip.relIdFk, ip.relIdFk,
bp.ggxh, bp.ggxh,
ip.batchNo, ip.batchNo,
ip.productionDate, ip.productionDate,
ip.expireDate, ip.expireDate,
bp.ylqxzcrbarmc, bp.ylqxzcrbarmc,
bp.zczbhhzbapzbh, bp.zczbhhzbapzbh,
sum(ip.inCount) as inCount, sum(ip.inCount) as inCount,
sum(ip.outCount) as outCount, sum(ip.outCount) as outCount,
sum(ip.reCount) as reCount, sum(ip.reCount) as reCount,
ip.customerId, ip.customerId,
basic_corp.name supName, basic_corp.name supName,
ip.supId, ip.supId,
auth_dept.name deptName, auth_dept.name deptName,
auth_warehouse.name invName, auth_warehouse.name invName,
ip.deptCode, ip.deptCode,
ip.invCode ip.invCode
from inv_product ip from inv_product ip
inner join basic_udirel on ip.relIdFk = basic_udirel.id inner join basic_udirel on ip.relIdFk = basic_udirel.id
inner join basic_products bp on basic_udirel.uuid = bp.uuid inner join basic_products bp on basic_udirel.uuid = bp.uuid
left join basic_corp on ip.supId = basic_corp.erpId left join basic_corp on ip.supId = basic_corp.erpId
left join auth_dept on auth_dept.code = ip.deptCode left join auth_dept on auth_dept.code = ip.deptCode
left join auth_warehouse on auth_warehouse.code = ip.invCode left join auth_warehouse on auth_warehouse.code = ip.invCode
left join inv_product_detail ipd on ip.invCode = ipd.invCode and ip.relIdFk = ipd.relId and left join inv_product_detail ipd on ip.invCode = ipd.invCode and ip.relIdFk = ipd.relId and
ifnull(ip.batchNo, 'empty') = ifnull(ipd.batchNo, 'empty') ifnull(ip.batchNo, 'empty') = ifnull(ipd.batchNo, 'empty')
<where> <where>
bp.diType = 1 bp.diType = 1
<if test="cpmctymc != null and cpmctymc != ''"> <if test="cpmctymc != null and cpmctymc != ''">

Loading…
Cancel
Save