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.
223 lines
9.5 KiB
223 lines
9.5 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.gaotao.modules.inboundNotification.dao.InboundNotificationDetailMapper">
|
|
|
|
<!-- 验证标签与入库单是否匹配 -->
|
|
<select id="validateLabelWithInbound" resultType="java.util.Map">
|
|
SELECT top 1
|
|
pr.roll_no as labelCode,
|
|
pr.part_no as partNo,
|
|
pr.roll_qty as quantity,
|
|
pr.hardtag_in_flag as hardtagInFlag,
|
|
pr.batch_no as batchNo
|
|
FROM po_order_roll_no pr
|
|
INNER JOIN inbound_notification_detail d ON pr.site = d.site and pr.bu_no = d.bu_no and pr.inspection_no = d.inspection_no AND pr.part_no = d.part_no
|
|
WHERE pr.roll_no = #{labelCode}
|
|
AND d.order_no = #{orderNo}
|
|
AND pr.hardtag_in_flag = '未入库'
|
|
AND pr.site = #{site}
|
|
</select>
|
|
|
|
<!-- 获取入库单的标签明细 -->
|
|
<select id="getInboundLabelDetails" resultType="java.util.Map">
|
|
SELECT
|
|
pr.roll_no as labelCode,
|
|
pr.part_no as partNo,
|
|
pr.roll_qty as quantity,
|
|
pr.hardtag_in_flag as hardtagInFlag
|
|
FROM po_order_roll_no pr
|
|
INNER JOIN inbound_notification_detail d ON pr.inspection_no = d.order_no AND pr.part_no = d.part_no
|
|
WHERE pr.inspection_no = #{orderNo}
|
|
AND pr.part_no = #{partNo}
|
|
AND pr.hardtag_in_flag = '未入库'
|
|
AND pr.site = #{site}
|
|
ORDER BY pr.roll_no
|
|
</select>
|
|
|
|
<!-- 更新标签状态 -->
|
|
<update id="updateLabelStatus">
|
|
<if test="labelCodes != null and labelCodes.size() > 0">
|
|
UPDATE po_order_roll_no
|
|
SET hardtag_in_flag = #{status},
|
|
updated_date = GETDATE(),
|
|
update_by = 'SYSTEM'
|
|
WHERE roll_no IN
|
|
<foreach collection="labelCodes" item="labelCode" open="(" separator="," close=")">
|
|
#{labelCode}
|
|
</foreach>
|
|
AND site = #{site}
|
|
AND bu_no = #{buNo}
|
|
</if>
|
|
</update>
|
|
|
|
<!-- 查询收获入库单明细 -->
|
|
<select id="getInboundDetail" resultType="com.gaotao.modules.inboundNotification.entity.vo.InboundNotificationDetailVo" parameterType="com.gaotao.modules.inboundNotification.entity.vo.InboundNotificationDetailVo">
|
|
SELECT
|
|
a.site,
|
|
a.bu_no,
|
|
a.order_no,
|
|
a.part_no,
|
|
a.part_desc,
|
|
a.unit,
|
|
c.umName,
|
|
a.required_qty,
|
|
a.in_warehouse,
|
|
b.WareHouseName as inWarehouseName,
|
|
a.in_batch_no,
|
|
a.created_by,
|
|
a.created_date,
|
|
a.updated_by,
|
|
a.updated_date,
|
|
a.order_qty,
|
|
a.related_order_no,
|
|
a.related_order_line_no,
|
|
a.actual_in_qty as actualStockInQty,
|
|
a.roll_no
|
|
FROM inbound_notification_detail as a
|
|
left join WareHouse as b on a.site = b.site and a.bu_no = b.bu_no and a.in_warehouse = b.WareHouseID
|
|
left join um as c on a.site = c.site and a.unit = c.UMID
|
|
<where>
|
|
a.site = #{site} and a.bu_no = #{buNo} and a.order_no = #{orderNo}
|
|
<if test = "partNo != null and partNo != ''">
|
|
AND a.part_no = #{partNo}
|
|
</if>
|
|
</where>
|
|
</select>
|
|
|
|
<!-- 删除收获入库单明细 -->
|
|
<delete id="deleteInboundDetail" parameterType="com.gaotao.modules.inboundNotification.entity.vo.InboundNotificationDetailVo">
|
|
DELETE FROM inbound_notification_detail
|
|
WHERE site = #{site} and bu_no = #{buNo} and order_no = #{orderNo} and part_no = #{partNo}
|
|
<if test="rollNo != null and rollNo != ''">
|
|
AND roll_no = #{rollNo}
|
|
</if>
|
|
</delete>
|
|
|
|
<insert id="saveInboundDetails">
|
|
INSERT INTO inbound_notification_detail
|
|
(site, bu_no, order_no, part_no, part_desc, unit, required_qty,
|
|
in_warehouse, in_batch_no, created_by, created_date, order_qty,
|
|
related_order_no, related_order_line_no, inspection_no, order_item_no, roll_no)
|
|
VALUES
|
|
<foreach collection="list" item="detail" separator=",">
|
|
(#{detail.site}, #{detail.buNo}, #{detail.orderNo}, #{detail.partNo}, #{detail.partDesc}, #{detail.unit}, #{detail.requiredQty,jdbcType=FLOAT},
|
|
#{detail.inWarehouse}, #{detail.inBatchNo}, #{detail.createdBy}, GETDATE(), #{detail.orderQty,jdbcType=FLOAT},
|
|
#{detail.relatedOrderNo}, #{detail.relatedOrderLineNo}, #{detail.inspectionNo}, #{detail.orderItemNo}, #{detail.rollNo})
|
|
</foreach>
|
|
</insert>
|
|
|
|
<select id="getInboundPartList" resultType="com.gaotao.modules.pms.entity.vo.PartInformationVo">
|
|
SELECT
|
|
a.site,
|
|
a.bu_no,
|
|
a.PartNo,
|
|
a.PartDescription as partDesc,
|
|
a.UMID as unit,
|
|
a.inbound_warehouse_id as inboundWarehouseId
|
|
FROM part as a
|
|
left join inbound_notification_detail as b on a.site = b.site and a.bu_no = b.bu_no and a.partNo = b.part_no and b.order_no = #{query.orderNo}
|
|
where a.site = #{query.site} and a.bu_no = #{query.buNo} and b.site is null
|
|
and a.PartNo not in
|
|
<foreach collection="query.arr" close=")" open="(" item="item" separator=",">
|
|
#{item}
|
|
</foreach>
|
|
<if test = "query.partNo != null and query.partNo != ''">
|
|
AND a.partNo like '%' + #{query.partNo} + '%'
|
|
</if>
|
|
<if test = "query.partDesc != null and query.partDesc != ''">
|
|
AND a.PartDescription like '%' + #{query.partDesc} + '%'
|
|
</if>
|
|
</select>
|
|
|
|
<delete id="deleteInboundDetailByHead">
|
|
DELETE FROM inbound_notification_detail
|
|
WHERE site = #{site} AND bu_no = #{buNo} AND order_no = #{orderNo}
|
|
</delete>
|
|
|
|
<update id="updateInboundDetails" parameterType="java.util.List">
|
|
UPDATE inbound_notification_detail
|
|
SET
|
|
required_qty = CASE
|
|
<foreach item="item" index="index" collection="list" open="" close="" separator=" ">
|
|
WHEN (roll_no = #{item.rollNo} OR (ISNULL(roll_no, '') = '' AND part_no = #{item.partNo})) THEN #{item.requiredQty,jdbcType=DOUBLE}
|
|
</foreach>
|
|
ELSE required_qty
|
|
END,
|
|
in_warehouse = CASE
|
|
<foreach item="item" index="index" collection="list" open="" close="" separator=" ">
|
|
WHEN (roll_no = #{item.rollNo} OR (ISNULL(roll_no, '') = '' AND part_no = #{item.partNo})) THEN #{item.inWarehouse}
|
|
</foreach>
|
|
ELSE in_warehouse
|
|
END
|
|
WHERE site = #{list[0].site} AND bu_no = #{list[0].buNo} AND order_no = #{list[0].orderNo}
|
|
AND (
|
|
roll_no IN
|
|
<foreach item="item" index="index" collection="list" open="(" separator="," close=")">
|
|
#{item.rollNo}
|
|
</foreach>
|
|
OR (ISNULL(roll_no, '') = '' AND part_no IN
|
|
<foreach item="item" index="index" collection="list" open="(" separator="," close=")">
|
|
#{item.partNo}
|
|
</foreach>
|
|
)
|
|
)
|
|
</update>
|
|
|
|
<select id="getInboundDetail2" resultType="com.gaotao.modules.trans.entity.TransDetailSub" statementType="CALLABLE">
|
|
{call GetWarehouseEntryAndExitDetails(
|
|
#{site, mode=IN, jdbcType=VARCHAR},
|
|
#{buNo, mode=IN, jdbcType=VARCHAR},
|
|
#{orderNo, mode=IN, jdbcType=VARCHAR},
|
|
#{orderType, mode=IN, jdbcType=VARCHAR},
|
|
#{relatedOrderNo, mode=IN, jdbcType=VARCHAR},
|
|
#{relatedOrderLineNo, mode=IN, jdbcType=VARCHAR},
|
|
#{partNo, mode=IN, jdbcType=VARCHAR}
|
|
)}
|
|
</select>
|
|
|
|
<select id="getInboundShopOrderList" resultType="com.gaotao.modules.inboundNotification.entity.vo.InboundNotificationDetailVo">
|
|
SELECT
|
|
a.Site,
|
|
a.bu_no,
|
|
a.OrderNo as related_order_no,
|
|
a.PartNo,
|
|
c.PartDescription as partDesc,
|
|
c.UMID as unit,
|
|
a.status,
|
|
a.LotSize as order_qty,
|
|
pr.RollNo as rollNo,
|
|
pr.RollQty as requiredQty,
|
|
pr.remark,
|
|
c.inbound_warehouse_id as inboundWarehouseId
|
|
FROM ShopOrder a
|
|
INNER JOIN SFDC_Rolls pr ON a.site = pr.site AND a.bu_no = pr.bu_no AND a.OrderNo = pr.OrderNo
|
|
LEFT JOIN inbound_notification_detail b ON pr.Site = b.site AND pr.bu_no = b.bu_no AND pr.OrderNo = b.related_order_no AND pr.RollNo = b.roll_no
|
|
INNER JOIN Part c on a.Site = c.Site and a.bu_no = c.bu_no and a.PartNo = c.PartNo
|
|
WHERE a.site = #{query.site} and a.bu_no = #{query.buNo} and pr.status = '待入库' AND b.site IS NULL AND pr.RollType <![CDATA[<>]]> '删除卷'
|
|
AND pr.RollNo NOT IN
|
|
<foreach collection="query.arr" close=")" open="(" item="item" separator=",">
|
|
#{item}
|
|
</foreach>
|
|
<if test = "query.relatedOrderNo != null and query.relatedOrderNo != ''">
|
|
AND a.OrderNo like '%' + #{query.relatedOrderNo} + '%'
|
|
</if>
|
|
<if test = "query.partNo != null and query.partNo != ''">
|
|
AND a.partNo like '%' + #{query.partNo} + '%'
|
|
</if>
|
|
<if test = "query.partDesc != null and query.partDesc != ''">
|
|
AND c.PartDescription like '%' + #{query.partDesc} + '%'
|
|
</if>
|
|
<if test = "query.status != null and query.status != ''">
|
|
AND a.status = #{query.status}
|
|
</if>
|
|
ORDER BY a.OrderNo, pr.RollNo
|
|
</select>
|
|
|
|
<select id="getMaxLineNo" resultType="java.lang.Integer">
|
|
SELECT
|
|
MAX(order_item_no)
|
|
FROM inbound_notification_detail
|
|
WHERE site = #{site} AND bu_no = #{buNo} AND order_no = #{orderNo}
|
|
</select>
|
|
</mapper>
|