Files
nanguangszwlback/mhd_wms/src/main/resources/mapper/stockShelfOrder/StockShelfOrderMapper.xml
T

134 lines
6.7 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" />
</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
</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>
<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
<where>
<include refid="selectStockShelfOrderPo1"/>
<include refid="com.mhd.wms.domain.stockInOrder.repository.mapper.StockInOrderMapper.joinStockInOrderPoWhere"/>
</where>
ORDER BY a.create_time DESC
</select>
<update id="updateOmsOrder">
update "NGWL_TEST_OMS".RESERVATION_STOCK_IN_ORDER set ISSUE_STATUS = #{status},quantity = #{shelvesQuantity},STORAGE_TIME = CURRENT_TIMESTAMP where IN_ORDER_NUMBER = #{orderNumber}
</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}
</update>
</mapper>