diff --git a/src/views/wms/issueManage/productionreturn/productionreturnRequestMain/index.vue b/src/views/wms/issueManage/productionreturn/productionreturnRequestMain/index.vue index 64ad37286..6cf6b59a0 100644 --- a/src/views/wms/issueManage/productionreturn/productionreturnRequestMain/index.vue +++ b/src/views/wms/issueManage/productionreturn/productionreturnRequestMain/index.vue @@ -113,6 +113,7 @@ import { getAccessToken } from '@/utils/auth' import { getJmreportBaseUrl } from '@/utils/systemParam' import { formatDate } from '@/utils/formatTime' import { usePageLoading } from '@/hooks/web/usePageLoading' +import * as ruleApi from '@/api/wms/rule/index' const { loadStart, loadDone } = usePageLoading() // 生产退料申请 defineOptions({ name: 'ProductionreturnRequestMain' }) @@ -202,7 +203,7 @@ const clearSearchInput = (formField) => { tableData.value = [] } } - +let fromManagementPrecision = ref('') // 查询页面返回 const searchTableSuccess = (formField, searchField, val, formRef, type, row ) => { console.log('searchTableSuccess',formField, searchField, val, formRef, type, row) @@ -214,6 +215,7 @@ const searchTableSuccess = (formField, searchField, val, formRef, type, row ) => // message.warning(`物料${val[0]['itemCode']}已经存在`) // return // } + val[0]['batche'] let enableBuy = val[0]['enableBuy'] if(tableData.value.length>0){ enableBuy = tableData.value[0]['enableBuy'] @@ -228,7 +230,7 @@ const searchTableSuccess = (formField, searchField, val, formRef, type, row ) => val = val.filter(item=>item['enableBuy']==enableBuy) let messageItemCodes = [] - val.forEach(item=>{ + val.forEach(async item=>{ const newRow = JSON.parse(JSON.stringify({...tableFormKeys,...item})) newRow['itemCode'] = item['itemCode'] newRow['enableBuy'] = item['enableBuy'] @@ -238,11 +240,33 @@ const searchTableSuccess = (formField, searchField, val, formRef, type, row ) => // 如果有批次 赋值库存余额批次 无批次 赋值 000000 if (item['batch'] !== '') { newRow['batch'] = item['batch'] - } else { - newRow['batch'] = '000000' + }else{ + const a = new Date(); + newRow['batch'] = a.toISOString().split('T')[0]; // 获取 YYYY-MM-DD 格式的日期 } + + // else { + // newRow['batch'] = '000000' + // } newRow['packUnit'] = item['packUnit'] newRow['packQty'] = item['packQty'] + + //根据来源库位查询管理精度 + row[formField] = val[0][searchField] + await ruleApi.getManagementPrecision({ + itemCodes: [row['itemCode']], + locationCode:val[0]['locationCode'] + }).then((res) => { + fromManagementPrecision.value = res[0].ManagementPrecision + }) + if (fromManagementPrecision.value == 'BY_QUANTITY') { + newRow['batchFormItemType'] = 'FormDate' + newRow['disabled_batch'] = false + } else { + newRow['fromBatchFormItemType'] = '' + newRow['disabled_fromBatch'] = true + } + if(tableData.value.find(item1=>item1['itemCode'] == item['itemCode'])){ messageItemCodes.push(item['itemCode']) }else{