feat(mes): AGV挂起动作引擎 + 智能跟车流转 + PLC快照缓存(2026-11-19 主控拍板)
一、AGV 挂起动作引擎(弃显式任务队列、弃并发硬拒) - 新增 internal/logic/agv_pending.go:待发动作直接挂任务(pending_action + pending_since), CONTINUE_LIFT(举升完成→continueTask#1)/ WAIT_DROP_CONFIRM(人工确认放下→continueTask#2) / FREE_ROBOT(末组完成→freeRobot);系统动作超 60s 未触发转预警人工重试,绝不自动重发 - Client 新增 ContinueTask(RCS 2.1.2) / FreeRobot(3.1.2),仅点名释放指定车,禁止释放全部 - agv_task 增 pending_action/pending_since 字段,ent 重生成 + db.go 幂等迁移补丁 + migrateonce - 回调按 B01/B02/C01 模板编排:业务流转到位即自动放行放下、回调自动放车; 仅人工派车(MANUAL)挂 WAIT_DROP_CONFIRM;新增 /agv/confirm-drop、/agv/pending/retry - 前端 AgvManual/Agv 确认放下、挂起重试按钮与等待提示联动 二、智能跟车 + 动态目标截断流转引擎 - 新增 internal/logic/flow_engine.go:事件驱动(报工/扫码),读 48 位物理快照,从下游往上游算, 前方占用则动态截断到最近空闲缓存位;IN_TRANSIT 在途闭锁防重复下发,MW=0 才确认到位落台账; 主线占用=台账 OR 传感器,工位 G 位只认台账;在途超 5s 落预警 - workpiece 增 flow_transit_mw/target/at 字段,ent 重生成 + 迁移补丁 三、PLC 读取优化与诊断 - 新增 internal/plc/snapshot_cache.go:2s TTL + singleflight + 写失效,合并 SSE/PLC监控/流转引擎 的重复点位读取;tcp.go 读块重构、localip.go 多网卡、plcdiag 诊断工具、plc_monitor/logging 配套 四、文档与前端 - help.js 重写「工位下发」帮助:明确报工自动驱动流转 vs 下发路线码的定位、缺料/握手/撤回边界 - 案例.md 补充定稿说明;public/index.html 构建指纹更新
This commit is contained in:
@@ -292,6 +292,41 @@ func (_u *AgvTaskUpdate) AddArrivedAt(v int64) *AgvTaskUpdate {
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetPendingAction sets the "pending_action" field.
|
||||
func (_u *AgvTaskUpdate) SetPendingAction(v string) *AgvTaskUpdate {
|
||||
_u.mutation.SetPendingAction(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillablePendingAction sets the "pending_action" field if the given value is not nil.
|
||||
func (_u *AgvTaskUpdate) SetNillablePendingAction(v *string) *AgvTaskUpdate {
|
||||
if v != nil {
|
||||
_u.SetPendingAction(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetPendingSince sets the "pending_since" field.
|
||||
func (_u *AgvTaskUpdate) SetPendingSince(v int64) *AgvTaskUpdate {
|
||||
_u.mutation.ResetPendingSince()
|
||||
_u.mutation.SetPendingSince(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillablePendingSince sets the "pending_since" field if the given value is not nil.
|
||||
func (_u *AgvTaskUpdate) SetNillablePendingSince(v *int64) *AgvTaskUpdate {
|
||||
if v != nil {
|
||||
_u.SetPendingSince(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// AddPendingSince adds value to the "pending_since" field.
|
||||
func (_u *AgvTaskUpdate) AddPendingSince(v int64) *AgvTaskUpdate {
|
||||
_u.mutation.AddPendingSince(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetRemark sets the "remark" field.
|
||||
func (_u *AgvTaskUpdate) SetRemark(v string) *AgvTaskUpdate {
|
||||
_u.mutation.SetRemark(v)
|
||||
@@ -437,6 +472,11 @@ func (_u *AgvTaskUpdate) check() error {
|
||||
return &ValidationError{Name: "operator", err: fmt.Errorf(`ent: validator failed for field "AgvTask.operator": %w`, err)}
|
||||
}
|
||||
}
|
||||
if v, ok := _u.mutation.PendingAction(); ok {
|
||||
if err := agvtask.PendingActionValidator(v); err != nil {
|
||||
return &ValidationError{Name: "pending_action", err: fmt.Errorf(`ent: validator failed for field "AgvTask.pending_action": %w`, err)}
|
||||
}
|
||||
}
|
||||
if v, ok := _u.mutation.Remark(); ok {
|
||||
if err := agvtask.RemarkValidator(v); err != nil {
|
||||
return &ValidationError{Name: "remark", err: fmt.Errorf(`ent: validator failed for field "AgvTask.remark": %w`, err)}
|
||||
@@ -526,6 +566,15 @@ func (_u *AgvTaskUpdate) sqlSave(ctx context.Context) (_node int, err error) {
|
||||
if value, ok := _u.mutation.AddedArrivedAt(); ok {
|
||||
_spec.AddField(agvtask.FieldArrivedAt, field.TypeInt64, value)
|
||||
}
|
||||
if value, ok := _u.mutation.PendingAction(); ok {
|
||||
_spec.SetField(agvtask.FieldPendingAction, field.TypeString, value)
|
||||
}
|
||||
if value, ok := _u.mutation.PendingSince(); ok {
|
||||
_spec.SetField(agvtask.FieldPendingSince, field.TypeInt64, value)
|
||||
}
|
||||
if value, ok := _u.mutation.AddedPendingSince(); ok {
|
||||
_spec.AddField(agvtask.FieldPendingSince, field.TypeInt64, value)
|
||||
}
|
||||
if value, ok := _u.mutation.Remark(); ok {
|
||||
_spec.SetField(agvtask.FieldRemark, field.TypeString, value)
|
||||
}
|
||||
@@ -824,6 +873,41 @@ func (_u *AgvTaskUpdateOne) AddArrivedAt(v int64) *AgvTaskUpdateOne {
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetPendingAction sets the "pending_action" field.
|
||||
func (_u *AgvTaskUpdateOne) SetPendingAction(v string) *AgvTaskUpdateOne {
|
||||
_u.mutation.SetPendingAction(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillablePendingAction sets the "pending_action" field if the given value is not nil.
|
||||
func (_u *AgvTaskUpdateOne) SetNillablePendingAction(v *string) *AgvTaskUpdateOne {
|
||||
if v != nil {
|
||||
_u.SetPendingAction(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetPendingSince sets the "pending_since" field.
|
||||
func (_u *AgvTaskUpdateOne) SetPendingSince(v int64) *AgvTaskUpdateOne {
|
||||
_u.mutation.ResetPendingSince()
|
||||
_u.mutation.SetPendingSince(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillablePendingSince sets the "pending_since" field if the given value is not nil.
|
||||
func (_u *AgvTaskUpdateOne) SetNillablePendingSince(v *int64) *AgvTaskUpdateOne {
|
||||
if v != nil {
|
||||
_u.SetPendingSince(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// AddPendingSince adds value to the "pending_since" field.
|
||||
func (_u *AgvTaskUpdateOne) AddPendingSince(v int64) *AgvTaskUpdateOne {
|
||||
_u.mutation.AddPendingSince(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetRemark sets the "remark" field.
|
||||
func (_u *AgvTaskUpdateOne) SetRemark(v string) *AgvTaskUpdateOne {
|
||||
_u.mutation.SetRemark(v)
|
||||
@@ -982,6 +1066,11 @@ func (_u *AgvTaskUpdateOne) check() error {
|
||||
return &ValidationError{Name: "operator", err: fmt.Errorf(`ent: validator failed for field "AgvTask.operator": %w`, err)}
|
||||
}
|
||||
}
|
||||
if v, ok := _u.mutation.PendingAction(); ok {
|
||||
if err := agvtask.PendingActionValidator(v); err != nil {
|
||||
return &ValidationError{Name: "pending_action", err: fmt.Errorf(`ent: validator failed for field "AgvTask.pending_action": %w`, err)}
|
||||
}
|
||||
}
|
||||
if v, ok := _u.mutation.Remark(); ok {
|
||||
if err := agvtask.RemarkValidator(v); err != nil {
|
||||
return &ValidationError{Name: "remark", err: fmt.Errorf(`ent: validator failed for field "AgvTask.remark": %w`, err)}
|
||||
@@ -1088,6 +1177,15 @@ func (_u *AgvTaskUpdateOne) sqlSave(ctx context.Context) (_node *AgvTask, err er
|
||||
if value, ok := _u.mutation.AddedArrivedAt(); ok {
|
||||
_spec.AddField(agvtask.FieldArrivedAt, field.TypeInt64, value)
|
||||
}
|
||||
if value, ok := _u.mutation.PendingAction(); ok {
|
||||
_spec.SetField(agvtask.FieldPendingAction, field.TypeString, value)
|
||||
}
|
||||
if value, ok := _u.mutation.PendingSince(); ok {
|
||||
_spec.SetField(agvtask.FieldPendingSince, field.TypeInt64, value)
|
||||
}
|
||||
if value, ok := _u.mutation.AddedPendingSince(); ok {
|
||||
_spec.AddField(agvtask.FieldPendingSince, field.TypeInt64, value)
|
||||
}
|
||||
if value, ok := _u.mutation.Remark(); ok {
|
||||
_spec.SetField(agvtask.FieldRemark, field.TypeString, value)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user