Files
nanguangszwlback/mhd_wms/src/main/resources/mapper/shiftMaterialDetail/ShiftMaterialDetailMapper.xml
T
2026-03-16 16:16:28 +08:00

292 lines
15 KiB
XML

<?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.wms.domain.shiftMaterialDetail.repository.mapper.ShiftMaterialDetailMapper">
<resultMap type="com.mhd.wms.domain.shiftMaterialDetail.repository.po.ShiftMaterialDetailPO" id="ShiftMaterialDetailResult">
<result property="shiftIoDetailId" column="shift_io_detail_id" />
<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="uniqueId" column="unique_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="shiftNumber" column="shift_number" />
<result property="materialStatusCode" column="material_status_code" />
<result property="materialStatusName" column="material_status_name" />
<result property="shiftStatus" column="shift_status" />
<result property="inventoryQuantity" column="inventory_quantity" />
<result property="quantity" column="quantity" />
<result property="shiftQuantity" column="shift_quantity" />
<result property="batchNumber" column="batch_number" />
<result property="shiftType" column="shift_type" />
<result property="oldWarehouseId" column="old_warehouse_id" />
<result property="oldWarehouseCode" column="old_warehouse_code" />
<result property="oldWarehouseName" column="old_warehouse_name" />
<result property="oldStorageSectionId" column="old_storage_section_id" />
<result property="oldStorageCode" column="old_storage_code" />
<result property="oldStorageName" column="old_storage_name" />
<result property="oldStorageLocationId" column="old_storage_location_id" />
<result property="oldStorageLocationCode" column="old_storage_location_code" />
<result property="oldStorageLocationName" column="old_storage_location_name" />
<result property="newWarehouseId" column="new_warehouse_id" />
<result property="newWarehouseCode" column="new_warehouse_code" />
<result property="newWarehouseName" column="new_warehouse_name" />
<result property="newStorageSectionId" column="new_storage_section_id" />
<result property="newStorageCode" column="new_storage_code" />
<result property="newStorageName" column="new_storage_name" />
<result property="newStorageLocationId" column="new_storage_location_id" />
<result property="newStorageLocationCode" column="new_storage_location_code" />
<result property="newStorageLocationName" column="new_storage_location_name" />
<result property="packId" column="pack_id" />
<result property="packCode" column="pack_code" />
<result property="packName" column="pack_name" />
<result property="packDetailId" column="pack_detail_id" />
<result property="unitCode" column="unit_code" />
<result property="unitName" column="unit_name" />
<result property="unitNumber" column="unit_number" />
<result property="materialWarehouseControlId" column="material_warehouse_control_id" />
<result property="serialNumberManage" column="serial_number_manage" />
<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="level" column="level" />
<result property="parentUniqueId" column="parent_unique_id" />
<result property="netWeight" column="net_weight" />
<result property="grossWeight" column="gross_weight" />
<result property="volume" column="volume" />
<result property="area" column="area" />
<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>
<sql id="selectShiftMaterialDetailPo">
select shift_io_detail_id, organization_id, organization_name, top_organization_id, unique_id, material_inventory_id, material_base_info_id, material_code, material_name, bar_code, shift_number, shift_status, inventory_quantity, quantity, already_shift_quantity, shift_quantity, batch_number,shift_type,old_warehouse_id, old_warehouse_code, old_warehouse_name, old_storage_section_id, old_storage_code, old_storage_name, old_storage_location_id, old_storage_location_code, old_storage_location_name, new_warehouse_id, new_warehouse_code, new_warehouse_name, new_storage_section_id, new_storage_code, new_storage_name, new_storage_location_id, new_storage_location_code, new_storage_location_name, pack_id, pack_code, pack_name, pack_detail_id, unit_code, unit_name, unit_number, material_warehouse_control_id, serial_number_manage, container_id, container_code, container_type, container_type_name, level, parent_unique_id, remark, create_time, create_by, create_by_name, update_time, update_by, update_by_name, del_flag,material_status_code,material_status_name,net_weight,gross_weight,volume,area from shift_material_detail
</sql>
<sql id="selectShiftMaterialDetailPo1">
<where>
and del_flag = 1
<if test="organizationId != null ">
and organization_id = #{organizationId}
</if>
<if test="organizationName != null and organizationName != ''">
and organization_name like concat('%', #{organizationName}, '%')
</if>
<if test="topOrganizationId != null ">
and top_organization_id = #{topOrganizationId}
</if>
<if test="uniqueId != null ">
and unique_id = #{uniqueId}
</if>
<if test="materialBaseInfoId != null ">
and material_base_info_id = #{materialBaseInfoId}
</if>
<if test="materialCode != null and materialCode != ''">
and material_code = #{materialCode}
</if>
<if test="materialName != null and materialName != ''">
and material_name like concat('%', #{materialName}, '%')
</if>
<if test="barCode != null and barCode != ''">
and bar_code = #{barCode}
</if>
<if test="shiftNumber != null and shiftNumber != ''">
and shift_number like concat('%',#{shiftNumber},'%')
</if>
<if test="shiftStatus != null ">
and shift_status = #{shiftStatus}
</if>
<if test="inventoryQuantity != null ">
and inventory_quantity = #{inventoryQuantity}
</if>
<if test="quantity != null ">
and quantity = #{quantity}
</if>
<if test="shiftQuantity != null ">
and shift_quantity = #{shiftQuantity}
</if>
<if test="oldWarehouseId != null ">
and old_warehouse_id = #{oldWarehouseId}
</if>
<if test="oldWarehouseCode != null and oldWarehouseCode != ''">
and old_warehouse_code = #{oldWarehouseCode}
</if>
<if test="oldWarehouseName != null and oldWarehouseName != ''">
and old_warehouse_name like concat('%', #{oldWarehouseName}, '%')
</if>
<if test="oldStorageSectionId != null ">
and old_storage_section_id = #{oldStorageSectionId}
</if>
<if test="oldStorageCode != null and oldStorageCode != ''">
and old_storage_code = #{oldStorageCode}
</if>
<if test="oldStorageName != null and oldStorageName != ''">
and old_storage_name like concat('%', #{oldStorageName}, '%')
</if>
<if test="oldStorageLocationId != null ">
and old_storage_location_id = #{oldStorageLocationId}
</if>
<if test="oldStorageLocationCode != null and oldStorageLocationCode != ''">
and old_storage_location_code = #{oldStorageLocationCode}
</if>
<if test="oldStorageLocationName != null and oldStorageLocationName != ''">
and old_storage_location_name like concat('%', #{oldStorageLocationName}, '%')
</if>
<if test="newWarehouseId != null ">
and new_warehouse_id = #{newWarehouseId}
</if>
<if test="newWarehouseCode != null and newWarehouseCode != ''">
and new_warehouse_code = #{newWarehouseCode}
</if>
<if test="newWarehouseName != null and newWarehouseName != ''">
and new_warehouse_name like concat('%', #{newWarehouseName}, '%')
</if>
<if test="newStorageSectionId != null ">
and new_storage_section_id = #{newStorageSectionId}
</if>
<if test="newStorageCode != null and newStorageCode != ''">
and new_storage_code = #{newStorageCode}
</if>
<if test="newStorageName != null and newStorageName != ''">
and new_storage_name like concat('%', #{newStorageName}, '%')
</if>
<if test="newStorageLocationId != null ">
and new_storage_location_id = #{newStorageLocationId}
</if>
<if test="newStorageLocationCode != null and newStorageLocationCode != ''">
and new_storage_location_code = #{newStorageLocationCode}
</if>
<if test="newStorageLocationName != null and newStorageLocationName != ''">
and new_storage_location_name like concat('%', #{newStorageLocationName}, '%')
</if>
<if test="packId != null ">
and pack_id = #{packId}
</if>
<if test="packCode != null and packCode != ''">
and pack_code = #{packCode}
</if>
<if test="packName != null and packName != ''">
and pack_name like concat('%', #{packName}, '%')
</if>
<if test="packDetailId != null ">
and pack_detail_id = #{packDetailId}
</if>
<if test="unitCode != null and unitCode != ''">
and unit_code = #{unitCode}
</if>
<if test="unitName != null and unitName != ''">
and unit_name like concat('%', #{unitName}, '%')
</if>
<if test="unitNumber != null ">
and unit_number = #{unitNumber}
</if>
<if test="materialWarehouseControlId != null ">
and material_warehouse_control_id = #{materialWarehouseControlId}
</if>
<if test="serialNumberManage != null ">
and serial_number_manage = #{serialNumberManage}
</if>
<if test="containerId != null ">
and container_id = #{containerId}
</if>
<if test="containerCode != null and containerCode != ''">
and container_code = #{containerCode}
</if>
<if test="containerType != null and containerType != ''">
and container_type = #{containerType}
</if>
<if test="containerTypeName != null and containerTypeName != ''">
and container_type_name like concat('%', #{containerTypeName}, '%')
</if>
<if test="level != null ">
and level = #{level}
</if>
<if test="createByName != null and createByName != ''">
and create_by_name like concat('%', #{createByName}, '%')
</if>
<if test="updateByName != null and updateByName != ''">
and update_by_name like concat('%', #{updateByName}, '%')
</if>
<if test="remark != null and remark != ''">
and remark like concat('%',#{remark},'%')
</if>
</where>
</sql>
<update id="updateShiftMaterialDetail">
update shift_material_detail
set shift_quantity = #{shiftQuantity},shift_status = #{shiftStatus}
where shift_io_detail_id = #{shiftIoDetailId}
</update>
<select id="queryList" parameterType="com.mhd.wms.domain.shiftMaterialDetail.repository.todo.ShiftMaterialDetailDO" resultMap="ShiftMaterialDetailResult">
<include refid="selectShiftMaterialDetailPo"/>
<include refid="selectShiftMaterialDetailPo1"/>
order by material_name
</select>
<select id="queryGroupList"
resultType="com.mhd.wms.domain.shiftMaterialDetail.repository.po.ShiftMaterialDetailPO">
<include refid="selectShiftMaterialDetailPo"/>
<include refid="selectShiftMaterialDetailPo1"/>
group by shift_number
</select>
<select id="getShiftMaterialDetailPO"
resultType="com.mhd.wms.domain.shiftMaterialDetail.repository.po.ShiftMaterialDetailPO">
<include refid="selectShiftMaterialDetailPo"/>
where new_warehouse_id = #{newWarehouseId}
and new_storage_section_id = #{newStorageSectionId}
and new_storage_location_id = #{newStorageLocationId}
</select>
<select id="getMaterialInventoryPO"
resultType="com.mhd.wms.domain.materialInventory.repository.po.MaterialInventoryPO">
select *
from material_inventory
where del_flag = 1
<if test="newWarehouseId != null">
and warehouse_id = #{newWarehouseId}
</if>
<if test="newStorageSectionId != null">
and storage_section_id = #{newStorageSectionId}
</if>
<if test="newStorageLocationId != null">
and storage_location_id = #{newStorageLocationId}
</if>
</select>
<select id="selectCountGroup" resultType="java.lang.Integer">
SELECT COUNT( 1 ) FROM shift_material_detail WHERE material_base_info_id = #{materialBaseInfoId} and shift_status=2
</select>
<select id="getShiftMaterialDetail"
resultType="com.mhd.wms.domain.shiftMaterialDetail.repository.po.ShiftMaterialDetailPO">
<include refid="selectShiftMaterialDetailPo"/>
where shift_io_detail_id = #{shiftIoDetailId}
</select>
<select id="queryListPDA"
resultType="com.mhd.wms.domain.shiftMaterialDetail.repository.po.ShiftMaterialDetailPO">
<include refid="selectShiftMaterialDetailPo"/>
where shift_status != 1
</select>
<update id="updateCheckDetail">
update shift_material_detail set shift_status = 2
where shift_number = #{shiftNumber}
</update>
</mapper>