|
|
|
@ -2,10 +2,10 @@
|
|
|
|
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
|
|
|
|
|
|
|
|
|
<mapper namespace="com.glxp.api.admin.dao.inventory.InvProductDetailDao">
|
|
|
|
|
|
|
|
|
|
<select id="filterInvProductDetail" parameterType="com.glxp.api.admin.req.inventory.FilterInvProductDetailRequest"
|
|
|
|
|
resultType="com.glxp.api.admin.entity.inventory.InvProductDetailEntity">
|
|
|
|
|
SELECT * FROM inv_product_detail
|
|
|
|
|
SELECT *
|
|
|
|
|
FROM inv_product_detail
|
|
|
|
|
<where>
|
|
|
|
|
<if test="productIdFk != '' and productIdFk != null">
|
|
|
|
|
AND productIdFk = #{productIdFk}
|
|
|
|
@ -27,7 +27,7 @@
|
|
|
|
|
AND purchaseType = #{purchaseType}
|
|
|
|
|
</if>
|
|
|
|
|
|
|
|
|
|
<if test="batchNo != '' and batchNo != null and batchNo!='empty'">
|
|
|
|
|
<if test="batchNo != '' and batchNo != null and batchNo != 'empty'">
|
|
|
|
|
AND batchNo = #{batchNo}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="batchNo == 'empty'">
|
|
|
|
@ -51,6 +51,9 @@
|
|
|
|
|
<if test="invWarehouseCode != '' and invWarehouseCode != null">
|
|
|
|
|
AND invWarehouseCode = #{invWarehouseCode}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="invSpaceCode != null and invSpaceCode != ''">
|
|
|
|
|
AND invSpaceCode = #{invSpaceCode}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="orderIdFk != null and orderIdFk != ''">
|
|
|
|
|
AND orderIdFk = #{orderIdFk}
|
|
|
|
|
</if>
|
|
|
|
@ -58,8 +61,9 @@
|
|
|
|
|
</select>
|
|
|
|
|
<select id="filterJoinInvProduct" parameterType="com.glxp.api.admin.req.inventory.FilterInvProductDetailRequest"
|
|
|
|
|
resultType="com.glxp.api.admin.res.inventory.InvProductDetailJoinResponse">
|
|
|
|
|
SELECT inv_product_detail.* ,io_order.fromCorp,io_order.fromCorpId FROM inv_product_detail
|
|
|
|
|
inner join io_order on inv_product_detail.orderIdFk = io_order.id
|
|
|
|
|
SELECT inv_product_detail.*, io_order.fromCorp, io_order.fromCorpId
|
|
|
|
|
FROM inv_product_detail
|
|
|
|
|
inner join io_order on inv_product_detail.orderIdFk = io_order.id
|
|
|
|
|
<where>
|
|
|
|
|
<if test="productIdFk != '' and productIdFk != null">
|
|
|
|
|
AND productIdFk = #{productIdFk}
|
|
|
|
@ -81,7 +85,7 @@
|
|
|
|
|
AND purchaseType = #{purchaseType}
|
|
|
|
|
</if>
|
|
|
|
|
|
|
|
|
|
<if test="batchNo != '' and batchNo != null and batchNo!='empty'">
|
|
|
|
|
<if test="batchNo != '' and batchNo != null and batchNo != 'empty'">
|
|
|
|
|
AND batchNo = #{batchNo}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="batchNo == 'empty'">
|
|
|
|
@ -106,6 +110,9 @@
|
|
|
|
|
<if test="invWarehouseCode != '' and invWarehouseCode != null">
|
|
|
|
|
AND invWarehouseCode = #{invWarehouseCode}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="invSpaceCode != null and invSpaceCode != ''">
|
|
|
|
|
AND invSpaceCode = #{invSpaceCode}
|
|
|
|
|
</if>
|
|
|
|
|
</where>
|
|
|
|
|
</select>
|
|
|
|
|
<insert id="insertInvProductDetail" keyProperty="id"
|
|
|
|
@ -114,31 +121,32 @@
|
|
|
|
|
(code, productIdFk, orderIdFk, customerId, mainAction, `action`, `count`, updateTime,
|
|
|
|
|
purchaseType, batchNo, productionDate, expireDate, unitFk, stockIdFk, supId, originCode,
|
|
|
|
|
invStorageCode,
|
|
|
|
|
invWarehouseCode)
|
|
|
|
|
invWarehouseCode,
|
|
|
|
|
invSpaceCode)
|
|
|
|
|
values (#{code},
|
|
|
|
|
#{productIdFk}, #{orderIdFk},
|
|
|
|
|
#{customerId}, #{mainAction}, #{action}, #{count}, #{updateTime},
|
|
|
|
|
#{purchaseType}, #{batchNo}, #{productionDate}, #{expireDate}, #{unitFk}, #{stockIdFk}, #{supId},
|
|
|
|
|
#{originCode}, #{invStorageCode}, #{invWarehouseCode})
|
|
|
|
|
#{originCode}, #{invStorageCode}, #{invWarehouseCode}, #{invSpaceCode})
|
|
|
|
|
</insert>
|
|
|
|
|
|
|
|
|
|
<insert id="insertInvProductDetails" keyProperty="id"
|
|
|
|
|
parameterType="com.glxp.api.admin.entity.inventory.InvProductDetailEntity">
|
|
|
|
|
insert INTO inv_product_detail
|
|
|
|
|
(code, productIdFk, orderIdFk, customerId, mainAction, `action`, `count`, updateTime,
|
|
|
|
|
purchaseType, batchNo, productionDate, expireDate, unitFk, stockIdFk, supId, originCode,
|
|
|
|
|
invStorageCode,
|
|
|
|
|
invWarehouseCode)
|
|
|
|
|
purchaseType, batchNo, productionDate, expireDate, unitFk, stockIdFk, supId, originCode,
|
|
|
|
|
invStorageCode,
|
|
|
|
|
invWarehouseCode, invSpaceCode)
|
|
|
|
|
values
|
|
|
|
|
|
|
|
|
|
<foreach collection="invProductDetailEntitys" item="item" index="index"
|
|
|
|
|
separator=",">
|
|
|
|
|
(#{item.code},
|
|
|
|
|
#{item.productIdFk}, #{item.orderIdFk},
|
|
|
|
|
#{item.customerId}, #{item.mainAction}, #{item.action}, #{item.count}, #{item.updateTime},
|
|
|
|
|
#{item.purchaseType}, #{item.batchNo}, #{item.productionDate}, #{item.expireDate},
|
|
|
|
|
#{item.unitFk}, #{item.stockIdFk},
|
|
|
|
|
#{item.supId}, #{item.originCode}, #{item.invStorageCode}, #{item.invWarehouseCode})
|
|
|
|
|
#{item.productIdFk}, #{item.orderIdFk},
|
|
|
|
|
#{item.customerId}, #{item.mainAction}, #{item.action}, #{item.count}, #{item.updateTime},
|
|
|
|
|
#{item.purchaseType}, #{item.batchNo}, #{item.productionDate}, #{item.expireDate},
|
|
|
|
|
#{item.unitFk}, #{item.stockIdFk},
|
|
|
|
|
#{item.supId}, #{item.originCode}, #{item.invStorageCode}, #{item.invWarehouseCode}, #{item.invSpaceCode})
|
|
|
|
|
</foreach>
|
|
|
|
|
</insert>
|
|
|
|
|
|
|
|
|
@ -155,8 +163,8 @@
|
|
|
|
|
<if test="productIdFk != '' and productIdFk != null">
|
|
|
|
|
AND productIdFk = #{productIdFk}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="batchNo != '' and batchNo != null and batchNo!='empty'">
|
|
|
|
|
AND inv_product_detail.batchNo like concat('%',#{batchNo},'%')
|
|
|
|
|
<if test="batchNo != '' and batchNo != null and batchNo != 'empty'">
|
|
|
|
|
AND inv_product_detail.batchNo like concat('%', #{batchNo}, '%')
|
|
|
|
|
</if>
|
|
|
|
|
<if test="batchNo == 'empty'">
|
|
|
|
|
AND batchNo is NULL
|
|
|
|
@ -168,34 +176,69 @@
|
|
|
|
|
AND supId = #{supId}
|
|
|
|
|
</if>
|
|
|
|
|
</where>
|
|
|
|
|
|
|
|
|
|
</delete>
|
|
|
|
|
|
|
|
|
|
<update id="updateInvProductDetail" parameterType="com.glxp.api.admin.entity.inventory.InvProductDetailEntity">
|
|
|
|
|
UPDATE inv_product_detail
|
|
|
|
|
<trim prefix="set" suffixOverrides=",">
|
|
|
|
|
<if test="code != null">code=#{code},</if>
|
|
|
|
|
<if test="productIdFk != null">productIdFk=#{productIdFk},</if>
|
|
|
|
|
<if test="customerId != null">customerId=#{customerId},</if>
|
|
|
|
|
<if test="mainAction != null">mainAction=#{mainAction},</if>
|
|
|
|
|
<if test="action != null">`action`=#{action},</if>
|
|
|
|
|
<if test="count != null">`count`=#{count},</if>
|
|
|
|
|
<if test="unitFk != null">unitFk=#{unitFk},</if>
|
|
|
|
|
<if test="purchaseType != null">purchaseType=#{purchaseType},</if>
|
|
|
|
|
<if test="batchNo != null">batchNo=#{batchNo},</if>
|
|
|
|
|
<if test="productionDate != null">productionDate=#{productionDate},</if>
|
|
|
|
|
<if test="expireDate != null">expireDate=#{expireDate},</if>
|
|
|
|
|
<if test="stockIdFk != null">stockIdFk=#{stockIdFk},</if>
|
|
|
|
|
<if test="supId != null">supId=#{supId},</if>
|
|
|
|
|
<if test="originCode != null">originCode=#{originCode},</if>
|
|
|
|
|
<if test="invStorageCode != null">invStorageCode=#{invStorageCode},</if>
|
|
|
|
|
<if test="invWarehouseCode != null">invWarehouseCode=#{invWarehouseCode},</if>
|
|
|
|
|
<if test="code != null">
|
|
|
|
|
code=#{code},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="productIdFk != null">
|
|
|
|
|
productIdFk=#{productIdFk},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="customerId != null">
|
|
|
|
|
customerId=#{customerId},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="mainAction != null">
|
|
|
|
|
mainAction=#{mainAction},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="action != null">
|
|
|
|
|
`action`=#{action},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="count != null">
|
|
|
|
|
`count`=#{count},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="unitFk != null">
|
|
|
|
|
unitFk=#{unitFk},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="purchaseType != null">
|
|
|
|
|
purchaseType=#{purchaseType},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="batchNo != null">
|
|
|
|
|
batchNo=#{batchNo},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="productionDate != null">
|
|
|
|
|
productionDate=#{productionDate},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="expireDate != null">
|
|
|
|
|
expireDate=#{expireDate},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="stockIdFk != null">
|
|
|
|
|
stockIdFk=#{stockIdFk},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="supId != null">
|
|
|
|
|
supId=#{supId},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="originCode != null">
|
|
|
|
|
originCode=#{originCode},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="invStorageCode != null">
|
|
|
|
|
invStorageCode=#{invStorageCode},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="invWarehouseCode != null">
|
|
|
|
|
invWarehouseCode=#{invWarehouseCode},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="invSpaceCode != null != null">
|
|
|
|
|
invSpaceCode=#{invSpaceCode},
|
|
|
|
|
</if>
|
|
|
|
|
</trim>
|
|
|
|
|
WHERE id = #{id}
|
|
|
|
|
</update>
|
|
|
|
|
<select id="statCount" parameterType="com.glxp.api.admin.req.inventory.FilterInvProductDetailRequest"
|
|
|
|
|
resultType="java.lang.Integer">
|
|
|
|
|
SELECT count(0) FROM inv_product_detail
|
|
|
|
|
SELECT count(0)
|
|
|
|
|
FROM inv_product_detail
|
|
|
|
|
<where>
|
|
|
|
|
<if test="productIdFk != '' and productIdFk != null">
|
|
|
|
|
AND productIdFk = #{productIdFk}
|
|
|
|
@ -234,14 +277,13 @@
|
|
|
|
|
#{id}
|
|
|
|
|
</foreach>
|
|
|
|
|
</if>
|
|
|
|
|
|
|
|
|
|
</where>
|
|
|
|
|
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="isExit" parameterType="com.glxp.api.admin.req.inventory.FilterInvProductDetailRequest"
|
|
|
|
|
resultType="com.glxp.api.admin.entity.inventory.InvProductDetailEntity">
|
|
|
|
|
SELECT * FROM inv_product_detail
|
|
|
|
|
SELECT *
|
|
|
|
|
FROM inv_product_detail
|
|
|
|
|
<where>
|
|
|
|
|
<if test="productIdFk != '' and productIdFk != null">
|
|
|
|
|
AND productIdFk = #{productIdFk}
|
|
|
|
@ -275,7 +317,6 @@
|
|
|
|
|
</if>
|
|
|
|
|
</where>
|
|
|
|
|
limit 1
|
|
|
|
|
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<delete id="deleteByOrderId">
|
|
|
|
@ -291,4 +332,63 @@
|
|
|
|
|
and code = #{code}
|
|
|
|
|
</delete>
|
|
|
|
|
|
|
|
|
|
<select id="selectPlacementDetailList" resultType="com.glxp.api.admin.res.inventory.InvProductDetailPlaceResponse">
|
|
|
|
|
select pd.id,
|
|
|
|
|
pd.code,
|
|
|
|
|
pd.productIdFk,
|
|
|
|
|
pd.batchNo,
|
|
|
|
|
pd.productionDate,
|
|
|
|
|
pd.expireDate,
|
|
|
|
|
bp.ggxh,
|
|
|
|
|
bp.cpmctymc as procutName,
|
|
|
|
|
bp.zczbhhzbapzbh,
|
|
|
|
|
bp.ylqxzcrbarmc,
|
|
|
|
|
inv_warehouse.name as invStorageName,
|
|
|
|
|
inv_warehouse_sub.name as invWarehouseName,
|
|
|
|
|
inv_space.name as invSpaceName
|
|
|
|
|
from inv_product_detail pd
|
|
|
|
|
left join basic_udirel bu on pd.productIdFk = bu.id
|
|
|
|
|
left join basic_products bp on bp.uuid = bu.uuid
|
|
|
|
|
left join inv_warehouse on pd.invStorageCode = inv_warehouse.code
|
|
|
|
|
left join inv_warehouse_sub on pd.invWarehouseCode = inv_warehouse_sub.code
|
|
|
|
|
left join inv_space on pd.invSpaceCode = inv_space.code
|
|
|
|
|
<where>
|
|
|
|
|
invSpaceCode != null
|
|
|
|
|
and invSpaceCode != ''
|
|
|
|
|
<if test="invStorageCode != null and invStorageCode != ''">
|
|
|
|
|
AND pd.invStorageCode = #{invStorageCode}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="invWarehouseCode != null and invWarehouseCode != ''">
|
|
|
|
|
AND pd.invWarehouseCode = #{invWarehouseCode}
|
|
|
|
|
</if>
|
|
|
|
|
</where>
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="selectInvProductDetailIds" resultType="java.lang.Integer">
|
|
|
|
|
select id
|
|
|
|
|
from inv_product_detail
|
|
|
|
|
where invStorageCode = #{invStorageCode}
|
|
|
|
|
and invWarehouseCode = #{invWarehouseCode}
|
|
|
|
|
and code in
|
|
|
|
|
<foreach collection="codeArray" index="index" item="item" separator="," open="(" close=")">
|
|
|
|
|
#{item}
|
|
|
|
|
</foreach>
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<update id="batchBindSpace">
|
|
|
|
|
update inv_product_detail
|
|
|
|
|
set invSpaceCode = #{invSpaceCode}
|
|
|
|
|
where id in
|
|
|
|
|
<foreach collection="ids" index="index" item="item" separator="," open="(" close=")">
|
|
|
|
|
#{item}
|
|
|
|
|
</foreach>
|
|
|
|
|
</update>
|
|
|
|
|
|
|
|
|
|
<select id="selectByInvAndCode" resultType="com.glxp.api.admin.entity.inventory.InvProductDetailEntity">
|
|
|
|
|
select *
|
|
|
|
|
from inv_product_detail
|
|
|
|
|
where invStorageCode = #{invStorageCode}
|
|
|
|
|
and invWarehouseCode = #{invWarehouseCode}
|
|
|
|
|
and code = #{code}
|
|
|
|
|
</select>
|
|
|
|
|
</mapper>
|