feat(pl): add GET transport/plan/contract-gaps endpoint
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
211156a94c
commit
d1d7425eeb
12 files changed
+5122
-3643
No files matched your search
@@ -32,6 +32,7 @@ from app.schemas.pl.plan import (
|
||||
CreateFromContractRequest,
|
||||
PlanArchiveBody,
|
||||
PlanArchiveBrandQtyItem,
|
||||
PlanContractGapListResponse,
|
||||
PlanCreate,
|
||||
PlanCreateFull,
|
||||
PlanDriverFeedbackUpdateBody,
|
||||
@@ -48,6 +49,7 @@ from app.schemas.pl.plan import (
|
||||
PlanUpdate,
|
||||
PlanWithProducts,
|
||||
)
|
||||
from app.services.pl_plan_contract_gap import list_plan_contract_gaps
|
||||
from app.services.pl_brand_archive import load_brand_qtys_by_plan_product_ids
|
||||
from app.services.pl_product_display import (
|
||||
load_crm_product_alias_maps,
|
||||
@@ -508,6 +510,47 @@ def count_plans_by_contract(
|
||||
return {"counts": counts}
|
||||
|
||||
|
||||
@router.get("/contract-gaps", response_model=PlanContractGapListResponse)
|
||||
def list_contract_gaps(
|
||||
page: int = Query(default=1, ge=1),
|
||||
page_size: int = Query(default=20, ge=1, le=100, alias="pageSize"),
|
||||
plan_no: Optional[str] = Query(default=None, alias="planNo", description="计划编号"),
|
||||
gap_type: Optional[str] = Query(
|
||||
default=None,
|
||||
alias="gapType",
|
||||
description="缺口类型:supplier | demander | both",
|
||||
),
|
||||
customer_keyword: Optional[str] = Query(
|
||||
default=None,
|
||||
alias="customerKeyword",
|
||||
description="供方或需方名称关键词",
|
||||
),
|
||||
plan_date_from: Optional[date] = Query(default=None, alias="planDateFrom"),
|
||||
plan_date_to: Optional[date] = Query(default=None, alias="planDateTo"),
|
||||
q: Optional[str] = Query(
|
||||
default=None,
|
||||
description="模糊搜索(计划编号/供方名称/需方名称)",
|
||||
),
|
||||
db: Session = Depends(get_db),
|
||||
user: DbUserContext = Depends(get_db_current_user),
|
||||
) -> PlanContractGapListResponse:
|
||||
tenant_no = get_tenant_no(db, user.to_tenant_user_dict())
|
||||
total, items = list_plan_contract_gaps(
|
||||
db,
|
||||
tenant_no=tenant_no,
|
||||
user=user,
|
||||
page=page,
|
||||
page_size=page_size,
|
||||
plan_no=plan_no,
|
||||
gap_type=gap_type,
|
||||
customer_keyword=customer_keyword,
|
||||
plan_date_from=plan_date_from,
|
||||
plan_date_to=plan_date_to,
|
||||
q=q,
|
||||
)
|
||||
return PlanContractGapListResponse(total=total, list=items)
|
||||
|
||||
|
||||
# =============================================================================
|
||||
# 创建计划
|
||||
# =============================================================================
|
||||
|
||||
Reference in new issue
Block a user