Improve the frontend 3

This commit is contained in:
Urtzi Alfaro
2025-10-30 21:08:07 +01:00
parent 36217a2729
commit 63f5c6d512
184 changed files with 21512 additions and 7442 deletions

View File

@@ -143,6 +143,55 @@ class OrderSettings(BaseModel):
delivery_tracking_enabled: bool = True
class ReplenishmentSettings(BaseModel):
"""Replenishment planning settings"""
projection_horizon_days: int = Field(7, ge=1, le=30)
service_level: float = Field(0.95, ge=0.0, le=1.0)
buffer_days: int = Field(1, ge=0, le=14)
enable_auto_replenishment: bool = True
min_order_quantity: float = Field(1.0, ge=0.1, le=1000.0)
max_order_quantity: float = Field(1000.0, ge=1.0, le=10000.0)
demand_forecast_days: int = Field(14, ge=1, le=90)
class SafetyStockSettings(BaseModel):
"""Safety stock settings"""
service_level: float = Field(0.95, ge=0.0, le=1.0)
method: str = Field("statistical", description="Method for safety stock calculation")
min_safety_stock: float = Field(0.0, ge=0.0, le=1000.0)
max_safety_stock: float = Field(100.0, ge=0.0, le=1000.0)
reorder_point_calculation: str = Field("safety_stock_plus_lead_time_demand", description="Method for reorder point calculation")
class MOQSettings(BaseModel):
"""MOQ aggregation settings"""
consolidation_window_days: int = Field(7, ge=1, le=30)
allow_early_ordering: bool = True
enable_batch_optimization: bool = True
min_batch_size: float = Field(1.0, ge=0.1, le=1000.0)
max_batch_size: float = Field(1000.0, ge=1.0, le=10000.0)
class SupplierSelectionSettings(BaseModel):
"""Supplier selection settings"""
price_weight: float = Field(0.40, ge=0.0, le=1.0)
lead_time_weight: float = Field(0.20, ge=0.0, le=1.0)
quality_weight: float = Field(0.20, ge=0.0, le=1.0)
reliability_weight: float = Field(0.20, ge=0.0, le=1.0)
diversification_threshold: int = Field(1000, ge=0, le=1000)
max_single_percentage: float = Field(0.70, ge=0.0, le=1.0)
enable_supplier_score_optimization: bool = True
@validator('price_weight', 'lead_time_weight', 'quality_weight', 'reliability_weight')
def validate_weights_sum(cls, v, values):
weights = [values.get('price_weight', 0.40), values.get('lead_time_weight', 0.20),
values.get('quality_weight', 0.20), values.get('reliability_weight', 0.20)]
total = sum(weights)
if total > 1.0:
raise ValueError('Weights must sum to 1.0 or less')
return v
# ================================================================
# REQUEST/RESPONSE SCHEMAS
# ================================================================
@@ -157,6 +206,10 @@ class TenantSettingsResponse(BaseModel):
supplier_settings: SupplierSettings
pos_settings: POSSettings
order_settings: OrderSettings
replenishment_settings: ReplenishmentSettings
safety_stock_settings: SafetyStockSettings
moq_settings: MOQSettings
supplier_selection_settings: SupplierSelectionSettings
created_at: datetime
updated_at: datetime
@@ -172,6 +225,10 @@ class TenantSettingsUpdate(BaseModel):
supplier_settings: Optional[SupplierSettings] = None
pos_settings: Optional[POSSettings] = None
order_settings: Optional[OrderSettings] = None
replenishment_settings: Optional[ReplenishmentSettings] = None
safety_stock_settings: Optional[SafetyStockSettings] = None
moq_settings: Optional[MOQSettings] = None
supplier_selection_settings: Optional[SupplierSelectionSettings] = None
class CategoryUpdateRequest(BaseModel):