Files
nanguangszwlback/mhd_wms/src/main/resources/mapper/handoverTaskOrder/HandoverTaskOrderMapper.xml
T
rcx 50423b4e4b feat(oms,wms): 入库/出库业务单执行单与WMS出入库各页面列表返回计划数量与实际数量总和(全量不分页合计)
- OMS入库业务单/执行单: list/list1返回totalPlanQuantity/totalInQuantity(与行quantity/in_quantity列同源)
- WMS入库/收货/上架: 返回totalPlanQuantity/totalInQuantity(上架计划数量=明细应上架量; 入库数量=收货/上架数量, 与行列同口径)
- WMS出库/拣货/复核/交接: 返回totalPlanQuantity/totalOutboundQuantity(各页实际量列同口径; 复核明细聚合不滤del_flag兼容已反审tab)
- 合计SQL与queryList同条件片段/同JOIN结构, 分页查询后同一DO查询, 响应与total同层级追加字段, 前端纯增量兼容
2026-09-14 18:02:57 +08:00

191 lines
10 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.handoverTaskOrder.repository.mapper.HandoverTaskOrderMapper">
<resultMap type="com.mhd.wms.domain.handoverTaskOrder.repository.po.HandoverTaskOrderPO" id="HandoverTaskOrderResult">
<id property="handoverTaskOrderId" column="handover_task_order_id" />
<result property="organizationId" column="organization_id" />
<result property="organizationName" column="organization_name" />
<result property="topOrganizationId" column="top_organization_id" />
<result property="serialNumber" column="serial_number" />
<result property="taskNumber" column="task_number" />
<result property="status" column="status" />
<result property="platformId" column="platform_id" />
<result property="platformCode" column="platform_code" />
<result property="platformName" column="platform_name" />
<result property="platformUseTimeId" column="platform_use_time_id" />
<result property="platformUseStartTime" column="platform_use_start_time" />
<result property="platformUseEndTime" column="platform_use_end_time" />
<result property="platformUseStatus" column="platform_use_status" />
<result property="orderTypeCode" column="order_type_code" />
<result property="orderTypeName" column="order_type_name" />
<result property="expectTime" column="expect_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="orderNumber" column="order_number" />
<result property="pickingOrderNumber" column="picking_order_number" />
<result property="remark" column="remark" />
<result property="taskDistribution" column="task_distribution" />
<result property="taskDistributionTime" column="task_distribution_time" />
<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="pictureApp" column="picture_app" />
<result property="billingJson" column="billing_json" />
</resultMap>
<sql id="selectHandoverTaskOrderPo">
a.handover_task_order_id AS handover_task_order_id, a.organization_id, a.organization_name, a.top_organization_id, a.serial_number, a.task_number, a.status, a.platform_id,
a.platform_code, a.platform_name, a.platform_use_time_id, a.platform_use_start_time, a.platform_use_end_time, a.platform_use_status,
a.order_type_code, a.order_type_name, a.expect_time, a.warehouse_id, a.warehouse_code, a.warehouse_name, a.shipper_id,
a.shipper_name, a.order_number, a.picking_order_number, a.remark, a.task_distribution, a.task_distribution_time, a.create_time, a.create_by, a.create_by_name, a.update_time,
a.update_by, a.update_by_name, a.del_flag, a.reverse_flag, a.picture_app,a.billing_json
</sql>
<sql id="selectHandoverTaskOrderPo1">
<if test="organizationId != null ">
and a.organization_id = #{organizationId}
</if>
<if test="handoverTaskOrderId != null ">
and a.handover_task_order_id = #{handoverTaskOrderId}
</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="serialNumber != null and serialNumber != ''">
and a.serial_number = #{serialNumber}
</if>
<if test="taskNumber != null and taskNumber != ''">
and a.task_number = #{taskNumber}
</if>
<if test="status != null ">
and a.status = #{status}
</if>
<if test="platformId != null ">
and a.platform_id = #{platformId}
</if>
<if test="platformCode != null and platformCode != ''">
and a.platform_code = #{platformCode}
</if>
<if test="platformName != null and platformName != ''">
and a.platform_name like concat('%', #{platformName}, '%')
</if>
<if test="platformUseTimeId != null ">
and a.platform_use_time_id = #{platformUseTimeId}
</if>
<if test="platformUseStartTime != null ">
and a.platform_use_start_time = #{platformUseStartTime}
</if>
<if test="platformUseEndTime != null ">
and a.platform_use_end_time = #{platformUseEndTime}
</if>
<if test="platformUseStatus != null ">
and a.platform_use_status = #{platformUseStatus}
</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="expectTime != null ">
and a.expect_time = #{expectTime}
</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="orderNumber != null and orderNumber != ''">
and a.order_number = #{orderNumber}
</if>
<if test="pickingOrderNumber != null and pickingOrderNumber != ''">
and a.picking_order_number = #{pickingOrderNumber}
</if>
<if test="operatorsBy != null">
and a.operators_by = #{operatorsBy}
</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>
<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.handoverTaskOrder.repository.todo.HandoverTaskOrderDO" resultMap="HandoverTaskOrderResult">
select
<include refid="selectHandoverTaskOrderPo"/>
from handover_task_order a
<where>
<include refid="selectHandoverTaskOrderPo1"/>
</where>
order by a.create_time desc
</select>
<!-- 列表合计:按查询条件(与queryList同条件片段)全量不分页汇总交接明细数量,计划数量与出库数量分开计算;
头表无数量列, 两口径均按交接明细(del_flag=1)按task_number求和: 计划数量=quantity, 出库数量=check_quantity(复核数量,与详情页出库数量口径一致) -->
<select id="queryListTotal" parameterType="com.mhd.wms.domain.handoverTaskOrder.repository.todo.HandoverTaskOrderDO" resultType="com.mhd.wms.domain.handoverTaskOrder.repository.po.HandoverTaskOrderTotalPO">
select
coalesce(sum(md.plan_quantity), 0) as totalPlanQuantity,
coalesce(sum(md.check_quantity), 0) as totalOutboundQuantity
from handover_task_order a
left join (
select task_number,
sum(quantity) as plan_quantity,
sum(check_quantity) as check_quantity
from task_handover_material_detail
where del_flag = 1
group by task_number
) md on md.task_number = a.task_number
<where>
<include refid="selectHandoverTaskOrderPo1"/>
</where>
</select>
<update id="updateOmsOrder">
update "NGWL_TEST_OMS".RESERVATION_STOCK_OUT_ORDER set ISSUE_STATUS = #{status},OUTBOUND_TIME = CURRENT_TIMESTAMP where OUT_ORDER_NUMBER = #{orderNumber} and DEL_FLAG = 1
</update>
<update id="updateOmsExecutionOrder">
update "NGWL_TEST_OMS".EXECUTION_STOCK_OUT_ORDER set ISSUE_STATUS = #{status},OUTBOUND_TIME = CURRENT_TIMESTAMP where OUT_ORDER_NUMBER = #{orderNumber} and DEL_FLAG = 1
</update>
<select id="getExecutionRkCount" parameterType="java.lang.String" resultType="java.lang.Integer">
select count(0) from "NGWL_TEST_OMS".EXECUTION_STOCK_OUT_ORDER where BUSINESS_OUT_ORDER_NUMBER = #{orderNumber} and ISSUE_STATUS != 4 and DEL_FLAG = 1
</select>
<select id="getBusinessOrdernumber" parameterType="java.lang.String" resultType="java.lang.String">
select BUSINESS_OUT_ORDER_NUMBER from "NGWL_TEST_OMS".EXECUTION_STOCK_OUT_ORDER where OUT_ORDER_NUMBER = #{orderNumber} and DEL_FLAG = 1
</select>
</mapper>