及时库存查询修改;

This commit is contained in:
王奎兴
2026-01-30 15:30:32 +08:00
parent 81633720e3
commit 089b7535b5
2 changed files with 53 additions and 12 deletions
@@ -69,6 +69,10 @@ public class ImmediateInventoryDO extends BaseVOEntity {
@Excel(name = "库存数量")
private BigDecimal inventoryQuantity;
@ApiModelProperty("复核数量")
@Excel(name = "复核数量")
private BigDecimal checkQuantity;
@ApiModelProperty("可用数量 ")
@Excel(name = "可用数量 ")
private BigDecimal allocationQuantity;
@@ -144,4 +148,4 @@ public class ImmediateInventoryDO extends BaseVOEntity {
@Excel(name = "拣货数量结束")
private BigDecimal pickQuantityEnd;
}
}
@@ -342,9 +342,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
b.material_name,
b.material_code,
b.bar_code,
sum(a.inventory_quantity) inventory_quantity,
<!-- sum(a.inventory_quantity) inventory_quantity,
sum(a.allocation_quantity) allocation_quantity,
sum(a.freeze_quantity) freeze_quantity,
sum(a.freeze_quantity) freeze_quantity,-->
a.inventory_quantity ,
a.allocation_quantity ,
a.freeze_quantity ,
ifnull(
(
SELECT
@@ -426,6 +429,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
and (a.shipper_name = #{shipperName} OR b.shipper_name = #{shipperName})
</if>
<if test="shipperId != null and shipperId != '' ">
and a.shipper_id = #{shipperId}
</if>
<if test="warehouseId != null and warehouseId != '' ">
and a.warehouse_id = #{warehouseId}
</if>
@@ -442,6 +449,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
and b.material_name = #{materialName}
</if>
<if test="materialCode != null and materialCode != '' ">
and b.material_code = #{materialCode}
</if>
<if test="barCode != null and barCode != '' ">
and b.bar_code = #{barCode}
</if>
@@ -561,34 +572,60 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
0
) &lt; #{pickQuantityEnd}
</if>
<!--
GROUP BY
a.warehouse_id,
a.material_base_info_id,
a.shipper_id
HAVING 1=1
HAVING 1=1-->
<if test="checkQuantity != null ">
and
ifnull(
(
SELECT
SUM(c.CHECK_QUANTITY) AS CHECK_QUANTITY
FROM
OUT_MATERIAL_DETAIL c
LEFT JOIN STOCK_OUT_ORDER d ON c.OUT_ORDER_NUMBER = d.OUT_ORDER_NUMBER
WHERE
d.CHECK_STATUS = 2
AND d.DEL_FLAG = 1
AND c.DEL_FLAG = 1
AND d.warehouse_id = a.warehouse_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
) = #{checkQuantity}
</if>
<if test="inventoryQuantity != null ">
and a.inventory_quantity = #{inventoryQuantity}
</if>
<if test="inventoryQuantityStart != null ">
and sum(a.inventory_quantity) > #{inventoryQuantityStart}
and a.inventory_quantity > #{inventoryQuantityStart}
</if>
<if test="inventoryQuantityEnd != null ">
and sum(a.inventory_quantity) &lt; #{inventoryQuantityEnd}
and a.inventory_quantity &lt; #{inventoryQuantityEnd}
</if>
<if test="allocationQuantityStart != null ">
and sum(a.allocation_quantity) > #{allocationQuantityStart}
and a.allocation_quantity > #{allocationQuantityStart}
</if>
<if test="allocationQuantityEnd != null ">
and sum(a.allocation_quantity) &lt; #{allocationQuantityEnd}
and a.allocation_quantity &lt; #{allocationQuantityEnd}
</if>
<if test="freezeQuantityStart != null ">
and sum(a.freeze_quantity) > #{freezeQuantityStart}
and a.freeze_quantity > #{freezeQuantityStart}
</if>
<if test="freezeQuantityEnd != null ">
and sum(a.freeze_quantity) &lt; #{freezeQuantityEnd}
and a.freeze_quantity &lt; #{freezeQuantityEnd}
</if>
</select>
@@ -637,7 +674,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
material_inventory a
LEFT JOIN material_base_info b on a.material_base_info_id = b.material_base_info_id
WHERE
a.del_flag = 1 AND b.shipper_id = #{shipperId} AND a.top_organization_id = #{topOrganizationId}
a.del_flag = 1 AND b.shipper_id = #{shipperId} AND a.organization_id = #{organizationId}
<if test="materialBaseInfoId != null and materialBaseInfoId != ''">
AND a.material_base_info_id = #{materialBaseInfoId}
</if>