New enterprise feature
This commit is contained in:
@@ -54,8 +54,8 @@ structlog.configure(
|
||||
logger = structlog.get_logger()
|
||||
|
||||
# Fixed Demo Tenant IDs (must match tenant service)
|
||||
DEMO_TENANT_SAN_PABLO = uuid.UUID("a1b2c3d4-e5f6-47a8-b9c0-d1e2f3a4b5c6") # Individual bakery
|
||||
DEMO_TENANT_LA_ESPIGA = uuid.UUID("b2c3d4e5-f6a7-48b9-c0d1-e2f3a4b5c6d7") # Central bakery
|
||||
DEMO_TENANT_PROFESSIONAL = uuid.UUID("a1b2c3d4-e5f6-47a8-b9c0-d1e2f3a4b5c6") # Individual bakery
|
||||
DEMO_TENANT_ENTERPRISE_CHAIN = uuid.UUID("c3d4e5f6-a7b8-49c0-d1e2-f3a4b5c6d7e8") # Enterprise parent (Obrador)
|
||||
|
||||
# Hardcoded SKU to Ingredient ID mapping (no database lookups needed!)
|
||||
INGREDIENT_ID_MAP = {
|
||||
@@ -128,7 +128,7 @@ def weighted_choice(choices: list) -> dict:
|
||||
|
||||
def generate_plan_number(tenant_id: uuid.UUID, index: int, plan_type: str) -> str:
|
||||
"""Generate a unique plan number"""
|
||||
tenant_prefix = "SP" if tenant_id == DEMO_TENANT_SAN_PABLO else "LE"
|
||||
tenant_prefix = "SP" if tenant_id == DEMO_TENANT_PROFESSIONAL else "LE"
|
||||
type_code = plan_type[0:3].upper()
|
||||
return f"PROC-{tenant_prefix}-{type_code}-{BASE_REFERENCE_DATE.year}-{index:03d}"
|
||||
|
||||
@@ -487,7 +487,8 @@ async def seed_all(db: AsyncSession):
|
||||
"requirements_per_plan": {"min": 3, "max": 8},
|
||||
"planning_horizon_days": {
|
||||
"individual_bakery": 30,
|
||||
"central_bakery": 45
|
||||
"central_bakery": 45,
|
||||
"enterprise_chain": 45 # Enterprise parent uses same horizon as central bakery
|
||||
},
|
||||
"safety_stock_percentage": {"min": 15.0, "max": 25.0},
|
||||
"temporal_distribution": {
|
||||
@@ -561,25 +562,25 @@ async def seed_all(db: AsyncSession):
|
||||
|
||||
results = []
|
||||
|
||||
# Seed San Pablo (Individual Bakery)
|
||||
result_san_pablo = await generate_procurement_for_tenant(
|
||||
# Seed Professional Bakery (single location)
|
||||
result_professional = await generate_procurement_for_tenant(
|
||||
db,
|
||||
DEMO_TENANT_SAN_PABLO,
|
||||
"Panadería San Pablo (Individual Bakery)",
|
||||
DEMO_TENANT_PROFESSIONAL,
|
||||
"Panadería Artesana Madrid (Professional)",
|
||||
"individual_bakery",
|
||||
config
|
||||
)
|
||||
results.append(result_san_pablo)
|
||||
results.append(result_professional)
|
||||
|
||||
# Seed La Espiga (Central Bakery)
|
||||
result_la_espiga = await generate_procurement_for_tenant(
|
||||
# Seed Enterprise Parent (central production - Obrador) with scaled procurement
|
||||
result_enterprise_parent = await generate_procurement_for_tenant(
|
||||
db,
|
||||
DEMO_TENANT_LA_ESPIGA,
|
||||
"Panadería La Espiga (Central Bakery)",
|
||||
"central_bakery",
|
||||
DEMO_TENANT_ENTERPRISE_CHAIN,
|
||||
"Panadería Central - Obrador Madrid (Enterprise Parent)",
|
||||
"enterprise_chain",
|
||||
config
|
||||
)
|
||||
results.append(result_la_espiga)
|
||||
results.append(result_enterprise_parent)
|
||||
|
||||
total_plans = sum(r["plans_created"] for r in results)
|
||||
total_requirements = sum(r["requirements_created"] for r in results)
|
||||
|
||||
Reference in New Issue
Block a user