64dc85bd14
- inventory业务层下沉(薄路由+service orchestration模式): - customer/supplier/warehouse -> master_data_service - material_routes(价格历史/趋势/供应商关联)-> material_service - product_routes(CRUD/BOM/from-task跨模块桥接)-> product_service - dashboard_routes(首页统计/低库存预警)-> dashboard_service - inventory侧新增service回归覆盖(dashboard 2 / master_data 10 / material 10 / product 14),含跨模块桥接测试种子 - Pydantic v2弃用清零:全仓14处 class Config 全部迁移到 model_config = ConfigDict(from_attributes=True)(含 shared auth) - datetime.utcnow() 弃用清零:auth_service 3处统一改 datetime.now(timezone.utc) - 同步文档:STATUS / ROADMAP / TECH_DEBT(D12清偿)/ AGENTS 代码地图 测试基线:126 passed, 4 skipped(无deprecation warning) Co-Authored-By: Claude Code <noreply@anthropic.com>
34 lines
822 B
Python
34 lines
822 B
Python
from pydantic import BaseModel, ConfigDict
|
|
from typing import Optional
|
|
from decimal import Decimal
|
|
|
|
|
|
class InventoryResponse(BaseModel):
|
|
id: int
|
|
product_id: int
|
|
product_name: str
|
|
product_sku: str
|
|
warehouse_id: int
|
|
warehouse_name: str
|
|
quantity: Decimal
|
|
locked_quantity: Decimal
|
|
available_quantity: Decimal
|
|
|
|
model_config = ConfigDict(from_attributes=True)
|
|
|
|
|
|
class InventoryCreate(BaseModel):
|
|
product_id: int
|
|
warehouse_id: int
|
|
quantity: Decimal = Decimal("0")
|
|
locked_quantity: Decimal = Decimal("0")
|
|
batch_number: Optional[str] = None
|
|
location: Optional[str] = None
|
|
|
|
|
|
class InventoryUpdate(BaseModel):
|
|
quantity: Optional[Decimal] = None
|
|
locked_quantity: Optional[Decimal] = None
|
|
batch_number: Optional[str] = None
|
|
location: Optional[str] = None
|