feat(linkage): 鞍座自动投入生产 + 实绩生产阶段数据 + 去掉口语化提示

- 产线空闲时自动把上卷鞍座预备卷投入生产;产线在产则等上一卷完成生成实绩后自动进入
- 引擎循环间隔降到5s,自动推进更及时
- 实绩页:ProductionRecordOut 增加生产阶段字段;点击行在下方展示生产阶段数据
- 移除入口跟踪/物料跟踪/成本页的口语化提示小字

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-06-29 15:30:30 +08:00
parent 62c484411e
commit 4567b87314
6 changed files with 67 additions and 9 deletions

View File

@@ -81,6 +81,19 @@ class ProductionRecordOut(BaseModel):
offline_time: Optional[datetime] = None
status: Optional[str] = None
remark: Optional[str] = None
# 生产阶段数据
shift_date: Optional[datetime] = None
start_time: Optional[datetime] = None
end_time: Optional[datetime] = None
process_length: Optional[float] = None
process_weight: Optional[float] = None
avg_speed: Optional[float] = None
max_speed: Optional[float] = None
acid_consumption: Optional[float] = None
inlet_thickness: Optional[float] = None
inlet_width: Optional[float] = None
quality_grade: Optional[str] = None
operator: Optional[str] = None
created_at: datetime
class Config:

View File

@@ -212,13 +212,25 @@ async def detect_downtime(db: AsyncSession):
logger.info("自动检测到停机,已新增待补充停机记录")
async def auto_commit_saddle(db: AsyncSession):
"""产线空闲(无在产卷)且上卷鞍座有预备卷 → 自动投入生产(无需人工点击)。"""
res = await db.execute(select(ProductionPlan).where(ProductionPlan.status == "producing"))
if res.scalars().first() is not None:
return # 产线占用:鞍座预备卷等待上一卷生产完成
saddle = await _saddle_plan(db)
if saddle is None:
return
await commit_plan(db, saddle)
async def tick(db: AsyncSession):
"""引擎单步:推进在产卷 + 停机检测(在线为人工触发,不自动上线)"""
"""引擎单步:推进在产卷 → 产线空闲则自动投入鞍座预备卷 → 停机检测"""
await advance_production(db)
await auto_commit_saddle(db)
await detect_downtime(db)
async def run_engine_loop(interval_s: int = 15):
async def run_engine_loop(interval_s: int = 5):
"""后台循环,使联动在无人查看时也能自动推进。"""
import asyncio
from app.database import AsyncSessionLocal