diff --git a/src/api/part/recipeManagement.js b/src/api/part/recipeManagement.js
index 17ed200..60e7531 100644
--- a/src/api/part/recipeManagement.js
+++ b/src/api/part/recipeManagement.js
@@ -98,6 +98,7 @@ export const queryRecipeHeader = data => createAPI(`/plm/recipeManagement/queryR
* @returns {*}
*/
export const saveRecipeComponent = data => createAPI(`/plm/recipeManagement/saveRecipeComponent`,'post',data)
+export const saveRecipeComponentBatch = data => createAPI(`/plm/recipeManagement/saveRecipeComponentBatch`,'post',data)
/**
* 修改recipe子明细
diff --git a/src/views/modules/part/recipeManagement.vue b/src/views/modules/part/recipeManagement.vue
index 7df7de2..8d1b4f6 100644
--- a/src/views/modules/part/recipeManagement.vue
+++ b/src/views/modules/part/recipeManagement.vue
@@ -225,8 +225,7 @@
- 新增
- 删除
+ 新增/删除
-
+
@@ -546,9 +545,15 @@
- 应用
- 保存
- 关闭
+
+ 确定
+ 关闭
+
+
+ 应用
+ 保存
+ 关闭
+
@@ -968,6 +973,55 @@
+
+
+
+
+ 新增
+ 删除
+ 重量分配合计:{{ componentBatchWeightTotal }}
+
+
+
+
+
+
+ {{scope.row[item.columnProp]}}
+
+
+
+
+
+ 编辑
+
+
+
+
+
+ 保存
+ 关闭
+
+
+
@@ -990,6 +1044,7 @@ import {
queryPartList, // 查询物料清单
queryRecipeComponent, // 查询recipe子明细
saveRecipeComponent, // 新增recipe子明细
+ saveRecipeComponentBatch, // 临时物料配方子件整单保存
updateRecipeComponent, // 修改recipe子明细
deleteRecipeComponent, // 删除recipe子明细
queryOperationList, // 根据物料编码查询工序
@@ -1024,6 +1079,18 @@ export default {
ChooseList
},
// 监听
+ computed: {
+ isTemporaryRecipePart () {
+ return this.modalData.flag !== '3' && this.detailData.officialFlag !== 'Y'
+ },
+ componentBatchWeightTotal () {
+ const total = (this.componentBatchList || []).reduce((sum, row) => {
+ const weight = Number(row.weightShare)
+ return sum + (Number.isFinite(weight) ? weight : 0)
+ }, 0)
+ return Number(total.toFixed(6))
+ }
+ },
watch: {
searchData: {
deep: true,
@@ -2975,6 +3042,12 @@ export default {
saveDetailModalFlag :false,
saveDetailModalDisable: false,
componentSaveModal: false,
+ componentBatchModal: false,
+ componentBatchList: [],
+ componentBatchSelection: [],
+ componentBatchLoading: false,
+ componentBatchEditing: false,
+ componentBatchEditIndex: -1,
componentDisableFlag: false,
operationModelFlag: false,
copyRecipeModelFlag: false,
@@ -3229,7 +3302,9 @@ export default {
createBy: this.$store.state.user.name,
printUnit: '',
printUnitName: '',
- officialFlag: 'N'
+ officialFlag: 'N',
+ partOfficialStatus: '',
+ temporaryPartFlag: ''
}
this.detailData = {
site: this.$store.state.user.site,
@@ -3281,6 +3356,8 @@ export default {
officialFlag: row.officialFlag,
alternativeNo: row.alternativeNo,
ifsPartNo: row.ifsPartNo,
+ partOfficialStatus: row.partOfficialStatus,
+ temporaryPartFlag: row.temporaryPartFlag,
}
this.subDetailTable = 'recipe_sub_detail'
// 查recipe明细
@@ -3422,6 +3499,190 @@ export default {
})
},
+ openComponentBatchModal () {
+ if (!this.detailData.alternativeNo) {
+ this.$message.warning('请先选择替代!')
+ return
+ }
+ this.componentBatchList = JSON.parse(JSON.stringify(this.subDetailList || []))
+ this.componentBatchSelection = []
+ this.componentBatchEditing = false
+ this.componentBatchEditIndex = -1
+ this.componentBatchModal = true
+ },
+ nextBatchLineSequence () {
+ return this.componentBatchList.reduce((max, row) => {
+ const sequence = Number(row.lineSequence)
+ return Number.isFinite(sequence) ? Math.max(max, sequence) : max
+ }, 0) + 1
+ },
+ openBatchComponentForm () {
+ this.componentBatchEditing = true
+ this.componentBatchEditIndex = -1
+ this.componentData = {
+ flag: '1',
+ site: this.$store.state.user.site,
+ partNo: this.modalData.partNo,
+ engChgLevel: this.modalData.engChgLevel,
+ bomType: this.modalData.bomType,
+ alternativeNo: this.detailData.alternativeNo,
+ componentPart: '',
+ componentPartDesc: '',
+ printUnit: '',
+ printUnitName: '',
+ partStatus: '',
+ partStatusDesc: '',
+ qtyPerAssembly: undefined,
+ componentScrap: 0,
+ issueType: 'Reserve And Backflush',
+ shrinkageFactor: 0,
+ lineItemNo: '',
+ operationId: '',
+ operationNo: '',
+ issueToLoc: '',
+ issueToLocName: '',
+ noteText: '',
+ createBy: this.$store.state.user.name,
+ lineSequence: this.nextBatchLineSequence(),
+ consumptionItem: 'Consumed',
+ productFlag: 'component',
+ weightShare: undefined,
+ partsByWeight: undefined,
+ qtyUom: undefined,
+ issuePlannedScrapDb: 'TRUE',
+ issueOverreportedQtyDb: 'FALSE',
+ fixedQtyFlag: 'Not fixed',
+ promisePlanned: 'Promised',
+ phantomConsume: 'Not Phantom Consume',
+ operCostDistribution: '0',
+ genOhCostDistribution: '0',
+ qtyKg: undefined,
+ byProdAsSupplyInMrpDb: 'FALSE',
+ leadtimeOffset: '0',
+ stdPlannedItem: '1',
+ chargedItem: 'Item not charged',
+ excludeFromCalculationsDb: 'FALSE',
+ excludeFromAsBuiltDb: 'FALSE',
+ lotBatchOriginDb: 'FALSE'
+ }
+ this.componentDisableFlag = false
+ this.componentSaveModal = true
+ },
+ editBatchComponentRow (row, index) {
+ this.componentBatchEditing = true
+ this.componentBatchEditIndex = index
+ this.componentData = JSON.parse(JSON.stringify(row))
+ this.componentData.flag = '2'
+ this.componentData.productFlag = 'component'
+ this.componentData.partNo = this.modalData.partNo
+ this.componentData.engChgLevel = this.modalData.engChgLevel
+ this.componentData.bomType = this.modalData.bomType
+ this.componentData.alternativeNo = this.detailData.alternativeNo
+ this.componentData.updateBy = this.$store.state.user.name
+ this.componentDisableFlag = true
+ this.componentSaveModal = true
+ },
+ componentBatchSelectionChange (selection) {
+ this.componentBatchSelection = selection
+ },
+ removeComponentBatchRows () {
+ if (!this.componentBatchSelection.length) {
+ this.$message.warning('请选择要删除的子件!')
+ return
+ }
+ this.componentBatchList = this.componentBatchList.filter(row => this.componentBatchSelection.indexOf(row) === -1)
+ this.componentBatchSelection = []
+ },
+ submitComponentBatch () {
+ if (!this.componentBatchList.length) {
+ this.$message.warning('请至少维护一条子件,且重量分配总额必须等于100!')
+ return
+ }
+ const componentParts = []
+ for (let i = 0; i < this.componentBatchList.length; i++) {
+ const row = this.componentBatchList[i]
+ const componentPart = this.normalizePartNo(row.componentPart)
+ row.componentPart = componentPart
+ if (!componentPart) {
+ this.$message.warning('请选择子物料编码!')
+ return
+ }
+ if (this.isSelfAsComponent(this.modalData.partNo, componentPart)) {
+ this.$message.warning('不能将自己作为子物料!')
+ return
+ }
+ if (componentParts.indexOf(componentPart) !== -1) {
+ this.$message.warning('子物料【' + componentPart + '】重复!')
+ return
+ }
+ componentParts.push(componentPart)
+ if (row.weightShare === undefined || row.weightShare === null || row.weightShare === '' || Number(row.weightShare) <= 0) {
+ this.$message.warning('子物料【' + componentPart + '】的重量分配必须大于0!')
+ return
+ }
+ }
+ if (Math.abs(this.componentBatchWeightTotal - 100) > 0.000001) {
+ this.$message.warning('重量分配总额必须等于100,当前合计为' + this.componentBatchWeightTotal + '!')
+ return
+ }
+ const params = {
+ site: this.modalData.site || this.$store.state.user.site,
+ partNo: this.modalData.partNo,
+ engChgLevel: this.modalData.engChgLevel,
+ bomType: this.modalData.bomType,
+ alternativeNo: this.detailData.alternativeNo,
+ createBy: this.$store.state.user.name,
+ updateBy: this.$store.state.user.name,
+ informationList: this.componentBatchList.map(row => ({
+ lineSequence: row.lineSequence,
+ componentPart: row.componentPart,
+ componentPartDesc: row.componentPartDesc,
+ printUnit: row.printUnit,
+ weightShare: row.weightShare,
+ partsByWeight: row.partsByWeight,
+ qtyUom: row.qtyUom,
+ qtyPerAssembly: row.qtyPerAssembly,
+ qtyKg: row.qtyKg,
+ componentScrap: row.componentScrap,
+ shrinkageFactor: row.shrinkageFactor,
+ consumptionItem: row.consumptionItem,
+ issueType: row.issueType,
+ operationNo: row.operationNo === '' ? null : row.operationNo,
+ issueToLoc: row.issueToLoc,
+ noteText: row.noteText,
+ issuePlannedScrapDb: row.issuePlannedScrapDb,
+ issueOverreportedQtyDb: row.issueOverreportedQtyDb,
+ fixedQtyFlag: row.fixedQtyFlag,
+ promisePlanned: row.promisePlanned,
+ phantomConsume: row.phantomConsume,
+ operCostDistribution: row.operCostDistribution,
+ genOhCostDistribution: row.genOhCostDistribution,
+ byProdAsSupplyInMrpDb: row.byProdAsSupplyInMrpDb,
+ leadtimeOffset: row.leadtimeOffset,
+ stdPlannedItem: row.stdPlannedItem,
+ chargedItem: row.chargedItem,
+ excludeFromCalculationsDb: row.excludeFromCalculationsDb,
+ excludeFromAsBuiltDb: row.excludeFromAsBuiltDb,
+ lotBatchOriginDb: row.lotBatchOriginDb
+ }))
+ }
+ this.componentBatchLoading = true
+ saveRecipeComponentBatch(params).then(({data}) => {
+ this.componentBatchLoading = false
+ if (data && data.code === 0) {
+ this.subDetailList = data.rows.subDetailList
+ this.byProductList = data.rows.byProductList
+ this.manufStructCostDistribList = data.rows.manufStructCostDistribList
+ this.componentBatchModal = false
+ this.$message.success('操作成功')
+ } else {
+ this.$alert(data.msg, '错误', { confirmButtonText: '确定' })
+ }
+ }).catch(() => {
+ this.componentBatchLoading = false
+ })
+ },
+
// 子明细新增模态框
saveComponentModal () {
this.$alert("配方子件的【新增】【删除】操作需到IFS系统中,然后通过【数据同步-反向】同步到PLM系统!", "提示", {
@@ -3493,6 +3754,7 @@ export default {
// 副产品新增模态框
saveByProductModal () {
+ this.componentBatchEditing = false
if (this.detailData.alternativeNo === '' || this.detailData.alternativeNo == null) {
this.$message.warning('请先选择替代!')
return
@@ -3539,6 +3801,7 @@ export default {
// 子明细编辑模态框
updateComponentModal (row) {
+ this.componentBatchEditing = false
this.componentData = {
flag: '2',
site: row.site,
@@ -3809,7 +4072,9 @@ export default {
if (data.page.list.length === 1) {
this.modalData.partDesc = data.page.list[0].partDesc
this.modalData.printUnit = data.page.list[0].printUnit
- this.modalData.printUnitName = data.page[0].printUnitName
+ this.modalData.printUnitName = data.page.list[0].printUnitName
+ this.modalData.partOfficialStatus = data.page.list[0].partOfficialStatus
+ this.modalData.temporaryPartFlag = data.page.list[0].temporaryPartFlag
}
}
})
@@ -3821,6 +4086,8 @@ export default {
this.modalData.partDesc = row.partDesc
this.modalData.printUnit = row.printUnit
this.modalData.printUnitName = row.printUnitName
+ this.modalData.partOfficialStatus = row.partOfficialStatus
+ this.modalData.temporaryPartFlag = row.temporaryPartFlag
this.partModelFlag = false
},
@@ -3837,6 +4104,8 @@ export default {
this.componentData.componentPartDesc = row.partDesc
this.componentData.printUnit = row.printUnit
this.componentData.printUnitName = row.printUnitName
+ this.componentData.partStatus = row.partStatus
+ this.componentData.partStatusDesc = row.partStatusDesc
this.componentPartModelFlag = false
},
@@ -3854,11 +4123,13 @@ export default {
},
// 子物料列表
- queryComponentPartModal () {
+ queryComponentPartModal (keepStatus) {
this.componentPartData.productGroupId4 = ''
this.componentPartData.limit = this.pageSize3
this.componentPartData.page = this.pageIndex3
- this.componentPartData.status = 'Y'
+ if (!keepStatus && !this.componentBatchEditing) {
+ this.componentPartData.status = 'Y'
+ }
// 查询所有物料
queryPartListAll(this.componentPartData).then(({data}) => {
if (data && data.code === 0) {
@@ -4003,6 +4274,8 @@ export default {
this.componentData.componentPartDesc = data.page.list[0].partDesc
this.componentData.printUnit = data.page.list[0].printUnit
this.componentData.printUnitName = data.page.list[0].printUnitName
+ this.componentData.partStatus = data.page.list[0].partStatus
+ this.componentData.partStatusDesc = data.page.list[0].partStatusDesc
return
}
}
@@ -4011,6 +4284,8 @@ export default {
this.componentData.componentPartDesc = ''
this.componentData.printUnit = ''
this.componentData.printUnitName = ''
+ this.componentData.partStatus = ''
+ this.componentData.partStatusDesc = ''
},
// copy物料编码失焦事件
@@ -4210,8 +4485,69 @@ export default {
this.componentData.qtyKg = this.componentData.weightShare / 100
},
+ closeBatchComponentForm () {
+ this.componentSaveModal = false
+ this.componentBatchEditing = false
+ this.componentBatchEditIndex = -1
+ },
+ saveBatchComponentRow (keepOpen) {
+ if (this.componentData.lineSequence === '' || this.componentData.lineSequence == null) {
+ this.$message.warning('序号不能为空!')
+ return
+ }
+ const normalizedComponentPart = this.normalizeComponentPartInput()
+ if (normalizedComponentPart === '') {
+ this.$message.warning('请选择子物料编码!')
+ return
+ }
+ if (this.isSelfAsComponent(this.componentData.partNo, normalizedComponentPart)) {
+ this.$message.warning('不能将自己作为子物料!')
+ return
+ }
+ if (this.componentData.consumptionItem === '' || this.componentData.consumptionItem == null) {
+ this.$message.warning('请选择消耗项目!')
+ return
+ }
+ if (this.componentData.weightShare === '' || this.componentData.weightShare == null || Number(this.componentData.weightShare) <= 0) {
+ this.$message.warning('请填写重量分配!')
+ return
+ }
+ if (this.componentData.issueType === '' || this.componentData.issueType == null) {
+ this.$message.warning('请选择生产属性!')
+ return
+ }
+ const duplicated = this.componentBatchList.some((row, index) => {
+ return index !== this.componentBatchEditIndex && this.normalizePartNo(row.componentPart) === normalizedComponentPart
+ })
+ if (duplicated) {
+ this.$message.warning('子物料【' + normalizedComponentPart + '】重复!')
+ return
+ }
+ this.changeWeightShare()
+ const row = JSON.parse(JSON.stringify(this.componentData))
+ row.componentPart = normalizedComponentPart
+ row.productFlag = 'component'
+ if (this.componentBatchEditIndex >= 0) {
+ this.$set(this.componentBatchList, this.componentBatchEditIndex, row)
+ this.componentSaveModal = false
+ this.componentBatchEditing = false
+ return
+ }
+ this.componentBatchList.push(row)
+ if (keepOpen) {
+ this.openBatchComponentForm()
+ } else {
+ this.componentSaveModal = false
+ this.componentBatchEditing = false
+ }
+ },
+
// 新增子明细方法
componentDataSave (isClose) {
+ if (this.componentBatchEditing) {
+ this.saveBatchComponentRow(isClose)
+ return
+ }
if (this.componentData.lineSequence === '' || this.componentData.lineSequence == null) {
this.$message.warning('序号不能为空!')
return