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:
@@ -48,12 +48,18 @@ var (
|
||||
{Name: "id", Type: field.TypeInt, Increment: true},
|
||||
{Name: "task_no", Type: field.TypeString, Unique: true, Size: 64, Comment: "我方任务号(内部)"},
|
||||
{Name: "hik_task_code", Type: field.TypeString, Size: 64, Comment: "RCS-Lite 任务单号(即我方 task_no,下发时透传 taskCode)", Default: ""},
|
||||
{Name: "source_dock", Type: field.TypeString, Size: 20, Comment: "起点接驳台(常为 DOCK21 库房)", Default: ""},
|
||||
{Name: "target_dock", Type: field.TypeString, Size: 20, Comment: "终点接驳台 DOCK01..20", Default: ""},
|
||||
{Name: "source_dock", Type: field.TypeString, Size: 20, Comment: "起点接驳台(空车段可为空=单点path由RCS派最近空闲车)", Default: ""},
|
||||
{Name: "target_dock", Type: field.TypeString, Size: 20, Comment: "终点接驳台/点位 DOCK01..21 或 AGV-CHARGE01", Default: ""},
|
||||
{Name: "materials_json", Type: field.TypeString, Size: 4000, Comment: "物料清单 JSON", Default: ""},
|
||||
{Name: "related_request_no", Type: field.TypeString, Nullable: true, Size: 64, Comment: "关联叫料单号(MES material_request.requestNo)", Default: ""},
|
||||
{Name: "related_outbound_no", Type: field.TypeString, Nullable: true, Size: 64, Comment: "关联出库单号(可选, WMS 回传)", Default: ""},
|
||||
{Name: "status", Type: field.TypeString, Size: 20, Comment: "PENDING/FAILED/1已创建/2执行中/5已取消/9已结束", Default: "PENDING"},
|
||||
{Name: "status", Type: field.TypeString, Size: 20, Comment: "PENDING/FAILED/1已创建/2执行中/ARRIVED到位待令/5已取消/9已结束", Default: "PENDING"},
|
||||
{Name: "kind", Type: field.TypeString, Size: 20, Comment: "段类型:GO_LOAD空车去装货点/TRANSPORT重载运输/EMPTY_RETURN空车回充/FREE人工自由调度单点段", Default: "TRANSPORT"},
|
||||
{Name: "biz_type", Type: field.TypeString, Size: 20, Comment: "业务来源:CALL叫料/PALLET托盘回收/FREE自由调度", Default: "CALL"},
|
||||
{Name: "biz_no", Type: field.TypeString, Size: 64, Comment: "业务单据号(叫料单号/托盘回收标识等)", Default: ""},
|
||||
{Name: "chain_no", Type: field.TypeString, Size: 64, Comment: "任务链号(=首段taskNo,同链各段关联)", Default: ""},
|
||||
{Name: "auto_end", Type: field.TypeBool, Comment: "到位自动结束(空车回充段=true,不停留待令)", Default: false},
|
||||
{Name: "agv_code", Type: field.TypeString, Size: 32, Comment: "RCS 分配的车辆编号(任务分车后由回调/查询回写)", Default: ""},
|
||||
{Name: "operator", Type: field.TypeString, Size: 64, Comment: "下发人", Default: ""},
|
||||
{Name: "dispatched_at", Type: field.TypeInt64, Comment: "下发时间 unix秒", Default: 0},
|
||||
{Name: "arrived_at", Type: field.TypeInt64, Comment: "到位时间 unix秒", Default: 0},
|
||||
@@ -63,7 +69,7 @@ var (
|
||||
// AgvTasksTable holds the schema information for the "agv_tasks" table.
|
||||
AgvTasksTable = &schema.Table{
|
||||
Name: "agv_tasks",
|
||||
Comment: "AgvTask AGV 搬运任务记录:MES 调度海康 RCS 派车后落库,用于状态跟踪/追溯。",
|
||||
Comment: "AgvTask AGV 搬运任务记录:三段链模型(空车去程/重载运输/空车回充),到位进 ARRIVED 待人工确认。",
|
||||
Columns: AgvTasksColumns,
|
||||
PrimaryKey: []*schema.Column{AgvTasksColumns[0]},
|
||||
Indexes: []*schema.Index{
|
||||
@@ -356,6 +362,7 @@ var (
|
||||
{Name: "name", Type: field.TypeString, Size: 64, Comment: "接驳台名称", Default: ""},
|
||||
{Name: "dock_type", Type: field.TypeString, Size: 16, Comment: "类型 line产线/store库房/other其他", Default: "line"},
|
||||
{Name: "station_no", Type: field.TypeInt, Comment: "关联工位号(与工位1:1,非产线为0)", Default: 0},
|
||||
{Name: "side", Type: field.TypeString, Size: 8, Comment: "左右:left=操作员左手边/right=右手边(按操作员朝向区分,下排工位与地图左右相反)", Default: "left"},
|
||||
{Name: "has_pallet", Type: field.TypeBool, Comment: "当前是否有托盘", Default: false},
|
||||
{Name: "pallet_ref", Type: field.TypeString, Nullable: true, Size: 64, Comment: "托盘关联(出库单号/备料单号)", Default: ""},
|
||||
{Name: "status", Type: field.TypeString, Size: 20, Default: "ENABLED"},
|
||||
@@ -539,6 +546,49 @@ var (
|
||||
},
|
||||
},
|
||||
}
|
||||
// LossLedgersColumns holds the columns for the "loss_ledgers" table.
|
||||
LossLedgersColumns = []*schema.Column{
|
||||
{Name: "id", Type: field.TypeInt, Increment: true},
|
||||
{Name: "station_no", Type: field.TypeInt, Comment: "工位号"},
|
||||
{Name: "material_code", Type: field.TypeString, Size: 64, Comment: "物料编码(图号)"},
|
||||
{Name: "material_name", Type: field.TypeString, Size: 128, Comment: "物料名称", Default: ""},
|
||||
{Name: "theory_qty", Type: field.TypeFloat64, Comment: "理论应退量"},
|
||||
{Name: "actual_qty", Type: field.TypeFloat64, Comment: "实际退回量"},
|
||||
{Name: "loss_qty", Type: field.TypeFloat64, Comment: "损耗量(理论-实际)"},
|
||||
{Name: "reason", Type: field.TypeString, Size: 200, Comment: "损耗原因(必填)"},
|
||||
{Name: "return_no", Type: field.TypeString, Size: 64, Comment: "关联退库单号(material_request.requestNo)", Default: ""},
|
||||
{Name: "work_order_no", Type: field.TypeString, Size: 64, Comment: "关联工单号(可空)", Default: ""},
|
||||
{Name: "status", Type: field.TypeString, Size: 20, Comment: "PENDING待批注/COMMENTED已批注", Default: "PENDING"},
|
||||
{Name: "comment", Type: field.TypeString, Size: 300, Comment: "主管批注回复", Default: ""},
|
||||
{Name: "commenter", Type: field.TypeString, Size: 64, Comment: "批注人", Default: ""},
|
||||
{Name: "commented_at", Type: field.TypeInt64, Comment: "批注时间 unix秒", Default: 0},
|
||||
{Name: "operator", Type: field.TypeString, Size: 64, Comment: "退料操作人", Default: ""},
|
||||
{Name: "created_at", Type: field.TypeTime},
|
||||
}
|
||||
// LossLedgersTable holds the schema information for the "loss_ledgers" table.
|
||||
LossLedgersTable = &schema.Table{
|
||||
Name: "loss_ledgers",
|
||||
Comment: "LossLedger 损耗台账:退料差额自动落账,主管批注(后审核)。",
|
||||
Columns: LossLedgersColumns,
|
||||
PrimaryKey: []*schema.Column{LossLedgersColumns[0]},
|
||||
Indexes: []*schema.Index{
|
||||
{
|
||||
Name: "lossledger_station_no",
|
||||
Unique: false,
|
||||
Columns: []*schema.Column{LossLedgersColumns[1]},
|
||||
},
|
||||
{
|
||||
Name: "lossledger_status",
|
||||
Unique: false,
|
||||
Columns: []*schema.Column{LossLedgersColumns[10]},
|
||||
},
|
||||
{
|
||||
Name: "lossledger_return_no",
|
||||
Unique: false,
|
||||
Columns: []*schema.Column{LossLedgersColumns[8]},
|
||||
},
|
||||
},
|
||||
}
|
||||
// MaterialsColumns holds the columns for the "materials" table.
|
||||
MaterialsColumns = []*schema.Column{
|
||||
{Name: "id", Type: field.TypeInt, Increment: true},
|
||||
@@ -650,6 +700,11 @@ var (
|
||||
{Name: "reject_reason", Type: field.TypeString, Size: 128, Comment: "驳回理由(仓库拒发时必填)", Default: ""},
|
||||
{Name: "borrow_from", Type: field.TypeJSON, Nullable: true, Comment: "跨工位借料来源 stationNo→借用量;空=本工位自取", SchemaType: map[string]string{"postgres": "jsonb"}},
|
||||
{Name: "operator", Type: field.TypeString, Size: 64, Default: ""},
|
||||
{Name: "work_order_no", Type: field.TypeString, Size: 64, Comment: "关联工单号(转产按工单精确退料;普通叫料单为空)", Default: ""},
|
||||
{Name: "return_dock", Type: field.TypeString, Size: 20, Comment: "退料接驳台(退料/还库时指定从哪个接驳台拉走,AGV 派车依据)", Default: ""},
|
||||
{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: "created_at", Type: field.TypeTime},
|
||||
{Name: "updated_at", Type: field.TypeTime, Nullable: true},
|
||||
}
|
||||
@@ -675,6 +730,11 @@ var (
|
||||
Unique: false,
|
||||
Columns: []*schema.Column{MaterialRequestColumns[7]},
|
||||
},
|
||||
{
|
||||
Name: "materialrequest_work_order_no",
|
||||
Unique: false,
|
||||
Columns: []*schema.Column{MaterialRequestColumns[21]},
|
||||
},
|
||||
},
|
||||
}
|
||||
// PermissionColumns holds the columns for the "permission" table.
|
||||
@@ -909,6 +969,41 @@ var (
|
||||
},
|
||||
},
|
||||
}
|
||||
// ShortageRequestsColumns holds the columns for the "shortage_requests" table.
|
||||
ShortageRequestsColumns = []*schema.Column{
|
||||
{Name: "id", Type: field.TypeInt, Increment: true},
|
||||
{Name: "station_no", Type: field.TypeInt, Comment: "申请工位号"},
|
||||
{Name: "material_code", Type: field.TypeString, Size: 64, Comment: "物料编码(图号)"},
|
||||
{Name: "material_name", Type: field.TypeString, Size: 128, Comment: "物料名称", Default: ""},
|
||||
{Name: "unit", Type: field.TypeString, Size: 16, Comment: "单位", Default: ""},
|
||||
{Name: "qty", Type: field.TypeInt, Comment: "补料数量(申请增加的额度)"},
|
||||
{Name: "reason", Type: field.TypeString, Size: 200, Comment: "补料原因(损耗超标/用量超出预估等,必填)"},
|
||||
{Name: "status", Type: field.TypeString, Size: 20, Comment: "PENDING待审批/APPROVED已通过/REJECTED已驳回", Default: "PENDING"},
|
||||
{Name: "comment", Type: field.TypeString, Size: 300, Comment: "主管批注", Default: ""},
|
||||
{Name: "commenter", Type: field.TypeString, Size: 64, Comment: "审批人", Default: ""},
|
||||
{Name: "commented_at", Type: field.TypeInt64, Comment: "审批时间 unix秒", Default: 0},
|
||||
{Name: "operator", Type: field.TypeString, Size: 64, Comment: "申请人", Default: ""},
|
||||
{Name: "created_at", Type: field.TypeTime},
|
||||
}
|
||||
// ShortageRequestsTable holds the schema information for the "shortage_requests" table.
|
||||
ShortageRequestsTable = &schema.Table{
|
||||
Name: "shortage_requests",
|
||||
Comment: "ShortageRequest 补料申请:工位物料不够用申请加量,主管审批后调增叫料池额度。",
|
||||
Columns: ShortageRequestsColumns,
|
||||
PrimaryKey: []*schema.Column{ShortageRequestsColumns[0]},
|
||||
Indexes: []*schema.Index{
|
||||
{
|
||||
Name: "shortagerequest_station_no",
|
||||
Unique: false,
|
||||
Columns: []*schema.Column{ShortageRequestsColumns[1]},
|
||||
},
|
||||
{
|
||||
Name: "shortagerequest_status",
|
||||
Unique: false,
|
||||
Columns: []*schema.Column{ShortageRequestsColumns[7]},
|
||||
},
|
||||
},
|
||||
}
|
||||
// StationColumns holds the columns for the "station" table.
|
||||
StationColumns = []*schema.Column{
|
||||
{Name: "id", Type: field.TypeInt, Increment: true},
|
||||
@@ -935,6 +1030,37 @@ var (
|
||||
},
|
||||
},
|
||||
}
|
||||
// StationShiftsColumns holds the columns for the "station_shifts" table.
|
||||
StationShiftsColumns = []*schema.Column{
|
||||
{Name: "id", Type: field.TypeInt, Increment: true},
|
||||
{Name: "station_no", Type: field.TypeInt, Comment: "工位号"},
|
||||
{Name: "operator", Type: field.TypeString, Size: 64, Comment: "当班工人", Default: ""},
|
||||
{Name: "status", Type: field.TypeString, Size: 20, Comment: "ON_DUTY当班/CLOSING待收尾(有剩余物料退料中)/CLOSED已下班", Default: "ON_DUTY"},
|
||||
{Name: "start_at", Type: field.TypeInt64, Comment: "班次开始(登录) unix秒", Default: 0},
|
||||
{Name: "end_apply_at", Type: field.TypeInt64, Comment: "申请下班时间 unix秒", Default: 0},
|
||||
{Name: "closed_at", Type: field.TypeInt64, Comment: "实际下班(收尾完成) unix秒", Default: 0},
|
||||
{Name: "remark", Type: field.TypeString, Nullable: true, Size: 300, Comment: "备注(如退料单号/退出未下班警示留痕)", Default: ""},
|
||||
{Name: "created_at", Type: field.TypeTime},
|
||||
}
|
||||
// StationShiftsTable holds the schema information for the "station_shifts" table.
|
||||
StationShiftsTable = &schema.Table{
|
||||
Name: "station_shifts",
|
||||
Comment: "StationShift 工位班次:下班/结束作业闭环状态。",
|
||||
Columns: StationShiftsColumns,
|
||||
PrimaryKey: []*schema.Column{StationShiftsColumns[0]},
|
||||
Indexes: []*schema.Index{
|
||||
{
|
||||
Name: "stationshift_station_no",
|
||||
Unique: false,
|
||||
Columns: []*schema.Column{StationShiftsColumns[1]},
|
||||
},
|
||||
{
|
||||
Name: "stationshift_status",
|
||||
Unique: false,
|
||||
Columns: []*schema.Column{StationShiftsColumns[3]},
|
||||
},
|
||||
},
|
||||
}
|
||||
// StationStateColumns holds the columns for the "station_state" table.
|
||||
StationStateColumns = []*schema.Column{
|
||||
{Name: "id", Type: field.TypeInt, Increment: true},
|
||||
@@ -1444,6 +1570,7 @@ var (
|
||||
FlowMaterialTable,
|
||||
InspectionRecordTable,
|
||||
LinePointTable,
|
||||
LossLedgersTable,
|
||||
MaterialsTable,
|
||||
MaterialQtyReportTable,
|
||||
MaterialRequestTable,
|
||||
@@ -1455,7 +1582,9 @@ var (
|
||||
ProductProcessItemTable,
|
||||
RoleTable,
|
||||
SemiFlowTable,
|
||||
ShortageRequestsTable,
|
||||
StationTable,
|
||||
StationShiftsTable,
|
||||
StationStateTable,
|
||||
StepCriterionTable,
|
||||
StepDataTable,
|
||||
@@ -1515,6 +1644,9 @@ func init() {
|
||||
LinePointTable.Annotation = &entsql.Annotation{
|
||||
Table: "line_point",
|
||||
}
|
||||
LossLedgersTable.Annotation = &entsql.Annotation{
|
||||
Table: "loss_ledgers",
|
||||
}
|
||||
MaterialsTable.Annotation = &entsql.Annotation{
|
||||
Table: "materials",
|
||||
}
|
||||
@@ -1548,9 +1680,15 @@ func init() {
|
||||
SemiFlowTable.Annotation = &entsql.Annotation{
|
||||
Table: "semi_flow",
|
||||
}
|
||||
ShortageRequestsTable.Annotation = &entsql.Annotation{
|
||||
Table: "shortage_requests",
|
||||
}
|
||||
StationTable.Annotation = &entsql.Annotation{
|
||||
Table: "station",
|
||||
}
|
||||
StationShiftsTable.Annotation = &entsql.Annotation{
|
||||
Table: "station_shifts",
|
||||
}
|
||||
StationStateTable.Annotation = &entsql.Annotation{
|
||||
Table: "station_state",
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user