From b2e1c3ca71c0a9cf611002721c6c830b8403f1f3 Mon Sep 17 00:00:00 2001 From: zxy Date: Wed, 21 Jan 2026 14:06:26 +0800 Subject: [PATCH] =?UTF-8?q?=E7=89=A9=E6=96=99=E9=87=8D=E9=87=8F=E8=AE=A1?= =?UTF-8?q?=E7=AE=97=E5=85=AC=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../module/heli/enums/ErrorCodeConstants.java | 2 + .../admin/formal/vo/FormalRespVO.java | 10 +- .../admin/formal/vo/FormalSaveReqVO.java | 4 +- .../heli/dal/dataobject/formal/FormalDO.java | 3 + .../heli/dal/mysql/formal/FormalMapper.java | 40 ++++-- .../service/formal/FormalServiceImpl.java | 12 +- mes-ui/mes-ui-admin-vue3/src/utils/dict.ts | 2 + .../src/views/heli/formal/FormalForm.vue | 45 +++++-- .../src/views/heli/formal/index.vue | 120 +++++++++++------- .../src/views/heli/storage/StorageForm.vue | 10 +- 10 files changed, 168 insertions(+), 80 deletions(-) diff --git a/mes-module-heli/mes-module-heli-api/src/main/java/com/chanko/yunxi/mes/module/heli/enums/ErrorCodeConstants.java b/mes-module-heli/mes-module-heli-api/src/main/java/com/chanko/yunxi/mes/module/heli/enums/ErrorCodeConstants.java index 79d2aad1..ccd38fac 100644 --- a/mes-module-heli/mes-module-heli-api/src/main/java/com/chanko/yunxi/mes/module/heli/enums/ErrorCodeConstants.java +++ b/mes-module-heli/mes-module-heli-api/src/main/java/com/chanko/yunxi/mes/module/heli/enums/ErrorCodeConstants.java @@ -171,4 +171,6 @@ public interface ErrorCodeConstants { ErrorCode TASK_IN_REPORT_NOT_REWORK = new ErrorCode(1_013_007 , "该报工没有完成,不允许返工,请确认"); ErrorCode THIS_SHIPMENT_CANNOT_BE_INVALIDATED = new ErrorCode(1_013_008 , "该出库不允许作废,请刷新界面"); + ErrorCode THERE_EXISTS_WEIGHT_CALCULATION_FORMULA = new ErrorCode(1_013_009 , "该物料类型存在重量计算公式,请确认"); + } diff --git a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/formal/vo/FormalRespVO.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/formal/vo/FormalRespVO.java index 26e93dde..a2824994 100644 --- a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/formal/vo/FormalRespVO.java +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/formal/vo/FormalRespVO.java @@ -37,4 +37,12 @@ public class FormalRespVO { @ExcelProperty("创建时间") private LocalDateTime createTime; -} \ No newline at end of file + @Schema(description = "创建者") + @ExcelProperty("创建者") + private String creator; + + @Schema(description = "创建者名称") + @ExcelProperty("创建者名称") + private String creatorName; + +} diff --git a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/formal/vo/FormalSaveReqVO.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/formal/vo/FormalSaveReqVO.java index 513d59b2..31058a4d 100644 --- a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/formal/vo/FormalSaveReqVO.java +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/formal/vo/FormalSaveReqVO.java @@ -23,8 +23,8 @@ public class FormalSaveReqVO { @Schema(description = "描述", example = "你猜") private String description; - @Schema(description = "状态,1表示正常,2表示禁用", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") + @Schema(description = "状态,1表示正常,2表示禁用", requiredMode = Schema.RequiredMode.REQUIRED, example = "true") @NotNull(message = "状态,1表示正常,2表示禁用不能为空") - private Boolean status; + private Boolean status = true; } diff --git a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/dataobject/formal/FormalDO.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/dataobject/formal/FormalDO.java index e343cb30..5de4cdaf 100644 --- a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/dataobject/formal/FormalDO.java +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/dataobject/formal/FormalDO.java @@ -44,4 +44,7 @@ public class FormalDO extends BaseDO { */ private Boolean status; + @TableField(exist = false) + private String creatorName; + } \ No newline at end of file diff --git a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/mysql/formal/FormalMapper.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/mysql/formal/FormalMapper.java index 738d949c..9d63c5e5 100644 --- a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/mysql/formal/FormalMapper.java +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/mysql/formal/FormalMapper.java @@ -1,11 +1,14 @@ package com.chanko.yunxi.mes.module.heli.dal.mysql.formal; +import java.time.LocalDateTime; import java.util.*; import com.chanko.yunxi.mes.framework.common.pojo.PageResult; -import com.chanko.yunxi.mes.framework.mybatis.core.query.LambdaQueryWrapperX; import com.chanko.yunxi.mes.framework.mybatis.core.mapper.BaseMapperX; import com.chanko.yunxi.mes.module.heli.dal.dataobject.formal.FormalDO; +import com.chanko.yunxi.mes.module.heli.dal.dataobject.taskreport.TaskReportDO; +import com.chanko.yunxi.mes.module.system.dal.dataobject.user.AdminUserDO; +import com.github.yulichang.wrapper.MPJLambdaWrapper; import org.apache.ibatis.annotations.Mapper; import com.chanko.yunxi.mes.module.heli.controller.admin.formal.vo.*; @@ -18,13 +21,30 @@ import com.chanko.yunxi.mes.module.heli.controller.admin.formal.vo.*; public interface FormalMapper extends BaseMapperX { default PageResult selectPage(FormalPageReqVO reqVO) { - return selectPage(reqVO, new LambdaQueryWrapperX() - .eqIfPresent(FormalDO::getMatType, reqVO.getMatType()) - .eqIfPresent(FormalDO::getFormal, reqVO.getFormal()) - .eqIfPresent(FormalDO::getDescription, reqVO.getDescription()) - .eqIfPresent(FormalDO::getStatus, reqVO.getStatus()) - .betweenIfPresent(FormalDO::getCreateTime, reqVO.getCreateTime()) - .orderByDesc(FormalDO::getId)); + MPJLambdaWrapper query = new MPJLambdaWrapper<>(); + query.selectAll(FormalDO.class) + .select("u.nickname as creatorName") + .leftJoin(AdminUserDO.class, "u", AdminUserDO::getId, FormalDO::getCreator) + .eq(reqVO.getMatType() != null, FormalDO::getMatType, reqVO.getMatType()) + .eq(reqVO.getFormal() != null, FormalDO::getFormal, reqVO.getFormal()) + .eq(reqVO.getStatus() != null, FormalDO::getStatus, reqVO.getStatus()) + .disableSubLogicDel(); +// if (reqVO.getCreateTime() != null) { +// LocalDateTime endDateTime = reqVO.getCreateTime()[1]; +// // 重置时间为 23:59:59 +// LocalDateTime endOfDay = endDateTime +// .withHour(23) +// .withMinute(59) +// .withSecond(59); +// query.between(FormalDO::getCreateTime, reqVO.getCreateTime()[0], endOfDay); +// } + return selectPage(reqVO, query); } - -} \ No newline at end of file + // 查询当前物料类型计算公式 + default FormalDO selectOneByMatType(String matType) { + return selectOne(new MPJLambdaWrapper() + .eq(FormalDO::getMatType, matType) + .eq(FormalDO::getStatus, true) + .disableSubLogicDel()); + } +} diff --git a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/formal/FormalServiceImpl.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/formal/FormalServiceImpl.java index e92b3289..9d187fa4 100644 --- a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/formal/FormalServiceImpl.java +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/formal/FormalServiceImpl.java @@ -31,6 +31,11 @@ public class FormalServiceImpl implements FormalService { @Override public Long createFormal(FormalSaveReqVO createReqVO) { + // 校验存在 + FormalDO formalDO = formalMapper.selectOneByMatType(createReqVO.getMatType()); + if (formalDO != null) { + throw exception(THERE_EXISTS_WEIGHT_CALCULATION_FORMULA); + } // 插入 FormalDO formal = BeanUtils.toBean(createReqVO, FormalDO.class); formalMapper.insert(formal); @@ -40,6 +45,11 @@ public class FormalServiceImpl implements FormalService { @Override public void updateFormal(FormalSaveReqVO updateReqVO) { + FormalDO formalDO = formalMapper.selectOneByMatType(updateReqVO.getMatType()); + if (formalDO != null && !formalDO.getId().equals(updateReqVO.getId())) { + throw exception(THERE_EXISTS_WEIGHT_CALCULATION_FORMULA); + } + // 校验存在 validateFormalExists(updateReqVO.getId()); // 更新 @@ -57,7 +67,7 @@ public class FormalServiceImpl implements FormalService { private void validateFormalExists(Long id) { if (formalMapper.selectById(id) == null) { -// throw exception(FORMAL_NOT_EXISTS); + throw exception(THE_DATA_DOES_NOT_EXIST); } } diff --git a/mes-ui/mes-ui-admin-vue3/src/utils/dict.ts b/mes-ui/mes-ui-admin-vue3/src/utils/dict.ts index 91054c28..5e3b4fb2 100644 --- a/mes-ui/mes-ui-admin-vue3/src/utils/dict.ts +++ b/mes-ui/mes-ui-admin-vue3/src/utils/dict.ts @@ -305,4 +305,6 @@ export enum DICT_TYPE { HELI_PLAN_TASK_STATUS = 'heli_plan_task_status', //bom状态 + HELI_FOR_MAT_TYPE = 'for_mat_type', // 物料类型 + } diff --git a/mes-ui/mes-ui-admin-vue3/src/views/heli/formal/FormalForm.vue b/mes-ui/mes-ui-admin-vue3/src/views/heli/formal/FormalForm.vue index ec5bbcb4..bd6e109a 100644 --- a/mes-ui/mes-ui-admin-vue3/src/views/heli/formal/FormalForm.vue +++ b/mes-ui/mes-ui-admin-vue3/src/views/heli/formal/FormalForm.vue @@ -1,5 +1,5 @@