SELECT
a.notify_no AS notifyNo,
a.site,
a.sub_site AS subSite,
a.item_no AS itemNo,
a.BOM_item_no AS BOMItemNo,
a.component_part_no AS componentPartNo,
a.qty_to_issue AS qtyToIssue,
a.qty_to_issue_original AS qtyToIssueOriginal,
a.remark,
a.batch_no AS batchNo
FROM haian_SOIssueNotifyOrderMaterialList a WITH (NOLOCK)
INNER JOIN haian_SOIssueNotifyOrderList b WITH (NOLOCK)
ON a.site = b.site
AND a.notify_no = b.notify_no
AND a.item_no = b.item_no
WHERE a.notify_no = #{notifyNo}
AND b.soorder_no = #{orderNo}
AND b.release_no = #{releaseNo}
AND b.sequence_no = #{sequenceNo}
AND (a.site = #{site} OR a.sub_site = #{site})
SELECT
a.notify_no AS notifyNo,
a.site,
a.sub_site AS subSite,
a.item_no AS itemNo,
a.BOM_item_no AS BOMItemNo,
a.component_part_no AS componentPartNo,
a.qty_to_issue AS qtyToIssue,
a.qty_to_issue_original AS qtyToIssueOriginal,
b.fgpart_no AS fgpartNo,
b.ops_item_no AS opsItemNo,
b.soorder_no AS soorderNo,
b.seq_no AS seqNo,
b.location_no AS locationNo,
a.issue_type AS issueType,
b.need_date AS needDate,
a.remark,
a.batch_no AS batchNo,
ISNULL(pa.is_in_wh, '未维护') AS isInWh,
b.push_wms_flag AS pushWmsFlag
FROM haian_SOIssueNotifyOrderMaterialList a WITH (NOLOCK)
LEFT JOIN haian_SOIssueNotifyOrderList b WITH (NOLOCK)
ON a.site = b.site
AND a.notify_no = b.notify_no
AND a.item_no = b.item_no
LEFT JOIN part_attribute pa WITH (NOLOCK)
ON a.sub_site = pa.site
AND a.component_part_no = pa.part_no
WHERE a.notify_no = #{notifyNo}
AND a.site = #{site}
AND a.sub_site = #{subSite}
ORDER BY b.need_date, a.item_no, a.BOM_item_no
SELECT
a.notify_no AS notifyNo,
a.site,
a.sub_site AS subSite,
a.item_no AS itemNo,
a.fgpart_no AS fgPartNo,
a.soorder_no AS soorderNo,
a.ops_item_no AS opsItemNo,
a.seq_no AS seqNo,
a.issure_qty AS issureQty,
a.location_no AS locationNo,
a.need_date AS needDate,
a.out_work_order_flag AS outWorkOrderFlag,
a.release_no AS releaseNo,
a.sequence_no AS sequenceNo,
a.push_wms_flag AS pushWmsFlag,
a.transport_flag AS transportFlag,
a.production_area AS productionArea,
a.push_wcs_time AS pushWcsTime,
b.area_desc AS areaDesc
FROM haian_SOIssueNotifyOrderList a WITH (NOLOCK)
LEFT JOIN haian_area b WITH (NOLOCK)
ON a.site = b.site
AND a.production_area = b.area_id
WHERE a.notify_no = #{notifyNo}
AND a.site = #{site}
ORDER BY a.item_no
SELECT
a.sub_site AS subSite,
a.component_part_no AS componentPartNo,
SUM(a.qty_to_issue) AS qtyToIssue,
SUM(ISNULL(a.qty_to_issue_original, 0)) AS qtyToIssueOriginal,
a.issue_type AS issueType,
ISNULL(MAX(pa.is_in_wh), '未维护') AS isInWh
FROM haian_SOIssueNotifyOrderMaterialList a WITH (NOLOCK)
LEFT JOIN part_attribute pa WITH (NOLOCK)
ON a.sub_site = pa.site
AND a.component_part_no = pa.part_no
WHERE a.notify_no = #{notifyNo}
AND a.site = #{site}
GROUP BY a.sub_site, a.component_part_no, a.issue_type
ORDER BY a.issue_type
UPDATE haian_SOIssueNotifyHeader
SET status = #{status},
remark = #{closeRemark}
WHERE site = #{site}
AND notify_no = #{notifyNo}
SELECT '暂无日志数据' AS message
WHERE 1 = 2
SELECT '暂无关闭日志数据' AS message
WHERE 1 = 2
SELECT
d.site,
d.notify_no AS notifyNo,
d.item_no AS itemNo,
d.BOM_item_no AS bomItemNo,
d.serialNo AS serialNo,
d.task_ref AS taskRef,
d.task_item AS taskItem,
d.task_seq AS taskSeq,
d.out_wcs_flag AS outWcsFlag,
d.out_wcs_time AS outWcsTime,
d.issure_flag AS issureFlag,
d.order_type AS orderType,
d.sub_site AS subSite,
d.batch_no AS batchNo,
d.alloc_seq AS allocSeq,
d.pallet_id AS palletId,
m.component_part_no AS componentPartNo
FROM haian_SOIssueNotifyOrderMaterialList_detail d
LEFT JOIN haian_SOIssueNotifyOrderMaterialList m WITH (NOLOCK)
ON m.site = d.site
AND m.notify_no = d.notify_no
AND m.item_no = d.item_no
AND m.BOM_item_no = d.BOM_item_no
AND ISNULL(m.sub_site, '') = ISNULL(d.sub_site, '')
WHERE d.site = #{site}
AND d.notify_no = #{notifyNo}
AND d.sub_site = #{subSite}
ORDER BY d.item_no, d.BOM_item_no, d.alloc_seq, d.task_seq
SELECT DISTINCT
o.site,
o.notify_no AS notifyNo,
o.item_no AS itemNo,
o.transport_flag AS transportFlag
FROM haian_SOIssueNotifyOrderMaterialList m
INNER JOIN haian_SOIssueNotifyOrderList o
ON m.site = o.site
AND m.notify_no = o.notify_no
AND m.item_no = o.item_no
WHERE m.site = #{site}
AND ISNULL(o.transport_flag, 'N') = 'N'
ORDER BY o.notify_no, o.item_no
SELECT COUNT(1)
FROM haian_SOIssueNotifyOrderMaterialList_detail
WHERE site = #{site}
AND notify_no = #{notifyNo}
AND item_no = #{itemNo}
SELECT COUNT(1)
FROM haian_SOIssueNotifyOrderMaterialList_detail
WHERE site = #{site}
AND notify_no = #{notifyNo}
AND item_no = #{itemNo}
AND out_wcs_flag = 'Y'
UPDATE haian_SOIssueNotifyOrderList
SET transport_flag = 'Y'
WHERE site = #{site}
AND notify_no = #{notifyNo}
AND item_no = #{itemNo}
AND ISNULL(transport_flag, 'N') = 'N'