From 28f384986ed6df07d9e2637258b44810df5f12ed Mon Sep 17 00:00:00 2001 From: zch Date: Wed, 12 Mar 2025 15:08:54 +0800 Subject: [PATCH] =?UTF-8?q?feat(mes):=20=E5=B0=86=E7=89=A9=E6=96=99?= =?UTF-8?q?=E5=A4=A7=E7=B1=BB=E4=BB=8E=E5=AD=97=E5=85=B8=E6=94=B9=E4=B8=BA?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E5=BA=93=E8=A1=A8=E4=B8=AD=E8=8E=B7=E5=8F=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在 BaseMaterialInfo 实体类中将 materialCategories 字段改为 materialCategoryId - 在 BaseMaterialInfoBo 和 BaseMaterialInfoVo 中做相应修改 - 更新 BaseMaterialInfoServiceImpl 中的查询逻辑,关联物料大类信息 - 修改前端页面,使用新的物料大类选项从数据库获取 - 更新相关类型定义,将物料大类改为数据库表字段 --- .../org/dromara/mes/domain/BaseMaterialInfo.java | 11 +++++++++-- .../dromara/mes/domain/bo/BaseMaterialInfoBo.java | 4 ++-- .../dromara/mes/domain/vo/BaseMaterialInfoVo.java | 14 ++++++++++---- .../service/impl/BaseMaterialInfoServiceImpl.java | 11 ++++++----- 4 files changed, 27 insertions(+), 13 deletions(-) diff --git a/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/domain/BaseMaterialInfo.java b/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/domain/BaseMaterialInfo.java index 4cbf300c..c2aa8b6c 100644 --- a/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/domain/BaseMaterialInfo.java +++ b/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/domain/BaseMaterialInfo.java @@ -55,9 +55,9 @@ public class BaseMaterialInfo extends TenantEntity { private Long materialTypeId; /** - * 物料大类(1原材料 2半成品 3成品) + * 物料大类(字典改为数据库表) */ - private String materialCategories; + private String materialCategoryId; /** * 物料小类 @@ -277,4 +277,11 @@ public class BaseMaterialInfo extends TenantEntity { @TableField(exist = false) private String matrialTypeName;//映射字段 + + /** + * 物料大类名称 + */ + @TableField(exist = false) + private String materialCategoryName;//映射字段 + } diff --git a/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/domain/bo/BaseMaterialInfoBo.java b/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/domain/bo/BaseMaterialInfoBo.java index 7dbc7619..e28a0311 100644 --- a/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/domain/bo/BaseMaterialInfoBo.java +++ b/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/domain/bo/BaseMaterialInfoBo.java @@ -56,9 +56,9 @@ public class BaseMaterialInfoBo extends BaseEntity { private Long materialTypeId; /** - * 物料大类(1原材料 2半成品 3成品) + * 物料大类(字典改为数据库表) */ - private String materialCategories; + private String materialCategoryId; /** * 物料小类 diff --git a/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/domain/vo/BaseMaterialInfoVo.java b/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/domain/vo/BaseMaterialInfoVo.java index 788cca24..b2817308 100644 --- a/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/domain/vo/BaseMaterialInfoVo.java +++ b/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/domain/vo/BaseMaterialInfoVo.java @@ -1,6 +1,8 @@ package org.dromara.mes.domain.vo; import java.util.Date; + +import com.baomidou.mybatisplus.annotation.TableField; import com.fasterxml.jackson.annotation.JsonFormat; import org.dromara.mes.domain.BaseMaterialInfo; import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; @@ -73,11 +75,9 @@ public class BaseMaterialInfoVo implements Serializable { private Long materialTypeId; /** - * 物料大类(1原材料 2半成品 3成品) + * 物料大类(字典改为数据库表) */ - @ExcelProperty(value = "物料大类(1原材料 2半成品 3成品)", converter = ExcelDictConvert.class) - @ExcelDictFormat(dictType = "mes_material_categories") - private String materialCategories; + private String materialCategoryId; /** * 物料小类 @@ -381,4 +381,10 @@ public class BaseMaterialInfoVo implements Serializable { @ExcelProperty(value = "物料类型名称") private String matrialTypeName;//映射字段 + /** + * 物料大类名称 + */ + @ExcelProperty(value = "物料大类名称") + private String materialCategoryName;//映射字段 + } diff --git a/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/service/impl/BaseMaterialInfoServiceImpl.java b/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/service/impl/BaseMaterialInfoServiceImpl.java index 6cb9bf6c..4974f798 100644 --- a/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/service/impl/BaseMaterialInfoServiceImpl.java +++ b/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/service/impl/BaseMaterialInfoServiceImpl.java @@ -9,10 +9,7 @@ import org.dromara.common.core.utils.MapstructUtils; import org.dromara.common.core.utils.StringUtils; import org.dromara.common.mybatis.core.page.PageQuery; import org.dromara.common.mybatis.core.page.TableDataInfo; -import org.dromara.mes.domain.BaseMaterialInfo; -import org.dromara.mes.domain.BaseMaterialType; -import org.dromara.mes.domain.ProdBaseFactoryInfo; -import org.dromara.mes.domain.ProdMaterialBom; +import org.dromara.mes.domain.*; import org.dromara.mes.domain.bo.BaseMaterialInfoBo; import org.dromara.mes.domain.vo.BaseMaterialInfoVo; import org.dromara.mes.mapper.BaseMaterialInfoMapper; @@ -94,6 +91,10 @@ public class BaseMaterialInfoServiceImpl implements IBaseMaterialInfoService { .select(BaseMeasurementUnitInfo::getUnitName) .leftJoin(BaseMeasurementUnitInfo.class, BaseMeasurementUnitInfo::getUnitId, BaseMaterialInfo::getMaterialUnitId)*/ + //关联物料大类信息(物料大类从字典改为了数据库表) + .select(BaseMaterialCategory::getMaterialCategoryName) + .leftJoin(BaseMaterialCategory.class, BaseMaterialCategory::getMaterialCategoryId, BaseMaterialInfo::getMaterialCategoryId) + .eq(bo.getMaterialId() != null, BaseMaterialInfo::getMaterialId, bo.getMaterialId()) .eq(StringUtils.isNotBlank(bo.getErpId()), BaseMaterialInfo::getErpId, bo.getErpId()) @@ -101,7 +102,7 @@ public class BaseMaterialInfoServiceImpl implements IBaseMaterialInfoService { .eq(StringUtils.isNotBlank(bo.getOldMaterialCode()), BaseMaterialInfo::getOldMaterialCode, bo.getOldMaterialCode()) .like(StringUtils.isNotBlank(bo.getMaterialName()), BaseMaterialInfo::getMaterialName, bo.getMaterialName()) .eq(bo.getMaterialTypeId() != null, BaseMaterialInfo::getMaterialTypeId, bo.getMaterialTypeId()) - .eq(StringUtils.isNotBlank(bo.getMaterialCategories()), BaseMaterialInfo::getMaterialCategories, bo.getMaterialCategories()) + .eq(StringUtils.isNotBlank(bo.getMaterialCategoryId()), BaseMaterialInfo::getMaterialCategoryId, bo.getMaterialCategoryId()) .eq(StringUtils.isNotBlank(bo.getMaterialSubclass()), BaseMaterialInfo::getMaterialSubclass, bo.getMaterialSubclass()) .eq(StringUtils.isNotBlank(bo.getBatchFlag()), BaseMaterialInfo::getBatchFlag, bo.getBatchFlag()) .eq(bo.getBatchAmount() != null, BaseMaterialInfo::getBatchAmount, bo.getBatchAmount())