更新混炼示方功能,优化胶料信息同步与删除逻辑,新增胶料类别名称匹配支持,调整选料弹窗以支持胶料查询,提升用户体验。
This commit is contained in:
@@ -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<string, string>;
|
||||
byRefCode: Record<string, string>;
|
||||
//update-begin---author:cursor ---date:20260601 for:【XSLMES-20260601-A62】种类查找表支持胶料类别名称-----------
|
||||
byRefName?: Record<string, string>;
|
||||
//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 = [
|
||||
|
||||
Reference in New Issue
Block a user