From 6e909212bff4c71701dbf77c2a8fc68aeb201d87 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A0=82=E7=B3=96?= Date: Tue, 10 Mar 2026 15:38:22 +0800 Subject: [PATCH 1/2] =?UTF-8?q?feat(=E6=A0=87=E7=AD=BE=E7=B3=BB=E7=BB=9F):?= =?UTF-8?q?=20=E6=B7=BB=E5=8A=A0=E8=84=B1=E8=84=82=E5=8E=9F=E6=96=99?= =?UTF-8?q?=E5=BA=93=E6=A0=87=E7=AD=BE=E7=B1=BB=E5=9E=8B=E5=B9=B6=E4=BC=98?= =?UTF-8?q?=E5=8C=96=E9=80=8F=E8=A7=86=E8=A1=A8=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 新增脱脂原料库标签类型6及相关组件TuoZhiTag 优化透视表功能,增加保存明细选项和导出功能 在标签渲染组件中添加对脱脂原料库类型的判断 更新相关API调用和UI交互逻辑 --- klp-ui/src/api/system/oss.js | 13 + klp-ui/src/api/wms/coil.js | 8 +- .../wms/coil/panels/LabelRender/TuoZhiTag.vue | 291 ++++++++++++++++++ .../wms/coil/panels/LabelRender/index.vue | 17 + klp-ui/src/views/wms/coil/panels/base.vue | 12 +- klp-ui/src/views/wms/coil/panels/do.vue | 11 +- .../coil/perspective/components/LeftList.vue | 17 +- .../src/views/wms/coil/perspective/index.vue | 120 +++++++- 8 files changed, 465 insertions(+), 24 deletions(-) create mode 100644 klp-ui/src/views/wms/coil/panels/LabelRender/TuoZhiTag.vue diff --git a/klp-ui/src/api/system/oss.js b/klp-ui/src/api/system/oss.js index 8a7317dd..2ea46c6b 100644 --- a/klp-ui/src/api/system/oss.js +++ b/klp-ui/src/api/system/oss.js @@ -27,3 +27,16 @@ export function delOss(ossId) { }) } +/** + * 上传文件 + */ +export function uploadFile(file) { + const form = new FormData() + form.append('file', file) + return request({ + url: '/system/oss/upload', + method: 'post', + data: form, + }) +} + diff --git a/klp-ui/src/api/wms/coil.js b/klp-ui/src/api/wms/coil.js index 8df7af39..1a1af730 100644 --- a/klp-ui/src/api/wms/coil.js +++ b/klp-ui/src/api/wms/coil.js @@ -1,4 +1,5 @@ import request from '@/utils/request' +import { tansParams } from "@/utils/klp"; // 查询钢卷物料表列表 export function listMaterialCoil(query) { @@ -348,12 +349,15 @@ export function categoryWidthStatistics() { } /** - * 钢卷被退货,发给客户的钢卷被退货 + * 导出钢卷的全部字段 */ export function exportCoilWithAll(data) { return request({ url: '/wms/materialCoil/exportAll', method: 'post', - data + data: data, + transformRequest: [(params) => { return tansParams(params) }], + headers: { 'Content-Type': 'application/x-www-form-urlencoded' }, + responseType: 'blob' }) } \ No newline at end of file diff --git a/klp-ui/src/views/wms/coil/panels/LabelRender/TuoZhiTag.vue b/klp-ui/src/views/wms/coil/panels/LabelRender/TuoZhiTag.vue new file mode 100644 index 00000000..44411cc1 --- /dev/null +++ b/klp-ui/src/views/wms/coil/panels/LabelRender/TuoZhiTag.vue @@ -0,0 +1,291 @@ + + + + + \ No newline at end of file diff --git a/klp-ui/src/views/wms/coil/panels/LabelRender/index.vue b/klp-ui/src/views/wms/coil/panels/LabelRender/index.vue index e66a6a5d..46561660 100644 --- a/klp-ui/src/views/wms/coil/panels/LabelRender/index.vue +++ b/klp-ui/src/views/wms/coil/panels/LabelRender/index.vue @@ -38,6 +38,12 @@ :paperWidthMm="180" :paperHeightMm="100" /> + @@ -61,6 +67,8 @@ import GalvanizedTag from './GalvanizedTag.vue'; import WhereTag from './WhereTag.vue'; import ZincRawTag from './ZincRawTag.vue'; import DuGeTag from './DuGeTag.vue'; +import TuoZhiTag from './TuoZhiTag.vue'; + // import SampleTagPreview from './SampleTagPreview.vue'; // import ForgeTagPreview from './ForgeTagPreview.vue'; @@ -75,6 +83,7 @@ export default { WhereTag, ZincRawTag, DuGeTag, + TuoZhiTag, // SampleTagPreview, // ForgeTagPreview, // SaltSprayTagPreview, @@ -107,6 +116,10 @@ export default { width: 180, height: 100, }, + '6': { + width: 180, + height: 100, + }, } } }, @@ -143,6 +156,10 @@ export default { // 在镀锌颜料库的卷使用镀锌原料标签 if (itemType == 'raw_material' && (warehouseId == '1988150263284953089' || warehouseId == '1988150487185289217')) { this.labelType = '5'; + } + // 脱脂原料库 + else if (itemType == 'raw_material' && (warehouseId == '1988150545175736322')) { + this.labelType = '6'; } else if (itemType == 'raw_material') { this.labelType = '2'; } else if (itemType == 'product' && itemName == '冷硬卷') { diff --git a/klp-ui/src/views/wms/coil/panels/base.vue b/klp-ui/src/views/wms/coil/panels/base.vue index d25dce86..9e947beb 100644 --- a/klp-ui/src/views/wms/coil/panels/base.vue +++ b/klp-ui/src/views/wms/coil/panels/base.vue @@ -410,7 +410,6 @@ import { cancelExportCoil, checkCoilNo, returnCoil, - exportCoilWithAll } from "@/api/wms/coil"; import { listBoundCoil } from "@/api/wms/deliveryWaybillDetail"; import WarehouseSelect from "@/components/KLPService/WarehouseSelect"; @@ -807,7 +806,12 @@ export default { // 在镀锌颜料库的卷使用镀锌原料标签 if (itemType == 'raw_material' && (warehouseId == '1988150263284953089' || warehouseId == '1988150487185289217')) { this.labelRender.type = '5'; - } else if (itemType == 'raw_material') { + } + // 脱脂原料库 + else if (itemType == 'raw_material' && (warehouseId == '1988150545175736322')) { + this.labelRender.type = '6'; + } + else if (itemType == 'raw_material') { this.labelRender.type = '2'; } else if (itemType == 'product' && itemName == '冷硬卷') { this.labelRender.type = '3'; @@ -1060,7 +1064,7 @@ export default { const res = await listBoundCoil(query) coilIds = res.rows.map(item => item.coilId).join(',') this.loading = false - this.download('wms/deliveryWaybill/export', { + this.download('/wms/materialCoil/exportDelivery', { coilIds, }, 'coil.xlsx') } else { @@ -1071,8 +1075,6 @@ export default { coilIds, }, 'coil.xlsx') } - - }, handleCheck(row) { this.isCheck = true; diff --git a/klp-ui/src/views/wms/coil/panels/do.vue b/klp-ui/src/views/wms/coil/panels/do.vue index f493e49e..9ea0ca1e 100644 --- a/klp-ui/src/views/wms/coil/panels/do.vue +++ b/klp-ui/src/views/wms/coil/panels/do.vue @@ -577,6 +577,10 @@ export default { width: 180, height: 100, }, + '6': { + width: 180, + height: 100, + }, }, stepSpilt: { list: [], @@ -663,7 +667,12 @@ export default { // 在镀锌颜料库的卷使用镀锌原料标签 if (itemType == 'raw_material' && (warehouseId == '1988150263284953089' || warehouseId == '1988150487185289217')) { this.labelRender.type = '5'; - } else if (itemType == 'raw_material') { + } + // 脱脂原料库 + else if (itemType == 'raw_material' && (warehouseId == '1988150545175736322')) { + this.labelRender.type = '6'; + } + else if (itemType == 'raw_material') { this.labelRender.type = '2'; } else if (itemType == 'product' && itemName == '冷硬卷') { this.labelRender.type = '3'; diff --git a/klp-ui/src/views/wms/coil/perspective/components/LeftList.vue b/klp-ui/src/views/wms/coil/perspective/components/LeftList.vue index 185c4119..97aa1690 100644 --- a/klp-ui/src/views/wms/coil/perspective/components/LeftList.vue +++ b/klp-ui/src/views/wms/coil/perspective/components/LeftList.vue @@ -17,6 +17,9 @@ 新增 + + 刷新 + @@ -32,11 +35,16 @@
{{ item.statType }} -
+
-
{{ item.title }}
- +
+ {{ item.title }} + +
+
+ {{ item.createBy }} + {{ item.createTime }} +
@@ -261,6 +269,7 @@ export default { .item-content { flex: 1; display: flex; + align-items: flex-start; gap: 5px; } diff --git a/klp-ui/src/views/wms/coil/perspective/index.vue b/klp-ui/src/views/wms/coil/perspective/index.vue index fdc1742b..5bda6cf1 100644 --- a/klp-ui/src/views/wms/coil/perspective/index.vue +++ b/klp-ui/src/views/wms/coil/perspective/index.vue @@ -5,7 +5,11 @@ - + +
    +
  • 下载明细
  • +
@@ -17,9 +21,21 @@ - - - 保存 + +
+ 保存 + + 保存透视表时保存明细,勾选后在保存时会消耗更长的时间且会占用更多内存和存储 +
+
+
+ +
+
+
钢卷生产统计详情
+
+
@@ -30,7 +46,8 @@ import LeftList from "./components/LeftList.vue"; import Preview from "@/views/wms/coil/panels/Perspective/index.vue"; import { listRawMaterialPerspective } from "@/api/wms/rawMaterial"; -import { listCoilTrimStatistics, categoryWidthStatistics } from "@/api/wms/coil"; +import { uploadFile } from "@/api/system/oss"; +import { listCoilTrimStatistics, categoryWidthStatistics, listMaterialCoil, exportCoilWithAll } from "@/api/wms/coil"; export default { name: "CoilStatisticsSummary", @@ -67,6 +84,7 @@ export default { title: undefined, statType: undefined, }, + saveDetail: false, // 表单参数 form: {}, // 表单校验 @@ -171,19 +189,97 @@ export default { } this.previewLoading = false; }, - handleSave() { - addCoilStatisticsSummary({ - ...this.form, - statJson: JSON.stringify(this.liveData) - }).then(response => { + async handleSave() { + const loading = this.$loading({ + lock: true, + text: '保存中...', + background: 'rgba(0, 0, 0, 0.7)' + }) + try { + this.buttonLoading = true; + + const { data: summary } = await addCoilStatisticsSummary({ + ...this.form, + statJson: JSON.stringify(this.liveData) + }) + + if (this.saveDetail) { + // 获取原始数据,组装coilIds, + let coilIds = '' + if (this.form.statType == '热轧原料') { + const { rows: coils } = await listMaterialCoil({ + pageNum: 1, + pageSize: 9999, + selectType: 'raw_material', + dataType: 1, + status: 0, + itemName: '热轧卷板', + itemType: 'raw_material', + }) + coilIds = coils.map(item => item.coilId).join(',') + } else if (this.form.statType == '冷硬卷板') { + const { rows: coils1 } = await listMaterialCoil({ + pageNum: 1, + pageSize: 9999, + selectType: 'raw_material', + dataType: 1, + status: 0, + itemName: '冷硬卷', + itemType: 'raw_material', + }) + const { rows: coils2 } = await listCoilTrimStatistics({ + pageNum: 1, + pageSize: 9999, + selectType: 'product', + dataType: 1, + status: 0, + itemName: '冷硬卷', + itemType: 'raw_material', + }) + coilIds = coils1.concat(coils2).map(item => item.coilId).join(',') + } else if (this.form.statType == '汇总') { + const { rows: coils } = await listMaterialCoil({ + pageNum: 1, + pageSize: 9999, + dataType: 1, + status: 0, + }) + coilIds = coils.map(item => item.coilId).join(',') + } + + // 使用exportCoilWithAll接口传入coilIds获取二进制文件数据 + const response = await exportCoilWithAll({ + coilIds: coilIds, + }) + const file = new Blob([response], { type: 'application/vnd.ms-excel' }) + const fileName = this.form.statType + '明细.xlsx' + // 通过new File构建出excel文件 + const excelFile = new File([file], fileName, { type: 'application/vnd.ms-excel' }) + + console.log(excelFile) + // 上传文件到minio + const uploadResponse = await uploadFile(excelFile) + console.log(uploadResponse) + + // 关联附件信息 + await updateCoilStatisticsSummary({ + ...summary, + attachmentInfo: uploadResponse.data.ossId, + }); + } this.$modal.msgSuccess("新增成功"); this.open = false; + this.previewOpen = false; this.liveData = []; this.form = {}; this.$refs.leftList.getList(); - }).finally(() => { + } finally { this.buttonLoading = false; - }); + loading.close(); + } + }, + handleDownload(row) { + this.$download.oss(row.attachmentInfo) }, /** 修改按钮操作 */ handleUpdate(row) { From da2caa1c4643d454b46574abcccde494f09d7780 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A0=82=E7=B3=96?= Date: Tue, 10 Mar 2026 16:18:21 +0800 Subject: [PATCH 2/2] =?UTF-8?q?fix(wms):=20=E4=BF=AE=E5=A4=8D=E9=80=8F?= =?UTF-8?q?=E8=A7=86=E8=A1=A8=E6=95=B0=E6=8D=AE=E5=B1=95=E7=A4=BA=E5=92=8C?= =?UTF-8?q?=E8=BE=B9=E6=96=99=E7=BB=9F=E8=AE=A1=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修复透视表预览条件判断错误,将currentRow.summaryId改为liveData 修正边料统计接口调用错误,将listCoilTrimStatistics改为listMaterialCoil 添加可选链操作符处理可能为null的数据遍历 --- .../panels/Perspective/TrimStatistics.vue | 30 +++++++++---------- .../src/views/wms/coil/perspective/index.vue | 6 ++-- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/klp-ui/src/views/wms/coil/panels/Perspective/TrimStatistics.vue b/klp-ui/src/views/wms/coil/panels/Perspective/TrimStatistics.vue index f48d591f..304707a5 100644 --- a/klp-ui/src/views/wms/coil/panels/Perspective/TrimStatistics.vue +++ b/klp-ui/src/views/wms/coil/panels/Perspective/TrimStatistics.vue @@ -92,8 +92,8 @@ export default { // 提取净边料所有原始宽度 rawTrimmedWidths() { const widthSet = new Set(); - this.data.forEach(item => { - item.trimmedList.forEach(trimmed => { + this.data?.forEach(item => { + item.trimmedList?.forEach(trimmed => { if (trimmed.width) widthSet.add(trimmed.width); }); }); @@ -108,8 +108,8 @@ export default { // 提取毛边料所有原始宽度 rawUntrimmedWidths() { const widthSet = new Set(); - this.data.forEach(item => { - item.untrimmedList.forEach(untrimmed => { + this.data?.forEach(item => { + item.untrimmedList?.forEach(untrimmed => { if (untrimmed.width) widthSet.add(untrimmed.width); }); }); @@ -132,25 +132,25 @@ export default { }; // 初始化净边料分组数据 - this.trimmedWidthGroups.forEach(group => { + this.trimmedWidthGroups?.forEach(group => { row[`trimmed_${group.key}_count`] = 0; row[`trimmed_${group.key}_weight`] = 0; }); // 初始化毛边料分组数据 - this.untrimmedWidthGroups.forEach(group => { + this.untrimmedWidthGroups?.forEach(group => { row[`untrimmed_${group.key}_count`] = 0; row[`untrimmed_${group.key}_weight`] = 0; }); // 处理净边料数据(按分组求和) - item.trimmedList.forEach(trimmed => { + item.trimmedList?.forEach(trimmed => { const width = trimmed.width; const count = Number(trimmed.coilCount) || 0; const weight = Number(trimmed.totalWeight) || 0; // 找到宽度所属的分组并累加 - this.trimmedWidthGroups.forEach(group => { + this.trimmedWidthGroups?.forEach(group => { if (group.includesWidth(width)) { row[`trimmed_${group.key}_count`] += count; row[`trimmed_${group.key}_weight`] = (row[`trimmed_${group.key}_weight`] + weight).toFixed(3); @@ -163,13 +163,13 @@ export default { }); // 处理毛边料数据(按分组求和) - item.untrimmedList.forEach(untrimmed => { + item.untrimmedList?.forEach(untrimmed => { const width = untrimmed.width; const count = Number(untrimmed.coilCount) || 0; const weight = Number(untrimmed.totalWeight) || 0; // 找到宽度所属的分组并累加 - this.untrimmedWidthGroups.forEach(group => { + this.untrimmedWidthGroups?.forEach(group => { if (group.includesWidth(width)) { row[`untrimmed_${group.key}_count`] += count; row[`untrimmed_${group.key}_weight`] = (row[`untrimmed_${group.key}_weight`] + weight).toFixed(3); @@ -202,7 +202,7 @@ export default { // 检查净边料分组列 if (!hasNonZeroData) { - this.trimmedWidthGroups.forEach(group => { + this.trimmedWidthGroups?.forEach(group => { if (Number(row[`trimmed_${group.key}_count`]) > 0 || Number(row[`trimmed_${group.key}_weight`]) > 0) { hasNonZeroData = true; } @@ -211,7 +211,7 @@ export default { // 检查毛边料分组列 if (!hasNonZeroData) { - this.untrimmedWidthGroups.forEach(group => { + this.untrimmedWidthGroups?.forEach(group => { if (Number(row[`untrimmed_${group.key}_count`]) > 0 || Number(row[`untrimmed_${group.key}_weight`]) > 0) { hasNonZeroData = true; } @@ -229,7 +229,7 @@ export default { const usedWidths = new Set(); // 遍历分组规则,匹配原始宽度 - Object.entries(this.widthGroupRules).forEach(([groupLabel, widthList]) => { + Object.entries(this.widthGroupRules)?.forEach(([groupLabel, widthList]) => { // 筛选出当前分组包含的原始宽度 const matchedWidths = rawWidths.filter(width => widthList.includes(width)); if (matchedWidths.length === 0) return; @@ -246,11 +246,11 @@ export default { }); // 标记已使用的宽度 - matchedWidths.forEach(width => usedWidths.add(width)); + matchedWidths?.forEach(width => usedWidths.add(width)); }); // 处理未匹配到分组的宽度(单独成组) - rawWidths.forEach(width => { + rawWidths?.forEach(width => { if (!usedWidths.has(width)) { const groupKey = width.replace(/[^a-zA-Z0-9]/g, '_'); groups.push({ diff --git a/klp-ui/src/views/wms/coil/perspective/index.vue b/klp-ui/src/views/wms/coil/perspective/index.vue index 5bda6cf1..949336c3 100644 --- a/klp-ui/src/views/wms/coil/perspective/index.vue +++ b/klp-ui/src/views/wms/coil/perspective/index.vue @@ -29,7 +29,7 @@ label="orderBy">保存透视表时保存明细,勾选后在保存时会消耗更长的时间且会占用更多内存和存储
-
+
@@ -227,14 +227,14 @@ export default { itemName: '冷硬卷', itemType: 'raw_material', }) - const { rows: coils2 } = await listCoilTrimStatistics({ + const { rows: coils2 } = await listMaterialCoil({ pageNum: 1, pageSize: 9999, selectType: 'product', dataType: 1, status: 0, itemName: '冷硬卷', - itemType: 'raw_material', + itemType: 'product', }) coilIds = coils1.concat(coils2).map(item => item.coilId).join(',') } else if (this.form.statType == '汇总') {