入库管理收货、上架数量修改

This commit is contained in:
秦鸿展
2026-01-28 09:51:58 +08:00
parent 0738c939ae
commit 00dacdae19
7 changed files with 230 additions and 128 deletions
@@ -53,8 +53,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</sql>
<sql id="JoinMaterialBaseInfoPo">
,b.shipper_id, b.shipper_code, b.shipper_name, b.material_code, b.material_name, b.bar_code, b.material_classify_code, b.material_classify_name,
b.material_type, b.material_type_name, b.common
<!-- 注意:物料基础信息表中的货主字段统一使用别名,避免与主表中的 shipper_id/shipper_code/shipper_name 冲突 -->
,b.shipper_id AS base_shipper_id,
b.shipper_code AS base_shipper_code,
b.shipper_name AS base_shipper_name,
b.material_code,
b.material_name,
b.bar_code,
b.material_classify_code,
b.material_classify_name,
b.material_type,
b.material_type_name,
b.common
</sql>
<sql id="selectMaterialBaseInfoPo1">
@@ -175,41 +185,44 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</sql>
<sql id="JoinMaterialBaseInfoPoWhere">
<!-- 该片段总是在物料基础信息表使用别名 b 时被 include,例如:
FROM ... LEFT JOIN material_base_info b ON ...
因此这里所有列名都加上 b. 前缀以避免和主表列名歧义 -->
<if test="shipperId != null ">
and shipper_id = #{shipperId}
and b.shipper_id = #{shipperId}
</if>
<if test="shipperCode != null and shipperCode != ''">
and shipper_code like concat('%', #{shipperCode}, '%')
and b.shipper_code like concat('%', #{shipperCode}, '%')
</if>
<if test="shipperName != null and shipperName != ''">
and shipper_name like concat('%', #{shipperName}, '%')
and b.shipper_name like concat('%', #{shipperName}, '%')
</if>
<if test="materialCode != null and materialCode != ''">
and material_code = #{materialCode}
and b.material_code = #{materialCode}
</if>
<if test="materialName != null and materialName != ''">
and material_name like concat('%', #{materialName}, '%')
and b.material_name like concat('%', #{materialName}, '%')
</if>
<if test="barCode != null and barCode != ''">
and bar_code = #{barCode}
and b.bar_code = #{barCode}
</if>
<if test="materialClassifyCode != null and materialClassifyCode != ''">
and material_classify_code = #{materialClassifyCode}
and b.material_classify_code = #{materialClassifyCode}
</if>
<if test="materialClassifyName != null and materialClassifyName != ''">
and material_classify_name like concat('%', #{materialClassifyName}, '%')
and b.material_classify_name like concat('%', #{materialClassifyName}, '%')
</if>
<if test="materialType != null and materialType != ''">
and material_type = #{materialType}
and b.material_type = #{materialType}
</if>
<if test="materialTypeName != null and materialTypeName != ''">
and material_type_name like concat('%', #{materialTypeName}, '%')
and b.material_type_name like concat('%', #{materialTypeName}, '%')
</if>
<if test="shipperInfo != null and shipperInfo != ''">
and (shipper_code like concat('%', #{shipperInfo}, '%') or shipper_name like concat('%', #{shipperInfo}, '%'))
and (b.shipper_code like concat('%', #{shipperInfo}, '%') or b.shipper_name like concat('%', #{shipperInfo}, '%'))
</if>
<if test="materialInfo != null and materialInfo != ''">
and (material_code = #{materialInfo} or material_name like concat('%', #{materialInfo}, '%') or bar_code = #{materialInfo})
and (b.material_code = #{materialInfo} or b.material_name like concat('%', #{materialInfo}, '%') or b.bar_code = #{materialInfo})
</if>
</sql>
@@ -9,6 +9,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="organizationId" column="organization_id" />
<result property="organizationName" column="organization_name" />
<result property="topOrganizationId" column="top_organization_id" />
<result property="shipperId" column="shipper_id" />
<result property="shipperCode" column="shipper_code" />
<result property="shipperName" column="shipper_name" />
<result property="warehouseId" column="warehouse_id" />
<result property="warehouseCode" column="warehouse_code" />
<result property="warehouseName" column="warehouse_name" />
@@ -45,7 +48,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<sql id="selectMaterialInventoryPo">
a.material_inventory_id, a.organization_id, a.organization_name, a.top_organization_id, a.warehouse_id, a.warehouse_code, a.warehouse_name,
a.material_inventory_id, a.organization_id, a.organization_name, a.top_organization_id,
a.shipper_id, a.shipper_code, a.shipper_name,
a.warehouse_id, a.warehouse_code, a.warehouse_name,
a.storage_section_id, a.storage_code, a.storage_name, a.storage_location_id, a.storage_location_code, a.storage_location_name, a.material_base_info_id,a.material_detail_id,
a.batch_number,a.material_status_code,a.material_status_name,a.container_id,a.container_code,a.container_type,a.container_type_name,IFNULL(a.freeze_quantity,0) freeze_quantity,a.is_able,
IFNULL(a.inventory_quantity,0) inventory_quantity, IFNULL(a.allocation_quantity,0) allocation_quantity, a.remark, a.create_time, a.create_by, a.create_by_name, a.update_time, a.update_by, a.update_by_name,
@@ -329,7 +334,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
select
a.warehouse_id,
a.warehouse_name,
b.shipper_name,
ifnull(a.shipper_name, b.shipper_name) shipper_name,
b.material_name,
b.material_code,
b.bar_code,
@@ -348,8 +353,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
WHERE
c.del_flag = 1
AND e.warehouse_id = a.warehouse_id
AND e.shipper_id = b.shipper_id
AND c.material_base_info_id = b.material_base_info_id
AND (a.shipper_id IS NULL OR e.shipper_id = a.shipper_id)
AND c.material_base_info_id = a.material_base_info_id
),
0
) received_quantity,
@@ -365,8 +370,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
WHERE
c.del_flag = 1
AND e.warehouse_id = a.warehouse_id
AND e.shipper_id = b.shipper_id
AND c.material_base_info_id = b.material_base_info_id
AND (a.shipper_id IS NULL OR e.shipper_id = a.shipper_id)
AND c.material_base_info_id = a.material_base_info_id
),
0
) shelves_quantity,
@@ -380,8 +385,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
WHERE
c.del_flag = 1
AND d.warehouse_id = a.warehouse_id
AND d.shipper_id = b.shipper_id
AND c.material_base_info_id = b.material_base_info_id
AND (a.shipper_id IS NULL OR d.shipper_id = a.shipper_id)
AND c.material_base_info_id = a.material_base_info_id
),
0
) pick_quantity
@@ -396,7 +401,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</if>
<if test="shipperName != null and shipperName != ''">
and b.shipper_name = #{shipperName}
and (a.shipper_name = #{shipperName} OR b.shipper_name = #{shipperName})
</if>
<if test="warehouseId != null and warehouseId != '' ">
@@ -415,30 +420,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
and b.bar_code = #{barCode}
</if>
<if test="inventoryQuantityStart != null ">
and sum(a.inventory_quantity) > #{inventoryQuantityStart}
</if>
<if test="inventoryQuantityEnd != null ">
and sum(a.inventory_quantity) lt #{inventoryQuantityEnd}
</if>
<if test="allocationQuantityStart != null ">
and sum(a.allocation_quantity) > #{allocationQuantityStart}
</if>
<if test="allocationQuantityEnd != null ">
and sum(a.allocation_quantity)lt #{allocationQuantityEnd}
</if>
<if test="freezeQuantityStart != null ">
and sum(a.freeze_quantity) > #{freezeQuantityStart}
</if>
<if test="freezeQuantityEnd != null ">
and sum(a.freeze_quantity) lt #{freezeQuantityEnd}
</if>
<if test="receivedQuantityStart != null ">
and ifnull(
(
@@ -452,8 +433,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
WHERE
c.del_flag = 1
AND e.warehouse_id = a.warehouse_id
AND e.shipper_id = b.shipper_id
AND c.material_base_info_id = b.material_base_info_id
AND (a.shipper_id IS NULL OR e.shipper_id = a.shipper_id)
AND c.material_base_info_id = a.material_base_info_id
),
0
)> #{receivedQuantityStart}
@@ -472,11 +453,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
WHERE
c.del_flag = 1
AND e.warehouse_id = a.warehouse_id
AND e.shipper_id = b.shipper_id
AND c.material_base_info_id = b.material_base_info_id
AND (a.shipper_id IS NULL OR e.shipper_id = a.shipper_id)
AND c.material_base_info_id = a.material_base_info_id
),
0
) lt #{receivedQuantityEnd}
) &lt; #{receivedQuantityEnd}
</if>
<if test="shelvesQuantityStart != null ">
@@ -492,8 +473,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
WHERE
c.del_flag = 1
AND e.warehouse_id = a.warehouse_id
AND e.shipper_id = b.shipper_id
AND c.material_base_info_id = b.material_base_info_id
AND (a.shipper_id IS NULL OR e.shipper_id = a.shipper_id)
AND c.material_base_info_id = a.material_base_info_id
),
0
) > #{shelvesQuantityStart}
@@ -512,11 +493,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
WHERE
c.del_flag = 1
AND e.warehouse_id = a.warehouse_id
AND e.shipper_id = b.shipper_id
AND c.material_base_info_id = b.material_base_info_id
AND (a.shipper_id IS NULL OR e.shipper_id = a.shipper_id)
AND c.material_base_info_id = a.material_base_info_id
),
0
) lt #{shelvesQuantityEnd}
) &lt; #{shelvesQuantityEnd}
</if>
<if test="pickQuantityStart != null ">
@@ -530,8 +511,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
WHERE
c.del_flag = 1
AND d.warehouse_id = a.warehouse_id
AND d.shipper_id = b.shipper_id
AND c.material_base_info_id = b.material_base_info_id
AND (a.shipper_id IS NULL OR d.shipper_id = a.shipper_id)
AND c.material_base_info_id = a.material_base_info_id
),
0
) > #{pickQuantityStart}
@@ -548,17 +529,41 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
WHERE
c.del_flag = 1
AND d.warehouse_id = a.warehouse_id
AND d.shipper_id = b.shipper_id
AND c.material_base_info_id = b.material_base_info_id
AND (a.shipper_id IS NULL OR d.shipper_id = a.shipper_id)
AND c.material_base_info_id = a.material_base_info_id
),
0
) lt #{pickQuantityEnd}
) &lt; #{pickQuantityEnd}
</if>
GROUP BY
a.warehouse_id,
a.material_base_info_id,
b.shipper_id
a.shipper_id
HAVING 1=1
<if test="inventoryQuantityStart != null ">
and sum(a.inventory_quantity) > #{inventoryQuantityStart}
</if>
<if test="inventoryQuantityEnd != null ">
and sum(a.inventory_quantity) &lt; #{inventoryQuantityEnd}
</if>
<if test="allocationQuantityStart != null ">
and sum(a.allocation_quantity) > #{allocationQuantityStart}
</if>
<if test="allocationQuantityEnd != null ">
and sum(a.allocation_quantity) &lt; #{allocationQuantityEnd}
</if>
<if test="freezeQuantityStart != null ">
and sum(a.freeze_quantity) > #{freezeQuantityStart}
</if>
<if test="freezeQuantityEnd != null ">
and sum(a.freeze_quantity) &lt; #{freezeQuantityEnd}
</if>
</select>
<select id="selectOneByWhere" parameterType="com.mhd.wms.domain.statementStatistics.todo.ImmediateInventoryDO"