Browse Source

RFQ 批量修改里点保存没有执行计算

java8
han\hanst 2 months ago
parent
commit
cabf54c863
  1. 56
      src/views/modules/part/bom_create.vue
  2. 14
      src/views/modules/part/quicklyCreateBom.vue

56
src/views/modules/part/bom_create.vue

@ -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()
}
},

14
src/views/modules/part/quicklyCreateBom.vue

@ -105,9 +105,9 @@
</el-card>
</el-col>
<!-- 数据 -->
<el-col :span="17">
<el-col :span="17" :style="{height: this.height + 'px'}" style="display: block;overflow-y: scroll">
<!-- 页签 -->
<el-tabs v-model="activeTable" style="width: 100%" type="border-card" @tab-click="refreshCurrentTabTable" class="customer-tab">
<el-tabs v-model="activeTable" :style="{height: this.height + 'px'}" style="width: 100%" type="border-card" @tab-click="refreshCurrentTabTable" class="customer-tab">
<!-- BOM页签 -->
<el-tab-pane label="产品BOM管理" name="bom_info">
<bom-create v-loading="bomLoading" ref="BomCreate" :batchUpdateFlag="batchUpdateFlag" @handleBatchUpdatePart="handleBatchUpdatePart" @refreshNode="refreshNode" @refreshBomLoading="refreshBomLoading" v-drag></bom-create>
@ -4688,28 +4688,28 @@ export default {
try {
const priorityList = []
const otherList = []
umList.forEach(item => {
if (!item) return
const umid = String(item.fieldname1 || item.UMID || '')
const umName = String(item.caption1 || item.UMName || '')
const isQianZhang = umid === '1002' || umName.includes('千张')
const isMi = umName === '米' || (umName.includes('米') && umName.length <= 2 && !umName.includes('千'))
if (isMi || isQianZhang) {
priorityList.push({ item, isMi, isQianZhang })
} else {
otherList.push(item)
}
})
//
priorityList.sort((a, b) => {
if (a.isMi && !b.isMi) return -1
if (!a.isMi && b.isMi) return 1
return 0
})
if (priorityList.length > 0) {
umList = [...priorityList.map(p => p.item), ...otherList]
}
@ -4717,7 +4717,7 @@ export default {
console.warn('计量单位排序失败,使用原始顺序:', error)
}
}
for (let i = 0; i < this.partList1.length; i++) {
this.$set(this.partList1[i], 'umList', umList);
this.$set(this.partList1[i], 'partFamilyList', data.data.list[i][0]);

Loading…
Cancel
Save