feat: 大屏新增虚拟工位滚动栏与多订单轮播,附件表增加删除原因及彻底清除留痕字段
This commit is contained in:
@@ -108,7 +108,12 @@ type FrontDashboard struct {
|
||||
Production FrontProduction `json:"production"`
|
||||
Warehouse FrontWarehouse `json:"warehouse"`
|
||||
Equipment []FrontStation `json:"equipment"`
|
||||
// VirtualStations 虚拟工位(OFFLINE,不连PLC):地图"虚拟工位"滚动栏展示,不混入 equipment(12 工位映射口径不变)
|
||||
VirtualStations []FrontStation `json:"virtualStations"`
|
||||
Progress FrontProgress `json:"progress"`
|
||||
// ProgressList 当前在产订单列表(多订单轮播):进行中的工单排前,最多 6 条;
|
||||
// 首条与 Progress 一致(老消费方可继续只用 progress)。
|
||||
ProgressList []FrontProgress `json:"progressList"`
|
||||
Traces []TraceItem `json:"traces"`
|
||||
Trends FrontTrends `json:"trends"`
|
||||
// Points 产线点位态(主线 15 位 / 接驳台 21 位 / 在途路径指令),驱动 2D 地图真实亮灭与流光
|
||||
@@ -179,6 +184,34 @@ func (s *Service) mapFrontDashboard(ctx context.Context, r *DashboardSnapshot) *
|
||||
})
|
||||
}
|
||||
f.Equipment = equipment
|
||||
|
||||
// -------- 虚拟工位(OFFLINE):同构映射,但不计入设备在线/总数口径 --------
|
||||
f.VirtualStations = make([]FrontStation, 0, len(r.VirtualEquipment))
|
||||
for _, st := range r.VirtualEquipment {
|
||||
tool := "online"
|
||||
switch st.Status {
|
||||
case "running":
|
||||
tool = "busy"
|
||||
case "alarm":
|
||||
tool = "alarm"
|
||||
case "offline":
|
||||
tool = "offline"
|
||||
}
|
||||
f.VirtualStations = append(f.VirtualStations, FrontStation{
|
||||
ID: st.StationNo,
|
||||
Name: st.Name,
|
||||
Status: st.Status,
|
||||
ScanGun: FrontToolState{Status: tool, ProcessedCount: st.DoneToday},
|
||||
TighteningGun: FrontToolState{Status: tool, CurrentSn: st.CurrentSn, ProcessedCount: st.DoneToday},
|
||||
CurrentSn: st.CurrentSn,
|
||||
CurrentOperator: st.CurrentOperator,
|
||||
CurrentProcess: st.CurrentProcess,
|
||||
DoneCount: st.DoneToday,
|
||||
Paused: st.Paused,
|
||||
PauseReason: st.PauseReason,
|
||||
})
|
||||
}
|
||||
|
||||
f.Production = FrontProduction{
|
||||
OutputToday: r.Production.OutputToday,
|
||||
TargetToday: r.Production.TargetToday,
|
||||
@@ -241,6 +274,29 @@ func (s *Service) mapFrontDashboard(ctx context.Context, r *DashboardSnapshot) *
|
||||
pr.Traceable = stepCount > 0 && allOk
|
||||
f.Progress = pr
|
||||
|
||||
// -------- 多订单列表(轮播):进行中工单排前,最多 6 条,首条与 progress 一致 --------
|
||||
f.ProgressList = make([]FrontProgress, 0, len(r.Production.WorkOrders))
|
||||
for i, wo := range r.Production.WorkOrders {
|
||||
if i >= 6 {
|
||||
break
|
||||
}
|
||||
f.ProgressList = append(f.ProgressList, FrontProgress{
|
||||
OrderNo: wo.OrderNo,
|
||||
ProductName: wo.ProductName,
|
||||
TotalQty: wo.TotalQty,
|
||||
DoneQty: wo.DoneQty,
|
||||
Progress: wo.Progress,
|
||||
Status: wo.Status,
|
||||
CurrentProcess: wo.CurrentProcess,
|
||||
PlanStart: shortDate(wo.PlanStart),
|
||||
PlanEnd: shortDate(wo.PlanEnd),
|
||||
RemainDays: remainDays(wo.PlanEnd),
|
||||
ProcessTotal: 12,
|
||||
TraceStepCount: stepCount,
|
||||
Traceable: stepCount > 0 && allOk,
|
||||
})
|
||||
}
|
||||
|
||||
// -------- traces / trends / points / agv / events --------
|
||||
f.Traces = r.Trace.Recent
|
||||
if f.Traces == nil {
|
||||
|
||||
Reference in New Issue
Block a user