feat(schedule): 增加库存源选项描述字段与站点ID支持
This commit is contained in:
1 parent
f4e74f7b07
commit
8b1efbedb9
37 files changed
+8488
-4126
No files matched your search
@@ -122,6 +122,24 @@ def _resolve_odm_id(task: ShippingTask) -> str:
|
||||
return ""
|
||||
|
||||
|
||||
def _shipment_warehouse_id(task: ShippingTask) -> str:
|
||||
"""
|
||||
解析发货 Excel Header 的 Warehouse ID。
|
||||
核心逻辑:库存快照入库时按「配置 site_id 优先,否则库存 Excel 的 warehouse id」写入 inv_file.warehouse_id。
|
||||
"""
|
||||
try:
|
||||
from app.services.shipping_notice.inventory_snapshot_store import serialize_inventory_snapshot_link
|
||||
|
||||
snapshot = serialize_inventory_snapshot_link(task)
|
||||
except Exception:
|
||||
snapshot = None
|
||||
if isinstance(snapshot, dict):
|
||||
value = str(snapshot.get("warehouse_id") or "").strip()
|
||||
if value:
|
||||
return value
|
||||
return "AWSDU"
|
||||
|
||||
|
||||
def _line_po_number(task: ShippingTask, line: dict[str, Any]) -> str:
|
||||
for value in (line.get("po_number"), task.po_number):
|
||||
text = str(value or "").strip()
|
||||
@@ -158,8 +176,7 @@ def _fill_pvmi_template(task: ShippingTask, path: Path) -> None:
|
||||
_clear_sheet_data_rows(detail_ws)
|
||||
_clear_sheet_data_rows(header_ws, from_row=DATA_START_ROW)
|
||||
|
||||
if header_ws.cell(DATA_START_ROW, 1).value in (None, ""):
|
||||
header_ws.cell(DATA_START_ROW, 1).value = "AWSDU"
|
||||
header_ws.cell(DATA_START_ROW, 1).value = _shipment_warehouse_id(task)
|
||||
if header_ws.cell(DATA_START_ROW, 2).value in (None, ""):
|
||||
header_ws.cell(DATA_START_ROW, 2).value = "n"
|
||||
if header_ws.cell(DATA_START_ROW, 3).value in (None, ""):
|
||||
|
||||
Reference in new issue
Block a user