diff --git a/src/views/wms/inventoryjobManage/unplannedissue/unplannedissueRequestMain/index.vue b/src/views/wms/inventoryjobManage/unplannedissue/unplannedissueRequestMain/index.vue index c7d328cce..a118d01ad 100644 --- a/src/views/wms/inventoryjobManage/unplannedissue/unplannedissueRequestMain/index.vue +++ b/src/views/wms/inventoryjobManage/unplannedissue/unplannedissueRequestMain/index.vue @@ -93,6 +93,7 @@ import * as UnplannedissueRequestDetailApi from '@/api/wms/unplannedissueRequest import * as defaultButtons from '@/utils/disposition/defaultButtons' 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: 'UnplannedissueRequestMain' }) @@ -109,21 +110,43 @@ const tableColumns = ref([...UnplannedissueRequestMain.allSchemas.tableColumns,. const updataTableColumns = (val) => { tableColumns.value = val } - +const fromManagementPrecision = ref('') // 查询页面返回 const searchTableSuccess = (formField, searchField, val, formRef, type, row ) => { - nextTick(() => { + nextTick(async() => { if (type == 'tableForm') { // 明细查询页赋值 if(formField === 'itemCode'){ val = val.filter(item=>!tableData.value.find(item1=>item1['itemCode']==item['itemCode']&&item1['batch']==item['batch']&&item1['packingNumber']==item['packingNumber']&&item1['fromLocationCode']==item['locationCode']&&item1['inventoryStatus']==item['inventoryStatus'])) if(val.length==0) return - val.forEach(item=>{ + val.forEach(async item=>{ let newRow = JSON.parse(JSON.stringify(tableFormKeys)) newRow[formField] =item[searchField] newRow['packingNumber'] = item['packingNumber'] newRow['containerNumber'] = item['containerNumber'] newRow['batch'] = item['batch'] + //从批次 + await ruleApi.getManagementPrecision({ + itemCodes: [item['itemCode']], + locationCode:item['locationCode'] + }).then((res) => { + fromManagementPrecision.value = res[0].ManagementPrecision + }) + if (fromManagementPrecision.value == 'BY_QUANTITY') {//如果从批次+物料管理精度是按数量 + if(newRow['batch']==''){ + newRow['batch'] = getFormattedDate(); // 获取 YYYYMMDD 格式的日期 + } + newRow['batchFormItemType'] = 'FormDate' + newRow['disabled_batch'] = false + + }else { + newRow['bathFormItemType'] = '' + newRow['disabled_batch'] = true + } + + + + newRow['inventoryStatus'] = item['inventoryStatus'] newRow['fromLocationCode'] = item['locationCode'] newRow['itemCode'] = item['itemCode'] @@ -586,4 +609,12 @@ onMounted(async () => { getList() importTemplateData.templateUrl = await UnplannedissueRequestMainApi.importTemplate() }) + +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/inventoryjobManage/unplannedissue/unplannedissueRequestMain/unplannedissueRequestMain.data.ts b/src/views/wms/inventoryjobManage/unplannedissue/unplannedissueRequestMain/unplannedissueRequestMain.data.ts index 71006c7dc..5afe8c6f5 100644 --- a/src/views/wms/inventoryjobManage/unplannedissue/unplannedissueRequestMain/unplannedissueRequestMain.data.ts +++ b/src/views/wms/inventoryjobManage/unplannedissue/unplannedissueRequestMain/unplannedissueRequestMain.data.ts @@ -801,13 +801,17 @@ export const UnplannedissueRequestDetail = useCrudSchemas(reactive table: { width: 150 }, + tableForm: { + disabled: true, + placeholder: '请选择从批次', + valueFormat: 'YYYYMMDD', + format: 'YYYYMMDD', + }, form: { componentProps: { - disabled: true + disabled: true, + valueFormat: 'YYYYMMDD', } - }, - tableForm: { - disabled:true } }, {