Improve the sales import
This commit is contained in:
@@ -257,11 +257,11 @@ class InventoryServiceClient(BaseServiceClient):
|
||||
# ================================================================
|
||||
# PRODUCT CLASSIFICATION (for onboarding)
|
||||
# ================================================================
|
||||
|
||||
|
||||
async def classify_product(
|
||||
self,
|
||||
product_name: str,
|
||||
sales_volume: Optional[float],
|
||||
self,
|
||||
product_name: str,
|
||||
sales_volume: Optional[float],
|
||||
tenant_id: str
|
||||
) -> Optional[Dict[str, Any]]:
|
||||
"""Classify a single product for inventory creation"""
|
||||
@@ -270,24 +270,24 @@ class InventoryServiceClient(BaseServiceClient):
|
||||
"product_name": product_name,
|
||||
"sales_volume": sales_volume
|
||||
}
|
||||
|
||||
|
||||
result = await self.post("inventory/operations/classify-product", data=classification_data, tenant_id=tenant_id)
|
||||
if result:
|
||||
logger.info("Classified product",
|
||||
product=product_name,
|
||||
logger.info("Classified product",
|
||||
product=product_name,
|
||||
classification=result.get('product_type'),
|
||||
confidence=result.get('confidence_score'),
|
||||
tenant_id=tenant_id)
|
||||
return result
|
||||
|
||||
|
||||
except Exception as e:
|
||||
logger.error("Error classifying product",
|
||||
logger.error("Error classifying product",
|
||||
error=str(e), product=product_name, tenant_id=tenant_id)
|
||||
return None
|
||||
|
||||
|
||||
async def classify_products_batch(
|
||||
self,
|
||||
products: List[Dict[str, Any]],
|
||||
self,
|
||||
products: List[Dict[str, Any]],
|
||||
tenant_id: str
|
||||
) -> Optional[Dict[str, Any]]:
|
||||
"""Classify multiple products for onboarding automation"""
|
||||
@@ -295,20 +295,51 @@ class InventoryServiceClient(BaseServiceClient):
|
||||
classification_data = {
|
||||
"products": products
|
||||
}
|
||||
|
||||
|
||||
result = await self.post("inventory/operations/classify-products-batch", data=classification_data, tenant_id=tenant_id)
|
||||
if result:
|
||||
suggestions = result.get('suggestions', [])
|
||||
business_model = result.get('business_model_analysis', {}).get('model', 'unknown')
|
||||
|
||||
logger.info("Batch classification complete",
|
||||
|
||||
logger.info("Batch classification complete",
|
||||
total_products=len(suggestions),
|
||||
business_model=business_model,
|
||||
tenant_id=tenant_id)
|
||||
return result
|
||||
|
||||
|
||||
except Exception as e:
|
||||
logger.error("Error in batch classification",
|
||||
logger.error("Error in batch classification",
|
||||
error=str(e), products_count=len(products), tenant_id=tenant_id)
|
||||
return None
|
||||
|
||||
async def resolve_or_create_products_batch(
|
||||
self,
|
||||
products: List[Dict[str, Any]],
|
||||
tenant_id: str
|
||||
) -> Optional[Dict[str, Any]]:
|
||||
"""Resolve or create multiple products in a single batch operation"""
|
||||
try:
|
||||
batch_data = {
|
||||
"products": products
|
||||
}
|
||||
|
||||
result = await self.post("inventory/operations/resolve-or-create-products-batch",
|
||||
data=batch_data, tenant_id=tenant_id)
|
||||
if result:
|
||||
created = result.get('created_count', 0)
|
||||
resolved = result.get('resolved_count', 0)
|
||||
failed = result.get('failed_count', 0)
|
||||
|
||||
logger.info("Batch product resolution complete",
|
||||
created=created,
|
||||
resolved=resolved,
|
||||
failed=failed,
|
||||
total=len(products),
|
||||
tenant_id=tenant_id)
|
||||
return result
|
||||
|
||||
except Exception as e:
|
||||
logger.error("Error in batch product resolution",
|
||||
error=str(e), products_count=len(products), tenant_id=tenant_id)
|
||||
return None
|
||||
|
||||
|
||||
@@ -266,6 +266,11 @@ class PlanFeatures:
|
||||
'seasonal_patterns',
|
||||
'longer_forecast_horizon',
|
||||
|
||||
# Scenario Analysis (Professional+)
|
||||
'scenario_modeling',
|
||||
'what_if_analysis',
|
||||
'risk_assessment',
|
||||
|
||||
# Integration
|
||||
'pos_integration',
|
||||
'accounting_export',
|
||||
@@ -279,9 +284,6 @@ class PlanFeatures:
|
||||
# ===== Enterprise Tier Features =====
|
||||
ENTERPRISE_FEATURES = PROFESSIONAL_FEATURES + [
|
||||
# Advanced ML & AI
|
||||
'scenario_modeling',
|
||||
'what_if_analysis',
|
||||
'risk_assessment',
|
||||
'advanced_ml_parameters',
|
||||
'model_artifacts_access',
|
||||
'custom_algorithms',
|
||||
|
||||
Reference in New Issue
Block a user