feat:出库单分配功能

This commit is contained in:
zhouz
2026-07-27 10:26:58 +08:00
parent ac19f00697
commit 66dca91e7d
25 changed files with 1765 additions and 286 deletions

View File

@@ -2,11 +2,33 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.code.nl.module.wms.dal.mysql.iostorinvdis.IostorinvDisMapper">
<!--
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
文档可见https://www.iocoder.cn/MyBatis/x-plugins/
-->
<select id="selectAllocationList"
resultType="cn.code.nl.module.wms.controller.admin.iostorinv.vo.OutboundAllocationRespVO">
SELECT dis.iostorinvdis_id,
dis.iostorinvdtl_id,
dis.work_status,
dis.material_code,
mb.material_name,
dis.pcsn,
dis.storagevehicle_code,
dis.plan_qty,
dis.qty_unit_name,
dis.sect_id,
dis.sect_name,
dis.struct_code,
dis.struct_name
FROM wms_iostorinvdis dis
LEFT JOIN base_materialbase mb
ON mb.material_id = dis.material_id
AND mb.deleted = 0
WHERE dis.iostorinv_id = #{iostorinvId}
<if test="iostorinvdtlId != null">
AND dis.iostorinvdtl_id = #{iostorinvdtlId}
</if>
<if test="sectId != null and sectId != ''">
AND dis.sect_id = #{sectId}
</if>
ORDER BY dis.seq_no, dis.iostorinvdis_id
</select>
</mapper>
</mapper>

View File

@@ -32,7 +32,7 @@
) sa ON sa.storagevehicle_code = gp.vehicle_code
LEFT JOIN base_materialbase mb ON mb.material_id = gp.material_id AND mb.deleted = 0
WHERE sa.stor_id = #{reqVO.storId}
AND gp.status = '可用'
AND gp.status = '02'
AND gp.qty - COALESCE(gp.frozen_qty, 0) &gt; 0
AND gp.deleted = 0
<if test="reqVO.materialCode != null and reqVO.materialCode != ''">
@@ -59,7 +59,7 @@
) sa ON sa.storagevehicle_code = gp.vehicle_code
LEFT JOIN base_materialbase mb ON mb.material_id = gp.material_id AND mb.deleted = 0
WHERE sa.stor_id = #{storId}
AND gp.status = '可用'
AND gp.status = '02'
AND gp.qty - COALESCE(gp.frozen_qty, 0) &gt; 0
AND gp.deleted = 0
AND gp.vehicle_code IN
@@ -81,7 +81,7 @@
) sa ON sa.storagevehicle_code = gp.vehicle_code
LEFT JOIN base_materialbase mb ON mb.material_id = gp.material_id AND mb.deleted = 0
WHERE sa.stor_id = #{storId}
AND gp.status = '可用'
AND gp.status = '02'
AND gp.qty - COALESCE(gp.frozen_qty, 0) &gt; 0
AND gp.deleted = 0
AND gp.vehicle_code IN
@@ -94,7 +94,12 @@
<select id="selectEditDetails"
resultType="cn.code.nl.module.wms.controller.admin.iostorinv.vo.IostorInvDetailRespVO">
SELECT d.material_code,
SELECT d.iostorinvdtl_id,
d.seq_no,
d.bill_status,
d.assign_qty,
d.unassign_qty,
d.material_code,
d.material_id,
mb.material_name,
d.pcsn,
@@ -107,10 +112,100 @@
FROM wms_iostorinvdtl d
LEFT JOIN base_materialbase mb
ON mb.material_id = d.material_id
AND mb.deleted = 0
WHERE d.iostorinv_id = #{iostorinvId}
AND d.deleted = 0
ORDER BY d.seq_no, d.iostorinvdtl_id
</select>
<select id="selectAllocationInventoryForUpdate"
resultType="cn.code.nl.module.wms.controller.admin.iostorinv.vo.AllocationInventoryRespVO">
SELECT gp.group_id,
gp.vehicle_code,
gp.material_id,
gp.material_code,
gp.pcsn,
gp.qty - COALESCE(gp.frozen_qty, 0) AS available_qty,
gp.qty_unit_id,
gp.qty_unit_name,
sa.sect_id,
sa.sect_code,
sa.sect_name,
sa.struct_id,
sa.struct_code,
sa.struct_name
FROM wms_group_plate gp
INNER JOIN wms_structattr sa
ON sa.storagevehicle_code = gp.vehicle_code
AND sa.deleted = 0
WHERE gp.deleted = 0
AND gp.status = '02'
AND gp.qty - COALESCE(gp.frozen_qty, 0) &gt; 0
AND sa.stor_id = #{storId}
AND (sa.lock_type IS NULL OR sa.lock_type IN ('0', '1'))
<if test="sectId != null and sectId != ''">
AND sa.sect_id = #{sectId}
</if>
AND gp.material_id = #{materialId}
<choose>
<when test="pcsn != null and pcsn != ''">AND gp.pcsn = #{pcsn}</when>
<otherwise>AND (gp.pcsn IS NULL OR gp.pcsn = '')</otherwise>
</choose>
<choose>
<when test="sourceBillCode != null and sourceBillCode != ''">AND gp.ext_code = #{sourceBillCode}</when>
<otherwise>AND (gp.ext_code IS NULL OR gp.ext_code = '')</otherwise>
</choose>
ORDER BY gp.create_time, gp.group_id
FOR UPDATE
</select>
<select id="selectManualAllocationInventory"
resultType="cn.code.nl.module.wms.controller.admin.iostorinv.vo.AllocationInventoryRespVO">
SELECT gp.group_id,
gp.vehicle_code,
gp.material_id,
gp.material_code,
mb.material_name,
gp.pcsn,
gp.qty - COALESCE(gp.frozen_qty, 0) AS available_qty,
gp.qty_unit_id,
gp.qty_unit_name,
sa.sect_id,
sa.sect_code,
sa.sect_name,
sa.struct_id,
sa.struct_code,
sa.struct_name
FROM wms_group_plate gp
INNER JOIN wms_structattr sa
ON sa.storagevehicle_code = gp.vehicle_code
AND sa.deleted = 0
LEFT JOIN base_materialbase mb
ON mb.material_id = gp.material_id
AND mb.deleted = 0
WHERE gp.deleted = 0
AND gp.status = '02'
AND gp.qty - COALESCE(gp.frozen_qty, 0) &gt; 0
AND sa.stor_id = #{storId}
AND (sa.lock_type IS NULL OR sa.lock_type IN ('0', '1'))
AND gp.material_id = #{materialId}
<if test="sectId != null and sectId != ''">
AND sa.sect_id = #{sectId}
</if>
<choose>
<when test="pcsn != null and pcsn != ''">AND gp.pcsn = #{pcsn}</when>
<otherwise>AND (gp.pcsn IS NULL OR gp.pcsn = '')</otherwise>
</choose>
<choose>
<when test="sourceBillCode != null and sourceBillCode != ''">AND gp.ext_code = #{sourceBillCode}</when>
<otherwise>AND (gp.ext_code IS NULL OR gp.ext_code = '')</otherwise>
</choose>
<if test="groupIds != null and !groupIds.isEmpty()">
AND gp.group_id IN
<foreach collection="groupIds" item="groupId" open="(" separator="," close=")">
#{groupId}
</foreach>
</if>
ORDER BY gp.vehicle_code, gp.group_id
<if test="forUpdate">FOR UPDATE</if>
</select>
</mapper>