diff --git a/src/views/wms/issueManage/productionreturn/productionreturnRequestMainNo/index.vue b/src/views/wms/issueManage/productionreturn/productionreturnRequestMainNo/index.vue index 2cf3a6f82..851dbc378 100644 --- a/src/views/wms/issueManage/productionreturn/productionreturnRequestMainNo/index.vue +++ b/src/views/wms/issueManage/productionreturn/productionreturnRequestMainNo/index.vue @@ -57,7 +57,7 @@ :isBusiness="true" @handleAddTable="handleAddTable" @handleDeleteTable="handleDeleteTable" - @searchTableSuccess="searchTableSuccess" + @searchTableSuccess="searchTableSuccessAdd" @submitForm="submitForm" /> @@ -172,7 +172,83 @@ const isItemType = async (itemCode, labelTypeParams) => { if (!isType) labelType.value = labelTypeOld return isType } +// 查询页面返回 +const searchTableSuccessAdd = (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 + } + + let itemRes = await ItembasicApi.getItembasicPage({ + pageSize: 10, + pageNo: 1, + code: val[0]['itemCode'], + sort: '', + by: 'ASC', + }) + let rowType = '' + if (itemRes.list.length > 0) { + // 判断物料 可采购 可制造 + if (itemRes.list[0].enableMake == "FALSE") { + rowType = 'cg' + } else { + rowType = 'zz' + } + } + console.log('rowType',rowType) + console.log('tableData',tableData.value) + row['labelType'] = '' + if(tableData.value.find(item=>item['labelType']&&item['labelType']!=rowType)){ + message.warning('当前物料可制造与其他数据不一致,请重新选择!') + }else { + row['labelType'] = rowType + row['batch'] = val[0]['batch']==''?formatTime(new Date(), 'yyyyMMdd'):val[0]['batch'] + row['itemCode'] = val[0]['itemCode'] + row['uom'] = val[0]['uom'] + row['inventoryStatus'] = val[0]['inventoryStatus'] + row['qty'] = Number(val[0]['qty']) + row['packUnit'] = val[0]['packUnit'] + row['packQty'] = val[0]['packQty'] + // HL-4885 聂喜婷:@邱晨 @王宇飞 先把数量的校验拿掉 + // 修改 tableform 属性 数量最大值设置为库存余额中数量 + // ProductionreturnRequestDetail.allSchemas.tableFormColumns.forEach(item => { + // if(item.field == 'qty' && Number(val[0]['qty'])>item.tableForm.min) { + // item.tableForm.max = Number(val[0]['qty']) + // } + // // if(item.field == 'batch') { + // // item.tableForm.disabled = false + // // } + // }) + } + } else if(formField == 'workStationCode') { + val.forEach(item=>{ + const newRow = JSON.parse(JSON.stringify({...tableFormKeys,...item})) + newRow['workStationCode'] = item['code'] + newRow['fromLocationCode'] = item['rawLocationCode'] + newRow['checkId'] = item['id'] + tableData.value.push(newRow) + }) + } + // else if(formField == 'packUnit') { + // row['packUnit'] = val[0]['packUnit'] + // row['packQty'] = val[0]['packQty'] + // } + else { + row[formField] = val[0][searchField] + } + } else { + const setV = {} + setV[formField] = val[0][searchField] + tableData.value = [] // 重置明细数据 + formRef.setValues(setV) + } + }) +} // 查询页面返回 const searchTableSuccess = (formField, searchField, val, formRef, type, row ) => { nextTick(async () => {