DELETE FROM outbound_notification_detail
WHERE site = #{site} and bu_no = #{buNo} and order_no = #{orderNo} and part_no = #{partNo}
INSERT INTO outbound_notification_detail
(site, bu_no, order_no, part_no, part_desc, unit, required_qty, out_warehouse,
out_batch_no, created_by, created_date, order_qty, related_order_no, related_order_line_no)
VALUES
(#{detail.site}, #{detail.buNo}, #{detail.orderNo}, #{detail.partNo}, #{detail.partDesc},
#{detail.unit}, #{detail.requiredQty,jdbcType=FLOAT}, #{detail.outWarehouse},
#{detail.outBatchNo}, #{detail.createdBy}, GETDATE(), #{detail.orderQty,jdbcType=FLOAT},
#{detail.relatedOrderNo}, #{detail.relatedOrderLineNo})
DELETE FROM outbound_notification_detail
WHERE site = #{site} AND bu_no = #{buNo} AND order_no = #{orderNo}
UPDATE outbound_notification_detail
SET
required_qty = CASE
WHEN part_no = #{item.partNo} THEN #{item.requiredQty,jdbcType=DOUBLE}
ELSE required_qty
END,
out_warehouse = CASE
WHEN part_no = #{item.partNo} THEN #{item.outWarehouse}
ELSE out_warehouse
END
WHERE part_no IN
#{item.partNo}
AND site = #{list[0].site} and bu_no = #{list[0].buNo} and order_no = #{list[0].orderNo}