From e031c258f4b70266653f1d083aed6721df2b6493 Mon Sep 17 00:00:00 2001 From: shenzhouyu Date: Thu, 3 Sep 2026 13:32:10 +0800 Subject: [PATCH] =?UTF-8?q?=E7=94=9F=E4=BA=A7=E9=A2=86=E6=96=99=E6=B5=B7?= =?UTF-8?q?=E5=AE=89=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ShopOrderIssueNotify54.vue | 111 ++++++++++++++++-- 1 file changed, 98 insertions(+), 13 deletions(-) diff --git a/src/views/modules/haianWarehouse/shopOrderIssueNotify/ShopOrderIssueNotify54.vue b/src/views/modules/haianWarehouse/shopOrderIssueNotify/ShopOrderIssueNotify54.vue index a4934e8..7d30f47 100644 --- a/src/views/modules/haianWarehouse/shopOrderIssueNotify/ShopOrderIssueNotify54.vue +++ b/src/views/modules/haianWarehouse/shopOrderIssueNotify/ShopOrderIssueNotify54.vue @@ -167,6 +167,27 @@ 关闭 + + + + + + + + + + + + + + + + + 关闭 + + @@ -734,7 +755,7 @@ export default { fixed: false, columnWidth: 100, }, - /* { + { userId: this.$store.state.user.name, functionId: 555001, serialNumber: '555001Table2ReleaseNo', @@ -769,7 +790,7 @@ export default { status: true, fixed: false, columnWidth: 80, - }, */ + }, { userId: this.$store.state.user.name, functionId: 555001, @@ -788,16 +809,16 @@ export default { fixed: false, columnWidth: 70, }, - /* { + { userId: this.$store.state.user.name, functionId: 555001, - serialNumber: '555001Table2Contract', + serialNumber: '555001Table2SubSite', tableId: '555001Table2', tableName: '查询工单及物料', - columnProp: 'contract', + columnProp: 'subSite', headerAlign: 'center', align: 'center', - columnLabel: '合同', + columnLabel: 'Site', columnHidden: false, columnImage: false, columnSortable: false, @@ -805,7 +826,7 @@ export default { status: true, fixed: false, columnWidth: 100, - }, */ + }, { userId: this.$store.state.user.name, functionId: 555001, @@ -1433,6 +1454,9 @@ export default { chooseLoading: false, seqNoModalLoading: false, saveNewLoading: false, + // 多site工单候选列表(contract区分)- rqrq + shopOrderSiteSelectFlag: false, + shopOrderCandidateList: [], } }, @@ -1771,7 +1795,7 @@ export default { chooseSOSModal() { this.seqNoData = { - site: this.$store.state.user.site, + site: this.$store.state.user.site+'%', orderNo: '', releaseNo: '*', sequenceNo: '*', @@ -1784,9 +1808,11 @@ export default { endDate: this.dayjs().format('YYYY-MM-DD'), } this.seqNoList = [] + this.shopOrderCandidateList = [] + this.shopOrderSiteSelectFlag = false this.seqNoModalFlag = true }, - // 海安工单物料拉取:IFS回传contract映射为subSite并透传到后续保存 - rqrq + // 先按site%查ShopOrder;唯一则用contract查物料,多site则弹窗选择 - rqrq searchSOSRouting() { if (!this.seqNoData.orderNo || !this.seqNoData.releaseNo || !this.seqNoData.sequenceNo) { this.$message.warning('请输入完整的OrderNo/ReleaseNo/SequenceNo!') @@ -1796,7 +1822,66 @@ export default { return false } this.seqNoModalLoading = true - haiAnGetShopOrderAndMaterialByShoporder(this.seqNoData) + let materialFetchStarted = false + const shopOrderQuery = { + ...this.seqNoData, + site: (this.$store.state.user.site || '') + '%', + } + haiAnGetShopOrderFromIFSWithOrderNo(shopOrderQuery) + .then(({ data }) => { + if (!(data && data.code === 0 && data.rows && data.rows.length > 0)) { + this.$message.error((data && data.msg) || '未查询到工单') + return + } + const allowedStatuses = ['Released', 'Reserved', 'Started'] + const validOrders = data.rows.filter(item => allowedStatuses.includes(item.objstate)) + if (data.rows.length > 0 && validOrders.length === 0) { + this.$message.error('生产订单' + this.seqNoData.orderNo + '状态不允许发料,请检查!') + return + } + if (validOrders.length === 1) { + // 唯一工单:loading交由物料查询方法接管 - rqrq + materialFetchStarted = true + return this.fetchShopOrderMaterial(validOrders[0]) + } + // 多site:展示contract供用户选择后再查物料 - rqrq + this.shopOrderCandidateList = validOrders + this.shopOrderSiteSelectFlag = true + }) + .catch((e) => { + this.$message.error((e && e.msg) || '查询工单失败') + }) + .finally(() => { + if (!materialFetchStarted) { + this.seqNoModalLoading = false + } + }) + }, + // 用户选定具体site(contract)后拉取物料 - rqrq + confirmShopOrderSite(row) { + if (!row) { + return + } + this.shopOrderSiteSelectFlag = false + this.fetchShopOrderMaterial(row) + }, + // 使用精确site(contract)调用ShopOrderMaterial链路,并映射subSite - rqrq + fetchShopOrderMaterial(shopOrder) { + const contract = (shopOrder && (shopOrder.contract || shopOrder.site)) || '' + if (!contract) { + this.seqNoModalLoading = false + this.$message.error('工单缺少Site(contract)信息,无法查询物料') + return Promise.resolve() + } + this.seqNoModalLoading = true + const materialQuery = { + ...this.seqNoData, + site: contract, + orderNo: (shopOrder && shopOrder.orderNo) || this.seqNoData.orderNo, + releaseNo: (shopOrder && shopOrder.releaseNo) || this.seqNoData.releaseNo, + sequenceNo: (shopOrder && shopOrder.sequenceNo) || this.seqNoData.sequenceNo, + } + return haiAnGetShopOrderAndMaterialByShoporder(materialQuery) .then(({ data }) => { if (data && data.code === 0 && data.rows && data.rows.length > 0) { data.rows.forEach(newRow => { @@ -1805,8 +1890,8 @@ export default { const qtyReserved = parseFloat(newRow.qtyReserved) || 0 const applyQty = qtyRequired - qtyIssued - qtyReserved this.$set(newRow, 'applyQty', applyQty > 0 ? applyQty : 0) - // 明确subSite来源:IFS回传contract/site均视为subsite - rqrq - this.$set(newRow, 'subSite', newRow.subSite || newRow.contract || newRow.site || '') + // 明确subSite来源:优先接口回传,其次选定工单的contract - rqrq + this.$set(newRow, 'subSite', newRow.subSite || newRow.contract || contract || newRow.site || '') this.seqNoList.push(newRow) }) this.$message.success(`成功添加 ${data.rows.length} 条数据`) @@ -1815,7 +1900,7 @@ export default { } }) .catch((e) => { - this.$message.error(e.msg || '查询失败') + this.$message.error((e && e.msg) || '查询失败') }) .finally(() => { this.seqNoModalLoading = false