|
|
|
@ -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(/</g, '<') |
|
|
|
@ -4173,15 +4214,38 @@ |
|
|
|
.replace(/"/g, '"') |
|
|
|
.replace(/'/g, ''') |
|
|
|
|
|
|
|
const previewLines = nonWholeDetails |
|
|
|
.map(detail => `箱${escapeHtml(detail.itemNo)} / PN:${escapeHtml(detail.pn || '-')} / 箱数:${escapeHtml(detail.boxQty)}`) |
|
|
|
.join('<br/>') |
|
|
|
const confirmMessage = `检测到 ${nonWholeDetails.length} 条非整箱数据:<br/>${previewLines}<br/>请确认是否继续装箱。` |
|
|
|
const warningSections = [] |
|
|
|
|
|
|
|
if (nonWholeDetails.length > 0) { |
|
|
|
const boxPreviewLines = nonWholeDetails |
|
|
|
.map(detail => `箱${escapeHtml(detail.itemNo)} / PN:${escapeHtml(detail.pn || '-')} / 箱数:${escapeHtml(detail.boxQty)}`) |
|
|
|
.join('<br/>') |
|
|
|
warningSections.push( |
|
|
|
`<div style="padding: 8px 10px; border: 1px solid #ebeef5; border-radius: 4px; margin-bottom: 8px;"> |
|
|
|
<div style="font-weight: 600; color: #e6a23c; margin-bottom: 4px;">【非整箱数据(${nonWholeDetails.length}条)】</div> |
|
|
|
<div>${boxPreviewLines}</div> |
|
|
|
</div>` |
|
|
|
) |
|
|
|
} |
|
|
|
|
|
|
|
if (nonWholeRollDetails.length > 0) { |
|
|
|
const rollPreviewLines = nonWholeRollDetails |
|
|
|
.map(detail => `箱${escapeHtml(detail.itemNo)} / PN:${escapeHtml(detail.pn || '-')} / Rolls:${escapeHtml(detail.detailRolls)}`) |
|
|
|
.join('<br/>') |
|
|
|
warningSections.push( |
|
|
|
`<div style="padding: 8px 10px; border: 1px solid #ebeef5; border-radius: 4px; margin-bottom: 8px;"> |
|
|
|
<div style="font-weight: 600; color: #e6a23c; margin-bottom: 4px;">【WET产品非整卷数据(${nonWholeRollDetails.length}条)】</div> |
|
|
|
<div>${rollPreviewLines}</div> |
|
|
|
</div>` |
|
|
|
) |
|
|
|
} |
|
|
|
|
|
|
|
const confirmMessage = `检测到需要确认的装箱数据:<br/>${warningSections.join('')}<div style="margin-top: 4px;">请确认是否继续装箱。</div>` |
|
|
|
|
|
|
|
try { |
|
|
|
await this.$confirm( |
|
|
|
confirmMessage, |
|
|
|
'非整箱确认', |
|
|
|
'装箱确认', |
|
|
|
{ |
|
|
|
confirmButtonText: '确认继续', |
|
|
|
cancelButtonText: '取消', |
|
|
|
@ -4190,7 +4254,6 @@ |
|
|
|
} |
|
|
|
) |
|
|
|
} catch (confirmError) { |
|
|
|
this.$message.warning('已取消保存') |
|
|
|
return |
|
|
|
} |
|
|
|
} |
|
|
|
|