Browse Source

WET产品非整卷数据

master
han\hanst 4 weeks ago
parent
commit
82c3b9c8b7
  1. 77
      src/views/modules/ecss/codelnotifyConfirm.vue

77
src/views/modules/ecss/codelnotifyConfirm.vue

@ -3434,6 +3434,7 @@
detailRolls: detailRolls, detailRolls: detailRolls,
readyDate: detail.readyDate, readyDate: detail.readyDate,
partDesc: detail.partDesc, partDesc: detail.partDesc,
cinvcname: detail.cinvcname,
// //
rollQtyCache: rollQty, rollQtyCache: rollQty,
boxRollsCache: boxRolls, boxRollsCache: boxRolls,
@ -4117,6 +4118,45 @@
return Array.from(nonWholeBoxMap.values()) 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() const nonWholeDetails = this.getNonWholeBoxDetails()
if (nonWholeDetails.length > 0) {
const nonWholeRollDetails = this.getNonWholeRollDetails()
if (nonWholeDetails.length > 0 || nonWholeRollDetails.length > 0) {
const escapeHtml = (value) => String(value) const escapeHtml = (value) => String(value)
.replace(/&/g, '&amp;') .replace(/&/g, '&amp;')
.replace(/</g, '&lt;') .replace(/</g, '&lt;')
@ -4173,15 +4214,38 @@
.replace(/"/g, '&quot;') .replace(/"/g, '&quot;')
.replace(/'/g, '&#39;') .replace(/'/g, '&#39;')
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 { try {
await this.$confirm( await this.$confirm(
confirmMessage, confirmMessage,
'非整箱确认',
'箱确认',
{ {
confirmButtonText: '确认继续', confirmButtonText: '确认继续',
cancelButtonText: '取消', cancelButtonText: '取消',
@ -4190,7 +4254,6 @@
} }
) )
} catch (confirmError) { } catch (confirmError) {
this.$message.warning('已取消保存')
return return
} }
} }

Loading…
Cancel
Save