feat: AGV三段链安全机制、补料/损耗/下班闭环、接驳台左右互换

AGV 调度:
- 任务重构为 GO_LOAD/TRANSPORT/EMPTY_RETURN/FREE 三段链,到位即停(ARRIVED)需人工确认装卸
- 自由调度单点步进,每段强制弹"请确保路径畅通无杂物";托盘回收独立工作台
- 接驳台 PLC 传感器检测到托盘即自动卸货放行,传感器故障由人工按钮兜底(无轮询)
- 车辆状态只读展示(海康3.1.7 queryAgvStatus),调度仍由 RCS 负责

物料闭环:
- 补料管理(SHORTAGE):工位申请 + 主管审批调增叫料池额度,与借料/差异补发三轨并行
- 损耗台账(loss_ledger):退料实际 < 理论必填原因、后审核,工单不记损耗
- 退料强制指定左/右接驳台,WMS 库管可代工位退料

下班闭环:
- 工位终端自检接驳台剩余物料后下班;库管收货 + 托盘拉走后事件驱动自动结班
- 退出登录未下班仅作安全提示(不强制拦截、不新增责任审批)

接驳台左右按操作员朝向建模(dock.side 字段),废除"奇左偶右"隐式约定;
看板标签 / seed / 迁移补丁 / 布局文档统一为中文左/右。

产线布局说明:C1 前线头 AGV 点、C15 后线尾 AGV 点、外部 O1/O2/O3 散点,
清理修订痕迹为最终态描述。
This commit is contained in:
SunYF
2026-11-03 18:29:31 +08:00
parent 2ccf9bb9ca
commit 42bcf395d2
123 changed files with 19472 additions and 247 deletions
+254
View File
@@ -152,6 +152,90 @@ func (_u *AgvTaskUpdate) SetNillableStatus(v *string) *AgvTaskUpdate {
return _u
}
// SetKind sets the "kind" field.
func (_u *AgvTaskUpdate) SetKind(v string) *AgvTaskUpdate {
_u.mutation.SetKind(v)
return _u
}
// SetNillableKind sets the "kind" field if the given value is not nil.
func (_u *AgvTaskUpdate) SetNillableKind(v *string) *AgvTaskUpdate {
if v != nil {
_u.SetKind(*v)
}
return _u
}
// SetBizType sets the "biz_type" field.
func (_u *AgvTaskUpdate) SetBizType(v string) *AgvTaskUpdate {
_u.mutation.SetBizType(v)
return _u
}
// SetNillableBizType sets the "biz_type" field if the given value is not nil.
func (_u *AgvTaskUpdate) SetNillableBizType(v *string) *AgvTaskUpdate {
if v != nil {
_u.SetBizType(*v)
}
return _u
}
// SetBizNo sets the "biz_no" field.
func (_u *AgvTaskUpdate) SetBizNo(v string) *AgvTaskUpdate {
_u.mutation.SetBizNo(v)
return _u
}
// SetNillableBizNo sets the "biz_no" field if the given value is not nil.
func (_u *AgvTaskUpdate) SetNillableBizNo(v *string) *AgvTaskUpdate {
if v != nil {
_u.SetBizNo(*v)
}
return _u
}
// SetChainNo sets the "chain_no" field.
func (_u *AgvTaskUpdate) SetChainNo(v string) *AgvTaskUpdate {
_u.mutation.SetChainNo(v)
return _u
}
// SetNillableChainNo sets the "chain_no" field if the given value is not nil.
func (_u *AgvTaskUpdate) SetNillableChainNo(v *string) *AgvTaskUpdate {
if v != nil {
_u.SetChainNo(*v)
}
return _u
}
// SetAutoEnd sets the "auto_end" field.
func (_u *AgvTaskUpdate) SetAutoEnd(v bool) *AgvTaskUpdate {
_u.mutation.SetAutoEnd(v)
return _u
}
// SetNillableAutoEnd sets the "auto_end" field if the given value is not nil.
func (_u *AgvTaskUpdate) SetNillableAutoEnd(v *bool) *AgvTaskUpdate {
if v != nil {
_u.SetAutoEnd(*v)
}
return _u
}
// SetAgvCode sets the "agv_code" field.
func (_u *AgvTaskUpdate) SetAgvCode(v string) *AgvTaskUpdate {
_u.mutation.SetAgvCode(v)
return _u
}
// SetNillableAgvCode sets the "agv_code" field if the given value is not nil.
func (_u *AgvTaskUpdate) SetNillableAgvCode(v *string) *AgvTaskUpdate {
if v != nil {
_u.SetAgvCode(*v)
}
return _u
}
// SetOperator sets the "operator" field.
func (_u *AgvTaskUpdate) SetOperator(v string) *AgvTaskUpdate {
_u.mutation.SetOperator(v)
@@ -323,6 +407,31 @@ func (_u *AgvTaskUpdate) check() error {
return &ValidationError{Name: "status", err: fmt.Errorf(`ent: validator failed for field "AgvTask.status": %w`, err)}
}
}
if v, ok := _u.mutation.Kind(); ok {
if err := agvtask.KindValidator(v); err != nil {
return &ValidationError{Name: "kind", err: fmt.Errorf(`ent: validator failed for field "AgvTask.kind": %w`, err)}
}
}
if v, ok := _u.mutation.BizType(); ok {
if err := agvtask.BizTypeValidator(v); err != nil {
return &ValidationError{Name: "biz_type", err: fmt.Errorf(`ent: validator failed for field "AgvTask.biz_type": %w`, err)}
}
}
if v, ok := _u.mutation.BizNo(); ok {
if err := agvtask.BizNoValidator(v); err != nil {
return &ValidationError{Name: "biz_no", err: fmt.Errorf(`ent: validator failed for field "AgvTask.biz_no": %w`, err)}
}
}
if v, ok := _u.mutation.ChainNo(); ok {
if err := agvtask.ChainNoValidator(v); err != nil {
return &ValidationError{Name: "chain_no", err: fmt.Errorf(`ent: validator failed for field "AgvTask.chain_no": %w`, err)}
}
}
if v, ok := _u.mutation.AgvCode(); ok {
if err := agvtask.AgvCodeValidator(v); err != nil {
return &ValidationError{Name: "agv_code", err: fmt.Errorf(`ent: validator failed for field "AgvTask.agv_code": %w`, err)}
}
}
if v, ok := _u.mutation.Operator(); ok {
if err := agvtask.OperatorValidator(v); err != nil {
return &ValidationError{Name: "operator", err: fmt.Errorf(`ent: validator failed for field "AgvTask.operator": %w`, err)}
@@ -384,6 +493,24 @@ func (_u *AgvTaskUpdate) sqlSave(ctx context.Context) (_node int, err error) {
if value, ok := _u.mutation.Status(); ok {
_spec.SetField(agvtask.FieldStatus, field.TypeString, value)
}
if value, ok := _u.mutation.Kind(); ok {
_spec.SetField(agvtask.FieldKind, field.TypeString, value)
}
if value, ok := _u.mutation.BizType(); ok {
_spec.SetField(agvtask.FieldBizType, field.TypeString, value)
}
if value, ok := _u.mutation.BizNo(); ok {
_spec.SetField(agvtask.FieldBizNo, field.TypeString, value)
}
if value, ok := _u.mutation.ChainNo(); ok {
_spec.SetField(agvtask.FieldChainNo, field.TypeString, value)
}
if value, ok := _u.mutation.AutoEnd(); ok {
_spec.SetField(agvtask.FieldAutoEnd, field.TypeBool, value)
}
if value, ok := _u.mutation.AgvCode(); ok {
_spec.SetField(agvtask.FieldAgvCode, field.TypeString, value)
}
if value, ok := _u.mutation.Operator(); ok {
_spec.SetField(agvtask.FieldOperator, field.TypeString, value)
}
@@ -557,6 +684,90 @@ func (_u *AgvTaskUpdateOne) SetNillableStatus(v *string) *AgvTaskUpdateOne {
return _u
}
// SetKind sets the "kind" field.
func (_u *AgvTaskUpdateOne) SetKind(v string) *AgvTaskUpdateOne {
_u.mutation.SetKind(v)
return _u
}
// SetNillableKind sets the "kind" field if the given value is not nil.
func (_u *AgvTaskUpdateOne) SetNillableKind(v *string) *AgvTaskUpdateOne {
if v != nil {
_u.SetKind(*v)
}
return _u
}
// SetBizType sets the "biz_type" field.
func (_u *AgvTaskUpdateOne) SetBizType(v string) *AgvTaskUpdateOne {
_u.mutation.SetBizType(v)
return _u
}
// SetNillableBizType sets the "biz_type" field if the given value is not nil.
func (_u *AgvTaskUpdateOne) SetNillableBizType(v *string) *AgvTaskUpdateOne {
if v != nil {
_u.SetBizType(*v)
}
return _u
}
// SetBizNo sets the "biz_no" field.
func (_u *AgvTaskUpdateOne) SetBizNo(v string) *AgvTaskUpdateOne {
_u.mutation.SetBizNo(v)
return _u
}
// SetNillableBizNo sets the "biz_no" field if the given value is not nil.
func (_u *AgvTaskUpdateOne) SetNillableBizNo(v *string) *AgvTaskUpdateOne {
if v != nil {
_u.SetBizNo(*v)
}
return _u
}
// SetChainNo sets the "chain_no" field.
func (_u *AgvTaskUpdateOne) SetChainNo(v string) *AgvTaskUpdateOne {
_u.mutation.SetChainNo(v)
return _u
}
// SetNillableChainNo sets the "chain_no" field if the given value is not nil.
func (_u *AgvTaskUpdateOne) SetNillableChainNo(v *string) *AgvTaskUpdateOne {
if v != nil {
_u.SetChainNo(*v)
}
return _u
}
// SetAutoEnd sets the "auto_end" field.
func (_u *AgvTaskUpdateOne) SetAutoEnd(v bool) *AgvTaskUpdateOne {
_u.mutation.SetAutoEnd(v)
return _u
}
// SetNillableAutoEnd sets the "auto_end" field if the given value is not nil.
func (_u *AgvTaskUpdateOne) SetNillableAutoEnd(v *bool) *AgvTaskUpdateOne {
if v != nil {
_u.SetAutoEnd(*v)
}
return _u
}
// SetAgvCode sets the "agv_code" field.
func (_u *AgvTaskUpdateOne) SetAgvCode(v string) *AgvTaskUpdateOne {
_u.mutation.SetAgvCode(v)
return _u
}
// SetNillableAgvCode sets the "agv_code" field if the given value is not nil.
func (_u *AgvTaskUpdateOne) SetNillableAgvCode(v *string) *AgvTaskUpdateOne {
if v != nil {
_u.SetAgvCode(*v)
}
return _u
}
// SetOperator sets the "operator" field.
func (_u *AgvTaskUpdateOne) SetOperator(v string) *AgvTaskUpdateOne {
_u.mutation.SetOperator(v)
@@ -741,6 +952,31 @@ func (_u *AgvTaskUpdateOne) check() error {
return &ValidationError{Name: "status", err: fmt.Errorf(`ent: validator failed for field "AgvTask.status": %w`, err)}
}
}
if v, ok := _u.mutation.Kind(); ok {
if err := agvtask.KindValidator(v); err != nil {
return &ValidationError{Name: "kind", err: fmt.Errorf(`ent: validator failed for field "AgvTask.kind": %w`, err)}
}
}
if v, ok := _u.mutation.BizType(); ok {
if err := agvtask.BizTypeValidator(v); err != nil {
return &ValidationError{Name: "biz_type", err: fmt.Errorf(`ent: validator failed for field "AgvTask.biz_type": %w`, err)}
}
}
if v, ok := _u.mutation.BizNo(); ok {
if err := agvtask.BizNoValidator(v); err != nil {
return &ValidationError{Name: "biz_no", err: fmt.Errorf(`ent: validator failed for field "AgvTask.biz_no": %w`, err)}
}
}
if v, ok := _u.mutation.ChainNo(); ok {
if err := agvtask.ChainNoValidator(v); err != nil {
return &ValidationError{Name: "chain_no", err: fmt.Errorf(`ent: validator failed for field "AgvTask.chain_no": %w`, err)}
}
}
if v, ok := _u.mutation.AgvCode(); ok {
if err := agvtask.AgvCodeValidator(v); err != nil {
return &ValidationError{Name: "agv_code", err: fmt.Errorf(`ent: validator failed for field "AgvTask.agv_code": %w`, err)}
}
}
if v, ok := _u.mutation.Operator(); ok {
if err := agvtask.OperatorValidator(v); err != nil {
return &ValidationError{Name: "operator", err: fmt.Errorf(`ent: validator failed for field "AgvTask.operator": %w`, err)}
@@ -819,6 +1055,24 @@ func (_u *AgvTaskUpdateOne) sqlSave(ctx context.Context) (_node *AgvTask, err er
if value, ok := _u.mutation.Status(); ok {
_spec.SetField(agvtask.FieldStatus, field.TypeString, value)
}
if value, ok := _u.mutation.Kind(); ok {
_spec.SetField(agvtask.FieldKind, field.TypeString, value)
}
if value, ok := _u.mutation.BizType(); ok {
_spec.SetField(agvtask.FieldBizType, field.TypeString, value)
}
if value, ok := _u.mutation.BizNo(); ok {
_spec.SetField(agvtask.FieldBizNo, field.TypeString, value)
}
if value, ok := _u.mutation.ChainNo(); ok {
_spec.SetField(agvtask.FieldChainNo, field.TypeString, value)
}
if value, ok := _u.mutation.AutoEnd(); ok {
_spec.SetField(agvtask.FieldAutoEnd, field.TypeBool, value)
}
if value, ok := _u.mutation.AgvCode(); ok {
_spec.SetField(agvtask.FieldAgvCode, field.TypeString, value)
}
if value, ok := _u.mutation.Operator(); ok {
_spec.SetField(agvtask.FieldOperator, field.TypeString, value)
}