diff --git a/jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/impl/MesXslFormulaSpecServiceImpl.java b/jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/impl/MesXslFormulaSpecServiceImpl.java index e2ea385..c35a80b 100644 --- a/jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/impl/MesXslFormulaSpecServiceImpl.java +++ b/jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/impl/MesXslFormulaSpecServiceImpl.java @@ -62,12 +62,6 @@ public class MesXslFormulaSpecServiceImpl extends ServiceImpl RUBBER_CATEGORY_KEYS = Set.of("S", "P", "T", "C"); private static final Pattern RUBBER_CODE_VERSION_PATTERN = Pattern.compile("([A-Z])01$"); - //update-begin---author:cursor ---date:20260525 for:【XSLMES-20260525-A48】生成混炼示方同步B/F段胶至密炼物料----------- - private static final String CATEGORY_MASTER_MAJOR = "XSLMES_MATERIAL_MASTER"; - private static final String CATEGORY_MASTER_MINOR_A = "XSLMES_MATERIAL_MASTER_A"; - private static final String CATEGORY_FINAL_MAJOR = "XSLMES_MATERIAL_FINAL"; - private static final String CATEGORY_FINAL_MINOR_Q = "XSLMES_MATERIAL_FINAL_Q"; - //update-end---author:cursor ---date:20260525 for:【XSLMES-20260525-A48】生成混炼示方同步B/F段胶至密炼物料----------- @Resource private MesXslFormulaSpecLineMapper lineMapper; @@ -776,10 +770,10 @@ public class MesXslFormulaSpecServiceImpl extends ServiceImpl 物料大类「母炼胶」+ 小类「A胶」;F 段 -> 物料大类「终炼胶」+ 小类「Q胶」。 + * 生成混炼示方时,将 B 段/F 段胶料同步写入「胶料信息」(mes_material): + * 胶料类别取配合示方所选「胶料代号」对应胶料的类别;不再写入密炼物料,也不再维护比重。 */ private void syncGeneratedRubberMixerMaterial( MesXslFormulaMixingGenerateRowVO row, @@ -791,26 +785,13 @@ public class MesXslFormulaSpecServiceImpl extends ServiceImpl() - .eq(MesMixerMaterial::getMaterialCode, specCode) - .and(w -> w.eq(MesMixerMaterial::getDelFlag, CommonConstant.DEL_FLAG_0).or().isNull(MesMixerMaterial::getDelFlag)) + /** 生成的 B/F 段胶料类别:取配合示方所选「胶料代号」对应胶料(mes_material)的类别 */ + private String resolveGeneratedRubberCategoryId(MesXslFormulaSpec formula) { + if (formula == null || StringUtils.isBlank(formula.getRubberMaterialId())) { + return null; + } + MesMaterial rubber = mesMaterialService.getById(formula.getRubberMaterialId()); + return rubber != null ? rubber.getCategoryId() : null; + } + + private MesMaterial findRubberMaterialByCodeOrName(String specCode) { + if (StringUtils.isBlank(specCode)) { + return null; + } + MesMaterial byCode = mesMaterialService.getOne( + new LambdaQueryWrapper() + .eq(MesMaterial::getMaterialCode, specCode) + .and(w -> w.eq(MesMaterial::getDelFlag, CommonConstant.DEL_FLAG_0).or().isNull(MesMaterial::getDelFlag)) .last("limit 1")); if (byCode != null) { return byCode; } - return mesMixerMaterialService.getOne( - new LambdaQueryWrapper() - .eq(MesMixerMaterial::getMaterialName, specCode) - .and(w -> w.eq(MesMixerMaterial::getDelFlag, CommonConstant.DEL_FLAG_0).or().isNull(MesMixerMaterial::getDelFlag)) + return mesMaterialService.getOne( + new LambdaQueryWrapper() + .eq(MesMaterial::getMaterialName, specCode) + .and(w -> w.eq(MesMaterial::getDelFlag, CommonConstant.DEL_FLAG_0).or().isNull(MesMaterial::getDelFlag)) .last("limit 1")); } - - private String resolveCategoryIdByCode(String categoryCode, Map cache) { - if (StringUtils.isBlank(categoryCode)) { - return null; - } - if (cache != null && cache.containsKey(categoryCode)) { - return cache.get(categoryCode); - } - SysCategory category = sysCategoryService.getOne( - new LambdaQueryWrapper().eq(SysCategory::getCode, categoryCode.trim()).last("limit 1")); - String categoryId = category != null ? category.getId() : null; - if (cache != null) { - cache.put(categoryCode, categoryId); - } - return categoryId; - } - //update-end---author:cursor ---date:20260525 for:【XSLMES-20260525-A48】生成混炼示方同步B/F段胶至密炼物料----------- + //update-end---author:cursor ---date:20260601 for:【XSLMES-20260601-A62】生成混炼示方改为同步B/F段胶至胶料信息----------- private int normalizeMixingStages(Integer mixingStages) { if (mixingStages == null || mixingStages <= 0) { @@ -1129,39 +1104,40 @@ public class MesXslFormulaSpecServiceImpl extends ServiceImpl mixerCache, Map categoryNameCache, MesXslMixerMaterialKindLookupVO kindLookup) { - ensureMotherRubberMixerMaterialSynced(motherSpecCode, formula, compoundSpecificGravity, categoryIdCache); + //update-begin---author:cursor ---date:20260601 for:【XSLMES-20260601-A62】上一段母胶明细行改绑胶料信息----------- + ensureMotherRubberMaterialSynced(motherSpecCode, formula, categoryIdCache); MesXslMixingSpecMaterial material = new MesXslMixingSpecMaterial(); material.setSortNo(sortNo); material.setUnitWeight(unitWeight); - MesMixerMaterial mixer = findMixerMaterialByCodeOrName(motherSpecCode.trim()); - if (mixer != null) { - fillMixingMaterialFromMixerMaterial(material, mixer, null, mixerCache, categoryNameCache, kindLookup); + MesMaterial rubber = findRubberMaterialByCodeOrName(motherSpecCode.trim()); + if (rubber != null) { + fillMixingMaterialFromRubberMaterial(material, rubber, categoryNameCache, kindLookup); return material; } - log.warn("[混炼示方生成] 未找到上一段密炼物料 {},明细行回退为示方编号展示", motherSpecCode); + log.warn("[混炼示方生成] 未找到上一段胶料信息 {},明细行回退为示方编号展示", motherSpecCode); material.setMixerMaterialName(motherSpecCode); material.setMixerMaterialDesc(motherSpecCode); - fillMotherRubberCategoryFallback(material, categoryIdCache, categoryNameCache, kindLookup); + fillMotherRubberCategoryFallback(material, formula, categoryNameCache, kindLookup); return material; + //update-end---author:cursor ---date:20260601 for:【XSLMES-20260601-A62】上一段母胶明细行改绑胶料信息----------- } - /** 上一段 B 段胶尚未写入主数据时,按母炼胶/A胶分类补建一条密炼物料 */ - private void ensureMotherRubberMixerMaterialSynced( + /** 上一段 B 段胶尚未写入胶料信息时,按配合示方胶料类别补建一条胶料信息 */ + private void ensureMotherRubberMaterialSynced( String motherSpecCode, MesXslFormulaSpec formula, - BigDecimal compoundSpecificGravity, Map categoryIdCache) { if (StringUtils.isBlank(motherSpecCode)) { return; } String normalized = motherSpecCode.trim(); - if (findMixerMaterialByCodeOrName(normalized) != null) { + if (findRubberMaterialByCodeOrName(normalized) != null) { return; } MesXslFormulaMixingGenerateRowVO stub = new MesXslFormulaMixingGenerateRowVO(); stub.setSpecCode(normalized); stub.setStepType("A"); - syncGeneratedRubberMixerMaterial(stub, formula, compoundSpecificGravity, categoryIdCache); + syncGeneratedRubberMixerMaterial(stub, formula, null, categoryIdCache); } /** 按密炼物料主数据回填混炼示方明细行(名称/大小类/种类) */ @@ -1195,20 +1171,44 @@ public class MesXslFormulaSpecServiceImpl extends ServiceImpl categoryIdCache, + MesMaterial rubber, Map categoryNameCache, MesXslMixerMaterialKindLookupVO kindLookup) { - String majorCategoryId = resolveCategoryIdByCode(CATEGORY_MASTER_MAJOR, categoryIdCache); - String minorCategoryId = resolveCategoryIdByCode(CATEGORY_MASTER_MINOR_A, categoryIdCache); - material.setMaterialMajor(resolveCategoryName(majorCategoryId, categoryNameCache)); - material.setMaterialMinor(resolveCategoryName(minorCategoryId, categoryNameCache)); + if (material == null || rubber == null) { + return; + } + String displayName = + StringUtils.isNotBlank(rubber.getMaterialName()) ? rubber.getMaterialName() : rubber.getMaterialCode(); + material.setMixerMaterialName(displayName); + material.setMixerMaterialDesc(displayName); + String categoryName = resolveCategoryName(rubber.getCategoryId(), categoryNameCache); + material.setMaterialMajor(null); + material.setMaterialMinor(categoryName); + material.setMixerMaterialId(rubber.getId()); material.setMaterialKind( mesXslMixerMaterialKindCfgService.resolveMixingMaterialKind( - kindLookup, minorCategoryId, null, material.getMaterialMinor())); + kindLookup, rubber.getCategoryId(), null, categoryName)); } + + /** 未查到胶料信息时,按配合示方胶料类别从配置表解析种类 */ + private void fillMotherRubberCategoryFallback( + MesXslMixingSpecMaterial material, + MesXslFormulaSpec formula, + Map categoryNameCache, + MesXslMixerMaterialKindLookupVO kindLookup) { + String categoryId = resolveGeneratedRubberCategoryId(formula); + String categoryName = resolveCategoryName(categoryId, categoryNameCache); + material.setMaterialMajor(null); + material.setMaterialMinor(categoryName); + material.setMaterialKind( + mesXslMixerMaterialKindCfgService.resolveMixingMaterialKind( + kindLookup, categoryId, null, categoryName)); + } + //update-end---author:cursor ---date:20260601 for:【XSLMES-20260601-A62】母胶明细行按胶料信息回填----------- //update-end---author:cursor ---date:20260525 for:【XSLMES-20260525-A54】母炼胶明细行绑定已同步密炼物料主数据----------- /** 混合段累计合计:优先主表 stageNTotal,否则按明细该列求和 */ diff --git a/jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/impl/MesXslMixerMaterialKindCfgServiceImpl.java b/jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/impl/MesXslMixerMaterialKindCfgServiceImpl.java index aafb2b0..142c7a7 100644 --- a/jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/impl/MesXslMixerMaterialKindCfgServiceImpl.java +++ b/jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/impl/MesXslMixerMaterialKindCfgServiceImpl.java @@ -290,6 +290,9 @@ public class MesXslMixerMaterialKindCfgServiceImpl MesXslMixerMaterialKindLookupVO lookup = new MesXslMixerMaterialKindLookupVO(); Map byRefId = new LinkedHashMap<>(); Map byRefCode = new LinkedHashMap<>(); + //update-begin---author:cursor ---date:20260601 for:【XSLMES-20260601-A62】种类查找表支持按胶料类别名称匹配----------- + Map byRefName = new LinkedHashMap<>(); + //update-end---author:cursor ---date:20260601 for:【XSLMES-20260601-A62】种类查找表支持按胶料类别名称匹配----------- String rubberKindName = null; if (rows != null) { for (MesXslMixerMaterialKindCfg row : rows) { @@ -310,6 +313,14 @@ public class MesXslMixerMaterialKindCfgServiceImpl byRefCode.put(lowerCode, kindName); } } + //update-begin---author:cursor ---date:20260601 for:【XSLMES-20260601-A62】种类查找表支持按胶料类别名称匹配----------- + if (oConvertUtils.isNotEmpty(row.getCategoryRefName())) { + String refName = row.getCategoryRefName().trim(); + if (!byRefName.containsKey(refName)) { + byRefName.put(refName, kindName); + } + } + //update-end---author:cursor ---date:20260601 for:【XSLMES-20260601-A62】种类查找表支持按胶料类别名称匹配----------- if (rubberKindName == null && DEFAULT_RUBBER_KIND_NAME.equals(kindName)) { rubberKindName = kindName; } @@ -317,6 +328,9 @@ public class MesXslMixerMaterialKindCfgServiceImpl } lookup.setByRefId(byRefId); lookup.setByRefCode(byRefCode); + //update-begin---author:cursor ---date:20260601 for:【XSLMES-20260601-A62】种类查找表支持按胶料类别名称匹配----------- + lookup.setByRefName(byRefName); + //update-end---author:cursor ---date:20260601 for:【XSLMES-20260601-A62】种类查找表支持按胶料类别名称匹配----------- lookup.setRubberKindName(oConvertUtils.isNotEmpty(rubberKindName) ? rubberKindName : DEFAULT_RUBBER_KIND_NAME); return lookup; } @@ -342,6 +356,17 @@ public class MesXslMixerMaterialKindCfgServiceImpl return fromMinor; } } + //update-begin---author:cursor ---date:20260601 for:【XSLMES-20260601-A62】种类解析支持胶料类别名称----------- + if (oConvertUtils.isNotEmpty(minorCategoryName)) { + Map byRefName = lookup.getByRefName(); + if (byRefName != null) { + String fromName = byRefName.get(minorCategoryName.trim()); + if (oConvertUtils.isNotEmpty(fromName)) { + return fromName; + } + } + } + //update-end---author:cursor ---date:20260601 for:【XSLMES-20260601-A62】种类解析支持胶料类别名称----------- //update-begin---author:cursor ---date:20260525 for:【XSLMES-20260525-A53】种类未命中配置时不回退小类名----------- return null; //update-end---author:cursor ---date:20260525 for:【XSLMES-20260525-A53】种类未命中配置时不回退小类名----------- diff --git a/jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/impl/MesXslMixingSpecServiceImpl.java b/jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/impl/MesXslMixingSpecServiceImpl.java index d5c8e72..bc1e167 100644 --- a/jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/impl/MesXslMixingSpecServiceImpl.java +++ b/jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/impl/MesXslMixingSpecServiceImpl.java @@ -11,7 +11,6 @@ import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.Date; -import java.util.HashMap; import java.util.LinkedHashSet; import java.util.List; import java.util.Map; @@ -23,10 +22,8 @@ import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; import org.jeecg.common.constant.CommonConstant; import org.jeecg.common.util.oConvertUtils; -import org.jeecg.modules.mes.material.entity.MesMixerMaterial; -import org.jeecg.modules.mes.material.service.IMesMixerMaterialService; -import org.jeecg.modules.system.entity.SysCategory; -import org.jeecg.modules.system.service.ISysCategoryService; +import org.jeecg.modules.mes.material.entity.MesMaterial; +import org.jeecg.modules.mes.material.service.IMesMaterialService; import org.jeecg.modules.xslmes.entity.MesXslMixingSpec; import org.jeecg.modules.xslmes.entity.MesXslMixingSpecDownStep; import org.jeecg.modules.xslmes.entity.MesXslMixingSpecMaterial; @@ -53,13 +50,9 @@ public class MesXslMixingSpecServiceImpl extends ServiceImpl().eq(MesXslMixingSpec::getSpecName, specCode)); if (remainingSpecCount > 0) { - log.debug("[混炼示方删除] 示方编号 {} 仍有 {} 条混炼示方,跳过密炼物料同步删除", specCode, remainingSpecCount); + log.debug("[混炼示方删除] 示方编号 {} 仍有 {} 条混炼示方,跳过胶料信息同步删除", specCode, remainingSpecCount); return; } long referencedCount = countMaterialReference(specCode, null); if (referencedCount > 0) { log.info( - "[混炼示方删除] 示方编号 {} 仍被 {} 条混炼示方明细引用,跳过密炼物料同步删除", + "[混炼示方删除] 示方编号 {} 仍被 {} 条混炼示方明细引用,跳过胶料信息同步删除", specCode, referencedCount); return; } - MesMixerMaterial material = findMixerMaterialByCodeOrName(specCode); + MesMaterial material = findRubberMaterialByCodeOrName(specCode); if (material == null) { - log.debug("[混炼示方删除] 未找到示方编号 {} 对应密炼物料,跳过同步删除", specCode); + log.debug("[混炼示方删除] 未找到示方编号 {} 对应胶料信息,跳过同步删除", specCode); return; } referencedCount = countMaterialReference(specCode, material.getId()); if (referencedCount > 0) { log.info( - "[混炼示方删除] 密炼物料 id={}, code={} 仍被 {} 条混炼示方明细引用,跳过同步删除", + "[混炼示方删除] 胶料信息 id={}, code={} 仍被 {} 条混炼示方明细引用,跳过同步删除", material.getId(), specCode, referencedCount); return; } - Map categoryIdCache = new HashMap<>(); - if (!isGeneratedRubberMixerMaterial(material, isFinalStage, categoryIdCache)) { - log.info( - "[混炼示方删除] 密炼物料 id={}, code={} 分类非生成示方自动同步类型,跳过删除", - material.getId(), - specCode); - return; - } - mesMixerMaterialService.removeById(material.getId()); - log.info("[混炼示方删除] 同步删除密炼物料 id={}, code={}", material.getId(), specCode); + mesMaterialService.removeById(material.getId()); + log.info("[混炼示方删除] 同步删除胶料信息 id={}, code={}", material.getId(), specCode); } /** 判断是否为生成混炼示方时自动同步的 B/F 段胶示方编号;true=F段,false=B段,null=非自动生成胶料编号 */ @@ -752,38 +737,26 @@ public class MesXslMixingSpecServiceImpl extends ServiceImpl() - .eq(MesMixerMaterial::getMaterialCode, specCode) - .and(w -> w.eq(MesMixerMaterial::getDelFlag, CommonConstant.DEL_FLAG_0).or().isNull(MesMixerMaterial::getDelFlag)) + private MesMaterial findRubberMaterialByCodeOrName(String specCode) { + if (StringUtils.isBlank(specCode)) { + return null; + } + MesMaterial byCode = mesMaterialService.getOne( + new LambdaQueryWrapper() + .eq(MesMaterial::getMaterialCode, specCode) + .and(w -> w.eq(MesMaterial::getDelFlag, CommonConstant.DEL_FLAG_0).or().isNull(MesMaterial::getDelFlag)) .last("limit 1")); if (byCode != null) { return byCode; } - return mesMixerMaterialService.getOne( - new LambdaQueryWrapper() - .eq(MesMixerMaterial::getMaterialName, specCode) - .and(w -> w.eq(MesMixerMaterial::getDelFlag, CommonConstant.DEL_FLAG_0).or().isNull(MesMixerMaterial::getDelFlag)) + return mesMaterialService.getOne( + new LambdaQueryWrapper() + .eq(MesMaterial::getMaterialName, specCode) + .and(w -> w.eq(MesMaterial::getDelFlag, CommonConstant.DEL_FLAG_0).or().isNull(MesMaterial::getDelFlag)) .last("limit 1")); } - private boolean isGeneratedRubberMixerMaterial( - MesMixerMaterial material, boolean isFinalStage, Map categoryIdCache) { - if (material == null) { - return false; - } - String majorCode = isFinalStage ? CATEGORY_FINAL_MAJOR : CATEGORY_MASTER_MAJOR; - String minorCode = isFinalStage ? CATEGORY_FINAL_MINOR_Q : CATEGORY_MASTER_MINOR_A; - String expectedMajorId = resolveCategoryIdByCode(majorCode, categoryIdCache); - String expectedMinorId = resolveCategoryIdByCode(minorCode, categoryIdCache); - if (StringUtils.isBlank(expectedMajorId) || StringUtils.isBlank(expectedMinorId)) { - return false; - } - return expectedMajorId.equals(material.getMajorCategoryId()) && expectedMinorId.equals(material.getMinorCategoryId()); - } - - /** 统计混炼示方明细对某示方编号/密炼物料 ID 的引用次数 */ + /** 统计混炼示方明细对某示方编号/胶料信息 ID 的引用次数 */ private long countMaterialReference(String specCode, String mixerMaterialId) { LambdaQueryWrapper qw = new LambdaQueryWrapper<>(); qw.and(wrapper -> { @@ -794,23 +767,7 @@ public class MesXslMixingSpecServiceImpl extends ServiceImpl cache) { - if (StringUtils.isBlank(categoryCode)) { - return null; - } - if (cache != null && cache.containsKey(categoryCode)) { - return cache.get(categoryCode); - } - SysCategory category = sysCategoryService.getOne( - new LambdaQueryWrapper().eq(SysCategory::getCode, categoryCode.trim()).last("limit 1")); - String categoryId = category != null ? category.getId() : null; - if (cache != null) { - cache.put(categoryCode, categoryId); - } - return categoryId; - } - //update-end---author:cursor ---date:20260525 for:【XSLMES-20260525-A49】删除混炼示方时同步删除B/F段胶密炼物料----------- + //update-end---author:cursor ---date:20260601 for:【XSLMES-20260601-A62】删除混炼示方时同步删除自动生成的B/F段胶料信息----------- //update-begin---author:cursor ---date:20260526 for:【XSLMES-20260526-A61】混炼示方密炼PS审批联动同步审批人----------- @Override diff --git a/jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/vo/MesXslMixerMaterialKindLookupVO.java b/jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/vo/MesXslMixerMaterialKindLookupVO.java index cf2d3f3..1629a47 100644 --- a/jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/vo/MesXslMixerMaterialKindLookupVO.java +++ b/jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/vo/MesXslMixerMaterialKindLookupVO.java @@ -21,6 +21,11 @@ public class MesXslMixerMaterialKindLookupVO implements Serializable { @Schema(description = "对应分类/字典项编码 -> 种类名称") private Map byRefCode = new LinkedHashMap<>(); + //update-begin---author:cursor ---date:20260601 for:【XSLMES-20260601-A62】种类查找表支持按胶料类别名称匹配----------- + @Schema(description = "对应分类名称 -> 种类名称(胶料信息 categoryId_dictText)") + private Map byRefName = new LinkedHashMap<>(); + //update-end---author:cursor ---date:20260601 for:【XSLMES-20260601-A62】种类查找表支持按胶料类别名称匹配----------- + @Schema(description = "胶料种类名称(母炼胶行兜底)") private String rubberKindName; } diff --git a/jeecg-boot/jeecg-module-system/jeecg-system-start/src/main/resources/application-dev.yml b/jeecg-boot/jeecg-module-system/jeecg-system-start/src/main/resources/application-dev.yml index 3f7ebd7..a68b2ff 100644 --- a/jeecg-boot/jeecg-module-system/jeecg-system-start/src/main/resources/application-dev.yml +++ b/jeecg-boot/jeecg-module-system/jeecg-system-start/src/main/resources/application-dev.yml @@ -157,6 +157,7 @@ spring: datasource: master: url: jdbc:mysql://xsl.qdxsl.top:50768/jeecg-boot?characterEncoding=UTF-8&useUnicode=true&useSSL=false&tinyInt1isBit=false&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai + # url: jdbc:mysql://10.30.1.60:3306/jeecg-boot?characterEncoding=UTF-8&useUnicode=true&useSSL=false&tinyInt1isBit=false&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai # url: jdbc:mysql://localhost:3307/jeecg-boot?characterEncoding=UTF-8&useUnicode=true&useSSL=false&tinyInt1isBit=false&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai username: root password: 123456 diff --git a/jeecgboot-vue3/src/views/xslmes/mesXslMixingSpec/MesXslMixingSpec.data.ts b/jeecgboot-vue3/src/views/xslmes/mesXslMixingSpec/MesXslMixingSpec.data.ts index 29c60f7..163b6bc 100644 --- a/jeecgboot-vue3/src/views/xslmes/mesXslMixingSpec/MesXslMixingSpec.data.ts +++ b/jeecgboot-vue3/src/views/xslmes/mesXslMixingSpec/MesXslMixingSpec.data.ts @@ -17,8 +17,10 @@ export const MIXING_MATERIAL_ROW_NUMBER_WIDTH = 60; /** 橡胶及配合剂明细列可缩小到的最小宽度 */ export const MIXING_MATERIAL_MIN_COLUMN_WIDTH = 40; -/** 默认隐藏的明细列 */ -export const MIXING_MATERIAL_DEFAULT_HIDDEN_COLUMN_KEYS = ['materialMajor', 'materialKind']; +//update-begin---author:cursor ---date:20260601 for:【XSLMES-20260601-A62】橡胶及配合剂明细默认展示种类列----------- +/** 默认隐藏的明细列(种类列默认展示,物料小类默认隐藏) */ +export const MIXING_MATERIAL_DEFAULT_HIDDEN_COLUMN_KEYS = ['materialMajor', 'materialMinor']; +//update-end---author:cursor ---date:20260601 for:【XSLMES-20260601-A62】橡胶及配合剂明细默认展示种类列----------- /** 不允许隐藏的明细列 */ export const MIXING_MATERIAL_LOCKED_COLUMN_KEYS = ['mixerMaterialName']; @@ -92,8 +94,17 @@ export const materialColumns: JVxeColumn[] = [ { title: '密炼物料ID', key: 'mixerMaterialId', type: JVxeTypes.hidden }, //update-end---author:cursor ---date:20260525 for:【XSLMES-20260525-A55】混炼示方明细关联密炼物料ID----------- { title: '物料大类', key: 'materialMajor', type: JVxeTypes.input, width: 100, minWidth: MIXING_MATERIAL_MIN_COLUMN_WIDTH }, + //update-begin---author:cursor ---date:20260601 for:【XSLMES-20260601-A62】种类列置于首列展示且只读----------- + { + title: '种类', + key: 'materialKind', + type: JVxeTypes.input, + width: 100, + minWidth: MIXING_MATERIAL_MIN_COLUMN_WIDTH, + disabled: true, + }, { title: '物料小类', key: 'materialMinor', type: JVxeTypes.input, width: 120, minWidth: MIXING_MATERIAL_MIN_COLUMN_WIDTH }, - { title: '种类', key: 'materialKind', type: JVxeTypes.input, width: 80, minWidth: MIXING_MATERIAL_MIN_COLUMN_WIDTH }, + //update-end---author:cursor ---date:20260601 for:【XSLMES-20260601-A62】种类列置于首列展示且只读----------- { title: '密炼物料名称', key: 'mixerMaterialName', @@ -134,9 +145,16 @@ export function loadMixingMaterialHiddenColumnKeys(): string[] { if (!Array.isArray(saved)) { return MIXING_MATERIAL_DEFAULT_HIDDEN_COLUMN_KEYS.filter((key) => validKeys.has(key)); } - return saved.filter( + //update-begin---author:cursor ---date:20260601 for:【XSLMES-20260601-A62】迁移列显示偏好:原隐藏种类改为隐藏物料小类----------- + let keys = saved.filter( (key) => typeof key === 'string' && !MIXING_MATERIAL_LOCKED_COLUMN_KEYS.includes(key) && validKeys.has(key), ); + if (keys.includes('materialKind') && !keys.includes('materialMinor')) { + keys = keys.filter((key) => key !== 'materialKind'); + keys.push('materialMinor'); + } + return keys; + //update-end---author:cursor ---date:20260601 for:【XSLMES-20260601-A62】迁移列显示偏好:原隐藏种类改为隐藏物料小类----------- } /** 保存已隐藏的橡胶及配合剂明细列 key */ @@ -1047,12 +1065,16 @@ export function sanitizeMixingMaterialPickerHiddenCategoryIds(allMinorIds: strin export interface MixerMaterialKindLookup { byRefId: Record; byRefCode: Record; + //update-begin---author:cursor ---date:20260601 for:【XSLMES-20260601-A62】种类查找表支持胶料类别名称----------- + byRefName?: Record; + //update-end---author:cursor ---date:20260601 for:【XSLMES-20260601-A62】种类查找表支持胶料类别名称----------- rubberKindName?: string; } export const EMPTY_MIXER_MATERIAL_KIND_LOOKUP: MixerMaterialKindLookup = { byRefId: {}, byRefCode: {}, + byRefName: {}, rubberKindName: '胶料', }; @@ -1074,6 +1096,9 @@ export async function loadMixingMaterialKindLookup(forceReload = false): Promise const lookup: MixerMaterialKindLookup = { byRefId: raw?.byRefId || {}, byRefCode: raw?.byRefCode || {}, + //update-begin---author:cursor ---date:20260601 for:【XSLMES-20260601-A62】加载种类配置含类别名称映射----------- + byRefName: raw?.byRefName || {}, + //update-end---author:cursor ---date:20260601 for:【XSLMES-20260601-A62】加载种类配置含类别名称映射----------- rubberKindName: raw?.rubberKindName || '胶料', }; mixingMaterialKindLookupCache = lookup; @@ -1116,12 +1141,12 @@ function matchKindFromLookup(lookup: MixerMaterialKindLookup | null | undefined, return ''; } -/** 解析混炼示方明细种类:称量方式优先,其次物料小类 ID(未命中返回空,由配置表维护) */ +/** 解析混炼示方明细种类:称量方式优先,其次分类 ID,再按分类名称(未命中返回空) */ export function resolveMixingMaterialKindFromLookup( lookup: MixerMaterialKindLookup | null | undefined, weighMode?: string, minorCategoryId?: string, - _minorCategoryName?: string, + minorCategoryName?: string, ) { const fromWeighMode = matchKindFromLookup(lookup, weighMode); if (fromWeighMode) { @@ -1131,9 +1156,35 @@ export function resolveMixingMaterialKindFromLookup( if (fromMinorId) { return fromMinorId; } + //update-begin---author:cursor ---date:20260601 for:【XSLMES-20260601-A62】按胶料类别名称匹配种类配置----------- + if (minorCategoryName != null && String(minorCategoryName).trim() !== '') { + const refName = String(minorCategoryName).trim(); + if (lookup?.byRefName?.[refName]) { + return lookup.byRefName[refName]; + } + } + //update-end---author:cursor ---date:20260601 for:【XSLMES-20260601-A62】按胶料类别名称匹配种类配置----------- return ''; } +/** 胶料页签解析种类:配置匹配后可用 rubberKindName(如「胶料」)兜底 */ +export function resolveMixingRubberKindForPicker( + lookup: MixerMaterialKindLookup | null | undefined, + weighMode?: string, + categoryId?: string, + categoryName?: string, + categoryCode?: string, +) { + let kind = resolveMixingMaterialKindFromLookup(lookup, weighMode, categoryId, categoryName); + if (!kind && categoryCode) { + kind = matchKindFromLookup(lookup, categoryCode); + } + if (!kind && lookup?.rubberKindName) { + kind = lookup.rubberKindName; + } + return kind; +} + /** @deprecated 保留兼容,请改用 resolveMixingMaterialKindFromLookup */ export function resolveMixingMaterialKindFromCategory(_isRubber?: unknown, minorName?: string) { return minorName != null && String(minorName).trim() !== '' ? String(minorName).trim() : ''; @@ -1189,6 +1240,33 @@ export function applyMixingMaterialFromSelection(row: Recordable, material: Reco } //update-end---author:cursor ---date:20260525 for:【XSLMES-20260525-A50】混炼示方密炼物料选料弹窗与种类解析----------- +//update-begin---author:cursor ---date:20260601 for:【XSLMES-20260601-A62】选料弹窗新增胶料页签(查询胶料信息)----------- +/** 选料弹窗「胶料」页签表格列(数据源为胶料信息 mes_material) */ +export const mixingRubberPickerTableColumns: BasicColumn[] = [ + { title: '胶料编码', align: 'center', width: 140, dataIndex: 'materialCode' }, + { title: '胶料名称', align: 'center', width: 180, dataIndex: 'materialName' }, + //update-begin---author:cursor ---date:20260601 for:【XSLMES-20260601-A62】胶料页签补齐自动/人工称量列----------- + { title: '自动/人工称量', align: 'center', width: 132, dataIndex: 'pickerWeighMode' }, + //update-end---author:cursor ---date:20260601 for:【XSLMES-20260601-A62】胶料页签补齐自动/人工称量列----------- + { title: '种类', align: 'center', width: 100, dataIndex: 'pickerMaterialKind' }, + { title: '胶料类别', align: 'center', width: 140, dataIndex: 'categoryId_dictText' }, + { title: '胶料别名', align: 'center', width: 140, dataIndex: 'aliasName' }, +]; + +/** 选择胶料信息后回填混炼示方橡胶及配合剂明细行(复用 mixerMaterialId 存 mes_material.id) */ +export function applyMixingRubberFromSelection(row: Recordable, material: Recordable, materialKind: string) { + if (!row || !material) { + return; + } + row.mixerMaterialId = material.id || ''; + row.mixerMaterialName = material.materialName || material.materialCode || ''; + row.mixerMaterialDesc = material.materialName || material.materialCode || ''; + row.materialMajor = ''; + row.materialMinor = material.categoryId_dictText || ''; + row.materialKind = materialKind != null && String(materialKind).trim() !== '' ? String(materialKind).trim() : ''; +} +//update-end---author:cursor ---date:20260601 for:【XSLMES-20260601-A62】选料弹窗新增胶料页签(查询胶料信息)----------- + //update-begin---author:cursor ---date:20260526 for:【XSLMES-20260526-A58】参照历史混合步骤选择弹窗----------- /** 混合步骤可复制的业务字段 */ export const MIXING_STEP_COPY_FIELD_KEYS = [ diff --git a/jeecgboot-vue3/src/views/xslmes/mesXslMixingSpec/components/MesXslMixingMaterialSelectModal.vue b/jeecgboot-vue3/src/views/xslmes/mesXslMixingSpec/components/MesXslMixingMaterialSelectModal.vue index 707e42b..2866c07 100644 --- a/jeecgboot-vue3/src/views/xslmes/mesXslMixingSpec/components/MesXslMixingMaterialSelectModal.vue +++ b/jeecgboot-vue3/src/views/xslmes/mesXslMixingSpec/components/MesXslMixingMaterialSelectModal.vue @@ -1,7 +1,7 @@