|
|
|
@ -4144,6 +4144,46 @@ export default { |
|
|
|
this.$refs.byProductTable.toggleRowSelection(row) |
|
|
|
}, |
|
|
|
|
|
|
|
isDrawingNoMaintained (drawingNo) { |
|
|
|
if (drawingNo === null || drawingNo === undefined) { |
|
|
|
return false |
|
|
|
} |
|
|
|
const normalizedDrawingNo = String(drawingNo).trim().toUpperCase() |
|
|
|
return normalizedDrawingNo !== '' && normalizedDrawingNo !== 'NA' |
|
|
|
}, |
|
|
|
|
|
|
|
validateComponentDrawingNoForCreate () { |
|
|
|
return partInformationSearch({ |
|
|
|
site: this.$store.state.user.site, |
|
|
|
partNo: this.componentData.componentPart, |
|
|
|
limit: 1, |
|
|
|
page: 1 |
|
|
|
}).then(({data}) => { |
|
|
|
const firstPart = data && data.code === 0 && data.page && data.page.list && data.page.list.length > 0 |
|
|
|
? data.page.list[0] |
|
|
|
: null |
|
|
|
if (!firstPart) { |
|
|
|
this.$message.warning('子物料【' + this.componentData.componentPart + '】未查询到物料信息,不能保存!') |
|
|
|
return false |
|
|
|
} |
|
|
|
|
|
|
|
const materialStatus = (firstPart.status || '').toString().trim().toUpperCase() |
|
|
|
if (materialStatus !== 'Y') { |
|
|
|
// 临时物料不做编码校验 |
|
|
|
return true |
|
|
|
} |
|
|
|
|
|
|
|
if (this.isDrawingNoMaintained(firstPart.drawingNo)) { |
|
|
|
return true |
|
|
|
} |
|
|
|
this.$message.warning('子物料【' + this.componentData.componentPart + '】未维护编码,不能保存!') |
|
|
|
return false |
|
|
|
}).catch(() => { |
|
|
|
this.$message.error('验证子物料编码信息失败,请重试!') |
|
|
|
return false |
|
|
|
}) |
|
|
|
}, |
|
|
|
|
|
|
|
// 重量分配改变 |
|
|
|
changeWeightShare () { |
|
|
|
this.componentData.partsByWeight = this.componentData.weightShare |
|
|
|
@ -4222,19 +4262,15 @@ export default { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
partInformationSearch({ |
|
|
|
site: this.$store.state.user.site, |
|
|
|
partNo: this.componentData.componentPart, |
|
|
|
limit: 1, |
|
|
|
page: 1 |
|
|
|
}).then(({data}) => { |
|
|
|
if (data && data.code === 0 && data.page.list.length > 0 && data.page.list[0].drawingNo) { |
|
|
|
if (this.componentData.flag !== '1') { |
|
|
|
doSaveRecipeComponent() |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|
this.validateComponentDrawingNoForCreate().then((isValid) => { |
|
|
|
if (isValid) { |
|
|
|
doSaveRecipeComponent() |
|
|
|
} else { |
|
|
|
this.$message.warning('子物料【' + this.componentData.componentPart + '】未获取编码,不能保存!') |
|
|
|
} |
|
|
|
}).catch(() => { |
|
|
|
this.$message.error('验证子物料编码信息失败,请重试!') |
|
|
|
}) |
|
|
|
}, |
|
|
|
|
|
|
|
|