Merge branch 'dev' into feature/dev-0729
# Conflicts: # mhd_bms/src/main/resources/bootstrap.yml
This commit is contained in:
@@ -5,7 +5,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<mapper namespace="com.mhd.wms.domain.handoverTaskOrder.repository.mapper.HandoverTaskOrderMapper">
|
||||
|
||||
<resultMap type="com.mhd.wms.domain.handoverTaskOrder.repository.po.HandoverTaskOrderPO" id="HandoverTaskOrderResult">
|
||||
<result property="handoverTaskOrderId" column="handover_task_order_id" />
|
||||
<id property="handoverTaskOrderId" column="handover_task_order_id" />
|
||||
<result property="organizationId" column="organization_id" />
|
||||
<result property="organizationName" column="organization_name" />
|
||||
<result property="topOrganizationId" column="top_organization_id" />
|
||||
@@ -45,7 +45,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
|
||||
|
||||
<sql id="selectHandoverTaskOrderPo">
|
||||
a.handover_task_order_id, a.organization_id, a.organization_name, a.top_organization_id, a.serial_number, a.task_number, a.status, a.platform_id,
|
||||
a.handover_task_order_id AS handover_task_order_id, a.organization_id, a.organization_name, a.top_organization_id, a.serial_number, a.task_number, a.status, a.platform_id,
|
||||
a.platform_code, a.platform_name, a.platform_use_time_id, a.platform_use_start_time, a.platform_use_end_time, a.platform_use_status,
|
||||
a.order_type_code, a.order_type_name, a.expect_time, a.warehouse_id, a.warehouse_code, a.warehouse_name, a.shipper_id,
|
||||
a.shipper_name, a.order_number, a.picking_order_number, a.remark, a.task_distribution, a.task_distribution_time, a.create_time, a.create_by, a.create_by_name, a.update_time,
|
||||
|
||||
@@ -162,7 +162,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
and a.material_base_info_id = #{materialBaseInfoId}
|
||||
</if>
|
||||
<if test="materialDetailId != null ">
|
||||
and a.material_detail_id, = #{materialDetailId}
|
||||
and a.material_detail_id = #{materialDetailId}
|
||||
</if>
|
||||
<!-- 容器号或批次号:containerOrBatch 优先;若 batchNumber 与 containerCode 相同则按 OR 查(PDA 单输入框传两个相同值) -->
|
||||
<choose>
|
||||
@@ -313,7 +313,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
and mi.material_base_info_id = #{materialBaseInfoId}
|
||||
</if>
|
||||
<if test="materialDetailId != null ">
|
||||
and mi.material_detail_id, = #{materialDetailId}
|
||||
and mi.material_detail_id = #{materialDetailId}
|
||||
</if>
|
||||
<choose>
|
||||
<when test="containerOrBatch != null and containerOrBatch != ''">
|
||||
@@ -528,6 +528,55 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
loc.storage_location_id, loc.storage_location_code, loc.storage_location_name order by sort_order, a.update_time desc
|
||||
</select>
|
||||
|
||||
<!-- ============ 按货主+物料+仓库+单位 汇总(库存查询第三个页签) ============ -->
|
||||
<!-- SELECT 列:需求字段,全部聚合;包装单位优先库存表,回退物料基础信息表 -->
|
||||
<sql id="selectMaterialInventoryPoByHzWlUnit">
|
||||
a.shipper_id, a.shipper_code, a.shipper_name,
|
||||
b.material_base_info_id, b.material_code, b.material_name, b.SPECIFICATION_MODEL,
|
||||
a.warehouse_id, a.warehouse_code, a.warehouse_name,
|
||||
a.organization_id, a.organization_name, a.top_organization_id,
|
||||
MAX(b.material_type) AS material_type,
|
||||
MAX(b.material_type_name) AS material_type_name,
|
||||
MAX(b.bar_code) AS bar_code,
|
||||
MAX(nvl(a.unit_name, b.unit_name)) AS unit_name,
|
||||
MAX(b.pack_id) AS pack_id,
|
||||
MAX(b.pack_code) AS pack_code,
|
||||
MAX(b.pack_name) AS pack_name,
|
||||
MAX(a.unit) AS unit,
|
||||
IFNULL(SUM(a.freeze_quantity), 0) AS freeze_quantity,
|
||||
IFNULL(SUM(a.inventory_quantity), 0) AS inventory_quantity,
|
||||
IFNULL(SUM(a.allocation_quantity), 0) AS allocation_quantity,
|
||||
IFNULL(SUM(a.area), 0) AS area,
|
||||
IFNULL(SUM(a.NET_WEIGHT), 0) AS NET_WEIGHT,
|
||||
IFNULL(SUM(a.GROSS_WEIGHT), 0) AS GROSS_WEIGHT,
|
||||
IFNULL(SUM(a.VOLUME), 0) AS VOLUME,
|
||||
MIN(a.create_time) AS create_time, -- 新增:首次入库时间
|
||||
MAX(a.update_time) AS update_time,
|
||||
CASE WHEN IFNULL(SUM(a.inventory_quantity), 0) = 0 THEN 1 ELSE 0 END AS sort_order
|
||||
</sql>
|
||||
|
||||
<select id="queryListByHzWlUnit"
|
||||
parameterType="com.mhd.wms.domain.materialInventory.repository.todo.MaterialInventoryDO"
|
||||
resultMap="MaterialInventoryResult">
|
||||
select
|
||||
<include refid="selectMaterialInventoryPoByHzWlUnit"/>
|
||||
from 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
|
||||
<include refid="selectMaterialInventoryPo1"/>
|
||||
<include refid="com.mhd.wms.domain.materialBaseInfo.repository.mapper.MaterialBaseInfoMapper.JoinMaterialBaseInfoPoWhere"/>
|
||||
<if test="excludeZeroInventoryQuantity != null and excludeZeroInventoryQuantity == true">
|
||||
and IFNULL(a.inventory_quantity, 0) > 0
|
||||
</if>
|
||||
</where>
|
||||
GROUP BY a.shipper_id, a.shipper_code, a.shipper_name,
|
||||
b.material_base_info_id, b.material_code, b.material_name, b.SPECIFICATION_MODEL,
|
||||
a.warehouse_id, a.warehouse_code, a.warehouse_name,
|
||||
a.organization_id, a.organization_name, a.top_organization_id
|
||||
ORDER BY sort_order, MAX(a.update_time) DESC
|
||||
</select>
|
||||
|
||||
<select id="queryListByHz" parameterType="com.mhd.wms.domain.materialInventory.repository.todo.MaterialInventoryDO" resultMap="MaterialInventoryResult">
|
||||
select
|
||||
<include refid="selectMaterialInventoryPo"/>
|
||||
@@ -781,12 +830,279 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
and container_id = #{containerId}
|
||||
</update>
|
||||
|
||||
<sql id="immediateInventoryQueryWhere">
|
||||
<if test="organizationId != null ">
|
||||
and a.organization_id = #{organizationId}
|
||||
</if>
|
||||
|
||||
<if test="topOrganizationId != null ">
|
||||
and a.top_organization_id = #{topOrganizationId}
|
||||
</if>
|
||||
|
||||
<if test="shipperName != null and shipperName != ''">
|
||||
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>
|
||||
|
||||
<if test="warehouseCode != null and warehouseCode != '' ">
|
||||
and a.warehouse_code = #{warehouseCode}
|
||||
</if>
|
||||
|
||||
<if test="warehouseName != null and warehouseName != '' ">
|
||||
and a.warehouse_name like concat('%', #{warehouseName}, '%')
|
||||
</if>
|
||||
|
||||
<if test="materialName != null and materialName != '' ">
|
||||
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>
|
||||
|
||||
<if test="specificationModel != null and specificationModel != ''">
|
||||
and b.specification_model = #{specificationModel}
|
||||
</if>
|
||||
|
||||
<if test="batchNumber != null and batchNumber != ''">
|
||||
and a.batch_number = #{batchNumber}
|
||||
</if>
|
||||
|
||||
<if test="receivedQuantityStart != null ">
|
||||
and ifnull(
|
||||
(
|
||||
SELECT
|
||||
sum( c.receipt_quantity )
|
||||
FROM
|
||||
receipt_material_detail c
|
||||
LEFT JOIN stock_receipt_order d ON c.receipt_order_number = d.receipt_order_number
|
||||
AND d.del_flag = 1
|
||||
LEFT JOIN stock_in_order e ON d.in_order_number = e.in_order_number and e.DEL_FLAG = 1 and d.DEL_FLAG = 1
|
||||
WHERE
|
||||
c.del_flag = 1 and d.STATUS = 3
|
||||
AND e.warehouse_id = a.warehouse_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
|
||||
and (c.BATCH_REF_NO = a.batch_ref_no or (c.BATCH_REF_NO is null and a.BATCH_REF_NO is null))
|
||||
and (c.SHEET_REF_NO = a.sheet_ref_no or (c.SHEET_REF_NO is null and a.SHEET_REF_NO is null))
|
||||
and (c.BOX_PALLET_NO = a.BOX_PALLET_NO or (c.BOX_PALLET_NO is null and a.BOX_PALLET_NO is null))
|
||||
and (c.EXT_ATTR_1 = a.EXT_ATTR_1 or (c.EXT_ATTR_1 is null and a.EXT_ATTR_1 is null))
|
||||
and (c.EXT_ATTR_2 = a.EXT_ATTR_2 or (c.EXT_ATTR_2 is null and a.EXT_ATTR_2 is null))
|
||||
and (c.EXT_ATTR_3 = a.EXT_ATTR_3 or (c.EXT_ATTR_3 is null and a.EXT_ATTR_3 is null))
|
||||
and (c.EXT_ATTR_4 = a.EXT_ATTR_4 or (c.EXT_ATTR_4 is null and a.EXT_ATTR_4 is null))
|
||||
and (c.PRODUCTION_DATE = a.PRODUCTION_DATE or (c.PRODUCTION_DATE is null and a.PRODUCTION_DATE is null))
|
||||
and (c.EXPIRY_DATE = a.EXPIRY_DATE or (c.EXPIRY_DATE is null and a.EXPIRY_DATE is null))
|
||||
and (c.INVENTORY_DATE = a.INVENTORY_DATE or (c.INVENTORY_DATE is null and a.INVENTORY_DATE is null))
|
||||
),
|
||||
0
|
||||
)> #{receivedQuantityStart}
|
||||
</if>
|
||||
|
||||
<if test="receivedQuantityEnd != null ">
|
||||
and ifnull(
|
||||
(
|
||||
SELECT
|
||||
sum( c.receipt_quantity )
|
||||
FROM
|
||||
receipt_material_detail c
|
||||
LEFT JOIN stock_receipt_order d ON c.receipt_order_number = d.receipt_order_number
|
||||
AND d.del_flag = 1
|
||||
LEFT JOIN stock_in_order e ON d.in_order_number = e.in_order_number and e.DEL_FLAG = 1 and d.DEL_FLAG = 1
|
||||
WHERE
|
||||
c.del_flag = 1 and d.STATUS = 3
|
||||
AND e.warehouse_id = a.warehouse_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
|
||||
and (c.BATCH_REF_NO = a.batch_ref_no or (c.BATCH_REF_NO is null and a.BATCH_REF_NO is null))
|
||||
and (c.SHEET_REF_NO = a.sheet_ref_no or (c.SHEET_REF_NO is null and a.SHEET_REF_NO is null))
|
||||
and (c.BOX_PALLET_NO = a.BOX_PALLET_NO or (c.BOX_PALLET_NO is null and a.BOX_PALLET_NO is null))
|
||||
and (c.EXT_ATTR_1 = a.EXT_ATTR_1 or (c.EXT_ATTR_1 is null and a.EXT_ATTR_1 is null))
|
||||
and (c.EXT_ATTR_2 = a.EXT_ATTR_2 or (c.EXT_ATTR_2 is null and a.EXT_ATTR_2 is null))
|
||||
and (c.EXT_ATTR_3 = a.EXT_ATTR_3 or (c.EXT_ATTR_3 is null and a.EXT_ATTR_3 is null))
|
||||
and (c.EXT_ATTR_4 = a.EXT_ATTR_4 or (c.EXT_ATTR_4 is null and a.EXT_ATTR_4 is null))
|
||||
and (c.PRODUCTION_DATE = a.PRODUCTION_DATE or (c.PRODUCTION_DATE is null and a.PRODUCTION_DATE is null))
|
||||
and (c.EXPIRY_DATE = a.EXPIRY_DATE or (c.EXPIRY_DATE is null and a.EXPIRY_DATE is null))
|
||||
and (c.INVENTORY_DATE = a.INVENTORY_DATE or (c.INVENTORY_DATE is null and a.INVENTORY_DATE is null))
|
||||
),
|
||||
0
|
||||
) < #{receivedQuantityEnd}
|
||||
</if>
|
||||
|
||||
<if test="shelvesQuantityStart != null ">
|
||||
and ifnull(
|
||||
(
|
||||
SELECT
|
||||
sum( c.shelves_quantity )
|
||||
FROM
|
||||
shelf_material_detail c
|
||||
LEFT JOIN stock_shelf_order d ON c.shelf_order_number = d.shelf_order_number
|
||||
AND d.del_flag = 1
|
||||
LEFT JOIN stock_in_order e ON d.in_order_number = e.in_order_number and e.DEL_FLAG = 1 and d.DEL_FLAG = 1
|
||||
WHERE
|
||||
c.del_flag = 1
|
||||
AND e.warehouse_id = a.warehouse_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}
|
||||
</if>
|
||||
|
||||
<if test="shelvesQuantityEnd != null ">
|
||||
and ifnull(
|
||||
(
|
||||
SELECT
|
||||
sum( c.shelves_quantity )
|
||||
FROM
|
||||
shelf_material_detail c
|
||||
LEFT JOIN stock_shelf_order d ON c.shelf_order_number = d.shelf_order_number
|
||||
AND d.del_flag = 1
|
||||
LEFT JOIN stock_in_order e ON d.in_order_number = e.in_order_number and e.DEL_FLAG = 1 and d.DEL_FLAG = 1
|
||||
WHERE
|
||||
c.del_flag = 1
|
||||
AND e.warehouse_id = a.warehouse_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
|
||||
) < #{shelvesQuantityEnd}
|
||||
</if>
|
||||
|
||||
<if test="pickQuantityStart != null ">
|
||||
and ifnull(
|
||||
(
|
||||
SELECT
|
||||
sum( c.picking_quantity )
|
||||
FROM
|
||||
picking_material_detail c
|
||||
LEFT JOIN picking_order d ON c.picking_order_number = d.PICKING_ORDER_NUMBER and c.del_flag = 1 and d.del_flag=1
|
||||
left join STOCK_OUT_ORDER e ON d.ORDER_NUMBER = e.OUT_ORDER_NUMBER and e.del_flag = 1
|
||||
WHERE
|
||||
c.del_flag = 1 and d.STATUS = 3 and e.STATUS = 7
|
||||
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
|
||||
AND c.MATERIAL_INVENTORY_ID = a.MATERIAL_INVENTORY_ID
|
||||
),
|
||||
0
|
||||
) > #{pickQuantityStart}
|
||||
</if>
|
||||
|
||||
<if test="pickQuantityEnd != null ">
|
||||
and ifnull(
|
||||
(
|
||||
SELECT
|
||||
sum( c.picking_quantity )
|
||||
FROM
|
||||
picking_material_detail c
|
||||
LEFT JOIN picking_order d ON c.picking_order_number = d.PICKING_ORDER_NUMBER and c.del_flag = 1 and d.del_flag=1
|
||||
left join STOCK_OUT_ORDER e ON d.ORDER_NUMBER = e.OUT_ORDER_NUMBER and e.del_flag = 1
|
||||
WHERE
|
||||
c.del_flag = 1 and d.STATUS = 3 and e.STATUS = 7
|
||||
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
|
||||
AND c.MATERIAL_INVENTORY_ID = a.MATERIAL_INVENTORY_ID
|
||||
),
|
||||
0
|
||||
) < #{pickQuantityEnd}
|
||||
</if>
|
||||
|
||||
<if test="checkQuantityBegin != 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 and c.del_flag = 1 and d.del_flag = 1
|
||||
LEFT JOIN HANDOVER_TASK_ORDER e ON d.OUT_ORDER_NUMBER = e.ORDER_NUMBER
|
||||
WHERE
|
||||
d.CHECK_STATUS in (2,3) and e.STATUS = 1 and d.STATUS in (8,12)
|
||||
AND d.DEL_FLAG = 1
|
||||
AND c.DEL_FLAG = 1
|
||||
and e.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
|
||||
AND c.MATERIAL_INVENTORY_ID = a.MATERIAL_INVENTORY_ID
|
||||
),
|
||||
0
|
||||
) > #{checkQuantityBegin}
|
||||
</if>
|
||||
|
||||
<if test="checkQuantityEnd != 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 and c.del_flag = 1 and d.del_flag = 1
|
||||
LEFT JOIN HANDOVER_TASK_ORDER e ON d.OUT_ORDER_NUMBER = e.ORDER_NUMBER
|
||||
WHERE
|
||||
d.CHECK_STATUS in (2,3) and e.STATUS = 1 and d.STATUS in (8,12)
|
||||
AND d.DEL_FLAG = 1
|
||||
AND c.DEL_FLAG = 1
|
||||
and e.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
|
||||
AND c.MATERIAL_INVENTORY_ID = a.MATERIAL_INVENTORY_ID
|
||||
),
|
||||
0
|
||||
) < #{checkQuantityEnd}
|
||||
</if>
|
||||
|
||||
<if test="inventoryQuantity != null ">
|
||||
and a.inventory_quantity = #{inventoryQuantity}
|
||||
</if>
|
||||
|
||||
<if test="inventoryQuantityStart != null ">
|
||||
and a.inventory_quantity > #{inventoryQuantityStart}
|
||||
</if>
|
||||
|
||||
<if test="inventoryQuantityEnd != null ">
|
||||
and a.inventory_quantity < #{inventoryQuantityEnd}
|
||||
</if>
|
||||
|
||||
<if test="allocationQuantityStart != null ">
|
||||
and a.allocation_quantity > #{allocationQuantityStart}
|
||||
</if>
|
||||
|
||||
<if test="allocationQuantityEnd != null ">
|
||||
and a.allocation_quantity < #{allocationQuantityEnd}
|
||||
</if>
|
||||
|
||||
<if test="freezeQuantityStart != null ">
|
||||
and a.freeze_quantity > #{freezeQuantityStart}
|
||||
</if>
|
||||
|
||||
<if test="freezeQuantityEnd != null ">
|
||||
and a.freeze_quantity < #{freezeQuantityEnd}
|
||||
</if>
|
||||
</sql>
|
||||
|
||||
<resultMap type="com.mhd.wms.domain.statementStatistics.po.ImmediateInventoryPO" id="queryImmediateInventoryListResult">
|
||||
|
||||
<result property="shipperName" column="shipper_name" />
|
||||
<result property="materialCode" column="material_code" />
|
||||
<result property="materialName" column="material_name" />
|
||||
<result property="barCode" column="bar_code" />
|
||||
<result property="specificationModel" column="specification_model" />
|
||||
<result property="warehouseName" column="warehouse_name" />
|
||||
<result property="inventoryQuantity" column="inventory_quantity" />
|
||||
<result property="allocationQuantity" column="allocation_quantity" />
|
||||
@@ -826,6 +1142,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
b.material_name,
|
||||
b.material_code,
|
||||
b.bar_code,
|
||||
b.specification_model,
|
||||
<!-- sum(a.inventory_quantity) inventory_quantity,
|
||||
sum(a.allocation_quantity) allocation_quantity,
|
||||
sum(a.freeze_quantity) freeze_quantity,-->
|
||||
@@ -995,271 +1312,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
WHERE
|
||||
a.del_flag = 1
|
||||
|
||||
<if test="organizationId != null ">
|
||||
and a.organization_id = #{organizationId}
|
||||
</if>
|
||||
|
||||
<if test="topOrganizationId != null ">
|
||||
and a.top_organization_id = #{topOrganizationId}
|
||||
</if>
|
||||
|
||||
<if test="shipperName != null and shipperName != ''">
|
||||
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>
|
||||
|
||||
<if test="warehouseCode != null and warehouseCode != '' ">
|
||||
and a.warehouse_code = #{warehouseCode}
|
||||
</if>
|
||||
|
||||
<if test="warehouseName != null and warehouseName != '' ">
|
||||
and a.warehouse_name like concat('%', #{warehouseName}, '%')
|
||||
</if>
|
||||
|
||||
<if test="materialName != null and materialName != '' ">
|
||||
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>
|
||||
|
||||
<if test="batchNumber != null and batchNumber != ''">
|
||||
and a.batch_number = #{batchNumber}
|
||||
</if>
|
||||
|
||||
<if test="receivedQuantityStart != null ">
|
||||
and ifnull(
|
||||
(
|
||||
SELECT
|
||||
sum( c.receipt_quantity )
|
||||
FROM
|
||||
receipt_material_detail c
|
||||
LEFT JOIN stock_receipt_order d ON c.receipt_order_number = d.receipt_order_number
|
||||
AND d.del_flag = 1
|
||||
LEFT JOIN stock_in_order e ON d.in_order_number = e.in_order_number and e.DEL_FLAG = 1 and d.DEL_FLAG = 1
|
||||
WHERE
|
||||
c.del_flag = 1 and d.STATUS = 3
|
||||
AND e.warehouse_id = a.warehouse_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
|
||||
and (c.BATCH_REF_NO = a.batch_ref_no or (c.BATCH_REF_NO is null and a.BATCH_REF_NO is null))
|
||||
and (c.SHEET_REF_NO = a.sheet_ref_no or (c.SHEET_REF_NO is null and a.SHEET_REF_NO is null))
|
||||
and (c.BOX_PALLET_NO = a.BOX_PALLET_NO or (c.BOX_PALLET_NO is null and a.BOX_PALLET_NO is null))
|
||||
and (c.EXT_ATTR_1 = a.EXT_ATTR_1 or (c.EXT_ATTR_1 is null and a.EXT_ATTR_1 is null))
|
||||
and (c.EXT_ATTR_2 = a.EXT_ATTR_2 or (c.EXT_ATTR_2 is null and a.EXT_ATTR_2 is null))
|
||||
and (c.EXT_ATTR_3 = a.EXT_ATTR_3 or (c.EXT_ATTR_3 is null and a.EXT_ATTR_3 is null))
|
||||
and (c.EXT_ATTR_4 = a.EXT_ATTR_4 or (c.EXT_ATTR_4 is null and a.EXT_ATTR_4 is null))
|
||||
and (c.PRODUCTION_DATE = a.PRODUCTION_DATE or (c.PRODUCTION_DATE is null and a.PRODUCTION_DATE is null))
|
||||
and (c.EXPIRY_DATE = a.EXPIRY_DATE or (c.EXPIRY_DATE is null and a.EXPIRY_DATE is null))
|
||||
and (c.INVENTORY_DATE = a.INVENTORY_DATE or (c.INVENTORY_DATE is null and a.INVENTORY_DATE is null))
|
||||
),
|
||||
0
|
||||
)> #{receivedQuantityStart}
|
||||
</if>
|
||||
|
||||
<if test="receivedQuantityEnd != null ">
|
||||
and ifnull(
|
||||
(
|
||||
SELECT
|
||||
sum( c.receipt_quantity )
|
||||
FROM
|
||||
receipt_material_detail c
|
||||
LEFT JOIN stock_receipt_order d ON c.receipt_order_number = d.receipt_order_number
|
||||
AND d.del_flag = 1
|
||||
LEFT JOIN stock_in_order e ON d.in_order_number = e.in_order_number and e.DEL_FLAG = 1 and d.DEL_FLAG = 1
|
||||
WHERE
|
||||
c.del_flag = 1 and d.STATUS = 3
|
||||
AND e.warehouse_id = a.warehouse_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
|
||||
and (c.BATCH_REF_NO = a.batch_ref_no or (c.BATCH_REF_NO is null and a.BATCH_REF_NO is null))
|
||||
and (c.SHEET_REF_NO = a.sheet_ref_no or (c.SHEET_REF_NO is null and a.SHEET_REF_NO is null))
|
||||
and (c.BOX_PALLET_NO = a.BOX_PALLET_NO or (c.BOX_PALLET_NO is null and a.BOX_PALLET_NO is null))
|
||||
and (c.EXT_ATTR_1 = a.EXT_ATTR_1 or (c.EXT_ATTR_1 is null and a.EXT_ATTR_1 is null))
|
||||
and (c.EXT_ATTR_2 = a.EXT_ATTR_2 or (c.EXT_ATTR_2 is null and a.EXT_ATTR_2 is null))
|
||||
and (c.EXT_ATTR_3 = a.EXT_ATTR_3 or (c.EXT_ATTR_3 is null and a.EXT_ATTR_3 is null))
|
||||
and (c.EXT_ATTR_4 = a.EXT_ATTR_4 or (c.EXT_ATTR_4 is null and a.EXT_ATTR_4 is null))
|
||||
and (c.PRODUCTION_DATE = a.PRODUCTION_DATE or (c.PRODUCTION_DATE is null and a.PRODUCTION_DATE is null))
|
||||
and (c.EXPIRY_DATE = a.EXPIRY_DATE or (c.EXPIRY_DATE is null and a.EXPIRY_DATE is null))
|
||||
and (c.INVENTORY_DATE = a.INVENTORY_DATE or (c.INVENTORY_DATE is null and a.INVENTORY_DATE is null))
|
||||
),
|
||||
0
|
||||
) < #{receivedQuantityEnd}
|
||||
</if>
|
||||
|
||||
<if test="shelvesQuantityStart != null ">
|
||||
and ifnull(
|
||||
(
|
||||
SELECT
|
||||
sum( c.shelves_quantity )
|
||||
FROM
|
||||
shelf_material_detail c
|
||||
LEFT JOIN stock_shelf_order d ON c.shelf_order_number = d.shelf_order_number
|
||||
AND d.del_flag = 1
|
||||
LEFT JOIN stock_in_order e ON d.in_order_number = e.in_order_number and e.DEL_FLAG = 1 and d.DEL_FLAG = 1
|
||||
WHERE
|
||||
c.del_flag = 1
|
||||
AND e.warehouse_id = a.warehouse_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}
|
||||
</if>
|
||||
|
||||
<if test="shelvesQuantityEnd != null ">
|
||||
and ifnull(
|
||||
(
|
||||
SELECT
|
||||
sum( c.shelves_quantity )
|
||||
FROM
|
||||
shelf_material_detail c
|
||||
LEFT JOIN stock_shelf_order d ON c.shelf_order_number = d.shelf_order_number
|
||||
AND d.del_flag = 1
|
||||
LEFT JOIN stock_in_order e ON d.in_order_number = e.in_order_number and e.DEL_FLAG = 1 and d.DEL_FLAG = 1
|
||||
WHERE
|
||||
c.del_flag = 1
|
||||
AND e.warehouse_id = a.warehouse_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
|
||||
) < #{shelvesQuantityEnd}
|
||||
</if>
|
||||
|
||||
<if test="pickQuantityStart != null ">
|
||||
and ifnull(
|
||||
(
|
||||
SELECT
|
||||
sum( c.picking_quantity )
|
||||
FROM
|
||||
picking_material_detail c
|
||||
LEFT JOIN picking_order d ON c.picking_order_number = d.PICKING_ORDER_NUMBER and c.del_flag = 1 and d.del_flag=1
|
||||
left join STOCK_OUT_ORDER e ON d.ORDER_NUMBER = e.OUT_ORDER_NUMBER and e.del_flag = 1
|
||||
WHERE
|
||||
c.del_flag = 1 and d.STATUS = 3 and e.STATUS = 7
|
||||
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
|
||||
AND c.MATERIAL_INVENTORY_ID = a.MATERIAL_INVENTORY_ID
|
||||
),
|
||||
0
|
||||
) > #{pickQuantityStart}
|
||||
</if>
|
||||
|
||||
<if test="pickQuantityEnd != null ">
|
||||
and ifnull(
|
||||
(
|
||||
SELECT
|
||||
sum( c.picking_quantity )
|
||||
FROM
|
||||
picking_material_detail c
|
||||
LEFT JOIN picking_order d ON c.picking_order_number = d.PICKING_ORDER_NUMBER and c.del_flag = 1 and d.del_flag=1
|
||||
left join STOCK_OUT_ORDER e ON d.ORDER_NUMBER = e.OUT_ORDER_NUMBER and e.del_flag = 1
|
||||
WHERE
|
||||
c.del_flag = 1 and d.STATUS = 3 and e.STATUS = 7
|
||||
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
|
||||
AND c.MATERIAL_INVENTORY_ID = a.MATERIAL_INVENTORY_ID
|
||||
),
|
||||
0
|
||||
) < #{pickQuantityEnd}
|
||||
</if>
|
||||
<!--
|
||||
GROUP BY
|
||||
a.warehouse_id,
|
||||
a.material_base_info_id,
|
||||
a.shipper_id
|
||||
HAVING 1=1-->
|
||||
|
||||
<if test="checkQuantityBegin != 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 and c.del_flag = 1 and d.del_flag = 1
|
||||
LEFT JOIN HANDOVER_TASK_ORDER e ON d.OUT_ORDER_NUMBER = e.ORDER_NUMBER
|
||||
WHERE
|
||||
d.CHECK_STATUS in (2,3) and e.STATUS = 1 and d.STATUS in (8,12)
|
||||
AND d.DEL_FLAG = 1
|
||||
AND c.DEL_FLAG = 1
|
||||
and e.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
|
||||
AND c.MATERIAL_INVENTORY_ID = a.MATERIAL_INVENTORY_ID
|
||||
),
|
||||
0
|
||||
) > #{checkQuantityBegin}
|
||||
</if>
|
||||
|
||||
<if test="checkQuantityEnd != 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 and c.del_flag = 1 and d.del_flag = 1
|
||||
LEFT JOIN HANDOVER_TASK_ORDER e ON d.OUT_ORDER_NUMBER = e.ORDER_NUMBER
|
||||
WHERE
|
||||
d.CHECK_STATUS in (2,3) and e.STATUS = 1 and d.STATUS in (8,12)
|
||||
AND d.DEL_FLAG = 1
|
||||
AND c.DEL_FLAG = 1
|
||||
and e.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
|
||||
AND c.MATERIAL_INVENTORY_ID = a.MATERIAL_INVENTORY_ID
|
||||
),
|
||||
0
|
||||
) < #{checkQuantityEnd}
|
||||
</if>
|
||||
|
||||
<if test="inventoryQuantity != null ">
|
||||
and a.inventory_quantity = #{inventoryQuantity}
|
||||
</if>
|
||||
|
||||
<if test="inventoryQuantityStart != null ">
|
||||
and a.inventory_quantity > #{inventoryQuantityStart}
|
||||
</if>
|
||||
|
||||
<if test="inventoryQuantityEnd != null ">
|
||||
and a.inventory_quantity < #{inventoryQuantityEnd}
|
||||
</if>
|
||||
|
||||
<if test="allocationQuantityStart != null ">
|
||||
and a.allocation_quantity > #{allocationQuantityStart}
|
||||
</if>
|
||||
|
||||
<if test="allocationQuantityEnd != null ">
|
||||
and a.allocation_quantity < #{allocationQuantityEnd}
|
||||
</if>
|
||||
|
||||
<if test="freezeQuantityStart != null ">
|
||||
and a.freeze_quantity > #{freezeQuantityStart}
|
||||
</if>
|
||||
|
||||
<if test="freezeQuantityEnd != null ">
|
||||
and a.freeze_quantity < #{freezeQuantityEnd}
|
||||
</if>
|
||||
<include refid="immediateInventoryQueryWhere"/>
|
||||
ORDER BY GREATEST(
|
||||
IFNULL(a.update_time, '1970-01-01 00:00:00'),
|
||||
IFNULL((
|
||||
@@ -1330,6 +1383,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
|
||||
</select>
|
||||
|
||||
<select id="sumImmediateInventoryQuantity" parameterType="com.mhd.wms.domain.statementStatistics.todo.ImmediateInventoryDO"
|
||||
resultType="java.math.BigDecimal">
|
||||
SELECT IFNULL(SUM(a.inventory_quantity), 0)
|
||||
FROM 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
|
||||
<include refid="immediateInventoryQueryWhere"/>
|
||||
</select>
|
||||
|
||||
|
||||
<select id="selectListByWhere" parameterType="com.mhd.wms.domain.materialInventory.entity.MaterialInventory"
|
||||
resultMap="MaterialInventoryResult">
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<mapper namespace="com.mhd.wms.domain.reviewOrder.repository.mapper.ReviewOrderMapper">
|
||||
|
||||
<resultMap type="com.mhd.wms.domain.reviewOrder.repository.po.ReviewOrderPO" id="ReviewOrderResult">
|
||||
<result property="reviewOrderId" column="review_order_id"/>
|
||||
<id property="reviewOrderId" column="review_order_id"/>
|
||||
<result property="reviewOrderNumber" column="review_order_number"/>
|
||||
<result property="outOrderId" column="out_order_id"/>
|
||||
<result property="outOrderNumber" column="out_order_number"/>
|
||||
@@ -84,7 +84,7 @@
|
||||
</resultMap>
|
||||
|
||||
<sql id="reviewOrderSelectColumns">
|
||||
a.review_order_id,
|
||||
a.review_order_id AS review_order_id,
|
||||
a.review_order_number,
|
||||
a.out_order_id,
|
||||
a.out_order_number,
|
||||
|
||||
Reference in New Issue
Block a user