oms出入库预约单;

This commit is contained in:
王奎兴
2026-04-27 10:45:29 +08:00
parent a76e9c4367
commit 90652840bb
55 changed files with 16826 additions and 9 deletions
@@ -0,0 +1,343 @@
<?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.reserveInMaterialDetail.repository.mapper.ReserveInMaterialDetailMapper">
<resultMap type="com.mhd.oms.domain.reserveInMaterialDetail.repository.po.ReserveInMaterialDetailPO" id="MaterialDetailResult">
<result property="materialDetailId" column="material_detail_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="quantity" column="quantity" />
<result property="receiptQuantity" column="receipt_quantity" />
<result property="shelvesQuantity" column="shelves_quantity" />
<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" jdbcType="BIGINT" />
<result property="unitCode" column="unit_code" />
<result property="unitName" column="unit_name" />
<result property="materialWarehouseControlId" column="material_warehouse_control_id" />
<result property="serialNumberManage" column="serial_number_manage" />
<result property="qualityInspectionManage" column="quality_inspection_manage" />
<result property="qualityInspectionStage" column="quality_inspection_stage" />
<result property="qualityInspectionRule" column="quality_inspection_rule" />
<result property="qualityInspectionTerm" column="quality_inspection_term" />
<result property="qualityInspectionResults" column="quality_inspection_results" />
<result property="allowOvercharge" column="allow_overcharge" />
<result property="overchargeRatio" column="overcharge_ratio" />
<result property="batchNumber" column="batch_number" />
<result property="materialStatusCode" column="material_status_code" />
<result property="materialStatusName" column="material_status_name" />
<result property="distributeRuleId" column="distribute_rule_id" />
<result property="distributeRuleCode" column="distribute_rule_code" />
<result property="distributeRuleName" column="distribute_rule_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="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="overStockId" column="over_stock_id" />
<result property="overStockStatus" column="over_stock_status" />
<result property="overStockType" column="over_stock_type" />
<result property="specificationModel" column="SPECIFICATION_MODEL" />
<result property="skuCode" column="SKU_CODE" />
<result property="invoiceNo" column="INVOICE_NO" />
<result property="liter" column="LITER" />
<result property="dimensions" column="DIMENSIONS" />
<result property="declarationUnit" column="DECLARATION_UNIT" />
<result property="batchRefNo" column="BATCH_REF_NO" />
<result property="sheetRefNo" column="SHEET_REF_NO" />
<result property="originCountry" column="ORIGIN_COUNTRY" />
<result property="boxPalletNo" column="BOX_PALLET_NO" />
<result property="currency" column="CURRENCY" />
<result property="unit" column="UNIT" />
<result property="declaredQuantity" column="DECLARED_QUANTITY" />
<result property="boxCount" column="BOX_COUNT" />
<result property="pieceCount" column="PIECE_COUNT" />
<result property="inboundQuantity" column="INBOUND_QUANTITY" />
<result property="totalNetWeight" column="TOTAL_NET_WEIGHT" />
<result property="totalGrossWeight" column="TOTAL_GROSS_WEIGHT" />
<result property="totalVolume" column="TOTAL_VOLUME" />
<result property="totalArea" column="TOTAL_AREA" />
<result property="totalPrice" column="TOTAL_PRICE" />
<result property="productionDate" column="PRODUCTION_DATE" />
<result property="expiryDate" column="EXPIRY_DATE" />
<result property="inventoryDate" column="INVENTORY_DATE" />
<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="contractFee" column="contract_fee" />
<result property="monthlyWarehouseFee" column="monthly_warehouse_fee" />
<result property="halfMonthWhFee" column="half_month_wh_fee" />
<result property="discountRate" column="discount_rate" />
<result property="singleVolume" column="single_volume" />
<result property="singleGrossWeight" column="single_gross_weight" />
<result property="lotNo" column="lot_no" />
</resultMap>
<sql id="selectMaterialDetailPo">
a.contract_fee ,
a.monthly_warehouse_fee ,
a.half_month_wh_fee ,
a.discount_rate ,
a.single_volume ,
a.single_gross_weight ,
a.lot_no ,
a.material_detail_id, a.organization_id, a.organization_name, a.top_organization_id, a.unique_id, a.in_order_number, a.material_base_info_id,
a.material_code, a.material_name, a.bar_code, a.quantity, a.receipt_quantity, a.shelves_quantity,
a.receipt_status, a.shelves_status, a.pack_id, a.pack_code, a.pack_name,
CASE
WHEN a.pack_detail_id IS NULL OR TRIM(a.pack_detail_id) = '' THEN NULL
ELSE CAST(a.pack_detail_id AS BIGINT)
END as pack_detail_id, a.unit_code, a.unit_name, a.material_warehouse_control_id, a.serial_number_manage, a.quality_inspection_manage,
a.quality_inspection_stage, a.quality_inspection_rule, a.quality_inspection_ratio, a.quality_inspection_term, a.quality_inspection_results, a.allow_overcharge,
a.overcharge_ratio, a.batch_number, a.material_status_code, a.material_status_name, a.distribute_rule_id, a.distribute_rule_code,
a.distribute_rule_name, a.container_id, a.container_code, a.container_type, a.container_type_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.level, a.parent_unique_id, 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.over_stock_id, a.over_stock_status, a.over_stock_type,
a.SPECIFICATION_MODEL, a.SKU_CODE, a.INVOICE_NO, a.LITER, a.DIMENSIONS, a.DECLARATION_UNIT, a.BATCH_REF_NO, a.SHEET_REF_NO,
a.ORIGIN_COUNTRY, a.BOX_PALLET_NO, a.CURRENCY, a.UNIT, a.DECLARED_QUANTITY, a.BOX_COUNT, a.PIECE_COUNT, a.INBOUND_QUANTITY,
a.TOTAL_NET_WEIGHT, a.TOTAL_GROSS_WEIGHT, a.TOTAL_VOLUME, a.TOTAL_AREA, a.TOTAL_PRICE,
a.PRODUCTION_DATE, a.EXPIRY_DATE, a.INVENTORY_DATE, a.EXT_ATTR_1, a.EXT_ATTR_2, a.EXT_ATTR_3, a.EXT_ATTR_4
,CASE
WHEN (a.quantity - a.receipt_quantity) &lt; 0 THEN 0
ELSE (a.quantity - a.receipt_quantity)
END AS wait_receipt_quantity,
CASE
WHEN (a.receipt_quantity - a.shelves_quantity) &lt; 0 THEN 0
ELSE (a.receipt_quantity - a.shelves_quantity)
END AS wait_shelves_quantity
</sql>
<sql id="selectMaterialDetailPo1">
<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="inOrderNumber != null and inOrderNumber != '' ">
and a.in_order_number = #{inOrderNumber}
</if>
<if test="materialBaseInfoId != null ">
and a.material_base_info_id = #{materialBaseInfoId}
</if>
<if test="materialCode != null and materialCode != ''">
and a.material_code = #{materialCode}
</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="quantity != null ">
and a.quantity = #{quantity}
</if>
<if test="receiptQuantity != null ">
and a.receipt_quantity = #{receiptQuantity}
</if>
<if test="shelvesQuantity != null ">
and a.shelves_quantity = #{shelvesQuantity}
</if>
<if test="packId != null ">
and a.pack_id = #{packId}
</if>
<if test="packCode != null and packCode != ''">
and a.pack_code = #{packCode}
</if>
<if test="packName != null and packName != ''">
and a.pack_name like concat('%', #{packName}, '%')
</if>
<if test="packDetailId != null">
and a.pack_detail_id = #{packDetailId}
</if>
<if test="unitCode != null and unitCode != ''">
and a.unit_code = #{unitCode}
</if>
<if test="unitName != null and unitName != ''">
and a.unit_name like concat('%', #{unitName}, '%')
</if>
<if test="materialWarehouseControlId != null ">
and a.material_warehouse_control_id = #{materialWarehouseControlId}
</if>
<if test="serialNumberManage != null ">
and a.serial_number_manage = #{serialNumberManage}
</if>
<if test="qualityInspectionManage != null ">
and a.quality_inspection_manage = #{qualityInspectionManage}
</if>
<if test="qualityInspectionStage != null ">
and a.quality_inspection_stage = #{qualityInspectionStage}
</if>
<if test="qualityInspectionRule != null ">
and a.quality_inspection_rule = #{qualityInspectionRule}
</if>
<if test="qualityInspectionTerm != null ">
and a.quality_inspection_term = #{qualityInspectionTerm}
</if>
<if test="qualityInspectionResults != null ">
and a.quality_inspection_results = #{qualityInspectionResults}
</if>
<if test="allowOvercharge != null ">
and a.allow_overcharge = #{allowOvercharge}
</if>
<if test="overchargeRatio != null ">
and a.overcharge_ratio = #{overchargeRatio}
</if>
<if test="batchNumber != null and batchNumber != ''">
and a.batch_number = #{batchNumber}
</if>
<if test="materialStatusCode != null and materialStatusCode != ''">
and a.material_status_code = #{materialStatusCode}
</if>
<if test="materialStatusName != null and materialStatusName != ''">
and a.material_status_name like concat('%', #{materialStatusName}, '%')
</if>
<if test="distributeRuleId != null ">
and a.distribute_rule_id = #{distributeRuleId}
</if>
<if test="distributeRuleCode != null and distributeRuleCode != ''">
and a.distribute_rule_code = #{distributeRuleCode}
</if>
<if test="distributeRuleName != null and distributeRuleName != ''">
and a.distribute_rule_name like concat('%', #{distributeRuleName}, '%')
</if>
<if test="containerId != null ">
and a.container_id = #{containerId}
</if>
<if test="containerCode != null and containerCode != ''">
and a.container_code = #{containerCode}
</if>
<if test="containerType != null and containerType != ''">
and a.container_type = #{containerType}
</if>
<if test="containerTypeName != null and containerTypeName != ''">
and a.container_type_name like concat('%', #{containerTypeName}, '%')
</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>
<if test="inOrderNumberList != null and inOrderNumberList.size > 0 ">
and a.in_order_number in
<foreach collection="inOrderNumberList" item="item" index="index" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
<choose>
<when test="delFlag != null"> and a.del_flag = #{delFlag} </when>
<otherwise> and a.del_flag = 1 </otherwise>
</choose>
</sql>
<sql id="joinMaterialDetailPoWhere">
<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="overStockStatus != null ">
and a.over_stock_status = #{overStockStatus}
</if>
<if test="materialBaseInfoId != null ">
and a.material_base_info_id = #{materialBaseInfoId}
</if>
<if test="materialBaseInfoIdList != null and materialBaseInfoIdList != ''">
and a.material_base_info_id in
<foreach collection="materialBaseInfoIdList" item="item" index="index" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
<choose>
<when test="delFlag != null"> and a.del_flag = #{delFlag} </when>
<otherwise> and a.del_flag = 1 </otherwise>
</choose>
</sql>
<sql id="joinStockInOrderPoWhere">
<if test="outOrderNumber != null and outOrderNumber != ''">
and b.out_order_number = #{outOrderNumber}
</if>
<if test="warehouseId != null and warehouseId != '' ">
and b.warehouse_id = #{warehouseId}
</if>
<if test="shipperId != null and shipperId != ''">
and b.shipper_id = #{shipperId}
</if>
<if test="shipperIdList != null and shipperIdList != ''">
and b.shipper_id in
<foreach collection="shipperIdList" item="item" index="index" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
<if test="inOrderExpectStartTime != null and inOrderExpectStartTime != ''"><!-- 开始时间检索 -->
and date_format(b.expect_time,'%y%m%d') &gt;= date_format(#{inOrderExpectStartTime},'%y%m%d')
</if>
<if test="inOrderExpectEndTime != null and inOrderExpectEndTime != ''"><!-- 结束时间检索 -->
and date_format(b.expect_time,'%y%m%d') &lt;= date_format(#{inOrderExpectEndTime},'%y%m%d')
</if>
<if test="inOrderTypeCode != null and inOrderTypeCode != ''">
and b.order_type_code = #{outOrderTypeCode}
</if>
<!-- 入库状态: 1-已创建 2-已审核 3-收货中 4-上架中 5-已入库 -->
<if test="inStatus != null ">
and b.status = #{inStatus}
</if>
<choose>
<when test="delFlag != null"> and b.del_flag = #{delFlag} </when>
<otherwise> and b.del_flag = 1 </otherwise>
</choose>
</sql>
<select id="queryList" parameterType="com.mhd.oms.domain.reserveInMaterialDetail.repository.todo.ReserveInMaterialDetailDO" resultMap="MaterialDetailResult">
select
<include refid="selectMaterialDetailPo"/>
from reserve_in_material_detail a
<where>
<include refid="selectMaterialDetailPo1"/>
</where>
</select>
<select id="queryInOrderList" parameterType="com.mhd.oms.domain.reserveInMaterialDetail.repository.todo.QueryOrderOverStockDO" resultMap="MaterialDetailResult">
select
<include refid="selectMaterialDetailPo"/>
<include refid="com.mhd.oms.domain.reserveStockInOrder.repository.mapper.ReserveStockInOrderMapper.joinStockInOrderPo"/>
from reserve_in_material_detail a
LEFT JOIN reserve_stock_in_order b ON a.in_order_number = b.in_order_number
<where>
<include refid="joinMaterialDetailPoWhere"/>
<include refid="joinStockInOrderPoWhere"/>
</where>
</select>
<select id="getkctzjl" resultType="com.mhd.oms.domain.reserveInMaterialDetail.repository.todo.InventoryAdjustmentRecordPO">
select * from "NGWL_TEST_WMS".INVENTORY_ADJUSTMENT_RECORD where MATERIAL_BASE_INFO_ID = #{materialBaseInfoId} and RELATE_NO = #{orderNumber} and ADJUST_TYPE = #{adjustType}
</select>
</mapper>
@@ -0,0 +1,408 @@
<?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.reserveOutMaterialDetail.repository.mapper.ReserveOutMaterialDetailMapper">
<resultMap type="com.mhd.oms.domain.reserveOutMaterialDetail.repository.po.ReserveOutMaterialDetailPO" id="MaterialDetailResult">
<result property="materialDetailId" column="material_detail_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="outOrderNumber" column="out_order_number" />
<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="weightLimit" column="weight_limit" />
<result property="volumeLimit" column="volume_limit" />
<result property="quantity" column="quantity" />
<result property="allocationQuantity" column="allocation_quantity" />
<result property="pickingQuantity" column="picking_quantity" />
<result property="checkQuantity" column="check_quantity" />
<result property="waitCheckQuantity" column="WAIT_CHECK_QUANTITY" />
<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="materialWarehouseControlId" column="material_warehouse_control_id" />
<result property="serialNumberManage" column="serial_number_manage" />
<result property="materialInventoryId" column="material_inventory_id" />
<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="level" column="level" />
<result property="parentUniqueId" column="parent_unique_id" />
<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="overStockId" column="over_stock_id" />
<result property="overStockStatus" column="over_stock_status" />
<result property="overStockType" column="over_stock_type" />
<result property="commodityName" column="COMMODITY_NAME" />
<result property="commodityNo" column="COMMODITY_NO" />
<result property="materialNo" column="MATERIAL_NO" />
<result property="specificationModel" column="SPECIFICATION_MODEL" />
<result property="skucode" column="SKUCODE" />
<result property="invoiceNo" column="INVOICE_NO" />
<result property="liter" column="LITER" />
<result property="size" column="SIZE" />
<result property="declareUnit" column="DECLARE_UNIT" />
<result property="batchRefNo" column="BATCH_REF_NO" />
<result property="sheetRefNo" column="SHEET_REF_NO" />
<result property="countryOfOrigin" column="COUNTRY_OF_ORIGIN" />
<result property="boxPalletNo" column="BOX_PALLET_NO" />
<result property="currency" column="CURRENCY" />
<result property="declareQuantity" column="DECLARE_QUANTITY" />
<result property="caseCount" column="CASE_COUNT" />
<result property="pieceCount" column="PIECE_COUNT" />
<result property="outboundQuantity" column="OUTBOUND_QUANTITY" />
<result property="totalNetWeight" column="TOTAL_NET_WEIGHT" />
<result property="totalGrossWeight" column="TOTAL_GROSS_WEIGHT" />
<result property="totalVolume" column="TOTAL_VOLUME" />
<result property="totalArea" column="TOTAL_AREA" />
<result property="totalAmount" column="TOTAL_AMOUNT" />
<result property="unit" column="UNIT" />
<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="contractFee" column="contract_fee" />
<result property="monthlyWarehouseFee" column="monthly_warehouse_fee" />
<result property="halfMonthWhFee" column="half_month_wh_fee" />
<result property="discountRate" column="discount_rate" />
<result property="singleVolume" column="single_volume" />
<result property="singleGrossWeight" column="single_gross_weight" />
<result property="lotNo" column="lot_no" />
<result property="inOrderNumber" column="in_order_number" />
<result property="stockUnit" column="stock_unit" />
<result property="stockQuantity" column="stock_quantity" />
</resultMap>
<sql id="selectMaterialDetailPo">
a.contract_fee ,
a.monthly_warehouse_fee ,
a.half_month_wh_fee ,
a.discount_rate ,
a.single_volume ,
a.single_gross_weight ,
a.lot_no ,
a.stock_quantity ,
a.stock_unit ,a.in_order_number ,
a.material_detail_id, a.organization_id, a.organization_name, a.top_organization_id, a.unique_id, a.out_order_number, a.material_base_info_id, a.line_number, a.material_code, a.material_name, a.bar_code, a.weight_limit, a.volume_limit,
a.quantity, a.already_allocation_quantity, a.allocation_quantity, a.picking_quantity, a.check_quantity, ROUND(GREATEST(0, IFNULL(a.quantity, 0) - IFNULL(a.check_quantity, 0), IFNULL(a.picking_quantity, 0) - IFNULL(a.check_quantity, 0)), 2) AS wait_check_quantity,
a.pack_id, a.pack_code, a.pack_name, a.pack_detail_id, a.unit_code, a.unit_name, a.material_warehouse_control_id, a.serial_number_manage,
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.level, a.parent_unique_id, a.allow_modify,
a.material_inventory_id, a.batch_number, a.container_id, a.container_code, a.container_type, a.container_type_name, a.material_status_code, a.material_status_name,
a.remark, a.create_time, a.create_by,gen_picking_order,
a.create_by_name, a.update_time, a.update_by, a.update_by_name, a.del_flag, a.over_stock_id, a.over_stock_status, a.over_stock_type,
a.COMMODITY_NAME,
a.COMMODITY_NO,
a.MATERIAL_NO ,
a.SPECIFICATION_MODEL,
a.SKUCODE ,
a.INVOICE_NO,
a.LITER,
a.SIZE,
a.DECLARE_UNIT,
a.BATCH_REF_NO,
a.SHEET_REF_NO,
a.COUNTRY_OF_ORIGIN,
a.BOX_PALLET_NO,
a.CURRENCY,
a.DECLARE_QUANTITY,
a.CASE_COUNT,
a.PIECE_COUNT,
a.OUTBOUND_QUANTITY,
a.TOTAL_NET_WEIGHT,
a.TOTAL_GROSS_WEIGHT,
a.TOTAL_VOLUME,
a.TOTAL_AREA,
a.TOTAL_AMOUNT,
a.UNIT,
a.EXT_ATTR_1,
a.EXT_ATTR_2,
a.PRODUCTION_DATE,
a.EXPIRY_DATE,
a.INVENTORY_DATE,
a.EXT_ATTR_3,
a.EXT_ATTR_4,
a.INVENTORY_QUANTITY
</sql>
<sql id="selectMaterialDetailPo1">
<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="outOrderNumber != null and outOrderNumber != '' ">
and a.out_order_number = #{outOrderNumber}
</if>
<if test="materialBaseInfoId != null ">
and a.material_base_info_id = #{materialBaseInfoId}
</if>
<if test="materialCode != null and materialCode != ''">
and a.material_code = #{materialCode}
</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="quantity != null ">
and a.quantity = #{quantity}
</if>
<if test="allocationQuantity != null ">
and a.allocation_quantity = #{allocationQuantity}
</if>
<if test="pickingQuantity != null ">
and a.picking_quantity = #{pickingQuantity}
</if>
<if test="checkQuantity != null ">
and a.check_quantity = #{checkQuantity}
</if>
<if test="packId != null ">
and a.pack_id = #{packId}
</if>
<if test="packCode != null and packCode != ''">
and a.pack_code = #{packCode}
</if>
<if test="packName != null and packName != ''">
and a.pack_name like concat('%', #{packName}, '%')
</if>
<if test="packDetailId != null and packDetailId != ''">
and a.pack_detail_id = #{packDetailId}
</if>
<if test="unitCode != null and unitCode != ''">
and a.unit_code = #{unitCode}
</if>
<if test="unitName != null and unitName != ''">
and a.unit_name like concat('%', #{unitName}, '%')
</if>
<if test="materialWarehouseControlId != null ">
and a.material_warehouse_control_id = #{materialWarehouseControlId}
</if>
<if test="serialNumberManage != null ">
and a.serial_number_manage = #{serialNumberManage}
</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="level != null ">
and a.level = #{level}
</if>
<if test="genPickingOrder != null ">
and a.gen_picking_order = #{genPickingOrder}
</if>
<if test="parentUniqueId != null ">
and a.parent_unique_id = #{parentUniqueId}
</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>
<if test="outOrderNumberList != null and outOrderNumberList.size > 0 ">
and a.out_order_number in
<foreach collection="outOrderNumberList" item="item" index="index" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
<choose>
<when test="delFlag != null"> and a.del_flag = #{delFlag} </when>
<otherwise> and a.del_flag = 1 </otherwise>
</choose>
</sql>
<sql id="joinMaterialDetailPoWhere">
<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="overStockStatus != null ">
and a.over_stock_status = #{overStockStatus}
</if>
<if test="materialBaseInfoId != null ">
and a.material_base_info_id = #{materialBaseInfoId}
</if>
<if test="materialBaseInfoIdList != null and materialBaseInfoIdList != ''">
and a.material_base_info_id in
<foreach collection="materialBaseInfoIdList" item="item" index="index" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
<choose>
<when test="delFlag != null"> and a.del_flag = #{delFlag} </when>
<otherwise> and a.del_flag = 1 </otherwise>
</choose>
</sql>
<sql id="joinStockOutOrderPoWhere">
<if test="outOrderNumber != null and outOrderNumber != ''">
and b.out_order_number = #{outOrderNumber}
</if>
<if test="warehouseId != null and warehouseId != '' ">
and b.warehouse_id = #{warehouseId}
</if>
<if test="shipperId != null and shipperId != ''">
and b.shipper_id = #{shipperId}
</if>
<if test="shipperIdList != null and shipperIdList != ''">
and b.shipper_id in
<foreach collection="shipperIdList" item="item" index="index" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
<if test="outOrderExpectStartTime != null and outOrderExpectStartTime != ''"><!-- 开始时间检索 -->
and date_format(b.expect_time,'%y%m%d') &gt;= date_format(#{outOrderExpectStartTime},'%y%m%d')
</if>
<if test="outOrderExpectEndTime != null and outOrderExpectEndTime != ''"><!-- 结束时间检索 -->
and date_format(b.expect_time,'%y%m%d') &lt;= date_format(#{outOrderExpectEndTime},'%y%m%d')
</if>
<if test="outOrderTypeCode != null and outOrderTypeCode != ''">
and b.order_type_code = #{outOrderTypeCode}
</if>
<!-- 出库状态: 1-已创建 2-已审核 3-部分分配 4-已分配 5-拣货中 6-波次中 7-拣货完成 8-复核中 9-已出库 10-已取消 11-已关闭 -->
<if test="outStatus != null ">
and b.status = #{outStatus}
</if>
<choose>
<when test="delFlag != null"> and b.del_flag = #{delFlag} </when>
<otherwise> and b.del_flag = 1 </otherwise>
</choose>
</sql>
<select id="queryList" parameterType="com.mhd.oms.domain.reserveOutMaterialDetail.repository.todo.ReserveOutMaterialDetailDO" resultMap="MaterialDetailResult">
select
<include refid="selectMaterialDetailPo"/>
from reserve_out_material_detail a
<where>
<include refid="selectMaterialDetailPo1"/>
</where>
</select>
<select id="queryOutOrderList" parameterType="com.mhd.oms.domain.reserveInMaterialDetail.repository.todo.QueryOrderOverStockDO" resultMap="MaterialDetailResult">
select
<include refid="selectMaterialDetailPo"/>
<include refid="com.mhd.oms.domain.reserveStockOutOrder.repository.mapper.ReserveStockOutOrderMapper.joinStockOutOrderPo"/>
from reserve_out_material_detail a
left join reserve_stock_out_order b on a.out_order_number = b.out_order_number
<where>
<include refid="joinMaterialDetailPoWhere"/>
<include refid="joinStockOutOrderPoWhere"/>
</where>
</select>
<update id="batchAddAllocationQuantityByIds" parameterType="com.mhd.oms.domain.reserveOutMaterialDetail.repository.todo.ReserveOutMaterialDetailDO">
UPDATE reserve_out_material_detail
<set>
allocation_quantity = CASE material_detail_id
<foreach collection="children" item="item" index="index" separator=",">
WHEN #{item.materialDetailId} THEN allocation_quantity + #{item.allocationQuantity}
</foreach>
END,
update_by = #{item.updateBy},
update_by_name = #{item.updateByName},
update_time = now()
</set>
WHERE material_detail_id IN
<foreach collection="children" item="item" index="index" open="(" separator="," close=")">
#{item.materialDetailId}
</foreach>
</update>
<update id="batchAddPickingQuantityByIds" parameterType="com.mhd.oms.domain.reserveOutMaterialDetail.repository.todo.ReserveOutMaterialDetailDO">
UPDATE reserve_out_material_detail
<set>
picking_quantity = CASE material_detail_id
<foreach collection="children" item="item" index="index" separator=",">
WHEN #{item.materialDetailId} THEN picking_quantity + #{item.pickingQuantity}
</foreach>
END,
update_by = #{updateBy},
update_by_name = #{updateByName},
update_time = now()
</set>
WHERE material_detail_id IN
<foreach collection="children" item="item" index="index" open="(" separator="," close=")">
#{item.materialDetailId}
</foreach>
</update>
<update id="batchAddPickingQuantityByUniqueIds" parameterType="com.mhd.oms.domain.reserveOutMaterialDetail.repository.todo.ReserveOutMaterialDetailDO">
UPDATE reserve_out_material_detail
<set>
picking_quantity = CASE unique_id
<foreach collection="children" item="item" index="index" separator=",">
WHEN #{item.uniqueId} THEN picking_quantity + #{item.pickingQuantity}
</foreach>
END,
<trim prefix="picking_quantity = CASE unique_id" suffix="END,">
<foreach collection="children" item="item" index="index">
WHEN #{item.uniqueId} THEN picking_quantity + #{item.pickingQuantity}
</foreach>
</trim>
update_by = #{updateBy},
update_by_name = #{updateByName},
update_time = now()
</set>
WHERE unique_id IN
<foreach collection="children" item="item" index="index" open="(" separator="," close=")">
#{item.uniqueId}
</foreach>
</update>
</mapper>
@@ -0,0 +1,528 @@
<?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.reserveStockInOrder.repository.mapper.ReserveStockInOrderMapper">
<resultMap type="com.mhd.oms.domain.reserveStockInOrder.repository.po.ReserveStockInOrderPO" id="StockInOrderResult">
<result property="inOrderId" column="in_order_id" />
<result property="organizationId" column="organization_id" />
<result property="organizationName" column="organization_name" />
<result property="topOrganizationId" column="top_organization_id" />
<result property="noticeNumber" column="notice_number" />
<result property="inOrderNumber" column="in_order_number" />
<result property="status" column="status" />
<result property="auditStatus" column="audit_status" />
<result property="auditRemark" column="audit_remark" />
<result property="auditBy" column="audit_by" />
<result property="auditByName" column="audit_by_name" />
<result property="auditTime" column="audit_time" />
<result property="warehouseId" column="warehouse_id" />
<result property="warehouseCode" column="warehouse_code" />
<result property="warehouseName" column="warehouse_name" />
<result property="shipperId" column="shipper_id" />
<result property="shipperName" column="shipper_name" />
<result property="orderTypeCode" column="order_type_code" />
<result property="orderTypeName" column="order_type_name" />
<result property="supplierId" column="supplier_id" />
<result property="supplierName" column="supplier_name" />
<result property="expectTime" column="expect_time" />
<result property="supplyChainNumber" column="supply_chain_number" />
<result property="priorityLevelCode" column="priority_level_code" />
<result property="priorityLevelName" column="priority_level_name" />
<result property="directWarehouse" column="direct_warehouse" />
<result property="annexUrl" column="annex_url" />
<result property="quantity" column="quantity" />
<result property="planInQuantity" column="plan_in_quantity" />
<result property="receiptQuantity" column="receipt_quantity" />
<result property="shelvesQuantity" column="shelves_quantity" />
<result property="cancelOrder" column="cancel_order" />
<result property="cancelRemark" column="cancel_remark" />
<result property="cancelBy" column="cancel_by" />
<result property="cancelByName" column="cancel_by_name" />
<result property="cancelTime" column="cancel_time" />
<result property="closeOrder" column="close_order" />
<result property="closeRemark" column="close_remark" />
<result property="closeBy" column="close_by" />
<result property="closeByName" column="close_by_name" />
<result property="closeTime" column="close_time" />
<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="overStockId" column="over_stock_id" />
<result property="overStockStatus" column="over_stock_status" />
<result property="overStockType" column="over_stock_type" />
<result property="to" column="TO" />
<result property="contactPerson" column="CONTACT_PERSON" />
<result property="vehicleInfo" column="VEHICLE_INFO" />
<result property="consignmentNo" column="CONSIGNMENT_NO" />
<result property="tel" column="TEL" />
<result property="driverSignature" column="DRIVER_SIGNATURE" />
<result property="fax" column="FAX" />
<result property="declarationArea" column="DECLARATION_AREA" />
<result property="manufacturer" column="MANUFACTURER" />
<result property="customsBrokerInfo" column="CUSTOMS_BROKER_INFO" />
<result property="deliveryAddress" column="DELIVERY_ADDRESS" />
<result property="entryExitCustoms" column="ENTRY_EXIT_CUSTOMS" />
<result property="originDestinationCountry" column="ORIGIN_DESTINATION_COUNTRY" />
<result property="carrier" column="CARRIER" />
<result property="containerNo" column="CONTAINER_NO" />
<result property="transportMethod" column="TRANSPORT_METHOD" />
<result property="supervisionMethod" column="SUPERVISION_METHOD" />
<result property="customsInspection" column="CUSTOMS_INSPECTION" />
<result property="needCustomsDeclaration" column="NEED_CUSTOMS_DECLARATION" />
<result property="needTransport" column="NEED_TRANSPORT" />
<result property="warehouseDate" column="WAREHOUSE_DATE" />
<result property="completionTime" column="COMPLETION_TIME" />
<result property="orderDate" column="ORDER_DATE" />
<result property="issueStatus" column="issue_status" />
<result property="issueTime" column="issue_time" />
<result property="issueId" column="issue_id" />
<result property="issueName" column="issue_name" />
<result property="reservationAuditId" column="reservation_audit_id" />
<result property="reservationAuditName" column="reservation_audit_name" />
<result property="reservationAuditTime" column="reservation_audit_time" />
<result property="reservationOrderSource" column="RESERVATION_ORDER_SOURCE" />
<result property="directorId" column="DIRECTOR_ID" />
<result property="directorPhone" column="DIRECTOR_PHONE" />
<result property="directorName" column="DIRECTOR_NAME" />
<result property="storageTime" column="STORAGE_TIME" />
<result property="inQuantity" column="IN_QUANTITY" />
</resultMap>
<sql id="selectStockInOrderPo">
a.in_order_id, a.organization_id, a.organization_name, a.top_organization_id, a.notice_number, a.in_order_number, a.status,
a.audit_status, a.audit_remark, a.audit_by, a.audit_by_name, a.audit_time, a.warehouse_id, a.warehouse_code, a.warehouse_name, a.shipper_id, a.shipper_code,
a.shipper_name, a.order_type_code, a.order_type_name, a.supplier_id, a.supplier_code, a.supplier_name, a.expect_time, a.supply_chain_number,
a.priority_level_code, a.priority_level_name, a.direct_warehouse, a.annex_url, a.material_quantity, a.quantity,a.business_order_no,
-- 计划入库数量:入库明细表 in_material_detail 的 quantity 汇总
<!-- (select ifnull(sum(imd.quantity), 0)-->
<!-- from in_material_detail imd-->
<!-- where imd.in_order_number = a.in_order_number-->
<!-- and imd.del_flag = 1-->
<!-- and (imd.level is null or imd.level = 1)-->
<!-- ) as plan_in_quantity,-->
<!-- &#45;&#45; 收货数量:收货单表 stock_receipt_order 的 receipt_quantity 汇总-->
<!-- (select ifnull(sum(sro.receipt_quantity), 0)-->
<!-- from stock_receipt_order sro-->
<!-- where sro.in_order_number = a.in_order_number-->
<!-- and sro.del_flag = 1-->
<!-- ) as receipt_quantity,-->
<!-- &#45;&#45; 上架数量:上架单表 stock_shelf_order 的 shelves_quantity 汇总-->
<!-- (select ifnull(sum(sso.shelves_quantity), 0)-->
<!-- from stock_shelf_order sso-->
<!-- where sso.in_order_number = a.in_order_number-->
<!-- and sso.del_flag = 1-->
<!-- ) as shelves_quantity,-->
a.weight_limit, a.volume_limit, a.cancel_order, a.cancel_remark, a.cancel_by,
a.cancel_by_name, a.cancel_time, a.close_order, a.close_remark, a.close_by, a.close_by_name, a.close_time, 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, over_stock_id, over_stock_status, over_stock_type,
a."TO", a.CONTACT_PERSON, a.VEHICLE_INFO, a.CONSIGNMENT_NO, a.TEL, a.DRIVER_SIGNATURE, a.FAX, a.DECLARATION_AREA, a.MANUFACTURER,
a.CUSTOMS_BROKER_INFO, a.DELIVERY_ADDRESS, a.ENTRY_EXIT_CUSTOMS, a.ORIGIN_DESTINATION_COUNTRY, a.CARRIER, a.CONTAINER_NO,
a.TRANSPORT_METHOD, a.SUPERVISION_METHOD, a.CUSTOMS_INSPECTION, a.NEED_CUSTOMS_DECLARATION, a.NEED_TRANSPORT,
a.WAREHOUSE_DATE, a.COMPLETION_TIME, a.ORDER_DATE,a.reserve_audit_time,a.reserve_audit_name
,a.reserve_audit_id,a.issue_name,a.issue_id,a.issue_time,a.issue_status,a.RESERVATION_ORDER_SOURCE,a.tms_order_number
,a.DIRECTOR_NAME ,a.DIRECTOR_PHONE,a.DIRECTOR_ID,a.STORAGE_TIME,a.in_quantity
</sql>
<sql id="joinStockInOrderPo">
,b.notice_number, b.warehouse_id, b.warehouse_code, b.warehouse_name, b.shipper_id, b.shipper_code, b.shipper_name,
b.order_type_code, b.order_type_name, b.supplier_id, b.supplier_code, b.supplier_name, b.expect_time, b.supply_chain_number, b.priority_level_code,
b.priority_level_name, b.direct_warehouse, b.annex_url, b.material_quantity as in_order_material_quantity, b.quantity as in_order_quantity
</sql>
<sql id="joinStockInOrderPoWhere">
<if test="noticeNumber != null and noticeNumber != ''">
and b.notice_number = #{noticeNumber}
</if>
<if test="inOrderNumber != null and inOrderNumber != ''">
and b.in_order_number like concat('%', #{inOrderNumber}, '%')
</if>
<if test="warehouseId != null ">
and b.warehouse_id = #{warehouseId}
</if>
<if test="warehouseCode != null and warehouseCode != ''">
and b.warehouse_code = #{warehouseCode}
</if>
<if test="warehouseName != null and warehouseName != ''">
and b.warehouse_name like concat('%', #{warehouseName}, '%')
</if>
<if test="shipperId != null ">
and b.shipper_id = #{shipperId}
</if>
<if test="shipperName != null and shipperName != ''">
and b.shipper_name like concat('%', #{shipperName}, '%')
</if>
<if test="orderTypeCode != null and orderTypeCode != ''">
and b.order_type_code = #{orderTypeCode}
</if>
<if test="orderTypeName != null and orderTypeName != ''">
and b.order_type_name like concat('%', #{orderTypeName}, '%')
</if>
<if test="supplierId != null ">
and b.supplier_id = #{supplierId}
</if>
<if test="supplierName != null and supplierName != ''">
and b.supplier_name like concat('%', #{supplierName}, '%')
</if>
<if test="expectTime != null ">
and b.expect_time = #{expectTime}
</if>
<if test="supplyChainNumber != null and supplyChainNumber != ''">
and b.supply_chain_number = #{supplyChainNumber}
</if>
<if test="priorityLevelCode != null and priorityLevelCode != ''">
and b.priority_level_code = #{priorityLevelCode}
</if>
<if test="priorityLevelName != null and priorityLevelName != ''">
and b.priority_level_name like concat('%', #{priorityLevelName}, '%')
</if>
<if test="directWarehouse != null ">
and b.direct_warehouse = #{directWarehouse}
</if>
<if test="annexUrl != null and annexUrl != ''">
and b.annex_url = #{annexUrl}
</if>
<if test="quantity != null ">
and b.quantity = #{quantity}
</if>
</sql>
<sql id="selectStockInOrderPo1">
<if test="organizationId != null ">
and a.organization_id = #{organizationId}
</if>
<if test="tmsOrderNumber != null and tmsOrderNumber != ''">
and a.tms_order_number like concat('%', #{tmsOrderNumber}, '%')
</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="noticeNumber != null and noticeNumber != ''">
and a.notice_number = #{noticeNumber}
</if>
<if test="inOrderNumber != null and inOrderNumber != ''">
and a.in_order_number = #{inOrderNumber}
</if>
<if test="status != null ">
and a.status = #{status}
</if>
<if test="ltStatus != null ">
and a.status &lt; #{ltStatus}
</if>
<if test="gtStatus != null ">
and a.status &gt; #{gtStatus}
</if>
<if test="auditStatus != null ">
and a.audit_status = #{auditStatus}
</if>
<if test="ltAuditStatus != null ">
and a.audit_status &lt; #{ltAuditStatus}
</if>
<if test="gtAuditStatus != null ">
and a.audit_status &gt; #{gtAuditStatus}
</if>
<if test="auditRemark != null and auditRemark != ''">
and a.audit_remark = #{auditRemark}
</if>
<if test="auditBy != null ">
and a.audit_by = #{auditBy}
</if>
<if test="auditByName != null and auditByName != ''">
and a.audit_by_name like concat('%', #{auditByName}, '%')
</if>
<if test="auditTime != null ">
and a.audit_time = #{auditTime}
</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="shipperId != null ">
and a.shipper_id = #{shipperId}
</if>
<if test="shipperName != null and shipperName != ''">
and a.shipper_name like concat('%', #{shipperName}, '%')
</if>
<if test="orderTypeCode != null and orderTypeCode != ''">
and a.order_type_code = #{orderTypeCode}
</if>
<if test="orderTypeName != null and orderTypeName != ''">
and a.order_type_name like concat('%', #{orderTypeName}, '%')
</if>
<if test="supplierId != null ">
and a.supplier_id = #{supplierId}
</if>
<if test="supplierName != null and supplierName != ''">
and a.supplier_name like concat('%', #{supplierName}, '%')
</if>
<if test="expectTime != null ">
and a.expect_time = #{expectTime}
</if>
<if test="supplyChainNumber != null and supplyChainNumber != ''">
and a.supply_chain_number = #{supplyChainNumber}
</if>
<if test="priorityLevelCode != null and priorityLevelCode != ''">
and a.priority_level_code = #{priorityLevelCode}
</if>
<if test="priorityLevelName != null and priorityLevelName != ''">
and a.priority_level_name like concat('%', #{priorityLevelName}, '%')
</if>
<if test="directWarehouse != null ">
and a.direct_warehouse = #{directWarehouse}
</if>
<if test="annexUrl != null and annexUrl != ''">
and a.annex_url = #{annexUrl}
</if>
<if test="quantity != null ">
and a.quantity = #{quantity}
</if>
<if test="cancelOrder != null ">
and a.cancel_order = #{cancelOrder}
</if>
<if test="cancelRemark != null and cancelRemark != ''">
and a.cancel_remark = #{cancelRemark}
</if>
<if test="cancelBy != null ">
and a.cancel_by = #{cancelBy}
</if>
<if test="cancelByName != null and cancelByName != ''">
and a.cancel_by_name like concat('%', #{cancelByName}, '%')
</if>
<if test="cancelTime != null ">
and a.cancel_time = #{cancelTime}
</if>
<if test="closeOrder != null ">
and a.close_order = #{closeOrder}
</if>
<if test="closeRemark != null and closeRemark != ''">
and a.close_remark = #{closeRemark}
</if>
<if test="closeBy != null ">
and a.close_by = #{closeBy}
</if>
<if test="closeByName != null and closeByName != ''">
and a.close_by_name like concat('%', #{closeByName}, '%')
</if>
<if test="closeTime != null ">
and a.close_time = #{closeTime}
</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>
<if test="inOrderIds != null and inOrderIds.size > 0 ">
and a.in_order_id in
<foreach collection="inOrderIds" item="item" index="index" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
<!-- 报关相关字段查询条件 -->
<if test="to != null and to != ''">
and a."TO" like concat('%', #{to}, '%')
</if>
<if test="contactPerson != null and contactPerson != ''">
and a.CONTACT_PERSON like concat('%', #{contactPerson}, '%')
</if>
<if test="vehicleInfo != null and vehicleInfo != ''">
and a.VEHICLE_INFO like concat('%', #{vehicleInfo}, '%')
</if>
<if test="consignmentNo != null and consignmentNo != ''">
and a.CONSIGNMENT_NO like concat('%', #{consignmentNo}, '%')
</if>
<if test="tel != null and tel != ''">
and a.TEL like concat('%', #{tel}, '%')
</if>
<if test="driverSignature != null and driverSignature != ''">
and a.DRIVER_SIGNATURE like concat('%', #{driverSignature}, '%')
</if>
<if test="fax != null and fax != ''">
and a.FAX like concat('%', #{fax}, '%')
</if>
<if test="declarationArea != null and declarationArea != ''">
and a.DECLARATION_AREA like concat('%', #{declarationArea}, '%')
</if>
<if test="manufacturer != null and manufacturer != ''">
and a.MANUFACTURER like concat('%', #{manufacturer}, '%')
</if>
<if test="customsBrokerInfo != null and customsBrokerInfo != ''">
and a.CUSTOMS_BROKER_INFO like concat('%', #{customsBrokerInfo}, '%')
</if>
<if test="deliveryAddress != null and deliveryAddress != ''">
and a.DELIVERY_ADDRESS like concat('%', #{deliveryAddress}, '%')
</if>
<if test="entryExitCustoms != null and entryExitCustoms != ''">
and a.ENTRY_EXIT_CUSTOMS like concat('%', #{entryExitCustoms}, '%')
</if>
<if test="originDestinationCountry != null and originDestinationCountry != ''">
and a.ORIGIN_DESTINATION_COUNTRY like concat('%', #{originDestinationCountry}, '%')
</if>
<if test="carrier != null and carrier != ''">
and a.CARRIER like concat('%', #{carrier}, '%')
</if>
<if test="containerNo != null and containerNo != ''">
and a.CONTAINER_NO = #{containerNo}
</if>
<if test="transportMethod != null and transportMethod != ''">
and a.TRANSPORT_METHOD = #{transportMethod}
</if>
<if test="supervisionMethod != null and supervisionMethod != ''">
and a.SUPERVISION_METHOD = #{supervisionMethod}
</if>
<if test="customsInspection != null">
and a.CUSTOMS_INSPECTION = #{customsInspection}
</if>
<if test="needCustomsDeclaration != null">
and a.NEED_CUSTOMS_DECLARATION = #{needCustomsDeclaration}
</if>
<if test="needTransport != null">
and a.NEED_TRANSPORT = #{needTransport}
</if>
<if test="warehouseDate != null">
and a.WAREHOUSE_DATE = #{warehouseDate}
</if>
<if test="completionTime != null">
and a.COMPLETION_TIME = #{completionTime}
</if>
<if test="orderDate != null">
and a.ORDER_DATE = #{orderDate}
</if>
<if test="createTimeStart != null and createTimeStart != ''">
and date_format(a.create_time,'%Y-%m-%d') &gt;= #{createTimeStart}
</if>
<if test="createTimeEnd != null and createTimeEnd != ''">
and date_format(a.create_time,'%Y-%m-%d') &lt;= #{createTimeEnd}
</if>
<!-- 入库明细:物料名称、物料编码(同一明细行同时满足;与计划数量汇总口径一致)。关联 material_base_info 避免明细冗余名称与主档不一致时筛不到 -->
<if test="(materialName != null and materialName != '') or (materialCode != null and materialCode != '')">
and exists (
select 1 from in_material_detail imd
left join material_base_info mb on imd.material_base_info_id = mb.material_base_info_id and mb.del_flag = 1
where imd.in_order_number = a.in_order_number
and imd.del_flag = 1
and (imd.level is null or imd.level = 1)
<if test="materialName != null and materialName != ''">
and (
imd.material_name like concat('%', #{materialName}, '%')
or mb.material_name like concat('%', #{materialName}, '%')
)
</if>
<if test="materialCode != null and materialCode != ''">
and (
imd.material_code like concat('%', #{materialCode}, '%')
or mb.material_code like concat('%', #{materialCode}, '%')
)
</if>
)
</if>
<choose>
<when test="delFlag != null"> and a.del_flag = #{delFlag} </when>
<otherwise> and a.del_flag = 1 </otherwise>
</choose>
</sql>
<select id="queryList" parameterType="com.mhd.oms.domain.reserveStockInOrder.repository.todo.ReserveStockInOrderDO" resultMap="StockInOrderResult">
select
<include refid="selectStockInOrderPo"/>
from reserve_stock_in_order a
<where>
<include refid="selectStockInOrderPo1"/>
</where>
ORDER BY a.create_time IS NULL, a.create_time DESC
</select>
<select id="getinfo" parameterType="java.lang.Long" resultType="com.mhd.oms.domain.reservationStockInOrder.repository.po.MaterialBaseInfoPO">
select * from "NGWL_TEST_WMS".MATERIAL_BASE_INFO where MATERIAL_BASE_INFO_ID = #{id}
</select>
<select id="getMaterialBaseInfoList" parameterType="java.lang.String" resultType="com.mhd.oms.domain.reservationStockInOrder.repository.po.MaterialBaseInfoPO">
select * from "NGWL_TEST_WMS".MATERIAL_BASE_INFO where material_code = #{id}
</select>
<select id="getInfoByMaterialBaseInfoIds" parameterType="java.lang.Long" resultType="com.mhd.oms.domain.reservationStockInOrder.repository.po.MaterialWarehouseControlPO">
select * from "NGWL_TEST_WMS".MATERIAL_WAREHOUSE_CONTROL where MATERIAL_BASE_INFO_ID = #{id}
</select>
<select id="getGoodsInfoByMaterialBaseInfoIds" parameterType="java.lang.Long" resultType="com.mhd.oms.domain.reservationStockInOrder.repository.po.MaterialGoodsRulePO">
select * from "NGWL_TEST_WMS".MATERIAL_GOODS_RULE where MATERIAL_BASE_INFO_ID = #{id}
</select>
<!-- 入仓通知单打印-表头查询 -->
<select id="queryNoticePrint" resultMap="StockInOrderResult">
SELECT
a.notice_number,
a.in_order_number,
a.status,
a.warehouse_name,
a.supplier_name,
a.shipper_name,
a.order_type_name,
a.expect_time,
a.material_quantity,
a.manufacturer,
a.contact_person,
a.tel,
a.vehicle_info,
a.delivery_address,
a.warehouse_date,
a.remark,
a.create_time
FROM reserve_stock_in_order a
WHERE a.del_flag = 1
AND a.in_order_id = #{inOrderId}
</select>
<!-- 入仓通知单打印-明细查询 -->
<select id="queryNoticePrintDetail" resultMap="ReserveInMaterialDetailResult">
SELECT
b.material_code,
b.material_name,
b.piece_count,
b.total_net_weight,
b.total_gross_weight,
b.unit_code,
b.pack_name,
b.batch_number,
b.storage_location_name,
b.quantity,
b.inbound_quantity
FROM reserve_in_material_detail b
WHERE b.del_flag = 1
AND b.in_order_number = #{inOrderNumber}
ORDER BY b.material_code
</select>
<!-- 明细结果映射 -->
<resultMap type="com.mhd.oms.domain.reserveInMaterialDetail.repository.po.ReserveInMaterialDetailPO" id="ReserveInMaterialDetailResult">
<result property="materialCode" column="material_code"/>
<result property="materialName" column="material_name"/>
<result property="pieceCount" column="piece_count"/>
<result property="totalNetWeight" column="total_net_weight"/>
<result property="totalGrossWeight" column="total_gross_weight"/>
<result property="unitCode" column="unit_code"/>
<result property="packName" column="pack_name"/>
<result property="batchNumber" column="batch_number"/>
<result property="storageLocationName" column="storage_location_name"/>
<result property="quantity" column="quantity"/>
<result property="inboundQuantity" column="inbound_quantity"/>
</resultMap>
</mapper>
@@ -0,0 +1,407 @@
<?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.reserveStockOutOrder.repository.mapper.ReserveStockOutOrderMapper">
<resultMap type="com.mhd.oms.domain.reserveStockOutOrder.repository.po.ReserveStockOutOrderPO" id="StockOutOrderResult">
<result property="outOrderId" column="out_order_id" />
<result property="organizationId" column="organization_id" />
<result property="organizationName" column="organization_name" />
<result property="topOrganizationId" column="top_organization_id" />
<result property="noticeNumber" column="notice_number" />
<result property="outOrderNumber" column="out_order_number" />
<result property="status" column="status" />
<result property="auditStatus" column="audit_status" />
<result property="auditRemark" column="audit_remark" />
<result property="auditBy" column="audit_by" />
<result property="auditByName" column="audit_by_name" />
<result property="auditTime" column="audit_time" />
<result property="warehouseId" column="warehouse_id" />
<result property="warehouseCode" column="warehouse_code" />
<result property="warehouseName" column="warehouse_name" />
<result property="shipperId" column="shipper_id" />
<result property="shipperName" column="shipper_name" />
<result property="orderTypeCode" column="order_type_code" />
<result property="orderTypeName" column="order_type_name" />
<result property="customerId" column="customer_id" />
<result property="customerName" column="customer_name" />
<result property="expectTime" column="expect_time" />
<result property="supplyChainNumber" column="supply_chain_number" />
<result property="priorityLevelCode" column="priority_level_code" />
<result property="priorityLevelName" column="priority_level_name" />
<result property="directWarehouse" column="direct_warehouse" />
<result property="review" column="review" />
<result property="annexUrl" column="annex_url" />
<result property="quantity" column="quantity" />
<result property="cancelOrder" column="cancel_order" />
<result property="cancelRemark" column="cancel_remark" />
<result property="cancelBy" column="cancel_by" />
<result property="cancelByName" column="cancel_by_name" />
<result property="cancelTime" column="cancel_time" />
<result property="closeOrder" column="close_order" />
<result property="closeRemark" column="close_remark" />
<result property="closeBy" column="close_by" />
<result property="closeByName" column="close_by_name" />
<result property="closeTime" column="close_time" />
<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="overStockId" column="over_stock_id" />
<result property="overStockStatus" column="over_stock_status" />
<result property="overStockType" column="over_stock_type" />
<result property="to" column="to"/>
<result property="contactPerson" column="contact_person"/>
<result property="vehicleModelPlate" column="vehicle_model_plate"/>
<result property="entrustNo" column="entrust_no"/>
<result property="tel" column="tel"/>
<result property="driverSign" column="driver_sign"/>
<result property="fax" column="fax"/>
<result property="declareCustoms" column="declare_customs"/>
<result property="manufacturer" column="manufacturer"/>
<result property="customsDeclarerInfo" column="customs_declarer_info"/>
<result property="deliveryAddr" column="delivery_addr"/>
<result property="entryExitCustoms" column="entry_exit_customs"/>
<result property="departureArrivalCountry" column="departure_arrival_country"/>
<result property="carrier" column="carrier"/>
<result property="containerNo" column="container_no"/>
<result property="containerNoName" column="container_no_name"/>
<result property="outboundDate" column="outbound_date"/>
<result property="completeTime" column="complete_time"/>
<result property="orderDate" column="order_date"/>
<result property="transportModeCode" column="transport_mode_code"/>
<result property="transportModeName" column="transport_mode_name"/>
<result property="supervisionModeCode" column="supervision_mode_code"/>
<result property="supervisionModeName" column="supervision_mode_name"/>
<result property="customsInspectionFlag" column="customs_inspection_flag"/>
<result property="needDeclareFlag" column="need_declare_flag"/>
<result property="needTransportFlag" column="need_transport_flag"/>
<result property="pictureApp" column="picture_app"/>
<result property="issueStatus" column="issue_status" />
<result property="issueTime" column="issue_time" />
<result property="issueId" column="issue_id" />
<result property="issueName" column="issue_name" />
<result property="reservationAuditId" column="reservation_audit_id" />
<result property="reservationAuditName" column="reservation_audit_name" />
<result property="reservationAuditTime" column="reservation_audit_time" />
<result property="directorId" column="DIRECTOR_ID" />
<result property="directorPhone" column="DIRECTOR_PHONE" />
<result property="directorName" column="DIRECTOR_NAME" />
<result property="reservationOrderSource" column="RESERVATION_ORDER_SOURCE" />
<result property="outboundTime" column="OUTBOUND_TIME" />
<result property="businessOrderNo" column="BUSINESS_ORDER_NO" />
</resultMap>
<sql id="selectStockOutOrderPo">
a.out_order_id, a.organization_id, a.organization_name, a.top_organization_id, a.receipt_notice_id, a.notice_number, a.out_order_number, a.status,
a.audit_status, a.audit_remark, a.audit_by, a.audit_by_name, a.audit_time, a.warehouse_id, a.warehouse_code, a.warehouse_name, a.shipper_id, a.shipper_code,
a.shipper_name, a.order_type_code, a.order_type_name, a.customer_id, a.customer_code, a.customer_name, a.expect_time, a.supply_chain_number, a.priority_level_code,
a.priority_level_name, a.direct_warehouse, a.review, a.annex_url, a.material_quantity, a.quantity, a.weight_limit, a.volume_limit, a.check_quantity, a.cancel_order, a.cancel_remark, a.cancel_by, a.cancel_by_name,
a.cancel_time, a.close_order, a.close_remark, a.close_by, a.close_by_name, a.close_time, a.check_status,a.BUSINESS_ORDER_NO,
a.check_task_distribution, a.check_task_distribution_time, a.check_operators_by, a.check_operators_name, a.mobilize_code,
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, over_stock_id, over_stock_status, over_stock_type,a."TO",
a.CONTACT_PERSON,a.VEHICLE_MODEL_PLATE,a.ENTRUST_NO,a.TEL,a.DRIVER_SIGN,a.FAX,a.DECLARE_CUSTOMS,a.MANUFACTURER,
a.CUSTOMS_DECLARER_INFO,a.DELIVERY_ADDR,a.ENTRY_EXIT_CUSTOMS,a.DEPARTURE_ARRIVAL_COUNTRY,a.CARRIER,a.CONTAINER_NO,a.CONTAINER_NO_NAME,a.OUTBOUND_DATE,
a.COMPLETE_TIME,a.ORDER_DATE,a.TRANSPORT_MODE_CODE,a.TRANSPORT_MODE_NAME,a.SUPERVISION_MODE_CODE,a.SUPERVISION_MODE_NAME,
a.CUSTOMS_INSPECTION_FLAG,a.NEED_DECLARE_FLAG,a.NEED_TRANSPORT_FLAG,a.picture_app,a.reserve_audit_time,a.reserve_audit_name
,a.reserve_audit_id,a.issue_name,a.issue_id,a.issue_time,a.issue_status,a.tms_order_number,
a.DIRECTOR_NAME ,a.DIRECTOR_PHONE,a.DIRECTOR_ID,a.RESERVATION_ORDER_SOURCE,a.OUTBOUND_TIME
</sql>
<sql id="joinStockOutOrderPo">
,b.notice_number, b.out_order_number, b.warehouse_id, b.warehouse_code, b.warehouse_name, b.shipper_id, b.shipper_code,
b.shipper_name, b.order_type_code, b.order_type_name, b.customer_id, b.customer_name, b.expect_time, b.supply_chain_number, b.priority_level_code,
b.priority_level_name, b.direct_warehouse, b.review, b.annex_url, b.quantity
</sql>
<sql id="joinStockOutOrderPoYc">
,b.notice_number, b.out_order_number, b.warehouse_id, b.warehouse_code, b.warehouse_name, b.shipper_id, b.shipper_code,
b.shipper_name, b.order_type_code, b.order_type_name, b.customer_id, b.customer_name, b.expect_time, b.supply_chain_number, b.priority_level_code,
b.priority_level_name, b.direct_warehouse, b.review, b.annex_url
</sql>
<sql id="selectStockOutOrderPo1">
<if test="outOrderId != null ">
and a.out_order_id = #{outOrderId}
</if>
<if test="organizationId != null ">
and a.organization_id = #{organizationId}
</if>
<if test="tmsOrderNumber != null and tmsOrderNumber != ''">
and a.tms_order_number like concat('%', #{tmsOrderNumber}, '%')
</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="noticeNumber != null and noticeNumber != ''">
and a.notice_number = #{noticeNumber}
</if>
<if test="outOrderNumber != null and outOrderNumber != ''">
and a.out_order_number like concat('%', #{outOrderNumber}, '%')
</if>
<!-- 出库状态: 1-已创建 2-已审核 3-部分分配 4-已分配 5-拣货中 6-波次中 7-拣货完成 8-复核中 9-已出库 10-已取消 11-已关闭 -->
<if test="status != null ">
<choose>
<when test="status == -1 "> <!-- 作业中 -->
<!-- 出库状态: 3-部分分配 4-已分配 5-拣货中 6-波次中 7-拣货完成 8-复核中-->
and a.status IN (3, 4, 5, 6, 7, 8)
</when>
<otherwise>
and a.status = #{status}
</otherwise>
</choose>
</if>
<!-- 出库状态: 1-已创建 2-已审核 3-部分分配 4-已分配 5-拣货中 6-波次中 7-拣货完成 8-复核中 9-已出库 10-已取消 11-已关闭 -->
<if test="gtStatus != null ">
and a.status &gt; #{gtStatus}
</if>
<if test="ltStatus != null ">
and a.status &lt; #{ltStatus}
</if>
<if test="auditStatus != null ">
and a.audit_status = #{auditStatus}
</if>
<if test="auditRemark != null and auditRemark != ''">
and a.audit_remark = #{auditRemark}
</if>
<if test="checkTaskDistribution != null ">
and a.check_task_distribution = #{checkTaskDistribution}
</if>
<if test="auditBy != null ">
and a.audit_by = #{auditBy}
</if>
<if test="auditByName != null and auditByName != ''">
and a.audit_by_name like concat('%', #{auditByName}, '%')
</if>
<if test="auditTime != null ">
and a.audit_time = #{auditTime}
</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="shipperId != null ">
and a.shipper_id = #{shipperId}
</if>
<if test="shipperName != null and shipperName != ''">
and a.shipper_name like concat('%', #{shipperName}, '%')
</if>
<if test="orderTypeCode != null and orderTypeCode != ''">
and a.order_type_code = #{orderTypeCode}
</if>
<if test="orderTypeName != null and orderTypeName != ''">
and a.order_type_name like concat('%', #{orderTypeName}, '%')
</if>
<if test="customerId != null ">
and a.customer_id = #{customerId}
</if>
<if test="customerName != null and customerName != ''">
and a.customer_name like concat('%', #{customerName}, '%')
</if>
<if test="expectTime != null ">
and a.expect_time = #{expectTime}
</if>
<if test="supplyChainNumber != null and supplyChainNumber != ''">
and a.supply_chain_number = #{supplyChainNumber}
</if>
<if test="priorityLevelCode != null and priorityLevelCode != ''">
and a.priority_level_code = #{priorityLevelCode}
</if>
<if test="priorityLevelName != null and priorityLevelName != ''">
and a.priority_level_name like concat('%', #{priorityLevelName}, '%')
</if>
<if test="directWarehouse != null ">
and a.direct_warehouse = #{directWarehouse}
</if>
<if test="review != null ">
and a.review = #{review}
</if>
<if test="annexUrl != null and annexUrl != ''">
and a.annex_url = #{annexUrl}
</if>
<if test="quantity != null ">
and a.quantity = #{quantity}
</if>
<if test="cancelOrder != null ">
and a.cancel_order = #{cancelOrder}
</if>
<if test="cancelRemark != null and cancelRemark != ''">
and a.cancel_remark = #{cancelRemark}
</if>
<if test="cancelBy != null ">
and a.cancel_by = #{cancelBy}
</if>
<if test="cancelByName != null and cancelByName != ''">
and a.cancel_by_name like concat('%', #{cancelByName}, '%')
</if>
<if test="cancelTime != null ">
and a.cancel_time = #{cancelTime}
</if>
<if test="closeOrder != null ">
and a.close_order = #{closeOrder}
</if>
<if test="closeRemark != null and closeRemark != ''">
and a.close_remark = #{closeRemark}
</if>
<if test="closeBy != null ">
and a.close_by = #{closeBy}
</if>
<if test="closeByName != null and closeByName != ''">
and a.close_by_name like concat('%', #{closeByName}, '%')
</if>
<if test="closeTime != null ">
and a.close_time = #{closeTime}
</if>
<if test="checkStatus != null ">
and a.check_status = #{checkStatus}
</if>
<if test="gtCheckStatus != null ">
and a.check_status &gt; #{gtCheckStatus}
</if>
<if test="ltCheckStatus != null ">
and a.check_status &lt; #{ltCheckStatus}
</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>
<if test="checkOperatorsBy != null and checkOperatorsBy != ''">
and a.check_operators_by = #{checkOperatorsBy}
</if>
<if test="outOrderIds != null and outOrderIds.size > 0 ">
and a.out_order_id in
<foreach collection="outOrderIds" item="item" index="index" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
<if test="createTimeStart != null and createTimeStart != ''">
and date_format(a.create_time,'%Y-%m-%d') &gt;= #{createTimeStart}
</if>
<if test="createTimeEnd != null and createTimeEnd != ''">
and date_format(a.create_time,'%Y-%m-%d') &lt;= #{createTimeEnd}
</if>
<if test="auditTimeStart != null and auditTimeStart != ''">
and date_format(a.audit_time,'%Y-%m-%d') &gt;= #{auditTimeStart}
</if>
<if test="auditTimeEnd != null and auditTimeEnd != ''">
and date_format(a.audit_time,'%Y-%m-%d') &lt;= #{auditTimeEnd}
</if>
<!-- 出库明细:物料名称、物料编码(同一明细行同时满足;与出库明细口径一致)。关联 material_base_info 避免明细冗余名称与主档不一致时筛不到 -->
<!-- <if test="(materialName != null and materialName != '') or (materialCode != null and materialCode != '')">-->
<!-- and exists (-->
<!-- select 1 from out_material_detail omd-->
<!-- left join material_base_info mb on omd.material_base_info_id = mb.material_base_info_id and mb.del_flag = 1-->
<!-- where omd.out_order_number = a.out_order_number-->
<!-- and omd.del_flag = 1-->
<!-- and (omd.level is null or omd.level = 1)-->
<!-- <if test="materialName != null and materialName != ''">-->
<!-- and (-->
<!-- omd.material_name like concat('%', #{materialName}, '%')-->
<!-- or mb.material_name like concat('%', #{materialName}, '%')-->
<!-- )-->
<!-- </if>-->
<!-- <if test="materialCode != null and materialCode != ''">-->
<!-- and (-->
<!-- omd.material_code like concat('%', #{materialCode}, '%')-->
<!-- or mb.material_code like concat('%', #{materialCode}, '%')-->
<!-- )-->
<!-- </if>-->
<!-- )-->
<!-- </if>-->
<choose>
<when test="delFlag != null"> and a.del_flag = #{delFlag} </when>
<otherwise> and a.del_flag = 1 </otherwise>
</choose>
</sql>
<select id="queryList" parameterType="com.mhd.oms.domain.reserveStockOutOrder.repository.todo.ReserveStockOutOrderDO" resultMap="StockOutOrderResult">
select
<include refid="selectStockOutOrderPo"/>
from reserve_stock_out_order a
<where>
<include refid="selectStockOutOrderPo1"/>
</where>
order by a.create_time desc nulls last
</select>
<!-- 出库单提货单打印-表头查询 -->
<select id="queryOutStockNoticePrint" resultMap="StockOutOrderResult">
SELECT
a.notice_number,
a.out_order_number,
a.supply_chain_number,
a.shipper_name,
a.expect_time,
a.document_creator_name,
a.document_creator,
a.document_date,
a.warehouse_name,
a.remark
FROM reserve_stock_out_order a
WHERE a.del_flag = 1
AND a.out_order_id = #{outOrderId}
</select>
<!-- 出库单提货单打印-明细查询 -->
<select id="queryOutStockNoticePrintDetail" resultMap="OutMaterialDetailResult">
SELECT
b.batch_number,
b.material_code,
b.material_name,
b.specification_model,
b.quantity,
b.unit_name,
b.pack_name,
b.warehouse_code,
b.warehouse_id,
b.storage_location_name,
b.lot_no,
b.piece_count,
b.material_base_info_id,
b.outbound_quantity,
b.box_pallet_no
FROM reserve_out_material_detail b
WHERE b.del_flag = 1
AND b.out_order_number = (SELECT out_order_number FROM reserve_stock_out_order WHERE out_order_id = #{outOrderId} AND del_flag = 1)
ORDER BY b.material_detail_id
</select>
<!-- 明细结果映射 -->
<resultMap type="com.mhd.oms.domain.reserveOutMaterialDetail.repository.po.ReserveOutMaterialDetailPO" id="OutMaterialDetailResult">
<result property="batchNumber" column="batch_number"/>
<result property="materialCode" column="material_code"/>
<result property="materialName" column="material_name"/>
<result property="specificationModel" column="specification_model"/>
<result property="quantity" column="quantity"/>
<result property="unitName" column="unit_name"/>
<result property="packName" column="pack_name"/>
<result property="warehouseCode" column="warehouse_code"/>
<result property="warehouseId" column="warehouse_id"/>
<result property="storageLocationName" column="storage_location_name"/>
<result property="lotNo" column="lot_no"/>
<result property="pieceCount" column="piece_count"/>
<result property="materialBaseInfoId" column="material_base_info_id"/>
<result property="outboundQuantity" column="outbound_quantity"/>
<result property="boxPalletNo" column="box_pallet_no"/>
</resultMap>
</mapper>