实现密炼物料种类配置关联解析功能,新增种类查找表加载与解析接口,优化选料弹窗层级与刷新功能,增强用户体验与系统稳定性。
This commit is contained in:
@@ -278,3 +278,31 @@ jeecgboot-vue3/src/views/xslmes/mesXslMixerMaterialKindCfg/components/MesXslMixe
|
||||
-- author:cursor---date:20260525--for: 【XSLMES-20260525-A51】密炼物料种类配置菜单ID冲突修复 -----------
|
||||
jeecg-module-system/jeecg-system-start/src/main/resources/flyway/sql/mysql/V3.9.2_102__mes_xsl_mixer_material_kind_cfg.sql
|
||||
jeecg-module-system/jeecg-system-start/src/main/resources/flyway/sql/mysql/V3.9.2_103__mes_xsl_mixer_material_kind_cfg_menu_fix.sql
|
||||
|
||||
-- author:cursor---date:20260525--for: 【XSLMES-20260525-A52】混炼示方种类改读密炼物料种类配置(生成/选料弹窗) -----------
|
||||
jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/vo/MesXslMixerMaterialKindLookupVO.java
|
||||
jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/IMesXslMixerMaterialKindCfgService.java
|
||||
jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/impl/MesXslMixerMaterialKindCfgServiceImpl.java
|
||||
jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/controller/MesXslMixerMaterialKindCfgController.java
|
||||
jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/impl/MesXslFormulaSpecServiceImpl.java
|
||||
jeecgboot-vue3/src/views/xslmes/mesXslMixerMaterialKindCfg/MesXslMixerMaterialKindCfg.api.ts
|
||||
jeecgboot-vue3/src/views/xslmes/mesXslMixingSpec/MesXslMixingSpec.data.ts
|
||||
jeecgboot-vue3/src/views/xslmes/mesXslMixingSpec/components/MesXslMixingMaterialSelectModal.vue
|
||||
|
||||
-- author:cursor---date:20260525--for: 【XSLMES-20260525-A52】选料弹窗层级修复及关闭父弹窗时同步关闭 -----------
|
||||
jeecgboot-vue3/src/views/xslmes/mesXslMixingSpec/components/MesXslMixingMaterialSelectModal.vue
|
||||
jeecgboot-vue3/src/views/xslmes/mesXslMixingSpec/components/MesXslMixingSpecModal.vue
|
||||
|
||||
-- author:cursor---date:20260525--for: 【XSLMES-20260525-A52】选料弹窗左侧物料小类树会话缓存 -----------
|
||||
jeecgboot-vue3/src/views/system/category/category.constants.ts
|
||||
jeecgboot-vue3/src/views/xslmes/mesXslMixingSpec/components/MesXslMixingMaterialSelectModal.vue
|
||||
|
||||
-- author:cursor---date:20260525--for: 【XSLMES-20260525-A52】选料弹窗小类设置按钮 Popover 层级修复 -----------
|
||||
jeecgboot-vue3/src/views/xslmes/mesXslMixingSpec/components/MesXslMixingMaterialCategorySetting.vue
|
||||
|
||||
-- author:cursor---date:20260525--for: 【XSLMES-20260525-A52】选料弹窗小类设置新增刷新分类字典 -----------
|
||||
jeecgboot-vue3/src/views/xslmes/mesXslMixingSpec/components/MesXslMixingMaterialCategorySetting.vue
|
||||
jeecgboot-vue3/src/views/xslmes/mesXslMixingSpec/components/MesXslMixingMaterialSelectModal.vue
|
||||
|
||||
-- author:cursor---date:20260525--for: 【XSLMES-20260525-A52】高层级弹窗内 Message 提示层级修复 -----------
|
||||
jeecgboot-vue3/src/design/public.less
|
||||
|
||||
@@ -19,6 +19,7 @@ import org.jeecg.common.system.query.QueryGenerator;
|
||||
import org.jeecg.common.util.oConvertUtils;
|
||||
import org.jeecg.modules.xslmes.entity.MesXslMixerMaterialKindCfg;
|
||||
import org.jeecg.modules.xslmes.service.IMesXslMixerMaterialKindCfgService;
|
||||
import org.jeecg.modules.xslmes.vo.MesXslMixerMaterialKindLookupVO;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
@@ -72,6 +73,28 @@ public class MesXslMixerMaterialKindCfgController
|
||||
}
|
||||
//update-end---author:cursor ---date:20260525 for:【XSLMES-20260525-A51】密炼物料种类配置展开与批量保存-----------
|
||||
|
||||
//update-begin---author:cursor ---date:20260525 for:【XSLMES-20260525-A52】密炼物料种类配置关联解析-----------
|
||||
@Operation(summary = "MES密炼物料种类配置-加载种类查找表")
|
||||
@GetMapping(value = "/kindLookup")
|
||||
public Result<MesXslMixerMaterialKindLookupVO> kindLookup(
|
||||
@RequestParam(name = "tenantId", required = false) Integer tenantId) {
|
||||
return Result.OK(mesXslMixerMaterialKindCfgService.loadKindLookup(tenantId));
|
||||
}
|
||||
|
||||
@Operation(summary = "MES密炼物料种类配置-解析混炼示方明细种类")
|
||||
@GetMapping(value = "/resolveKind")
|
||||
public Result<String> resolveKind(
|
||||
@RequestParam(name = "minorCategoryId", required = false) String minorCategoryId,
|
||||
@RequestParam(name = "weighMode", required = false) String weighMode,
|
||||
@RequestParam(name = "minorCategoryName", required = false) String minorCategoryName,
|
||||
@RequestParam(name = "tenantId", required = false) Integer tenantId) {
|
||||
MesXslMixerMaterialKindLookupVO lookup = mesXslMixerMaterialKindCfgService.loadKindLookup(tenantId);
|
||||
String kind = mesXslMixerMaterialKindCfgService.resolveMixingMaterialKind(
|
||||
lookup, minorCategoryId, weighMode, minorCategoryName);
|
||||
return Result.OK(kind);
|
||||
}
|
||||
//update-end---author:cursor ---date:20260525 for:【XSLMES-20260525-A52】密炼物料种类配置关联解析-----------
|
||||
|
||||
@AutoLog(value = "MES密炼物料种类配置-添加")
|
||||
@Operation(summary = "MES密炼物料种类配置-添加")
|
||||
@RequiresPermissions("xslmes:mes_xsl_mixer_material_kind_cfg:add")
|
||||
|
||||
@@ -3,6 +3,7 @@ package org.jeecg.modules.xslmes.service;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import java.util.List;
|
||||
import org.jeecg.modules.xslmes.entity.MesXslMixerMaterialKindCfg;
|
||||
import org.jeecg.modules.xslmes.vo.MesXslMixerMaterialKindLookupVO;
|
||||
|
||||
/**
|
||||
* MES 密炼物料种类配置
|
||||
@@ -23,4 +24,20 @@ public interface IMesXslMixerMaterialKindCfgService extends IService<MesXslMixer
|
||||
* 校验租户内种类键值/对应分类是否重复
|
||||
*/
|
||||
void checkDuplicate(MesXslMixerMaterialKindCfg line, String excludeId);
|
||||
|
||||
//update-begin---author:cursor ---date:20260525 for:【XSLMES-20260525-A52】密炼物料种类配置关联解析-----------
|
||||
/**
|
||||
* 加载种类配置查找表(按 category_ref_id / category_ref_code 关联)
|
||||
*/
|
||||
MesXslMixerMaterialKindLookupVO loadKindLookup(Integer tenantId);
|
||||
|
||||
/**
|
||||
* 解析混炼示方明细种类:称量方式优先,其次物料小类,最后小类名称兜底
|
||||
*/
|
||||
String resolveMixingMaterialKind(
|
||||
MesXslMixerMaterialKindLookupVO lookup,
|
||||
String minorCategoryId,
|
||||
String weighMode,
|
||||
String minorCategoryName);
|
||||
//update-end---author:cursor ---date:20260525 for:【XSLMES-20260525-A52】密炼物料种类配置关联解析-----------
|
||||
}
|
||||
|
||||
@@ -39,7 +39,9 @@ import org.jeecg.modules.xslmes.mapper.MesXslFormulaSpecMapper;
|
||||
import org.jeecg.modules.xslmes.service.IMesXslEquipmentLedgerService;
|
||||
import org.jeecg.modules.xslmes.service.IMesXslFormulaSpecService;
|
||||
import org.jeecg.modules.xslmes.service.IMesXslFormulaSpecSettingService;
|
||||
import org.jeecg.modules.xslmes.service.IMesXslMixerMaterialKindCfgService;
|
||||
import org.jeecg.modules.xslmes.service.IMesXslMixingSpecService;
|
||||
import org.jeecg.modules.xslmes.vo.MesXslMixerMaterialKindLookupVO;
|
||||
import org.jeecg.modules.xslmes.vo.MesXslFormulaMixingGenerateMachineVO;
|
||||
import org.jeecg.modules.xslmes.vo.MesXslFormulaMixingGeneratePreviewItemVO;
|
||||
import org.jeecg.modules.xslmes.vo.MesXslFormulaMixingGeneratePreviewVO;
|
||||
@@ -90,6 +92,9 @@ public class MesXslFormulaSpecServiceImpl extends ServiceImpl<MesXslFormulaSpecM
|
||||
@Resource
|
||||
private ISysCategoryService sysCategoryService;
|
||||
|
||||
@Resource
|
||||
private IMesXslMixerMaterialKindCfgService mesXslMixerMaterialKindCfgService;
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void saveMain(MesXslFormulaSpec main, List<MesXslFormulaSpecLine> lineList) {
|
||||
@@ -528,7 +533,9 @@ public class MesXslFormulaSpecServiceImpl extends ServiceImpl<MesXslFormulaSpecM
|
||||
}
|
||||
Map<String, MesMixerMaterial> mixerCache = new HashMap<>();
|
||||
Map<String, String> categoryNameCache = new HashMap<>();
|
||||
Map<String, Boolean> categoryRubberCache = new HashMap<>();
|
||||
//update-begin---author:cursor ---date:20260525 for:【XSLMES-20260525-A52】生成混炼示方种类改读密炼物料种类配置-----------
|
||||
MesXslMixerMaterialKindLookupVO kindLookup = mesXslMixerMaterialKindCfgService.loadKindLookup(null);
|
||||
//update-end---author:cursor ---date:20260525 for:【XSLMES-20260525-A52】生成混炼示方种类改读密炼物料种类配置-----------
|
||||
Map<String, MesXslEquipmentLedger> equipmentCache = new HashMap<>();
|
||||
//update-begin---author:cursor ---date:20260525 for:【XSLMES-20260525-A44】F段终炼胶比重按配合示方整体PHR/体积汇总-----------
|
||||
BigDecimal compoundSpecificGravity = resolveCompoundSpecificGravity(formula, lines);
|
||||
@@ -555,7 +562,7 @@ public class MesXslFormulaSpecServiceImpl extends ServiceImpl<MesXslFormulaSpecM
|
||||
String materialStep = resolveMixingMaterialStep(row);
|
||||
int mixingColumn = resolveMixingColumn(row, formula);
|
||||
List<MesXslMixingSpecMaterial> materials = buildMixingMaterials(
|
||||
formula, lines, mixingColumn, materialStep, mixerCache, categoryNameCache, categoryRubberCache);
|
||||
formula, lines, mixingColumn, materialStep, mixerCache, categoryNameCache, kindLookup);
|
||||
for (MesXslFormulaMixingGenerateMachineVO machine : row.getMachines()) {
|
||||
if (machine == null || oConvertUtils.isEmpty(machine.getMachineId())) {
|
||||
continue;
|
||||
@@ -928,7 +935,7 @@ public class MesXslFormulaSpecServiceImpl extends ServiceImpl<MesXslFormulaSpecM
|
||||
String materialStep,
|
||||
Map<String, MesMixerMaterial> mixerCache,
|
||||
Map<String, String> categoryNameCache,
|
||||
Map<String, Boolean> categoryRubberCache) {
|
||||
MesXslMixerMaterialKindLookupVO kindLookup) {
|
||||
String stepFilter = StringUtils.isNotBlank(materialStep) ? materialStep.trim().toUpperCase() : "A";
|
||||
List<MesXslMixingSpecMaterial> materials = new ArrayList<>();
|
||||
int sort = 0;
|
||||
@@ -940,9 +947,9 @@ public class MesXslFormulaSpecServiceImpl extends ServiceImpl<MesXslFormulaSpecM
|
||||
if (lastBSegment > 0) {
|
||||
String motherSpecCode = appendFormulaCodeSuffix("B" + lastBSegment + rubberName, codeSuffix);
|
||||
BigDecimal motherWeight = resolveStageCumulativeTotal(formula, lines, lastBSegment);
|
||||
materials.add(createMotherRubberMaterial(motherSpecCode, rubberName, motherWeight, materials.size()));
|
||||
materials.add(createMotherRubberMaterial(motherSpecCode, rubberName, motherWeight, materials.size(), kindLookup));
|
||||
}
|
||||
appendQStageColumnAgents(lines, stageIndex, materials, mixerCache, categoryNameCache, categoryRubberCache);
|
||||
appendQStageColumnAgents(lines, stageIndex, materials, mixerCache, categoryNameCache, kindLookup);
|
||||
reindexMaterialSortNo(materials);
|
||||
return materials;
|
||||
//update-end---author:cursor ---date:20260522 for:【XSLMES-20260522-A38】F段加入最后一段B炼好胶料一条再加Q配合剂-----------
|
||||
@@ -951,7 +958,7 @@ public class MesXslFormulaSpecServiceImpl extends ServiceImpl<MesXslFormulaSpecM
|
||||
String rubberName = resolveRubberName(formula);
|
||||
String codeSuffix = resolveFormulaCodeSuffix(formula);
|
||||
if (bColumn <= 1) {
|
||||
appendBStageColumnAgents(lines, 1, materials, mixerCache, categoryNameCache, categoryRubberCache);
|
||||
appendBStageColumnAgents(lines, 1, materials, mixerCache, categoryNameCache, kindLookup);
|
||||
reindexMaterialSortNo(materials);
|
||||
return materials;
|
||||
}
|
||||
@@ -959,8 +966,8 @@ public class MesXslFormulaSpecServiceImpl extends ServiceImpl<MesXslFormulaSpecM
|
||||
int prevB = bColumn - 1;
|
||||
String motherSpecCode = appendFormulaCodeSuffix("B" + prevB + rubberName, codeSuffix);
|
||||
BigDecimal motherWeight = resolveStageCumulativeTotal(formula, lines, prevB);
|
||||
materials.add(createMotherRubberMaterial(motherSpecCode, rubberName, motherWeight, materials.size()));
|
||||
appendBStageColumnAgents(lines, bColumn, materials, mixerCache, categoryNameCache, categoryRubberCache);
|
||||
materials.add(createMotherRubberMaterial(motherSpecCode, rubberName, motherWeight, materials.size(), kindLookup));
|
||||
appendBStageColumnAgents(lines, bColumn, materials, mixerCache, categoryNameCache, kindLookup);
|
||||
reindexMaterialSortNo(materials);
|
||||
return materials;
|
||||
}
|
||||
@@ -981,7 +988,7 @@ public class MesXslFormulaSpecServiceImpl extends ServiceImpl<MesXslFormulaSpecM
|
||||
List<MesXslMixingSpecMaterial> materials,
|
||||
Map<String, MesMixerMaterial> mixerCache,
|
||||
Map<String, String> categoryNameCache,
|
||||
Map<String, Boolean> categoryRubberCache) {
|
||||
MesXslMixerMaterialKindLookupVO kindLookup) {
|
||||
for (MesXslFormulaSpecLine line : lines) {
|
||||
if (!isLineStep(line, "Q")) {
|
||||
continue;
|
||||
@@ -991,7 +998,7 @@ public class MesXslFormulaSpecServiceImpl extends ServiceImpl<MesXslFormulaSpecM
|
||||
continue;
|
||||
}
|
||||
materials.add(
|
||||
toMixingMaterial(line, unitWeight, materials.size(), mixerCache, categoryNameCache, categoryRubberCache));
|
||||
toMixingMaterial(line, unitWeight, materials.size(), mixerCache, categoryNameCache, kindLookup));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1002,7 +1009,7 @@ public class MesXslFormulaSpecServiceImpl extends ServiceImpl<MesXslFormulaSpecM
|
||||
List<MesXslMixingSpecMaterial> materials,
|
||||
Map<String, MesMixerMaterial> mixerCache,
|
||||
Map<String, String> categoryNameCache,
|
||||
Map<String, Boolean> categoryRubberCache) {
|
||||
MesXslMixerMaterialKindLookupVO kindLookup) {
|
||||
for (MesXslFormulaSpecLine line : lines) {
|
||||
if (!isLineStep(line, "A")) {
|
||||
continue;
|
||||
@@ -1012,18 +1019,26 @@ public class MesXslFormulaSpecServiceImpl extends ServiceImpl<MesXslFormulaSpecM
|
||||
continue;
|
||||
}
|
||||
materials.add(
|
||||
toMixingMaterial(line, unitWeight, materials.size(), mixerCache, categoryNameCache, categoryRubberCache));
|
||||
toMixingMaterial(line, unitWeight, materials.size(), mixerCache, categoryNameCache, kindLookup));
|
||||
}
|
||||
}
|
||||
|
||||
/** 上一段密炼产出胶料(一条):示方编号 B{n-1}+胶料名,种类=胶料 */
|
||||
/** 上一段密炼产出胶料(一条):示方编号 B{n-1}+胶料名,种类读配置表 */
|
||||
private MesXslMixingSpecMaterial createMotherRubberMaterial(
|
||||
String motherSpecCode, String rubberName, BigDecimal unitWeight, int sortNo) {
|
||||
String motherSpecCode,
|
||||
String rubberName,
|
||||
BigDecimal unitWeight,
|
||||
int sortNo,
|
||||
MesXslMixerMaterialKindLookupVO kindLookup) {
|
||||
MesXslMixingSpecMaterial material = new MesXslMixingSpecMaterial();
|
||||
material.setSortNo(sortNo);
|
||||
material.setMixerMaterialName(motherSpecCode);
|
||||
material.setMixerMaterialDesc(StringUtils.isNotBlank(rubberName) ? rubberName : motherSpecCode);
|
||||
material.setMaterialKind("胶料");
|
||||
String rubberKind =
|
||||
kindLookup != null && StringUtils.isNotBlank(kindLookup.getRubberKindName())
|
||||
? kindLookup.getRubberKindName()
|
||||
: "胶料";
|
||||
material.setMaterialKind(rubberKind);
|
||||
material.setUnitWeight(unitWeight);
|
||||
return material;
|
||||
}
|
||||
@@ -1103,14 +1118,14 @@ public class MesXslFormulaSpecServiceImpl extends ServiceImpl<MesXslFormulaSpecM
|
||||
int sortNo,
|
||||
Map<String, MesMixerMaterial> mixerCache,
|
||||
Map<String, String> categoryNameCache,
|
||||
Map<String, Boolean> categoryRubberCache) {
|
||||
MesXslMixerMaterialKindLookupVO kindLookup) {
|
||||
MesXslMixingSpecMaterial material = new MesXslMixingSpecMaterial();
|
||||
material.setSortNo(sortNo);
|
||||
material.setMixerMaterialName(line.getMixerMaterialName());
|
||||
material.setMixerMaterialDesc(
|
||||
StringUtils.isNotBlank(line.getMaterialDesc()) ? line.getMaterialDesc() : line.getMixerMaterialName());
|
||||
material.setUnitWeight(unitWeight);
|
||||
fillMaterialCategory(material, line.getMixerMaterialId(), line, mixerCache, categoryNameCache, categoryRubberCache);
|
||||
fillMaterialCategory(material, line.getMixerMaterialId(), line, mixerCache, categoryNameCache, kindLookup);
|
||||
return material;
|
||||
}
|
||||
|
||||
@@ -1136,7 +1151,7 @@ public class MesXslFormulaSpecServiceImpl extends ServiceImpl<MesXslFormulaSpecM
|
||||
MesXslFormulaSpecLine line,
|
||||
Map<String, MesMixerMaterial> mixerCache,
|
||||
Map<String, String> categoryNameCache,
|
||||
Map<String, Boolean> categoryRubberCache) {
|
||||
MesXslMixerMaterialKindLookupVO kindLookup) {
|
||||
if (oConvertUtils.isEmpty(mixerMaterialId)) {
|
||||
return;
|
||||
}
|
||||
@@ -1149,58 +1164,11 @@ public class MesXslFormulaSpecServiceImpl extends ServiceImpl<MesXslFormulaSpecM
|
||||
String minorName = resolveCategoryName(mixer.getMinorCategoryId(), categoryNameCache);
|
||||
material.setMaterialMajor(majorName);
|
||||
material.setMaterialMinor(minorName);
|
||||
//update-begin---author:cursor ---date:20260525 for:【XSLMES-20260525-A50】生成混炼示方时称量方式优先映射种类-----------
|
||||
//update-begin---author:cursor ---date:20260525 for:【XSLMES-20260525-A52】生成混炼示方种类改读密炼物料种类配置-----------
|
||||
material.setMaterialKind(
|
||||
resolveMixingMaterialKind(weighMode, mixer.getMinorCategoryId(), minorName, categoryRubberCache));
|
||||
//update-end---author:cursor ---date:20260525 for:【XSLMES-20260525-A50】生成混炼示方时称量方式优先映射种类-----------
|
||||
}
|
||||
|
||||
//update-begin---author:cursor ---date:20260525 for:【XSLMES-20260525-A50】生成混炼示方时称量方式优先映射种类-----------
|
||||
/**
|
||||
* 种类:配合示方称量方式优先;否则物料小类勾选「胶料」则显示「胶料」,否则显示小类名称。
|
||||
*/
|
||||
private String resolveMixingMaterialKind(
|
||||
String weighMode, String minorCategoryId, String minorCategoryName, Map<String, Boolean> categoryRubberCache) {
|
||||
String weighKind = resolveWeighModeMaterialKind(weighMode);
|
||||
if (StringUtils.isNotBlank(weighKind)) {
|
||||
return weighKind;
|
||||
}
|
||||
if (isCategoryRubber(minorCategoryId, categoryRubberCache)) {
|
||||
return "胶料";
|
||||
}
|
||||
if (StringUtils.isNotBlank(minorCategoryName)) {
|
||||
return minorCategoryName;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/** 配合示方自动/人工称量 -> 混炼示方种类 */
|
||||
private String resolveWeighModeMaterialKind(String weighMode) {
|
||||
if (StringUtils.isBlank(weighMode)) {
|
||||
return null;
|
||||
}
|
||||
String normalized = weighMode.trim();
|
||||
String lower = normalized.toLowerCase();
|
||||
if (lower.startsWith("auto") || normalized.contains("自动")) {
|
||||
return "自动";
|
||||
}
|
||||
if ("manual".equals(lower) || normalized.contains("人工")) {
|
||||
return "人工";
|
||||
}
|
||||
return null;
|
||||
}
|
||||
//update-end---author:cursor ---date:20260525 for:【XSLMES-20260525-A50】生成混炼示方时称量方式优先映射种类-----------
|
||||
|
||||
private boolean isCategoryRubber(String categoryId, Map<String, Boolean> cache) {
|
||||
if (oConvertUtils.isEmpty(categoryId)) {
|
||||
return false;
|
||||
}
|
||||
return Boolean.TRUE.equals(cache.computeIfAbsent(categoryId, this::loadCategoryIsRubber));
|
||||
}
|
||||
|
||||
private Boolean loadCategoryIsRubber(String categoryId) {
|
||||
SysCategory category = sysCategoryService.getById(categoryId);
|
||||
return category != null && "1".equals(category.getIsRubber());
|
||||
mesXslMixerMaterialKindCfgService.resolveMixingMaterialKind(
|
||||
kindLookup, mixer.getMinorCategoryId(), weighMode, minorName));
|
||||
//update-end---author:cursor ---date:20260525 for:【XSLMES-20260525-A52】生成混炼示方种类改读密炼物料种类配置-----------
|
||||
}
|
||||
|
||||
private String resolveCategoryName(String categoryId, Map<String, String> cache) {
|
||||
|
||||
@@ -7,7 +7,9 @@ import java.util.ArrayDeque;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Deque;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import org.jeecg.common.constant.CommonConstant;
|
||||
import org.jeecg.common.exception.JeecgBootException;
|
||||
@@ -25,6 +27,8 @@ import org.jeecg.modules.system.service.ISysDictService;
|
||||
import org.jeecg.modules.xslmes.entity.MesXslMixerMaterialKindCfg;
|
||||
import org.jeecg.modules.xslmes.mapper.MesXslMixerMaterialKindCfgMapper;
|
||||
import org.jeecg.modules.xslmes.service.IMesXslMixerMaterialKindCfgService;
|
||||
import org.jeecg.modules.xslmes.vo.MesXslMixerMaterialKindLookupVO;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@@ -295,4 +299,109 @@ public class MesXslMixerMaterialKindCfgServiceImpl
|
||||
}
|
||||
}
|
||||
//update-end---author:cursor ---date:20260525 for:【XSLMES-20260525-A51】密炼物料种类配置展开与批量保存-----------
|
||||
|
||||
//update-begin---author:cursor ---date:20260525 for:【XSLMES-20260525-A52】密炼物料种类配置关联解析-----------
|
||||
private static final String DEFAULT_RUBBER_KIND_NAME = "胶料";
|
||||
|
||||
@Override
|
||||
public MesXslMixerMaterialKindLookupVO loadKindLookup(Integer tenantId) {
|
||||
LambdaQueryWrapper<MesXslMixerMaterialKindCfg> qw = new LambdaQueryWrapper<>();
|
||||
qw.and(q -> q.eq(MesXslMixerMaterialKindCfg::getDelFlag, CommonConstant.DEL_FLAG_0).or().isNull(MesXslMixerMaterialKindCfg::getDelFlag));
|
||||
Integer resolvedTenantId = resolveTenantId(tenantId);
|
||||
if (resolvedTenantId != null && MybatisPlusSaasConfig.OPEN_SYSTEM_TENANT_CONTROL) {
|
||||
qw.eq(MesXslMixerMaterialKindCfg::getTenantId, resolvedTenantId);
|
||||
}
|
||||
qw.orderByAsc(MesXslMixerMaterialKindCfg::getPriority).orderByAsc(MesXslMixerMaterialKindCfg::getKindKey);
|
||||
List<MesXslMixerMaterialKindCfg> rows = list(qw);
|
||||
|
||||
MesXslMixerMaterialKindLookupVO lookup = new MesXslMixerMaterialKindLookupVO();
|
||||
Map<String, String> byRefId = new LinkedHashMap<>();
|
||||
Map<String, String> byRefCode = new LinkedHashMap<>();
|
||||
String rubberKindName = null;
|
||||
if (rows != null) {
|
||||
for (MesXslMixerMaterialKindCfg row : rows) {
|
||||
if (row == null || oConvertUtils.isEmpty(row.getKindName())) {
|
||||
continue;
|
||||
}
|
||||
String kindName = row.getKindName().trim();
|
||||
if (oConvertUtils.isNotEmpty(row.getCategoryRefId()) && !byRefId.containsKey(row.getCategoryRefId().trim())) {
|
||||
byRefId.put(row.getCategoryRefId().trim(), kindName);
|
||||
}
|
||||
if (oConvertUtils.isNotEmpty(row.getCategoryRefCode())) {
|
||||
String refCode = row.getCategoryRefCode().trim();
|
||||
if (!byRefCode.containsKey(refCode)) {
|
||||
byRefCode.put(refCode, kindName);
|
||||
}
|
||||
String lowerCode = refCode.toLowerCase();
|
||||
if (!lowerCode.equals(refCode) && !byRefCode.containsKey(lowerCode)) {
|
||||
byRefCode.put(lowerCode, kindName);
|
||||
}
|
||||
}
|
||||
if (rubberKindName == null && DEFAULT_RUBBER_KIND_NAME.equals(kindName)) {
|
||||
rubberKindName = kindName;
|
||||
}
|
||||
}
|
||||
}
|
||||
lookup.setByRefId(byRefId);
|
||||
lookup.setByRefCode(byRefCode);
|
||||
lookup.setRubberKindName(oConvertUtils.isNotEmpty(rubberKindName) ? rubberKindName : DEFAULT_RUBBER_KIND_NAME);
|
||||
return lookup;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String resolveMixingMaterialKind(
|
||||
MesXslMixerMaterialKindLookupVO lookup,
|
||||
String minorCategoryId,
|
||||
String weighMode,
|
||||
String minorCategoryName) {
|
||||
if (lookup == null) {
|
||||
lookup = loadKindLookup(null);
|
||||
}
|
||||
if (oConvertUtils.isNotEmpty(weighMode)) {
|
||||
String fromWeighMode = matchKindFromLookup(lookup, weighMode.trim());
|
||||
if (oConvertUtils.isNotEmpty(fromWeighMode)) {
|
||||
return fromWeighMode;
|
||||
}
|
||||
}
|
||||
if (oConvertUtils.isNotEmpty(minorCategoryId)) {
|
||||
String fromMinor = matchKindFromLookup(lookup, minorCategoryId.trim());
|
||||
if (oConvertUtils.isNotEmpty(fromMinor)) {
|
||||
return fromMinor;
|
||||
}
|
||||
}
|
||||
if (oConvertUtils.isNotEmpty(minorCategoryName)) {
|
||||
return minorCategoryName.trim();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private String matchKindFromLookup(MesXslMixerMaterialKindLookupVO lookup, String key) {
|
||||
if (lookup == null || oConvertUtils.isEmpty(key)) {
|
||||
return null;
|
||||
}
|
||||
Map<String, String> byRefId = lookup.getByRefId();
|
||||
if (byRefId != null && byRefId.containsKey(key)) {
|
||||
return byRefId.get(key);
|
||||
}
|
||||
Map<String, String> byRefCode = lookup.getByRefCode();
|
||||
if (byRefCode == null || byRefCode.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
if (byRefCode.containsKey(key)) {
|
||||
return byRefCode.get(key);
|
||||
}
|
||||
String lower = key.toLowerCase();
|
||||
if (byRefCode.containsKey(lower)) {
|
||||
return byRefCode.get(lower);
|
||||
}
|
||||
if (StringUtils.isNotBlank(key)) {
|
||||
for (Map.Entry<String, String> entry : byRefCode.entrySet()) {
|
||||
if (entry.getKey() != null && key.contains(entry.getKey())) {
|
||||
return entry.getValue();
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
//update-end---author:cursor ---date:20260525 for:【XSLMES-20260525-A52】密炼物料种类配置关联解析-----------
|
||||
}
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
package org.jeecg.modules.xslmes.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import java.io.Serializable;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 密炼物料种类配置查找表(按对应分类/字典项关联)
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "密炼物料种类配置查找表")
|
||||
public class MesXslMixerMaterialKindLookupVO implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Schema(description = "对应分类/字典项ID -> 种类名称")
|
||||
private Map<String, String> byRefId = new LinkedHashMap<>();
|
||||
|
||||
@Schema(description = "对应分类/字典项编码 -> 种类名称")
|
||||
private Map<String, String> byRefCode = new LinkedHashMap<>();
|
||||
|
||||
@Schema(description = "胶料种类名称(母炼胶行兜底)")
|
||||
private String rubberKindName;
|
||||
}
|
||||
Reference in New Issue
Block a user