Browse Source

HL-59571.批量添加明细会导致同一物料重复添加,期望同一物料不能重复添加 2.先添加明细,后填写或者更改到仓库,会清空明细信息,期望不应该清空明细

hella_online_20240924
yufei_wang 2 months ago
parent
commit
ef1c796826
  1. 24
      src/views/wms/issueManage/productionreturn/productionreturnRequestMain/index.vue

24
src/views/wms/issueManage/productionreturn/productionreturnRequestMain/index.vue

@ -205,15 +205,15 @@ const clearSearchInput = (formField) => {
//
const searchTableSuccess = (formField, searchField, val, formRef, type, row ) => {
console.log('searchTableSuccess',formRef.formModel)
console.log('searchTableSuccess',formField, searchField, val, formRef, type, row)
nextTick(async () => {
if (type == 'tableForm') {
//
if(formField == 'itemCode') {
if(tableData.value.find(item1=>item1['itemCode'] == val[0]['itemCode'])){
message.warning(`物料${val[0]['itemCode']}已经存在`)
return
}
// if(tableData.value.find(item1=>item1['itemCode'] == val[0]['itemCode'])){
// message.warning(`${val[0]['itemCode']}`)
// return
// }
let enableBuy = val[0]['enableBuy']
if(tableData.value.length>0){
enableBuy = tableData.value[0]['enableBuy']
@ -227,6 +227,7 @@ const searchTableSuccess = (formField, searchField, val, formRef, type, row ) =>
}
val = val.filter(item=>item['enableBuy']==enableBuy)
let messageItemCodes = []
val.forEach(item=>{
const newRow = JSON.parse(JSON.stringify({...tableFormKeys,...item}))
newRow['itemCode'] = item['itemCode']
@ -242,8 +243,17 @@ const searchTableSuccess = (formField, searchField, val, formRef, type, row ) =>
}
newRow['packUnit'] = item['packUnit']
newRow['packQty'] = item['packQty']
tableData.value.push(newRow)
if(tableData.value.find(item1=>item1['itemCode'] == item['itemCode'])){
messageItemCodes.push(item['itemCode'])
}else{
tableData.value.push(newRow)
}
})
if(messageItemCodes.length>0){
message.warning(`物料${messageItemCodes.join(',')}已经存在`)
}
// HL-4885 @ @
// tableform
@ -291,8 +301,8 @@ const searchTableSuccess = (formField, searchField, val, formRef, type, row ) =>
//
setV['workStationCode'] = val[0]['code']
setV['fromLocationCode'] = val[0]['rawLocationCode']
tableData.value = [] //
}
tableData.value = [] //
formRef.setValues(setV)
}
})

Loading…
Cancel
Save