refactor(shipping-notice): 统一料号字段,移除过时的 SKU 相关字段,更新相关逻辑以支持新字段命名
This commit is contained in:
1 parent
dde25344ca
commit
46eb63f5bb
111 files changed
+3116
-1250
No files matched your search
@@ -21,11 +21,33 @@ def reservation_gate_issues(lines: list[Any] | None) -> list[dict[str, Any]]:
|
||||
lines: ShippingTask 订单行数组。
|
||||
|
||||
Returns:
|
||||
含行号、SKU、原值和原因的 blocking issue;全部合法时返回空列表。
|
||||
含行号、内部料号、原值和原因的 blocking issue;全部合法时返回空列表。
|
||||
"""
|
||||
if not lines:
|
||||
return [
|
||||
{
|
||||
"line_index": None,
|
||||
"part_number": "",
|
||||
"field": "reservation_id",
|
||||
"reason": "missing_order_lines",
|
||||
"severity": "blocking",
|
||||
"raw_value": "",
|
||||
}
|
||||
]
|
||||
|
||||
issues: list[dict[str, Any]] = []
|
||||
for index, raw_line in enumerate(lines or []):
|
||||
for index, raw_line in enumerate(lines):
|
||||
if not isinstance(raw_line, dict):
|
||||
issues.append(
|
||||
{
|
||||
"line_index": index,
|
||||
"part_number": "",
|
||||
"field": "reservation_id",
|
||||
"reason": "invalid_order_line",
|
||||
"severity": "blocking",
|
||||
"raw_value": "",
|
||||
}
|
||||
)
|
||||
continue
|
||||
raw_value = str(raw_line.get("reservation_id") or "").strip()
|
||||
if is_valid_reservation_id(raw_value):
|
||||
@@ -33,7 +55,7 @@ def reservation_gate_issues(lines: list[Any] | None) -> list[dict[str, Any]]:
|
||||
issues.append(
|
||||
{
|
||||
"line_index": index,
|
||||
"sku": str(raw_line.get("sku") or "").strip(),
|
||||
"part_number": str(raw_line.get("part_number") or "").strip(),
|
||||
"field": "reservation_id",
|
||||
"reason": "invalid_format" if raw_value else "missing",
|
||||
"severity": "blocking",
|
||||
|
||||
Reference in new issue
Block a user