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

dev
黄泽腾 2 years ago
parent c5f47f8139
commit cf543f8228

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

Loading…
Cancel
Save