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
+12
View File
@@ -21,6 +21,8 @@ const (
FieldDockType = "dock_type"
// FieldStationNo holds the string denoting the stationno field in the database.
FieldStationNo = "station_no"
// FieldSide holds the string denoting the side field in the database.
FieldSide = "side"
// FieldHasPallet holds the string denoting the haspallet field in the database.
FieldHasPallet = "has_pallet"
// FieldPalletRef holds the string denoting the palletref field in the database.
@@ -40,6 +42,7 @@ var Columns = []string{
FieldName,
FieldDockType,
FieldStationNo,
FieldSide,
FieldHasPallet,
FieldPalletRef,
FieldStatus,
@@ -69,6 +72,10 @@ var (
DockTypeValidator func(string) error
// DefaultStationNo holds the default value on creation for the "stationNo" field.
DefaultStationNo int
// DefaultSide holds the default value on creation for the "side" field.
DefaultSide string
// SideValidator is a validator for the "side" field. It is called by the builders before save.
SideValidator func(string) error
// DefaultHasPallet holds the default value on creation for the "hasPallet" field.
DefaultHasPallet bool
// DefaultPalletRef holds the default value on creation for the "palletRef" field.
@@ -111,6 +118,11 @@ func ByStationNo(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldStationNo, opts...).ToFunc()
}
// BySide orders the results by the side field.
func BySide(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldSide, opts...).ToFunc()
}
// ByHasPallet orders the results by the hasPallet field.
func ByHasPallet(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldHasPallet, opts...).ToFunc()
+70
View File
@@ -74,6 +74,11 @@ func StationNo(v int) predicate.Dock {
return predicate.Dock(sql.FieldEQ(FieldStationNo, v))
}
// Side applies equality check predicate on the "side" field. It's identical to SideEQ.
func Side(v string) predicate.Dock {
return predicate.Dock(sql.FieldEQ(FieldSide, v))
}
// HasPallet applies equality check predicate on the "hasPallet" field. It's identical to HasPalletEQ.
func HasPallet(v bool) predicate.Dock {
return predicate.Dock(sql.FieldEQ(FieldHasPallet, v))
@@ -329,6 +334,71 @@ func StationNoLTE(v int) predicate.Dock {
return predicate.Dock(sql.FieldLTE(FieldStationNo, v))
}
// SideEQ applies the EQ predicate on the "side" field.
func SideEQ(v string) predicate.Dock {
return predicate.Dock(sql.FieldEQ(FieldSide, v))
}
// SideNEQ applies the NEQ predicate on the "side" field.
func SideNEQ(v string) predicate.Dock {
return predicate.Dock(sql.FieldNEQ(FieldSide, v))
}
// SideIn applies the In predicate on the "side" field.
func SideIn(vs ...string) predicate.Dock {
return predicate.Dock(sql.FieldIn(FieldSide, vs...))
}
// SideNotIn applies the NotIn predicate on the "side" field.
func SideNotIn(vs ...string) predicate.Dock {
return predicate.Dock(sql.FieldNotIn(FieldSide, vs...))
}
// SideGT applies the GT predicate on the "side" field.
func SideGT(v string) predicate.Dock {
return predicate.Dock(sql.FieldGT(FieldSide, v))
}
// SideGTE applies the GTE predicate on the "side" field.
func SideGTE(v string) predicate.Dock {
return predicate.Dock(sql.FieldGTE(FieldSide, v))
}
// SideLT applies the LT predicate on the "side" field.
func SideLT(v string) predicate.Dock {
return predicate.Dock(sql.FieldLT(FieldSide, v))
}
// SideLTE applies the LTE predicate on the "side" field.
func SideLTE(v string) predicate.Dock {
return predicate.Dock(sql.FieldLTE(FieldSide, v))
}
// SideContains applies the Contains predicate on the "side" field.
func SideContains(v string) predicate.Dock {
return predicate.Dock(sql.FieldContains(FieldSide, v))
}
// SideHasPrefix applies the HasPrefix predicate on the "side" field.
func SideHasPrefix(v string) predicate.Dock {
return predicate.Dock(sql.FieldHasPrefix(FieldSide, v))
}
// SideHasSuffix applies the HasSuffix predicate on the "side" field.
func SideHasSuffix(v string) predicate.Dock {
return predicate.Dock(sql.FieldHasSuffix(FieldSide, v))
}
// SideEqualFold applies the EqualFold predicate on the "side" field.
func SideEqualFold(v string) predicate.Dock {
return predicate.Dock(sql.FieldEqualFold(FieldSide, v))
}
// SideContainsFold applies the ContainsFold predicate on the "side" field.
func SideContainsFold(v string) predicate.Dock {
return predicate.Dock(sql.FieldContainsFold(FieldSide, v))
}
// HasPalletEQ applies the EQ predicate on the "hasPallet" field.
func HasPalletEQ(v bool) predicate.Dock {
return predicate.Dock(sql.FieldEQ(FieldHasPallet, v))