部门id改为字符串;修改库存推送oms;

This commit is contained in:
王奎兴
2026-04-22 14:41:20 +08:00
parent 3062adeca9
commit 775dfecf9f
43 changed files with 7072 additions and 6 deletions
@@ -0,0 +1,202 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.mhd.oms.domain.reservationInventoryAdjustmentRecord.repository.mapper.ReservationInventoryAdjustmentRecordMapper">
<resultMap type="com.mhd.oms.domain.reservationInventoryAdjustmentRecord.repository.po.ReservationInventoryAdjustmentRecordPO" id="InventoryAdjustmentRecordResult">
<result property="inventoryAdjustmentId" column="inventory_adjustment_id" />
<result property="organizationId" column="organization_id" />
<result property="organizationName" column="organization_name" />
<result property="topOrganizationId" column="top_organization_id" />
<result property="materialInventoryId" column="material_inventory_id" />
<result property="materialBaseInfoId" column="material_base_info_id" />
<result property="materialCode" column="material_code" />
<result property="materialName" column="material_name" />
<result property="barCode" column="bar_code" />
<result property="shipperId" column="shipper_id" />
<result property="shipperName" column="shipper_name" />
<result property="warehouseId" column="warehouse_id" />
<result property="warehouseCode" column="warehouse_code" />
<result property="warehouseName" column="warehouse_name" />
<result property="storageSectionId" column="storage_section_id" />
<result property="storageCode" column="storage_code" />
<result property="storageName" column="storage_name" />
<result property="storageLocationId" column="storage_location_id" />
<result property="storageLocationCode" column="storage_location_code" />
<result property="storageLocationName" column="storage_location_name" />
<result property="adjustType" column="adjust_type" />
<result property="adjustDirection" column="adjust_direction" />
<result property="adjustBeforeStatusCode" column="adjust_before_status_code" />
<result property="adjustBeforeStatusName" column="adjust_before_status_name" />
<result property="adjustAfterStatusCode" column="adjust_after_status_code" />
<result property="adjustAfterStatusName" column="adjust_after_status_name" />
<result property="inventoryBeforeQuantity" column="inventory_before_quantity" />
<result property="allocationBeforeQuantity" column="allocation_before_quantity" />
<result property="freezeBeforeQuantity" column="freeze_before_quantity" />
<result property="inventoryAfterQuantity" column="inventory_after_quantity" />
<result property="allocationAfterQuantity" column="allocation_after_quantity" />
<result property="freezeAfterQuantity" column="freeze_after_quantity" />
<result property="createTime" column="create_time" />
<result property="createBy" column="create_by" />
<result property="createByName" column="create_by_name" />
<result property="updateTime" column="update_time" />
<result property="updateBy" column="update_by" />
<result property="updateByName" column="update_by_name" />
<result property="delFlag" column="del_flag" />
<result property="extAttr1" column="ext_attr_1" />
<result property="extAttr2" column="ext_attr_2" />
<result property="extAttr3" column="ext_attr_3" />
<result property="extAttr4" column="ext_attr_4" />
<result property="productionDate" column="production_date" />
<result property="expiryDate" column="expiry_date" />
<result property="inventoryDate" column="inventory_date" />
<result property="batchRefNo" column="batch_ref_no" />
<result property="sheetRefNo" column="sheet_ref_no" />
<result property="boxPalletNo" column="box_pallet_no" />
<result property="adjustAction" column="adjust_action" />
<result property="relateNo" column="relate_no" />
<result property="inOrderNumber" column="in_order_number" />
<result property="lotNumber" column="lot_number" />
<result property="batchNumber" column="batch_number" />
</resultMap>
<sql id="selectInventoryAdjustmentRecordPo">
select a.inventory_adjustment_id, a.organization_id, a.organization_name, a.top_organization_id, a.material_inventory_id,
a.material_base_info_id, a.material_code, a.material_name, a.bar_code, a.shipper_id, 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.adjust_type, a.adjust_direction, a.adjust_before_status_code,
a.adjust_before_status_name, a.adjust_after_status_code, a.adjust_after_status_name, a.inventory_before_quantity,
a.allocation_before_quantity, a.freeze_before_quantity, a.inventory_after_quantity, a.allocation_after_quantity,
a.freeze_after_quantity, a.create_time, a.create_by, a.create_by_name, a.update_time, a.update_by, a.update_by_name,
a.del_flag,a.net_weight,
a.gross_weight,
a.volume,
a.area,
a.adjusted_net_weight,
a.adjusted_gross_weight,
a.adjusted_volume,
a.adjusted_area,
b.ext_attr_1, b.ext_attr_2, b.ext_attr_3, b.ext_attr_4,
b.production_date, b.expiry_date, b.inventory_date,
b.batch_ref_no, b.sheet_ref_no, b.box_pallet_no,a.ADJUST_ACTION,a.RELATE_NO,
a.in_order_number,a.lot_number,b.batch_number
from inventory_adjustment_record a left join material_inventory b on a.material_inventory_id = b.material_inventory_id
where a.del_flag = 1
</sql>
<sql id="selectInventoryAdjustmentRecordPo1">
<if test="organizationId != null ">
and a.organization_id = #{organizationId}
</if>
<if test="organizationName != null and organizationName != ''">
and a.organization_name like concat('%', #{organizationName}, '%')
</if>
<if test="topOrganizationId != null ">
and a.top_organization_id = #{topOrganizationId}
</if>
<if test="materialBaseInfoId != null ">
and a.material_base_info_id = #{materialBaseInfoId}
</if>
<if test="materialInventoryId != null ">
and a.material_inventory_id = #{materialInventoryId}
</if>
<if test="materialCode != null and materialCode != ''">
and a.material_code = #{materialCode}
</if>
<if test="adjustAction != null and adjustAction != ''">
and a.adjust_action = #{adjustAction}
</if>
<if test="relateNo != null and relateNo != ''">
and a.relate_no = #{relateNo}
</if>
<if test="materialName != null and materialName != ''">
and a.material_name like concat('%', #{materialName}, '%')
</if>
<if test="barCode != null and barCode != ''">
and a.bar_code = #{barCode}
</if>
<if test="shipperId != null ">
and a.shipper_id = #{shipperId}
</if>
<if test="shipperName != null and shipperName != ''">
and a.shipper_name like concat('%', #{shipperName}, '%')
</if>
<if test="warehouseId != null ">
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="storageSectionId != null ">
and a.storage_section_id = #{storageSectionId}
</if>
<if test="storageCode != null and storageCode != ''">
and a.storage_code = #{storageCode}
</if>
<if test="storageName != null and storageName != ''">
and a.storage_name like concat('%', #{storageName}, '%')
</if>
<if test="storageLocationId != null ">
and a.storage_location_id = #{storageLocationId}
</if>
<if test="storageLocationCode != null and storageLocationCode != ''">
and a.storage_location_code = #{storageLocationCode}
</if>
<if test="storageLocationName != null and storageLocationName != ''">
and a.storage_location_name like concat('%', #{storageLocationName}, '%')
</if>
<if test="adjustType != null ">
and a.adjust_type = #{adjustType}
</if>
<if test="adjustDirection != null ">
and a.adjust_direction = #{adjustDirection}
</if>
<if test="adjustBeforeStatusCode != null ">
and a.adjust_before_status_code = #{adjustBeforeStatusCode}
</if>
<if test="adjustBeforeStatusName != null ">
and a.adjust_before_status_name = #{adjustBeforeStatusName}
</if>
<if test="adjustAfterStatusCode != null ">
and a.adjust_after_status_code = #{adjustAfterStatusCode}
</if>
<if test="adjustAfterStatusName != null ">
and a.adjust_after_status_name = #{adjustAfterStatusName}
</if>
<if test="inventoryBeforeQuantity != null ">
and a.inventory_before_quantity = #{inventoryBeforeQuantity}
</if>
<if test="allocationBeforeQuantity != null ">
and a.allocation_before_quantity = #{allocationBeforeQuantity}
</if>
<if test="freezeBeforeQuantity != null ">
and a.freeze_before_quantity = #{freezeBeforeQuantity}
</if>
<if test="inventoryAfterQuantity != null ">
and a.inventory_after_quantity = #{inventoryAfterQuantity}
</if>
<if test="allocationAfterQuantity != null ">
and a.allocation_after_quantity = #{allocationAfterQuantity}
</if>
<if test="freezeAfterQuantity != null ">
and a.freeze_after_quantity = #{freezeAfterQuantity}
</if>
<if test="createByName != null and createByName != ''">
and a.create_by_name like concat('%', #{createByName}, '%')
</if>
<if test="updateByName != null and updateByName != ''">
and a.update_by_name like concat('%', #{updateByName}, '%')
</if>
order by a.create_time desc
</sql>
<select id="queryList" parameterType="com.mhd.oms.domain.reservationInventoryAdjustmentRecord.repository.todo.ReservationInventoryAdjustmentRecordDO" resultMap="InventoryAdjustmentRecordResult">
<include refid="selectInventoryAdjustmentRecordPo"/>
<include refid="selectInventoryAdjustmentRecordPo1"/>
</select>
</mapper>
@@ -0,0 +1,404 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.mhd.oms.domain.reservationMaterialInventory.repository.mapper.ReservationMaterialInventoryMapper">
<resultMap type="com.mhd.oms.domain.reservationMaterialInventory.repository.po.ReservationMaterialInventoryPO" id="MaterialInventoryResult">
<result property="materialInventoryId" column="material_inventory_id" />
<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" />
<result property="storageSectionId" column="storage_section_id" />
<result property="storageCode" column="storage_code" />
<result property="storageName" column="storage_name" />
<result property="storageLocationId" column="storage_location_id" />
<result property="storageLocationCode" column="storage_location_code" />
<result property="storageLocationName" column="storage_location_name" />
<result property="materialBaseInfoId" column="material_base_info_id" />
<result property="materialDetailId" column="material_detail_id" />
<result property="batchNumber" column="batch_number" />
<result property="materialStatusCode" column="material_status_code" />
<result property="materialStatusName" column="material_status_name" />
<result property="containerId" column="container_id" />
<result property="containerCode" column="container_code" />
<result property="containerType" column="container_type" />
<result property="containerTypeName" column="container_type_name" />
<result property="freezeQuantity" column="freeze_quantity" />
<result property="inventoryQuantity" column="inventory_quantity" />
<result property="allocationQuantity" column="allocation_quantity" />
<result property="remark" column="remark" />
<result property="createTime" column="create_time" />
<result property="createBy" column="create_by" />
<result property="createByName" column="create_by_name" />
<result property="updateTime" column="update_time" />
<result property="updateBy" column="update_by" />
<result property="updateByName" column="update_by_name" />
<result property="delFlag" column="del_flag" />
<result property="isAble" column="is_able" />
<result property="unit" column="unit" />
<result property="netWeight" column="net_weight" />
<result property="grossWeight" column="gross_weight" />
<result property="volume" column="volume" />
<result property="area" column="area" />
<result property="extAttr1" column="ext_attr_1" />
<result property="extAttr2" column="ext_attr_2" />
<result property="extAttr3" column="ext_attr_3" />
<result property="extAttr4" column="ext_attr_4" />
<result property="productionDate" column="production_date" />
<result property="expiryDate" column="expiry_date" />
<result property="inventoryDate" column="inventory_date" />
<result property="batchRefNo" column="batch_ref_no" />
<result property="sheetRefNo" column="sheet_ref_no" />
<result property="boxPalletNo" column="box_pallet_no" />
<result property="packName" column="pack_name" />
<result property="unitName" column="unit_name" />
<result property="barCode" column="inv_bar_code" />
<result property="inOrderNumber" column="in_order_number" />
<result property="lotNumber" column="lot_number" />
</resultMap>
<sql id="selectMaterialInventoryPo">
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 (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
</sql>
<sql id="selectMaterialInventoryPo1">
<if test="materialInventoryId != null ">
and a.material_inventory_id = #{materialInventoryId}
</if>
<if test="organizationId != null ">
and a.organization_id = #{organizationId}
</if>
<if test="organizationName != null and organizationName != ''">
and a.organization_name like concat('%', #{organizationName}, '%')
</if>
<if test="topOrganizationId != null ">
and a.top_organization_id = #{topOrganizationId}
</if>
<if test="warehouseId != null ">
and a.warehouse_id = #{warehouseId}
</if>
<if test="shipperId != null ">
and a.shipper_id = #{shipperId}
</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="storageSectionId != null ">
and a.storage_section_id = #{storageSectionId}
</if>
<if test="storageCode != null and storageCode != ''">
and a.storage_code = #{storageCode}
</if>
<if test="storageName != null and storageName != ''">
and a.storage_name like concat('%', #{storageName}, '%')
</if>
<if test="storageLocationId != null ">
and a.storage_location_id = #{storageLocationId}
</if>
<if test="storageLocationCode != null and storageLocationCode != ''">
and a.storage_location_code = #{storageLocationCode}
</if>
<if test="storageLocationName != null and storageLocationName != ''">
and a.storage_location_name like concat('%', #{storageLocationName}, '%')
</if>
<if test="materialBaseInfoId != null ">
and a.material_base_info_id = #{materialBaseInfoId}
</if>
<if test="materialDetailId != null ">
and a.material_detail_id, = #{materialDetailId}
</if>
<!-- 容器号或批次号:containerOrBatch 优先;若 batchNumber 与 containerCode 相同则按 OR 查(PDA 单输入框传两个相同值) -->
<choose>
<when test="containerOrBatch != null and containerOrBatch != ''">
and (a.container_code like concat('%', #{containerOrBatch}, '%') or a.batch_number like concat('%', #{containerOrBatch}, '%'))
</when>
<when test="batchNumber != null and batchNumber != '' and containerCode != null and containerCode != '' and batchNumber == containerCode">
and (a.batch_number like concat('%', #{batchNumber}, '%') or a.container_code like concat('%', #{containerCode}, '%'))
</when>
<otherwise>
<if test="batchNumber != null and batchNumber != ''">
and a.batch_number like concat('%', #{batchNumber}, '%')
</if>
<if test="containerCode != null and containerCode != ''">
and a.container_code like concat('%', #{containerCode}, '%')
</if>
</otherwise>
</choose>
<if test="materialStatusCode != null and materialStatusCode != ''">
and a.material_status_code like concat('%', #{materialStatusCode}, '%')
</if>
<if test="materialStatusName != null and materialStatusName != ''">
and a.material_status_name like concat('%', #{materialStatusName}, '%')
</if>
<if test="containerId != null ">
and a.container_id = #{containerId}
</if>
<if test="containerType != null and containerType != ''">
and a.container_type like concat('%', #{containerType}, '%')
</if>
<if test="containerTypeName != null and containerTypeName != ''">
and a.container_type_name like concat('%', #{containerTypeName}, '%')
</if>
<choose>
<when test="inventoryQuantity != null"> and a.inventory_quantity = #{inventoryQuantity} </when>
<otherwise> and a.inventory_quantity != 0 </otherwise>
</choose>
<if test="allocationQuantity != null ">
and a.allocation_quantity = #{allocationQuantity}
</if>
<if test="freezeQuantity != null ">
and a.freeze_quantity = #{freezeQuantity}
</if>
<if test="createByName != null and createByName != ''">
and a.create_by_name like concat('%', #{createByName}, '%')
</if>
<if test="updateByName != null and updateByName != ''">
and a.update_by_name like concat('%', #{updateByName}, '%')
</if>
<choose>
<when test="delFlag != null"> and a.del_flag = #{delFlag} </when>
<otherwise> and a.del_flag = 1 </otherwise>
</choose>
<if test="storageInfo != null and storageInfo != ''">
and (a.storage_location_code = #{storageInfo} or material_code = #{storageInfo} or material_name like concat('%', #{storageInfo}, '%') or bar_code = #{storageInfo})
</if>
<if test="batchRefNo != null and batchRefNo != ''">
and a.BATCH_REF_NO like concat('%', #{batchRefNo}, '%')
</if>
<if test="sheetRefNo != null and sheetRefNo != ''">
and a.SHEET_REF_NO like concat('%', #{sheetRefNo}, '%')
</if>
<if test="boxPalletNo != null and boxPalletNo != ''">
and a.BOX_PALLET_NO like concat('%', #{boxPalletNo}, '%')
</if>
</sql>
<select id="queryList" parameterType="com.mhd.oms.domain.reservationMaterialInventory.repository.todo.ReservationMaterialInventoryDO" resultMap="MaterialInventoryResult">
select
<include refid="selectMaterialInventoryPo"/>
<include refid="com.mhd.wms.domain.materialBaseInfo.repository.mapper.MaterialBaseInfoMapper.JoinMaterialBaseInfoPo"/>
from reservation_material_inventory a
left join NGWL_TEST_WMS.material_base_info b on a.material_base_info_id = b.material_base_info_id
<where>
<include refid="selectMaterialInventoryPo1"/>
<include refid="com.mhd.wms.domain.materialBaseInfo.repository.mapper.MaterialBaseInfoMapper.JoinMaterialBaseInfoPoWhere"/>
</where>
group by a.MATERIAL_INVENTORY_ID order by a.update_time desc
</select>
<select id="queryListByWlKw" parameterType="com.mhd.oms.domain.reservationMaterialInventory.repository.todo.ReservationMaterialInventoryDO" resultMap="MaterialInventoryResult">
select
<include refid="selectMaterialInventoryPo"/>
<include refid="com.mhd.wms.domain.materialBaseInfo.repository.mapper.MaterialBaseInfoMapper.JoinMaterialBaseInfoPo"/>
from reservation_material_inventory a
left join NGWL_TEST_WMS.material_base_info b on a.material_base_info_id = b.material_base_info_id
<where>
<include refid="selectMaterialInventoryPo1"/>
<include refid="com.mhd.wms.domain.materialBaseInfo.repository.mapper.MaterialBaseInfoMapper.JoinMaterialBaseInfoPoWhere"/>
</where>
GROUP BY a.MATERIAL_BASE_INFO_ID,a.WAREHOUSE_ID,a.STORAGE_SECTION_ID,a.STORAGE_LOCATION_ID
</select>
<select id="queryListByKw" parameterType="com.mhd.oms.domain.reservationMaterialInventory.repository.todo.ReservationMaterialInventoryDO" resultMap="MaterialInventoryResult">
select
<include refid="selectMaterialInventoryPo"/>
<include refid="com.mhd.wms.domain.materialBaseInfo.repository.mapper.MaterialBaseInfoMapper.JoinMaterialBaseInfoPo"/>
from reservation_material_inventory a
left join NGWL_TEST_WMS.material_base_info b on a.material_base_info_id = b.material_base_info_id
<where>
<include refid="selectMaterialInventoryPo1"/>
<include refid="com.mhd.wms.domain.materialBaseInfo.repository.mapper.MaterialBaseInfoMapper.JoinMaterialBaseInfoPoWhere"/>
</where>
GROUP BY a.WAREHOUSE_ID,a.STORAGE_SECTION_ID,a.STORAGE_LOCATION_ID
</select>
<select id="queryListByWl" parameterType="com.mhd.oms.domain.reservationMaterialInventory.repository.todo.ReservationMaterialInventoryDO" resultMap="MaterialInventoryResult">
select
<include refid="selectMaterialInventoryPo"/>
<include refid="com.mhd.wms.domain.materialBaseInfo.repository.mapper.MaterialBaseInfoMapper.JoinMaterialBaseInfoPo"/>
from reservation_material_inventory a
left join NGWL_TEST_WMS.material_base_info b on a.material_base_info_id = b.material_base_info_id
<where>
<include refid="selectMaterialInventoryPo1"/>
<include refid="com.mhd.wms.domain.materialBaseInfo.repository.mapper.MaterialBaseInfoMapper.JoinMaterialBaseInfoPoWhere"/>
</where>
GROUP BY a.MATERIAL_BASE_INFO_ID
</select>
<select id="queryListByHz" parameterType="com.mhd.oms.domain.reservationMaterialInventory.repository.todo.ReservationMaterialInventoryDO" resultMap="MaterialInventoryResult">
select
<include refid="selectMaterialInventoryPo"/>
<include refid="com.mhd.wms.domain.materialBaseInfo.repository.mapper.MaterialBaseInfoMapper.JoinMaterialBaseInfoPo"/>
from reservation_material_inventory a
left join NGWL_TEST_WMS.material_base_info b on a.material_base_info_id = b.material_base_info_id
<where>
<include refid="selectMaterialInventoryPo1"/>
<include refid="com.mhd.wms.domain.materialBaseInfo.repository.mapper.MaterialBaseInfoMapper.JoinMaterialBaseInfoPoWhere"/>
</where>
GROUP BY a.SHIPPER_ID
</select>
<resultMap type="com.mhd.oms.domain.reservationMaterialInventory.repository.po.ReservationMaterialInventoryQueryListPO" id="MaterialQueryListResult">
<result property="materialInventoryId" column="material_inventory_id" />
<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="materialCode" column="material_code" />
<result property="materialName" column="material_name" />
<result property="barCode" column="inv_bar_code" />
<result property="packId" column="pack_id" />
<result property="packCode" column="pack_code" />
<result property="packName" column="pack_name" />
<result property="warehouseId" column="warehouse_id" />
<result property="warehouseCode" column="warehouse_code" />
<result property="warehouseName" column="warehouse_name" />
<result property="storageSectionId" column="storage_section_id" />
<result property="storageCode" column="storage_code" />
<result property="storageName" column="storage_name" />
<result property="storageLocationId" column="storage_location_id" />
<result property="storageLocationCode" column="storage_location_code" />
<result property="storageLocationName" column="storage_location_name" />
<result property="materialBaseInfoId" column="material_base_info_id" />
<result property="batchNumber" column="batch_number" />
<result property="inOrderNumber" column="in_order_number" />
<result property="lotNumber" column="lot_number" />
<result property="materialStatusCode" column="material_status_code" />
<result property="materialStatusName" column="material_status_name" />
<result property="containerId" column="container_id" />
<result property="containerCode" column="container_code" />
<result property="containerType" column="container_type" />
<result property="containerTypeName" column="container_type_name" />
<result property="inventoryQuantity" column="inventory_quantity" />
<result property="allocationQuantity" column="allocation_quantity" />
<result property="freezeQuantity" column="freeze_quantity" />
<result property="isAble" column="is_able" />
<result property="unit" column="unit" />
<result property="unitName" column="unit_name" />
<result property="netWeight" column="NET_WEIGHT" />
<result property="grossWeight" column="GROSS_WEIGHT" />
<result property="volume" column="VOLUME" />
<result property="area" column="area" />
<result property="batchRefNo" column="BATCH_REF_NO" />
<result property="sheetRefNo" column="SHEET_REF_NO" />
<result property="boxPalletNo" column="BOX_PALLET_NO" />
<result property="extAttr1" column="ext_attr_1" />
<result property="extAttr2" column="ext_attr_2" />
<result property="productionDate" column="production_date" />
<result property="expiryDate" column="expiry_date" />
<result property="inventoryDate" column="inventory_date" />
<result property="extAttr3" column="ext_attr_3" />
<result property="extAttr4" column="ext_attr_4" />
<result property="remark" column="remark" />
<result property="createTime" column="create_time" />
<result property="createBy" column="create_by" />
<result property="createByName" column="create_by_name" />
<result property="updateTime" column="update_time" />
<result property="updateBy" column="update_by" />
<result property="updateByName" column="update_by_name" />
<result property="delFlag" column="del_flag" />
</resultMap>
<!-- 1-按货主 2-按物料 3-按批次 4-按库位 5-按物料/库位 6-按容器 0-全部 -->
<sql id="materialQueryListByGroup">
<choose>
<when test="queryType != null and queryType == 1">
group by a.shipper_id
order by max(a.shipper_name)
</when>
<when test="queryType != null and queryType == 2">
group by b.material_base_info_id, a.shipper_id
order by max(b.material_name), max(a.shipper_name)
</when>
<when test="queryType != null and queryType == 3">
group by b.material_base_info_id, a.shipper_id, a.batch_number
order by max(b.material_name), max(a.shipper_name), a.batch_number
</when>
<when test="queryType != null and queryType == 4">
group by a.storage_location_id
order by max(a.storage_location_code)
</when>
<when test="queryType != null and queryType == 5">
group by b.material_base_info_id, a.storage_location_id, a.shipper_id
order by max(b.material_name), max(a.storage_location_code), max(a.shipper_name)
</when>
<when test="queryType != null and queryType == 6">
group by a.container_id, a.container_code, a.container_type, a.container_type_name
order by a.container_type_name, b.material_name, a.storage_location_name
</when>
<otherwise>
group by a.material_inventory_id
order by a.shipper_name, b.material_name, a.storage_location_name, a.batch_number
</otherwise>
</choose>
</sql>
<!-- 根据库存ID查询库存信息(包含批次属性字段) -->
<select id="selectByIdWithBatchAttributes" parameterType="java.lang.Long" resultMap="MaterialInventoryResult">
SELECT
material_inventory_id, organization_id, organization_name, top_organization_id,
material_base_info_id, shipper_id, shipper_code, shipper_name, material_detail_id,
warehouse_id, warehouse_code, warehouse_name,
storage_section_id, storage_code, storage_name, storage_location_id, storage_location_code, storage_location_name,
batch_number, material_status_code, material_status_name,
container_id, container_code, container_type, container_type_name,
inventory_quantity, allocation_quantity, freeze_quantity, remark, is_able, unit,
net_weight, gross_weight, volume, area,
ext_attr_1, ext_attr_2, ext_attr_3, ext_attr_4,
production_date, expiry_date, inventory_date,
batch_ref_no, sheet_ref_no, box_pallet_no,
create_time, create_by, create_by_name, update_time, update_by, update_by_name, del_flag
FROM reservation_material_inventory
WHERE material_inventory_id = #{materialInventoryId} AND del_flag = 1
</select>
<!-- 根据库存ID查询库存信息(包含批次属性字段) -->
<select id="getByInfoId" parameterType="java.lang.Long" resultType="com.mhd.oms.domain.reservationMaterialInventory.repository.todo.MaterialBaseInfo">
SELECT
*
FROM NGWL_TEST_WMS.material_base_info
WHERE material_base_info_id = #{id} AND del_flag = 1
</select>
<select id="getInfoByMaterialBaseInfoIds" parameterType="java.lang.Long" resultType="com.mhd.oms.domain.reservationMaterialInventory.repository.todo.MaterialBarCodePO">
SELECT
*
FROM NGWL_TEST_WMS.material_bar_code
WHERE material_base_info_id = #{id} AND del_flag = 1
</select>
</mapper>