diff --git a/src/views/wms/moveManage/inventorymove/inventorymoveRecordMainNew/index.vue b/src/views/wms/moveManage/inventorymove/inventorymoveRecordMainNew/index.vue index 76641c3c3..5b0e06ca4 100644 --- a/src/views/wms/moveManage/inventorymove/inventorymoveRecordMainNew/index.vue +++ b/src/views/wms/moveManage/inventorymove/inventorymoveRecordMainNew/index.vue @@ -423,9 +423,10 @@ const searchTableSuccess = (formField, searchField, val, formRef, type, row ) => newRow['fromBatchFormItemType'] = 'FormDate' newRow['disabled_fromBatch'] = false - }else { + }else{ newRow['fromBatchFormItemType'] = '' newRow['disabled_fromBatch'] = true + newRow['fromBatch'] = '';//从到都是数量 } } newRow['fromInventoryStatus'] = item['inventoryStatus'] diff --git a/src/views/wms/moveManage/inventorymove/inventorymoveRequestMainOKHOLD/index.vue b/src/views/wms/moveManage/inventorymove/inventorymoveRequestMainOKHOLD/index.vue index d7ab786b0..194faf4c1 100644 --- a/src/views/wms/moveManage/inventorymove/inventorymoveRequestMainOKHOLD/index.vue +++ b/src/views/wms/moveManage/inventorymove/inventorymoveRequestMainOKHOLD/index.vue @@ -94,6 +94,7 @@ import * as LocationApi from '@/api/wms/location' import { formatDate } from '@/utils/formatTime' import dayjs from 'dayjs' import { usePageLoading } from '@/hooks/web/usePageLoading' +import * as ruleApi from '@/api/wms/rule/index' const { loadStart, loadDone } = usePageLoading() // 物料隔离申请OktoholdRequestMain // 只有物料隔离申请在使用的 @@ -309,19 +310,57 @@ const clearInput = (field, row, index) => { row['supplierName'] = '' } } +const fromManagementPrecision = ref('') +const toManagementPrecision = ref('') // 查询页面返回 const searchTableSuccess = (formField, searchField, val, formRef, type, row ) => { - nextTick(() => { + nextTick(async() => { if (type == 'tableForm') { if(formField == 'fromPackingNumber'){ val = val.filter(item=>!tableData.value.find(item1=>item1['itemCode']==item['itemCode']&&item1['fromBatch']==item['batch']&&item1['fromPackingNumber']==item['packingNumber']&&item1['fromLocationCode']==item['locationCode']&&item1['fromInventoryStatus']==item['inventoryStatus'])) if(val.length==0) return - val.forEach(item=>{ + + const toLocationCode =formRef.formModel.toLocationCode//主数据选择的到库位代码 + if(toLocationCode==''){ + message.warning('到库位代码不能为空'); + return + } + + val.forEach(async item=>{ const newRow = JSON.parse(JSON.stringify({...tableFormKeys,...item})) newRow['fromPackingNumber'] = item['packingNumber'] newRow['fromContainerNumber'] = item['containerNumber'] newRow['itemCode'] = item['itemCode'] newRow['fromBatch'] = item['batch'] + + //从批次 + await ruleApi.getManagementPrecision({ + itemCodes: [item['itemCode']], + locationCode:item['locationCode'] + }).then((res) => { + fromManagementPrecision.value = res[0].ManagementPrecision + }) + + if (fromManagementPrecision.value == 'BY_QUANTITY') {//如果从批次+物料管理精度是按数量 + //到批次 + await ruleApi.getManagementPrecision({ + itemCodes: [item['itemCode']], + locationCode:toLocationCode + }).then((res) => { + toManagementPrecision.value = res[0].ManagementPrecision + }) + if (toManagementPrecision.value != 'BY_QUANTITY') {//到批次+物料管理精度非数量需要添加批次 + if(newRow['fromBatch']==''){ + newRow['fromBatch'] = getFormattedDate(); // 获取 YYYYMMDD 格式的日期 + } + newRow['fromBatchFormItemType'] = 'FormDate' + newRow['disabled_fromBatch'] = false + }else { + newRow['fromBatchFormItemType'] = '' + newRow['disabled_fromBatch'] = true + } + } + newRow['fromInventoryStatus'] = item['inventoryStatus'] newRow['fromLocationCode'] = item['locationCode'] newRow['uom'] = item['uom'] @@ -765,4 +804,11 @@ onMounted(async () => { importTemplateData.templateUrl = await InventorymoveRequestMainApi.importTemplateExceptMove() } }) +const getFormattedDate = () =>{ + const a = new Date(); + const year = a.getFullYear(); + const month = String(a.getMonth() + 1).padStart(2, '0'); + const day = String(a.getDate()).padStart(2, '0'); + return `${year}${month}${day}`; + } diff --git a/src/views/wms/moveManage/inventorymove/inventorymoveRequestMainOKHOLD/inventorymoveRequestMain.data.ts b/src/views/wms/moveManage/inventorymove/inventorymoveRequestMainOKHOLD/inventorymoveRequestMain.data.ts index aad9685fe..d23961e59 100644 --- a/src/views/wms/moveManage/inventorymove/inventorymoveRequestMainOKHOLD/inventorymoveRequestMain.data.ts +++ b/src/views/wms/moveManage/inventorymove/inventorymoveRequestMainOKHOLD/inventorymoveRequestMain.data.ts @@ -1108,15 +1108,16 @@ export const InventorymoveRequestDetail = useCrudSchemas(reactive( label: '从批次', field: 'fromBatch', sort: 'custom', - table: { - width: 150 - }, tableForm: { - disabled: true + disabled: true, + placeholder: '请选择从批次', + valueFormat: 'YYYYMMDD', + format: 'YYYYMMDD', }, form: { componentProps: { - disabled: true + disabled: true, + valueFormat: 'YYYYMMDD', } } },