指令问题修复

This commit is contained in:
andy
2026-09-17 11:03:19 +08:00
parent a3505f3921
commit 6eeaee07d4
40 changed files with 395 additions and 59 deletions

View File

@@ -79,8 +79,8 @@ export function effectiveParserModeForRoute(route: BusinessRouteDefinition, conf
return route.parserPolicy === 'program_only' ? 'program' : 'ai';
}
const PROGRAM_VERSION = 'ltjt-program-parser-v1.0.12';
export const BUSINESS_INPUT_CONTRACT_VERSION = 'business-input-templates-0.5.135';
const PROGRAM_VERSION = 'ltjt-program-parser-v1.0.13';
export const BUSINESS_INPUT_CONTRACT_VERSION = 'business-input-templates-0.5.136';
const lookupFields = ({ customerRequired = true } = {}): ProgramFieldDefinition[] => [
{ key: 'order_no', label: '单号', aliases: ['团号', '订单号'], kind: 'text' },

View File

@@ -387,14 +387,14 @@ const ROOM_CODES = new Map<string, string>([
['SGL', 'SGL'], ['单', 'SGL'], ['单间', 'SGL'], ['单人间', 'SGL'],
['TWN', 'TWN'], ['标', 'TWN'], ['标间', 'TWN'], ['双标间', 'TWN'],
['TRP', 'TRP'], ['三', 'TRP'], ['三人间', 'TRP'],
['DBL', 'DBL'], ['双', 'DBL'], ['双人间', 'DBL'], ['大床', 'DBL'], ['大床房', 'DBL']
['DBL', 'DBL'], ['双', 'DBL'], ['双人间', 'DBL'], ['大床', 'DBL'], ['大床房', 'DBL'], ['大', 'DBL']
]);
function parseRoomCounts(rawValue: string): FieldParseResult {
const value = compactText(rawValue).replace(/\s+/gu, '');
const result: JsonRecord = {};
const consumed: string[] = [];
const pattern = /(\d+)\s*(SGL|TWN|TRP|DBL|单人间|单间|单|双标间|标间|标|三人间|三|双人间|大床房|大床|双)/giu;
const pattern = /(\d+)\s*(SGL|TWN|TRP|DBL|单人间|单间|单|双标间|标间|标|三人间|三|双人间|大床房|大床|大|双)/giu;
for (const match of value.matchAll(pattern)) {
const code = ROOM_CODES.get(match[2].toUpperCase()) || ROOM_CODES.get(match[2]);
if (!code) continue;
@@ -475,7 +475,7 @@ function splitControlledClauses(rawValue: string): string[] {
}
function controlledAssignment(clause: string): { target: string; value: string } | null {
const match = clause.match(/^(.+?)(?:调整为|变更为|修改为|改为|设为|=|:|:)\s*(.+)$/u);
const match = clause.match(/^(.+?)(?:调整为|变更为|修改为|更改为|改为|设为|=|:|:)\s*(.+)$/u);
const target = compactText(match?.[1] || '').replace(/\s+/gu, '');
const value = compactText(match?.[2] || '');
return target && value ? { target, value } : null;
@@ -504,7 +504,7 @@ function parseIndependentUpdates(rawValue: string, context: DateContext, nextOcc
}
continue;
}
if (/^(?:用房数量|房型数量|用房|房间)$/u.test(target)) {
if (/^(?:用房数量|房型数量|房间数|用房|房间)$/u.test(target)) {
const rooms = parseRoomCounts(value);
if (!rooms.ok) return { ok: false, code: 'program_invalid_value', message: rooms.message, field: 'update_targets' };
for (const [key, count] of Object.entries(rooms.value as JsonRecord)) {