refactor(shipping-notice): 统一料号字段,移除过时的 SKU 相关字段,更新相关逻辑以支持新字段命名

This commit is contained in:
hugo committed 2026-07-16 20:02:33 +08:00
1 parent dde25344ca
commit 46eb63f5bb
111 files changed
+3116 -1250

No files matched your search

-3
View File
@@ -408,7 +408,6 @@ class ShippingNoticeIntake(Base):
nullable=False,
index=True,
)
order_extraction_version: Mapped[Optional[str]] = mapped_column(String(64), nullable=True)
order_extraction_error_code: Mapped[Optional[str]] = mapped_column(String(64), nullable=True)
order_extraction_error_message: Mapped[Optional[str]] = mapped_column(Text, nullable=True)
extracted_text: Mapped[Optional[str]] = mapped_column(Text, nullable=True)
@@ -490,7 +489,6 @@ class ShippingNoticeDocument(Base):
)
order_extraction_source: Mapped[Optional[str]] = mapped_column(String(32), nullable=True)
order_extraction_result_json: Mapped[Optional[dict]] = mapped_column(JSON, nullable=True)
order_extraction_version: Mapped[Optional[str]] = mapped_column(String(64), nullable=True)
order_extraction_error_code: Mapped[Optional[str]] = mapped_column(String(64), nullable=True)
order_extraction_error_message: Mapped[Optional[str]] = mapped_column(Text, nullable=True)
created_at: Mapped[datetime] = mapped_column(default=datetime.utcnow, index=True)
@@ -535,7 +533,6 @@ class ShippingNoticeCandidate(Base):
candidate_key: Mapped[str] = mapped_column(String(128), nullable=False)
source_order_index: Mapped[Optional[int]] = mapped_column(Integer, nullable=True)
extraction_source: Mapped[Optional[str]] = mapped_column(String(32), nullable=True)
extraction_version: Mapped[Optional[str]] = mapped_column(String(64), nullable=True)
classification_confidence: Mapped[Optional[float]] = mapped_column(Float, nullable=True)
field_confidence_json: Mapped[Optional[dict]] = mapped_column(JSON, nullable=True)
missing_fields_json: Mapped[Optional[list]] = mapped_column(JSON, nullable=True)
+19 -8
View File
@@ -43,9 +43,21 @@ class ShippingTaskLine(Base):
__table_args__ = (
UniqueConstraint('task_id', 'position', name='uq_shipping_task_lines_task_position'),
CheckConstraint('qty > 0', name='ck_shipping_task_lines_qty_positive'),
CheckConstraint(
"part_number NOT LIKE '%/%'",
name='ck_shipping_task_lines_part_number_atomic',
),
CheckConstraint(
"customer_part_number IS NULL OR customer_part_number NOT LIKE '%/%'",
name='ck_shipping_task_lines_customer_part_number_atomic',
),
CheckConstraint(
"aws_part_number IS NULL OR aws_part_number NOT LIKE '%/%'",
name='ck_shipping_task_lines_aws_part_number_atomic',
),
Index('ix_shipping_task_lines_task_id', 'task_id'),
Index('ix_shipping_task_lines_reservation_id', 'reservation_id'),
Index('ix_shipping_task_lines_sku', 'sku'),
Index('ix_shipping_task_lines_part_number', 'part_number'),
)
id: Mapped[int] = mapped_column(primary_key=True)
@@ -54,16 +66,15 @@ class ShippingTaskLine(Base):
nullable=False,
)
position: Mapped[int] = mapped_column(Integer, nullable=False)
sku: Mapped[str] = mapped_column(String(128), nullable=False)
part_number: Mapped[str] = mapped_column(String(128), nullable=False)
qty: Mapped[Decimal] = mapped_column(Numeric(18, 6), nullable=False)
uom: Mapped[Optional[str]] = mapped_column(String(32), nullable=True)
reservation_id: Mapped[Optional[str]] = mapped_column(String(128), nullable=True)
source_type: Mapped[Optional[str]] = mapped_column(String(128), nullable=True)
hub_code: Mapped[Optional[str]] = mapped_column(String(64), nullable=True)
inventory_source_hint: Mapped[Optional[str]] = mapped_column(String(128), nullable=True)
line_no: Mapped[Optional[str]] = mapped_column(String(64), nullable=True)
required_date: Mapped[Optional[str]] = mapped_column(String(32), nullable=True)
vendor_part_number: Mapped[Optional[str]] = mapped_column(String(128), nullable=True)
customer_sku: Mapped[Optional[str]] = mapped_column(String(128), nullable=True)
customer_part_number: Mapped[Optional[str]] = mapped_column(String(128), nullable=True)
aws_part_number: Mapped[Optional[str]] = mapped_column(String(128), nullable=True)
po_number: Mapped[Optional[str]] = mapped_column(String(128), nullable=True)
allocation_id: Mapped[Optional[str]] = mapped_column(String(128), nullable=True)
unit_price: Mapped[Optional[Decimal]] = mapped_column(Numeric(18, 6), nullable=True)
@@ -76,8 +87,8 @@ class ShippingTaskLine(Base):
schema_version: Mapped[str] = mapped_column(
String(64),
nullable=False,
default='shipping-task-line-v1',
server_default=text("'shipping-task-line-v1'"),
default='shipping-task-line-v2',
server_default=text("'shipping-task-line-v2'"),
)
line_version: Mapped[int] = mapped_column(
Integer,