feat: 退料闭环定稿(损耗台账/备料清单/退料AGV自动派车/剩余量参考)+ 工位托盘守卫

- MES 新增损耗台账 loss_ledger,差异确认损耗接口 ConfirmReceiveLoss(按工单归集)
- 备料清单 preparation:MES 按 日计划×工单×工位×物料 实时计算,WMS 只读展示 PreparationList
- 退料闭环:N5 工位托盘守卫(未完成禁止退料)、退料 AGV 自动派车(JBT21 空位判定 + 托盘回收链路)、退料参考剩余量接口(应剩余=实备-已耗-已退-已损)
- 新增 AGV 车辆状态表 agv_vehicle_state 及查询
- 整合接驳台/叫料池/库存锁既有闭环,清理 sql 目录注释生成脚本与 catalog,更新文档
This commit is contained in:
SunYF
2026-11-04 19:06:03 +08:00
parent 42bcf395d2
commit 46fcb59079
123 changed files with 10666 additions and 3227 deletions
+26 -2
View File
@@ -95,6 +95,23 @@ var (
},
},
}
// AgvVehicleStateColumns holds the columns for the "agv_vehicle_state" table.
AgvVehicleStateColumns = []*schema.Column{
{Name: "id", Type: field.TypeInt, Increment: true},
{Name: "agv_code", Type: field.TypeString, Unique: true, Size: 32, Comment: "车辆编号(RCS robotCode/agvCode;RCS 未分车时=DEFAULT 未知车辆)"},
{Name: "has_pallet", Type: field.TypeBool, Comment: "载货状态:true=有托盘(载货) false=空车", Default: false},
{Name: "source", Type: field.TypeString, Size: 20, Comment: "状态来源:AUTO_LOAD取货确认/AUTO_UNLOAD卸货确认/MANUAL人工维护", Default: "MANUAL"},
{Name: "updated_by", Type: field.TypeString, Size: 64, Comment: "最近更新人", Default: ""},
{Name: "updated_at", Type: field.TypeInt64, Comment: "最近更新时间 unix秒", Default: 0},
{Name: "remark", Type: field.TypeString, Size: 200, Comment: "备注(人工修改原因等)", Default: ""},
}
// AgvVehicleStateTable holds the schema information for the "agv_vehicle_state" table.
AgvVehicleStateTable = &schema.Table{
Name: "agv_vehicle_state",
Comment: "AgvVehicleState AGV 载货状态台账:按 agv_code 逐台记录有托盘/空车,取货/卸货确认与人工维护写入,派车防撞校验消费。",
Columns: AgvVehicleStateColumns,
PrimaryKey: []*schema.Column{AgvVehicleStateColumns[0]},
}
// AlertColumns holds the columns for the "alert" table.
AlertColumns = []*schema.Column{
{Name: "id", Type: field.TypeInt, Increment: true},
@@ -371,7 +388,7 @@ var (
// DockTable holds the schema information for the "dock" table.
DockTable = &schema.Table{
Name: "dock",
Comment: "Dock 接驳台主数据:DOCK01~DOCK20(产线,DOCKn↔工位n)+ DOCK21(库房收货)。",
Comment: "Dock 接驳台主数据:DOCK01~DOCK20(产线,DOCKn↔工位n)+ JBT21(库房收货;T7 2026-11-03 统一代号)。",
Columns: DockColumns,
PrimaryKey: []*schema.Column{DockColumns[0]},
Indexes: []*schema.Index{
@@ -438,7 +455,7 @@ var (
{Name: "unit", Type: field.TypeString, Size: 16, Default: ""},
{Name: "sn_mode", Type: field.TypeInt, Default: 2},
{Name: "unit_qty", Type: field.TypeFloat64, Comment: "单台用量", Default: 0},
{Name: "loss_rate", Type: field.TypeFloat64, Comment: "损耗率%", Default: 0},
{Name: "loss_rate", Type: field.TypeFloat64, Comment: "损耗率%(仅展示口径,不参与备料计算——R7 2026-11-03 拍板:备料量=工单需求×单台用量,损耗走补料审批)", Default: 0},
{Name: "created_at", Type: field.TypeTime},
}
// FlowMaterialTable holds the schema information for the "flow_material" table.
@@ -705,6 +722,9 @@ var (
{Name: "theory_qty", Type: field.TypeFloat64, Nullable: true, Comment: "理论应退量(转产/下班退料按 BOM 计算;实际<理论差额=损耗)"},
{Name: "loss_qty", Type: field.TypeFloat64, Nullable: true, Comment: "损耗量(理论应退-实际退回>0 时记录)"},
{Name: "loss_reason", Type: field.TypeString, Size: 200, Comment: "损耗原因(有损耗时必填,主管在损耗台账批注)", Default: ""},
{Name: "receive_qty", Type: field.TypeFloat64, Nullable: true, Comment: "库管实收量(WMS 确认收货回写)"},
{Name: "receive_diff", Type: field.TypeFloat64, Nullable: true, Comment: "收货差异=应退-实收(>0 为少收,记待核,不自动进损耗台账)"},
{Name: "receive_note", Type: field.TypeString, Size: 200, Comment: "收货差异备注(库管填写,说明差异原因)", Default: ""},
{Name: "created_at", Type: field.TypeTime},
{Name: "updated_at", Type: field.TypeTime, Nullable: true},
}
@@ -1558,6 +1578,7 @@ var (
Tables = []*schema.Table{
AgvPointTable,
AgvTasksTable,
AgvVehicleStateTable,
AlertTable,
AlertRuleTable,
AssociationTraceTable,
@@ -1608,6 +1629,9 @@ func init() {
AgvTasksTable.Annotation = &entsql.Annotation{
Table: "agv_tasks",
}
AgvVehicleStateTable.Annotation = &entsql.Annotation{
Table: "agv_vehicle_state",
}
AlertTable.Annotation = &entsql.Annotation{
Table: "alert",
}