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
+70
View File
@@ -27,6 +27,18 @@ const (
FieldRelatedOutboundNo = "related_outbound_no"
// FieldStatus holds the string denoting the status field in the database.
FieldStatus = "status"
// FieldKind holds the string denoting the kind field in the database.
FieldKind = "kind"
// FieldBizType holds the string denoting the biz_type field in the database.
FieldBizType = "biz_type"
// FieldBizNo holds the string denoting the biz_no field in the database.
FieldBizNo = "biz_no"
// FieldChainNo holds the string denoting the chain_no field in the database.
FieldChainNo = "chain_no"
// FieldAutoEnd holds the string denoting the auto_end field in the database.
FieldAutoEnd = "auto_end"
// FieldAgvCode holds the string denoting the agv_code field in the database.
FieldAgvCode = "agv_code"
// FieldOperator holds the string denoting the operator field in the database.
FieldOperator = "operator"
// FieldDispatchedAt holds the string denoting the dispatched_at field in the database.
@@ -52,6 +64,12 @@ var Columns = []string{
FieldRelatedRequestNo,
FieldRelatedOutboundNo,
FieldStatus,
FieldKind,
FieldBizType,
FieldBizNo,
FieldChainNo,
FieldAutoEnd,
FieldAgvCode,
FieldOperator,
FieldDispatchedAt,
FieldArrivedAt,
@@ -100,6 +118,28 @@ var (
DefaultStatus string
// StatusValidator is a validator for the "status" field. It is called by the builders before save.
StatusValidator func(string) error
// DefaultKind holds the default value on creation for the "kind" field.
DefaultKind string
// KindValidator is a validator for the "kind" field. It is called by the builders before save.
KindValidator func(string) error
// DefaultBizType holds the default value on creation for the "biz_type" field.
DefaultBizType string
// BizTypeValidator is a validator for the "biz_type" field. It is called by the builders before save.
BizTypeValidator func(string) error
// DefaultBizNo holds the default value on creation for the "biz_no" field.
DefaultBizNo string
// BizNoValidator is a validator for the "biz_no" field. It is called by the builders before save.
BizNoValidator func(string) error
// DefaultChainNo holds the default value on creation for the "chain_no" field.
DefaultChainNo string
// ChainNoValidator is a validator for the "chain_no" field. It is called by the builders before save.
ChainNoValidator func(string) error
// DefaultAutoEnd holds the default value on creation for the "auto_end" field.
DefaultAutoEnd bool
// DefaultAgvCode holds the default value on creation for the "agv_code" field.
DefaultAgvCode string
// AgvCodeValidator is a validator for the "agv_code" field. It is called by the builders before save.
AgvCodeValidator func(string) error
// DefaultOperator holds the default value on creation for the "operator" field.
DefaultOperator string
// OperatorValidator is a validator for the "operator" field. It is called by the builders before save.
@@ -164,6 +204,36 @@ func ByStatus(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldStatus, opts...).ToFunc()
}
// ByKind orders the results by the kind field.
func ByKind(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldKind, opts...).ToFunc()
}
// ByBizType orders the results by the biz_type field.
func ByBizType(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldBizType, opts...).ToFunc()
}
// ByBizNo orders the results by the biz_no field.
func ByBizNo(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldBizNo, opts...).ToFunc()
}
// ByChainNo orders the results by the chain_no field.
func ByChainNo(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldChainNo, opts...).ToFunc()
}
// ByAutoEnd orders the results by the auto_end field.
func ByAutoEnd(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldAutoEnd, opts...).ToFunc()
}
// ByAgvCode orders the results by the agv_code field.
func ByAgvCode(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldAgvCode, opts...).ToFunc()
}
// ByOperator orders the results by the operator field.
func ByOperator(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldOperator, opts...).ToFunc()