From ff8ce551db112a8b18294aa9f7b56edfbd9b8db7 Mon Sep 17 00:00:00 2001 From: ljw Date: Sat, 17 Jan 2026 16:58:55 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B7=A5=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dispose/mfg/bom/service/BomService.java | 4 +- .../controller/CraftOperationController.java | 6 ++- .../pojo/entity/CraftOperationEntity.java | 8 +++- .../pojo/param/SearchCraftOperationParam.java | 39 +++++++++++++++++++ .../craft/service/CraftOperationService.java | 28 ++++++++++++- 5 files changed, 78 insertions(+), 7 deletions(-) create mode 100644 njzscloud-svr/src/main/java/com/njzscloud/dispose/mfg/craft/pojo/param/SearchCraftOperationParam.java diff --git a/njzscloud-svr/src/main/java/com/njzscloud/dispose/mfg/bom/service/BomService.java b/njzscloud-svr/src/main/java/com/njzscloud/dispose/mfg/bom/service/BomService.java index 7425224..768757e 100644 --- a/njzscloud-svr/src/main/java/com/njzscloud/dispose/mfg/bom/service/BomService.java +++ b/njzscloud-svr/src/main/java/com/njzscloud/dispose/mfg/bom/service/BomService.java @@ -109,7 +109,7 @@ public class BomService extends ServiceImpl implements ISe .ne(excludeId != null, BomEntity::getId, excludeId)); if (count > 0) { - throw Exceptions.clierr("同一主产品的BOM版本号必须唯一"); + throw Exceptions.clierr("同一主产品的物料版本号必须唯一"); } } @@ -126,7 +126,7 @@ public class BomService extends ServiceImpl implements ISe .ne(excludeId != null, BomEntity::getId, excludeId)); if (count > 0) { - throw Exceptions.clierr("同一主产品只能有一个可用的BOM"); + throw Exceptions.clierr("同一主产品只能有一个可用的物料"); } } diff --git a/njzscloud-svr/src/main/java/com/njzscloud/dispose/mfg/craft/controller/CraftOperationController.java b/njzscloud-svr/src/main/java/com/njzscloud/dispose/mfg/craft/controller/CraftOperationController.java index 0e8832b..0809f8f 100644 --- a/njzscloud-svr/src/main/java/com/njzscloud/dispose/mfg/craft/controller/CraftOperationController.java +++ b/njzscloud-svr/src/main/java/com/njzscloud/dispose/mfg/craft/controller/CraftOperationController.java @@ -4,6 +4,7 @@ import com.njzscloud.common.core.utils.R; import com.njzscloud.common.mp.support.PageParam; import com.njzscloud.common.mp.support.PageResult; import com.njzscloud.dispose.mfg.craft.pojo.entity.CraftOperationEntity; +import com.njzscloud.dispose.mfg.craft.pojo.param.SearchCraftOperationParam; import com.njzscloud.dispose.mfg.craft.service.CraftOperationService; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; @@ -13,6 +14,7 @@ import java.util.List; /** * 工序 + * @author ljw */ @Slf4j @RestController @@ -60,7 +62,7 @@ public class CraftOperationController { * 分页查询 */ @GetMapping("/paging") - public R> paging(PageParam pageParam, CraftOperationEntity craftOperationEntity) { - return R.success(craftOperationService.paging(pageParam, craftOperationEntity)); + public R> paging(PageParam pageParam, SearchCraftOperationParam operationParam) { + return R.success(craftOperationService.paging(pageParam, operationParam)); } } diff --git a/njzscloud-svr/src/main/java/com/njzscloud/dispose/mfg/craft/pojo/entity/CraftOperationEntity.java b/njzscloud-svr/src/main/java/com/njzscloud/dispose/mfg/craft/pojo/entity/CraftOperationEntity.java index 3226a74..ce32af2 100644 --- a/njzscloud-svr/src/main/java/com/njzscloud/dispose/mfg/craft/pojo/entity/CraftOperationEntity.java +++ b/njzscloud-svr/src/main/java/com/njzscloud/dispose/mfg/craft/pojo/entity/CraftOperationEntity.java @@ -1,6 +1,9 @@ package com.njzscloud.dispose.mfg.craft.pojo.entity; import com.baomidou.mybatisplus.annotation.*; +import com.njzscloud.common.core.ienum.DictItem; +import com.njzscloud.common.core.ienum.DictKey; +import com.njzscloud.common.mp.support.handler.j.DictItemTypeHandler; import lombok.Getter; import lombok.Setter; import lombok.ToString; @@ -11,6 +14,7 @@ import java.time.LocalDateTime; /** * 工序 + * @author ljw */ @Getter @Setter @@ -38,7 +42,9 @@ public class CraftOperationEntity { /** * 工序类型;字典编码:operation_category */ - private String operationCategory; + @DictKey("operation_category") + @TableField(typeHandler = DictItemTypeHandler.class) + private DictItem operationCategory; /** * 标准节拍;单位:N/分钟 diff --git a/njzscloud-svr/src/main/java/com/njzscloud/dispose/mfg/craft/pojo/param/SearchCraftOperationParam.java b/njzscloud-svr/src/main/java/com/njzscloud/dispose/mfg/craft/pojo/param/SearchCraftOperationParam.java new file mode 100644 index 0000000..bf97cc7 --- /dev/null +++ b/njzscloud-svr/src/main/java/com/njzscloud/dispose/mfg/craft/pojo/param/SearchCraftOperationParam.java @@ -0,0 +1,39 @@ +package com.njzscloud.dispose.mfg.craft.pojo.param; + +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; +import lombok.experimental.Accessors; + +/** + * 工序 + * + * @author ljw + */ +@Getter +@Setter +@ToString +@Accessors(chain = true) +public class SearchCraftOperationParam { + + /** + * 编号 + */ + private String sn; + + /** + * 工序名称 + */ + private String operationName; + + /** + * 是否质检节点;0-->否、1-->是 + */ + private Boolean checkPoint; + + /** + * 是否可用;0-->否、1-->是 + */ + private Boolean canuse; + +} diff --git a/njzscloud-svr/src/main/java/com/njzscloud/dispose/mfg/craft/service/CraftOperationService.java b/njzscloud-svr/src/main/java/com/njzscloud/dispose/mfg/craft/service/CraftOperationService.java index 2f0515d..dc32aa9 100644 --- a/njzscloud-svr/src/main/java/com/njzscloud/dispose/mfg/craft/service/CraftOperationService.java +++ b/njzscloud-svr/src/main/java/com/njzscloud/dispose/mfg/craft/service/CraftOperationService.java @@ -1,12 +1,15 @@ package com.njzscloud.dispose.mfg.craft.service; +import cn.hutool.core.util.StrUtil; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.njzscloud.common.mp.support.PageParam; import com.njzscloud.common.mp.support.PageResult; +import com.njzscloud.common.sn.support.SnUtil; import com.njzscloud.dispose.mfg.craft.mapper.CraftOperationMapper; import com.njzscloud.dispose.mfg.craft.pojo.entity.CraftOperationEntity; +import com.njzscloud.dispose.mfg.craft.pojo.param.SearchCraftOperationParam; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; @@ -16,6 +19,8 @@ import java.util.List; /** * 工序 + * + * @author ljw */ @Slf4j @Service @@ -26,6 +31,7 @@ public class CraftOperationService extends ServiceImpl paging(PageParam pageParam, CraftOperationEntity craftOperationEntity) { - return PageResult.of(this.page(pageParam.toPage(), Wrappers.query(craftOperationEntity))); + public PageResult paging(PageParam pageParam, SearchCraftOperationParam operationParam) { + return PageResult.of(this.page(pageParam.toPage(), Wrappers.lambdaQuery() + .like(StrUtil.isNotBlank(operationParam.getSn()), CraftOperationEntity::getSn, operationParam.getSn()) + .like(StrUtil.isNotBlank(operationParam.getOperationName()), CraftOperationEntity::getOperationName, operationParam.getOperationName()) + .eq(operationParam.getCheckPoint() != null, CraftOperationEntity::getCheckPoint, operationParam.getCheckPoint()) + .eq(operationParam.getCanuse() != null, CraftOperationEntity::getCanuse, operationParam.getCanuse()))); } + + /** + * 生成编码 + * + * @return sn 编码 + */ + public String generateSn() { + String sn = SnUtil.next("Operation-SN"); + if (this.exists(Wrappers.lambdaQuery().eq(CraftOperationEntity::getSn, sn).eq(CraftOperationEntity::getDeleted, Boolean.FALSE))) { + this.generateSn(); + } + return sn; + } + }