From 5343bcd65383fd105f3ce3cfbc73ea763675bd34 Mon Sep 17 00:00:00 2001 From: songguoqiang <765017469@qq.com> Date: Fri, 18 Oct 2024 15:39:00 +0800 Subject: [PATCH] =?UTF-8?q?YT-436:=E6=95=B0=E9=87=8F-=E6=89=B9=E6=AC=A1?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=89=B9=E6=AC=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../inventorymoveRecordMainNew/index.vue | 45 ++++++++++++++++++- .../inventorymoveRecordRequestMain.data.ts | 6 ++- .../inventorymoveRequestMain/index.vue | 2 +- 3 files changed, 49 insertions(+), 4 deletions(-) diff --git a/src/views/wms/moveManage/inventorymove/inventorymoveRecordMainNew/index.vue b/src/views/wms/moveManage/inventorymove/inventorymoveRecordMainNew/index.vue index 13e7a41e8..013470ce4 100644 --- a/src/views/wms/moveManage/inventorymove/inventorymoveRecordMainNew/index.vue +++ b/src/views/wms/moveManage/inventorymove/inventorymoveRecordMainNew/index.vue @@ -99,6 +99,7 @@ import * as defaultButtons from '@/utils/disposition/defaultButtons' import { CACHE_KEY, useCache } from '@/hooks/web/useCache' import { formatDate } from '@/utils/formatTime' import { usePageLoading } from '@/hooks/web/usePageLoading' +import * as ruleApi from '@/api/wms/rule/index' const { loadStart, loadDone } = usePageLoading() // 库存转移记录(新)InventorymoveRecordMainNew defineOptions({ name: 'InventorymoveRecordMainNew' }) @@ -375,21 +376,53 @@ const submitForm = async (formType, submitData) => { formRef.value.formLoading = false } } +const fromManagementPrecision = ref('') +const toManagementPrecision = ref('') // 查询页面返回 const searchTableSuccess = (formField, searchField, val, formRef, type, row ) => { console.log('searchTableSuccess',formField, searchField, val, formRef, type, row) - nextTick(() => { + nextTick(async () => { if (type == 'tableForm') { if(formField == 'itemCode'){ + const fromLocationCode =formRef.formModel.fromLocationCode//主数据选择的从库位代码 + const toLocationCode =formRef.formModel.fromLocationCode//主数据选择的到库位代码 val = val.filter(item=>!tableData.value.find(item1=>item1['itemCode']==item['itemCode']&&item1['fromBatch']==item['batch']&&item1['fromPackingNumber']==item['packingNumber']&&item1['origin_fromLocationCode']==item['locationCode']&&item1['fromInventoryStatus']==item['inventoryStatus'])) if(val.length==0) return - val.forEach(item=>{ + val.forEach(async item=>{ const newRow = JSON.parse(JSON.stringify({...tableFormKeys,...item})) newRow['fromPackingNumber'] = item['packingNumber'] newRow['toPackingNumber'] = item['packingNumber'] newRow['fromContainerNumber'] = item['containerNumber'] newRow['itemCode'] = item['itemCode'] newRow['fromBatch'] = item['batch'] + //从批次 + await ruleApi.getManagementPrecision({ + itemCodes: [item['itemCode']], + locationCode:fromLocationCode + }).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['origin_fromLocationCode'] = item['locationCode'] newRow['uom'] = item['uom'] @@ -467,5 +500,13 @@ onMounted(async () => { // 库存转移记录(新)InventorymoveRecordMainNew importTemplateData.templateUrl = await InventorymoveRecordMainApi.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}`; + } ./inventorymoveRecordRequestMain.data diff --git a/src/views/wms/moveManage/inventorymove/inventorymoveRecordMainNew/inventorymoveRecordRequestMain.data.ts b/src/views/wms/moveManage/inventorymove/inventorymoveRecordMainNew/inventorymoveRecordRequestMain.data.ts index 6913ac2ab..750723fa6 100644 --- a/src/views/wms/moveManage/inventorymove/inventorymoveRecordMainNew/inventorymoveRecordRequestMain.data.ts +++ b/src/views/wms/moveManage/inventorymove/inventorymoveRecordMainNew/inventorymoveRecordRequestMain.data.ts @@ -431,10 +431,14 @@ export const InventorymoveRequestDetail = useCrudSchemas(reactive( }, tableForm: { disabled: true, + placeholder: '请选择从批次', + valueFormat: 'YYYYMMDD', + format: 'YYYYMMDD', }, form: { componentProps: { - disabled: true + disabled: true, + valueFormat: 'YYYYMMDD', } } }, diff --git a/src/views/wms/moveManage/inventorymove/inventorymoveRequestMain/index.vue b/src/views/wms/moveManage/inventorymove/inventorymoveRequestMain/index.vue index 06793898d..ce08198d0 100644 --- a/src/views/wms/moveManage/inventorymove/inventorymoveRequestMain/index.vue +++ b/src/views/wms/moveManage/inventorymove/inventorymoveRequestMain/index.vue @@ -368,7 +368,7 @@ const searchTableSuccess = (formField, searchField, val, formRef, type, row ) => newRow['fromBatch'] = getFormattedDate(); // 获取 YYYYMMDD 格式的日期 } await ruleApi.getManagementPrecision({ - itemCodes: [row['itemCode']], + itemCodes: [item['itemCode']], locationCode:val[0]['locationCode'] }).then((res) => { fromManagementPrecision.value = res[0].ManagementPrecision