Files
nanguangszwlback/mhd_oms/src/main/resources/mapper/executionInMaterialDetail/executionInMaterialDetailMapper.xml
T
rcx 8af8197901 feat(oms/wms): 出入库明细货物种类改显物料分类名称、单据类型回显与查询条件
一、货物种类
- O/W出入库明细查询新增返回materialClassifyName(物料分类名称,多个逗号分隔)
- WMS入库导出"货物种类"列、出库导出"种类"列改为物料分类名称(原为goodsType编码转文字)
- OMS出入库导出新增"货物种类"列,货物类型列加字典转换不再显示0/1/2编码

二、单据类型
- O/W入库明细查询新增orderTypeCode/orderTypeName回显与查询条件(编码精确/名称模糊)
- WMS入库明细导出新增"业务单据类型"列(第31列)

三、时间字段
- OMS出库明细查询返回增加completeTime完成时间
- OMS orderOutboundDate出仓日期格式恢复为yyyy-MM-dd HH:mm:ss
- OMS出库时间过滤改为三级兜底:出库时间OUTBOUND_TIME→出仓日期→建档时间

四、修复
- WMS出库导出SQL修复TOTAL_PRICE列不存在(总价改用TOTAL_AMOUNT),总价值暂无来源占位空列
2026-09-10 11:35:30 +08:00

489 lines
26 KiB
XML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?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.executionInMaterialDetail.repository.mapper.ExecutionInMaterialDetailMapper">
<resultMap type="com.mhd.oms.domain.executionInMaterialDetail.repository.po.ExecutionInMaterialDetailPO" 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" />
<result property="drinkDate" column="drink_date" />
<result property="fireInsureFee" column="fire_insure_fee" />
<result property="lineNumGw" column="line_num_gw" />
<result property="specGw" column="spec_gw" />
<result property="unitGw" column="unit_gw" />
<result property="qtyGw" column="qty_gw" />
<result property="erpCurrGw" column="erp_curr_gw" />
<result property="erpPriceGw" column="erp_price_gw" />
<result property="amountGw" column="amount_gw" />
<result property="insureAmount" column="insure_amount" />
<result property="goodsType" column="goods_type" />
</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,a.drink_date,a.fire_insure_fee,
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.line_num_gw,
a.spec_gw,
a.unit_gw,
a.qty_gw,
a.erp_curr_gw,
a.erp_price_gw,
a.amount_gw,
a.in_order_number_gw,
a.in_line_num_gw,
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.executionInMaterialDetail.repository.todo.ExecutionInMaterialDetailDO" resultMap="MaterialDetailResult">
select
<include refid="selectMaterialDetailPo"/>
from execution_in_material_detail a
<where>
<include refid="selectMaterialDetailPo1"/>
</where>
</select>
<select id="queryInOrderList" parameterType="com.mhd.oms.domain.executionInMaterialDetail.repository.todo.QueryOrderOverStockDO" resultMap="MaterialDetailResult">
select
<include refid="selectMaterialDetailPo"/>
<include refid="com.mhd.oms.domain.executionStockInOrder.repository.mapper.ExecutionStockInOrderMapper.joinStockInOrderPo"/>
from execution_in_material_detail a
LEFT JOIN execution_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.executionInMaterialDetail.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>
<!-- ========== 入库明细查询(关联入库执行单) ========== -->
<resultMap type="com.mhd.oms.domain.executionInMaterialDetail.repository.po.ExecutionInMaterialDetailWithOrderPO" id="InMaterialDetailWithOrderResult" extends="MaterialDetailResult">
<result property="inOrderStatus" column="in_order_status" />
<result property="inOrderAuditStatus" column="in_order_audit_status" />
<result property="issueStatus" column="issue_status" />
<result property="materialClassifyName" column="material_classify_name" />
<result property="orderTypeCode" column="order_type_code" />
<result property="orderTypeName" column="order_type_name" />
<result property="orderShipperId" column="order_shipper_id" />
<result property="orderShipperCode" column="order_shipper_code" />
<result property="orderShipperName" column="order_shipper_name" />
<result property="warehouseDate" column="warehouse_date" />
</resultMap>
<select id="queryInOrderDetailList" parameterType="com.mhd.oms.domain.executionInMaterialDetail.repository.todo.QueryOrderOverStockDO"
resultMap="InMaterialDetailWithOrderResult">
select
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,
a.pack_detail_id, a.unit_code, a.unit_name, a.unit_number, 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,
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.drink_date, a.fire_insure_fee, a.unit_price,
a.line_num_gw, a.spec_gw, a.unit_gw, a.qty_gw, a.erp_curr_gw, a.erp_price_gw, a.amount_gw,
c.insure_amount, c.goods_type, c.material_classify_name,
b.shipper_id as order_shipper_id,
b.shipper_code as order_shipper_code,
b.shipper_name as order_shipper_name,
b.order_type_code,
b.order_type_name,
b.status as in_order_status,
b.audit_status as in_order_audit_status,
b.issue_status as issue_status,
b.warehouse_date
from execution_in_material_detail a
left join execution_stock_in_order b on a.in_order_number = b.in_order_number
left join NGWL_TEST_WMS.material_base_info c on a.material_base_info_id = c.material_base_info_id
<where>
<if test="organizationId != null ">
and a.organization_id = #{organizationId}
</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="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="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="inOrderTypeCode != null and inOrderTypeCode != ''">
and b.order_type_code = #{inOrderTypeCode}
</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>
<!-- 入库单展示状态issue_status: 0-已创建 2-已审核 3-已驳回 4-已入库(WMS回写status=5时同步为4)
"已入库"以issue_status=4为准(推送创建的单据直接置4status不一定为5 -->
and b.issue_status = 4
<if test="inOrderExpectStartTime != null">
and b.expect_time &gt;= #{inOrderExpectStartTime}
</if>
<if test="inOrderExpectEndTime != null">
and b.expect_time &lt;= #{inOrderExpectEndTime}
</if>
<!-- 实际入仓日期区间(为空的历史单按建档时间兜底),用于统计当天入库 -->
<if test="warehouseDateStart != null and warehouseDateStart != ''">
and date_format(IFNULL(b.warehouse_date, b.create_time), '%Y-%m-%d') &gt;= #{warehouseDateStart}
</if>
<if test="warehouseDateEnd != null and warehouseDateEnd != ''">
and date_format(IFNULL(b.warehouse_date, b.create_time), '%Y-%m-%d') &lt;= #{warehouseDateEnd}
</if>
and a.del_flag = 1
and b.del_flag = 1
</where>
order by a.create_time desc
</select>
</mapper>