Files
nanguangszwlback/mhd_wms/src/main/resources/mapper/stockShelfOrder/StockShelfOrderMapper.xml
T
2026-07-01 11:36:59 +08:00

196 lines
11 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.stockShelfOrder.repository.mapper.StockShelfOrderMapper">
<resultMap type="com.mhd.wms.domain.stockShelfOrder.repository.po.StockShelfOrderPO" id="StockShelfOrderResult">
<result property="shelfOrderId" column="shelf_order_id" />
<result property="organizationId" column="organization_id" />
<result property="organizationName" column="organization_name" />
<result property="topOrganizationId" column="top_organization_id" />
<result property="inOrderNumber" column="in_order_number" />
<result property="receiptOrderNumber" column="receipt_order_number" />
<result property="receiptTaskNumber" column="receipt_task_number" />
<result property="shelfOrderNumber" column="shelf_order_number" />
<result property="status" column="status" />
<result property="receiptQuantity" column="receipt_quantity" />
<result property="shelvesQuantity" column="shelves_quantity" />
<result property="abnormal" column="abnormal" />
<result property="taskDistribution" column="task_distribution" />
<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="pushStatus" column="push_status" />
<result property="pushTime" column="push_time" />
<result property="pushBy" column="push_by" />
<result property="pushByName" column="push_by_name" />
<result property="goodsType" column="goods_type" />
</resultMap>
<sql id="selectStockShelfOrderPo">
a.shelf_order_id, a.organization_id, a.organization_name, a.top_organization_id,
a.in_order_number, a.receipt_order_number,a.receipt_task_number, a.shelf_order_number,a.status, a.receipt_quantity, a.shelves_quantity, a.material_quantity,
a.shelves_material_quantity, a.abnormal,a.task_distribution, a.task_distribution_time, a.operators_by, 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.push_status,a.push_time,a.push_by,a.push_by_name,
(SELECT m.goods_type FROM shelf_material_detail d
JOIN material_base_info m ON d.material_base_info_id = m.material_base_info_id
WHERE d.shelf_order_number = a.shelf_order_number AND d.level = 1
LIMIT 1) AS goods_type
</sql>
<sql id="selectStockShelfOrderPo1">
<if test="shelfOrderId != null ">
and a.shelf_order_id = #{shelfOrderId}
</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="inOrderNumber != null ">
and a.in_order_number = #{inOrderNumber}
</if>
<if test="receiptOrderNumber != null and receiptOrderNumber != ''">
and a.receipt_order_number like concat('%', #{receiptOrderNumber}, '%')
</if>
<if test="receiptTaskNumber != null and receiptTaskNumber != ''">
and a.receipt_task_number = #{receiptTaskNumber}
</if>
<if test="shelfOrderNumber != null and shelfOrderNumber != ''">
and a.shelf_order_number like concat('%', #{shelfOrderNumber}, '%')
</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="shelvesQuantity != null ">
and a.shelves_quantity = #{shelvesQuantity}
</if>
<if test="abnormal != null ">
and a.abnormal = #{abnormal}
</if>
<if test="taskDistribution != null ">
and a.task_distribution = #{taskDistribution}
</if>
<if test="operatorsBy != null and operatorsBy != ''">
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>
<if test="shelfOrderIds != null and shelfOrderIds.size > 0 ">
and a.shelf_order_id in
<foreach collection="shelfOrderIds" 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="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>
<choose>
<when test="delFlag != null"> and a.del_flag = #{delFlag} </when>
<otherwise> and a.del_flag = 1 </otherwise>
</choose>
</sql>
<sql id="joinStockReceiptOrderWhere">
<if test="receiptOrderNumber != null and receiptOrderNumber != ''">
and c.receipt_order_number like concat('%', #{receiptOrderNumber}, '%')
</if>
</sql>
<select id="queryList" parameterType="com.mhd.wms.domain.stockShelfOrder.repository.todo.StockShelfOrderDO" resultMap="StockShelfOrderResult">
select
<include refid="selectStockShelfOrderPo"/>
<include refid="com.mhd.wms.domain.stockInOrder.repository.mapper.StockInOrderMapper.joinStockInOrderPo"/>
from stock_shelf_order a
LEFT JOIN stock_in_order b ON a.in_order_number = b.in_order_number and a.DEL_FLAG = 1 and b.DEL_FLAG = 1
<where>
<include refid="selectStockShelfOrderPo1"/>
<include refid="com.mhd.wms.domain.stockInOrder.repository.mapper.StockInOrderMapper.joinStockInOrderPoWhere"/>
</where>
ORDER BY a.create_time DESC
</select>
<select id="getExecutionCount" resultType="java.lang.Integer" parameterType="java.lang.String">
select count(0) from "NGWL_TEST_OMS".EXECUTION_STOCK_IN_ORDER where BUSINESS_IN_ORDER_NUMBER = #{orderNumber} and ISSUE_STATUS != 4 and DELETE_FLAG = 1
</select>
<select id="getBusinessOrderNumber" resultType="java.lang.String" parameterType="java.lang.String">
select BUSINESS_IN_ORDER_NUMBER from "NGWL_TEST_OMS".EXECUTION_STOCK_IN_ORDER where IN_ORDER_NUMBER = #{orderNumber} and ISSUE_STATUS != 4 and DELETE_FLAG = 1
</select>
<update id="updateOmsOrder">
update "NGWL_TEST_OMS".RESERVATION_STOCK_IN_ORDER set ISSUE_STATUS = #{status},in_quantity = #{shelvesQuantity},STORAGE_TIME = CURRENT_TIMESTAMP where IN_ORDER_NUMBER = #{orderNumber} and DELETE_FLAG = 1
</update>
<update id="updateOmsExecutionOrder">
update "NGWL_TEST_OMS".EXECUTION_STOCK_IN_ORDER set ISSUE_STATUS = #{status},in_quantity = #{shelvesQuantity},STORAGE_TIME = CURRENT_TIMESTAMP where IN_ORDER_NUMBER = #{orderNumber} and DELETE_FLAG = 1
</update>
<update id="updateOmsReserveOrder">
update "NGWL_TEST_OMS".RESERVE_STOCK_IN_ORDER set in_quantity = #{shelvesQuantity},STORAGE_TIME = CURRENT_TIMESTAMP where IN_ORDER_NUMBER = #{orderNumber} and DELETE_FLAG = 1
</update>
<update id="updateOmsDocument">
update "NGWL_TEST_OMS".RESERVATION_IN_MATERIAL_DETAIL set INBOUND_ITEMS = #{shelvesQuantity}, TOTAL_NET_WEIGHT= #{totalNetWeight},STORAGE_TIME = CURRENT_TIMESTAMP where MATERIAL_DETAIL_ID = #{omsInMaterialDetail} and DELETE_FLAG = 1
</update>
<update id="updateOmsHandover">
update "NGWL_TEST_OMS".RESERVATION_OUT_MATERIAL_DETAIL set INBOUND_ITEMS = #{checkQuantity},
TOTAL_NET_WEIGHT= #{totalNetWeight}
,STORAGE_TIME = CURRENT_TIMESTAMP
where OUT_ORDER_NUMBER = #{outOrderNumber} and UNIQUE_ID = #{uniqueId} and DELETE_FLAG = 1
</update>
<update id="updateOmsDocumentLot">
update "NGWL_TEST_OMS".RESERVATION_IN_MATERIAL_DETAIL set INBOUND_ITEMS = #{shelvesQuantity}, TOTAL_NET_WEIGHT= #{totalNetWeight},STORAGE_TIME = CURRENT_TIMESTAMP
where LOT_NO = #{lotNumber} and DELETE_FLAG = 1
</update>
<update id="updateOmsInventoryQuantity">
update "NGWL_TEST_OMS".RESERVATION_MATERIAL_INVENTORY set INVENTORY_QUANTITY = #{quantity},
ALLOCATION_QUANTITY= #{quantity}
where IN_ORDER_NUMBER = #{inOrderNumber} and LOT_NUMBER = #{lotNumber} and DELETE_FLAG = 1
</update>
<update id="updateOmsInventorySynchronization">
update "NGWL_TEST_OMS".RESERVATION_MATERIAL_INVENTORY set INVENTORY_QUANTITY = INVENTORY_QUANTITY - #{checkQuantity},
ALLOCATION_QUANTITY= ALLOCATION_QUANTITY - #{checkQuantity}
where IN_ORDER_NUMBER = #{inOrderNumber} and LOT_NUMBER = #{lotNo} and DELETE_FLAG = 1
</update>
<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>
</mapper>