diff --git a/src/views/modules/part/bom_create.vue b/src/views/modules/part/bom_create.vue index 856a3cb..bbb7dab 100644 --- a/src/views/modules/part/bom_create.vue +++ b/src/views/modules/part/bom_create.vue @@ -75,43 +75,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -422,93 +385,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@@ -851,12 +727,12 @@ - + + :value = "i.buDesc"> @@ -884,7 +760,7 @@ { + if (data.code === 0) { + this.userBuList = data.rows + } + }) + }, + // bom新增模态框 addModal (row) { this.modalData = { @@ -4111,6 +4005,10 @@ export default { }, copyBomPart() { + if (!this.modalData.partNo) { + this.$message.warning('请选择节点!') + return + } this.copyBomSearchData = { site: this.$store.state.user.site, buNo: '', @@ -4174,44 +4072,54 @@ export default { }, copyBomSave() { - console.log(this.copyBomSelections) if (this.copyBomSelections === null || this.copyBomSelections.length === 0) { this.$message.warning('请选择可选物料!') return } - this.$confirm("是否确认添加该"+ this.copyBomSelections.length +"条子件记录?", "提示", { - confirmButtonText: "确定", - cancelButtonText: "取消", - type: "warning" - }).then(() => { - let tempData = { - site: this.modalData.site, - buNo: this.modalData.buNo, - partNo: this.modalData.partNo, - engChgLevel: this.modalData.engChgLevel, - bomType: this.modalData.bomType, - alternativeNo: this.detailData.alternativeNo, - consumptionItem: 'Consumed', - qtyPerAssembly: 0, - componentScrap: 0, - shrinkageFactor: '', - lineItemNo: '', - operationId: '', - operationNo: '', - issueToLoc: '', - issueToLocName: '', - noteText: '', - createBy: this.$store.state.user.name, - lineSequence: '', - issueType: 'Reserve And Backflush', - productFlag: 'component', - batchSaveList: this.copyBomSelections - } + + // 转换数据结构:将 componentPart 映射到 partNo,因为后端使用 entity.getPartNo() 作为子件编码 + const convertedSelections = this.copyBomSelections.map(item => { + return { + partNo: item.componentPart, // 子件编码(关键:后端使用这个字段作为子件) + printUnit: item.printUnit || '', + componentPart: item.componentPart, + componentPartDesc: item.componentPartDesc || '', + qtyPerAssembly: item.qtyPerAssembly || 0 // 单位用量 + } + }) + + this.$confirm("是否确认添加该"+ this.copyBomSelections.length +"条子件记录?", "提示", { + confirmButtonText: "确定", + cancelButtonText: "取消", + type: "warning" + }).then(() => { + let tempData = { + site: this.modalData.site, + buNo: this.modalData.buNo, + partNo: this.modalData.partNo, + engChgLevel: this.modalData.engChgLevel, + bomType: this.modalData.bomType, + alternativeNo: this.detailData.alternativeNo, + consumptionItem: 'Consumed', + qtyPerAssembly: 0, + componentScrap: 0, + shrinkageFactor: this.modalData.shrinkageFactor || '', // 使用头部的损耗率 + lineItemNo: '', + operationId: '', + operationNo: '', + issueToLoc: '', + issueToLocName: '', + noteText: '', + createBy: this.$store.state.user.name, + lineSequence: '', + issueType: 'Reserve And Backflush', + productFlag: 'component', + batchSaveList: convertedSelections // 使用转换后的数据 + } batchSaveBomComponent(tempData).then(({data}) => { if (data && data.code === 0) { this.subDetailList = data.rows.subDetailList this.copyBomDialogFlag = false - this.batchSaveComponentModal() this.$message({ message: '操作成功', type: 'success',