添加bigdecimal序列号
添加移库单向列表
This commit is contained in:
@@ -12,6 +12,9 @@
|
||||
<!-- 关键字段 -->
|
||||
<result property="rkInfoId" column="rk_info_id"/>
|
||||
<result property="newRkInfoId" column="new_rk_info_id"/>
|
||||
|
||||
<result property="parentMoveId" column="parent_move_id"/>
|
||||
|
||||
<result property="entityId" column="entity_id"/>
|
||||
|
||||
<!-- 数量 -->
|
||||
@@ -55,6 +58,10 @@
|
||||
id,
|
||||
rk_info_id,
|
||||
new_rk_info_id,
|
||||
|
||||
-- ★★★ 新增字段 ★★★
|
||||
parent_move_id,
|
||||
|
||||
entity_id,
|
||||
real_qty,
|
||||
from_cangku,
|
||||
@@ -82,6 +89,9 @@
|
||||
INSERT INTO move_record (
|
||||
rk_info_id,
|
||||
new_rk_info_id,
|
||||
|
||||
parent_move_id,
|
||||
|
||||
entity_id,
|
||||
real_qty,
|
||||
from_cangku,
|
||||
@@ -101,6 +111,9 @@
|
||||
) VALUES (
|
||||
#{rkInfoId},
|
||||
#{newRkInfoId},
|
||||
|
||||
#{parentMoveId},
|
||||
|
||||
#{entityId},
|
||||
#{realQty},
|
||||
#{fromCangku},
|
||||
@@ -172,6 +185,9 @@
|
||||
<set>
|
||||
<if test="rkInfoId != null">rk_info_id = #{rkInfoId},</if>
|
||||
<if test="newRkInfoId != null">new_rk_info_id = #{newRkInfoId},</if>
|
||||
|
||||
<if test="parentMoveId != null">parent_move_id = #{parentMoveId},</if>
|
||||
|
||||
<if test="entityId != null">entity_id = #{entityId},</if>
|
||||
<if test="realQty != null">real_qty = #{realQty},</if>
|
||||
<if test="fromCangku != null">from_cangku = #{fromCangku},</if>
|
||||
@@ -203,4 +219,20 @@
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<select id="selectLastMoveIdByRkInfoId" resultType="java.lang.Long">
|
||||
SELECT id
|
||||
FROM move_record
|
||||
WHERE new_rk_info_id = #{rkInfoId}
|
||||
AND is_delete = '0'
|
||||
ORDER BY create_time DESC
|
||||
LIMIT 1
|
||||
</select>
|
||||
|
||||
<select id="countByParentMoveId" resultType="int">
|
||||
SELECT COUNT(1)
|
||||
FROM move_record
|
||||
WHERE parent_move_id = #{parentMoveId}
|
||||
AND is_delete = '0'
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
||||
@@ -389,5 +389,116 @@
|
||||
AND is_delete = '0'
|
||||
</update>
|
||||
|
||||
<!-- ========================= 1️⃣ 正常匹配 ========================= -->
|
||||
<select id="getByPcodeIdList" resultMap="RkInfoResult">
|
||||
SELECT
|
||||
ri.*
|
||||
FROM rk_info ri
|
||||
JOIN pcde_detail pd ON ri.pcode_id = pd.encoded_id
|
||||
WHERE ri.is_delete = '0'
|
||||
AND ri.is_chuku = '0'
|
||||
AND pd.is_delete = '0'
|
||||
AND pd.scene = #{sceneId}
|
||||
AND ri.pcode_id IN
|
||||
<foreach collection="pcdeIds" item="id" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
<!-- ========================= 2️⃣ 未盘点 ========================= -->
|
||||
<select id="getMissedPcodeIds" resultMap="RkInfoResult">
|
||||
SELECT
|
||||
ri.*
|
||||
FROM rk_info ri
|
||||
JOIN pcde_detail pd ON ri.pcode_id = pd.encoded_id
|
||||
WHERE ri.is_delete = '0'
|
||||
AND ri.is_chuku = '0'
|
||||
AND pd.is_delete = '0'
|
||||
AND pd.scene = #{sceneId}
|
||||
<if test="pcdeIds != null and pcdeIds.size() > 0">
|
||||
AND ri.pcode_id NOT IN
|
||||
<foreach collection="pcdeIds" item="id" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<!-- ========================= 3️⃣ 异常(不存在) ========================= -->
|
||||
<select id="getNotExistsPcodeIds" resultType="java.lang.String">
|
||||
SELECT t.pcode_id
|
||||
FROM (
|
||||
<foreach collection="pcdeIds" item="id" separator="UNION ALL">
|
||||
SELECT #{id} AS pcode_id
|
||||
</foreach>
|
||||
) t
|
||||
LEFT JOIN (
|
||||
SELECT ri.pcode_id
|
||||
FROM rk_info ri
|
||||
JOIN pcde_detail pd ON ri.pcode_id = pd.encoded_id
|
||||
WHERE ri.is_delete = '0'
|
||||
AND ri.is_chuku = '0'
|
||||
AND pd.is_delete = '0'
|
||||
AND pd.scene = #{sceneId}
|
||||
) s ON t.pcode_id = s.pcode_id
|
||||
WHERE s.pcode_id IS NULL
|
||||
</select>
|
||||
|
||||
<select id="selectPcdeCntFromRkInfo" resultType="com.zg.project.inventory.domain.vo.PcdeCntVO">
|
||||
SELECT pcode AS pcde,
|
||||
COUNT(*) AS cnt
|
||||
FROM rk_info
|
||||
WHERE pcode_id IN
|
||||
<foreach collection="ids" item="id" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
GROUP BY pcode
|
||||
</select>
|
||||
|
||||
<select id="getUnscannedPcodeByScene"
|
||||
resultType="com.zg.project.inventory.domain.vo.RkInfoMatchVO">
|
||||
SELECT
|
||||
r.pcode AS rkPcode,
|
||||
COALESCE(SUM(r.real_qty), 0) AS realQty
|
||||
FROM pcde_detail d
|
||||
JOIN rk_info r ON r.pcode = d.pcode
|
||||
LEFT JOIN (
|
||||
SELECT DISTINCT pcode
|
||||
FROM inventory_match_scan
|
||||
WHERE task_id = #{taskId}
|
||||
AND status = '0'
|
||||
) s ON s.pcode = r.pcode
|
||||
WHERE (d.is_delete IS NULL OR d.is_delete = '0')
|
||||
AND d.scene = #{sceneId}
|
||||
AND r.is_chuku = '0'
|
||||
AND s.pcode IS NULL
|
||||
GROUP BY r.pcode
|
||||
ORDER BY MAX(r.create_time) DESC
|
||||
</select>
|
||||
|
||||
<select id="countGetByWh" resultType="java.lang.Integer" parameterType="java.lang.String">
|
||||
SELECT COUNT(1) FROM rk_info
|
||||
WHERE is_delete = '0'
|
||||
AND cangku = #{warehouse}
|
||||
AND is_chuku = '0'
|
||||
</select>
|
||||
|
||||
<select id="listRkInfoByPcode"
|
||||
parameterType="string"
|
||||
resultMap="RkInfoResult">
|
||||
SELECT
|
||||
t.*,
|
||||
wh.warehouse_name AS cangku_name,
|
||||
wh.parent_warehouse_code AS parent_warehouse_code,
|
||||
wh.parent_warehouse_name AS parent_warehouse_name,
|
||||
wh.warehouse_code AS warehouse_code,
|
||||
wh.warehouse_name AS warehouse_name
|
||||
FROM rk_info t
|
||||
LEFT JOIN warehouse_info wh
|
||||
ON wh.warehouse_code = t.cangku
|
||||
WHERE t.is_delete = 0
|
||||
AND t.is_chuku = 0
|
||||
AND t.pcode = #{pcode}
|
||||
ORDER BY t.operation_time DESC, t.id DESC
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
||||
@@ -590,70 +590,35 @@
|
||||
COUNT(DISTINCT rr.pcode) AS locationCount,
|
||||
IFNULL(SUM(rr.real_qty), 0) AS totalQuantity
|
||||
FROM rk_record rr
|
||||
<where>
|
||||
rr.is_delete = 0
|
||||
AND rr.exec_status = 1 <!-- 入库 -->
|
||||
|
||||
<if test="operationType != null and operationType.size() > 0">
|
||||
AND rr.operation_type IN
|
||||
<foreach collection="operationType" item="it" open="(" separator="," close=")">
|
||||
#{it}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="xmNo != null and xmNo != ''">
|
||||
AND rr.xm_no LIKE CONCAT('%', #{xmNo}, '%')
|
||||
</if>
|
||||
<if test="wlNo != null and wlNo != ''">
|
||||
AND rr.wl_no LIKE CONCAT('%', #{wlNo}, '%')
|
||||
</if>
|
||||
<if test="pcode != null and pcode != ''">
|
||||
AND rr.pcode LIKE CONCAT('%', #{pcode}, '%')
|
||||
</if>
|
||||
<if test="cangku != null and cangku != ''">
|
||||
AND rr.cangku LIKE CONCAT('%', #{cangku}, '%')
|
||||
</if>
|
||||
<if test="startDate != null">
|
||||
AND rr.operation_time >= #{startDate}
|
||||
</if>
|
||||
<if test="endDate != null">
|
||||
AND rr.operation_time <= #{endDate}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<!-- 出库统计 -->
|
||||
<select id="selectOutRecordStatistic"
|
||||
parameterType="com.zg.project.wisdom.domain.RkRecord"
|
||||
resultType="com.zg.project.wisdom.domain.vo.StockStatisticVO">
|
||||
|
||||
SELECT
|
||||
IFNULL(SUM(rr.real_qty * rr.ht_dj), 0) AS total_amount,
|
||||
COUNT(DISTINCT rr.pcode) AS location_count,
|
||||
IFNULL(SUM(rr.real_qty), 0) AS total_quantity
|
||||
FROM rk_record rr
|
||||
<where>
|
||||
rr.is_delete = 0
|
||||
AND rr.exec_status = 1
|
||||
AND rr.biz_type = 1 <!-- 出库 -->
|
||||
|
||||
<!-- 已修复:String 不可用 size() -->
|
||||
<if test="operationType != null and operationType != ''">
|
||||
AND rr.operation_type LIKE CONCAT('%', #{operationType}, '%')
|
||||
AND rr.operation_type = #{operationType}
|
||||
</if>
|
||||
|
||||
<if test="xmNo != null and xmNo != ''">
|
||||
AND rr.xm_no LIKE CONCAT('%', #{xmNo}, '%')
|
||||
</if>
|
||||
|
||||
<if test="wlNo != null and wlNo != ''">
|
||||
AND rr.wl_no LIKE CONCAT('%', #{wlNo}, '%')
|
||||
</if>
|
||||
|
||||
<if test="pcode != null and pcode != ''">
|
||||
AND rr.pcode LIKE CONCAT('%', #{pcode}, '%')
|
||||
</if>
|
||||
|
||||
<if test="cangku != null and cangku != ''">
|
||||
AND rr.cangku LIKE CONCAT('%', #{cangku}, '%')
|
||||
</if>
|
||||
|
||||
<if test="startDate != null">
|
||||
AND rr.operation_time >= #{startDate}
|
||||
</if>
|
||||
|
||||
<if test="endDate != null">
|
||||
AND rr.operation_time <= #{endDate}
|
||||
</if>
|
||||
|
||||
Reference in New Issue
Block a user