|
|
|
@ -9,25 +9,25 @@
|
|
|
|
|
ip.nameCode,
|
|
|
|
|
bp.cpmctymc,
|
|
|
|
|
bp.measname,
|
|
|
|
|
bp.bzgg,
|
|
|
|
|
COALESCE(bp.ggxh, bp.bzgg) as ggxh,
|
|
|
|
|
ip.relIdFk,
|
|
|
|
|
bp.ggxh,
|
|
|
|
|
ip.batchNo,
|
|
|
|
|
ip.productionDate,
|
|
|
|
|
ip.expireDate,
|
|
|
|
|
bp.ylqxzcrbarmc,
|
|
|
|
|
COALESCE(bp.ylqxzcrbarmc, bp.manufactory) as ylqxzcrbarmc,
|
|
|
|
|
bp.zczbhhzbapzbh,
|
|
|
|
|
ip.inCount,
|
|
|
|
|
ip.outCount,
|
|
|
|
|
ip.reCount,
|
|
|
|
|
ip.customerId,
|
|
|
|
|
basic_corp.name supName,
|
|
|
|
|
basic_corp.name supName,
|
|
|
|
|
ip.supId,
|
|
|
|
|
auth_dept.name deptName,
|
|
|
|
|
auth_warehouse.name invName,
|
|
|
|
|
auth_dept.name deptName,
|
|
|
|
|
auth_warehouse.name invName,
|
|
|
|
|
ip.deptCode,
|
|
|
|
|
ip.invCode,
|
|
|
|
|
as.name spaceName,
|
|
|
|
|
as.name spaceName,
|
|
|
|
|
bp.productsType,
|
|
|
|
|
bp.levelUnit,
|
|
|
|
|
bp.prepnUnit,
|
|
|
|
@ -54,12 +54,11 @@
|
|
|
|
|
bp.packUnit,
|
|
|
|
|
ip.price
|
|
|
|
|
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_products bp ON ip.relIdFk = (SELECT id FROM basic_udirel WHERE 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 s ON ip.invSpaceCode = s.CODE
|
|
|
|
|
<where>
|
|
|
|
|
<if test="productsType != null">
|
|
|
|
|
AND bp.productsType = #{productsType}
|
|
|
|
@ -87,9 +86,9 @@
|
|
|
|
|
</if>
|
|
|
|
|
<if test="ylqxzcrbarmc != null and ylqxzcrbarmc != ''">
|
|
|
|
|
AND (
|
|
|
|
|
bp.ylqxzcrbarmc like concat('%', #{ylqxzcrbarmc}, '%')
|
|
|
|
|
or bp.manufactory like concat('%', #{ylqxzcrbarmc}, '%')
|
|
|
|
|
)
|
|
|
|
|
bp.ylqxzcrbarmc like concat('%', #{ylqxzcrbarmc}, '%')
|
|
|
|
|
or bp.manufactory like concat('%', #{ylqxzcrbarmc}, '%')
|
|
|
|
|
)
|
|
|
|
|
</if>
|
|
|
|
|
<if test="zczbhhzbapzbh != null and zczbhhzbapzbh != ''">
|
|
|
|
|
AND bp.zczbhhzbapzbh like concat('%', #{zczbhhzbapzbh}, '%')
|
|
|
|
@ -142,15 +141,15 @@
|
|
|
|
|
</if>
|
|
|
|
|
<if test="keyWords != '' and keyWords != null">
|
|
|
|
|
AND (
|
|
|
|
|
bp.cpmctymc like concat('%', #{keyWords}, '%')
|
|
|
|
|
or ip.nameCode like concat('%', #{keyWords}, '%')
|
|
|
|
|
or bp.ggxh like concat('%', #{keyWords}, '%')
|
|
|
|
|
or bp.bzgg like concat('%', #{keyWords}, '%')
|
|
|
|
|
or bp.prepnSpec LIKE concat('%', #{keyWords}, '%')
|
|
|
|
|
or ip.batchNo like concat('%', #{keyWords}, '%')
|
|
|
|
|
or bp.zczbhhzbapzbh LIKE concat('%', #{keyWords}, '%')
|
|
|
|
|
or bp.manufactory LIKE concat('%', #{keyWords}, '%')
|
|
|
|
|
or bp.ylqxzcrbarywmc LIKE concat('%', #{keyWords}, '%'))
|
|
|
|
|
bp.cpmctymc like concat('%', #{keyWords}, '%')
|
|
|
|
|
or ip.nameCode like concat('%', #{keyWords}, '%')
|
|
|
|
|
or bp.ggxh like concat('%', #{keyWords}, '%')
|
|
|
|
|
or bp.bzgg like concat('%', #{keyWords}, '%')
|
|
|
|
|
or bp.prepnSpec LIKE concat('%', #{keyWords}, '%')
|
|
|
|
|
or ip.batchNo like concat('%', #{keyWords}, '%')
|
|
|
|
|
or bp.zczbhhzbapzbh LIKE concat('%', #{keyWords}, '%')
|
|
|
|
|
or bp.manufactory LIKE concat('%', #{keyWords}, '%')
|
|
|
|
|
or bp.ylqxzcrbarywmc LIKE concat('%', #{keyWords}, '%'))
|
|
|
|
|
</if>
|
|
|
|
|
</where>
|
|
|
|
|
GROUP BY ip.relIdFk, ip.batchNo, ip.supId, ip.price
|
|
|
|
@ -175,10 +174,10 @@
|
|
|
|
|
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 != ''">
|
|
|
|
@ -229,9 +228,9 @@
|
|
|
|
|
bp.manufactory,
|
|
|
|
|
bp.zczbhhzbapzbh
|
|
|
|
|
FROM inv_product_detail ip
|
|
|
|
|
LEFT JOIN basic_udirel bu ON bu.id = ip.relId
|
|
|
|
|
LEFT JOIN basic_products bp ON bu.uuid = bp.uuid
|
|
|
|
|
LEFT JOIN basic_corp ON ip.supId = basic_corp.erpId
|
|
|
|
|
LEFT JOIN basic_udirel bu ON bu.id = ip.relId
|
|
|
|
|
LEFT JOIN basic_products bp ON bu.uuid = bp.uuid
|
|
|
|
|
LEFT JOIN basic_corp ON ip.supId = basic_corp.erpId
|
|
|
|
|
<where>
|
|
|
|
|
<if test="nameCode != null and nameCode != ''">
|
|
|
|
|
AND bp.nameCode like concat('%', #{nameCode}, '%')
|
|
|
|
@ -268,10 +267,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}
|
|
|
|
@ -309,11 +308,11 @@
|
|
|
|
|
-- 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}
|
|
|
|
@ -347,8 +346,8 @@
|
|
|
|
|
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}
|
|
|
|
@ -366,10 +365,10 @@
|
|
|
|
|
<select id="filterProductNames" resultType="com.glxp.api.res.inv.InvProductResponse">
|
|
|
|
|
select ip.relIdFk, bp.cpmctymc, bp.ggxh, bp.ylqxzcrbarmc, bp.zczbhhzbapzbh
|
|
|
|
|
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}, '%')
|
|
|
|
@ -408,13 +407,13 @@
|
|
|
|
|
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 != ''">
|
|
|
|
@ -498,15 +497,15 @@
|
|
|
|
|
ip.price,
|
|
|
|
|
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 basic_product_category_rel on basic_product_category_rel.relId = basic_udirel.id
|
|
|
|
|
left join basic_product_category on basic_product_category_rel.code = basic_product_category.code
|
|
|
|
|
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 basic_product_category_rel on basic_product_category_rel.relId = basic_udirel.id
|
|
|
|
|
left join basic_product_category on basic_product_category_rel.code = basic_product_category.code
|
|
|
|
|
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 != ''">
|
|
|
|
|