From 271edea9abb9583761f67c772e71b78f377e476c Mon Sep 17 00:00:00 2001 From: siontion Date: Tue, 23 Jan 2024 12:36:05 +0800 Subject: [PATCH] =?UTF-8?q?=E5=87=BA=E5=85=A5=E5=BA=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 出入库 --- .../admin/storage/StorageController.java | 2 +- .../heli/dal/mysql/storage/StorageMapper.java | 7 +- .../src/views/heli/pn/index.vue | 12 +-- .../src/views/heli/rg/index.vue | 8 +- .../src/views/heli/storage/StorageForm.vue | 75 ++++++++++++------- .../src/views/heli/storage/StorageOut.vue | 70 +++++++++++------ 6 files changed, 115 insertions(+), 59 deletions(-) diff --git a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/storage/StorageController.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/storage/StorageController.java index 9c61884e..1eeed880 100644 --- a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/storage/StorageController.java +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/storage/StorageController.java @@ -64,7 +64,7 @@ public class StorageController { if(updateReqVO.getStatus().equals(2) && updateReqVO.getStockType().equals(1)){ targetDo.setKeeper(updateReqVO.getKeeper()); targetDo.setKeeperTime(currTime); - }if(updateReqVO.getStatus().equals(2) && updateReqVO.getStockType().equals(2)){ + } else if(updateReqVO.getStatus().equals(2) && updateReqVO.getStockType().equals(2)){ targetDo.setOutbound(updateReqVO.getOutbound()); targetDo.setOutboundTime(currTime); }else{ diff --git a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/mysql/storage/StorageMapper.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/mysql/storage/StorageMapper.java index 4d0c2931..f6735725 100644 --- a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/mysql/storage/StorageMapper.java +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/mysql/storage/StorageMapper.java @@ -28,19 +28,18 @@ public interface StorageMapper extends BaseMapperX { default PageResult selectPage(StoragePageReqVO reqVO) { MPJLambdaWrapper query = new MPJLambdaWrapper<>(); query.selectAll(StorageDO.class) - .select("mat.code as matNo", "mat.name as matName") .leftJoin(StorageMatDO.class, "sm", StorageMatDO::getStockId, StorageDO::getId) .leftJoin(MaterialDO.class, "mat", MaterialDO::getId, StorageMatDO::getMatId) .orderByDesc(StorageDO::getId); - query.like(!StringUtils.isEmpty(reqVO.getMatNo()), "mat.code", reqVO.getMatNo()) - .like(!StringUtils.isEmpty(reqVO.getMatName()), "mat.name", reqVO.getMatName()) + query.like(!StringUtils.isEmpty(reqVO.getMatNo()), MaterialDO::getCode, reqVO.getMatNo()) + .like(!StringUtils.isEmpty(reqVO.getMatName()), MaterialDO::getName, reqVO.getMatName()) .like(!StringUtils.isEmpty(reqVO.getStockNo()),StorageDO::getStockNo, reqVO.getStockNo()) .like(!StringUtils.isEmpty(reqVO.getHeaderNo()),StorageDO::getHeaderNo, reqVO.getHeaderNo()) .eq(reqVO.getStockType() != null,StorageDO::getStockType, reqVO.getStockType()) .eq(reqVO.getStockInType() != null,StorageDO::getStockInType, reqVO.getStockInType()) .eq(reqVO.getWhId() != null,StorageDO::getWhId, reqVO.getWhId()) - .eq(reqVO.getStatus() != null,StorageDO::getStatus, reqVO.getStatus()); + .eq(reqVO.getStatus() != null,StorageDO::getStatus, reqVO.getStatus()).distinct(); return selectPage(reqVO,query); // return selectPage(reqVO, new LambdaQueryWrapperX() diff --git a/mes-ui/mes-ui-admin-vue3/src/views/heli/pn/index.vue b/mes-ui/mes-ui-admin-vue3/src/views/heli/pn/index.vue index 365767dd..60507c47 100644 --- a/mes-ui/mes-ui-admin-vue3/src/views/heli/pn/index.vue +++ b/mes-ui/mes-ui-admin-vue3/src/views/heli/pn/index.vue @@ -125,6 +125,9 @@ const rgSelected = ref([]) /** 查询列表 */ const getList = async () => { + + await initPageData() + loading.value = true try { const data = await PnApi.getPnPage(queryParams) @@ -193,10 +196,7 @@ const handleExport = async () => { exportLoading.value = false } } - -/** 初始化 **/ -onMounted(async () => { - +const initPageData = async () =>{ const queryParamsWh = reactive({ pageNo: 1, pageSize: 99, @@ -219,7 +219,9 @@ onMounted(async () => { }); rgList.value = dataRg.list - +} +/** 初始化 **/ +onMounted(async () => { await getList() }) diff --git a/mes-ui/mes-ui-admin-vue3/src/views/heli/rg/index.vue b/mes-ui/mes-ui-admin-vue3/src/views/heli/rg/index.vue index 59b9f006..f51af0a3 100644 --- a/mes-ui/mes-ui-admin-vue3/src/views/heli/rg/index.vue +++ b/mes-ui/mes-ui-admin-vue3/src/views/heli/rg/index.vue @@ -116,6 +116,7 @@ const warehouseList = ref([]) /** 查询列表 */ const getList = async () => { + await initPageData() loading.value = true try { const data = await RgApi.getRgPage(queryParams) @@ -172,9 +173,7 @@ const handleExport = async () => { } } -/** 初始化 **/ -onMounted(async () => { - +const initPageData = async () =>{ const queryParamsWarehouse = reactive({ pageNo: 1, pageSize: 99, @@ -188,6 +187,9 @@ onMounted(async () => { }); warehouseList.value = data.list +} +/** 初始化 **/ +onMounted(async () => { await getList() }) 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 2ffc0ae6..88258bfc 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 @@ -74,7 +74,7 @@ - {{ formatDate(formData.createTime, 'YYYY-MM-DD HH:mm') }} + {{ formatDate(formData.createTime, 'YYYY-MM-DD HH:mm:ss') }} @@ -295,7 +295,7 @@ link type="danger" @click.prevent="handleDelete2(scope.$index)" - v-bind:disabled="isShowBtnOther" + v-if="isShowBtnOther" > 删除 @@ -357,7 +357,7 @@ type="danger" size="small" @click="handleDeleteAttachment(scope.$index, scope.row.businessFileType)" - v-bind:disabled="isShowBtnOther" + v-if="isShowBtnOther" > 删除 @@ -365,7 +365,6 @@ link type="primary" size="small" - v-if="isShow" @click="downloadAttachment(scope.row.name, scope.row.url)" > 下载 @@ -391,7 +390,7 @@ - {{ formatDate(formData.createTime, 'YYYY-MM-DD HH:mm') }} + {{ formatDate(formData.createTime, 'YYYY-MM-DD HH:mm:ss') }} @@ -403,7 +402,7 @@ - {{ formatDate(formData.keeperTime, 'YYYY-MM-DD HH:mm') }} + {{ formatDate(formData.keeperTime, 'YYYY-MM-DD HH:mm:ss') }} @@ -415,7 +414,7 @@ - {{ formatDate(formData.cancelTime, 'YYYY-MM-DD HH:mm') }} + {{ formatDate(formData.cancelTime, 'YYYY-MM-DD HH:mm:ss') }} @@ -491,7 +490,7 @@ const formData = ref({ status: 1, whId: undefined, creator: undefined, - createTime: formatDate(new Date(), 'YYYY-MM-DD HH:mm'), + createTime: formatDate(new Date(), 'YYYY-MM-DD HH:mm:ss'), keeper: undefined, keeperTime: undefined, outbound: undefined, @@ -518,6 +517,22 @@ const subFormRules = reactive({ storageOkQty: [{ required: true, message: '入库数量不能为空', trigger: 'blur' }] }) const handleStatus = async (num) => { + + // 校验表单 + await formRef.value.validate() + if(formData.value.matItemDOList.length === 0){ + message.alertWarning('请添加物料信息!') + return + } + // 校验子表单 + try { + await matSubFormRef.value.validate() + } catch (e) { + return + } + //保存表单数据 + await saveFormData() + formData.value.status = num const dataUpdate = formData.value as unknown as StorageApi.StorageVO @@ -555,8 +570,7 @@ const handleStatus = async (num) => { isShowBtnOther.value = true } query.type= 'update' - query.id = storageid.value - formData.value.id = storageid.value + query.id = formData.value.id reload() } @@ -620,15 +634,8 @@ var commonResult = '' /** 提交表单 */ const emit = defineEmits(['success']) // 定义 success 事件,用于操作成功后的回调 -const submitForm = async () => { - // 校验表单 - await formRef.value.validate() - // 校验子表单 - try { - await matSubFormRef.value.validate() - } catch (e) { - return - } + +const saveFormData = async () =>{ // 提交请求 formLoading.value = true try { @@ -655,18 +662,36 @@ const submitForm = async () => { matUploadData.value.businessId = storageid matUploadRef.value!.submit() } - + formData.value = await StorageApi.getStorage(storageid.value) message.success(t(commonResult)) - // 成功后刷新 - query.type= 'update' - query.id = storageid.value - formData.value.id = storageid.value - reload(); } finally { formLoading.value = false } } +const submitForm = async () => { + // 校验表单 + await formRef.value.validate() + if(formData.value.matItemDOList.length === 0){ + message.alertWarning('请添加物料信息!') + return + } + // 校验子表单 + try { + await matSubFormRef.value.validate() + } catch (e) { + return + } + //保存表单数据 + await saveFormData() + + // 成功后刷新 + query.type= 'update' + query.id = storageid.value + formData.value.id = storageid.value + //页面重新加载 + reload(); +} var matCount = 1 const onAddItem = () => { 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 441ff1cf..21b3667e 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 @@ -267,7 +267,7 @@ type="danger" size="small" @click.prevent="handleDelete2(scope.$index)" - v-bind:disabled="isShowBtnOther" + v-if="isShowBtnOther" > 删除 @@ -328,7 +328,7 @@ link type="danger" size="small" - v-bind:disabled="isShowBtnOther" + v-if="isShowBtnOther" @click="handleDeleteAttachment(scope.$index, scope.row.businessFileType)" > 删除 @@ -337,7 +337,6 @@ link type="primary" size="small" - v-if="isShow" @click="downloadAttachment(scope.row.name, scope.row.url)" > 下载 @@ -491,6 +490,22 @@ const subFormRules = reactive({ storageOkQty: [{ required: true, message: '出库数量不能为空', trigger: 'blur' }] }) const handleStatus = async (num) => { + + // 校验表单 + await formRef.value.validate() + if(formData.value.matItemDOList.length === 0){ + message.alertWarning('请添加物料信息!') + return + } + // 校验子表单 + try { + await matSubFormRef.value.validate() + } catch (e) { + return + } + //保存表单数据 + await saveFormData() + formData.value.status = num const dataUpdate = formData.value as unknown as StorageApi.StorageVO @@ -507,14 +522,17 @@ const handleStatus = async (num) => { case 1: isShowBtnGroup.value = true isShowBtnCancel.value = false + isShowBtnOther.value = true break case 2: isShowBtnGroup.value = false isShowBtnCancel.value = true + isShowBtnOther.value = false break case 3: isShowBtnGroup.value = false isShowBtnCancel.value = false + isShowBtnOther.value = false break default: break @@ -523,11 +541,10 @@ const handleStatus = async (num) => { if (query.type === 'review') { isShowBtnGroup.value = false isShowBtnCancel.value = false - isShowBtnOther.value = true + isShowBtnOther.value = false } query.id = storageid.value query.type= 'update' - formData.value.id = storageid.value reload() } const userList = ref([]) // 用户列表 @@ -590,16 +607,8 @@ var commonResult = '' /** 提交表单 */ const emit = defineEmits(['success']) // 定义 success 事件,用于操作成功后的回调 -const submitForm = async () => { - // 校验表单 - await formRef.value.validate() - // 校验子表单 - try { - await matSubFormRef.value.validate() - } catch (e) { - return - } +const saveFormData = async () =>{ //获取最新库存信息 const matCurrentData = await StorageMatApi.getStorageMatList() var hasRestNum = true @@ -646,18 +655,35 @@ const submitForm = async () => { matUploadData.value.businessId = storageid matUploadRef.value!.submit() } - + formData.value = await StorageApi.getStorage(storageid.value) message.success(t(commonResult)) - // 成功后刷新 - query.id = storageid.value - query.type= 'update' - formData.value.id = storageid.value - reload() + + } finally { formLoading.value = false } } +const submitForm = async () => { + // 校验表单 + await formRef.value.validate() + if(formData.value.matItemDOList.length === 0){ + message.alertWarning('请添加物料信息!') + return + } + // 校验子表单 + try { + await matSubFormRef.value.validate() + } catch (e) { + return + } + //保存表单数据 + await saveFormData() + // 成功后刷新 + query.id = storageid.value + query.type= 'update' + reload() +} var matCount = 1 const onAddItem = () => { @@ -850,10 +876,12 @@ onMounted(async () => { case 2: isShowBtnGroup.value = false isShowBtnCancel.value = true + isShowBtnOther.value = false break case 3: isShowBtnGroup.value = false isShowBtnCancel.value = false + isShowBtnOther.value = false break default: break @@ -862,7 +890,7 @@ onMounted(async () => { if (query.type === 'review') { isShowBtnGroup.value = false isShowBtnCancel.value = false - isShowBtnOther.value = true + isShowBtnOther.value = false } //获得库区列表