diff --git a/src/views/modules/ecss/codelnotifyConfirm.vue b/src/views/modules/ecss/codelnotifyConfirm.vue index 4fdd2a5..1f8d7be 100644 --- a/src/views/modules/ecss/codelnotifyConfirm.vue +++ b/src/views/modules/ecss/codelnotifyConfirm.vue @@ -3434,6 +3434,7 @@ detailRolls: detailRolls, readyDate: detail.readyDate, partDesc: detail.partDesc, + cinvcname: detail.cinvcname, // 缓存物料属性(用于后续自动计算) rollQtyCache: rollQty, boxRollsCache: boxRolls, @@ -4117,6 +4118,45 @@ return Array.from(nonWholeBoxMap.values()) }, + /** + * 获取非整卷明细数据(按明细Rolls是否为整数判断) + */ + getNonWholeRollDetails() { + const nonWholeRollMap = new Map() + const checkedDetailKeys = new Set() + + this.mergeBoxTableData.forEach(row => { + if (!row._hasDetail || !row._detailKey || checkedDetailKeys.has(row._detailKey)) { + return + } + checkedDetailKeys.add(row._detailKey) + + const cinvcname = (row.cinvcname || '').toString().trim().toUpperCase() + if (cinvcname !== 'WET') { + return + } + + const detailRolls = Number(row.detailRolls) + if (!(detailRolls > 0)) { + return + } + + const isWholeRoll = Math.abs(detailRolls - Math.round(detailRolls)) < 0.000001 + if (!isWholeRoll) { + const detailKey = row._detailKey + if (!nonWholeRollMap.has(detailKey)) { + nonWholeRollMap.set(detailKey, { + itemNo: row.item_no, + pn: row.pn, + detailRolls: parseFloat(detailRolls.toFixed(4)) + }) + } + } + }) + + return Array.from(nonWholeRollMap.values()) + }, + /** * 保存合箱批量编辑 */ @@ -4165,7 +4205,8 @@ } const nonWholeDetails = this.getNonWholeBoxDetails() - if (nonWholeDetails.length > 0) { + const nonWholeRollDetails = this.getNonWholeRollDetails() + if (nonWholeDetails.length > 0 || nonWholeRollDetails.length > 0) { const escapeHtml = (value) => String(value) .replace(/&/g, '&') .replace(/ `箱${escapeHtml(detail.itemNo)} / PN:${escapeHtml(detail.pn || '-')} / 箱数:${escapeHtml(detail.boxQty)}`) - .join('
') - const confirmMessage = `检测到 ${nonWholeDetails.length} 条非整箱数据:
${previewLines}
请确认是否继续装箱。` + const warningSections = [] + + if (nonWholeDetails.length > 0) { + const boxPreviewLines = nonWholeDetails + .map(detail => `箱${escapeHtml(detail.itemNo)} / PN:${escapeHtml(detail.pn || '-')} / 箱数:${escapeHtml(detail.boxQty)}`) + .join('
') + warningSections.push( + `
+
【非整箱数据(${nonWholeDetails.length}条)】
+
${boxPreviewLines}
+
` + ) + } + + if (nonWholeRollDetails.length > 0) { + const rollPreviewLines = nonWholeRollDetails + .map(detail => `箱${escapeHtml(detail.itemNo)} / PN:${escapeHtml(detail.pn || '-')} / Rolls:${escapeHtml(detail.detailRolls)}`) + .join('
') + warningSections.push( + `
+
【WET产品非整卷数据(${nonWholeRollDetails.length}条)】
+
${rollPreviewLines}
+
` + ) + } + + const confirmMessage = `检测到需要确认的装箱数据:
${warningSections.join('')}
请确认是否继续装箱。
` try { await this.$confirm( confirmMessage, - '非整箱确认', + '装箱确认', { confirmButtonText: '确认继续', cancelButtonText: '取消', @@ -4190,7 +4254,6 @@ } ) } catch (confirmError) { - this.$message.warning('已取消保存') return } }