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/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/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..949336c3 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 listMaterialCoil({ + pageNum: 1, + pageSize: 9999, + selectType: 'product', + dataType: 1, + status: 0, + itemName: '冷硬卷', + itemType: 'product', + }) + 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) {