413 lines
22 KiB
XML
413 lines
22 KiB
XML
<?xml version="1.0" encoding="UTF-8" ?>
|
|
<!DOCTYPE mapper
|
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
<mapper namespace="com.mhd.oms.domain.reservationStockOutOrder.repository.mapper.ReservationStockOutOrderMapper">
|
|
|
|
<resultMap type="com.mhd.oms.domain.reservationStockOutOrder.repository.po.ReservationStockOutOrderPO" 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.reservation_audit_time,a.reservation_audit_name
|
|
,a.reservation_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 > #{gtStatus}
|
|
</if>
|
|
<if test="ltStatus != null ">
|
|
and a.status < #{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="issueStatus != null">
|
|
and a.issue_status = #{issueStatus}
|
|
</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 > #{gtCheckStatus}
|
|
</if>
|
|
<if test="ltCheckStatus != null ">
|
|
and a.check_status < #{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') >= #{createTimeStart}
|
|
</if>
|
|
<if test="createTimeEnd != null and createTimeEnd != ''">
|
|
and date_format(a.create_time,'%Y-%m-%d') <= #{createTimeEnd}
|
|
</if>
|
|
<if test="auditTimeStart != null and auditTimeStart != ''">
|
|
and date_format(a.audit_time,'%Y-%m-%d') >= #{auditTimeStart}
|
|
</if>
|
|
<if test="auditTimeEnd != null and auditTimeEnd != ''">
|
|
and date_format(a.audit_time,'%Y-%m-%d') <= #{auditTimeEnd}
|
|
</if>
|
|
<if test="needDeclareFlag != null">
|
|
and a.NEED_DECLARE_FLAG = #{needDeclareFlag}
|
|
</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.reservationStockOutOrder.repository.todo.ReservationStockOutOrderDO" resultMap="StockOutOrderResult">
|
|
select
|
|
<include refid="selectStockOutOrderPo"/>
|
|
from reservation_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 reservation_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 reservation_out_material_detail b
|
|
WHERE b.del_flag = 1
|
|
AND b.out_order_number = (SELECT out_order_number FROM reservation_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.reservationOutMaterialDetail.repository.po.ReservationOutMaterialDetailPO" 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> |