From 2218bb4caddc55bf603d3c04c579f6cc23a186f7 Mon Sep 17 00:00:00 2001 From: zch Date: Mon, 20 Jan 2025 11:30:37 +0800 Subject: [PATCH] =?UTF-8?q?add(hwmom-mes):=20=E6=96=B0=E5=A2=9E=E7=BB=93?= =?UTF-8?q?=E6=9E=84BOM=E7=AE=A1=E7=90=86(=E6=A0=91=E5=9E=8B)=E5=92=8C?= =?UTF-8?q?=E6=9C=BA=E5=8F=B0=E4=BF=A1=E6=81=AF=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 添加结构BOM信息相关实体、控制器、服务、Mapper等代码 - 实现结构BOM信息的增删查改等功能 - 添加机台信息相关实体、控制器、服务、Mapper等代码 - 实现机台信息的增删查改等功能 --- .../BaseStructureBomController.java | 117 ++++++++++++++ .../ProdBaseMachineInfoController.java | 117 ++++++++++++++ .../dromara/mes/domain/BaseStructureBom.java | 81 ++++++++++ .../mes/domain/ProdBaseMachineInfo.java | 76 +++++++++ .../mes/domain/bo/BaseStructureBomBo.java | 80 ++++++++++ .../mes/domain/bo/ProdBaseMachineInfoBo.java | 76 +++++++++ .../mes/domain/vo/BaseStructureBomVo.java | 136 ++++++++++++++++ .../mes/domain/vo/ProdBaseMachineInfoVo.java | 129 +++++++++++++++ .../mes/mapper/BaseStructureBomMapper.java | 15 ++ .../mes/mapper/ProdBaseMachineInfoMapper.java | 15 ++ .../mes/service/IBaseStructureBomService.java | 59 +++++++ .../service/IProdBaseMachineInfoService.java | 69 ++++++++ .../impl/BaseStructureBomServiceImpl.java | 146 +++++++++++++++++ .../impl/ProdBaseMachineInfoServiceImpl.java | 151 ++++++++++++++++++ .../mapper/mes/BaseStructureBomMapper.xml | 7 + .../mapper/mes/ProdBaseMachineInfoMapper.xml | 7 + 16 files changed, 1281 insertions(+) create mode 100644 ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/controller/BaseStructureBomController.java create mode 100644 ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/controller/ProdBaseMachineInfoController.java create mode 100644 ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/domain/BaseStructureBom.java create mode 100644 ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/domain/ProdBaseMachineInfo.java create mode 100644 ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/domain/bo/BaseStructureBomBo.java create mode 100644 ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/domain/bo/ProdBaseMachineInfoBo.java create mode 100644 ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/domain/vo/BaseStructureBomVo.java create mode 100644 ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/domain/vo/ProdBaseMachineInfoVo.java create mode 100644 ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/mapper/BaseStructureBomMapper.java create mode 100644 ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/mapper/ProdBaseMachineInfoMapper.java create mode 100644 ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/service/IBaseStructureBomService.java create mode 100644 ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/service/IProdBaseMachineInfoService.java create mode 100644 ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/service/impl/BaseStructureBomServiceImpl.java create mode 100644 ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/service/impl/ProdBaseMachineInfoServiceImpl.java create mode 100644 ruoyi-modules/hwmom-mes/src/main/resources/mapper/mes/BaseStructureBomMapper.xml create mode 100644 ruoyi-modules/hwmom-mes/src/main/resources/mapper/mes/ProdBaseMachineInfoMapper.xml diff --git a/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/controller/BaseStructureBomController.java b/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/controller/BaseStructureBomController.java new file mode 100644 index 00000000..b6599b7f --- /dev/null +++ b/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/controller/BaseStructureBomController.java @@ -0,0 +1,117 @@ +package org.dromara.mes.controller; + +import java.util.List; + +import lombok.RequiredArgsConstructor; +import jakarta.servlet.http.HttpServletResponse; +import jakarta.validation.constraints.*; +import cn.dev33.satoken.annotation.SaCheckPermission; +import org.springframework.web.bind.annotation.*; +import org.springframework.validation.annotation.Validated; +import org.dromara.common.idempotent.annotation.RepeatSubmit; +import org.dromara.common.log.annotation.Log; +import org.dromara.common.web.core.BaseController; +import org.dromara.common.mybatis.core.page.PageQuery; +import org.dromara.common.core.domain.R; +import org.dromara.common.core.validate.AddGroup; +import org.dromara.common.core.validate.EditGroup; +import org.dromara.common.log.enums.BusinessType; +import org.dromara.common.excel.utils.ExcelUtil; +import org.dromara.mes.domain.vo.BaseStructureBomVo; +import org.dromara.mes.domain.bo.BaseStructureBomBo; +import org.dromara.mes.service.IBaseStructureBomService; + +/** + * 结构BOM信息 + * 前端访问路由地址为:/mes/baseStructureBom + * + * @author zangch + * @date 2025-01-20 + */ +@Validated +@RequiredArgsConstructor +@RestController +@RequestMapping("/baseStructureBom") +public class BaseStructureBomController extends BaseController { + + private final IBaseStructureBomService baseStructureBomService; + + /** + * 查询结构BOM信息列表 + */ + @SaCheckPermission("mes:baseStructureBom:list") + @GetMapping("/list") + public R> list(BaseStructureBomBo bo) { + List list = baseStructureBomService.queryList(bo); + return R.ok(list); + } + + /** + * 导出结构BOM信息列表 + */ + @SaCheckPermission("mes:baseStructureBom:export") + @Log(title = "结构BOM信息", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(BaseStructureBomBo bo, HttpServletResponse response) { + List list = baseStructureBomService.queryList(bo); + ExcelUtil.exportExcel(list, "结构BOM信息", BaseStructureBomVo.class, response); + } + + /** + * 获取结构BOM信息详细信息 + * + * @param structureBomId 主键 + */ + @SaCheckPermission("mes:baseStructureBom:query") + @GetMapping("/{structureBomId}") + public R getInfo(@NotNull(message = "主键不能为空") + @PathVariable Long structureBomId) { + return R.ok(baseStructureBomService.queryById(structureBomId)); + } + + /** + * 新增结构BOM信息 + */ + @SaCheckPermission("mes:baseStructureBom:add") + @Log(title = "结构BOM信息", businessType = BusinessType.INSERT) + @RepeatSubmit() + @PostMapping() + public R add(@Validated(AddGroup.class) @RequestBody BaseStructureBomBo bo) { + return toAjax(baseStructureBomService.insertByBo(bo)); + } + + /** + * 修改结构BOM信息 + */ + @SaCheckPermission("mes:baseStructureBom:edit") + @Log(title = "结构BOM信息", businessType = BusinessType.UPDATE) + @RepeatSubmit() + @PutMapping() + public R edit(@Validated(EditGroup.class) @RequestBody BaseStructureBomBo bo) { + return toAjax(baseStructureBomService.updateByBo(bo)); + } + + /** + * 删除结构BOM信息 + * + * @param structureBomIds 主键串 + */ + @SaCheckPermission("mes:baseStructureBom:remove") + @Log(title = "结构BOM信息", businessType = BusinessType.DELETE) + @DeleteMapping("/{structureBomIds}") + public R remove(@NotEmpty(message = "主键不能为空") + @PathVariable Long[] structureBomIds) { + return toAjax(baseStructureBomService.deleteWithValidByIds(List.of(structureBomIds), true)); + } + + + /** + * 下拉框查询结构BOM信息列表 + */ + + @GetMapping("getBaseStructureBomList") + public R> getBaseStructureBomlist(BaseStructureBomBo bo) { + List list = baseStructureBomService.queryList(bo); + return R.ok(list); + } +} diff --git a/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/controller/ProdBaseMachineInfoController.java b/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/controller/ProdBaseMachineInfoController.java new file mode 100644 index 00000000..399bc658 --- /dev/null +++ b/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/controller/ProdBaseMachineInfoController.java @@ -0,0 +1,117 @@ +package org.dromara.mes.controller; + +import java.util.List; + +import lombok.RequiredArgsConstructor; +import jakarta.servlet.http.HttpServletResponse; +import jakarta.validation.constraints.*; +import cn.dev33.satoken.annotation.SaCheckPermission; +import org.springframework.web.bind.annotation.*; +import org.springframework.validation.annotation.Validated; +import org.dromara.common.idempotent.annotation.RepeatSubmit; +import org.dromara.common.log.annotation.Log; +import org.dromara.common.web.core.BaseController; +import org.dromara.common.mybatis.core.page.PageQuery; +import org.dromara.common.core.domain.R; +import org.dromara.common.core.validate.AddGroup; +import org.dromara.common.core.validate.EditGroup; +import org.dromara.common.log.enums.BusinessType; +import org.dromara.common.excel.utils.ExcelUtil; +import org.dromara.mes.domain.vo.ProdBaseMachineInfoVo; +import org.dromara.mes.domain.bo.ProdBaseMachineInfoBo; +import org.dromara.mes.service.IProdBaseMachineInfoService; +import org.dromara.common.mybatis.core.page.TableDataInfo; + +/** + * 机台信息 + * 前端访问路由地址为:/mes/prodBaseMachineInfo + * + * @author zangch + * @date 2025-01-20 + */ +@Validated +@RequiredArgsConstructor +@RestController +@RequestMapping("/prodBaseMachineInfo") +public class ProdBaseMachineInfoController extends BaseController { + + private final IProdBaseMachineInfoService prodBaseMachineInfoService; + + /** + * 查询机台信息列表 + */ + @SaCheckPermission("mes:prodBaseMachineInfo:list") + @GetMapping("/list") + public TableDataInfo list(ProdBaseMachineInfoBo bo, PageQuery pageQuery) { + return prodBaseMachineInfoService.queryPageList(bo, pageQuery); + } + + /** + * 导出机台信息列表 + */ + @SaCheckPermission("mes:prodBaseMachineInfo:export") + @Log(title = "机台信息", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(ProdBaseMachineInfoBo bo, HttpServletResponse response) { + List list = prodBaseMachineInfoService.queryList(bo); + ExcelUtil.exportExcel(list, "机台信息", ProdBaseMachineInfoVo.class, response); + } + + /** + * 获取机台信息详细信息 + * + * @param machineId 主键 + */ + @SaCheckPermission("mes:prodBaseMachineInfo:query") + @GetMapping("/{machineId}") + public R getInfo(@NotNull(message = "主键不能为空") + @PathVariable Long machineId) { + return R.ok(prodBaseMachineInfoService.queryById(machineId)); + } + + /** + * 新增机台信息 + */ + @SaCheckPermission("mes:prodBaseMachineInfo:add") + @Log(title = "机台信息", businessType = BusinessType.INSERT) + @RepeatSubmit() + @PostMapping() + public R add(@Validated(AddGroup.class) @RequestBody ProdBaseMachineInfoBo bo) { + return toAjax(prodBaseMachineInfoService.insertByBo(bo)); + } + + /** + * 修改机台信息 + */ + @SaCheckPermission("mes:prodBaseMachineInfo:edit") + @Log(title = "机台信息", businessType = BusinessType.UPDATE) + @RepeatSubmit() + @PutMapping() + public R edit(@Validated(EditGroup.class) @RequestBody ProdBaseMachineInfoBo bo) { + return toAjax(prodBaseMachineInfoService.updateByBo(bo)); + } + + /** + * 删除机台信息 + * + * @param machineIds 主键串 + */ + @SaCheckPermission("mes:prodBaseMachineInfo:remove") + @Log(title = "机台信息", businessType = BusinessType.DELETE) + @DeleteMapping("/{machineIds}") + public R remove(@NotEmpty(message = "主键不能为空") + @PathVariable Long[] machineIds) { + return toAjax(prodBaseMachineInfoService.deleteWithValidByIds(List.of(machineIds), true)); + } + + + /** + * 下拉框查询机台信息列表 + */ + + @GetMapping("getProdBaseMachineInfoList") + public R> getProdBaseMachineInfolist(ProdBaseMachineInfoBo bo) { + List list = prodBaseMachineInfoService.queryList(bo); + return R.ok(list); + } +} diff --git a/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/domain/BaseStructureBom.java b/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/domain/BaseStructureBom.java new file mode 100644 index 00000000..bd1aef12 --- /dev/null +++ b/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/domain/BaseStructureBom.java @@ -0,0 +1,81 @@ +package org.dromara.mes.domain; + +import org.dromara.common.tenant.core.TenantEntity; +import com.baomidou.mybatisplus.annotation.*; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.io.Serial; + +/** + * 结构BOM信息对象 base_structure_bom + * + * @author zangch + * @date 2025-01-20 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@TableName("base_structure_bom") +public class BaseStructureBom extends TenantEntity { + + @Serial + private static final long serialVersionUID = 1L; + + /** + * 主键标识 + */ + @TableId(value = "structure_bom_id", type = IdType.AUTO) + private Long structureBomId; + + /** + * 父级标识 + */ + private Long parentId; + + /** + * 物料类型ID + */ + private String materialTypeId; + + /** + * 物料类型名称 + */ + private String materialTypeName; + + /** + * 结构BOM说明 + */ + private String structureBomDesc; + + /** + * 结构BOM版本 + */ + private String structureBomVersion; + + /** + * 祖级列表 + */ + private String ancestors; + + /** + * 层级 + */ + private Long level; + + /** + * 顶级标识(1是 0否) + */ + private Long topFlag; + + /** + * 激活标识(1是 0否) + */ + private String activeFlag; + + /** + * 备注 + */ + private String remark; + + +} diff --git a/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/domain/ProdBaseMachineInfo.java b/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/domain/ProdBaseMachineInfo.java new file mode 100644 index 00000000..cb218511 --- /dev/null +++ b/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/domain/ProdBaseMachineInfo.java @@ -0,0 +1,76 @@ +package org.dromara.mes.domain; + +import org.dromara.common.tenant.core.TenantEntity; +import com.baomidou.mybatisplus.annotation.*; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.io.Serial; + +/** + * 机台信息对象 prod_base_machine_info + * + * @author zangch + * @date 2025-01-20 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@TableName("prod_base_machine_info") +public class ProdBaseMachineInfo extends TenantEntity { + + @Serial + private static final long serialVersionUID = 1L; + + /** + * 主键标识 + */ + @TableId(value = "machine_id", type = IdType.AUTO) + private Long machineId; + + /** + * 机台编号 + */ + private String machineCode; + + /** + * 机台名称 + */ + private String machineName; + + /** + * 资产编号 + */ + private String assetNumber; + + /** + * 机台位置 + */ + private String machineLocation; + + /** + * 机台类型 + */ + private String machineType; + + /** + * 机台规格 + */ + private String machineSpec; + + /** + * 供应商 + */ + private String supplierId; + + /** + * 机台状态(0停用 1启用 2报废) + */ + private String machineStatus; + + /** + * 备注 + */ + private String remark; + + +} diff --git a/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/domain/bo/BaseStructureBomBo.java b/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/domain/bo/BaseStructureBomBo.java new file mode 100644 index 00000000..05f6e93a --- /dev/null +++ b/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/domain/bo/BaseStructureBomBo.java @@ -0,0 +1,80 @@ +package org.dromara.mes.domain.bo; + +import org.dromara.mes.domain.BaseStructureBom; +import org.dromara.common.mybatis.core.domain.BaseEntity; +import org.dromara.common.core.validate.AddGroup; +import org.dromara.common.core.validate.EditGroup; +import io.github.linpeilie.annotations.AutoMapper; +import lombok.Data; +import lombok.EqualsAndHashCode; +import jakarta.validation.constraints.*; + +/** + * 结构BOM信息业务对象 base_structure_bom + * + * @author zangch + * @date 2025-01-20 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@AutoMapper(target = BaseStructureBom.class, reverseConvertGenerate = false) +public class BaseStructureBomBo extends BaseEntity { + + /** + * 主键标识 + */ + private Long structureBomId; + + /** + * 父级标识 + */ + private Long parentId; + + /** + * 物料类型ID + */ + @NotBlank(message = "物料类型ID不能为空", groups = { AddGroup.class, EditGroup.class }) + private String materialTypeId; + + /** + * 物料类型名称 + */ + private String materialTypeName; + + /** + * 结构BOM说明 + */ + private String structureBomDesc; + + /** + * 结构BOM版本 + */ + private String structureBomVersion; + + /** + * 祖级列表 + */ + private String ancestors; + + /** + * 层级 + */ + private Long level; + + /** + * 顶级标识(1是 0否) + */ + private Long topFlag; + + /** + * 激活标识(1是 0否) + */ + private String activeFlag; + + /** + * 备注 + */ + private String remark; + + +} diff --git a/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/domain/bo/ProdBaseMachineInfoBo.java b/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/domain/bo/ProdBaseMachineInfoBo.java new file mode 100644 index 00000000..1c09d3d4 --- /dev/null +++ b/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/domain/bo/ProdBaseMachineInfoBo.java @@ -0,0 +1,76 @@ +package org.dromara.mes.domain.bo; + +import org.dromara.mes.domain.ProdBaseMachineInfo; +import org.dromara.common.mybatis.core.domain.BaseEntity; +import org.dromara.common.core.validate.AddGroup; +import org.dromara.common.core.validate.EditGroup; +import io.github.linpeilie.annotations.AutoMapper; +import lombok.Data; +import lombok.EqualsAndHashCode; +import jakarta.validation.constraints.*; + +/** + * 机台信息业务对象 prod_base_machine_info + * + * @author zangch + * @date 2025-01-20 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@AutoMapper(target = ProdBaseMachineInfo.class, reverseConvertGenerate = false) +public class ProdBaseMachineInfoBo extends BaseEntity { + + /** + * 主键标识 + */ + private Long machineId; + + /** + * 机台编号 + */ + @NotBlank(message = "机台编号不能为空", groups = { AddGroup.class, EditGroup.class }) + private String machineCode; + + /** + * 机台名称 + */ + @NotBlank(message = "机台名称不能为空", groups = { AddGroup.class, EditGroup.class }) + private String machineName; + + /** + * 资产编号 + */ + private String assetNumber; + + /** + * 机台位置 + */ + private String machineLocation; + + /** + * 机台类型 + */ + private String machineType; + + /** + * 机台规格 + */ + private String machineSpec; + + /** + * 供应商 + */ + private String supplierId; + + /** + * 机台状态(0停用 1启用 2报废) + */ + private String machineStatus; + + /** + * 备注 + */ + private String remark; + + +} diff --git a/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/domain/vo/BaseStructureBomVo.java b/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/domain/vo/BaseStructureBomVo.java new file mode 100644 index 00000000..1e09b3e7 --- /dev/null +++ b/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/domain/vo/BaseStructureBomVo.java @@ -0,0 +1,136 @@ +package org.dromara.mes.domain.vo; + +import org.dromara.mes.domain.BaseStructureBom; +import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; +import com.alibaba.excel.annotation.ExcelProperty; +import org.dromara.common.excel.annotation.ExcelDictFormat; +import org.dromara.common.excel.convert.ExcelDictConvert; +import io.github.linpeilie.annotations.AutoMapper; +import lombok.Data; + +import java.io.Serial; +import java.io.Serializable; +import java.util.Date; + + + +/** + * 结构BOM信息视图对象 base_structure_bom + * + * @author zangch + * @date 2025-01-20 + */ +@Data +@ExcelIgnoreUnannotated +@AutoMapper(target = BaseStructureBom.class) +public class BaseStructureBomVo implements Serializable { + + @Serial + private static final long serialVersionUID = 1L; + + /** + * 主键标识 + */ + @ExcelProperty(value = "主键标识") + private Long structureBomId; + + /** + * 租户编号 + */ + @ExcelProperty(value = "租户编号") + private String tenantId; + + /** + * 父级标识 + */ + @ExcelProperty(value = "父级标识") + private Long parentId; + + /** + * 物料类型ID + */ + @ExcelProperty(value = "物料类型ID") + private String materialTypeId; + + /** + * 物料类型名称 + */ + @ExcelProperty(value = "物料类型名称") + private String materialTypeName; + + /** + * 结构BOM说明 + */ + @ExcelProperty(value = "结构BOM说明") + private String structureBomDesc; + + /** + * 结构BOM版本 + */ + @ExcelProperty(value = "结构BOM版本") + private String structureBomVersion; + + /** + * 祖级列表 + */ + @ExcelProperty(value = "祖级列表") + private String ancestors; + + /** + * 层级 + */ + @ExcelProperty(value = "层级") + private Long level; + + /** + * 顶级标识(1是 0否) + */ + @ExcelProperty(value = "顶级标识(1是 0否)", converter = ExcelDictConvert.class) + @ExcelDictFormat(dictType = "top_flag") + private Long topFlag; + + /** + * 激活标识(1是 0否) + */ + @ExcelProperty(value = "激活标识", converter = ExcelDictConvert.class) + @ExcelDictFormat(dictType = "active_flag") + private String activeFlag; + + /** + * 备注 + */ + @ExcelProperty(value = "备注") + private String remark; + + /** + * 创建部门 + */ + @ExcelProperty(value = "创建部门") + private Long createDept; + + /** + * 创建人 + */ + @ExcelProperty(value = "创建人") + private Long createBy; + + /** + * 创建时间 + */ + @ExcelProperty(value = "创建时间") + private Date createTime; + + /** + * 更新人 + */ + @ExcelProperty(value = "更新人") + private Long updateBy; + + /** + * 更新时间 + */ + @ExcelProperty(value = "更新时间") + private Date updateTime; + + +} diff --git a/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/domain/vo/ProdBaseMachineInfoVo.java b/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/domain/vo/ProdBaseMachineInfoVo.java new file mode 100644 index 00000000..abc767a9 --- /dev/null +++ b/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/domain/vo/ProdBaseMachineInfoVo.java @@ -0,0 +1,129 @@ +package org.dromara.mes.domain.vo; + +import org.dromara.mes.domain.ProdBaseMachineInfo; +import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; +import com.alibaba.excel.annotation.ExcelProperty; +import org.dromara.common.excel.annotation.ExcelDictFormat; +import org.dromara.common.excel.convert.ExcelDictConvert; +import io.github.linpeilie.annotations.AutoMapper; +import lombok.Data; + +import java.io.Serial; +import java.io.Serializable; +import java.util.Date; + + + +/** + * 机台信息视图对象 prod_base_machine_info + * + * @author zangch + * @date 2025-01-20 + */ +@Data +@ExcelIgnoreUnannotated +@AutoMapper(target = ProdBaseMachineInfo.class) +public class ProdBaseMachineInfoVo implements Serializable { + + @Serial + private static final long serialVersionUID = 1L; + + /** + * 主键标识 + */ + @ExcelProperty(value = "主键标识") + private Long machineId; + + /** + * 租户编号 + */ + @ExcelProperty(value = "租户编号") + private String tenantId; + + /** + * 机台编号 + */ + @ExcelProperty(value = "机台编号") + private String machineCode; + + /** + * 机台名称 + */ + @ExcelProperty(value = "机台名称") + private String machineName; + + /** + * 资产编号 + */ + @ExcelProperty(value = "资产编号") + private String assetNumber; + + /** + * 机台位置 + */ + @ExcelProperty(value = "机台位置") + private String machineLocation; + + /** + * 机台类型 + */ + @ExcelProperty(value = "机台类型") + private String machineType; + + /** + * 机台规格 + */ + @ExcelProperty(value = "机台规格") + private String machineSpec; + + /** + * 供应商 + */ + @ExcelProperty(value = "供应商") + private String supplierId; + + /** + * 机台状态(0停用 1启用 2报废) + */ + @ExcelProperty(value = "机台状态(0停用 1启用 2报废)", converter = ExcelDictConvert.class) + @ExcelDictFormat(dictType = "machine_status") + private String machineStatus; + + /** + * 备注 + */ + @ExcelProperty(value = "备注") + private String remark; + + /** + * 创建部门 + */ + @ExcelProperty(value = "创建部门") + private Long createDept; + + /** + * 创建人 + */ + @ExcelProperty(value = "创建人") + private Long createBy; + + /** + * 创建时间 + */ + @ExcelProperty(value = "创建时间") + private Date createTime; + + /** + * 更新人 + */ + @ExcelProperty(value = "更新人") + private Long updateBy; + + /** + * 更新时间 + */ + @ExcelProperty(value = "更新时间") + private Date updateTime; + + +} diff --git a/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/mapper/BaseStructureBomMapper.java b/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/mapper/BaseStructureBomMapper.java new file mode 100644 index 00000000..2cc70760 --- /dev/null +++ b/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/mapper/BaseStructureBomMapper.java @@ -0,0 +1,15 @@ +package org.dromara.mes.mapper; + +import org.dromara.mes.domain.BaseStructureBom; +import org.dromara.mes.domain.vo.BaseStructureBomVo; +import org.dromara.common.mybatis.core.mapper.BaseMapperPlus; + +/** + * 结构BOM信息Mapper接口 + * + * @author zangch + * @date 2025-01-20 + */ +public interface BaseStructureBomMapper extends BaseMapperPlus { + +} diff --git a/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/mapper/ProdBaseMachineInfoMapper.java b/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/mapper/ProdBaseMachineInfoMapper.java new file mode 100644 index 00000000..b1da8e75 --- /dev/null +++ b/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/mapper/ProdBaseMachineInfoMapper.java @@ -0,0 +1,15 @@ +package org.dromara.mes.mapper; + +import org.dromara.mes.domain.ProdBaseMachineInfo; +import org.dromara.mes.domain.vo.ProdBaseMachineInfoVo; +import org.dromara.common.mybatis.core.mapper.BaseMapperPlus; + +/** + * 机台信息Mapper接口 + * + * @author zangch + * @date 2025-01-20 + */ +public interface ProdBaseMachineInfoMapper extends BaseMapperPlus { + +} diff --git a/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/service/IBaseStructureBomService.java b/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/service/IBaseStructureBomService.java new file mode 100644 index 00000000..d65a7d1b --- /dev/null +++ b/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/service/IBaseStructureBomService.java @@ -0,0 +1,59 @@ +package org.dromara.mes.service; + +import org.dromara.mes.domain.BaseStructureBom; +import org.dromara.mes.domain.vo.BaseStructureBomVo; +import org.dromara.mes.domain.bo.BaseStructureBomBo; + +import java.util.Collection; +import java.util.List; + +/** + * 结构BOM信息Service接口 + * + * @author zangch + * @date 2025-01-20 + */ +public interface IBaseStructureBomService { + + /** + * 查询结构BOM信息 + * + * @param structureBomId 主键 + * @return 结构BOM信息 + */ + BaseStructureBomVo queryById(Long structureBomId); + + + /** + * 查询符合条件的结构BOM信息列表 + * + * @param bo 查询条件 + * @return 结构BOM信息列表 + */ + List queryList(BaseStructureBomBo bo); + + /** + * 新增结构BOM信息 + * + * @param bo 结构BOM信息 + * @return 是否新增成功 + */ + Boolean insertByBo(BaseStructureBomBo bo); + + /** + * 修改结构BOM信息 + * + * @param bo 结构BOM信息 + * @return 是否修改成功 + */ + Boolean updateByBo(BaseStructureBomBo bo); + + /** + * 校验并批量删除结构BOM信息信息 + * + * @param ids 待删除的主键集合 + * @param isValid 是否进行有效性校验 + * @return 是否删除成功 + */ + Boolean deleteWithValidByIds(Collection ids, Boolean isValid); +} diff --git a/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/service/IProdBaseMachineInfoService.java b/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/service/IProdBaseMachineInfoService.java new file mode 100644 index 00000000..4f543821 --- /dev/null +++ b/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/service/IProdBaseMachineInfoService.java @@ -0,0 +1,69 @@ +package org.dromara.mes.service; + +import org.dromara.mes.domain.ProdBaseMachineInfo; +import org.dromara.mes.domain.vo.ProdBaseMachineInfoVo; +import org.dromara.mes.domain.bo.ProdBaseMachineInfoBo; +import org.dromara.common.mybatis.core.page.TableDataInfo; +import org.dromara.common.mybatis.core.page.PageQuery; + +import java.util.Collection; +import java.util.List; + +/** + * 机台信息Service接口 + * + * @author zangch + * @date 2025-01-20 + */ +public interface IProdBaseMachineInfoService { + + /** + * 查询机台信息 + * + * @param machineId 主键 + * @return 机台信息 + */ + ProdBaseMachineInfoVo queryById(Long machineId); + + /** + * 分页查询机台信息列表 + * + * @param bo 查询条件 + * @param pageQuery 分页参数 + * @return 机台信息分页列表 + */ + TableDataInfo queryPageList(ProdBaseMachineInfoBo bo, PageQuery pageQuery); + + /** + * 查询符合条件的机台信息列表 + * + * @param bo 查询条件 + * @return 机台信息列表 + */ + List queryList(ProdBaseMachineInfoBo bo); + + /** + * 新增机台信息 + * + * @param bo 机台信息 + * @return 是否新增成功 + */ + Boolean insertByBo(ProdBaseMachineInfoBo bo); + + /** + * 修改机台信息 + * + * @param bo 机台信息 + * @return 是否修改成功 + */ + Boolean updateByBo(ProdBaseMachineInfoBo bo); + + /** + * 校验并批量删除机台信息信息 + * + * @param ids 待删除的主键集合 + * @param isValid 是否进行有效性校验 + * @return 是否删除成功 + */ + Boolean deleteWithValidByIds(Collection ids, Boolean isValid); +} diff --git a/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/service/impl/BaseStructureBomServiceImpl.java b/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/service/impl/BaseStructureBomServiceImpl.java new file mode 100644 index 00000000..9ed72ad7 --- /dev/null +++ b/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/service/impl/BaseStructureBomServiceImpl.java @@ -0,0 +1,146 @@ +package org.dromara.mes.service.impl; + +import org.apache.commons.lang3.ObjectUtils; +import org.dromara.common.core.exception.ServiceException; +import org.dromara.common.core.utils.MapstructUtils; +import org.dromara.common.core.utils.StringUtils; +import com.github.yulichang.toolkit.JoinWrappers; +import com.github.yulichang.wrapper.MPJLambdaWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; +import org.dromara.mes.domain.bo.BaseStructureBomBo; +import org.dromara.mes.domain.vo.BaseStructureBomVo; +import org.dromara.mes.domain.BaseStructureBom; +import org.dromara.mes.mapper.BaseStructureBomMapper; +import org.dromara.mes.service.IBaseStructureBomService; + +import java.util.List; +import java.util.Map; +import java.util.Collection; + +/** + * 结构BOM信息Service业务层处理 + * + * @author zangch + * @date 2025-01-20 + */ +@RequiredArgsConstructor +@Service +public class BaseStructureBomServiceImpl implements IBaseStructureBomService { + + private final BaseStructureBomMapper baseMapper; + + /** + * 查询结构BOM信息 + * + * @param structureBomId 主键 + * @return 结构BOM信息 + */ + @Override + public BaseStructureBomVo queryById(Long structureBomId){ + return baseMapper.selectVoById(structureBomId); + } + + + /** + * 查询符合条件的结构BOM信息列表 + * + * @param bo 查询条件 + * @return 结构BOM信息列表 + */ + @Override + public List queryList(BaseStructureBomBo bo) { + MPJLambdaWrapper lqw = buildQueryWrapper(bo); + return baseMapper.selectVoList(lqw); + } + + private MPJLambdaWrapper buildQueryWrapper(BaseStructureBomBo bo) { + Map params = bo.getParams(); + MPJLambdaWrapper lqw = JoinWrappers.lambda(BaseStructureBom.class) + .selectAll(BaseStructureBom.class) + .eq(bo.getStructureBomId() != null, BaseStructureBom::getStructureBomId, bo.getStructureBomId()) + .eq(bo.getParentId() != null, BaseStructureBom::getParentId, bo.getParentId()) + .eq(StringUtils.isNotBlank(bo.getMaterialTypeId()), BaseStructureBom::getMaterialTypeId, bo.getMaterialTypeId()) + .like(StringUtils.isNotBlank(bo.getMaterialTypeName()), BaseStructureBom::getMaterialTypeName, bo.getMaterialTypeName()) + .eq(StringUtils.isNotBlank(bo.getStructureBomDesc()), BaseStructureBom::getStructureBomDesc, bo.getStructureBomDesc()) + .eq(StringUtils.isNotBlank(bo.getStructureBomVersion()), BaseStructureBom::getStructureBomVersion, bo.getStructureBomVersion()) + .eq(StringUtils.isNotBlank(bo.getAncestors()), BaseStructureBom::getAncestors, bo.getAncestors()) + .eq(bo.getLevel() != null, BaseStructureBom::getLevel, bo.getLevel()) + .eq(bo.getTopFlag() != null, BaseStructureBom::getTopFlag, bo.getTopFlag()) + .eq(StringUtils.isNotBlank(bo.getActiveFlag()), BaseStructureBom::getActiveFlag, bo.getActiveFlag()) + .orderByDesc(BaseStructureBom::getCreateTime); + return lqw; + } + + /** + * 新增结构BOM信息 + * + * @param bo 结构BOM信息 + * @return 是否新增成功 + */ + @Override + public Boolean insertByBo(BaseStructureBomBo bo) { + BaseStructureBom add = MapstructUtils.convert(bo, BaseStructureBom.class); + validEntityBeforeSave(add); + + //获取父节点信息 + BaseStructureBomVo query = baseMapper.selectVoById(bo.getParentId()); + if (ObjectUtils.isNotEmpty(query)) { + //若父节点不为空,则将父节点的ancestors拼接父节点id拼接成ancestors + add.setAncestors(query.getAncestors() + "," + bo.getParentId()); + }else{ + //若父节点为空,则ancestors仅有父节点id + add.setAncestors(bo.getParentId().toString()); + } + + boolean flag = baseMapper.insert(add) > 0; + if (flag) { + bo.setStructureBomId(add.getStructureBomId()); + } + return flag; + } + + /** + * 修改结构BOM信息 + * + * @param bo 结构BOM信息 + * @return 是否修改成功 + */ + @Override + public Boolean updateByBo(BaseStructureBomBo bo) { + BaseStructureBom update = MapstructUtils.convert(bo, BaseStructureBom.class); + validEntityBeforeSave(update); + return baseMapper.updateById(update) > 0; + } + + /** + * 保存前的数据校验 + */ + private void validEntityBeforeSave(BaseStructureBom entity){ + //TODO 做一些数据校验,如唯一约束 + } + + /** + * 校验并批量删除结构BOM信息信息 + * + * @param ids 待删除的主键集合 + * @param isValid 是否进行有效性校验 + * @return 是否删除成功 + */ + @Override + public Boolean deleteWithValidByIds(Collection ids, Boolean isValid) { + if(isValid){ + //TODO 做一些业务上的校验,判断是否需要校验 + for (Long id : ids) { + //监测删除的节点是否有子节点 + BaseStructureBom query = new BaseStructureBom(); + query.setParentId(id); + if (baseMapper.selectCount(Wrappers.lambdaQuery(query)) > 0) { + throw new ServiceException("存在子节点,不允许删除"); + } + } + } + return baseMapper.deleteByIds(ids) > 0; + } +} diff --git a/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/service/impl/ProdBaseMachineInfoServiceImpl.java b/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/service/impl/ProdBaseMachineInfoServiceImpl.java new file mode 100644 index 00000000..390b2461 --- /dev/null +++ b/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/service/impl/ProdBaseMachineInfoServiceImpl.java @@ -0,0 +1,151 @@ +package org.dromara.mes.service.impl; + +import org.dromara.common.core.exception.ServiceException; +import org.dromara.common.core.utils.MapstructUtils; +import org.dromara.common.core.utils.StringUtils; +import org.dromara.common.mybatis.core.page.TableDataInfo; +import org.dromara.common.mybatis.core.page.PageQuery; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.github.yulichang.toolkit.JoinWrappers; +import com.github.yulichang.wrapper.MPJLambdaWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; +import org.dromara.mes.domain.bo.ProdBaseMachineInfoBo; +import org.dromara.mes.domain.vo.ProdBaseMachineInfoVo; +import org.dromara.mes.domain.ProdBaseMachineInfo; +import org.dromara.mes.mapper.ProdBaseMachineInfoMapper; +import org.dromara.mes.service.IProdBaseMachineInfoService; + +import java.util.List; +import java.util.Map; +import java.util.Collection; + +/** + * 机台信息Service业务层处理 + * + * @author zangch + * @date 2025-01-20 + */ +@RequiredArgsConstructor +@Service +public class ProdBaseMachineInfoServiceImpl implements IProdBaseMachineInfoService { + + private final ProdBaseMachineInfoMapper baseMapper; + + /** + * 查询机台信息 + * + * @param machineId 主键 + * @return 机台信息 + */ + @Override + public ProdBaseMachineInfoVo queryById(Long machineId){ + return baseMapper.selectVoById(machineId); + } + + /** + * 分页查询机台信息列表 + * + * @param bo 查询条件 + * @param pageQuery 分页参数 + * @return 机台信息分页列表 + */ + @Override + public TableDataInfo queryPageList(ProdBaseMachineInfoBo bo, PageQuery pageQuery) { + MPJLambdaWrapper lqw = buildQueryWrapper(bo); + Page result = baseMapper.selectVoPage(pageQuery.build(), lqw); + return TableDataInfo.build(result); + } + + /** + * 查询符合条件的机台信息列表 + * + * @param bo 查询条件 + * @return 机台信息列表 + */ + @Override + public List queryList(ProdBaseMachineInfoBo bo) { + MPJLambdaWrapper lqw = buildQueryWrapper(bo); + return baseMapper.selectVoList(lqw); + } + + private MPJLambdaWrapper buildQueryWrapper(ProdBaseMachineInfoBo bo) { + Map params = bo.getParams(); + MPJLambdaWrapper lqw = JoinWrappers.lambda(ProdBaseMachineInfo.class) + .selectAll(ProdBaseMachineInfo.class) + .eq(bo.getMachineId() != null, ProdBaseMachineInfo::getMachineId, bo.getMachineId()) + .eq(StringUtils.isNotBlank(bo.getMachineCode()), ProdBaseMachineInfo::getMachineCode, bo.getMachineCode()) + .like(StringUtils.isNotBlank(bo.getMachineName()), ProdBaseMachineInfo::getMachineName, bo.getMachineName()) + .eq(StringUtils.isNotBlank(bo.getAssetNumber()), ProdBaseMachineInfo::getAssetNumber, bo.getAssetNumber()) + .eq(StringUtils.isNotBlank(bo.getMachineLocation()), ProdBaseMachineInfo::getMachineLocation, bo.getMachineLocation()) + .eq(StringUtils.isNotBlank(bo.getMachineType()), ProdBaseMachineInfo::getMachineType, bo.getMachineType()) + .eq(StringUtils.isNotBlank(bo.getMachineSpec()), ProdBaseMachineInfo::getMachineSpec, bo.getMachineSpec()) + .eq(StringUtils.isNotBlank(bo.getSupplierId()), ProdBaseMachineInfo::getSupplierId, bo.getSupplierId()) + .eq(StringUtils.isNotBlank(bo.getMachineStatus()), ProdBaseMachineInfo::getMachineStatus, bo.getMachineStatus()) + .orderByDesc(ProdBaseMachineInfo::getCreateTime); + return lqw; + } + + /** + * 新增机台信息 + * + * @param bo 机台信息 + * @return 是否新增成功 + */ + @Override + public Boolean insertByBo(ProdBaseMachineInfoBo bo) { + ProdBaseMachineInfo add = MapstructUtils.convert(bo, ProdBaseMachineInfo.class); + validEntityBeforeSave(add); + boolean flag = baseMapper.insert(add) > 0; + if (flag) { + bo.setMachineId(add.getMachineId()); + } + return flag; + } + + /** + * 修改机台信息 + * + * @param bo 机台信息 + * @return 是否修改成功 + */ + @Override + public Boolean updateByBo(ProdBaseMachineInfoBo bo) { + ProdBaseMachineInfo update = MapstructUtils.convert(bo, ProdBaseMachineInfo.class); + validEntityBeforeSave(update); + return baseMapper.updateById(update) > 0; + } + + /** + * 保存前的数据校验 + */ + private void validEntityBeforeSave(ProdBaseMachineInfo entity){ + //TODO 做一些数据校验,如唯一约束 + if (StringUtils.isNotBlank(entity.getMachineCode())) { + ProdBaseMachineInfoBo query = new ProdBaseMachineInfoBo(); + query.setMachineCode(entity.getMachineCode()); + MPJLambdaWrapper lqw = buildQueryWrapper(query); + ProdBaseMachineInfo baseProdBaseMachineInfo = baseMapper.selectOne(lqw); + if (baseProdBaseMachineInfo != null + && !baseProdBaseMachineInfo.getMachineId().equals(entity.getMachineId())) { + throw new ServiceException("编码已存在"); + } + } + } + + /** + * 校验并批量删除机台信息信息 + * + * @param ids 待删除的主键集合 + * @param isValid 是否进行有效性校验 + * @return 是否删除成功 + */ + @Override + public Boolean deleteWithValidByIds(Collection ids, Boolean isValid) { + if(isValid){ + //TODO 做一些业务上的校验,判断是否需要校验 + } + return baseMapper.deleteByIds(ids) > 0; + } +} diff --git a/ruoyi-modules/hwmom-mes/src/main/resources/mapper/mes/BaseStructureBomMapper.xml b/ruoyi-modules/hwmom-mes/src/main/resources/mapper/mes/BaseStructureBomMapper.xml new file mode 100644 index 00000000..a8c008f0 --- /dev/null +++ b/ruoyi-modules/hwmom-mes/src/main/resources/mapper/mes/BaseStructureBomMapper.xml @@ -0,0 +1,7 @@ + + + + + diff --git a/ruoyi-modules/hwmom-mes/src/main/resources/mapper/mes/ProdBaseMachineInfoMapper.xml b/ruoyi-modules/hwmom-mes/src/main/resources/mapper/mes/ProdBaseMachineInfoMapper.xml new file mode 100644 index 00000000..df7a3b69 --- /dev/null +++ b/ruoyi-modules/hwmom-mes/src/main/resources/mapper/mes/ProdBaseMachineInfoMapper.xml @@ -0,0 +1,7 @@ + + + + +