万材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.

241 lines
18 KiB

2 years ago
<?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.WarehousingNoticeMapper">
<resultMap type="WarehousingNotice" id="WarehousingNoticeResult">
<result property="warehousingnoticeNo" column="warehousingNotice_no" />
<result property="customerId" column="customer_id" />
<result property="customerName" column="customer_name" />
<result property="warehousingType" column="warehousing_type" />
<result property="warehousingnoticeDate" column="warehousingNotice_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="outworkorderNo" column="outWorkOrder_no" />
<result property="spare1" column="spare_1" />
<result property="spare2" column="spare_2" />
<result property="spare3" column="spare_3" />
</resultMap>
<resultMap id="WarehousingNoticeWarehousingCheckResult" type="WarehousingNotice" extends="WarehousingNoticeResult">
<collection property="warehousingCheckList" notNullColumn="sub_warehousingCheck_id" javaType="java.util.List" resultMap="WarehousingCheckResult" />
</resultMap>
<resultMap type="WarehousingCheck" id="WarehousingCheckResult">
<result property="warehousingcheckId" column="sub_warehousingCheck_id" />
<result property="warehousingnoticeId" column="sub_warehousingNotice_id" />
<result property="materialCode" column="sub_material_Code" />
<result property="materialName" column="sub_material_name" />
<result property="specificationModel" column="sub_specificationModel" />
<result property="machineType" column="sub_machineType" />
<result property="unit" column="sub_unit" />
<result property="orderAmt" column="sub_order_amt" />
<result property="qualifiedAmt" column="sub_qualified_amt" />
<result property="unqualifiedAmt" column="sub_unqualified_amt" />
<result property="qualifiedRate" column="sub_qualifiedRate" />
<result property="note" column="sub_note" />
<result property="batchNumber" column="sub_batchNumber" />
<result property="notcieTime" column="sub_notcieTime" />
<result property="checkTime" column="sub_checkTime" />
<result property="isQualified" column="sub_isQualified" />
<result property="inspector" column="sub_inspector" />
<result property="spell1" column="sub_spell_1" />
<result property="spell2" column="sub_spell_2" />
<result property="spell3" column="sub_spell_3" />
</resultMap>
<sql id="selectWarehousingNoticeVo">
select warehousingNotice_no, customer_id, customer_name, warehousing_type, warehousingNotice_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, outWorkOrder_no, spare_1, spare_2, spare_3 from warehousing_notice
</sql>
<select id="selectWarehousingNoticeList" parameterType="WarehousingNotice" resultMap="WarehousingNoticeResult">
<include refid="selectWarehousingNoticeVo"/>
<where>
<if test="warehousingnoticeNo != null and warehousingnoticeNo != ''"> and warehousingNotice_no like concat('%', #{warehousingnoticeNo}, '%')</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="params.beginWarehousingnoticeDate != null and params.beginWarehousingnoticeDate != '' and params.endWarehousingnoticeDate != null and params.endWarehousingnoticeDate != ''"> and warehousingNotice_date between #{params.beginWarehousingnoticeDate} and #{params.endWarehousingnoticeDate}</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 = #{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 = #{spell1}</if>
<if test="spell2 != null and spell2 != ''"> and spell_2 = #{spell2}</if>
<if test="spell3 != null and spell3 != ''"> and spell_3 = #{spell3}</if>
<if test="outworkorderNo != null and outworkorderNo != ''"> and outWorkOrder_no = #{outworkorderNo}</if>
<if test="spare1 != null and spare1 != ''"> and spare_1 = #{spare1}</if>
<if test="spare2 != null and spare2 != ''"> and spare_2 = #{spare2}</if>
<if test="spare3 != null and spare3 != ''"> and spare_3 = #{spare3}</if>
</where>
</select>
<select id="selectWarehousingNoticeById" parameterType="String" resultMap="WarehousingNoticeWarehousingCheckResult">
select a.warehousingNotice_no, a.customer_id, a.customer_name, a.warehousing_type, a.warehousingNotice_date, a.purchaseOrder_no, a.workOrder_no, a.domesticOrExport, a.warehouse_NO, a.warehouse_name, a.warehousing_amt, a.item_NO, a.item_name, a.itemTimes, a.specificationModel, a.machineType, a.unit, a.spell_1, a.spell_2, a.spell_3, a.outWorkOrder_no, a.spare_1, a.spare_2, a.spare_3,
b.warehousingCheck_id as sub_warehousingCheck_id, b.warehousingNotice_id as sub_warehousingNotice_id, b.material_Code as sub_material_Code, b.material_name as sub_material_name, b.specificationModel as sub_specificationModel, b.machineType as sub_machineType, b.unit as sub_unit, b.order_amt as sub_order_amt, b.qualified_amt as sub_qualified_amt, b.unqualified_amt as sub_unqualified_amt, b.qualifiedRate as sub_qualifiedRate, b.note as sub_note, b.batchNumber as sub_batchNumber, b.notcieTime as sub_notcieTime, b.checkTime as sub_checkTime, b.isQualified as sub_isQualified, b.inspector as sub_inspector, b.spell_1 as sub_spell_1, b.spell_2 as sub_spell_2, b.spell_3 as sub_spell_3
from warehousing_notice a
left join warehousing_check b on b.warehousingNotice_id = a.warehousingNotice_no
where a.warehousingNotice_no = #{warehousingnoticeNo}
</select>
<!-- 获取本日的通知添加次数,用于生成入库通知单编号。-->
<select id="selectTodayWarehousingNoticedTimes" parameterType="String" resultType="String">
select COUNT(*)+1
from warehousing_notice
where warehousingNotice_No like CONCAT("WNNO", date_format(now(), '%Y%m%d'), "%");
</select>
<!-- 获取该条采购订单/制工单的入库通知次数以获得批号(项次?)。-->
<!-- +1是为了直接获取到正确的次数而不用对String型进行转换-->
<select id="selectOrderNoticedTimes" parameterType="String" resultType="String">
select count(*)+1
from warehousing_notice
where
<!-- <if test="purchaseOrderno= null">#{purchaseOrderNo}</if>-->
<!-- <if test="workOrderno= null">#{workOrderNo}</if>-->
purchaseOrder_no = #{purchaseOrderNo}
or workOrder_no = #{workOrderNo}
</select>
<insert id="insertWarehousingNotice" parameterType="WarehousingNotice">
insert into warehousing_notice
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="warehousingnoticeNo != null">warehousingNotice_no,</if>
<if test="customerId != null and customerId != ''">customer_id,</if>
<if test="customerName != null and customerName != ''">customer_name,</if>
<if test="warehousingType != null and warehousingType != ''">warehousing_type,</if>
<if test="warehousingnoticeDate != null">warehousingNotice_date,</if>
<if test="purchaseorderNo != null">purchaseOrder_no,</if>
<if test="workorderNo != null">workOrder_no,</if>
<if test="domesticOrExport != null and domesticOrExport != ''">domesticOrExport,</if>
<if test="warehouseNo != null and warehouseNo != ''">warehouse_NO,</if>
<if test="warehouseName != null and warehouseName != ''">warehouse_name,</if>
<if test="warehousingAmt != null and warehousingAmt != ''">warehousing_amt,</if>
<if test="itemNo != null and itemNo != ''">item_NO,</if>
<if test="itemName != null and itemName != ''">item_name,</if>
<if test="itemTimes != null and itemTimes != ''">itemTimes,</if>
<if test="specificationModel != null and specificationModel != ''">specificationModel,</if>
<if test="machineType != null and machineType != ''">machineType,</if>
<if test="unit != null and unit != ''">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="outworkorderNo != null">outWorkOrder_no,</if>
<if test="spare1 != null">spare_1,</if>
<if test="spare2 != null">spare_2,</if>
<if test="spare3 != null">spare_3,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="warehousingnoticeNo != null">#{warehousingnoticeNo},</if>
<if test="customerId != null and customerId != ''">#{customerId},</if>
<if test="customerName != null and customerName != ''">#{customerName},</if>
<if test="warehousingType != null and warehousingType != ''">#{warehousingType},</if>
<if test="warehousingnoticeDate != null">#{warehousingnoticeDate},</if>
<if test="purchaseorderNo != null">#{purchaseorderNo},</if>
<if test="workorderNo != null">#{workorderNo},</if>
<if test="domesticOrExport != null and domesticOrExport != ''">#{domesticOrExport},</if>
<if test="warehouseNo != null and warehouseNo != ''">#{warehouseNo},</if>
<if test="warehouseName != null and warehouseName != ''">#{warehouseName},</if>
<if test="warehousingAmt != null and warehousingAmt != ''">#{warehousingAmt},</if>
<if test="itemNo != null and itemNo != ''">#{itemNo},</if>
<if test="itemName != null and itemName != ''">#{itemName},</if>
<if test="itemTimes != null and itemTimes != ''">#{itemTimes},</if>
<if test="specificationModel != null and specificationModel != ''">#{specificationModel},</if>
<if test="machineType != null and machineType != ''">#{machineType},</if>
<if test="unit != null and unit != ''">#{unit},</if>
<if test="spell1 != null">#{spell1},</if>
<if test="spell2 != null">#{spell2},</if>
<if test="spell3 != null">#{spell3},</if>
<if test="outworkorderNo != null">#{outworkorderNo},</if>
<if test="spare1 != null">#{spare1},</if>
<if test="spare2 != null">#{spare2},</if>
<if test="spare3 != null">#{spare3},</if>
</trim>
</insert>
<update id="updateWarehousingNotice" parameterType="WarehousingNotice">
update warehousing_notice
<trim prefix="SET" suffixOverrides=",">
<if test="customerId != null and customerId != ''">customer_id = #{customerId},</if>
<if test="customerName != null and customerName != ''">customer_name = #{customerName},</if>
<if test="warehousingType != null and warehousingType != ''">warehousing_type = #{warehousingType},</if>
<if test="warehousingnoticeDate != null">warehousingNotice_date = #{warehousingnoticeDate},</if>
<if test="purchaseorderNo != null">purchaseOrder_no = #{purchaseorderNo},</if>
<if test="workorderNo != null">workOrder_no = #{workorderNo},</if>
<if test="domesticOrExport != null and domesticOrExport != ''">domesticOrExport = #{domesticOrExport},</if>
<if test="warehouseNo != null and warehouseNo != ''">warehouse_NO = #{warehouseNo},</if>
<if test="warehouseName != null and warehouseName != ''">warehouse_name = #{warehouseName},</if>
<if test="warehousingAmt != null and warehousingAmt != ''">warehousing_amt = #{warehousingAmt},</if>
<if test="itemNo != null and itemNo != ''">item_NO = #{itemNo},</if>
<if test="itemName != null and itemName != ''">item_name = #{itemName},</if>
<if test="itemTimes != null and itemTimes != ''">itemTimes = #{itemTimes},</if>
<if test="specificationModel != null and specificationModel != ''">specificationModel = #{specificationModel},</if>
<if test="machineType != null and machineType != ''">machineType = #{machineType},</if>
<if test="unit != null and unit != ''">unit = #{unit},</if>
<if test="spell1 != null">spell_1 = #{spell1},</if>
<if test="spell2 != null">spell_2 = #{spell2},</if>
<if test="spell3 != null">spell_3 = #{spell3},</if>
<if test="outworkorderNo != null">outWorkOrder_no = #{outworkorderNo},</if>
<if test="spare1 != null">spare_1 = #{spare1},</if>
<if test="spare2 != null">spare_2 = #{spare2},</if>
<if test="spare3 != null">spare_3 = #{spare3},</if>
</trim>
where warehousingNotice_no = #{warehousingnoticeNo}
</update>
<delete id="deleteWarehousingNoticeById" parameterType="String">
delete from warehousing_notice where warehousingNotice_no = #{warehousingnoticeNo}
</delete>
<delete id="deleteWarehousingNoticeByIds" parameterType="String">
delete from warehousing_notice where warehousingNotice_no in
<foreach item="warehousingnoticeNo" collection="array" open="(" separator="," close=")">
#{warehousingnoticeNo}
</foreach>
</delete>
<delete id="deleteWarehousingCheckByWarehousingnoticeIds" parameterType="String">
delete from warehousing_check where warehousingNotice_id in
<foreach item="warehousingnoticeId" collection="array" open="(" separator="," close=")">
#{warehousingnoticeId}
</foreach>
</delete>
<delete id="deleteWarehousingCheckByWarehousingnoticeId" parameterType="Long">
delete from warehousing_check where warehousingNotice_id = #{warehousingnoticeId}
</delete>
<insert id="batchWarehousingCheck">
insert into warehousing_check( warehousingCheck_id, warehousingNotice_id, material_Code, material_name, specificationModel, machineType, unit, order_amt, qualified_amt, unqualified_amt, qualifiedRate, note, batchNumber, notcieTime, checkTime, isQualified, inspector, spell_1, spell_2, spell_3) values
<foreach item="item" index="index" collection="list" separator=",">
( #{item.warehousingcheckId}, #{item.warehousingnoticeId}, #{item.materialCode}, #{item.materialName}, #{item.specificationModel}, #{item.machineType}, #{item.unit}, #{item.orderAmt}, #{item.qualifiedAmt}, #{item.unqualifiedAmt}, #{item.qualifiedRate}, #{item.note}, #{item.batchNumber}, #{item.notcieTime}, #{item.checkTime}, #{item.isQualified}, #{item.inspector}, #{item.spell1}, #{item.spell2}, #{item.spell3})
</foreach>
</insert>
</mapper>