refactor: 宏观状态统一(待仓库收货/已入库)废弃"在库"; WIP矩阵返回product_name并新增下钻明细

This commit is contained in:
2026-09-02 10:38:49 +08:00
parent e194b97649
commit 3019653dfa
6 changed files with 199 additions and 19 deletions

View File

@ -13,6 +13,7 @@ from app.services.dashboard_service import (
get_user_operations, UserOperation,
get_user_operation_detail, OperationDetail,
get_wip_matrix, WipMatrixRow,
get_wip_matrix_detail, WipMatrixDetailRow,
get_people_workload, PersonWorkload,
get_people_history, PersonHistoryRecord,
search_product_messages, ProductMessageList,
@ -108,12 +109,26 @@ async def wip_matrix(
until: str | None = Query(None, description="截止日期 ISO"),
db: AsyncSession = Depends(get_db),
):
"""生产分布透视表 — 规格型号 × 人员/工序 的设备数量交叉聚合(含在库/完成"""
"""生产分布透视表 — 规格型号 × 人员/工序 的设备数量交叉聚合(含已完成/已入库/已出库"""
since_dt = datetime.fromisoformat(since) if since else None
until_dt = datetime.fromisoformat(until) if until else None
return await get_wip_matrix(db, dimension=dimension, since=since_dt, until=until_dt)
@router.get("/wip-matrix/detail", response_model=list[WipMatrixDetailRow])
async def wip_matrix_detail(
spec: str = Query(..., description="规格型号"),
process: str = Query(..., description="当前工序dimension_key"),
since: str | None = Query(None, description="起始日期 ISO"),
until: str | None = Query(None, description="截止日期 ISO"),
db: AsyncSession = Depends(get_db),
):
"""WIP 矩阵单元格下钻 — 返回某 规格型号×工序 交叉点下的设备明细"""
since_dt = datetime.fromisoformat(since) if since else None
until_dt = datetime.fromisoformat(until) if until else None
return await get_wip_matrix_detail(db, spec_model=spec, process=process, since=since_dt, until=until_dt)
@router.get("/people-workload", response_model=list[PersonWorkload])
async def people_workload(
db: AsyncSession = Depends(get_db),

View File

@ -125,7 +125,7 @@ async def delete_product_endpoint(
# ============================================================
class OverallStatusUpdate(BaseModel):
status: str = Field(..., min_length=1, max_length=20, description="宏观状态: 备货/生产/测试/维修/")
status: str = Field(..., min_length=1, max_length=20, description="宏观状态: 备货/生产/测试/维修/待仓库收货/已入库/已出")
@router.patch("/scan/{serial_number}/status", response_model=ProductScanResponse)
@ -138,7 +138,7 @@ async def update_product_overall_status(
"""
更新产品宏观流转状态。
移动端首次扫码或手动切换时调用。
合法值: 备货 | 生产 | 测试 | 维修 |
合法值: 备货 | 生产 | 测试 | 维修 | 待仓库收货 | 已入库 | 已出
权限:仅 SUPER_ADMIN 或当前操作该产品主线任务的人可以修改。
"""