|
@@ -115,4 +115,182 @@
|
|
|
</if>
|
|
</if>
|
|
|
</trim>
|
|
</trim>
|
|
|
</select>
|
|
</select>
|
|
|
|
|
+ <!-- 查询生产领料要货 -->
|
|
|
|
|
+ <select id="getAskGoods" resultType="com.tld.model.AskGoods">
|
|
|
|
|
+ SELECT
|
|
|
|
|
+ a.id,
|
|
|
|
|
+ a.ask_goods_id,
|
|
|
|
|
+ a.material_id,
|
|
|
|
|
+ IFNULL( a.out_num, 0 ) AS out_num,
|
|
|
|
|
+ a.num,
|
|
|
|
|
+ e.NAME AS materialName,
|
|
|
|
|
+ e.CODE AS materialCode,
|
|
|
|
|
+ b.ask_goods_code,
|
|
|
|
|
+ b.company_number
|
|
|
|
|
+ FROM
|
|
|
|
|
+ tld_ask_goods a
|
|
|
|
|
+ JOIN tld_ask_goods_f b ON a.ask_goods_id = b.ask_goods_id
|
|
|
|
|
+ LEFT JOIN tld_department c ON b.department = c.code
|
|
|
|
|
+ JOIN tld_material e ON a.material_id = e.tld_id
|
|
|
|
|
+ WHERE e.part_type != '半成品' and e.part_type != '产成品'
|
|
|
|
|
+ <if test="askGoodsId != null and askGoodsId != ''">
|
|
|
|
|
+ and a.ask_goods_id = #{askGoodsId}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="materialCode != null and materialCode != ''">
|
|
|
|
|
+ and e.code like CONCAT(CONCAT('%', #{materialCode}), '%')
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="materialName != null and materialName != ''">
|
|
|
|
|
+ and e.name like CONCAT(CONCAT('%', #{materialName}), '%')
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="startTime != null and startTime != ''">
|
|
|
|
|
+ and b.sqrq <![CDATA[>=]]> #{startTime}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="endTime != null and endTime != ''">
|
|
|
|
|
+ and b.sqrq <![CDATA[<=]]> #{endTime}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ </select>
|
|
|
|
|
+ <!-- 查询生产领料要货 -->
|
|
|
|
|
+ <select id="getAskGoodsExcel" resultType="java.util.LinkedHashMap">
|
|
|
|
|
+ SELECT
|
|
|
|
|
+ a.ask_goods_id,
|
|
|
|
|
+ a.material_id,
|
|
|
|
|
+ a.num,
|
|
|
|
|
+ IFNULL( a.out_num, 0 ) AS out_num,
|
|
|
|
|
+ e.NAME AS materialName,
|
|
|
|
|
+ e.CODE AS materialCode,
|
|
|
|
|
+ b.ask_goods_code,
|
|
|
|
|
+ b.company_number
|
|
|
|
|
+ FROM
|
|
|
|
|
+ tld_ask_goods a
|
|
|
|
|
+ JOIN tld_ask_goods_f b ON a.ask_goods_id = b.ask_goods_id
|
|
|
|
|
+ LEFT JOIN tld_department c ON b.department = c.code
|
|
|
|
|
+ JOIN tld_material e ON a.material_id = e.tld_id
|
|
|
|
|
+ WHERE e.part_type != '半成品' and e.part_type != '产成品'
|
|
|
|
|
+ <if test="askGoodsId != null and askGoodsId != ''">
|
|
|
|
|
+ and a.ask_goods_id = #{askGoodsId}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="materialCode != null and materialCode != ''">
|
|
|
|
|
+ and e.code like CONCAT(CONCAT('%', #{materialCode}), '%')
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="materialName != null and materialName != ''">
|
|
|
|
|
+ and e.name like CONCAT(CONCAT('%', #{materialName}), '%')
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="startTime != null and startTime != ''">
|
|
|
|
|
+ and b.sqrq <![CDATA[>=]]> #{startTime}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="endTime != null and endTime != ''">
|
|
|
|
|
+ and b.sqrq <![CDATA[<=]]> #{endTime}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ </select>
|
|
|
|
|
+ <!-- 查询非生产领料单 -->
|
|
|
|
|
+ <select id="getInvite" resultType="com.tld.model.AskGoods">
|
|
|
|
|
+ SELECT
|
|
|
|
|
+ a.id,
|
|
|
|
|
+ a.ask_goods_id,
|
|
|
|
|
+ a.material_id,
|
|
|
|
|
+ IFNULL( a.out_num, 0 ) AS out_num,
|
|
|
|
|
+ a.num,
|
|
|
|
|
+ e.NAME AS materialName,
|
|
|
|
|
+ e.CODE AS materialCode,
|
|
|
|
|
+ b.ask_goods_code,
|
|
|
|
|
+ b.company_number
|
|
|
|
|
+ FROM
|
|
|
|
|
+ tld_invite a
|
|
|
|
|
+ JOIN tld_invite_f b ON a.ask_goods_id = b.ask_goods_id
|
|
|
|
|
+ LEFT JOIN tld_department c ON b.department = c.code
|
|
|
|
|
+ JOIN tld_material e ON a.material_id = e.tld_id
|
|
|
|
|
+ WHERE e.part_type != '半成品' and e.part_type != '产成品'
|
|
|
|
|
+ <if test="askGoodsId != null and askGoodsId != ''">
|
|
|
|
|
+ and a.ask_goods_id = #{askGoodsId}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="materialCode != null and materialCode != ''">
|
|
|
|
|
+ and e.code like CONCAT(CONCAT('%', #{materialCode}), '%')
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="materialName != null and materialName != ''">
|
|
|
|
|
+ and e.name like CONCAT(CONCAT('%', #{materialName}), '%')
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="startTime != null and startTime != ''">
|
|
|
|
|
+ and b.sqrq <![CDATA[>=]]> #{startTime}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="endTime != null and endTime != ''">
|
|
|
|
|
+ and b.sqrq <![CDATA[<=]]> #{endTime}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ </select>
|
|
|
|
|
+ <!-- 导出生产领料要货 -->
|
|
|
|
|
+ <select id="getInviteExcel" resultType="java.util.LinkedHashMap">
|
|
|
|
|
+ SELECT
|
|
|
|
|
+ a.ask_goods_id,
|
|
|
|
|
+ a.material_id,
|
|
|
|
|
+ a.num,
|
|
|
|
|
+ IFNULL( a.out_num, 0 ) AS out_num,
|
|
|
|
|
+ e.NAME AS materialName,
|
|
|
|
|
+ e.CODE AS materialCode,
|
|
|
|
|
+ b.ask_goods_code,
|
|
|
|
|
+ b.company_number
|
|
|
|
|
+ FROM
|
|
|
|
|
+ tld_invite a
|
|
|
|
|
+ JOIN tld_invite_f b ON a.ask_goods_id = b.ask_goods_id
|
|
|
|
|
+ LEFT JOIN tld_department c ON b.department = c.code
|
|
|
|
|
+ JOIN tld_material e ON a.material_id = e.tld_id
|
|
|
|
|
+ WHERE e.part_type != '半成品' and e.part_type != '产成品'
|
|
|
|
|
+ <if test="askGoodsId != null and askGoodsId != ''">
|
|
|
|
|
+ and a.ask_goods_id = #{askGoodsId}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="materialCode != null and materialCode != ''">
|
|
|
|
|
+ and e.code like CONCAT(CONCAT('%', #{materialCode}), '%')
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="materialName != null and materialName != ''">
|
|
|
|
|
+ and e.name like CONCAT(CONCAT('%', #{materialName}), '%')
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="startTime != null and startTime != ''">
|
|
|
|
|
+ and b.sqrq <![CDATA[>=]]> #{startTime}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="endTime != null and endTime != ''">
|
|
|
|
|
+ and b.sqrq <![CDATA[<=]]> #{endTime}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ </select>
|
|
|
|
|
+ <!-- 查询销售单 -->
|
|
|
|
|
+ <select id="getDelivery" resultType="com.tld.model.Delivery">
|
|
|
|
|
+ select
|
|
|
|
|
+ a.id,
|
|
|
|
|
+ a.delivery_id,
|
|
|
|
|
+ a.entry_number,
|
|
|
|
|
+ a.material_id,
|
|
|
|
|
+ a.wbs,
|
|
|
|
|
+ a.measurement_id,
|
|
|
|
|
+ a.gs_delivery_num,
|
|
|
|
|
+ a.gs_cancel_num,
|
|
|
|
|
+ a.out_num,
|
|
|
|
|
+ b.company_number,
|
|
|
|
|
+ b.bills_time,
|
|
|
|
|
+ b.delivery_type,
|
|
|
|
|
+ b.source_type,
|
|
|
|
|
+ b.move_type,
|
|
|
|
|
+ c.name as materialName,
|
|
|
|
|
+ c.code as materialCode
|
|
|
|
|
+ from tld_delivery a
|
|
|
|
|
+ join tld_delivery_f b on a.delivery_id = b.delivery_id
|
|
|
|
|
+ join tld_material c on a.material_id = c.tld_id
|
|
|
|
|
+ <trim prefix="WHERE" prefixOverrides="and |or">
|
|
|
|
|
+ <if test="deliveryId != null and deliveryId != ''">
|
|
|
|
|
+ and a.delivery_id = #{deliveryId}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="materialCode != null and materialCode != ''">
|
|
|
|
|
+ and c.code like CONCAT(CONCAT('%', #{materialCode}), '%')
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="materialName != null and materialName != ''">
|
|
|
|
|
+ and c.name like CONCAT(CONCAT('%', #{materialName}), '%')
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="startTime != null and startTime != ''">
|
|
|
|
|
+ and a.bills_time <![CDATA[>=]]> #{startTime}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="endTime != null and endTime != ''">
|
|
|
|
|
+ and a.bills_time <![CDATA[<=]]> #{endTime}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ </trim>
|
|
|
|
|
+ </select>
|
|
|
|
|
+ <!-- 导出销售单 -->
|
|
|
|
|
+ <select id="getDeliveryExcel" resultType="java.util.LinkedHashMap">
|
|
|
|
|
+
|
|
|
|
|
+ </select>
|
|
|
</mapper>
|
|
</mapper>
|