|
|
@@ -5,24 +5,24 @@
|
|
|
<!-- 查询收货单 -->
|
|
|
<select id="getReceiveGoods" resultType="com.tld.model.ReceiveGoods">
|
|
|
select
|
|
|
- a.id,
|
|
|
- a.order_code,
|
|
|
- b.name as materialName,
|
|
|
- c.name as supplierName,
|
|
|
- a.purchase_num,
|
|
|
- a.arrival_num,
|
|
|
- a.type,
|
|
|
- a.qualified_num,
|
|
|
- a.disqualification_num,
|
|
|
- a.arrival_time,
|
|
|
- c.code as wllbCode
|
|
|
+ a.id,
|
|
|
+ a.order_code,
|
|
|
+ b.name as materialName,
|
|
|
+ c.name as supplierName,
|
|
|
+ a.purchase_num,
|
|
|
+ a.arrival_num,
|
|
|
+ a.type,
|
|
|
+ a.qualified_num,
|
|
|
+ a.disqualification_num,
|
|
|
+ a.arrival_time,
|
|
|
+ c.code as wllbCode
|
|
|
from tld_receive_goods a
|
|
|
left join tld_material b on a.material_id = b.tld_id
|
|
|
left join tld_customer c on a.supplier_id = c.code
|
|
|
<trim prefix="WHERE" prefixOverrides="and |or">
|
|
|
-<!-- <if test="materialId != null and materialId != ''">-->
|
|
|
-<!-- and a.material_id = #{materialId}-->
|
|
|
-<!-- </if>-->
|
|
|
+ <!-- <if test="materialId != null and materialId != ''">-->
|
|
|
+ <!-- and a.material_id = #{materialId}-->
|
|
|
+ <!-- </if>-->
|
|
|
<if test="type != null and type != ''">
|
|
|
and a.type = #{type}
|
|
|
</if>
|
|
|
@@ -36,21 +36,21 @@
|
|
|
and a.order_code = #{orderCode}
|
|
|
</if>
|
|
|
</trim>
|
|
|
- order by a.id desc
|
|
|
+ order by a.id desc
|
|
|
</select>
|
|
|
<!-- 查询超时采购单 -->
|
|
|
<select id="getPastReceiveGoods" resultType="com.tld.model.ReceiveGoods">
|
|
|
select
|
|
|
- a.id,
|
|
|
- a.order_code,
|
|
|
- b.name as materialName,
|
|
|
- c.name as supplierName,
|
|
|
- a.purchase_num,
|
|
|
- a.arrival_num,
|
|
|
- a.type,
|
|
|
- a.qualified_num,
|
|
|
- a.disqualification_num,
|
|
|
- a.arrival_time
|
|
|
+ a.id,
|
|
|
+ a.order_code,
|
|
|
+ b.name as materialName,
|
|
|
+ c.name as supplierName,
|
|
|
+ a.purchase_num,
|
|
|
+ a.arrival_num,
|
|
|
+ a.type,
|
|
|
+ a.qualified_num,
|
|
|
+ a.disqualification_num,
|
|
|
+ a.arrival_time
|
|
|
from tld_receive_goods a
|
|
|
left join tld_material b on a.material_id = b.tld_id
|
|
|
left join tld_customer c on a.supplier_id = c.code
|
|
|
@@ -62,17 +62,24 @@
|
|
|
</select>
|
|
|
<!-- 查询采购父表是否有次采购单的数据 -->
|
|
|
<select id="getReceiveGoodsf" resultType="int">
|
|
|
- select count(*) from tld_receive_goods_f where order_code = #{orderCode}
|
|
|
+ select count(*)
|
|
|
+ from tld_receive_goods_f
|
|
|
+ where order_code = #{orderCode}
|
|
|
</select>
|
|
|
<!-- 新增采购单信息 -->
|
|
|
<insert id="addReceiveGoods">
|
|
|
- insert into tld_receive_goods(order_code,material_id,purchase_num,arrival_num,type,qualified_num,disqualification_num,wbs,arrival_time,measurement_id,supplier_id,entry_number,warehousing_num)
|
|
|
- values(#{orderCode},#{materialId},#{purchaseNum},#{arrivalNum},#{type},#{qualifiedNum},#{disqualificationNum},#{wbs},#{arrivalTime},#{measurementId},#{supplierId},#{entryNumber},'0');
|
|
|
+ insert into tld_receive_goods(order_code, material_id, purchase_num, arrival_num, type, qualified_num,
|
|
|
+ disqualification_num, wbs, arrival_time, measurement_id, supplier_id,
|
|
|
+ entry_number, warehousing_num)
|
|
|
+ values (#{orderCode}, #{materialId}, #{purchaseNum}, #{arrivalNum}, #{type}, #{qualifiedNum},
|
|
|
+ #{disqualificationNum}, #{wbs}, #{arrivalTime}, #{measurementId}, #{supplierId}, #{entryNumber}, '0');
|
|
|
</insert>
|
|
|
<!-- 新增采购单信息 -->
|
|
|
<insert id="addReceiveGoodsf">
|
|
|
- insert into tld_receive_goods_f(order_number,order_code,company_number,supplier_id,arrival_time,order_type,source_type,move_type)
|
|
|
- values(#{orderNumber},#{orderCode},#{companyNumber},#{supplierId},#{arrivalTime},#{orderType},#{sourceType},#{moveType})
|
|
|
+ insert into tld_receive_goods_f(order_number, order_code, company_number, supplier_id, arrival_time, order_type,
|
|
|
+ source_type, move_type)
|
|
|
+ values (#{orderNumber}, #{orderCode}, #{companyNumber}, #{supplierId}, #{arrivalTime}, #{orderType},
|
|
|
+ #{sourceType}, #{moveType})
|
|
|
</insert>
|
|
|
<!-- 修改采购单信息 -->
|
|
|
<update id="updateReceiveGoods">
|
|
|
@@ -121,8 +128,12 @@
|
|
|
</update>
|
|
|
<!-- 采购单日志 -->
|
|
|
<insert id="addReceiveGoodsLog" keyProperty="id" useGeneratedKeys="true">
|
|
|
- insert into tld_receive_goods_log(order_number, order_code, company_number, supplier_id, arrival_time, order_type, source_type, move_type, material_id, purchase_num, arrival_num, qualified_num, disqualification_num, wbs, measurement_id)
|
|
|
- values (#{orderNumber}, #{orderCode}, #{companyNumber}, #{supplierId}, #{arrivalTime}, #{orderType}, #{sourceType}, #{moveType}, #{materialId}, #{purchaseNum}, #{arrivalNum}, #{qualifiedNum}, #{disqualificationNum}, #{wbs}, #{measurementId})
|
|
|
+ insert into tld_receive_goods_log(order_number, order_code, company_number, supplier_id, arrival_time,
|
|
|
+ order_type, source_type, move_type, material_id, purchase_num, arrival_num,
|
|
|
+ qualified_num, disqualification_num, wbs, measurement_id)
|
|
|
+ values (#{orderNumber}, #{orderCode}, #{companyNumber}, #{supplierId}, #{arrivalTime}, #{orderType},
|
|
|
+ #{sourceType}, #{moveType}, #{materialId}, #{purchaseNum}, #{arrivalNum}, #{qualifiedNum},
|
|
|
+ #{disqualificationNum}, #{wbs}, #{measurementId})
|
|
|
</insert>
|
|
|
<!-- 新增采购到料大屏信息 -->
|
|
|
<insert id="addPurchase">
|
|
|
@@ -134,28 +145,39 @@
|
|
|
</insert>
|
|
|
<!-- 修改采购到料状态 -->
|
|
|
<update id="updatePurchaseType">
|
|
|
- update tld_purchase set type = '1' where order_code = #{orderCode}
|
|
|
+ update tld_purchase
|
|
|
+ set type = '1'
|
|
|
+ where order_code = #{orderCode}
|
|
|
</update>
|
|
|
<!-- 查询采购单 -->
|
|
|
<select id="getPurchase" resultType="com.tld.model.ReceiveGoods">
|
|
|
select
|
|
|
- a.id,
|
|
|
- a.supplier_id,
|
|
|
- a.order_code,
|
|
|
- a.material_id,
|
|
|
- a.purchase_num,
|
|
|
- a.arrival_num,
|
|
|
- a.arrival_time,
|
|
|
- a.type,
|
|
|
- b.name as materialName,
|
|
|
- b.code as wllbCode,
|
|
|
- c.name as supplierName
|
|
|
+ a.id,
|
|
|
+ a.supplier_id,
|
|
|
+ a.order_code,
|
|
|
+ a.material_id,
|
|
|
+ a.purchase_num,
|
|
|
+ a.arrival_num,
|
|
|
+ a.arrival_time,
|
|
|
+ a.type,
|
|
|
+ b.name as materialName,
|
|
|
+ b.code as wllbCode,
|
|
|
+ c.name as supplierName
|
|
|
from tld_purchase a
|
|
|
left join tld_material b on a.material_id = b.tld_id
|
|
|
left join tld_customer c on a.supplier_id = c.code
|
|
|
<trim prefix="WHERE" prefixOverrides="and |or">
|
|
|
<if test="orderCode != null and orderCode != ''">
|
|
|
- and a.order_code = #{orderCode}
|
|
|
+ and a.order_code like CONCAT(CONCAT('%', #{orderCode}), '%')
|
|
|
+ </if>
|
|
|
+ <if test="supplierId != null and supplierId != ''">
|
|
|
+ and a.supplier_id = #{supplierId}
|
|
|
+ </if>
|
|
|
+ <if test="materialName != null and materialName != ''">
|
|
|
+ and b.name like CONCAT(CONCAT('%', #{materialName}), '%')
|
|
|
+ </if>
|
|
|
+ <if test="wllbCode != null and wllbCode != ''">
|
|
|
+ and b.code like CONCAT(CONCAT('%', #{wllbCode}), '%')
|
|
|
</if>
|
|
|
<if test="startTime != null and startTime != ''">
|
|
|
and a.arrival_time <![CDATA[>=]]> #{startTime}
|
|
|
@@ -164,28 +186,29 @@
|
|
|
and a.arrival_time <![CDATA[<=]]> #{endTime}
|
|
|
</if>
|
|
|
</trim>
|
|
|
+ order by a.id desc
|
|
|
</select>
|
|
|
<!-- 查询超时采购单 -->
|
|
|
<select id="timeoutPurchase" resultType="com.tld.model.ReceiveGoods">
|
|
|
select
|
|
|
- a.id,
|
|
|
- a.supplier_id,
|
|
|
- a.order_code,
|
|
|
- a.material_id,
|
|
|
- a.purchase_num,
|
|
|
- a.arrival_num,
|
|
|
- a.arrival_time,
|
|
|
- a.type,
|
|
|
- b.name as materialName,
|
|
|
- b.code as wllbCode,
|
|
|
- c.name as supplierName
|
|
|
+ a.id,
|
|
|
+ a.supplier_id,
|
|
|
+ a.order_code,
|
|
|
+ a.material_id,
|
|
|
+ a.purchase_num,
|
|
|
+ a.arrival_num,
|
|
|
+ a.arrival_time,
|
|
|
+ a.type,
|
|
|
+ b.name as materialName,
|
|
|
+ b.code as wllbCode,
|
|
|
+ c.name as supplierName
|
|
|
from tld_purchase a
|
|
|
left join tld_material b on a.material_id = b.tld_id
|
|
|
left join tld_customer c on a.supplier_id = c.code
|
|
|
where
|
|
|
- a.arrival_time <![CDATA[<]]> CURDATE() and a.type = '0'
|
|
|
+ a.arrival_time <![CDATA[<]]> CURDATE() and a.type = '0'
|
|
|
<if test="orderCode != null and orderCode != ''">
|
|
|
- and a.order_code = #{orderCode}
|
|
|
+ and a.order_code like CONCAT(CONCAT('%', #{orderCode}), '%')
|
|
|
</if>
|
|
|
<if test="startTime != null and startTime != ''">
|
|
|
and a.arrival_time <![CDATA[>=]]> #{startTime}
|
|
|
@@ -193,13 +216,96 @@
|
|
|
<if test="endTime != null and endTime != ''">
|
|
|
and a.arrival_time <![CDATA[<=]]> #{endTime}
|
|
|
</if>
|
|
|
+ <if test="supplierId != null and supplierId != ''">
|
|
|
+ and a.supplier_id = #{supplierId}
|
|
|
+ </if>
|
|
|
+ <if test="materialName != null and materialName != ''">
|
|
|
+ and b.name like CONCAT(CONCAT('%', #{materialName}), '%')
|
|
|
+ </if>
|
|
|
+ <if test="wllbCode != null and wllbCode != ''">
|
|
|
+ and b.code like CONCAT(CONCAT('%', #{wllbCode}), '%')
|
|
|
+ </if>
|
|
|
+ order by a.id desc
|
|
|
</select>
|
|
|
<!-- 查询 原始记录 -->
|
|
|
<select id="getDelReceiveGoods" resultType="java.util.Map">
|
|
|
- select * from tld_receive_goods where id = #{id}
|
|
|
+ select *
|
|
|
+ from tld_receive_goods
|
|
|
+ where id = #{id}
|
|
|
+ </select>
|
|
|
+ <!--采购单导出-->
|
|
|
+ <select id="purchaseExport" resultType="java.util.LinkedHashMap">
|
|
|
+ select
|
|
|
+ a.supplier_id,
|
|
|
+ b.code as wllbCode,
|
|
|
+ b.name as materialName,
|
|
|
+ c.name as supplierName,
|
|
|
+ a.arrival_num,
|
|
|
+ a.arrival_time
|
|
|
+ from tld_purchase a
|
|
|
+ left join tld_material b on a.material_id = b.tld_id
|
|
|
+ left join tld_customer c on a.supplier_id = c.code
|
|
|
+ <trim prefix="WHERE" prefixOverrides="and |or">
|
|
|
+ <if test="orderCode != null and orderCode != ''">
|
|
|
+ and a.order_code like CONCAT(CONCAT('%', #{orderCode}), '%')
|
|
|
+ </if>
|
|
|
+ <if test="supplierId != null and supplierId != ''">
|
|
|
+ and a.supplier_id = #{supplierId}
|
|
|
+ </if>
|
|
|
+ <if test="materialName != null and materialName != ''">
|
|
|
+ and b.name like CONCAT(CONCAT('%', #{materialName}), '%')
|
|
|
+ </if>
|
|
|
+ <if test="wllbCode != null and wllbCode != ''">
|
|
|
+ and b.code like CONCAT(CONCAT('%', #{wllbCode}), '%')
|
|
|
+ </if>
|
|
|
+ <if test="startTime != null and startTime != ''">
|
|
|
+ and a.arrival_time <![CDATA[>=]]> #{startTime}
|
|
|
+ </if>
|
|
|
+ <if test="endTime != null and endTime != ''">
|
|
|
+ and a.arrival_time <![CDATA[<=]]> #{endTime}
|
|
|
+ </if>
|
|
|
+ </trim>
|
|
|
+ order by a.id desc
|
|
|
+ </select>
|
|
|
+ <!--超时采购单导出-->
|
|
|
+ <select id="overtimePurchaseExport" resultType="java.util.LinkedHashMap">
|
|
|
+ select
|
|
|
+ a.supplier_id,
|
|
|
+ b.code as wllbCode,
|
|
|
+ b.name as materialName,
|
|
|
+ c.name as supplierName,
|
|
|
+ a.arrival_num,
|
|
|
+ a.arrival_time
|
|
|
+ from tld_purchase a
|
|
|
+ left join tld_material b on a.material_id = b.tld_id
|
|
|
+ left join tld_customer c on a.supplier_id = c.code
|
|
|
+ where
|
|
|
+ a.arrival_time <![CDATA[<]]> CURDATE() and a.type = '0'
|
|
|
+ <if test="orderCode != null and orderCode != ''">
|
|
|
+ and a.order_code like CONCAT(CONCAT('%', #{orderCode}), '%')
|
|
|
+ </if>
|
|
|
+ <if test="startTime != null and startTime != ''">
|
|
|
+ and a.arrival_time <![CDATA[>=]]> #{startTime}
|
|
|
+ </if>
|
|
|
+ <if test="endTime != null and endTime != ''">
|
|
|
+ and a.arrival_time <![CDATA[<=]]> #{endTime}
|
|
|
+ </if>
|
|
|
+ <if test="supplierId != null and supplierId != ''">
|
|
|
+ and a.supplier_id = #{supplierId}
|
|
|
+ </if>
|
|
|
+ <if test="materialName != null and materialName != ''">
|
|
|
+ and b.name like CONCAT(CONCAT('%', #{materialName}), '%')
|
|
|
+ </if>
|
|
|
+ <if test="wllbCode != null and wllbCode != ''">
|
|
|
+ and b.code like CONCAT(CONCAT('%', #{wllbCode}), '%')
|
|
|
+ </if>
|
|
|
+ order by a.id desc
|
|
|
</select>
|
|
|
<!-- 删除原始记录 -->
|
|
|
<delete id="delReceiveGoods">
|
|
|
- delete from tld_receive_goods where id = #{id}
|
|
|
+ delete
|
|
|
+ from tld_receive_goods
|
|
|
+ where id = #{id}
|
|
|
</delete>
|
|
|
+
|
|
|
</mapper>
|