|
|
|
@ -389,7 +389,7 @@ |
|
|
|
<!-- 可选物料 --> |
|
|
|
<div style="flex: 1; padding: 1px;"> |
|
|
|
<span style="font-size: 12px">可选物料</span> |
|
|
|
<div style="height: 400px; overflow: auto"> |
|
|
|
<div style="height: 260px; overflow: auto"> |
|
|
|
<el-table |
|
|
|
:data="batchComponentPartList" |
|
|
|
border |
|
|
|
@ -430,6 +430,7 @@ |
|
|
|
<el-table |
|
|
|
:data="choosePartList" |
|
|
|
border |
|
|
|
height="260px" |
|
|
|
ref="batchSaveTable2" |
|
|
|
@row-dblclick="batchDeletePartDB" |
|
|
|
@selection-change="selectionSaveComponent2" |
|
|
|
@ -668,7 +669,7 @@ |
|
|
|
</el-table> |
|
|
|
</div> |
|
|
|
<el-footer style="height:40px;margin-top: 20px;text-align:center"> |
|
|
|
<el-button type="primary" @click="batchUpdateComponentsSave">保存</el-button> |
|
|
|
<el-button type="primary" :loading="batchUpdateSaveLoading" @click="batchUpdateComponentsSave">保存</el-button> |
|
|
|
<el-button type="primary" @click="batchUpdateComponentsFlag=false">关闭</el-button> |
|
|
|
</el-footer> |
|
|
|
</el-dialog> |
|
|
|
@ -2525,6 +2526,7 @@ export default { |
|
|
|
saveDetailLoading: false, |
|
|
|
computeLoading: false, |
|
|
|
copyBomQueryLoading: false, |
|
|
|
batchUpdateSaveLoading: false, |
|
|
|
// 控制 |
|
|
|
modalFlag: false, |
|
|
|
modalDisableFlag: false, |
|
|
|
@ -3131,6 +3133,22 @@ export default { |
|
|
|
|
|
|
|
// 判断子物料工序是否选择 |
|
|
|
packageSaveData () { |
|
|
|
// 检查单位用量是否为空 |
|
|
|
const hasEmptyQty = this.subDetailList.some(item => |
|
|
|
item.qtyPerAssembly === null || |
|
|
|
item.qtyPerAssembly === '' || |
|
|
|
item.qtyPerAssembly === undefined |
|
|
|
) |
|
|
|
|
|
|
|
if (hasEmptyQty) { |
|
|
|
this.$alert('单位用量不允许为空,请填写完整后再保存!', '验证失败', { |
|
|
|
confirmButtonText: '确定', |
|
|
|
type: 'warning' |
|
|
|
}) |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|
// 检查工序是否为空 |
|
|
|
const allAHasValue = this.subDetailList.every(item => item.operationId !== null && item.operationId !== '') |
|
|
|
if (!allAHasValue) { |
|
|
|
this.$confirm(`存在未选择工序的子物料,是否确认保存数据?`, '提示', { |
|
|
|
@ -3895,8 +3913,15 @@ export default { |
|
|
|
}, |
|
|
|
|
|
|
|
async batchUpdateComponentsSave() { |
|
|
|
// 开启loading |
|
|
|
this.batchUpdateSaveLoading = true |
|
|
|
|
|
|
|
let flag = true |
|
|
|
for (let i = 0; i < this.subDetailList.length; i++) { |
|
|
|
// 保存原始列表长度 |
|
|
|
const listLength = this.subDetailList.length |
|
|
|
|
|
|
|
for (let i = 0; i < listLength; i++) { |
|
|
|
// 每次从最新的列表中获取数据,因为前面的计算可能已经更新了列表 |
|
|
|
let row = this.subDetailList[i] |
|
|
|
this.componentData = { |
|
|
|
flag: '2', |
|
|
|
@ -3943,64 +3968,85 @@ export default { |
|
|
|
} |
|
|
|
if (this.componentData.lineSequence === '' || this.componentData.lineSequence == null) { |
|
|
|
this.$message.warning('序号不能为空!') |
|
|
|
this.batchUpdateSaveLoading = false |
|
|
|
return |
|
|
|
} |
|
|
|
if (this.componentData.partNo === '' || this.componentData.partNo == null) { |
|
|
|
this.$message.warning('请选择主记录物料编码!') |
|
|
|
this.batchUpdateSaveLoading = false |
|
|
|
return |
|
|
|
} |
|
|
|
if (this.componentData.bomType === '' || this.componentData.bomType == null) { |
|
|
|
this.$message.warning('请选择主记录制造类型!') |
|
|
|
this.batchUpdateSaveLoading = false |
|
|
|
return |
|
|
|
} |
|
|
|
if (this.componentData.engChgLevel === '' || this.componentData.engChgLevel == null) { |
|
|
|
this.$message.warning('请填写主记录BOM版本号!') |
|
|
|
this.batchUpdateSaveLoading = false |
|
|
|
return |
|
|
|
} |
|
|
|
if (this.componentData.componentPart === '' || this.componentData.componentPart == null) { |
|
|
|
this.$message.warning('请选择子物料编码!') |
|
|
|
this.batchUpdateSaveLoading = false |
|
|
|
return |
|
|
|
} |
|
|
|
if (this.componentData.productFlag === 'component' && (this.componentData.consumptionItem === '' || this.componentData.consumptionItem == null)) { |
|
|
|
this.$message.warning('请选择消耗项目!') |
|
|
|
this.batchUpdateSaveLoading = false |
|
|
|
return |
|
|
|
} |
|
|
|
if (this.componentData.componentScrap === '' || this.componentData.componentScrap == null) { |
|
|
|
this.$message.warning('请填写调机量!') |
|
|
|
this.batchUpdateSaveLoading = false |
|
|
|
return |
|
|
|
} |
|
|
|
if (this.componentData.shrinkageFactor === '' || this.componentData.shrinkageFactor == null) { |
|
|
|
this.$message.warning('请填写损耗率!') |
|
|
|
this.batchUpdateSaveLoading = false |
|
|
|
return |
|
|
|
} |
|
|
|
if (this.componentData.issueType === '' || this.componentData.issueType == null) { |
|
|
|
this.$message.warning('请选择生产属性!') |
|
|
|
this.batchUpdateSaveLoading = false |
|
|
|
return |
|
|
|
} |
|
|
|
try { |
|
|
|
const {data} = await computeQtyPerAssemblyEdit(this.componentData) |
|
|
|
if (data && data.code !== 0) { |
|
|
|
if (data && data.code === 0) { |
|
|
|
// 更新列表数据 |
|
|
|
this.subDetailList = data.rows.subDetailList |
|
|
|
} else if (data && data.code !== 0) { |
|
|
|
flag = false |
|
|
|
this.batchUpdateSaveLoading = false |
|
|
|
this.$alert('第'+(i+1)+'行'+data.msg, '错误', { |
|
|
|
confirmButtonText: '确定' |
|
|
|
}) |
|
|
|
break |
|
|
|
} |
|
|
|
} catch (error) { |
|
|
|
flag = false |
|
|
|
this.batchUpdateSaveLoading = false |
|
|
|
this.$alert('第'+(i+1)+'行请求失败', '错误', { |
|
|
|
confirmButtonText: '确定' |
|
|
|
}) |
|
|
|
break |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// 关闭loading |
|
|
|
this.batchUpdateSaveLoading = false |
|
|
|
|
|
|
|
if(flag) { |
|
|
|
this.$message({ |
|
|
|
message: '操作成功', |
|
|
|
message: '批量修改并计算完成', |
|
|
|
type: 'success', |
|
|
|
duration: 1500, |
|
|
|
onClose: () => {} |
|
|
|
}) |
|
|
|
this.batchUpdateComponentsFlag = false |
|
|
|
// 刷新表格显示 |
|
|
|
this.$forceUpdate() |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
|