refactor(shipping-notice): 统一料号字段,移除过时的 SKU 相关字段,更新相关逻辑以支持新字段命名
This commit is contained in:
1 parent
dde25344ca
commit
46eb63f5bb
111 files changed
+3116
-1250
No files matched your search
@@ -13,7 +13,7 @@ export interface ShippingTaskSwitchIntent {
|
||||
}
|
||||
|
||||
/**
|
||||
* 从自然语言文本解析库存列映射(sku / available_qty / reservation_id → Excel 列名)。
|
||||
* 从自然语言文本解析库存列映射(part_number / reservation_id / available_qty → Excel 列名)。
|
||||
*/
|
||||
export function parseShippingColumnMappingFromText(content: string): Record<string, string> | null {
|
||||
const raw = String(content || '').trim();
|
||||
@@ -31,7 +31,9 @@ export function parseShippingColumnMappingFromText(content: string): Record<stri
|
||||
const s = left.toLowerCase();
|
||||
if (s.includes('reservation') || left.includes('预留') || left.includes('预定')) return 'reservation_id';
|
||||
if (s.includes('qty') || s.includes('available') || left.includes('可用') || left.includes('数量')) return 'available_qty';
|
||||
if (s.includes('sku') || left.includes('料号') || left.includes('物料')) return 'sku';
|
||||
if (s.includes('part_number') || s.includes('part number') || s.includes('sku') || left.includes('料号') || left.includes('物料')) {
|
||||
return 'part_number';
|
||||
}
|
||||
return '';
|
||||
};
|
||||
for (const line of lines) {
|
||||
@@ -46,7 +48,7 @@ export function parseShippingColumnMappingFromText(content: string): Record<stri
|
||||
if (!col) continue;
|
||||
mapping[key] = col;
|
||||
}
|
||||
if (!mapping.sku || !mapping.available_qty) return null;
|
||||
if (!mapping.part_number || !mapping.reservation_id || !mapping.available_qty) return null;
|
||||
return mapping;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user