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
+175
View File
@@ -123,6 +123,90 @@ func (_c *AgvTaskCreate) SetNillableStatus(v *string) *AgvTaskCreate {
return _c
}
// SetKind sets the "kind" field.
func (_c *AgvTaskCreate) SetKind(v string) *AgvTaskCreate {
_c.mutation.SetKind(v)
return _c
}
// SetNillableKind sets the "kind" field if the given value is not nil.
func (_c *AgvTaskCreate) SetNillableKind(v *string) *AgvTaskCreate {
if v != nil {
_c.SetKind(*v)
}
return _c
}
// SetBizType sets the "biz_type" field.
func (_c *AgvTaskCreate) SetBizType(v string) *AgvTaskCreate {
_c.mutation.SetBizType(v)
return _c
}
// SetNillableBizType sets the "biz_type" field if the given value is not nil.
func (_c *AgvTaskCreate) SetNillableBizType(v *string) *AgvTaskCreate {
if v != nil {
_c.SetBizType(*v)
}
return _c
}
// SetBizNo sets the "biz_no" field.
func (_c *AgvTaskCreate) SetBizNo(v string) *AgvTaskCreate {
_c.mutation.SetBizNo(v)
return _c
}
// SetNillableBizNo sets the "biz_no" field if the given value is not nil.
func (_c *AgvTaskCreate) SetNillableBizNo(v *string) *AgvTaskCreate {
if v != nil {
_c.SetBizNo(*v)
}
return _c
}
// SetChainNo sets the "chain_no" field.
func (_c *AgvTaskCreate) SetChainNo(v string) *AgvTaskCreate {
_c.mutation.SetChainNo(v)
return _c
}
// SetNillableChainNo sets the "chain_no" field if the given value is not nil.
func (_c *AgvTaskCreate) SetNillableChainNo(v *string) *AgvTaskCreate {
if v != nil {
_c.SetChainNo(*v)
}
return _c
}
// SetAutoEnd sets the "auto_end" field.
func (_c *AgvTaskCreate) SetAutoEnd(v bool) *AgvTaskCreate {
_c.mutation.SetAutoEnd(v)
return _c
}
// SetNillableAutoEnd sets the "auto_end" field if the given value is not nil.
func (_c *AgvTaskCreate) SetNillableAutoEnd(v *bool) *AgvTaskCreate {
if v != nil {
_c.SetAutoEnd(*v)
}
return _c
}
// SetAgvCode sets the "agv_code" field.
func (_c *AgvTaskCreate) SetAgvCode(v string) *AgvTaskCreate {
_c.mutation.SetAgvCode(v)
return _c
}
// SetNillableAgvCode sets the "agv_code" field if the given value is not nil.
func (_c *AgvTaskCreate) SetNillableAgvCode(v *string) *AgvTaskCreate {
if v != nil {
_c.SetAgvCode(*v)
}
return _c
}
// SetOperator sets the "operator" field.
func (_c *AgvTaskCreate) SetOperator(v string) *AgvTaskCreate {
_c.mutation.SetOperator(v)
@@ -256,6 +340,30 @@ func (_c *AgvTaskCreate) defaults() {
v := agvtask.DefaultStatus
_c.mutation.SetStatus(v)
}
if _, ok := _c.mutation.Kind(); !ok {
v := agvtask.DefaultKind
_c.mutation.SetKind(v)
}
if _, ok := _c.mutation.BizType(); !ok {
v := agvtask.DefaultBizType
_c.mutation.SetBizType(v)
}
if _, ok := _c.mutation.BizNo(); !ok {
v := agvtask.DefaultBizNo
_c.mutation.SetBizNo(v)
}
if _, ok := _c.mutation.ChainNo(); !ok {
v := agvtask.DefaultChainNo
_c.mutation.SetChainNo(v)
}
if _, ok := _c.mutation.AutoEnd(); !ok {
v := agvtask.DefaultAutoEnd
_c.mutation.SetAutoEnd(v)
}
if _, ok := _c.mutation.AgvCode(); !ok {
v := agvtask.DefaultAgvCode
_c.mutation.SetAgvCode(v)
}
if _, ok := _c.mutation.Operator(); !ok {
v := agvtask.DefaultOperator
_c.mutation.SetOperator(v)
@@ -338,6 +446,49 @@ func (_c *AgvTaskCreate) check() error {
return &ValidationError{Name: "status", err: fmt.Errorf(`ent: validator failed for field "AgvTask.status": %w`, err)}
}
}
if _, ok := _c.mutation.Kind(); !ok {
return &ValidationError{Name: "kind", err: errors.New(`ent: missing required field "AgvTask.kind"`)}
}
if v, ok := _c.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 _, ok := _c.mutation.BizType(); !ok {
return &ValidationError{Name: "biz_type", err: errors.New(`ent: missing required field "AgvTask.biz_type"`)}
}
if v, ok := _c.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 _, ok := _c.mutation.BizNo(); !ok {
return &ValidationError{Name: "biz_no", err: errors.New(`ent: missing required field "AgvTask.biz_no"`)}
}
if v, ok := _c.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 _, ok := _c.mutation.ChainNo(); !ok {
return &ValidationError{Name: "chain_no", err: errors.New(`ent: missing required field "AgvTask.chain_no"`)}
}
if v, ok := _c.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 _, ok := _c.mutation.AutoEnd(); !ok {
return &ValidationError{Name: "auto_end", err: errors.New(`ent: missing required field "AgvTask.auto_end"`)}
}
if _, ok := _c.mutation.AgvCode(); !ok {
return &ValidationError{Name: "agv_code", err: errors.New(`ent: missing required field "AgvTask.agv_code"`)}
}
if v, ok := _c.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 _, ok := _c.mutation.Operator(); !ok {
return &ValidationError{Name: "operator", err: errors.New(`ent: missing required field "AgvTask.operator"`)}
}
@@ -418,6 +569,30 @@ func (_c *AgvTaskCreate) createSpec() (*AgvTask, *sqlgraph.CreateSpec) {
_spec.SetField(agvtask.FieldStatus, field.TypeString, value)
_node.Status = value
}
if value, ok := _c.mutation.Kind(); ok {
_spec.SetField(agvtask.FieldKind, field.TypeString, value)
_node.Kind = value
}
if value, ok := _c.mutation.BizType(); ok {
_spec.SetField(agvtask.FieldBizType, field.TypeString, value)
_node.BizType = value
}
if value, ok := _c.mutation.BizNo(); ok {
_spec.SetField(agvtask.FieldBizNo, field.TypeString, value)
_node.BizNo = value
}
if value, ok := _c.mutation.ChainNo(); ok {
_spec.SetField(agvtask.FieldChainNo, field.TypeString, value)
_node.ChainNo = value
}
if value, ok := _c.mutation.AutoEnd(); ok {
_spec.SetField(agvtask.FieldAutoEnd, field.TypeBool, value)
_node.AutoEnd = value
}
if value, ok := _c.mutation.AgvCode(); ok {
_spec.SetField(agvtask.FieldAgvCode, field.TypeString, value)
_node.AgvCode = value
}
if value, ok := _c.mutation.Operator(); ok {
_spec.SetField(agvtask.FieldOperator, field.TypeString, value)
_node.Operator = value