From d764b855f4ff69056fc0e2a380ca5d1f86f33aa5 Mon Sep 17 00:00:00 2001 From: Aoi_Tori <2547614904@qq.com> Date: Tue, 26 Aug 2025 12:37:22 +0800 Subject: [PATCH] 2025/8/26 --- src/views/modules/part/quicklyCreateBom.vue | 1231 +++++++++++++++++-- 1 file changed, 1110 insertions(+), 121 deletions(-) diff --git a/src/views/modules/part/quicklyCreateBom.vue b/src/views/modules/part/quicklyCreateBom.vue index 076b9c5..f4262f7 100644 --- a/src/views/modules/part/quicklyCreateBom.vue +++ b/src/views/modules/part/quicklyCreateBom.vue @@ -227,7 +227,7 @@
- 复制属性 + copy {{ attributeFlag ? '编辑' : '保存' }}
@@ -648,7 +648,6 @@ - 更改版本 + + + + + + + +
+
+
+ 目标物料 + 新物料 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ 被复制的物料 + + + 物料编码 + + + + + + + + + + + + + + + + + + + + + + + + + 复制BOM + 复制Routing + + +
+
+
+ 版本信息 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + 保存 + 关闭 + +
+ + + + + + + + + + + + 查询 + + + + + + + + + + + + 关闭 + + + @@ -989,7 +1293,7 @@ import { getPartItem, partInfoByMainPart, queryPartItem, - getItemLists, batchSavePartInfo, addPartsItem, batchUpdateCodeNo, deletePartsItem, commitItemsValue + getItemLists, batchSavePartInfo, addPartsItem, batchUpdateCodeNo, deletePartsItem, commitItemsValue, getCopyRowData } from "../../../api/part/partInformation"; import {getChooselist1} from "../../../api/chooselist/chooselist"; import { @@ -1003,8 +1307,8 @@ import { } from "../../../api/part/quicklyCreateBom"; import {getSiteAndBuByUserName} from "../../../api/qc/qc"; import Data from "lodash"; -import {queryBomDetail} from "../../../api/part/bomManagement"; -import {queryRoutingDetail} from "../../../api/part/routingManagement"; +import {copyBom, queryBomDetail, queryPartList} from "../../../api/part/bomManagement"; +import {copyRouting, queryRoutingDetail} from "../../../api/part/routingManagement"; export default { components: { PartCreate, @@ -1045,6 +1349,22 @@ export default { } } }, + 'bomCurrentRow1': { + deep: true, + handler: function (newV, oldV) { + if (newV) { + this.routingCurrentRow1 = null + } + } + }, + 'routingCurrentRow1': { + deep: true, + handler: function (newV, oldV) { + if (newV) { + this.bomCurrentRow1 = null + } + } + }, batchUpdateFlag: { handler: function (newV, oldV) { if (newV===false) { @@ -1092,6 +1412,42 @@ export default { item.formula = this.getFormula(item.operationName) }) } + }, + 'routingComponentPartList1': { + deep: true, + handler: function (newV, oldV) { + newV.forEach(item => { + item.formula = this.getFormula(item.operationName) + }) + } + }, + 'copyVisible': { + deep: true, + handler: function (newV, oldV) { + if (!newV) { + this.copyData = { + flag: '', + site: this.$store.state.user.site, + partNo: '', + partDesc: '', + previousVersion: {}, + nodeFlag: false, + mainPart: '', + nodeId: '', + engChgLevel: null, + bomFlag: 'N', + routingFlag: 'N', + page: 1, + limit: 10 + } + this.bomComponentList1 = [] + this.routingComponentList1 = [] + this.bomComponentPartList1 = [] + this.routingComponentPartList1 = [] + this.handleBatchUpdatePart() + this.getRevisionInfo() + } + } } }, data () { @@ -1135,6 +1491,9 @@ export default { pageIndex3: 1, pageSize3: 20, totalPage3: 0, + pageIndex4: 1, + pageSize4: 20, + totalPage4: 0, partList: [], partList1: [], codeList: [], @@ -1143,10 +1502,59 @@ export default { itemList1: [], itemList2: [], bomComponentPartList: [], + bomComponentPartList1: [], routingComponentPartList: [], + routingComponentPartList1: [], bomComponentList: [], + bomComponentList1: [], routingComponentList: [], + routingComponentList1: [], + copyPartList: [], previousCodeNo: '', + rules: { + buNo:[ + { + required: true, + message: ' ', + trigger: ['blur', 'change'] + } + ], + partDesc: [ + { + required: true, + message: ' ', + trigger: ['blur', 'change'] + } + ], + bomType: [ + { + required: true, + message: ' ', + trigger: ['blur', 'change'] + } + ], + routingType: [ + { + required: true, + message: ' ', + trigger: ['blur', 'change'] + } + ], + effPhaseOutDate: [ + { + required: true, + message: ' ', + trigger: ['blur', 'change'] + } + ], + effPhaseInDate: [ + { + required: true, + message: ' ', + trigger: ['blur', 'change'] + } + ], + }, searchData: { site: '', buNo: '', @@ -1190,6 +1598,37 @@ export default { page: 1, limit: 10 }, + copyData: { + flag: '', + site: this.$store.state.user.site, + partNo: '', + partDesc: '', + umId2: null, + productGroupId1: null, + productGroupId2: null, + productGroupId3: null, + codeNo: null, + familyID: null, + partType2: null, + previousVersion: {}, + nodeFlag: false, + mainPart: '', + nodeId: '', + engChgLevel: null, + active: '', + createBy: '', + routingFlag: 'N', + bomFlag: 'N', + page: 1, + limit: 10 + }, + copyModalData: { + site: '', + partNo: '', + partDesc: '', + page: 1, + limit: 10 + }, nodeRules:{ nodeId:[ { @@ -1224,15 +1663,45 @@ export default { currentNode: {}, partCurrentRow: {}, bomCurrentRow: {}, + bomCurrentRow1: {}, routingCurrentRow: {}, + routingCurrentRow1: {}, partCurrentRowIndex: -1, columnList: [ { userId: this.$store.state.user.name, - columnProp: 'Family', + columnProp: 'family1', + headerAlign: 'left', + align: 'left', + columnLabel: 'Family1', + columnHidden: false, + columnImage: false, + columnSortable: false, + sortLv: 0, + status: true, + fixed: '', + columnWidth: 50 + }, + { + userId: this.$store.state.user.name, + columnProp: 'family2', + headerAlign: 'left', + align: 'left', + columnLabel: 'Family2', + columnHidden: false, + columnImage: false, + columnSortable: false, + sortLv: 0, + status: true, + fixed: '', + columnWidth: 50 + }, + { + userId: this.$store.state.user.name, + columnProp: 'bondingPitch', headerAlign: 'left', align: 'left', - columnLabel: 'Family', + columnLabel: 'Bonding Pitch', columnHidden: false, columnImage: false, columnSortable: false, @@ -1243,10 +1712,24 @@ export default { }, { userId: this.$store.state.user.name, - columnProp: 'Orientation', + columnProp: 'bondingLanes', headerAlign: 'left', align: 'left', - columnLabel: 'Orientation', + columnLabel: '绑定列数', + columnHidden: false, + columnImage: false, + columnSortable: false, + sortLv: 0, + status: true, + fixed: '', + columnWidth: 50 + }, + { + userId: this.$store.state.user.name, + columnProp: 'printingLanes', + headerAlign: 'left', + align: 'left', + columnLabel: 'Printing lanes', columnHidden: false, columnImage: false, columnSortable: false, @@ -1257,10 +1740,10 @@ export default { }, { userId: this.$store.state.user.name, - columnProp: 'Lanes', + columnProp: 'uph-tal', headerAlign: 'left', align: 'left', - columnLabel: 'Lanes', + columnLabel: 'UPH-TAL', columnHidden: false, columnImage: false, columnSortable: false, @@ -1271,10 +1754,10 @@ export default { }, { userId: this.$store.state.user.name, - columnProp: 'WebWidth', + columnProp: 'uph-paris', headerAlign: 'left', - align: 'right', - columnLabel: 'Web width', + align: 'left', + columnLabel: 'UPH-Paris', columnHidden: false, columnImage: false, columnSortable: false, @@ -1285,10 +1768,38 @@ export default { }, { userId: this.$store.state.user.name, - columnProp: 'PrintingLanes', + columnProp: 'cl60k-up', headerAlign: 'left', - align: 'right', - columnLabel: 'Printing lanes', + align: 'left', + columnLabel: 'CL60K-UP', + columnHidden: false, + columnImage: false, + columnSortable: false, + sortLv: 0, + status: true, + fixed: '', + columnWidth: 80 + }, + { + userId: this.$store.state.user.name, + columnProp: 'cl60k-pitch', + headerAlign: 'left', + align: 'left', + columnLabel: 'CL60K-Pitch', + columnHidden: false, + columnImage: false, + columnSortable: false, + sortLv: 0, + status: true, + fixed: '', + columnWidth: 80 + }, + { + userId: this.$store.state.user.name, + columnProp: 'cl60k-cd', + headerAlign: 'left', + align: 'left', + columnLabel: 'CL60K-CD', columnHidden: false, columnImage: false, columnSortable: false, @@ -1299,10 +1810,52 @@ export default { }, { userId: this.$store.state.user.name, - columnProp: 'BodingPitch', + columnProp: 'compositeLanes', + headerAlign: 'left', + align: 'left', + columnLabel: '复合列数', + columnHidden: false, + columnImage: false, + columnSortable: false, + sortLv: 0, + status: true, + fixed: '', + columnWidth: 50 + }, + { + userId: this.$store.state.user.name, + columnProp: 'labelingLanes', + headerAlign: 'left', + align: 'left', + columnLabel: '贴标列数', + columnHidden: false, + columnImage: false, + columnSortable: false, + sortLv: 0, + status: true, + fixed: '', + columnWidth: 50 + }, + { + userId: this.$store.state.user.name, + columnProp: 'inspectionLanes', + headerAlign: 'left', + align: 'left', + columnLabel: '检测列数', + columnHidden: false, + columnImage: false, + columnSortable: false, + sortLv: 0, + status: true, + fixed: '', + columnWidth: 50 + }, + { + userId: this.$store.state.user.name, + columnProp: 'finalInspection-uph', headerAlign: 'left', - align: 'right', - columnLabel: 'Boding Pitch', + align: 'left', + columnLabel: '后道检品-UPH', columnHidden: false, columnImage: false, columnSortable: false, @@ -1313,10 +1866,10 @@ export default { }, { userId: this.$store.state.user.name, - columnProp: 'BondingLanes', + columnProp: 'coding-uph', headerAlign: 'left', - align: 'right', - columnLabel: 'Bonding lanes', + align: 'left', + columnLabel: '编码-UPH', columnHidden: false, columnImage: false, columnSortable: false, @@ -1327,10 +1880,10 @@ export default { }, { userId: this.$store.state.user.name, - columnProp: 'ConvertingUp', + columnProp: 'codingPrinting-uph', headerAlign: 'left', - align: 'right', - columnLabel: 'Converting up', + align: 'left', + columnLabel: '编码打印-UPH', columnHidden: false, columnImage: false, columnSortable: false, @@ -1338,7 +1891,7 @@ export default { status: true, fixed: '', columnWidth: 80 - } + }, ], partColumnList1: [ { @@ -2432,28 +2985,88 @@ export default { columnWidth: 120 }, ], - // 控制 - nodeModalFlag: false, - nodeModalDisableFlag: false, - partModelFlag: false, - buildAllLoading: false, - resetAllLoading: false, - bomLoading: false, - routingLoading: false, - treeVisible: false, - addNodeFlag: true, - batchUpdateFlag: false, - attributeFlag: true, - attributeFlag1: true, - attributeFlag2: true, - fastAddFlag: false, - fastAddFlag1: false, - loading: false, - addItemLoading: false, - deleteItemLoading: false, + componentPartColumnList: [ + { + columnProp: 'partNo', + headerAlign: "center", + align: "center", + columnLabel: '物料编码', + columnHidden: false, + columnImage: false, + status: true, + fixed: '', + columnWidth: 120 + }, + { + columnProp: 'partDesc', + headerAlign: "center", + align: "center", + columnLabel: '物料名称', + columnHidden: false, + columnImage: false, + status: true, + fixed: '', + columnWidth: 300 + }, + { + columnProp: 'spec', + headerAlign: "center", + align: "center", + columnLabel: '规格型号', + columnHidden: false, + columnImage: false, + status: true, + fixed: '', + columnWidth: 300 + }, + { + columnProp: 'printUnitName', + headerAlign: "center", + align: "center", + columnLabel: '计量单位', + columnHidden: false, + columnImage: false, + status: true, + fixed: '', + columnWidth: 100 + }, + { + columnProp: 'partType2', + headerAlign: "center", + align: "center", + columnLabel: '零件类型', + columnHidden: false, + columnImage: false, + status: true, + fixed: '', + columnWidth: 100 + } + ], + // 控制 + nodeModalFlag: false, + nodeModalDisableFlag: false, + partModelFlag: false, + buildAllLoading: false, + resetAllLoading: false, + bomLoading: false, + routingLoading: false, + treeVisible: false, + addNodeFlag: true, + batchUpdateFlag: false, + attributeFlag: true, + attributeFlag1: true, + attributeFlag2: true, + fastAddFlag: false, + fastAddFlag1: false, + loading: false, + addItemLoading: false, + deleteItemLoading: false, buNoQueryLoading: false, alternativeLoading: false, - bomFlag: true + bomFlag: true, + bomFlag1: true, + copyVisible: false, + copyPartModelFlag: false } }, created () { @@ -2508,7 +3121,7 @@ export default { } getNodeTree(tempData).then(({data}) => { if (data && data.code === 0) { - this.treeData = data.rows + this.$set(this, 'treeData', data.rows) } if (this.batchUpdateFlag){ this.handleBatchUpdatePart() @@ -3074,22 +3687,57 @@ export default { getPartItem(tempData).then(({data}) => { if (data && data.code === 0 && data.rows.length > 0) { for (let i = 0; i < data.rows.length; i++) { - if (data.rows[i].itemDesc === 'Family1'){ - this.$set(this.dataList[0], 'Family', data.rows[i].textValue); - } else if (data.rows[i].itemDesc === 'Family2'){ - this.$set(this.dataList[0], 'Orientation', data.rows[i].textValue); - } else if (data.rows[i].itemDesc === 'Lanes0 web'){ - this.$set(this.dataList[0], 'Lanes', data.rows[i].textValue); - } else if (data.rows[i].itemDesc === 'Lamination width'){ - this.$set(this.dataList[0], 'WebWidth', data.rows[i].textValue); - } else if (data.rows[i].itemDesc === 'Printing lanes'){ - this.$set(this.dataList[0], 'PrintingLanes', data.rows[i].numValue); - } else if (data.rows[i].itemDesc === 'Bonding Pitch'){ - this.$set(this.dataList[0], 'BodingPitch', data.rows[i].numValue); - } else if (data.rows[i].itemDesc === '绑定列数'){ - this.$set(this.dataList[0], 'BondingColumns', data.rows[i].numValue); - } else if (data.rows[i].itemDesc === 'CL60k-UP'){ - this.$set(this.dataList[0], 'ConvertingUp', data.rows[i].textValue); + const itemDesc = data.rows[i].itemDesc; + const value = data.rows[i].numValue ? data.rows[i].numValue : data.rows[i].textValue; + switch (itemDesc) { + case 'Family1': + this.$set(this.dataList[0], 'family1', value); + break; + case 'Family2': + this.$set(this.dataList[0], 'family2', value); + break; + case 'Bonding Pitch': + this.$set(this.dataList[0], 'bondingPitch', value); + break; + case '绑定列数': + this.$set(this.dataList[0], 'bondingLanes', value); + break; + case 'Printing lanes': + this.$set(this.dataList[0], 'printingLanes', value); + break; + case 'UPH-TAL': + this.$set(this.dataList[0], 'uph-tal', value); + break; + case 'UPH-Paris': + this.$set(this.dataList[0], 'uph-paris', value); + break; + case 'CL60k-UP': + this.$set(this.dataList[0], 'cl60k-up', value); + break; + case 'CL60k-Pitch': + this.$set(this.dataList[0], 'cl60k-pitch', value); + break; + case 'CL60k-CD': + this.$set(this.dataList[0], 'cl60k-cd', value); + break; + case '复合列数': + this.$set(this.dataList[0], 'compositeLanes', value); + break; + case '贴标列数': + this.$set(this.dataList[0], 'labelingLanes', value); + break; + case '检测列数': + this.$set(this.dataList[0], 'inspectionLanes', value); + break; + case '后道检品-UPH': + this.$set(this.dataList[0], 'finalInspection-uph', value); + break; + case '编码-UPH': + this.$set(this.dataList[0], 'coding-uph', value); + break; + case '编码打印-UPH': + this.$set(this.dataList[0], 'codingPrinting-uph', value); + break; } } } else { @@ -3192,6 +3840,63 @@ export default { } }, + getRevisionInfo1(row){ + let tempData = { + site: row.site, + buNo: row.buNo, + mainPart: this.searchData.partNo, + partNo: row.partNo, + partDesc: row.partDesc, + printUnit: row.umId2, + printUnitName: row.umName, + bomType: 'Manufacturing', + routingType: 'Manufacturing', + offFlag: '2' + } + this.$nextTick(() => { + getBomInformationListByPartNo(tempData).then(({data}) => { + if (data && data.code === 0) { + this.bomComponentList1 = [] + this.bomComponentPartList1 = [] + if (data.rows.length > 0) { + data.rows = data.rows.filter(item => item.partNo!==null&&item.partNo.length>0) + if (data.rows.length > 0) { + for (let i = 0; i < data.rows.length; i++) { + this.$set(data.rows[i], 'index', i) + this.$set(this.bomComponentList1, i, data.rows[i]) + this.queryBomDetail1(data.rows[i]) + } + } + } + } else { + this.$alert(data.msg, '提示', { + confirmButtonText: '确定' + }) + } + }) + getRoutingInformationListByPartNo(tempData).then(({data}) => { + if (data && data.code === 0) { + this.routingComponentList1 = [] + this.routingComponentPartList1 = [] + if (data.rows.length > 0) { + data.rows = data.rows.filter(item => item.partNo!==null&&item.partNo.length>0) + if (data.rows.length > 0) { + for (let i = 0; i < data.rows.length; i++) { + this.$set(data.rows[i], 'index', i) + this.$set(this.routingComponentList1, i, data.rows[i]) + this.queryRoutingDetail1(data.rows[i]) + } + } + } + } else { + this.$alert(data.msg, '提示', { + confirmButtonText: '确定' + }) + } + }) + }) + }, + handleBatchUpdatePart(){ if(this.treeData.length===0){ this.$message.warning('请先维护主物料的BOM模板!') @@ -3589,58 +4294,26 @@ export default { return { 'background-color': '#E8F7F6', cursor: 'pointer' }; }, + bomRowStyle1({row}){ + if(this.bomCurrentRow1&&row.engChgLevel===this.bomCurrentRow1.engChgLevel) + return { 'background-color': '#E8F7F6', cursor: 'pointer' }; + }, + routingRowStyle({row}){ if(this.routingCurrentRow&&row.routingRevision===this.routingCurrentRow.routingRevision) return { 'background-color': '#E8F7F6', cursor: 'pointer' }; }, + routingRowStyle1({row}){ + if(this.routingCurrentRow1&&row.routingRevision===this.routingCurrentRow1.routingRevision) + return { 'background-color': '#E8F7F6', cursor: 'pointer' }; + }, + partClickRow(row) { this.partCurrentRow = JSON.parse(JSON.stringify(row)) this.partCurrentRowIndex = this.partList1.indexOf(row) }, - copyInfo(){ - const index = this.partCurrentRowIndex - if(index > -1 && index < this.partList1.length - 1){ - const nextRow = this.partList1[index + 1] - if (nextRow.buNo!==this.partCurrentRow.buNo){ - this.$message.warning("当前选择行数据的BU与下一行的不同,只会复制计量单位和BOM模板!") - this.partList1[index+1].umId2 = this.partCurrentRow.umId2 - this.partList1[index+1].templateNo = this.partCurrentRow.templateNo - }else { - const excludeFields = ['buNo', 'nodeId', 'nodeName', 'site', 'partDesc', 'partNo']; - for (const key in this.partCurrentRow) { - if (!excludeFields.includes(key)) { - this.$set(nextRow, key, this.partCurrentRow[key]); - } - } - this.partList1[index + 1] = nextRow - } - batchSavePartInfo(this.partList1).then(({data}) => { - if (data && data.code === 0){ - this.handleBatchUpdatePart() - this.$message({ - message: '操作成功', - type: 'success', - duration: 1500, - onClose: () => {} - }) - this.attributeFlag = true - } else { - this.$alert(data.msg, '错误', { - confirmButtonText: '确定' - }) - this.handleBatchUpdatePart() - } - }) - - } else if (index === this.partList1.length) { - this.$message.warning("当前选择的是最后一行数据,无法复制!") - } else { - this.$message.warning("请先选择要复制的数据!") - } - }, - async handleEditInfo(){ if (this.attributeFlag===true){ this.getPropertiesList() @@ -3919,6 +4592,43 @@ export default { }) }, + queryBomDetail1(row) { + let tempData = { + flag: '2', + site: row.site, + buNo: row.buNo, + partNo: row.partNo, + partDesc: row.partDesc, + engChgLevel: row.engChgLevel, + bomType: row.bomType, + noteText: row.noteText, + effPhaseInDate: row.effPhaseInDate, + effPhaseOutDate: row.effPhaseOutDate, + engRevision: row.engRevision, + typeFlag: row.typeFlag, + netWeight: row.netWeight, + updateBy: this.$store.state.user.name, + printUnit: row.printUnit, + printUnitName: row.printUnitName, + alternativeNo: row.alternativeNo, + yieldRate: row.yieldRate, + shrinkageFactor: new Decimal(100).sub(new Decimal(row.yieldRate)).toNumber(), + processUnit: row.processUnit, + processUnitName: row.processUnitName + } + queryBomDetail(tempData).then(({data}) => { + if (data && data.code === 0) { + this.bomComponentPartList1 = data.rows.componentList + this.bomComponentList1[row.index] = { ...this.bomComponentList1[row.index], ...data.rows.detailData} + this.bomCurrentRow1 = JSON.parse(JSON.stringify(this.bomComponentList1[0])) + } else { + this.$alert(data.msg, '错误', { + confirmButtonText: '确定' + }) + } + }) + }, + queryRoutingDetail (row) { let tempData = { flag: '2', @@ -3952,6 +4662,39 @@ export default { }) }, + queryRoutingDetail1 (row) { + let tempData = { + flag: '2', + site: row.site, + buNo: row.buNo, + partNo: row.partNo, + partDesc: row.partDesc, + routingRevision: row.routingRevision, + routingType: row.routingType, + noteText: row.noteText, + phaseInDate: row.phaseInDate, + phaseOutDate: row.phaseOutDate, + engRevision: row.engRevision, + typeFlag: row.typeFlag, + netWeight: row.netWeight, + updateBy: this.$store.state.user.name, + printUnit: row.printUnit, + printUnitName: row.printUnitName, + alternativeNo: row.alternativeNo, + } + // 查routing明细 + queryRoutingDetail(tempData).then(({data}) => { + if (data && data.code === 0) { + this.routingComponentPartList1 = data.rows.componentList + this.routingComponentList1[row.index] = { ...this.routingComponentList1[row.index], ...data.rows.detailData} + } else { + this.$alert(data.msg, '错误', { + confirmButtonText: '确定' + }) + } + }) + }, + bomRowClick() { let tempData = { flag: '2', @@ -3988,11 +4731,52 @@ export default { }) }, + bomRowClick1() { + let tempData = { + flag: '2', + site: this.bomCurrentRow1.site, + buNo: this.bomCurrentRow1.buNo, + partNo: this.bomCurrentRow1.partNo, + partDesc: this.bomCurrentRow1.partDesc, + engChgLevel: this.bomCurrentRow1.engChgLevel, + bomType: this.bomCurrentRow1.bomType, + noteText: this.bomCurrentRow1.noteText, + effPhaseInDate: this.bomCurrentRow1.effPhaseInDate, + effPhaseOutDate: this.bomCurrentRow1.effPhaseOutDate, + engRevision: this.bomCurrentRow1.engRevision, + typeFlag: this.bomCurrentRow1.typeFlag, + netWeight: this.bomCurrentRow1.netWeight, + updateBy: this.$store.state.user.name, + printUnit: this.bomCurrentRow1.printUnit, + printUnitName: this.bomCurrentRow1.printUnitName, + alternativeNo: this.bomCurrentRow1.alternativeNo, + yieldRate: this.bomCurrentRow1.yieldRate, + shrinkageFactor: new Decimal(100).sub(new Decimal(this.bomCurrentRow1.yieldRate)).toNumber(), + processUnit: this.bomCurrentRow1.processUnit, + processUnitName: this.bomCurrentRow1.processUnitName + } + queryBomDetail(tempData).then(({data}) => { + if (data && data.code === 0) { + this.bomComponentPartList1 = data.rows.componentList + this.bomFlag1 = true + } else { + this.$alert(data.msg, '错误', { + confirmButtonText: '确定' + }) + } + }) + }, + bomInfoRowClick(row) { this.bomCurrentRow = JSON.parse(JSON.stringify(row)) this.bomRowClick() }, + bomInfoRowClick1(row) { + this.bomCurrentRow1 = JSON.parse(JSON.stringify(row)) + this.bomRowClick1() + }, + bomInfoTabClick() { if (this.bomComponentList.length>0){ if (!this.bomCurrentRow) { @@ -4002,6 +4786,15 @@ export default { } }, + bomInfoTabClick1() { + if (this.bomComponentList1.length>0){ + if (!this.bomCurrentRow1) { + this.bomCurrentRow1 = this.bomComponentList1[0] + } + this.bomRowClick1() + } + }, + bomInfoRowDblClick(row){ let tempData = { site: this.$store.state.user.site, @@ -4022,6 +4815,12 @@ export default { } }) }, + + bomInfoRowDblClick1(row){ + // this.copyData.previousVersion.engChgLevel = row.engChgLevel + this.$set(this.copyData.previousVersion, 'engChgLevel', row.engChgLevel) + }, + routingInfoRowDblClick(row){ let tempData = { site: this.$store.state.user.site, @@ -4043,11 +4842,20 @@ export default { }) }, + routingInfoRowDblClick1(row){ + this.copyData.previousVersion.routingRevision = row.routingRevision + }, + routingInfoRowClick(row) { this.routingCurrentRow = JSON.parse(JSON.stringify(row)) this.routingRowClick() }, + routingInfoRowClick1(row) { + this.routingCurrentRow1 = JSON.parse(JSON.stringify(row)) + this.routingRowClick1() + }, + routingInfoTabClick() { if (this.routingComponentList.length>0) { if (!this.routingCurrentRow) { @@ -4057,6 +4865,15 @@ export default { } }, + routingInfoTabClick1() { + if (this.routingComponentList1.length>0) { + if (!this.routingCurrentRow1) { + this.routingCurrentRow1 = this.routingComponentList1[0] + } + this.routingRowClick1() + } + }, + routingRowClick() { let tempData = { flag: '2', @@ -4090,6 +4907,39 @@ export default { }) }, + routingRowClick1() { + let tempData = { + flag: '2', + site: this.routingCurrentRow1.site, + buNo: this.routingCurrentRow1.buNo, + partNo: this.routingCurrentRow1.partNo, + partDesc: this.routingCurrentRow1.partDesc, + routingRevision: this.routingCurrentRow1.routingRevision, + routingType: this.routingCurrentRow1.routingType, + noteText: this.routingCurrentRow1.noteText, + phaseInDate: this.routingCurrentRow1.phaseInDate, + phaseOutDate: this.routingCurrentRow1.phaseOutDate, + engRevision: this.routingCurrentRow1.engRevision, + typeFlag: this.routingCurrentRow1.typeFlag, + netWeight: this.routingCurrentRow1.netWeight, + updateBy: this.$store.state.user.name, + printUnit: this.routingCurrentRow1.printUnit, + printUnitName: this.routingCurrentRow1.printUnitName, + alternativeNo: this.routingCurrentRow1.alternativeNo, + } + // 查routing明细 + queryRoutingDetail(tempData).then(({data}) => { + if (data && data.code === 0) { + this.routingComponentPartList1 = data.rows.componentList + this.bomFlag1 = false + } else { + this.$alert(data.msg, '错误', { + confirmButtonText: '确定' + }) + } + }) + }, + getFormula(value) { switch (value) { case '一复': case '熟化': case 'RFID前道检品': @@ -4141,13 +4991,13 @@ export default { }) }, - updateRevision() { - if(this.bomCurrentRow) { + updateRevision(row, type) { + if(type === 'bom') { let tempData = { site: this.$store.state.user.site, - partNo: this.bomCurrentRow.partNo, + partNo: row.partNo, mainPart: this.searchData.partNo, - engChgLevel: this.bomCurrentRow.engChgLevel, + engChgLevel: row.engChgLevel, routingRevision: this.partCurrentRow.routingRevision } setRevision(tempData).then(({data}) => { @@ -4161,13 +5011,13 @@ export default { }) } }) - } else if(this.routingCurrentRow) { + } else if(type === 'routing') { let tempData = { site: this.$store.state.user.site, - partNo: this.routingCurrentRow.partNo, + partNo: row.partNo, mainPart: this.searchData.partNo, engChgLevel: this.partCurrentRow.engChgLevel, - routingRevision: this.routingCurrentRow.routingRevision + routingRevision: row.routingRevision } setRevision(tempData).then(({data}) => { if (data && data.code === 0) { @@ -4180,17 +5030,156 @@ export default { }) } }) - } else { - this.$message({ - message: '请先选择BOM或Routing的版本', - type: 'warning', - duration: 1500, - onClose: () => {} + } + }, + + handleCopy() { + this.copyData.partNo = this.partCurrentRow.partNo + this.copyData.partDesc = this.partCurrentRow.partDesc + this.copyData.buNo = this.partCurrentRow.buNo + this.copyVisible = true + }, + + queryCopyPartModal () { + this.copyModalData.limit = this.pageSize4 + this.copyModalData.page = this.pageIndex4 + this.copyModalData.site = this.searchData.site + this.copyModalData.buNo = this.searchData.buNo + // 查询所有物料 + queryPartList(this.copyModalData).then(({data}) => { + if (data && data.code === 0) { + this.copyPartList = data.page.list + this.pageIndex4 = data.page.currPage + this.pageSize4 = data.page.pageSize + this.totalPage4 = data.page.totalCount + this.copyPartModelFlag = true + } else { + this.$alert(data.msg, '错误', { + confirmButtonText: '确定' + }) + } + }) + }, + + // 每页数 + sizeChangeHandle4 (val) { + this.pageSize4 = val + this.pageIndex4 = 1 + this.queryCopyPartModal() + }, + + // 当前页 + currentChangeHandle4 (val) { + this.pageIndex4 = val + this.queryCopyPartModal() + }, + + getCopyRowData(row) { + getCopyRowData(row).then(({data}) => { + if (data && data.code === 0) { + this.copyData.previousVersion = data.rows + this.getRevisionInfo1(data.rows) + this.copyPartModelFlag = false + } + }) + }, + + async copySave() { + if (!this.copyData.previousVersion.partNo) { + this.$message.warning('请先选择要复制的料号!') + return + } + let flag = true + if (!this.copyData.partNo||this.copyData.partNo==='') { + // 没有料号就先新建 + if (this.copyData.previousVersion.buNo !== this.copyData.buNo) { + this.$message.warning('所选的被复制的物料的BU和新物料的不一致!') + return + } + this.copyData.partNo = '*' + this.copyData.active = 'Y' + this.copyData.createBy = this.$store.state.user.name + this.copyData.mainPart = this.searchData.partNo + this.copyData.bu = this.$store.state.user.site + '_' + this.copyData.buNo + + this.copyData.partType2 = this.copyData.previousVersion.partType2 + this.copyData.umId2 = this.copyData.previousVersion.umId2 + this.copyData.productGroupId1 = this.copyData.previousVersion.productGroupId1 + this.copyData.productGroupId2 = this.copyData.previousVersion.productGroupId2 + this.copyData.productGroupId3 = this.copyData.previousVersion.productGroupId3 + this.copyData.familyID = this.copyData.previousVersion.familyID + this.copyData.codeNo = this.copyData.previousVersion.codeNo + + await savePartInfo(this.copyData).then(async ({data}) => { + if (data && data.code === 0) { + this.$set(this.partList1[this.partCurrentRowIndex], 'partNo', data.rows.partNo) + this.partList1[this.partCurrentRowIndex].mainPart = this.searchData.partNo + // 等待 updatePartNoOfNode 完成 + const {data: updateNodeData} = await updatePartNoOfNode(this.partList1[this.partCurrentRowIndex]); + if (updateNodeData && updateNodeData.code === 0) { + this.copyData.partNo = this.partList1[this.partCurrentRowIndex].partNo; + } else { + this.$message.error(data.msg); + flag = false; + } + } else { + this.$message.error(data.msg) + flag = false + } }) } - } + if (this.copyData.bomFlag&&this.copyData.bomFlag==='Y') { + this.copyData.previousVersion.noteText = this.bomCurrentRow1.noteText + this.copyData.previousVersion.engChgLevel = this.bomCurrentRow1.engChgLevel + this.copyData.previousVersion.bomType = this.bomCurrentRow1.bomType + await copyBom(this.copyData).then(({data}) => { + if (data && data.code === 0) { + this.$message({ + message: '操作成功', + type: 'success', + duration: 1500, + onClose: () => {} + }) + } else { + this.$alert(data.msg, '错误', { + confirmButtonText: '确定' + }) + flag = false + } + }).catch(()=>{ + flag = false + }) + } + if (this.copyData.routingFlag&&this.copyData.routingFlag==='Y') { + this.copyData.previousVersion.noteText = this.routingCurrentRow1.noteText + this.copyData.previousVersion.routingRevision = this.routingCurrentRow1.routingRevision + this.copyData.previousVersion.routingType = this.routingCurrentRow1.routingType + this.copyData.phaseInDate = this.copyData.effPhaseInDate + this.copyData.phaseOutDate = this.copyData.effPhaseOutDate + await copyRouting(this.copyData).then(({data}) => { + if (data && data.code === 0) { + this.$message({ + message: '操作成功', + type: 'success', + duration: 1500, + onClose: () => {} + }) + } else { + this.$alert(data.msg, '错误', { + confirmButtonText: '确定' + }) + flag = false + } + }).catch(()=>{ + flag = false + }) + } + if (flag) { + this.copyVisible = false + } + }, - } + }, }