201 lines
11 KiB
XML
201 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.ruoyi.out.outStockout.mapper.OutStockoutMapper">
|
|
|
|
<resultMap type="OutStockout" id="OutStockoutResult">
|
|
<result property="stockoutGuid" column="stockout_guid" />
|
|
<result property="stockoutId" column="stockout_id" />
|
|
<result property="outType" column="out_type" />
|
|
<result property="createDate" column="create_date" />
|
|
<result property="departmentNo" column="department_no" />
|
|
<result property="customerNo" column="customer_no" />
|
|
<result property="createManId" column="create_man_id" />
|
|
<result property="status" column="status" />
|
|
<result property="stockoutSource" column="stockout_source" />
|
|
<result property="warehouseId" column="warehouse_id" />
|
|
<result property="classNowId" column="class_now_id" />
|
|
<result property="exitId" column="exit_id" />
|
|
<result property="carNumber" column="car_number" />
|
|
<result property="FID" column="FID" />
|
|
<result property="erpStockoutId" column="erp_stockout_id" />
|
|
<result property="startDate" column="start_date" />
|
|
<result property="finishDate" column="finish_date" />
|
|
<result property="warehouseName" column="warehouse_name" />
|
|
<result property="customerName" column="customer_name" />
|
|
</resultMap>
|
|
|
|
<sql id="selectOutStockoutVo">
|
|
select stockout_guid, stockout_id, out_type, create_date, department_no, customer_no, create_man_id, status, stockout_source, warehouse_id, class_now_id, exit_id, car_number, FID, erp_stockout_id,start_date,finish_date from out_stockout
|
|
</sql>
|
|
|
|
<select id="selectOutStockoutList" parameterType="OutStockout" resultMap="OutStockoutResult">
|
|
select distinct o.stockout_guid, o.stockout_id, o.out_type, o.create_date, o.department_no, o.customer_no, o.create_man_id, o.status, o.stockout_source,
|
|
o.warehouse_id, o.class_now_id, o.exit_id, o.car_number, o.FID, o.erp_stockout_id,o.start_date,o.finish_date,bw.warehouse_name,bc.customer_name from out_stockout o
|
|
left join bas_warehouse bw on bw.warehouse_id = o.warehouse_id
|
|
left join bas_customer bc on bc.customer_no = o.customer_no
|
|
left join out_stockout_detail d on d.stockout_id = o.stockout_id
|
|
|
|
<where>
|
|
<if test="stockoutGuid != null and stockoutGuid != ''"> and o.stockout_guid = #{stockoutGuid}</if>
|
|
<if test="stockoutId != null and stockoutId != ''"> and o.stockout_id = #{stockoutId}</if>
|
|
<if test="outType != null and outType != ''"> and o.out_type = #{outType}</if>
|
|
<if test="startDate != null and startDate != ''"> and o.create_date >= #{startDate}</if>
|
|
<if test="finishDate != null and finishDate != ''"> and o.create_date <= #{finishDate}</if>
|
|
<if test="departmentNo != null and departmentNo != ''"> and o.department_no = #{departmentNo}</if>
|
|
<if test="customerNo != null and customerNo != ''"> and o.customer_no = #{customerNo}</if>
|
|
<if test="createManId != null and createManId != ''"> and o.create_man_id = #{createManId}</if>
|
|
<if test="status != null and status != ''"> and o.status = #{status}</if>
|
|
<if test="stockoutSource != null and stockoutSource != ''"> and o.stockout_source = #{stockoutSource}</if>
|
|
<if test="warehouseId != null and warehouseId != ''"> and o.warehouse_id = #{warehouseId}</if>
|
|
<if test="classNowId != null and classNowId != ''"> and o.class_now_id = #{classNowId}</if>
|
|
<if test="exitId != null and exitId != ''"> and o.exit_id = #{exitId}</if>
|
|
<if test="carNumber != null and carNumber != ''"> and o.car_number = #{carNumber}</if>
|
|
<if test="FID != null and FID != ''"> and o.FID = #{FID}</if>
|
|
<if test="erpStockoutId != null and erpStockoutId != ''"> and o.erp_stockout_id = #{erpStockoutId}</if>
|
|
<if test="productId != null and productId != ''"> and d.product_id = #{productId}</if>
|
|
<if test="productName != null and productName != ''"> and d.product_name like concat('%', #{productName}, '%')</if>
|
|
<if test="customerName != null and customerName != ''"> and bc.customer_name like concat('%', #{customerName}, '%')</if>
|
|
</where>
|
|
order by o.create_date desc
|
|
</select>
|
|
|
|
<select id="selectOutStockoutByStockoutGuid" parameterType="String" resultMap="OutStockoutResult">
|
|
<include refid="selectOutStockoutVo"/>
|
|
where stockout_guid = #{stockoutGuid}
|
|
</select>
|
|
|
|
<insert id="insertOutStockout" parameterType="OutStockout">
|
|
insert into out_stockout
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
<if test="stockoutGuid != null and stockoutGuid != ''">stockout_guid,</if>
|
|
<if test="stockoutId != null and stockoutId != ''">stockout_id,</if>
|
|
<if test="outType != null and outType != ''">out_type,</if>
|
|
<if test="createDate != null and createDate != ''">create_date,</if>
|
|
<if test="departmentNo != null">department_no,</if>
|
|
<if test="customerNo != null">customer_no,</if>
|
|
<if test="createManId != null">create_man_id,</if>
|
|
<if test="status != null and status != ''">status,</if>
|
|
<if test="stockoutSource != null">stockout_source,</if>
|
|
<if test="warehouseId != null">warehouse_id,</if>
|
|
<if test="classNowId != null">class_now_id,</if>
|
|
<if test="exitId != null">exit_id,</if>
|
|
<if test="carNumber != null">car_number,</if>
|
|
<if test="FID != null">FID,</if>
|
|
<if test="erpStockoutId != null">erp_stockout_id,</if>
|
|
</trim>
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
<if test="stockoutGuid != null and stockoutGuid != ''">#{stockoutGuid},</if>
|
|
<if test="stockoutId != null and stockoutId != ''">#{stockoutId},</if>
|
|
<if test="outType != null and outType != ''">#{outType},</if>
|
|
<if test="createDate != null and createDate != ''">#{createDate},</if>
|
|
<if test="departmentNo != null">#{departmentNo},</if>
|
|
<if test="customerNo != null">#{customerNo},</if>
|
|
<if test="createManId != null">#{createManId},</if>
|
|
<if test="status != null and status != ''">#{status},</if>
|
|
<if test="stockoutSource != null">#{stockoutSource},</if>
|
|
<if test="warehouseId != null">#{warehouseId},</if>
|
|
<if test="classNowId != null">#{classNowId},</if>
|
|
<if test="exitId != null">#{exitId},</if>
|
|
<if test="carNumber != null">#{carNumber},</if>
|
|
<if test="FID != null">#{FID},</if>
|
|
<if test="erpStockoutId != null">#{erpStockoutId},</if>
|
|
</trim>
|
|
</insert>
|
|
|
|
<update id="updateOutStockout" parameterType="OutStockout">
|
|
update out_stockout
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
<if test="stockoutId != null and stockoutId != ''">stockout_id = #{stockoutId},</if>
|
|
<if test="outType != null and outType != ''">out_type = #{outType},</if>
|
|
<if test="createDate != null and createDate != ''">create_date = #{createDate},</if>
|
|
<if test="departmentNo != null">department_no = #{departmentNo},</if>
|
|
<if test="customerNo != null">customer_no = #{customerNo},</if>
|
|
<if test="createManId != null">create_man_id = #{createManId},</if>
|
|
<if test="status != null and status != ''">status = #{status},</if>
|
|
<if test="stockoutSource != null">stockout_source = #{stockoutSource},</if>
|
|
<if test="warehouseId != null">warehouse_id = #{warehouseId},</if>
|
|
<if test="classNowId != null">class_now_id = #{classNowId},</if>
|
|
<if test="exitId != null">exit_id = #{exitId},</if>
|
|
<if test="carNumber != null">car_number = #{carNumber},</if>
|
|
<if test="FID != null">FID = #{FID},</if>
|
|
<if test="erpStockoutId != null">erp_stockout_id = #{erpStockoutId},</if>
|
|
<if test="startDate != null">start_date = #{startDate},</if>
|
|
<if test="finishDate != null">finish_date = #{finishDate},</if>
|
|
</trim>
|
|
where stockout_guid = #{stockoutGuid}
|
|
</update>
|
|
|
|
<delete id="deleteOutStockoutByStockoutGuid" parameterType="String">
|
|
delete from out_stockout where stockout_guid = #{stockoutGuid}
|
|
</delete>
|
|
|
|
<delete id="deleteOutStockoutByStockoutGuids" parameterType="String">
|
|
delete from out_stockout where stockout_guid in
|
|
<foreach item="stockoutGuid" collection="array" open="(" separator="," close=")">
|
|
#{stockoutGuid}
|
|
</foreach>
|
|
</delete>
|
|
|
|
<select id="updateOutStockoutStatus" parameterType="java.util.Map" statementType="CALLABLE">
|
|
{
|
|
call proc_update_outbill_status(
|
|
#{outStockId,mode=IN,jdbcType=VARCHAR},
|
|
#{status,mode=IN,jdbcType=VARCHAR},
|
|
#{newStatus,mode=IN,jdbcType=VARCHAR},
|
|
#{exitId,mode=IN,jdbcType=VARCHAR},
|
|
#{v_result,mode=OUT,jdbcType=VARCHAR},
|
|
#{v_resultString,mode=OUT,jdbcType=VARCHAR}
|
|
)
|
|
}
|
|
</select>
|
|
<select id="autoAllot" parameterType="java.util.Map" statementType="CALLABLE">
|
|
{
|
|
call proc_out_auto_allocation(
|
|
#{v_stockout_detail_id,mode=IN,jdbcType=VARCHAR},
|
|
#{v_result,mode=OUT,jdbcType=VARCHAR},
|
|
#{v_resultString,mode=OUT,jdbcType=VARCHAR}
|
|
)
|
|
}
|
|
</select>
|
|
|
|
<select id="manualAllot" parameterType="java.util.Map" statementType="CALLABLE">
|
|
{
|
|
call proc_out_hand_allocation(
|
|
#{v_stockout_detail_id,mode=IN,jdbcType=VARCHAR},
|
|
#{v_stock_id,mode=IN,jdbcType=VARCHAR},
|
|
#{v_result,mode=OUT,jdbcType=VARCHAR},
|
|
#{v_resultString,mode=OUT,jdbcType=VARCHAR}
|
|
)
|
|
}
|
|
</select>
|
|
<select id="selectOutStockoutByStockoutId" resultMap="OutStockoutResult">
|
|
select distinct o.stockout_guid,
|
|
o.stockout_id,
|
|
o.out_type,
|
|
o.create_date,
|
|
o.department_no,
|
|
o.customer_no,
|
|
o.create_man_id,
|
|
o.status,
|
|
o.stockout_source,
|
|
o.warehouse_id,
|
|
o.class_now_id,
|
|
o.exit_id,
|
|
o.car_number,
|
|
o.FID,
|
|
o.erp_stockout_id,
|
|
o.start_date,
|
|
o.finish_date,
|
|
bw.warehouse_name,
|
|
bc.customer_name
|
|
from out_stockout o
|
|
left join bas_warehouse bw on bw.warehouse_id = o.warehouse_id
|
|
left join bas_customer bc on bc.customer_no = o.customer_no
|
|
left join out_stockout_detail d on d.stockout_id = o.stockout_id
|
|
left join bas_product bp on bp.product_id = d.product_id
|
|
where o.stockout_id = #{stockoutId}
|
|
</select>
|
|
</mapper>
|