- OMS入库业务单/执行单: list/list1返回totalPlanQuantity/totalInQuantity(与行quantity/in_quantity列同源) - WMS入库/收货/上架: 返回totalPlanQuantity/totalInQuantity(上架计划数量=明细应上架量; 入库数量=收货/上架数量, 与行列同口径) - WMS出库/拣货/复核/交接: 返回totalPlanQuantity/totalOutboundQuantity(各页实际量列同口径; 复核明细聚合不滤del_flag兼容已反审tab) - 合计SQL与queryList同条件片段/同JOIN结构, 分页查询后同一DO查询, 响应与total同层级追加字段, 前端纯增量兼容
605 lines
30 KiB
XML
605 lines
30 KiB
XML
<?xml version="1.0" encoding="UTF-8" ?>
|
|
<!DOCTYPE mapper
|
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
<mapper namespace="com.mhd.wms.domain.stockOutOrder.repository.mapper.StockOutOrderMapper">
|
|
|
|
<resultMap type="com.mhd.wms.domain.stockOutOrder.repository.po.StockOutOrderPO" 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="materialQuantity" column="material_quantity"/>
|
|
<result property="quantity" column="quantity"/>
|
|
<result property="weightLimit" column="weight_limit"/>
|
|
<result property="volumeLimit" column="volume_limit"/>
|
|
<result property="allocationQuantity" column="allocation_quantity"/>
|
|
<result property="alreadyAllocationQuantity" column="already_allocation_quantity"/>
|
|
<result property="pickingQuantity" column="picking_quantity"/>
|
|
<result property="checkQuantity" column="check_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="reverseFlag" column="reverse_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="billingJson" column="billing_json"/>
|
|
<result property="salesmanId" column="SALESMAN_ID"/>
|
|
<result property="salesmanName" column="SALESMAN_NAME"/>
|
|
<result property="settlementCurrency" column="SETTLEMENT_CURRENCY"/>
|
|
<result property="businessOrderNo" column="business_order_no"/>
|
|
<result property="returnQuantity" column="RETURN_QUANTITY"/>
|
|
<result property="trainNo" column="train_no"/>
|
|
<result property="pushBy" column="PUSH_BY" />
|
|
<result property="pushByName" column="PUSH_BY_NAME" />
|
|
<result property="pushStatus" column="PUSH_STATUS" />
|
|
<result property="pushTime" column="PUSH_TIME" />
|
|
<result property="workUserId" column="WORK_USER_ID" />
|
|
<result property="workUserName" column="WORK_USER_NAME" />
|
|
<result property="workTaskReceiveStatus" column="WORK_TASK_RECEIVE_STATUS" />
|
|
<result property="taskIssueUserId" column="TASK_ISSUE_USER_ID" />
|
|
<result property="signatureStatus" column="SIGNATURE_STATUS" />
|
|
<result property="signatureTime" column="SIGNATURE_TIME" />
|
|
<result property="signaturePic" column="SIGNATURE_PIC" />
|
|
<result property="evidencePics" column="EVIDENCE_PICS" />
|
|
<result property="signatureRemark" column="SIGNATURE_REMARK" />
|
|
<result property="lineCode" column="LINE_CODE" />
|
|
<result property="lineName" column="LINE_NAME" />
|
|
<result property="shuttleNo" column="SHUTTLE_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.allocation_quantity, a.already_allocation_quantity, a.picking_quantity, 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.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.train_no,a.PUSH_TIME,a.PUSH_BY,a.PUSH_BY_NAME,a.PUSH_STATUS,
|
|
a.update_time, a.update_by, a.update_by_name, a.del_flag, a.reverse_flag, a.over_stock_id, a.over_stock_status, a.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.billing_json,a.SETTLEMENT_CURRENCY,
|
|
a.SALESMAN_ID,a.SALESMAN_NAME,a.business_order_no,a.RETURN_QUANTITY,a.WORK_USER_ID,a.WORK_TASK_RECEIVE_STATUS,a.TASK_ISSUE_USER_ID,a.WORK_USER_NAME,
|
|
a.SIGNATURE_STATUS, a.SIGNATURE_TIME, a.SIGNATURE_PIC, a.EVIDENCE_PICS, a.SIGNATURE_REMARK
|
|
,a.LINE_CODE,a.LINE_NAME,a.SHUTTLE_NO
|
|
</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="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="needDeclareFlag != null and needDeclareFlag != ''">
|
|
and a.need_declare_flag = #{needDeclareFlag}
|
|
</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>
|
|
<if test="statusList != null and statusList.size > 0 ">
|
|
and a.status in
|
|
<foreach collection="statusList" item="item" index="index" open="(" close=")" separator=",">
|
|
#{item}
|
|
</foreach>
|
|
</if>
|
|
<if test="queryUserId != null">
|
|
and a.TASK_ISSUE_USER_ID like concat('%', #{queryUserId}, '%')
|
|
</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="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="createTimeFrom != null">
|
|
and a.create_time <![CDATA[>=]]> #{createTimeFrom}
|
|
</if>
|
|
<if test="createTimeTo != null">
|
|
and a.create_time <![CDATA[<=]]> #{createTimeTo}
|
|
</if>
|
|
<if test="pushTimeFrom != null">
|
|
and a.PUSH_TIME <![CDATA[>=]]> #{pushTimeFrom}
|
|
</if>
|
|
<if test="pushTimeTo != null">
|
|
and a.PUSH_TIME <![CDATA[<=]]> #{pushTimeTo}
|
|
</if>
|
|
<if test="pushStatus != null">
|
|
and a.PUSH_STATUS = #{pushStatus}
|
|
</if>
|
|
<!-- PDA出库签名列表:作业任务人员模糊查询 -->
|
|
<if test="workUserNameLike != null and workUserNameLike != ''">
|
|
and a.WORK_USER_NAME like concat('%', #{workUserNameLike}, '%')
|
|
</if>
|
|
<!-- PDA出库签名列表:按签名状态精确查询 -->
|
|
<if test="signatureStatus != null">
|
|
and a.SIGNATURE_STATUS = #{signatureStatus}
|
|
</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>
|
|
<!-- 反审标记查询: 【已反审】tab 前端传 delFlag=2 + reverseFlag=1 -->
|
|
<if test="reverseFlag != null">and a.reverse_flag = #{reverseFlag}</if>
|
|
</sql>
|
|
|
|
<select id="queryList" parameterType="com.mhd.wms.domain.stockOutOrder.repository.todo.StockOutOrderDO"
|
|
resultMap="StockOutOrderResult">
|
|
select
|
|
<include refid="selectStockOutOrderPo"/>
|
|
from stock_out_order a
|
|
<where>
|
|
<include refid="selectStockOutOrderPo1"/>
|
|
</where>
|
|
order by a.create_time desc nulls last
|
|
</select>
|
|
|
|
<!-- 列表合计:按查询条件(与queryList同条件片段)全量不分页汇总计划数量与出库数量,两口径分开计算;
|
|
出库数量与行的totalOutboundQuantity列同口径(selectAggregatesForStockOutList: del_flag=1 and level=1),底部总和与列值之和一致 -->
|
|
<select id="queryListTotal" parameterType="com.mhd.wms.domain.stockOutOrder.repository.todo.StockOutOrderDO"
|
|
resultType="com.mhd.wms.domain.stockOutOrder.repository.po.StockOutOrderTotalPO">
|
|
select
|
|
coalesce(sum(a.quantity), 0) as totalPlanQuantity,
|
|
coalesce(sum(od.outbound_quantity), 0) as totalOutboundQuantity
|
|
from stock_out_order a
|
|
left join (
|
|
select out_order_number, sum(outbound_quantity) as outbound_quantity
|
|
from out_material_detail
|
|
where del_flag = 1
|
|
and level = 1
|
|
group by out_order_number
|
|
) od on od.out_order_number = a.out_order_number
|
|
<where>
|
|
<include refid="selectStockOutOrderPo1"/>
|
|
</where>
|
|
</select>
|
|
|
|
|
|
<select id="queryOutStockNoticePrint" resultMap="StockOutOrderResult">
|
|
SELECT a.out_order_id,
|
|
a.notice_number,
|
|
a.out_order_number,
|
|
a.business_order_no,
|
|
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,
|
|
a.create_by,
|
|
a.create_by_name,
|
|
a.create_time
|
|
FROM stock_out_order a
|
|
WHERE a.del_flag = 1
|
|
AND a.out_order_id = #{outOrderId}
|
|
</select>
|
|
|
|
<select id="queryOutStockNoticePrintDetail" resultMap="OutMaterialDetailPOResult">
|
|
SELECT b.lot_no,
|
|
b.warehouse_code,
|
|
b.warehouse_name,
|
|
b.material_name,
|
|
b.storage_location_name,
|
|
b.storage_location_code,
|
|
b.piece_count,
|
|
b.unit_name
|
|
FROM out_material_detail b
|
|
WHERE b.del_flag = 1
|
|
AND b.out_order_number =
|
|
(SELECT out_order_number FROM stock_out_order WHERE out_order_id = #{outOrderId} AND del_flag = 1)
|
|
ORDER BY b.material_detail_id
|
|
</select>
|
|
|
|
|
|
<resultMap type="com.mhd.wms.domain.outMaterialDetail.repository.po.OutMaterialDetailPO"
|
|
id="OutMaterialDetailPOResult">
|
|
<result property="lotNo" column="lot_no"/>
|
|
<result property="warehouseCode" column="warehouse_code"/>
|
|
<result property="warehouseName" column="warehouse_name"/>
|
|
<result property="materialName" column="material_name"/>
|
|
<result property="storageLocationName" column="storage_location_name"/>
|
|
<result property="storageLocationCode" column="storage_location_code"/>
|
|
<result property="pieceCount" column="piece_count"/>
|
|
<result property="unitName" column="unit_name"/>
|
|
<result property="batchNumber" column="batch_number"/>
|
|
<result property="materialCode" column="material_code"/>
|
|
<result property="specificationModel" column="specification_model"/>
|
|
<result property="quantity" column="quantity"/>
|
|
<result property="warehouseId" column="warehouse_id"/>
|
|
<result property="materialBaseInfoId" column="material_base_info_id"/>
|
|
<result property="copyCode" column="copy_code"/>
|
|
<result property="outboundQuantity" column="outbound_quantity"/>
|
|
<result property="packName" column="pack_name"/>
|
|
<result property="boxPalletNo" column="box_pallet_no"/>
|
|
</resultMap>
|
|
|
|
|
|
<resultMap type="com.mhd.wms.domain.copyCodeReference.repository.po.CopyCodeReferencePO" id="CopyCodeWeightResult">
|
|
<result property="netWeight" column="net_weight"/>
|
|
<result property="grossWeight" column="gross_weight"/>
|
|
<result property="inventoryQuantity" column="inventory_quantity"/>
|
|
<result property="lotNumber" column="lot_number"/>
|
|
<result property="boxPalletNo" column="box_pallet_no"/>
|
|
</resultMap>
|
|
|
|
<select id="queryCopyCodeWeightListByBatch" resultMap="CopyCodeWeightResult">
|
|
SELECT ccr.net_weight,
|
|
ccr.gross_weight,
|
|
ccr.inventory_quantity,
|
|
ccr.lot_number,
|
|
ccr.box_pallet_no
|
|
FROM copy_code_reference ccr
|
|
WHERE ccr.del_flag = 1
|
|
AND ccr.batch_number = #{batchNumber}
|
|
AND ccr.material_base_info_id = #{materialBaseInfoId}
|
|
AND ccr.warehouse_id = #{warehouseId}
|
|
AND ccr.box_pallet_no = #{boxPalletNo}
|
|
</select>
|
|
|
|
|
|
<select id="queryOutStockNoticePrintDetailGF" resultMap="OutMaterialDetailPOResult">
|
|
SELECT b.batch_number,
|
|
b.material_code,
|
|
b.material_name,
|
|
COALESCE(b.specification_model, b.size, b.liter, mbi.specification_model) AS specification_model,
|
|
b.quantity,
|
|
b.unit_name,
|
|
b.pack_name,
|
|
b.warehouse_code,
|
|
b.warehouse_name,
|
|
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,
|
|
mbi.copy_code
|
|
FROM out_material_detail b
|
|
LEFT JOIN material_base_info mbi ON b.material_base_info_id = mbi.material_base_info_id
|
|
WHERE b.del_flag = 1
|
|
AND b.out_order_number =
|
|
(SELECT out_order_number FROM stock_out_order WHERE out_order_id = #{outOrderId} AND del_flag = 1)
|
|
ORDER BY b.material_detail_id
|
|
</select>
|
|
<!-- 获取用户NC码 -->
|
|
<select id="getUserNcCode" parameterType="java.lang.Long" resultType="java.lang.String">
|
|
select CUSTOMER_NC_CODE from "NGWL_TEST_USER".USER_SHIPPER where 1 = 1 and DEL_FLAG = 1 and USER_ID = #{id} limit 1
|
|
</select>
|
|
|
|
<select id="getSettlementCurrency" parameterType="java.lang.Long" resultType="java.lang.String">
|
|
select SETTLEMENT_CURRENCY from "NGWL_TEST_USER".USER_SHIPPER where 1 = 1 and DEL_FLAG = 1 and USER_ID = #{id} limit 1
|
|
</select>
|
|
<select id="getKcId" parameterType="java.lang.String" resultType="java.lang.Long">
|
|
select MATERIAL_INVENTORY_ID from "NGWL_TEST_WMS".OUT_MATERIAL_DETAIL where lot_no = #{lotNo}
|
|
</select>
|
|
<select id="getInOrderNumber" parameterType="java.lang.Long" resultType="java.lang.String">
|
|
select IN_ORDER_NUMBER from "NGWL_TEST_WMS".MATERIAL_INVENTORY where MATERIAL_INVENTORY_ID = #{id}
|
|
</select>
|
|
<select id="getWarehouse" parameterType="java.lang.Long" resultType="java.lang.String">
|
|
select WAREHOUSE_NAME from "NGWL_TEST_WMS".MATERIAL_INVENTORY where MATERIAL_INVENTORY_ID = #{id}
|
|
</select>
|
|
<select id="getOpWhLoc" parameterType="java.lang.Long" resultType="java.lang.String">
|
|
select STORAGE_LOCATION_NAME from "NGWL_TEST_WMS".MATERIAL_INVENTORY where MATERIAL_INVENTORY_ID = #{id}
|
|
</select>
|
|
<select id="getInLotNo" resultType="java.lang.String">
|
|
select LOT_NO from "NGWL_TEST_WMS".IN_MATERIAL_DETAIL where MATERIAL_BASE_INFO_ID = #{baseId} and IN_ORDER_NUMBER = #{inOrderNumber}
|
|
</select>
|
|
|
|
<!-- 跨4张入库单表查询指定前缀+组织+仓库的所有入库单号(取最大序号+1,防止删单后单号重复) -->
|
|
<select id="getMaxStockOutOrderByPrefixAndOrgAndWarehouse" resultType="java.lang.String">
|
|
SELECT out_order_number FROM NGWL_TEST_OMS.reserve_stock_out_order
|
|
WHERE out_order_number LIKE concat(#{prefix}, '%')
|
|
|
|
<if test="organizationId != null">
|
|
AND organization_id = #{organizationId}
|
|
</if>
|
|
<if test="warehouseId != null">
|
|
AND warehouse_id = #{warehouseId}
|
|
</if>
|
|
|
|
UNION ALL
|
|
|
|
SELECT out_order_number FROM NGWL_TEST_OMS.reservation_stock_out_order
|
|
WHERE out_order_number LIKE concat(#{prefix}, '%')
|
|
|
|
<if test="organizationId != null">
|
|
AND organization_id = #{organizationId}
|
|
</if>
|
|
<if test="warehouseId != null">
|
|
AND warehouse_id = #{warehouseId}
|
|
</if>
|
|
|
|
UNION ALL
|
|
|
|
SELECT out_order_number FROM NGWL_TEST_OMS.execution_stock_out_order
|
|
WHERE out_order_number LIKE concat(#{prefix}, '%')
|
|
|
|
<if test="organizationId != null">
|
|
AND organization_id = #{organizationId}
|
|
</if>
|
|
<if test="warehouseId != null">
|
|
AND warehouse_id = #{warehouseId}
|
|
</if>
|
|
|
|
UNION ALL
|
|
|
|
SELECT out_order_number FROM stock_out_order
|
|
WHERE out_order_number LIKE concat(#{prefix}, '%')
|
|
|
|
<if test="organizationId != null">
|
|
AND organization_id = #{organizationId}
|
|
</if>
|
|
<if test="warehouseId != null">
|
|
AND warehouse_id = #{warehouseId}
|
|
</if>
|
|
</select>
|
|
</mapper> |