diff --git a/mhd_wms/src/main/java/com/mhd/wms/domain/materialInventory/repository/mapper/MaterialInventoryMapper.java b/mhd_wms/src/main/java/com/mhd/wms/domain/materialInventory/repository/mapper/MaterialInventoryMapper.java index a333dd8a8..5a42b31a8 100644 --- a/mhd_wms/src/main/java/com/mhd/wms/domain/materialInventory/repository/mapper/MaterialInventoryMapper.java +++ b/mhd_wms/src/main/java/com/mhd/wms/domain/materialInventory/repository/mapper/MaterialInventoryMapper.java @@ -33,6 +33,8 @@ public interface MaterialInventoryMapper extends BaseMapper public List queryListByWl(MaterialInventoryDO materialInventoryDO); //查物料库存列表-货主 public List queryListByHz(MaterialInventoryDO materialInventoryDO); + //查物料库存列表-货主+物料(同一物料在不同货主下各一行) + public List queryListByHzWl(MaterialInventoryDO materialInventoryDO); /** * @description 批量增加库存 diff --git a/mhd_wms/src/main/java/com/mhd/wms/domain/materialInventory/repository/persistence/MaterialInventoryImpl.java b/mhd_wms/src/main/java/com/mhd/wms/domain/materialInventory/repository/persistence/MaterialInventoryImpl.java index 19e88a9e9..fbed436d4 100644 --- a/mhd_wms/src/main/java/com/mhd/wms/domain/materialInventory/repository/persistence/MaterialInventoryImpl.java +++ b/mhd_wms/src/main/java/com/mhd/wms/domain/materialInventory/repository/persistence/MaterialInventoryImpl.java @@ -74,6 +74,8 @@ public class MaterialInventoryImpl extends ServiceImpl list = materialInventoryApplicationService.queryList(materialInventoryDO); return getDataTable(list); } diff --git a/mhd_wms/src/main/resources/mapper/materialInventory/MaterialInventoryMapper.xml b/mhd_wms/src/main/resources/mapper/materialInventory/MaterialInventoryMapper.xml index bbda42547..64b1b5548 100644 --- a/mhd_wms/src/main/resources/mapper/materialInventory/MaterialInventoryMapper.xml +++ b/mhd_wms/src/main/resources/mapper/materialInventory/MaterialInventoryMapper.xml @@ -89,6 +89,29 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" a.in_order_number,a.lot_number + + + a.material_inventory_id, a.organization_id, a.organization_name, a.top_organization_id, + a.shipper_id, a.shipper_code, a.shipper_name, + loc.warehouse_id, loc.warehouse_code, loc.warehouse_name, + loc.storage_section_id, loc.storage_code, loc.storage_name, loc.storage_location_id, loc.storage_location_code, loc.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 (sum(a.freeze_quantity), 0) freeze_quantity,a.is_able, + IFNULL (sum(a.inventory_quantity), 0) inventory_quantity, + IFNULL (sum(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, + a.del_flag,a.unit, + IFNULL (sum(a.area), 0) area, + IFNULL (sum(a.NET_WEIGHT), 0) NET_WEIGHT, + IFNULL (sum(a.GROSS_WEIGHT), 0) GROSS_WEIGHT, + IFNULL (sum(a.VOLUME), 0) VOLUME, + a.ext_attr_1, a.ext_attr_2, a.ext_attr_3, a.ext_attr_4, + a.production_date, a.expiry_date, a.inventory_date, + a.BATCH_REF_NO, a.SHEET_REF_NO, a.BOX_PALLET_NO,nvl(a.unit_name,b.unit_name) as unit_name, + a.bar_code as inv_bar_code, + a.in_order_number,a.lot_number + + and a.material_inventory_id = #{materialInventoryId} @@ -211,6 +234,124 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + + + + and mi.material_inventory_id = #{materialInventoryId} + + + and mi.organization_id = #{organizationId} + + + and mi.organization_name like concat('%', #{organizationName}, '%') + + + and mi.top_organization_id = #{topOrganizationId} + + + and mi.warehouse_id = #{warehouseId} + + + and mi.shipper_id = #{shipperId} + + + and mi.warehouse_code = #{warehouseCode} + + + and mi.warehouse_name like concat('%', #{warehouseName}, '%') + + + and mi.storage_section_id = #{storageSectionId} + + + and mi.storage_code = #{storageCode} + + + and mi.storage_name like concat('%', #{storageName}, '%') + + + and mi.storage_location_id = #{storageLocationId} + + + and mi.storage_location_code = #{storageLocationCode} + + + and mi.storage_location_name like concat('%', #{storageLocationName}, '%') + + + and mi.material_base_info_id = #{materialBaseInfoId} + + + and mi.material_detail_id, = #{materialDetailId} + + + + and (mi.container_code like concat('%', #{containerOrBatch}, '%') or mi.batch_number like concat('%', #{containerOrBatch}, '%')) + + + and (mi.batch_number like concat('%', #{batchNumber}, '%') or mi.container_code like concat('%', #{containerCode}, '%')) + + + + and mi.batch_number like concat('%', #{batchNumber}, '%') + + + and mi.container_code like concat('%', #{containerCode}, '%') + + + + + and mi.material_status_code like concat('%', #{materialStatusCode}, '%') + + + and mi.material_status_name like concat('%', #{materialStatusName}, '%') + + + and mi.container_id = #{containerId} + + + and mi.container_type like concat('%', #{containerType}, '%') + + + and mi.container_type_name like concat('%', #{containerTypeName}, '%') + + + and mi.inventory_quantity = #{inventoryQuantity} + + + and mi.allocation_quantity = #{allocationQuantity} + + + and mi.freeze_quantity = #{freezeQuantity} + + + and COALESCE(mi.inventory_quantity, 0) > 0 + + + + and mi.create_by_name like concat('%', #{createByName}, '%') + + + and mi.update_by_name like concat('%', #{updateByName}, '%') + + + and mi.del_flag = #{delFlag} + and mi.del_flag = 1 + + + and (mi.storage_location_code = #{storageInfo} or material_code = #{storageInfo} or material_name like concat('%', #{storageInfo}, '%') or bar_code = #{storageInfo}) + + + and mi.BATCH_REF_NO like concat('%', #{batchRefNo}, '%') + + + and mi.SHEET_REF_NO like concat('%', #{sheetRefNo}, '%') + + + and mi.BOX_PALLET_NO like concat('%', #{boxPalletNo}, '%') + + + select - + from material_inventory a left join material_base_info b on a.material_base_info_id = b.material_base_info_id + inner join ( + select material_base_info_id, warehouse_id, warehouse_code, warehouse_name, + storage_section_id, storage_code, storage_name, + storage_location_id, storage_location_code, storage_location_name + from ( + select mi.material_base_info_id, mi.warehouse_id, mi.warehouse_code, mi.warehouse_name, + mi.storage_section_id, mi.storage_code, mi.storage_name, + mi.storage_location_id, mi.storage_location_code, mi.storage_location_name, + row_number() over (partition by mi.material_base_info_id order by mi.create_time desc, mi.material_inventory_id desc) as wl_rn + from material_inventory mi + left join material_base_info b on mi.material_base_info_id = b.material_base_info_id + + + + + ) wl_ranked where wl_ranked.wl_rn = 1 + ) loc on loc.material_base_info_id = a.material_base_info_id - GROUP BY a.MATERIAL_BASE_INFO_ID + GROUP BY a.MATERIAL_BASE_INFO_ID, + loc.warehouse_id, loc.warehouse_code, loc.warehouse_name, + loc.storage_section_id, loc.storage_code, loc.storage_name, + loc.storage_location_id, loc.storage_location_code, loc.storage_location_name + + + +