万材erp项目
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

229 lines
14 KiB

<?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.stock.mapper.WarehousingRecordMapper">
<resultMap type="WarehousingRecord" id="WarehousingRecordResult">
<result property="warehousingrecordNo" column="warehousingRecord_no"/>
<result property="customerId" column="customer_id"/>
<result property="customerName" column="customer_name"/>
<result property="warehousingType" column="warehousing_type"/>
<result property="warehousingrecordDate" column="warehousingRecord_date"/>
<result property="purchaseorderNo" column="purchaseOrder_no"/>
<result property="workorderNo" column="workOrder_no"/>
<result property="domesticOrExport" column="domesticOrExport"/>
<result property="warehouseNo" column="warehouse_NO"/>
<result property="warehouseName" column="warehouse_name"/>
<result property="warehousingAmt" column="warehousing_amt"/>
<result property="itemNo" column="item_NO"/>
<result property="itemName" column="item_name"/>
<result property="itemTimes" column="itemTimes"/>
<result property="specificationModel" column="specificationModel"/>
<result property="machineType" column="machineType"/>
<result property="unit" column="unit"/>
<result property="spell1" column="spell_1"/>
<result property="spell2" column="spell_2"/>
<result property="spell3" column="spell_3"/>
<result property="salesReturnNo" column="salesReturnNo"/>
<result property="outsourceNo" column="outsourceNo"/>
<result property="remark" column="remark"/>
<result property="surplusQty" column="surplusQty"/>
<result property="cancelStockNo" column="cancelStockNo"/>
<result property="depositPosition" column="depositPosition"/>
</resultMap>
<sql id="selectWarehousingRecordVo">
select warehousingRecord_no, customer_id, customer_name, warehousing_type, warehousingRecord_date, purchaseOrder_no, workOrder_no, domesticOrExport, warehouse_NO, warehouse_name, warehousing_amt, item_NO, item_name, itemTimes, specificationModel, machineType, unit, spell_1, spell_2, spell_3,salesReturnNo,outsourceNo,remark,surplusQty,cancelStockNo,depositPosition from warehousing_record
</sql>
<select id="selectWarehousingRecordList" parameterType="WarehousingRecord" resultMap="WarehousingRecordResult">
<include refid="selectWarehousingRecordVo"/>
<where>
<if test="warehousingrecordNo != null and warehousingrecordNo != ''">and warehousingRecord_no like
concat('%', #{warehousingrecordNo}, '%')
</if>
<if test="customerId != null and customerId != ''">and customer_id like concat('%', #{customerId}, '%')
</if>
<if test="customerName != null and customerName != ''">and customer_name like concat('%', #{customerName},
'%')
</if>
<if test="warehousingType != null and warehousingType != ''">and warehousing_type = #{warehousingType}</if>
<!-- <if test="warehousingrecordDate != null "> and warehousingRecord_date = #{warehousingrecordDate}</if>-->
<if test="params.beginWarehousingrecordDate != null and params.beginWarehousingrecordDate !=''">and
warehousingRecord_date >= #{params.beginWarehousingrecordDate}
</if>
<if test="params.endWarehousingrecordDate != null and params.endWarehousingrecordDate != ''">and
#{params.endWarehousingrecordDate} >= warehousingRecord_date
</if>
<if test="purchaseorderNo != null and purchaseorderNo != ''">and purchaseOrder_no like concat('%',
#{purchaseorderNo}, '%')
</if>
<if test="workorderNo != null and workorderNo != ''">and workOrder_no like concat('%', #{workorderNo},
'%')
</if>
<if test="domesticOrExport != null and domesticOrExport != ''">and domesticOrExport = #{domesticOrExport}
</if>
<if test="warehouseNo != null and warehouseNo != ''">and warehouse_NO like concat('%', #{warehouseNo},
'%')
</if>
<if test="warehouseName != null and warehouseName != ''">and warehouse_name like concat('%',
#{warehouseName}, '%')
</if>
<if test="warehousingAmt != null and warehousingAmt != ''">and warehousing_amt = #{warehousingAmt}</if>
<if test="itemNo != null and itemNo != ''">and item_NO like concat('%', #{itemNo}, '%')</if>
<if test="itemName != null and itemName != ''">and item_name like concat('%', #{itemName}, '%')</if>
<if test="itemTimes != null and itemTimes != ''">and itemTimes = #{itemTimes}</if>
<if test="specificationModel != null and specificationModel != ''">and specificationModel like concat('%',
#{specificationModel}, '%')
</if>
<if test="machineType != null and machineType != ''">and machineType like concat('%', #{machineType},
'%')
</if>
<if test="unit != null and unit != ''">and unit like concat('%', #{unit}, '%')</if>
<if test="spell1 != null and spell1 != ''">and spell_1 like concat('%', #{spell1}, '%')</if>
<if test="spell2 != null and spell2 != ''">and spell_2 like concat('%', #{spell2}, '%')</if>
<if test="spell3 != null and spell3 != ''">and spell_3 like concat('%', #{spell3}, '%')</if>
<if test="salesReturnNo != null and salesReturnNo != ''">and salesReturnNo like concat('%',
#{salesReturnNo}, '%')
</if>
<if test="outsourceNo != null and outsourceNo != ''">and outsourceNo like concat('%', #{outsourceNo},
'%')
</if>
<if test="remark != null and remark != ''">and remark like concat('%', #{remark}, '%')</if>
<if test="cancelStockNo != null and cancelStockNo != ''">and cancelStockNo like concat('%', #{cancelStockNo}, '%')</if>
<if test="depositPosition != null and depositPosition != ''">and depositPosition like concat('%', #{depositPosition}, '%')</if>
</where>
order by warehousingRecord_date desc
</select>
<select id="selectWarehousingRecordById" parameterType="String" resultMap="WarehousingRecordResult">
<include refid="selectWarehousingRecordVo"/>
where warehousingRecord_no = #{warehousingrecordNo}
</select>
<insert id="insertWarehousingRecord" parameterType="WarehousingRecord">
insert into warehousing_record
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="warehousingrecordNo != null">warehousingRecord_no,</if>
<if test="customerId != null">customer_id,</if>
<if test="customerName != null">customer_name,</if>
<if test="warehousingType != null">warehousing_type,</if>
<if test="warehousingrecordDate != null">warehousingRecord_date,</if>
<if test="purchaseorderNo != null">purchaseOrder_no,</if>
<if test="workorderNo != null">workOrder_no,</if>
<if test="domesticOrExport != null">domesticOrExport,</if>
<if test="warehouseNo != null">warehouse_NO,</if>
<if test="warehouseName != null">warehouse_name,</if>
<if test="warehousingAmt != null">warehousing_amt,</if>
<if test="itemNo != null">item_NO,</if>
<if test="itemName != null">item_name,</if>
<if test="itemTimes != null">itemTimes,</if>
<if test="specificationModel != null">specificationModel,</if>
<if test="machineType != null">machineType,</if>
<if test="unit != null">unit,</if>
<if test="spell1 != null">spell_1,</if>
<if test="spell2 != null">spell_2,</if>
<if test="spell3 != null">spell_3,</if>
<if test="salesReturnNo != null">salesReturnNo,</if>
<if test="outsourceNo != null">outsourceNo,</if>
<if test="remark != null">remark,</if>
<if test="surplusQty != null">surplusQty,</if>
<if test="cancelStockNo != null">cancelStockNo,</if>
<if test="depositPosition != null">depositPosition,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="warehousingrecordNo != null">#{warehousingrecordNo},</if>
<if test="customerId != null">#{customerId},</if>
<if test="customerName != null">#{customerName},</if>
<if test="warehousingType != null">#{warehousingType},</if>
<if test="warehousingrecordDate != null">#{warehousingrecordDate},</if>
<if test="purchaseorderNo != null">#{purchaseorderNo},</if>
<if test="workorderNo != null">#{workorderNo},</if>
<if test="domesticOrExport != null">#{domesticOrExport},</if>
<if test="warehouseNo != null">#{warehouseNo},</if>
<if test="warehouseName != null">#{warehouseName},</if>
<if test="warehousingAmt != null">#{warehousingAmt},</if>
<if test="itemNo != null">#{itemNo},</if>
<if test="itemName != null">#{itemName},</if>
<if test="itemTimes != null">#{itemTimes},</if>
<if test="specificationModel != null">#{specificationModel},</if>
<if test="machineType != null">#{machineType},</if>
<if test="unit != null">#{unit},</if>
<if test="spell1 != null">#{spell1},</if>
<if test="spell2 != null">#{spell2},</if>
<if test="spell3 != null">#{spell3},</if>
<if test="salesReturnNo != null">#{salesReturnNo},</if>
<if test="outsourceNo != null">#{outsourceNo},</if>
<if test="remark != null">#{remark},</if>
<if test="surplusQty != null">#{surplusQty},</if>
<if test="cancelStockNo != null">#{cancelStockNo},</if>
<if test="depositPosition != null">#{depositPosition},</if>
</trim>
</insert>
<update id="updateWarehousingRecord" parameterType="WarehousingRecord">
update warehousing_record
<trim prefix="SET" suffixOverrides=",">
<if test="customerId != null">customer_id = #{customerId},</if>
<if test="customerName != null">customer_name = #{customerName},</if>
<if test="warehousingType != null">warehousing_type = #{warehousingType},</if>
<if test="warehousingrecordDate != null">warehousingRecord_date = #{warehousingrecordDate},</if>
<if test="purchaseorderNo != null">purchaseOrder_no = #{purchaseorderNo},</if>
<if test="workorderNo != null">workOrder_no = #{workorderNo},</if>
<if test="domesticOrExport != null">domesticOrExport = #{domesticOrExport},</if>
<if test="warehouseNo != null">warehouse_NO = #{warehouseNo},</if>
<if test="warehouseName != null">warehouse_name = #{warehouseName},</if>
<if test="warehousingAmt != null">warehousing_amt = #{warehousingAmt},</if>
<if test="itemNo != null">item_NO = #{itemNo},</if>
<if test="itemName != null">item_name = #{itemName},</if>
<if test="itemTimes != null">itemTimes = #{itemTimes},</if>
<if test="specificationModel != null">specificationModel = #{specificationModel},</if>
<if test="machineType != null">machineType = #{machineType},</if>
<if test="unit != null">unit = #{unit},</if>
<if test="spell1 != null and spell1 != ''">spell_1 = #{spell1},</if>
<if test="spell2 != null and spell2 != ''">spell_2 = #{spell2},</if>
<if test="spell3 != null and spell3 != ''">spell_3 = #{spell3},</if>
<if test="salesReturnNo != null and salesReturnNo != ''">salesReturnNo = #{salesReturnNo}</if>
<if test="outsourceNo != null and outsourceNo != ''">outsourceNo = #{outsourceNo}</if>
<if test="remark != null and remark != ''">remark = #{remark},</if>
<if test="surplusQty != null and surplusQty != ''">surplusQty = #{surplusQty},</if>
<if test="cancelStockNo != null and cancelStockNo != ''">cancelStockNo = #{cancelStockNo},</if>
<if test="depositPosition != null and depositPosition != ''">depositPosition = #{depositPosition},</if>
</trim>
where warehousingRecord_no = #{warehousingrecordNo}
</update>
<delete id="deleteWarehousingRecordById" parameterType="String">
delete from warehousing_record where warehousingRecord_no = #{warehousingrecordNo}
</delete>
<delete id="deleteWarehousingRecordByIds" parameterType="String">
delete from warehousing_record where warehousingRecord_no in
<foreach item="warehousingrecordNo" collection="array" open="(" separator="," close=")">
#{warehousingrecordNo}
</foreach>
</delete>
<select id="selectCountByDay" resultType="Integer">
select count(*) from warehousing_record where to_days(warehousingRecord_date) = to_days(now());
</select>
<select id="selectCountByBatchNum" resultType="Integer">
select count(*) from warehousing_record
<where>
<if test="purchaseorderNo!=null and purchaseorderNo!=''">and purchaseOrder_no=#{purchaseorderNo}</if>
<if test="workorderNo!=null and workorderNo!=''">and workOrder_no=#{workorderNo}</if>
<if test="itemNo!=null and itemNo!=''">and item_NO=#{itemNo}</if>
</where>
</select>
<select id="selectRecentlyRecord" resultMap="WarehousingRecordResult">
SELECT * FROM warehousing_record WHERE item_NO=#{itemNo} AND surplusQty>0 ORDER BY warehousingRecord_date LIMIT 0,1
</select>
<update id="updateSurplusQty" parameterType="WarehousingRecord">
update warehousing_record set surplusQty = surplusQty-#{surplusQty} WHERE warehousingRecord_no=#{warehousingrecordNo}
</update>
</mapper>