feat: 同步本地未提交的前后端更新(plan/quality/material/inspection/production 等模块)

This commit is contained in:
2026-06-20 18:19:06 +08:00
parent 970afe10b4
commit db3945c263
19 changed files with 1681 additions and 961 deletions

View File

@@ -5,7 +5,7 @@ from typing import Optional
from datetime import datetime
from app.database import get_db
from app.models.plan import ProductionPlan, PlanStatus
from app.models.plan import ProductionPlan
from app.schemas.plan import PlanCreate, PlanUpdate, PlanOut
from app.schemas.common import Response, PageResponse
from app.services.auth_service import get_current_user
@@ -34,10 +34,7 @@ async def list_plans(
):
query = select(ProductionPlan).order_by(desc(ProductionPlan.plan_date))
if status:
try:
query = query.where(ProductionPlan.status == PlanStatus(status))
except ValueError:
pass
query = query.where(ProductionPlan.status == status)
_sd = _parse_dt(start_date)
if _sd:
query = query.where(ProductionPlan.plan_date >= _sd)
@@ -98,6 +95,6 @@ async def confirm_plan(plan_id: int, db: AsyncSession = Depends(get_db), _ = Dep
plan = result.scalar_one_or_none()
if not plan:
raise HTTPException(status_code=404, detail="计划不存在")
plan.status = PlanStatus.CONFIRMED
plan.status = "online"
await db.flush()
return Response.ok(PlanOut.model_validate(plan))