chore: 以 AI 生鲜配送系统 当前版本作为 SupplierSystem 起点
来源仓库:jxc/ai-fresh-delivery 来源提交:f0b1a180e2deb7e4673b9d1c8542619f7bc0f73d 快照树: 09f679334ff38f0ff25e907961c94a8223bcaedd(与来源 HEAD 工作树逐字节一致,3801 个文件) 按约定本仓库不带任何历史提交:来源仓库的历史中含真实凭据 (生产 SSH 私钥 deploy/id_rsa_tencent、server/.env、.env.tencent/.env.production/.env.gitea、 deploy/小程序AppSecret.txt,其中 MP_APPSECRET / S3 AccessKey 经哈希比对与线上同值), 整包推送会把这些凭据永久带入本仓库,故只取「当前版本」的单提交快照。 供应商系统后续开发自本提交开始。
This commit is contained in:
@@ -0,0 +1,71 @@
|
||||
export const PROCESSING_METHODS = ['原材料', '净菜', '切配', '熟食'] as const;
|
||||
|
||||
/** 录单/OCR 常用标准加工方式(与 orderParseService 对齐) */
|
||||
export const STANDARD_PROCESSING_METHODS = [
|
||||
'砍',
|
||||
'去皮',
|
||||
'切片',
|
||||
'切块',
|
||||
'切丝',
|
||||
'切段',
|
||||
'切丁',
|
||||
'清洗',
|
||||
'洗净',
|
||||
'打包',
|
||||
'分装',
|
||||
'净菜',
|
||||
'剁碎',
|
||||
'去根',
|
||||
'去叶',
|
||||
] as const;
|
||||
|
||||
export type ProcessingMethod = (typeof PROCESSING_METHODS)[number];
|
||||
|
||||
export type ProcessingAlias = {
|
||||
alias_name: string;
|
||||
processing_method: string;
|
||||
};
|
||||
|
||||
function normalizeText(value: string): string {
|
||||
return (value || '').trim().toLowerCase();
|
||||
}
|
||||
|
||||
export function resolveProcessingMethodFromAlias(
|
||||
raw: string,
|
||||
aliases: ProcessingAlias[],
|
||||
): string {
|
||||
const trimmed = (raw || '').trim();
|
||||
if (!trimmed) return '原材料';
|
||||
|
||||
const direct = PROCESSING_METHODS.find((m) => m === trimmed);
|
||||
if (direct) return direct;
|
||||
|
||||
const aliasMatch = aliases.find(
|
||||
(item) => normalizeText(item.alias_name) === normalizeText(trimmed),
|
||||
);
|
||||
if (aliasMatch) return aliasMatch.processing_method;
|
||||
|
||||
if (trimmed.includes('切')) return '净菜';
|
||||
if (trimmed.includes('丁') || trimmed.includes('块') || trimmed.includes('片') || trimmed.includes('丝')) {
|
||||
return '切配';
|
||||
}
|
||||
if (trimmed.includes('卤') || trimmed.includes('熟')) return '熟食';
|
||||
if (trimmed.includes('加') || trimmed.includes('工')) return '切配';
|
||||
|
||||
return '原材料';
|
||||
}
|
||||
|
||||
/** 订单管理详情加工方式下拉(含库内已有自定义值时由调用方补一项) */
|
||||
export const ORDER_MANAGE_PROCESSING_METHOD_OPTIONS: string[] = Array.from(
|
||||
new Set(['原材料', ...PROCESSING_METHODS, ...STANDARD_PROCESSING_METHODS])
|
||||
);
|
||||
|
||||
export function orderManageProcessingMethodSelectOptions(current?: string | null): Array<{
|
||||
value: string;
|
||||
label: string;
|
||||
}> {
|
||||
const values = [...ORDER_MANAGE_PROCESSING_METHOD_OPTIONS];
|
||||
const cur = String(current || '').trim();
|
||||
if (cur && !values.includes(cur)) values.push(cur);
|
||||
return values.map((value) => ({ value, label: value }));
|
||||
}
|
||||
Reference in New Issue
Block a user