| | |
| | | using Newtonsoft.Json; |
| | | using SqlSugar; |
| | | using WIDESEAWCS_Core.DB.Models; |
| | | |
| | |
| | | /// 机械手状态数据库实体 |
| | | /// </summary> |
| | | /// <remarks> |
| | | /// 对应数据库表 Dt_RobotState,使用 RowVersion 实现乐观并发控制。 |
| | | /// 对应数据库表 Dt_RobotState,使用 Version 字段实现乐观并发控制。 |
| | | /// 复杂对象(RobotCrane、CurrentTask、数组等)以 JSON 字符串存储。 |
| | | /// </remarks> |
| | | [SugarTable(nameof(Dt_RobotState), "机械手状态表")] |
| | |
| | | /// <summary> |
| | | /// 机械手 IP 地址,唯一索引 |
| | | /// </summary> |
| | | [SugarColumn(Length = 50, ColumnDescription = "机械手IP地址", IsJsonKey = true)] |
| | | [SugarColumn(Length = 50, ColumnDescription = "机械手IP地址")] |
| | | public string IPAddress { get; set; } = string.Empty; |
| | | |
| | | /// <summary> |
| | | /// 行版本,用于乐观并发控制 |
| | | /// 版本号,用于乐观并发控制 |
| | | /// </summary> |
| | | /// <remarks> |
| | | /// SqlSugar 会自动管理此字段,每次更新时数据库自动递增。 |
| | | /// 更新时 WHERE RowVersion = @expectedRowVersion,检查影响行数判断是否冲突。 |
| | | /// 每次更新时自增。更新时 WHERE IPAddress = @ip AND Version = @expectedVersion。 |
| | | /// 如果影响行数为 0,说明版本不匹配,返回 false。 |
| | | /// </remarks> |
| | | [SugarColumn(ColumnDescription = "行版本(乐观锁)", IsJsonKey = true)] |
| | | public byte[] RowVersion { get; set; } = Array.Empty<byte>(); |
| | | [SugarColumn(ColumnDescription = "版本号(乐观锁)")] |
| | | public long Version { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 是否已订阅消息事件 |
| | | /// </summary> |
| | | [SugarColumn(ColumnDescription = "是否已订阅消息事件", IsJsonKey = true)] |
| | | [SugarColumn(ColumnDescription = "是否已订阅消息事件")] |
| | | public bool IsEventSubscribed { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 机械手运行模式 |
| | | /// </summary> |
| | | /// <remarks>1: 手动模式, 2: 自动模式</remarks> |
| | | [SugarColumn(ColumnDescription = "运行模式", IsNullable = true, IsJsonKey = true)] |
| | | [SugarColumn(ColumnDescription = "运行模式", IsNullable = true)] |
| | | public int? RobotRunMode { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 机械手控制模式 |
| | | /// </summary> |
| | | /// <remarks>1: 客户端控制, 2: 其他</remarks> |
| | | [SugarColumn(ColumnDescription = "控制模式", IsNullable = true, IsJsonKey = true)] |
| | | [SugarColumn(ColumnDescription = "控制模式", IsNullable = true)] |
| | | public int? RobotControlMode { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 机械手手臂抓取对象状态 |
| | | /// </summary> |
| | | /// <remarks>0: 无物料(手臂空闲), 1: 有物料(已抓取货物)</remarks> |
| | | [SugarColumn(ColumnDescription = "手臂抓取状态", IsNullable = true, IsJsonKey = true)] |
| | | [SugarColumn(ColumnDescription = "手臂抓取状态", IsNullable = true)] |
| | | public int? RobotArmObject { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 机械手设备基础信息(JSON 序列化) |
| | | /// </summary> |
| | | [SugarColumn(Length = 2000, ColumnDescription = "设备信息JSON", IsJsonKey = true)] |
| | | public string RobotCraneJson { get; set; } = string.Empty; |
| | | [SugarColumn(Length = 2000, ColumnDescription = "设备信息JSON", IsNullable = true)] |
| | | public string? RobotCraneJson { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 机械手初始化完成回到待机位状态 |
| | | /// </summary> |
| | | /// <remarks>Possible values: "Homed", "Homing"</remarks> |
| | | [SugarColumn(Length = 50, ColumnDescription = "回零状态", IsNullable = true, IsJsonKey = true)] |
| | | [SugarColumn(Length = 50, ColumnDescription = "回零状态", IsNullable = true)] |
| | | public string? Homed { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 机械手当前正在执行的动作 |
| | | /// </summary> |
| | | [SugarColumn(Length = 50, ColumnDescription = "当前动作", IsNullable = true, IsJsonKey = true)] |
| | | [SugarColumn(Length = 50, ColumnDescription = "当前动作", IsNullable = true)] |
| | | public string? CurrentAction { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 机械手当前运行状态 |
| | | /// </summary> |
| | | [SugarColumn(Length = 50, ColumnDescription = "运行状态", IsNullable = true, IsJsonKey = true)] |
| | | [SugarColumn(Length = 50, ColumnDescription = "运行状态", IsNullable = true)] |
| | | public string? OperStatus { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 最近一次取货完成的位置数组(JSON) |
| | | /// </summary> |
| | | [SugarColumn(Length = 500, ColumnDescription = "取货位置数组JSON", IsNullable = true, IsJsonKey = true)] |
| | | [SugarColumn(Length = 500, ColumnDescription = "取货位置数组JSON", IsNullable = true)] |
| | | public string? LastPickPositionsJson { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 最近一次放货完成的位置数组(JSON) |
| | | /// </summary> |
| | | [SugarColumn(Length = 500, ColumnDescription = "放货位置数组JSON", IsNullable = true, IsJsonKey = true)] |
| | | [SugarColumn(Length = 500, ColumnDescription = "放货位置数组JSON", IsNullable = true)] |
| | | public string? LastPutPositionsJson { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 电池/货位条码列表(JSON) |
| | | /// </summary> |
| | | [SugarColumn(Length = 2000, ColumnDescription = "电芯条码列表JSON", IsNullable = true, IsJsonKey = true)] |
| | | [SugarColumn(Length = 2000, ColumnDescription = "电芯条码列表JSON", IsNullable = true)] |
| | | public string? CellBarcodeJson { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 机械手当前正在执行的任务(JSON 序列化) |
| | | /// </summary> |
| | | [SugarColumn(Length = 2000, ColumnDescription = "当前任务JSON", IsNullable = true, IsJsonKey = true)] |
| | | [SugarColumn(Length = 2000, ColumnDescription = "当前任务JSON", IsNullable = true)] |
| | | public string? CurrentTaskJson { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 是否需要执行拆盘任务 |
| | | /// </summary> |
| | | [SugarColumn(ColumnDescription = "是否拆盘任务", IsJsonKey = true)] |
| | | [SugarColumn(ColumnDescription = "是否拆盘任务")] |
| | | public bool IsSplitPallet { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 是否需要执行组盘任务 |
| | | /// </summary> |
| | | [SugarColumn(ColumnDescription = "是否组盘任务", IsJsonKey = true)] |
| | | [SugarColumn(ColumnDescription = "是否组盘任务")] |
| | | public bool IsGroupPallet { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 机器人已处理的任务总数 |
| | | /// </summary> |
| | | [SugarColumn(ColumnDescription = "已处理任务总数", IsJsonKey = true)] |
| | | [SugarColumn(ColumnDescription = "已处理任务总数")] |
| | | public int RobotTaskTotalNum { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 是否处于假电芯补充模式 |
| | | /// </summary> |
| | | [SugarColumn(ColumnDescription = "是否假电芯模式", IsJsonKey = true)] |
| | | [SugarColumn(ColumnDescription = "是否假电芯模式")] |
| | | public bool IsInFakeBatteryMode { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 当前批次起始编号 |
| | | /// </summary> |
| | | [SugarColumn(ColumnDescription = "当前批次编号", IsJsonKey = true)] |
| | | [SugarColumn(ColumnDescription = "当前批次编号")] |
| | | public int CurrentBatchIndex { get; set; } = 1; |
| | | |
| | | /// <summary> |
| | | /// 换盘任务当前阶段 |
| | | /// </summary> |
| | | [SugarColumn(ColumnDescription = "换盘阶段", IsJsonKey = true)] |
| | | [SugarColumn(ColumnDescription = "换盘阶段")] |
| | | public int ChangePalletPhase { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 是否扫码NG |
| | | /// </summary> |
| | | [SugarColumn(ColumnDescription = "是否扫码NG", IsJsonKey = true)] |
| | | [SugarColumn(ColumnDescription = "是否扫码NG")] |
| | | public bool IsScanNG { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 是否电芯到位 |
| | | /// </summary> |
| | | [SugarColumn(ColumnDescription = "电芯是否到位", IsJsonKey = true)] |
| | | [SugarColumn(ColumnDescription = "电芯是否到位")] |
| | | public bool BatteryArrived { get; set; } |
| | | } |
| | | } |
| | | } |