优化种类生成逻辑

This commit is contained in:
geht
2026-05-25 20:42:13 +08:00
parent 441c19e87a
commit 72aeee0f10
8 changed files with 59 additions and 21 deletions

View File

@@ -306,3 +306,12 @@ jeecgboot-vue3/src/views/xslmes/mesXslMixingSpec/components/MesXslMixingMaterial
-- author:cursor---date:20260525--for: 【XSLMES-20260525-A52】高层级弹窗内 Message 提示层级修复 -----------
jeecgboot-vue3/src/design/public.less
-- author:cursor---date:20260525--for: 【XSLMES-20260525-A53】种类解析移除小类名兜底/通用选料弹窗接配置/配置变更清缓存 -----------
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
jeecgboot-vue3/src/views/mes/material/modules/MesMixerMaterialSelectModal.vue
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/MesXslMixingMaterialSelectModal.vue
jeecgboot-vue3/src/views/xslmes/mesXslMixerMaterialKindCfg/MesXslMixerMaterialKindCfgList.vue

View File

@@ -32,7 +32,7 @@ public interface IMesXslMixerMaterialKindCfgService extends IService<MesXslMixer
MesXslMixerMaterialKindLookupVO loadKindLookup(Integer tenantId);
/**
* 解析混炼示方明细种类:称量方式优先,其次物料小类,最后小类名称兜底
* 解析混炼示方明细种类:称量方式优先,其次物料小类 ID未命中配置返回 null
*/
String resolveMixingMaterialKind(
MesXslMixerMaterialKindLookupVO lookup,

View File

@@ -369,10 +369,9 @@ public class MesXslMixerMaterialKindCfgServiceImpl
return fromMinor;
}
}
if (oConvertUtils.isNotEmpty(minorCategoryName)) {
return minorCategoryName.trim();
}
//update-begin---author:cursor ---date:20260525 for【XSLMES-20260525-A53】种类未命中配置时不回退小类名-----------
return null;
//update-end---author:cursor ---date:20260525 for【XSLMES-20260525-A53】种类未命中配置时不回退小类名-----------
}
private String matchKindFromLookup(MesXslMixerMaterialKindLookupVO lookup, String key) {

View File

@@ -11,11 +11,21 @@
import { list as mixerList, queryById as queryMixerById } from '../MesMixerMaterial.api';
import { columns as mixerColumns, searchFormSchema as mixerSearch } from '../MesMixerMaterial.data';
import { useMessage } from '/@/hooks/web/useMessage';
//update-begin---author:cursor ---date:20260525 for【XSLMES-20260525-A53】通用密炼物料选料弹窗种类改读配置表-----------
import {
loadMixingMaterialKindLookup,
resolveMixingMaterialKindFromLookup,
type MixerMaterialKindLookup,
} from '/@/views/xslmes/mesXslMixingSpec/MesXslMixingSpec.data';
//update-end---author:cursor ---date:20260525 for【XSLMES-20260525-A53】通用密炼物料选料弹窗种类改读配置表-----------
const emit = defineEmits(['register', 'select']);
const { createMessage } = useMessage();
const selectedRow = ref<Recordable | null>(null);
//update-begin---author:cursor ---date:20260525 for【XSLMES-20260525-A53】通用密炼物料选料弹窗种类改读配置表-----------
const kindLookup = ref<MixerMaterialKindLookup | null>(null);
//update-end---author:cursor ---date:20260525 for【XSLMES-20260525-A53】通用密炼物料选料弹窗种类改读配置表-----------
const [registerTable, { reload, getSelectRowKeys, getSelectRows, setSelectedRowKeys, clearSelectedRowKeys }] = useTable({
api: mixerList,
@@ -44,6 +54,9 @@
selectedRow.value = null;
clearSelectedRowKeys?.();
setModalProps({ confirmLoading: false });
//update-begin---author:cursor ---date:20260525 for【XSLMES-20260525-A53】通用密炼物料选料弹窗种类改读配置表-----------
kindLookup.value = await loadMixingMaterialKindLookup();
//update-end---author:cursor ---date:20260525 for【XSLMES-20260525-A53】通用密炼物料选料弹窗种类改读配置表-----------
const mid = data?.mixerMaterialId as string | undefined;
if (mid) {
setSelectedRowKeys?.([mid]);
@@ -60,12 +73,13 @@
reload();
});
function buildKind(row: Recordable) {
const a = row.majorCategoryId_dictText || '';
const b = row.minorCategoryId_dictText || '';
if (a && b) return `${a} / ${b}`;
return a || b || '';
//update-begin---author:cursor ---date:20260525 for【XSLMES-20260525-A53】通用密炼物料选料弹窗种类改读配置表-----------
function resolveMaterialKind(row: Recordable) {
const minorId = row?.minorCategoryId ? String(row.minorCategoryId) : '';
const minorName = row?.minorCategoryId_dictText || '';
return resolveMixingMaterialKindFromLookup(kindLookup.value, undefined, minorId, minorName);
}
//update-end---author:cursor ---date:20260525 for【XSLMES-20260525-A53】通用密炼物料选料弹窗种类改读配置表-----------
async function handleOk() {
const keys = (getSelectRowKeys?.() || []) as string[];
@@ -82,12 +96,19 @@
createMessage.warning('请选择一条密炼物料');
return;
}
//update-begin---author:cursor ---date:20260525 for【XSLMES-20260525-A53】通用密炼物料选料弹窗种类改读配置表-----------
const materialKind = resolveMaterialKind(row);
if (!materialKind) {
createMessage.warning('未匹配到种类,请检查密炼物料种类配置');
return;
}
//update-end---author:cursor ---date:20260525 for【XSLMES-20260525-A53】通用密炼物料选料弹窗种类改读配置表-----------
emit('select', {
mixerMaterialId: row.id,
materialName: row.materialName || '',
materialCode: row.materialCode || '',
materialDesc: row.materialDesc || '',
materialKind: buildKind(row),
materialKind,
minorCategoryId: row.minorCategoryId || '',
majorCategoryText: row.majorCategoryId_dictText || '',
minorCategoryText: row.minorCategoryId_dictText || '',

View File

@@ -70,6 +70,9 @@
import MesXslMixerMaterialKindCfgEditModal from './components/MesXslMixerMaterialKindCfgEditModal.vue';
import { columns, searchFormSchema, superQuerySchema } from './MesXslMixerMaterialKindCfg.data';
import { batchDelete, deleteOne, getExportUrl, getImportUrl, list } from './MesXslMixerMaterialKindCfg.api';
//update-begin---author:cursor ---date:20260525 for【XSLMES-20260525-A53】种类配置变更后清除前端 lookup 缓存-----------
import { clearMixingMaterialKindLookupCache } from '../mesXslMixingSpec/MesXslMixingSpec.data';
//update-end---author:cursor ---date:20260525 for【XSLMES-20260525-A53】种类配置变更后清除前端 lookup 缓存-----------
const queryParam = reactive<any>({});
const [registerBatchModal, { openModal: openBatchModal }] = useModal();
@@ -138,6 +141,9 @@
}
function handleSuccess() {
//update-begin---author:cursor ---date:20260525 for【XSLMES-20260525-A53】种类配置变更后清除前端 lookup 缓存-----------
clearMixingMaterialKindLookupCache();
//update-end---author:cursor ---date:20260525 for【XSLMES-20260525-A53】种类配置变更后清除前端 lookup 缓存-----------
selectedRowKeys.value = [];
reload();
}

View File

@@ -1040,12 +1040,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) {
@@ -1055,9 +1055,6 @@ export function resolveMixingMaterialKindFromLookup(
if (fromMinorId) {
return fromMinorId;
}
if (minorCategoryName != null && String(minorCategoryName).trim() !== '') {
return String(minorCategoryName).trim();
}
return '';
}
@@ -1107,6 +1104,8 @@ export function applyMixingMaterialFromSelection(row: Recordable, material: Reco
row.mixerMaterialDesc = material.materialDesc || material.materialName || material.materialCode || '';
row.materialMajor = material.majorCategoryId_dictText || '';
row.materialMinor = material.minorCategoryId_dictText || '';
row.materialKind = materialKind || row.materialMinor || '';
//update-begin---author:cursor ---date:20260525 for【XSLMES-20260525-A53】种类仅读配置表移除小类名兜底-----------
row.materialKind = materialKind != null && String(materialKind).trim() !== '' ? String(materialKind).trim() : '';
//update-end---author:cursor ---date:20260525 for【XSLMES-20260525-A53】种类仅读配置表移除小类名兜底-----------
}
//update-end---author:cursor ---date:20260525 for【XSLMES-20260525-A50】混炼示方密炼物料选料弹窗与种类解析-----------

View File

@@ -393,6 +393,12 @@
const weighMode = getPickerWeighMode(row.id);
const payload: Recordable = { ...row, pickerWeighMode: weighMode };
const materialKind = resolveKindForMaterial(row, weighMode);
//update-begin---author:cursor ---date:20260525 for【XSLMES-20260525-A53】选料未匹配种类时提示检查配置-----------
if (!materialKind) {
createMessage.warning('未匹配到种类,请检查密炼物料种类配置');
return;
}
//update-end---author:cursor ---date:20260525 for【XSLMES-20260525-A53】选料未匹配种类时提示检查配置-----------
applyMixingMaterialFromSelection(payload, row, materialKind);
emit('select', payload);
closeModal();

View File

@@ -944,11 +944,9 @@ function onMixingMaterialSelect(payload: Recordable | null) {
if (!payload || !materialPickerRow.value) {
return;
}
applyMixingMaterialFromSelection(
materialPickerRow.value,
payload,
payload.materialKind || payload.materialMinor || '',
);
//update-begin---author:cursor ---date:20260525 for【XSLMES-20260525-A53】选料回填种类仅使用配置解析结果-----------
applyMixingMaterialFromSelection(materialPickerRow.value, payload, payload.materialKind || '');
//update-end---author:cursor ---date:20260525 for【XSLMES-20260525-A53】选料回填种类仅使用配置解析结果-----------
recalcMaterialAccumWeight();
materialPickerRow.value = null;
}