xx
This commit is contained in:
@@ -12,6 +12,8 @@ from shared.models.database import User
|
||||
from ..schemas import (
|
||||
PurchaseDemandCalculateRequest,
|
||||
PurchaseDemandResponse,
|
||||
PurchaseDemandConvertRequest,
|
||||
PurchaseDemandConvertResponse,
|
||||
)
|
||||
from ..services.purchase_demand_service import purchase_demand_service
|
||||
|
||||
@@ -26,3 +28,13 @@ async def calculate_purchase_demands(
|
||||
):
|
||||
"""根据销售订单 ID 列表,自动推导采购需求(BOM 展开 → 库存对比 → 供应商推荐)"""
|
||||
return await purchase_demand_service.calculate_demands(db_session, payload.sales_order_ids)
|
||||
|
||||
|
||||
@router.post("/convert", response_model=PurchaseDemandConvertResponse)
|
||||
async def convert_purchase_demands(
|
||||
payload: PurchaseDemandConvertRequest,
|
||||
db_session: AsyncSession = Depends(get_db_session),
|
||||
current_user: User = Depends(get_current_active_user),
|
||||
):
|
||||
"""将采购需求一键转换为采购单(按供应商分组,每组生成一张草稿采购单)"""
|
||||
return await purchase_demand_service.convert_to_purchase_orders(db_session, payload, current_user)
|
||||
|
||||
Reference in New Issue
Block a user