Browse Source

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

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

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

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

Loading…
Cancel
Save