diff --git a/klp-ui/src/views/wms/coil/do/correntAll.vue b/klp-ui/src/views/wms/coil/do/correntAll.vue index 403ea490..6027e9e3 100644 --- a/klp-ui/src/views/wms/coil/do/correntAll.vue +++ b/klp-ui/src/views/wms/coil/do/correntAll.vue @@ -191,13 +191,17 @@ diff --git a/klp-ui/src/views/wms/coil/docorrent.vue b/klp-ui/src/views/wms/coil/docorrent.vue index ebb704fd..1dc9f2ce 100644 --- a/klp-ui/src/views/wms/coil/docorrent.vue +++ b/klp-ui/src/views/wms/coil/docorrent.vue @@ -72,12 +72,16 @@ diff --git a/klp-ui/src/views/wms/coil/panels/base.vue b/klp-ui/src/views/wms/coil/panels/base.vue index 07a107ab..62b647b4 100644 --- a/klp-ui/src/views/wms/coil/panels/base.vue +++ b/klp-ui/src/views/wms/coil/panels/base.vue @@ -51,6 +51,27 @@ clearable @keyup.enter.native="handleQuery" /> + + + + + + + + + + + + + + + + + + + + 全部 @@ -1691,9 +1712,8 @@ export default { }); }, handleExportAll() { - this.download('wms/materialCoil/export', { - ...this.queryParams - }, `materialCoil_${new Date().getTime()}.xlsx`) + const { orderBy, ...query } = this.queryParams; + this.download('wms/materialCoil/export', query, `materialCoil_${new Date().getTime()}.xlsx`) }, /** 批量打印标签按钮 */ handleBatchPrintLabel() { diff --git a/klp-ui/src/views/wms/delivery/canuse/index.vue b/klp-ui/src/views/wms/delivery/canuse/index.vue index d15faef6..617cc2f6 100644 --- a/klp-ui/src/views/wms/delivery/canuse/index.vue +++ b/klp-ui/src/views/wms/delivery/canuse/index.vue @@ -26,7 +26,7 @@ export default { materialType: '成品', itemType: 'product', status: 0, - orderBy: false + orderBy: true }, labelType: '3', showStatus: true, diff --git a/klp-ui/src/views/wms/report/abnormal.vue b/klp-ui/src/views/wms/report/abnormal.vue index c43c2234..ed0d0896 100644 --- a/klp-ui/src/views/wms/report/abnormal.vue +++ b/klp-ui/src/views/wms/report/abnormal.vue @@ -38,10 +38,20 @@ :options="dict.type.coil_manufacturer" placeholder="请选择厂家" clearable @keyup.enter.native="handleQuery" /> - 查询 - 导出产出钢卷 - - 列设置 + + + 查询 + + 导出产出钢卷 + 导出消耗钢卷 + 保存产出报表 + 保存消耗报表 + + + @@ -86,19 +96,24 @@ - - - - + + + + + + + + + - - - 产出明细配置 - @@ -118,6 +133,7 @@ import { calcSummary, calcMSummary } from "@/views/wms/report/js/calc"; import CoilTable from "@/views/wms/report/components/coilTable"; import ColumnsSetting from "@/views/wms/report/components/setting/columns"; import TimeRangePicker from "@/views/wms/report/components/timeRangePicker.vue"; +import { saveReportFile } from "@/views/wms/report/js/reportFile"; export default { name: 'MergeTemplate', @@ -182,8 +198,8 @@ export default { return { lossList: [], outList: [], - activeTab: 'loss', - activeColumnConfig: 'coil-report-loss', + activeTab: 'output', + activeColumnConfig: 'coil-report-output', settingVisible: false, loading: false, timeRangeParams: { @@ -201,7 +217,7 @@ export default { itemSpecification: '', itemMaterial: '', itemManufacturer: '', - pageSize: 9999, + pageSize: 99999, pageNum: 1, }, lossColumns: [], @@ -243,6 +259,48 @@ export default { handleQuery() { this.getList() }, + // 保存产出报表 + saveOutputReport() { + this.loading = true + saveReportFile(this.outList.map(item => item.coilId).join(','), { + reportParams: this.queryParams, + reportType: '产出报表,异常报表', + productionLine: this.productionLine, + }).then(res => { + this.$message({ + message: '保存成功', + type: 'success', + }) + }).catch(err => { + this.$message({ + message: '保存失败', + type: 'error', + }) + }).finally(() => { + this.loading = false + }) + }, + // 保存消耗报表 + saveLossReport() { + this.loading = true + saveReportFile(this.lossList.map(item => item.coilId).join(','), { + reportParams: this.queryParams, + reportType: '消耗报表,异常报表', + productionLine: this.productionLine, + }).then(res => { + this.$message({ + message: '保存成功', + type: 'success', + }) + }).catch(err => { + this.$message({ + message: '保存失败', + type: 'error', + }) + }).finally(() => { + this.loading = false + }) + }, async getList() { this.loading = true; const actions = await listPendingAction({ ...this.queryParams, actionTypes: this.actionTypes, actionStatus: 2 }); @@ -282,68 +340,9 @@ export default { } }); - - // if (!lossIds) { - // this.lossList = [] - // } else { - // const lossRes = await listCoilWithIds({ ...this.queryParams, coilIds: lossIds || '', startTime: '', endTime: '' }); - - // this.lossList = lossRes.rows.map(item => { - // // 计算宽度和厚度,将规格按照*分割,*前的是厚度,*后的是宽度 - // const [thickness, width] = item.specification?.split('*') || [] - // return { - // ...item, - // computedThickness: parseFloat(thickness), - // computedWidth: parseFloat(width), - // } - // }); - // } - this.loading = false; - - // this.loading = true; - // const res1 = await listPendingAction({ ...this.queryParams, actionTypes: '201,202,203,204,205,206', actionStatus: 2 }); - - // const res = res1.rows; - // // 获取两层数据 - // const lossIds = res.map(item => item.coilId); - // // 使用new Set去重 - // const outIds = [...new Set(res.map(item => item.processedCoilIds))]; - - // if (lossIds.length === 0 || outIds.length === 0) { - // this.$message({ - // message: '查询结果为空', - // type: 'warning' - // }) - // this.loading = false; - // return - // } - - // const [lossRes, outRes] = await Promise.all([ - // listCoilWithIds({ ...this.queryParams, coilIds: lossIds.join(',') || '', startTime: '', endTime: '' }), - // listCoilWithIds({ ...this.queryParams, coilIds: outIds.join(',') || '', startTime: '', endTime: '' }), - // ]); - // this.lossList = lossRes.rows.map(item => { - // // 计算宽度和厚度,将规格按照*分割,*前的是厚度,*后的是宽度 - // const [thickness, width] = item.specification?.split('*') || [] - // return { - // ...item, - // computedThickness: parseFloat(thickness), - // computedWidth: parseFloat(width), - // } - // }); - // this.outList = outRes.rows.map(item => { - // // 计算宽度和厚度,将规格按照*分割,*前的是厚度,*后的是宽度 - // const [thickness, width] = item.specification?.split('*') || [] - // return { - // ...item, - // computedThickness: parseFloat(thickness), - // computedWidth: parseFloat(width), - // } - // }); - // this.loading = false; }, - // 导出 + // 导出产出钢卷 exportData() { if (this.outList.length === 0) { this.$message.warning('暂无数据可导出') @@ -353,6 +352,8 @@ export default { coilIds: this.outList.map(item => item.coilId).join(',') }, `materialCoil_${new Date().getTime()}.xlsx`) }, + + // 导出消耗钢卷 exportLossData() { if (this.lossList.length === 0) { this.$message.warning('暂无数据可导出') @@ -362,9 +363,21 @@ export default { coilIds: this.lossList.map(item => item.coilId).join(',') }, `materialCoil_${new Date().getTime()}.xlsx`) }, + // 处理命令 + handleCommand(command) { + if (command === 'exportData') { + this.exportData() + } else if (command === 'exportLossData') { + this.exportLossData() + } else if (command === 'saveOutputReport') { + this.saveOutputReport() + } else if (command === 'saveLossReport') { + this.saveLossReport() + } + }, // 加载列设置 loadColumns() { - // this.lossColumns = JSON.parse(localStorage.getItem('preference-tableColumns-coil-report-loss') || '[]') || [] + this.lossColumns = JSON.parse(localStorage.getItem('preference-tableColumns-coil-report-loss') || '[]') || [] this.outputColumns = JSON.parse(localStorage.getItem('preference-tableColumns-coil-report-output') || '[]') || [] } } diff --git a/klp-ui/src/views/wms/report/components/coilTable/index.vue b/klp-ui/src/views/wms/report/components/coilTable/index.vue index 23c3cdde..c5fc78f3 100644 --- a/klp-ui/src/views/wms/report/components/coilTable/index.vue +++ b/klp-ui/src/views/wms/report/components/coilTable/index.vue @@ -22,6 +22,8 @@ + + diff --git a/klp-ui/src/views/wms/report/components/crossTable/index.vue b/klp-ui/src/views/wms/report/components/crossTable/index.vue new file mode 100644 index 00000000..605ebfcf --- /dev/null +++ b/klp-ui/src/views/wms/report/components/crossTable/index.vue @@ -0,0 +1,195 @@ + + + + + diff --git a/klp-ui/src/views/wms/report/components/hierarchicalPivot/index.vue b/klp-ui/src/views/wms/report/components/hierarchicalPivot/index.vue new file mode 100644 index 00000000..0199fbe7 --- /dev/null +++ b/klp-ui/src/views/wms/report/components/hierarchicalPivot/index.vue @@ -0,0 +1,108 @@ + + + + + diff --git a/klp-ui/src/views/wms/report/components/timeRangePicker.vue b/klp-ui/src/views/wms/report/components/timeRangePicker.vue index 0a0ac655..64bc4097 100644 --- a/klp-ui/src/views/wms/report/components/timeRangePicker.vue +++ b/klp-ui/src/views/wms/report/components/timeRangePicker.vue @@ -21,6 +21,7 @@
前一天 + 今天 后一天 近7天 近15天 @@ -127,12 +128,15 @@ export default { switch (type) { case 'prevDay': - // 在当前时间基础上向前推一天 newStartDate.setDate(newStartDate.getDate() - 1) newEndDate.setDate(newEndDate.getDate() - 1) break + case 'today': + const todayNow = new Date() + newStartDate = todayNow + newEndDate = todayNow + break case 'nextDay': - // 在当前时间基础上向后推一天 newStartDate.setDate(newStartDate.getDate() + 1) newEndDate.setDate(newEndDate.getDate() + 1) break @@ -205,7 +209,11 @@ export default { } .quick-options { display: flex; - gap: 8px; + gap: 2px; flex-wrap: wrap; } + +.el-button + .el-button { + margin-left: 4px +} diff --git a/klp-ui/src/views/wms/report/receive.vue b/klp-ui/src/views/wms/report/receive.vue index 7084c596..6ed9c016 100644 --- a/klp-ui/src/views/wms/report/receive.vue +++ b/klp-ui/src/views/wms/report/receive.vue @@ -62,6 +62,12 @@ {{ summary.avgWeight }}t + + + + + + @@ -90,6 +96,8 @@ import { listDeliveryPlan } from '@/api/wms/deliveryPlan' import ColumnsSetting from "@/views/wms/report/components/setting/columns.vue"; import CoilTable from "@/views/wms/report/components/coilTable/index.vue"; import TimeRangePicker from "@/views/wms/report/components/timeRangePicker.vue"; +import HierarchicalPivot from "@/views/wms/report/components/hierarchicalPivot/index.vue"; +import CrossTable from "@/views/wms/report/components/crossTable/index.vue"; import { saveReportFile } from "@/views/wms/report/js/reportFile"; @@ -104,12 +112,13 @@ export default { ColumnsSetting, CoilTable, TimeRangePicker, + HierarchicalPivot, + CrossTable, }, dicts: ['product_coil_status', 'coil_material', 'coil_itemname', 'coil_manufacturer'], data() { // 工具函数:个位数补零,保证格式统一(比如 9 → 09,5 → 05) const addZero = (num) => num.toString().padStart(2, '0') - const now = new Date() // 当前本地北京时间 // 核心:获取【昨天】的日期对象(自动处理跨月/跨年,无边界问题) const yesterday = new Date(now) @@ -151,6 +160,44 @@ export default { loading: false, receiveColumns: [], + + // 厂家材质透视表配置 + hierarchicalPivotConfig: { + groupFields: ['manufacturer', 'material'], + groupLabels: ['厂家', '材质'], + summaryFields: [ + { prop: 'count', label: '求和项:件数', field: '', align: 'center' }, + { prop: 'weight', label: '求和项:重量', field: 'netWeight', align: 'center' } + ], + formatValue: (value, summaryField) => { + if (summaryField.field === '') { + return value + } + return value.toFixed(3) + } + }, + + // 宽度厚度统计表配置 + crossTableConfig: { + rowField: 'computedWidth', + rowLabel: '宽度', + rowWidth: 100, + columnField: 'computedThickness', + summaryColumns: [ + { prop: 'count', label: '件数', width: 80, field: '' }, + { prop: 'weight', label: '重量', width: 100, field: 'netWeight' } + ], + formatValue: (value, summaryField) => { + if (summaryField.field === '') { + return value + } + return value.toFixed(2) + }, + formatKey: (num) => { + if (num === null || num === undefined || isNaN(num)) return null + return parseFloat(num).toFixed(2) + } + } } }, computed: { @@ -167,7 +214,8 @@ export default { }, coilIds() { return this.list.map(item => item.coilId).join(',') - } + }, + }, methods: { // 加载列设置 @@ -196,7 +244,6 @@ export default { }).then(res => { const actions = res.rows const coilIds = actions.map(item => item.coilId).join(',') - console.log(coilIds) if (!coilIds) { this.$message({ message: '暂无数据', diff --git a/klp-ui/src/views/wms/report/template/mands.vue b/klp-ui/src/views/wms/report/template/mands.vue index cd5a597a..ce4a55f9 100644 --- a/klp-ui/src/views/wms/report/template/mands.vue +++ b/klp-ui/src/views/wms/report/template/mands.vue @@ -452,7 +452,6 @@ export default { this.lossList = lossList.filter(item => !this.mergeCoils.includes(item.coilId)) // 找出所有被剔除的卷的id, const removedCoilIds = lossList.filter(item => this.mergeCoils.includes(item.coilId)).map(item => item.coilId) - console.log(removedCoilIds) this.list = outputList.filter(item => !removedCoilIds.includes(item.parentCoilId)) // if (this.viewType == 'day') { // this.getYesterdayData()