From 413d0adf4ecc244f2f0b92375aef347fe4b210a8 Mon Sep 17 00:00:00 2001 From: siontion Date: Mon, 29 Jan 2024 18:18:25 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E5=BA=93=E5=AD=98=E7=9B=98=E7=82=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 库存盘点 --- .../views/heli/storagecheck/checkdetail.vue | 356 +++--------------- 1 file changed, 54 insertions(+), 302 deletions(-) diff --git a/mes-ui/mes-ui-admin-vue3/src/views/heli/storagecheck/checkdetail.vue b/mes-ui/mes-ui-admin-vue3/src/views/heli/storagecheck/checkdetail.vue index 130951bb..f6730b73 100644 --- a/mes-ui/mes-ui-admin-vue3/src/views/heli/storagecheck/checkdetail.vue +++ b/mes-ui/mes-ui-admin-vue3/src/views/heli/storagecheck/checkdetail.vue @@ -74,7 +74,8 @@ - + @@ -103,46 +104,24 @@ v-loading="subFormLoading" label-width="0"> - - - - - - - + + + - - - - + - + - + + - + - - - - + @@ -328,7 +295,7 @@ const formData = ref({ stockNo: undefined, checkType: undefined, checkTime: undefined, - status:undefined, + status: undefined, noZero: undefined, whId: undefined, description: undefined, @@ -417,7 +384,7 @@ const handleStatus = async (num) => { isShowBtnOther.value = false isShowBtnDelete.value = false } - query.id = storageid.value + query.id = formData.value.id query.type = 'update' reload() } @@ -476,7 +443,6 @@ const downloadAttachment = async (name, url) => { } // ====================附件信息 结束======================================= -const storageid = ref() var commonResult = '' /** 提交表单 */ @@ -489,15 +455,15 @@ const saveFormData = async () => { try { //物料信息保存 formData.value.matItemDOList.forEach((item) => { - item.stockId = storageid.value + item.stockId = formData.value.id item.whId = formData.value.whId }) const dataMats = formData.value.matItemDOList as unknown as CheckMatApi.StorageCheckMatVO[] - await CheckMatApi.createStorageMatBatch(dataMats, storageid.value) + await CheckMatApi.createStorageMatBatch(dataMats, formData.value.id) if (formData.value.matItemDOList.length > 0) { //附件信息保存 - matUploadData.value.businessId = storageid + matUploadData.value.businessId = formData.value.id matUploadRef.value!.submit() } message.success(t(commonResult)) @@ -521,87 +487,56 @@ const submitForm = async () => { //保存表单数据 await saveFormData() // 成功后刷新 - query.id = storageid.value + query.id = formData.value.id query.type = 'update' reload() } var matCount = 1 const onAddItem = () => { - if (formData.value.whId) { - const newData = { - // 新数据的属性 - cid: matCount, - stockId: 0, - matId: '', - matName: '', - matCode: '', - matType: '', - matSpec: '', - matUnit: '', - whId: '', - rgId: '', - pnId: '', - pnlist: ref([]), - storageOkQty: '', - lotNo: '', - description: '', - productBomItemValueDOList: [] - } - matCount = matCount + 1 - - formData.value.matItemDOList.push(newData) - } else { - message.alertWarning('请选择出库仓库') + const newData = { + // 新数据的属性 + cid: matCount, + isCopy: 0, + stockId: 0, + matId: '', + matName: '', + matCode: '', + matType: '', + matSpec: '', + matUnit: '', + matRest: '', + whId: '', + rgId: '', + pnId: '', + pnlist: ref([]), + storageOkQty: '', + lotNo: '', + description: '', + productBomItemValueDOList: [] } + matCount = matCount + 1 + + formData.value.matItemDOList.push(newData) } //删除新增物料信息 const handleDelete2 = (index: number) => { - formData.value.matItemDOList.splice(index, 1) + var itemDelteing = formData.value.matItemDOList[index] + if (itemDelteing.isCopy == 0) { + message.alertWarning("原始物料不能删除") + } else { + formData.value.matItemDOList.splice(index, 1) + } } //仓库全数据 -const warehouseList = ref([]) +const whList = ref([]) //库区全数据 var rgList = ref([]) //库位全数据 var pnList = ref([]) -const handleWh = async (wid) => { - //-------------------库区全数据 - const queryParamsRg = reactive({ - pageNo: 1, - pageSize: 99, - whId: wid - }) - const dataRg = await RgApi.getRgPage(queryParamsRg) - - rgList.value = [] - pnList.value = [] - rgList.value = dataRg.list - const matLastRemoteData = await CheckMatApi.getStorageMatList() - - let matParams = { - pageNo: 1, - pageSize: 99, - status: '1' - } - const dataMat = await MatApi.getMaterialPage(matParams) - matList.value = [] - matList.value = dataMat.list.filter( - (item) => - matLastRemoteData.find((fish) => fish.matId === item.id && fish.whId == wid) !== undefined - ) - - formData.value.matItemDOList = [] - // formData.value.matItemDOList.forEach(item => { - // item.rgId = '' - // item.pnId = '' - // item.pnlist.value = [] - // }) - //------------------- -} const handleRg = async (scope) => { //-------------------库位全数据 const queryParamsRPn = reactive({ @@ -616,203 +551,20 @@ const handleRg = async (scope) => { //------------------- } -const matList = ref([]) // 物料列表 -const matSelectLoading = ref(false) -const remoteMatCodeSearch = async (name) => { - matSelectLoading.value = true - // 获得用户列表 - let matParams = { - pageNo: 1, - pageSize: 10, - name: name, - status: '1' - } - - const matLastRemoteData = await CheckMatApi.getStorageMatList() - - const dataMat = await MatApi.getMaterialPage(matParams) - matList.value = [] - matList.value = dataMat.list.filter( - (item) => - matLastRemoteData.find( - (fish) => fish.matId === item.id && fish.whId == formData.value.whId - ) !== undefined - ) - matSelectLoading.value = false -} - -const handleMatCode = async (scope, matid) => { - if (matid && matLastData.value.find((item) => item.matId === matid)) { - const matVo = matLastData.value.find((item) => item.matId === matid) - scope.row.matId = matVo.matId - scope.row.matName = matVo.matName - scope.row.matCode = matVo.matCode - scope.row.matSpec = matVo.matSpec - scope.row.matType = matVo.materialType - scope.row.matUnit = matVo.matUnit - scope.row.rgId = matVo.rgId - scope.row.pnId = matVo.pnId - scope.row.matRest = matVo.matRest - scope.row.storageOkQty = matVo.storageOkQty - scope.row.lotNo = matVo.lotNo - scope.row.description = matVo.description - - const queryParamsRPn = reactive({ - pageNo: 1, - pageSize: 99, - rgId: scope.row.rgId, - pnStatus: 1 - }) - const dataPn = await PnApi.getPnPage(queryParamsRPn) - scope.row.pnlist = dataPn.list - } else { - scope.row.matId = '' - scope.row.matName = '' - scope.row.matCode = '' - scope.row.matSpec = '' - scope.row.matType = '' - scope.row.matUnit = '' - scope.row.rgId = '' - scope.row.pnId = '' - scope.row.matRest = '' - scope.row.storageOkQty = '' - scope.row.lotNo = '' - scope.row.description = '' - scope.row.pnlist = [] - } -} - const isShowBtnGroup = ref(true) const isShowBtnCancel = ref(false) const isShowBtnOther = ref(false) const isShowBtnDelete = ref(true) -const btnWhClickable = ref(false) -const matLastData = ref([]) /** 初始化 **/ onMounted(async () => { - btnWhClickable.value = query.type === 'update' ? true : false - - matLastData.value = await CheckMatApi.getStorageMatList() - - // 获得物料列表 - let matParams = { + // 附件信息 + let attParams = { pageNo: 1, pageSize: 99, - status: '1' + businessId: query.id, + businessType: 'STORAGECHECK' } - const dataMat = await MatApi.getMaterialPage(matParams) - matList.value = [] - matList.value = dataMat.list - - dialogTitle.value = t('action.' + query.type) - dialogTitle.value = query.type === 'review' ? '查看' : dialogTitle.value - - //-------------------仓库全数据 - const data = await WhApi.getWarehouseSimpList() - warehouseList.value = data - //------------------- - if (query.id) { - //获取库存信息 - formData.value = await CheckApi.getStorage(query.id) - - switch (formData.value.status) { - case 1: - isShowBtnGroup.value = true - isShowBtnCancel.value = false - isShowBtnDelete.value = true - break - case 2: - isShowBtnGroup.value = false - isShowBtnCancel.value = true - isShowBtnOther.value = false - isShowBtnDelete.value = false - break - case 3: - isShowBtnGroup.value = false - isShowBtnCancel.value = false - isShowBtnOther.value = false - isShowBtnDelete.value = false - break - default: - break - } - //查看页面不可以编辑 - if (query.type === 'review') { - isShowBtnGroup.value = false - isShowBtnCancel.value = false - isShowBtnOther.value = false - isShowBtnDelete.value = false - } - - //获得库区列表 - const queryParamsRg = reactive({ - pageNo: 1, - pageSize: 99, - status: 1, - whId: formData.value.whId - }) - const dataRg = await RgApi.getRgPage(queryParamsRg) - - rgList.value = [] - rgList.value = dataRg.list - //获得库区列表 - const queryParamsPn = reactive({ - pageNo: 1, - pageSize: 99 - }) - const dataPn = await PnApi.getPnPage(queryParamsPn) - - pnList.value = [] - pnList.value = dataPn.list - - //获取库存物料列表信息 - const queryParamsMat = reactive({ - pageNo: 1, - pageSize: 99, - stockId: query.id - }) - const dataMats = await CheckMatApi.getStorageMatPage(queryParamsMat) - formData.value.matItemDOList = dataMats.list - - //获取原始物料信息 - const queryParamsMat2 = reactive({ - pageNo: 1, - pageSize: 99, - status: 1 - }) - const matVos = await MatApi.getMaterialPage(queryParamsMat2) - - formData.value.matItemDOList.forEach((item) => { - item.cid = matCount - item.matId = matVos.list.find((record) => record.id === item.matId)?.id - //item.matCode = matVos.list.find( (record) => record.id === item.matId)?.id - item.matCode = matVos.list.find((record) => record.id == item.matId)?.code - item.matSpec = matVos.list.find((record) => record.id == item.matId)?.spec - item.matType = matVos.list.find((record) => record.id == item.matId)?.materialType - item.matUnit = matVos.list.find((record) => record.id == item.matId)?.unit - item.pnlist = pnList.value.filter((pn) => pn.rgId == item.rgId) - item.matRest = matLastData.value.find( - (rest) => rest.rgId == item.rgId && rest.pnId == item.pnId - )?.matRest - item.matRest = item.matRest == undefined ? 0 : item.matRest - matCount = matCount + 1 - - // item = matLastData.value.find((rest) => rest.rgId === item.rgId && rest.pnId === item.pnId) - // item.pnlist = pnList.value.filter((pn) => pn.rgId === item.rgId) - // item.cid = matCount - // matCount = matCount + 1 - }) - - // 附件信息 - let attParams = { - pageNo: 1, - pageSize: 99, - businessId: query.id, - businessType: 'STORAGE' - } - formData.value.attachments = (await getFilePage(attParams)).list - } - + formData.value.attachments = (await getFilePage(attParams)).list //用户信息 userList.value = await UserApi.getSimpleUserList() }) From 66bb7d59596c42bb2e8afb5a4913577279d4c544 Mon Sep 17 00:00:00 2001 From: siontion Date: Mon, 29 Jan 2024 22:13:59 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E5=BA=93=E5=AD=98=E7=9B=98=E7=82=B9?= =?UTF-8?q?=E7=BC=96=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 库存盘点编辑 --- .../src/views/heli/storage/StorageForm.vue | 2 +- .../src/views/heli/storage/StorageOut.vue | 2 +- .../views/heli/storagecheck/checkdetail.vue | 110 +++++++----------- .../src/views/heli/storagecheck/index.vue | 17 ++- 4 files changed, 59 insertions(+), 72 deletions(-) diff --git a/mes-ui/mes-ui-admin-vue3/src/views/heli/storage/StorageForm.vue b/mes-ui/mes-ui-admin-vue3/src/views/heli/storage/StorageForm.vue index 0ad19f5d..23d980ba 100644 --- a/mes-ui/mes-ui-admin-vue3/src/views/heli/storage/StorageForm.vue +++ b/mes-ui/mes-ui-admin-vue3/src/views/heli/storage/StorageForm.vue @@ -667,7 +667,7 @@ const saveFormData = async () => { const dataMats = formData.value.matItemDOList as unknown as StorageMatApi.StorageMatVO[] await StorageMatApi.createStorageMatBatch(dataMats, storageid.value) - if (formData.value.matItemDOList.length > 0) { + if (formData.value.attachments!=undefined && formData.value.attachments.length > 0) { //附件信息保存 matUploadData.value.businessId = storageid matUploadRef.value!.submit() diff --git a/mes-ui/mes-ui-admin-vue3/src/views/heli/storage/StorageOut.vue b/mes-ui/mes-ui-admin-vue3/src/views/heli/storage/StorageOut.vue index 3b8340de..faa083a6 100644 --- a/mes-ui/mes-ui-admin-vue3/src/views/heli/storage/StorageOut.vue +++ b/mes-ui/mes-ui-admin-vue3/src/views/heli/storage/StorageOut.vue @@ -662,7 +662,7 @@ const saveFormData = async () => { const dataMats = formData.value.matItemDOList as unknown as StorageMatApi.StorageMatVO[] await StorageMatApi.createStorageMatBatch(dataMats, storageid.value) - if (formData.value.matItemDOList.length > 0) { + if (formData.value.attachments!=undefined && formData.value.attachments.length > 0) { //附件信息保存 matUploadData.value.businessId = storageid matUploadRef.value!.submit() diff --git a/mes-ui/mes-ui-admin-vue3/src/views/heli/storagecheck/checkdetail.vue b/mes-ui/mes-ui-admin-vue3/src/views/heli/storagecheck/checkdetail.vue index f6730b73..a97e04c6 100644 --- a/mes-ui/mes-ui-admin-vue3/src/views/heli/storagecheck/checkdetail.vue +++ b/mes-ui/mes-ui-admin-vue3/src/views/heli/storagecheck/checkdetail.vue @@ -30,7 +30,7 @@ - + @@ -62,7 +62,7 @@ - + {{ dict.label }} @@ -74,7 +74,7 @@ - @@ -84,7 +84,7 @@ - + @@ -250,11 +250,11 @@ @@ -272,7 +272,6 @@ import * as CheckApi from '@/api/heli/storagecheck' import * as CheckMatApi from '@/api/heli/storagecheckmat' import * as UserApi from '@/api/system/user' -import * as MatApi from '@/api/heli/material' import * as WhApi from '@/api/heli/warehouse' import * as RgApi from '@/api/heli/rg' import * as PnApi from '@/api/heli/pn' @@ -340,52 +339,6 @@ const handleStatus = async (num) => { } catch (e) { return } - //保存表单数据 - await saveFormData() - - formData.value.status = num - - const dataUpdate = formData.value as unknown as CheckApi.StorageVO - if (num == 2) { - dataUpdate.outbound = useUserStore().getUser.id - } else { - dataUpdate.cancel = useUserStore().getUser.id - } - await CheckApi.updateStorageStatus(dataUpdate) - - message.success(t('common.updateSuccess')) - - switch (num) { - case 1: - isShowBtnGroup.value = true - isShowBtnCancel.value = false - isShowBtnOther.value = true - isShowBtnDelete.value = true - break - case 2: - isShowBtnGroup.value = false - isShowBtnCancel.value = true - isShowBtnOther.value = false - isShowBtnDelete.value = false - break - case 3: - isShowBtnGroup.value = false - isShowBtnCancel.value = false - isShowBtnOther.value = false - isShowBtnDelete.value = false - break - default: - break - } - //查看页面不可以编辑 - if (query.type === 'review') { - isShowBtnGroup.value = false - isShowBtnCancel.value = false - isShowBtnOther.value = false - isShowBtnDelete.value = false - } - query.id = formData.value.id - query.type = 'update' reload() } const userList = ref([]) // 用户列表 @@ -453,15 +406,26 @@ const saveFormData = async () => { // 提交请求 formLoading.value = true try { + + const data = formData.value as unknown as CheckApi.StorageCheckVO + await CheckApi.updateStorageCheck(data) //物料信息保存 - formData.value.matItemDOList.forEach((item) => { - item.stockId = formData.value.id - item.whId = formData.value.whId - }) + if( formData.value.matItemDOList){ + formData.value.matItemDOList.forEach((item) => { + item.stockId = formData.value.id + item.whId = formData.value.whId + }) + } const dataMats = formData.value.matItemDOList as unknown as CheckMatApi.StorageCheckMatVO[] - await CheckMatApi.createStorageMatBatch(dataMats, formData.value.id) + //await CheckMatApi.createStorageMatBatch(dataMats, formData.value.id) - if (formData.value.matItemDOList.length > 0) { + if (formData.value.matItemDOList !=undefined &&formData.value.matItemDOList.length > 0) { + //附件信息保存 + matUploadData.value.businessId = formData.value.id + matUploadRef.value!.submit() + } + + if (formData.value.attachments!=undefined && formData.value.attachments.length > 0) { //附件信息保存 matUploadData.value.businessId = formData.value.id matUploadRef.value!.submit() @@ -474,10 +438,10 @@ const saveFormData = async () => { const submitForm = async () => { // 校验表单 await formRef.value.validate() - if (formData.value.matItemDOList.length === 0) { - message.alertWarning('请添加物料信息!') - return - } + // if (formData.value.matItemDOList ==undefined || formData.value.matItemDOList.length === 0) { + // message.alertWarning('请添加物料信息!') + // return + // } // 校验子表单 try { await matSubFormRef.value.validate() @@ -487,8 +451,6 @@ const submitForm = async () => { //保存表单数据 await saveFormData() // 成功后刷新 - query.id = formData.value.id - query.type = 'update' reload() } @@ -551,12 +513,24 @@ const handleRg = async (scope) => { //------------------- } -const isShowBtnGroup = ref(true) -const isShowBtnCancel = ref(false) const isShowBtnOther = ref(false) const isShowBtnDelete = ref(true) + +//仓库列表 +const init_page_wh = (async ()=>{ + whList.value = await WhApi.getSimpList() +}) +//库区列表 +const init_page_rg = (async ()=>{ + rgList.value = await RgApi.getSimpList() +}) /** 初始化 **/ onMounted(async () => { + + await init_page_wh() + await init_page_rg() + formData.value = await CheckApi.getStorageCheck(query.id) + // 附件信息 let attParams = { pageNo: 1, diff --git a/mes-ui/mes-ui-admin-vue3/src/views/heli/storagecheck/index.vue b/mes-ui/mes-ui-admin-vue3/src/views/heli/storagecheck/index.vue index 4b3d4786..f6d39306 100644 --- a/mes-ui/mes-ui-admin-vue3/src/views/heli/storagecheck/index.vue +++ b/mes-ui/mes-ui-admin-vue3/src/views/heli/storagecheck/index.vue @@ -59,9 +59,17 @@ - + + + - + + +