173 lines
8.6 KiB
XML
173 lines
8.6 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.pickingOrder.repository.mapper.PickingOrderMapper">
|
|
|
|
<resultMap type="com.mhd.wms.domain.pickingOrder.repository.po.PickingOrderPO" id="PickingOrderResult">
|
|
<result property="pickingOrderId" column="picking_order_id" />
|
|
<result property="organizationId" column="organization_id" />
|
|
<result property="organizationName" column="organization_name" />
|
|
<result property="topOrganizationId" column="top_organization_id" />
|
|
<result property="orderNumber" column="order_number" />
|
|
<result property="pickingOrderNumber" column="picking_order_number" />
|
|
<result property="status" column="status" />
|
|
<result property="type" column="type" />
|
|
<result property="quantity" column="quantity" />
|
|
<result property="materialQuantity" column="material_quantity" />
|
|
<result property="pickingQuantity" column="picking_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="outOrderNumber" column="out_order_number" />
|
|
<result property="businessOrderNo" column="business_order_no" />
|
|
<result property="orderTypeCode" column="order_type_code" />
|
|
<result property="orderTypeName" column="order_type_name" />
|
|
<result property="priorityLevelCode" column="priority_level_code" />
|
|
<result property="priorityLevelName" column="priority_level_name" />
|
|
</resultMap>
|
|
|
|
|
|
<sql id="selectPickingOrderPo">
|
|
a.picking_order_id, a.organization_id, a.organization_name, a.top_organization_id, a.order_number, a.picking_order_number,
|
|
a.status, a.type, a.warehouse_id, a.warehouse_code, a.warehouse_name, a.shipper_id, a.shipper_name, a.quantity, a.weight_limit, a.volume_limit, a.material_quantity,
|
|
IFNULL((SELECT SUM(b.picking_quantity) FROM picking_material_detail b WHERE b.picking_order_number = a.picking_order_number AND b.del_flag = 1), 0) AS picking_quantity,
|
|
a.picking_material_quantity, a.abnormal, a.task_distribution, 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.out_order_number, a.business_order_no, a.order_type_code, a.order_type_name, a.priority_level_code, a.priority_level_name
|
|
</sql>
|
|
|
|
<sql id="selectPickingOrderPo1">
|
|
<if test="pickingOrderId != null ">
|
|
and a.picking_order_id = #{pickingOrderId}
|
|
</if>
|
|
<if test="shipperId != null ">
|
|
and a.shipper_id = #{shipperId}
|
|
</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="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="orderNumber != null and orderNumber != '' ">
|
|
and a.order_number like concat('%', #{orderNumber}, '%')
|
|
</if>
|
|
<if test="pickingOrderNumber != null and pickingOrderNumber != ''">
|
|
and a.picking_order_number like concat('%', #{pickingOrderNumber}, '%')
|
|
</if>
|
|
<if test="status != null ">
|
|
and a.status = #{status}
|
|
</if>
|
|
<if test="type != null ">
|
|
and a.type = #{type}
|
|
</if>
|
|
<if test="quantity != null ">
|
|
and a.quantity = #{quantity}
|
|
</if>
|
|
<if test="pickingQuantity != null ">
|
|
and a.picking_quantity = #{pickingQuantity}
|
|
</if>
|
|
<if test="abnormal != null ">
|
|
and a.abnormal = #{abnormal}
|
|
</if>
|
|
<if test="taskDistribution != null ">
|
|
and a.task_distribution = #{taskDistribution}
|
|
</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="pickingOrderIdList != null and pickingOrderIdList.size > 0 ">
|
|
and a.picking_order_id in
|
|
<foreach collection="pickingOrderIdList" item="item" index="index" open="(" close=")" separator=",">
|
|
#{item}
|
|
</foreach>
|
|
</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.wms.domain.pickingOrder.repository.todo.PickingOrderDO" resultMap="PickingOrderResult">
|
|
select
|
|
<include refid="selectPickingOrderPo"/>
|
|
from picking_order a
|
|
<where>
|
|
<include refid="selectPickingOrderPo1"/>
|
|
</where>
|
|
order by a.create_time desc
|
|
</select>
|
|
|
|
<select id="queryOutOrderById" parameterType="java.lang.Long" resultType="com.mhd.wms.domain.pickingOrder.repository.po.PickingOrderPO">
|
|
select
|
|
<include refid="selectPickingOrderPo"/>
|
|
<include refid="com.mhd.wms.domain.stockOutOrder.repository.mapper.StockOutOrderMapper.joinStockOutOrderPo"/>
|
|
from picking_order a
|
|
left join stock_out_order b on a.order_number = b.out_order_number
|
|
WHERE a.picking_order_id = #{pickingOrderId}
|
|
</select>
|
|
|
|
<select id="queryWaveOrderById" parameterType="java.lang.Long" resultType="com.mhd.wms.domain.pickingOrder.repository.po.PickingOrderPO">
|
|
select
|
|
<include refid="selectPickingOrderPo"/>
|
|
<include refid="com.mhd.wms.domain.waveOrder.repository.mapper.WaveOrderMapper.joinWaveOrderPo"/>
|
|
from picking_order a
|
|
left join wave_order b on a.order_number = b.wave_order_number
|
|
WHERE a.picking_order_id = #{pickingOrderId}
|
|
</select>
|
|
|
|
<select id="queryOutOrderByOrderNumber" parameterType="java.lang.String" resultType="com.mhd.wms.domain.pickingOrder.repository.po.PickingOrderPO">
|
|
select
|
|
<include refid="selectPickingOrderPo"/>
|
|
<include refid="com.mhd.wms.domain.stockOutOrder.repository.mapper.StockOutOrderMapper.joinStockOutOrderPo"/>
|
|
from picking_order a
|
|
left join stock_out_order b on a.order_number = b.out_order_number
|
|
WHERE a.order_number = #{orderNumber}
|
|
</select>
|
|
|
|
<select id="queryWaveOrderByOrderNumber" parameterType="java.lang.String" resultType="com.mhd.wms.domain.pickingOrder.repository.po.PickingOrderPO">
|
|
select
|
|
<include refid="selectPickingOrderPo"/>
|
|
<include refid="com.mhd.wms.domain.waveOrder.repository.mapper.WaveOrderMapper.joinWaveOrderPo"/>
|
|
from picking_order a
|
|
left join wave_order b on a.order_number = b.wave_order_number
|
|
WHERE a.order_number = #{orderNumber}
|
|
</select>
|
|
|
|
<update id="addQuantity" parameterType="com.mhd.wms.domain.pickingOrder.repository.todo.PickingOrderDO" >
|
|
UPDATE picking_order
|
|
<set>
|
|
picking_quantity = LEAST(picking_quantity + #{pickingQuantity}, quantity),
|
|
picking_material_quantity = picking_material_quantity + #{pickingMaterialQuantity},
|
|
status = #{status},
|
|
update_by = #{updateBy},
|
|
update_by_name = #{updateByName},
|
|
update_time = #{updateTime}
|
|
</set>
|
|
WHERE
|
|
picking_order_number = #{pickingOrderNumber}
|
|
AND del_flag = 1
|
|
</update>
|
|
</mapper> |