优化混炼示方
This commit is contained in:
@@ -315,3 +315,19 @@ jeecgboot-vue3/src/views/xslmes/mesXslMixingSpec/MesXslMixingSpec.data.ts
|
|||||||
jeecgboot-vue3/src/views/xslmes/mesXslMixingSpec/components/MesXslMixingSpecModal.vue
|
jeecgboot-vue3/src/views/xslmes/mesXslMixingSpec/components/MesXslMixingSpecModal.vue
|
||||||
jeecgboot-vue3/src/views/xslmes/mesXslMixingSpec/components/MesXslMixingMaterialSelectModal.vue
|
jeecgboot-vue3/src/views/xslmes/mesXslMixingSpec/components/MesXslMixingMaterialSelectModal.vue
|
||||||
jeecgboot-vue3/src/views/xslmes/mesXslMixerMaterialKindCfg/MesXslMixerMaterialKindCfgList.vue
|
jeecgboot-vue3/src/views/xslmes/mesXslMixerMaterialKindCfg/MesXslMixerMaterialKindCfgList.vue
|
||||||
|
|
||||||
|
-- author:cursor---date:20260525--for: 【XSLMES-20260525-A54】母炼胶明细行绑定已同步密炼物料主数据及种类配置解析 -----------
|
||||||
|
jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/impl/MesXslFormulaSpecServiceImpl.java
|
||||||
|
|
||||||
|
-- author:cursor---date:20260525--for: 【XSLMES-20260525-A55】混炼示方明细新增密炼物料ID字段 -----------
|
||||||
|
jeecg-module-system/jeecg-system-start/src/main/resources/flyway/sql/mysql/V3.9.2_104__mes_xsl_mixing_spec_material_mixer_material_id.sql
|
||||||
|
jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/entity/MesXslMixingSpecMaterial.java
|
||||||
|
jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/impl/MesXslFormulaSpecServiceImpl.java
|
||||||
|
jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/impl/MesXslMixingSpecServiceImpl.java
|
||||||
|
jeecgboot-vue3/src/views/xslmes/mesXslMixingSpec/MesXslMixingSpec.data.ts
|
||||||
|
|
||||||
|
-- author:cursor---date:20260525--for: 【XSLMES-20260525-A56】混炼示方批量删除性能优化(子表批量删+去重同步删密炼物料) -----------
|
||||||
|
jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/impl/MesXslMixingSpecServiceImpl.java
|
||||||
|
|
||||||
|
-- author:cursor---date:20260525--for: 【XSLMES-20260525-A57】混合步骤动作/组合下拉最多展示20条 -----------
|
||||||
|
jeecgboot-vue3/src/views/xslmes/mesXslMixingSpec/components/MesXslMixingStepSelectCell.vue
|
||||||
|
|||||||
@@ -40,6 +40,11 @@ public class MesXslMixingSpecMaterial implements Serializable {
|
|||||||
@Schema(description = "种类")
|
@Schema(description = "种类")
|
||||||
private String materialKind;
|
private String materialKind;
|
||||||
|
|
||||||
|
//update-begin---author:cursor ---date:20260525 for:【XSLMES-20260525-A55】混炼示方明细关联密炼物料ID-----------
|
||||||
|
@Schema(description = "密炼物料ID(关联mes_mixer_material.id)")
|
||||||
|
private String mixerMaterialId;
|
||||||
|
//update-end---author:cursor ---date:20260525 for:【XSLMES-20260525-A55】混炼示方明细关联密炼物料ID-----------
|
||||||
|
|
||||||
@Schema(description = "密炼物料名称")
|
@Schema(description = "密炼物料名称")
|
||||||
private String mixerMaterialName;
|
private String mixerMaterialName;
|
||||||
|
|
||||||
|
|||||||
@@ -562,7 +562,15 @@ public class MesXslFormulaSpecServiceImpl extends ServiceImpl<MesXslFormulaSpecM
|
|||||||
String materialStep = resolveMixingMaterialStep(row);
|
String materialStep = resolveMixingMaterialStep(row);
|
||||||
int mixingColumn = resolveMixingColumn(row, formula);
|
int mixingColumn = resolveMixingColumn(row, formula);
|
||||||
List<MesXslMixingSpecMaterial> materials = buildMixingMaterials(
|
List<MesXslMixingSpecMaterial> materials = buildMixingMaterials(
|
||||||
formula, lines, mixingColumn, materialStep, mixerCache, categoryNameCache, kindLookup);
|
formula,
|
||||||
|
lines,
|
||||||
|
mixingColumn,
|
||||||
|
materialStep,
|
||||||
|
mixerCache,
|
||||||
|
categoryNameCache,
|
||||||
|
kindLookup,
|
||||||
|
compoundSpecificGravity,
|
||||||
|
categoryIdCache);
|
||||||
for (MesXslFormulaMixingGenerateMachineVO machine : row.getMachines()) {
|
for (MesXslFormulaMixingGenerateMachineVO machine : row.getMachines()) {
|
||||||
if (machine == null || oConvertUtils.isEmpty(machine.getMachineId())) {
|
if (machine == null || oConvertUtils.isEmpty(machine.getMachineId())) {
|
||||||
continue;
|
continue;
|
||||||
@@ -935,7 +943,9 @@ public class MesXslFormulaSpecServiceImpl extends ServiceImpl<MesXslFormulaSpecM
|
|||||||
String materialStep,
|
String materialStep,
|
||||||
Map<String, MesMixerMaterial> mixerCache,
|
Map<String, MesMixerMaterial> mixerCache,
|
||||||
Map<String, String> categoryNameCache,
|
Map<String, String> categoryNameCache,
|
||||||
MesXslMixerMaterialKindLookupVO kindLookup) {
|
MesXslMixerMaterialKindLookupVO kindLookup,
|
||||||
|
BigDecimal compoundSpecificGravity,
|
||||||
|
Map<String, String> categoryIdCache) {
|
||||||
String stepFilter = StringUtils.isNotBlank(materialStep) ? materialStep.trim().toUpperCase() : "A";
|
String stepFilter = StringUtils.isNotBlank(materialStep) ? materialStep.trim().toUpperCase() : "A";
|
||||||
List<MesXslMixingSpecMaterial> materials = new ArrayList<>();
|
List<MesXslMixingSpecMaterial> materials = new ArrayList<>();
|
||||||
int sort = 0;
|
int sort = 0;
|
||||||
@@ -947,7 +957,17 @@ public class MesXslFormulaSpecServiceImpl extends ServiceImpl<MesXslFormulaSpecM
|
|||||||
if (lastBSegment > 0) {
|
if (lastBSegment > 0) {
|
||||||
String motherSpecCode = appendFormulaCodeSuffix("B" + lastBSegment + rubberName, codeSuffix);
|
String motherSpecCode = appendFormulaCodeSuffix("B" + lastBSegment + rubberName, codeSuffix);
|
||||||
BigDecimal motherWeight = resolveStageCumulativeTotal(formula, lines, lastBSegment);
|
BigDecimal motherWeight = resolveStageCumulativeTotal(formula, lines, lastBSegment);
|
||||||
materials.add(createMotherRubberMaterial(motherSpecCode, rubberName, motherWeight, materials.size(), kindLookup));
|
materials.add(
|
||||||
|
createMotherRubberMaterial(
|
||||||
|
motherSpecCode,
|
||||||
|
motherWeight,
|
||||||
|
materials.size(),
|
||||||
|
formula,
|
||||||
|
compoundSpecificGravity,
|
||||||
|
categoryIdCache,
|
||||||
|
mixerCache,
|
||||||
|
categoryNameCache,
|
||||||
|
kindLookup));
|
||||||
}
|
}
|
||||||
appendQStageColumnAgents(lines, stageIndex, materials, mixerCache, categoryNameCache, kindLookup);
|
appendQStageColumnAgents(lines, stageIndex, materials, mixerCache, categoryNameCache, kindLookup);
|
||||||
reindexMaterialSortNo(materials);
|
reindexMaterialSortNo(materials);
|
||||||
@@ -966,7 +986,17 @@ public class MesXslFormulaSpecServiceImpl extends ServiceImpl<MesXslFormulaSpecM
|
|||||||
int prevB = bColumn - 1;
|
int prevB = bColumn - 1;
|
||||||
String motherSpecCode = appendFormulaCodeSuffix("B" + prevB + rubberName, codeSuffix);
|
String motherSpecCode = appendFormulaCodeSuffix("B" + prevB + rubberName, codeSuffix);
|
||||||
BigDecimal motherWeight = resolveStageCumulativeTotal(formula, lines, prevB);
|
BigDecimal motherWeight = resolveStageCumulativeTotal(formula, lines, prevB);
|
||||||
materials.add(createMotherRubberMaterial(motherSpecCode, rubberName, motherWeight, materials.size(), kindLookup));
|
materials.add(
|
||||||
|
createMotherRubberMaterial(
|
||||||
|
motherSpecCode,
|
||||||
|
motherWeight,
|
||||||
|
materials.size(),
|
||||||
|
formula,
|
||||||
|
compoundSpecificGravity,
|
||||||
|
categoryIdCache,
|
||||||
|
mixerCache,
|
||||||
|
categoryNameCache,
|
||||||
|
kindLookup));
|
||||||
appendBStageColumnAgents(lines, bColumn, materials, mixerCache, categoryNameCache, kindLookup);
|
appendBStageColumnAgents(lines, bColumn, materials, mixerCache, categoryNameCache, kindLookup);
|
||||||
reindexMaterialSortNo(materials);
|
reindexMaterialSortNo(materials);
|
||||||
return materials;
|
return materials;
|
||||||
@@ -1023,25 +1053,102 @@ public class MesXslFormulaSpecServiceImpl extends ServiceImpl<MesXslFormulaSpecM
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 上一段密炼产出胶料(一条):示方编号 B{n-1}+胶料名,种类读配置表 */
|
//update-begin---author:cursor ---date:20260525 for:【XSLMES-20260525-A54】母炼胶明细行绑定已同步密炼物料主数据-----------
|
||||||
|
/**
|
||||||
|
* 上一段密炼产出胶料(一条):示方编号 B{n-1}+胶料名。
|
||||||
|
* 先确保对应密炼物料主数据存在,再按主数据回填明细(种类走配置表 + 小类 ID)。
|
||||||
|
*/
|
||||||
private MesXslMixingSpecMaterial createMotherRubberMaterial(
|
private MesXslMixingSpecMaterial createMotherRubberMaterial(
|
||||||
String motherSpecCode,
|
String motherSpecCode,
|
||||||
String rubberName,
|
|
||||||
BigDecimal unitWeight,
|
BigDecimal unitWeight,
|
||||||
int sortNo,
|
int sortNo,
|
||||||
|
MesXslFormulaSpec formula,
|
||||||
|
BigDecimal compoundSpecificGravity,
|
||||||
|
Map<String, String> categoryIdCache,
|
||||||
|
Map<String, MesMixerMaterial> mixerCache,
|
||||||
|
Map<String, String> categoryNameCache,
|
||||||
MesXslMixerMaterialKindLookupVO kindLookup) {
|
MesXslMixerMaterialKindLookupVO kindLookup) {
|
||||||
|
ensureMotherRubberMixerMaterialSynced(motherSpecCode, formula, compoundSpecificGravity, categoryIdCache);
|
||||||
MesXslMixingSpecMaterial material = new MesXslMixingSpecMaterial();
|
MesXslMixingSpecMaterial material = new MesXslMixingSpecMaterial();
|
||||||
material.setSortNo(sortNo);
|
material.setSortNo(sortNo);
|
||||||
material.setMixerMaterialName(motherSpecCode);
|
|
||||||
material.setMixerMaterialDesc(StringUtils.isNotBlank(rubberName) ? rubberName : motherSpecCode);
|
|
||||||
String rubberKind =
|
|
||||||
kindLookup != null && StringUtils.isNotBlank(kindLookup.getRubberKindName())
|
|
||||||
? kindLookup.getRubberKindName()
|
|
||||||
: "胶料";
|
|
||||||
material.setMaterialKind(rubberKind);
|
|
||||||
material.setUnitWeight(unitWeight);
|
material.setUnitWeight(unitWeight);
|
||||||
|
MesMixerMaterial mixer = findMixerMaterialByCodeOrName(motherSpecCode.trim());
|
||||||
|
if (mixer != null) {
|
||||||
|
fillMixingMaterialFromMixerMaterial(material, mixer, null, mixerCache, categoryNameCache, kindLookup);
|
||||||
return material;
|
return material;
|
||||||
}
|
}
|
||||||
|
log.warn("[混炼示方生成] 未找到上一段密炼物料 {},明细行回退为示方编号展示", motherSpecCode);
|
||||||
|
material.setMixerMaterialName(motherSpecCode);
|
||||||
|
material.setMixerMaterialDesc(motherSpecCode);
|
||||||
|
fillMotherRubberCategoryFallback(material, categoryIdCache, categoryNameCache, kindLookup);
|
||||||
|
return material;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 上一段 B 段胶尚未写入主数据时,按母炼胶/A胶分类补建一条密炼物料 */
|
||||||
|
private void ensureMotherRubberMixerMaterialSynced(
|
||||||
|
String motherSpecCode,
|
||||||
|
MesXslFormulaSpec formula,
|
||||||
|
BigDecimal compoundSpecificGravity,
|
||||||
|
Map<String, String> categoryIdCache) {
|
||||||
|
if (StringUtils.isBlank(motherSpecCode)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
String normalized = motherSpecCode.trim();
|
||||||
|
if (findMixerMaterialByCodeOrName(normalized) != null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
MesXslFormulaMixingGenerateRowVO stub = new MesXslFormulaMixingGenerateRowVO();
|
||||||
|
stub.setSpecCode(normalized);
|
||||||
|
stub.setStepType("A");
|
||||||
|
syncGeneratedRubberMixerMaterial(stub, formula, compoundSpecificGravity, categoryIdCache);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 按密炼物料主数据回填混炼示方明细行(名称/大小类/种类) */
|
||||||
|
private void fillMixingMaterialFromMixerMaterial(
|
||||||
|
MesXslMixingSpecMaterial material,
|
||||||
|
MesMixerMaterial mixer,
|
||||||
|
String weighMode,
|
||||||
|
Map<String, MesMixerMaterial> mixerCache,
|
||||||
|
Map<String, String> categoryNameCache,
|
||||||
|
MesXslMixerMaterialKindLookupVO kindLookup) {
|
||||||
|
if (material == null || mixer == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
String displayName =
|
||||||
|
StringUtils.isNotBlank(mixer.getMaterialName()) ? mixer.getMaterialName() : mixer.getMaterialCode();
|
||||||
|
material.setMixerMaterialName(displayName);
|
||||||
|
material.setMixerMaterialDesc(
|
||||||
|
StringUtils.isNotBlank(mixer.getMaterialDesc()) ? mixer.getMaterialDesc() : displayName);
|
||||||
|
String majorName = resolveCategoryName(mixer.getMajorCategoryId(), categoryNameCache);
|
||||||
|
String minorName = resolveCategoryName(mixer.getMinorCategoryId(), categoryNameCache);
|
||||||
|
material.setMaterialMajor(majorName);
|
||||||
|
material.setMaterialMinor(minorName);
|
||||||
|
//update-begin---author:cursor ---date:20260525 for:【XSLMES-20260525-A55】混炼示方明细回填密炼物料ID-----------
|
||||||
|
material.setMixerMaterialId(mixer.getId());
|
||||||
|
//update-end---author:cursor ---date:20260525 for:【XSLMES-20260525-A55】混炼示方明细回填密炼物料ID-----------
|
||||||
|
material.setMaterialKind(
|
||||||
|
mesXslMixerMaterialKindCfgService.resolveMixingMaterialKind(
|
||||||
|
kindLookup, mixer.getMinorCategoryId(), weighMode, minorName));
|
||||||
|
if (mixerCache != null && StringUtils.isNotBlank(mixer.getId())) {
|
||||||
|
mixerCache.put(mixer.getId(), mixer);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 未查到密炼物料时,按母炼胶/A胶分类从配置表解析种类 */
|
||||||
|
private void fillMotherRubberCategoryFallback(
|
||||||
|
MesXslMixingSpecMaterial material,
|
||||||
|
Map<String, String> categoryIdCache,
|
||||||
|
Map<String, String> 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));
|
||||||
|
material.setMaterialKind(
|
||||||
|
mesXslMixerMaterialKindCfgService.resolveMixingMaterialKind(
|
||||||
|
kindLookup, minorCategoryId, null, material.getMaterialMinor()));
|
||||||
|
}
|
||||||
|
//update-end---author:cursor ---date:20260525 for:【XSLMES-20260525-A54】母炼胶明细行绑定已同步密炼物料主数据-----------
|
||||||
|
|
||||||
/** 混合段累计合计:优先主表 stageNTotal,否则按明细该列求和 */
|
/** 混合段累计合计:优先主表 stageNTotal,否则按明细该列求和 */
|
||||||
private BigDecimal resolveStageCumulativeTotal(MesXslFormulaSpec formula, List<MesXslFormulaSpecLine> lines, int column) {
|
private BigDecimal resolveStageCumulativeTotal(MesXslFormulaSpec formula, List<MesXslFormulaSpecLine> lines, int column) {
|
||||||
@@ -1129,6 +1236,24 @@ public class MesXslFormulaSpecServiceImpl extends ServiceImpl<MesXslFormulaSpecM
|
|||||||
return material;
|
return material;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void fillMaterialCategory(
|
||||||
|
MesXslMixingSpecMaterial material,
|
||||||
|
String mixerMaterialId,
|
||||||
|
MesXslFormulaSpecLine line,
|
||||||
|
Map<String, MesMixerMaterial> mixerCache,
|
||||||
|
Map<String, String> categoryNameCache,
|
||||||
|
MesXslMixerMaterialKindLookupVO kindLookup) {
|
||||||
|
if (oConvertUtils.isEmpty(mixerMaterialId)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
MesMixerMaterial mixer = mixerCache.computeIfAbsent(mixerMaterialId, id -> mesMixerMaterialService.getById(id));
|
||||||
|
if (mixer == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
String weighMode = line != null ? line.getWeighMode() : null;
|
||||||
|
fillMixingMaterialFromMixerMaterial(material, mixer, weighMode, mixerCache, categoryNameCache, kindLookup);
|
||||||
|
}
|
||||||
|
|
||||||
private BigDecimal readStageValue(MesXslFormulaSpecLine line, int stageIndex) {
|
private BigDecimal readStageValue(MesXslFormulaSpecLine line, int stageIndex) {
|
||||||
if (line == null || stageIndex < 1 || stageIndex > 7) {
|
if (line == null || stageIndex < 1 || stageIndex > 7) {
|
||||||
return null;
|
return null;
|
||||||
@@ -1145,32 +1270,6 @@ public class MesXslFormulaSpecServiceImpl extends ServiceImpl<MesXslFormulaSpecM
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
private void fillMaterialCategory(
|
|
||||||
MesXslMixingSpecMaterial material,
|
|
||||||
String mixerMaterialId,
|
|
||||||
MesXslFormulaSpecLine line,
|
|
||||||
Map<String, MesMixerMaterial> mixerCache,
|
|
||||||
Map<String, String> categoryNameCache,
|
|
||||||
MesXslMixerMaterialKindLookupVO kindLookup) {
|
|
||||||
if (oConvertUtils.isEmpty(mixerMaterialId)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
MesMixerMaterial mixer = mixerCache.computeIfAbsent(mixerMaterialId, id -> mesMixerMaterialService.getById(id));
|
|
||||||
if (mixer == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
String weighMode = line != null ? line.getWeighMode() : null;
|
|
||||||
String majorName = resolveCategoryName(mixer.getMajorCategoryId(), categoryNameCache);
|
|
||||||
String minorName = resolveCategoryName(mixer.getMinorCategoryId(), categoryNameCache);
|
|
||||||
material.setMaterialMajor(majorName);
|
|
||||||
material.setMaterialMinor(minorName);
|
|
||||||
//update-begin---author:cursor ---date:20260525 for:【XSLMES-20260525-A52】生成混炼示方种类改读密炼物料种类配置-----------
|
|
||||||
material.setMaterialKind(
|
|
||||||
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) {
|
private String resolveCategoryName(String categoryId, Map<String, String> cache) {
|
||||||
if (oConvertUtils.isEmpty(categoryId)) {
|
if (oConvertUtils.isEmpty(categoryId)) {
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
@@ -8,11 +8,16 @@ import java.io.Serializable;
|
|||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.LinkedHashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.Set;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.jeecg.common.constant.CommonConstant;
|
import org.jeecg.common.constant.CommonConstant;
|
||||||
@@ -114,14 +119,12 @@ public class MesXslMixingSpecServiceImpl extends ServiceImpl<MesXslMixingSpecMap
|
|||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void delMain(String id) {
|
public void delMain(String id) {
|
||||||
MesXslMixingSpec main = this.getById(id);
|
//update-begin---author:cursor ---date:20260525 for:【XSLMES-20260525-A56】混炼示方批量删除性能优化-----------
|
||||||
clearChildren(id);
|
if (StringUtils.isBlank(id)) {
|
||||||
this.removeById(id);
|
return;
|
||||||
//update-begin---author:cursor ---date:20260525 for:【XSLMES-20260525-A49】删除混炼示方时同步删除B/F段胶密炼物料-----------
|
|
||||||
if (main != null) {
|
|
||||||
syncDeleteGeneratedRubberMixerMaterial(main.getSpecName());
|
|
||||||
}
|
}
|
||||||
//update-end---author:cursor ---date:20260525 for:【XSLMES-20260525-A49】删除混炼示方时同步删除B/F段胶密炼物料-----------
|
delBatchMain(Collections.singletonList(id));
|
||||||
|
//update-end---author:cursor ---date:20260525 for:【XSLMES-20260525-A56】混炼示方批量删除性能优化-----------
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -130,11 +133,32 @@ public class MesXslMixingSpecServiceImpl extends ServiceImpl<MesXslMixingSpecMap
|
|||||||
if (CollectionUtils.isEmpty(idList)) {
|
if (CollectionUtils.isEmpty(idList)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
for (Serializable id : idList) {
|
//update-begin---author:cursor ---date:20260525 for:【XSLMES-20260525-A56】混炼示方批量删除性能优化-----------
|
||||||
if (id != null) {
|
List<String> ids = idList.stream()
|
||||||
delMain(String.valueOf(id));
|
.filter(Objects::nonNull)
|
||||||
|
.map(String::valueOf)
|
||||||
|
.filter(StringUtils::isNotBlank)
|
||||||
|
.distinct()
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
if (ids.isEmpty()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
List<MesXslMixingSpec> mains = this.listByIds(ids);
|
||||||
|
if (CollectionUtils.isEmpty(mains)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
clearChildrenBatch(ids);
|
||||||
|
this.removeByIds(ids);
|
||||||
|
Set<String> specNames = new LinkedHashSet<>();
|
||||||
|
for (MesXslMixingSpec main : mains) {
|
||||||
|
if (main != null && StringUtils.isNotBlank(main.getSpecName())) {
|
||||||
|
specNames.add(main.getSpecName().trim());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
for (String specName : specNames) {
|
||||||
|
syncDeleteGeneratedRubberMixerMaterial(specName);
|
||||||
|
}
|
||||||
|
//update-end---author:cursor ---date:20260525 for:【XSLMES-20260525-A56】混炼示方批量删除性能优化-----------
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -269,6 +293,19 @@ public class MesXslMixingSpecServiceImpl extends ServiceImpl<MesXslMixingSpecMap
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//update-begin---author:cursor ---date:20260525 for:【XSLMES-20260525-A56】混炼示方批量删除性能优化-----------
|
||||||
|
/** 批量删除多个混炼示方的全部子表数据 */
|
||||||
|
private void clearChildrenBatch(Collection<String> mainIds) {
|
||||||
|
if (CollectionUtils.isEmpty(mainIds)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
materialMapper.delete(new LambdaQueryWrapper<MesXslMixingSpecMaterial>().in(MesXslMixingSpecMaterial::getMixingSpecId, mainIds));
|
||||||
|
stepMapper.delete(new LambdaQueryWrapper<MesXslMixingSpecStep>().in(MesXslMixingSpecStep::getMixingSpecId, mainIds));
|
||||||
|
downStepMapper.delete(new LambdaQueryWrapper<MesXslMixingSpecDownStep>().in(MesXslMixingSpecDownStep::getMixingSpecId, mainIds));
|
||||||
|
tcuMapper.delete(new LambdaQueryWrapper<MesXslMixingSpecTcu>().in(MesXslMixingSpecTcu::getMixingSpecId, mainIds));
|
||||||
|
}
|
||||||
|
//update-end---author:cursor ---date:20260525 for:【XSLMES-20260525-A56】混炼示方批量删除性能优化-----------
|
||||||
|
|
||||||
private void saveChildren(
|
private void saveChildren(
|
||||||
String mainId,
|
String mainId,
|
||||||
List<MesXslMixingSpecMaterial> materialList,
|
List<MesXslMixingSpecMaterial> materialList,
|
||||||
@@ -545,9 +582,12 @@ public class MesXslMixingSpecServiceImpl extends ServiceImpl<MesXslMixingSpecMap
|
|||||||
if (row == null) {
|
if (row == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
//update-begin---author:cursor ---date:20260525 for:【XSLMES-20260525-A55】混炼示方明细有效行判断含密炼物料ID-----------
|
||||||
return StringUtils.isNotBlank(row.getMixerMaterialName())
|
return StringUtils.isNotBlank(row.getMixerMaterialName())
|
||||||
|
|| StringUtils.isNotBlank(row.getMixerMaterialId())
|
||||||
|| row.getUnitWeight() != null
|
|| row.getUnitWeight() != null
|
||||||
|| StringUtils.isNotBlank(row.getMaterialKind());
|
|| StringUtils.isNotBlank(row.getMaterialKind());
|
||||||
|
//update-end---author:cursor ---date:20260525 for:【XSLMES-20260525-A55】混炼示方明细有效行判断含密炼物料ID-----------
|
||||||
}
|
}
|
||||||
|
|
||||||
private String normalizeMaterialKind(MesXslMixingSpecMaterial row) {
|
private String normalizeMaterialKind(MesXslMixingSpecMaterial row) {
|
||||||
@@ -634,8 +674,7 @@ public class MesXslMixingSpecServiceImpl extends ServiceImpl<MesXslMixingSpecMap
|
|||||||
log.debug("[混炼示方删除] 示方编号 {} 仍有 {} 条混炼示方,跳过密炼物料同步删除", specCode, remainingSpecCount);
|
log.debug("[混炼示方删除] 示方编号 {} 仍有 {} 条混炼示方,跳过密炼物料同步删除", specCode, remainingSpecCount);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
long referencedCount = materialMapper.selectCount(
|
long referencedCount = countMaterialReference(specCode, null);
|
||||||
new LambdaQueryWrapper<MesXslMixingSpecMaterial>().eq(MesXslMixingSpecMaterial::getMixerMaterialName, specCode));
|
|
||||||
if (referencedCount > 0) {
|
if (referencedCount > 0) {
|
||||||
log.info(
|
log.info(
|
||||||
"[混炼示方删除] 示方编号 {} 仍被 {} 条混炼示方明细引用,跳过密炼物料同步删除",
|
"[混炼示方删除] 示方编号 {} 仍被 {} 条混炼示方明细引用,跳过密炼物料同步删除",
|
||||||
@@ -648,6 +687,15 @@ public class MesXslMixingSpecServiceImpl extends ServiceImpl<MesXslMixingSpecMap
|
|||||||
log.debug("[混炼示方删除] 未找到示方编号 {} 对应密炼物料,跳过同步删除", specCode);
|
log.debug("[混炼示方删除] 未找到示方编号 {} 对应密炼物料,跳过同步删除", specCode);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
referencedCount = countMaterialReference(specCode, material.getId());
|
||||||
|
if (referencedCount > 0) {
|
||||||
|
log.info(
|
||||||
|
"[混炼示方删除] 密炼物料 id={}, code={} 仍被 {} 条混炼示方明细引用,跳过同步删除",
|
||||||
|
material.getId(),
|
||||||
|
specCode,
|
||||||
|
referencedCount);
|
||||||
|
return;
|
||||||
|
}
|
||||||
Map<String, String> categoryIdCache = new HashMap<>();
|
Map<String, String> categoryIdCache = new HashMap<>();
|
||||||
if (!isGeneratedRubberMixerMaterial(material, isFinalStage, categoryIdCache)) {
|
if (!isGeneratedRubberMixerMaterial(material, isFinalStage, categoryIdCache)) {
|
||||||
log.info(
|
log.info(
|
||||||
@@ -706,6 +754,18 @@ public class MesXslMixingSpecServiceImpl extends ServiceImpl<MesXslMixingSpecMap
|
|||||||
return expectedMajorId.equals(material.getMajorCategoryId()) && expectedMinorId.equals(material.getMinorCategoryId());
|
return expectedMajorId.equals(material.getMajorCategoryId()) && expectedMinorId.equals(material.getMinorCategoryId());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 统计混炼示方明细对某示方编号/密炼物料 ID 的引用次数 */
|
||||||
|
private long countMaterialReference(String specCode, String mixerMaterialId) {
|
||||||
|
LambdaQueryWrapper<MesXslMixingSpecMaterial> qw = new LambdaQueryWrapper<>();
|
||||||
|
qw.and(wrapper -> {
|
||||||
|
wrapper.eq(MesXslMixingSpecMaterial::getMixerMaterialName, specCode);
|
||||||
|
if (StringUtils.isNotBlank(mixerMaterialId)) {
|
||||||
|
wrapper.or().eq(MesXslMixingSpecMaterial::getMixerMaterialId, mixerMaterialId);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return materialMapper.selectCount(qw);
|
||||||
|
}
|
||||||
|
|
||||||
private String resolveCategoryIdByCode(String categoryCode, Map<String, String> cache) {
|
private String resolveCategoryIdByCode(String categoryCode, Map<String, String> cache) {
|
||||||
if (StringUtils.isBlank(categoryCode)) {
|
if (StringUtils.isBlank(categoryCode)) {
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
@@ -0,0 +1,7 @@
|
|||||||
|
-- 混炼示方明细:关联密炼物料主数据 ID
|
||||||
|
SET NAMES utf8mb4;
|
||||||
|
|
||||||
|
ALTER TABLE `mes_xsl_mixing_spec_material`
|
||||||
|
ADD COLUMN `mixer_material_id` varchar(32) DEFAULT NULL COMMENT '密炼物料ID(关联mes_mixer_material.id)' AFTER `material_kind`;
|
||||||
|
|
||||||
|
CREATE INDEX `idx_mxmix_mat_mixer_id` ON `mes_xsl_mixing_spec_material` (`mixer_material_id`);
|
||||||
@@ -88,6 +88,9 @@ export const mainSchema: FormSchema[] = [
|
|||||||
|
|
||||||
//update-begin---author:cursor ---date:20260522 for:【XSLMES-20260522-A17】橡胶及配合剂明细列展示设置-----------
|
//update-begin---author:cursor ---date:20260522 for:【XSLMES-20260522-A17】橡胶及配合剂明细列展示设置-----------
|
||||||
export const materialColumns: JVxeColumn[] = [
|
export const materialColumns: JVxeColumn[] = [
|
||||||
|
//update-begin---author:cursor ---date:20260525 for:【XSLMES-20260525-A55】混炼示方明细关联密炼物料ID-----------
|
||||||
|
{ 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 },
|
{ title: '物料大类', key: 'materialMajor', type: JVxeTypes.input, width: 100, minWidth: MIXING_MATERIAL_MIN_COLUMN_WIDTH },
|
||||||
{ title: '物料小类', key: 'materialMinor', type: JVxeTypes.input, width: 120, minWidth: MIXING_MATERIAL_MIN_COLUMN_WIDTH },
|
{ 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 },
|
{ title: '种类', key: 'materialKind', type: JVxeTypes.input, width: 80, minWidth: MIXING_MATERIAL_MIN_COLUMN_WIDTH },
|
||||||
@@ -219,7 +222,7 @@ function isMixingMaterialDataRow(row: Recordable): boolean {
|
|||||||
if (!row) {
|
if (!row) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return !!(row.mixerMaterialName || row.materialKind || row.unitWeight != null && row.unitWeight !== '');
|
return !!(row.mixerMaterialId || row.mixerMaterialName || row.materialKind || row.unitWeight != null && row.unitWeight !== '');
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 规范化种类字段,用于连续行分组 */
|
/** 规范化种类字段,用于连续行分组 */
|
||||||
@@ -1100,6 +1103,9 @@ export function applyMixingMaterialFromSelection(row: Recordable, material: Reco
|
|||||||
if (!row || !material) {
|
if (!row || !material) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
//update-begin---author:cursor ---date:20260525 for:【XSLMES-20260525-A55】选料回填密炼物料ID-----------
|
||||||
|
row.mixerMaterialId = material.id || material.mixerMaterialId || '';
|
||||||
|
//update-end---author:cursor ---date:20260525 for:【XSLMES-20260525-A55】选料回填密炼物料ID-----------
|
||||||
row.mixerMaterialName = material.materialName || material.materialCode || '';
|
row.mixerMaterialName = material.materialName || material.materialCode || '';
|
||||||
row.mixerMaterialDesc = material.materialDesc || material.materialName || material.materialCode || '';
|
row.mixerMaterialDesc = material.materialDesc || material.materialName || material.materialCode || '';
|
||||||
row.materialMajor = material.majorCategoryId_dictText || '';
|
row.materialMajor = material.majorCategoryId_dictText || '';
|
||||||
|
|||||||
@@ -10,6 +10,7 @@
|
|||||||
size="small"
|
size="small"
|
||||||
class="mixing-step-select"
|
class="mixing-step-select"
|
||||||
popup-class-name="mixing-step-select-dropdown"
|
popup-class-name="mixing-step-select-dropdown"
|
||||||
|
:list-height="listHeight"
|
||||||
:placeholder="placeholder"
|
:placeholder="placeholder"
|
||||||
:get-popup-container="getPopupContainer"
|
:get-popup-container="getPopupContainer"
|
||||||
@update:value="handleChange"
|
@update:value="handleChange"
|
||||||
@@ -19,9 +20,14 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { ref } from 'vue';
|
import { computed, ref } from 'vue';
|
||||||
import { useMessage } from '/@/hooks/web/useMessage';
|
import { useMessage } from '/@/hooks/web/useMessage';
|
||||||
|
|
||||||
|
/** 下拉单项高度(与 ant-design-vue small Select 选项行高一致) */
|
||||||
|
const STEP_SELECT_ITEM_HEIGHT = 32;
|
||||||
|
/** 下拉最多可见条数 */
|
||||||
|
const STEP_SELECT_MAX_VISIBLE = 20;
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
row: Recordable;
|
row: Recordable;
|
||||||
field: string;
|
field: string;
|
||||||
@@ -34,6 +40,14 @@
|
|||||||
const { createMessage } = useMessage();
|
const { createMessage } = useMessage();
|
||||||
const dropdownOpen = ref(false);
|
const dropdownOpen = ref(false);
|
||||||
|
|
||||||
|
//update-begin---author:cursor ---date:20260525 for:【XSLMES-20260525-A57】混合步骤动作/组合下拉最多展示20条-----------
|
||||||
|
const listHeight = computed(() => {
|
||||||
|
const count = props.options?.length ?? 0;
|
||||||
|
const visibleCount = count > 0 ? Math.min(count, STEP_SELECT_MAX_VISIBLE) : STEP_SELECT_MAX_VISIBLE;
|
||||||
|
return visibleCount * STEP_SELECT_ITEM_HEIGHT;
|
||||||
|
});
|
||||||
|
//update-end---author:cursor ---date:20260525 for:【XSLMES-20260525-A57】混合步骤动作/组合下拉最多展示20条-----------
|
||||||
|
|
||||||
function handleChange(value: string | undefined) {
|
function handleChange(value: string | undefined) {
|
||||||
props.row[props.field] = value;
|
props.row[props.field] = value;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user