diff --git a/klp-ui/src/views/wms/report/comparison.vue b/klp-ui/src/views/wms/report/comparison.vue new file mode 100644 index 00000000..14ff5cda --- /dev/null +++ b/klp-ui/src/views/wms/report/comparison.vue @@ -0,0 +1,385 @@ + + + + + diff --git a/klp-ui/src/views/wms/report/template/action.vue b/klp-ui/src/views/wms/report/template/action.vue index 864a2016..f033308d 100644 --- a/klp-ui/src/views/wms/report/template/action.vue +++ b/klp-ui/src/views/wms/report/template/action.vue @@ -265,6 +265,17 @@ + + + {{ sizeAbnormalSummary.length.count }} + {{ sizeAbnormalSummary.length.weight }}t + {{ sizeAbnormalSummary.length.countRate }} + {{ sizeAbnormalSummary.length.weightRate }} + {{ sizeAbnormalSummary.thickness.count }} + {{ sizeAbnormalSummary.thickness.weight }}t + {{ sizeAbnormalSummary.thickness.countRate }} + {{ sizeAbnormalSummary.thickness.weightRate }} + @@ -344,6 +355,17 @@
+ + + {{ sizeAbnormalSummary.length.count }} + {{ sizeAbnormalSummary.length.weight }}t + {{ sizeAbnormalSummary.length.countRate }} + {{ sizeAbnormalSummary.length.weightRate }} + {{ sizeAbnormalSummary.thickness.count }} + {{ sizeAbnormalSummary.thickness.weight }}t + {{ sizeAbnormalSummary.thickness.countRate }} + {{ sizeAbnormalSummary.thickness.weightRate }} + @@ -547,7 +569,9 @@ export default { ], lossColumns: [], outputColumns: [], - actionIds: '' + actionIds: '', + lengthThreshold: 0, + thicknessThreshold: 0 } }, computed: { @@ -610,6 +634,41 @@ export default { customExportStorageKey() { return `coil-report-action-${this.actionType}` }, + sizeAbnormalSummary() { + const totalCount = this.outList.length + const totalWeight = this.outList.reduce((acc, cur) => acc + (parseFloat(cur.netWeight) || 0), 0) + + const lengthAbnormal = this.outList.filter(row => { + const lengthDiff = (row.actualLength || 0) - (row.theoreticalLength || 0) + const theoreticalLength = row.theoreticalLength || 1 + return Math.abs(lengthDiff) / theoreticalLength > this.lengthThreshold + }) + + const thicknessAbnormal = this.outList.filter(row => { + const thicknessDiff = (row.theoreticalThickness || 0) - (row.computedThickness || 0) + return thicknessDiff > this.thicknessThreshold + }) + + const laCount = lengthAbnormal.length + const laWeight = lengthAbnormal.reduce((acc, cur) => acc + (parseFloat(cur.netWeight) || 0), 0) + const taCount = thicknessAbnormal.length + const taWeight = thicknessAbnormal.reduce((acc, cur) => acc + (parseFloat(cur.netWeight) || 0), 0) + + return { + length: { + count: laCount, + weight: laWeight.toFixed(2), + countRate: totalCount > 0 ? (laCount / totalCount * 100).toFixed(2) + '%' : '0.00%', + weightRate: totalWeight > 0 ? (laWeight / totalWeight * 100).toFixed(2) + '%' : '0.00%', + }, + thickness: { + count: taCount, + weight: taWeight.toFixed(2), + countRate: totalCount > 0 ? (taCount / totalCount * 100).toFixed(2) + '%' : '0.00%', + weightRate: totalWeight > 0 ? (taWeight / totalWeight * 100).toFixed(2) + '%' : '0.00%', + } + } + }, }, watch: { warehouseOptions: { @@ -625,6 +684,7 @@ export default { this.initDateByReportType() this.handleQuery() this.loadColumns() + this.getAlarmThreshold() }, methods: { initDateByReportType() { @@ -1102,6 +1162,10 @@ export default { this.loading = false }) }, + getAlarmThreshold() { + this.getConfigKey('material.warning.length').then(response => { this.lengthThreshold = parseFloat(response.msg) || 0 }) + this.getConfigKey('material.warning.thickness').then(response => { this.thicknessThreshold = parseFloat(response.msg) || 0 }) + }, loadColumns() { this.lossColumns = JSON.parse(localStorage.getItem('preference-tableColumns-coil-report-loss') || '[]') || [] this.outputColumns = JSON.parse(localStorage.getItem('preference-tableColumns-coil-report-output') || '[]') || []