diff --git a/SlnMesnac.Model/AirportApiEntity/AGVActiveMapEntity.cs b/SlnMesnac.Model/AirportApiEntity/AGVActiveMapEntity.cs new file mode 100644 index 0000000..76444f6 --- /dev/null +++ b/SlnMesnac.Model/AirportApiEntity/AGVActiveMapEntity.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace SlnMesnac.Model.AirportApiEntity +{ + /// + /// 获取当前激活地图信息响应实体类 + /// + public class ResponseActiveMapDataEntity + { + /// + /// 地图ID + /// + public string guid { get; set; } + + /// + /// 地图名称 + /// + public string name { get; set; } + } +} diff --git a/SlnMesnac.Model/AirportApiEntity/AGVAddTaskEntity.cs b/SlnMesnac.Model/AirportApiEntity/AGVAddTaskEntity.cs new file mode 100644 index 0000000..42d4d99 --- /dev/null +++ b/SlnMesnac.Model/AirportApiEntity/AGVAddTaskEntity.cs @@ -0,0 +1,125 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace SlnMesnac.Model.AirportApiEntity +{ + /// + /// 下发任务请求实体类 + /// + public class AGVRequestAddTaskEntity + { + /// + /// 任务单ID-AGVC的任务ID + /// + public string businessOrderId { get; set; } + + /// + /// 设备类型 + /// + public string RobotType { get; set; } + + /// + /// 优先级 默认值0 + /// + public int priority { get; set; } = 0; + + /// + /// 机器人ID + /// + public string roborId { get; set; } + + /// + /// 分组ID 默认空 + /// + public string group { get; set; } = string.Empty; + + /// + /// 任务来源,调度系统名称 默认值Mesnac + /// + public string taskSource { get; set; } = "Mesnac"; + + /// + /// 任务类型 0)none 默认值3 + /// + public int taskType { get; set; } = 3; + + /// + /// 验证任务 0:不验证 1:需要验证 传0 + /// + public int verifyStatus { get; set; } + + /// + /// 是否允许分⻋执⾏(默认FALSE) + /// + public int? enableSplitCar { get; set; } + + /// + /// 任务描述 + /// + public string? desc { get; set; } + + /// + /// 装货点 + /// + public List load { get; set; } + + /// + /// 卸货点 + /// + public List unload { get; set; } + } + + /// + /// 装载/卸载点位 + /// + public class LoadsEntity + { + /// + /// 任务模板 默认空字符串 + /// + public string jobid { get; set; } = string.Empty; + + /// + /// 地图中的点位 默认空字符串 + /// + public string loaction { get; set; } = string.Empty; + + /// + /// 参数 数据跟location一样 + /// + public List param { get; set; } + + /// + /// 默认空字符串 + /// + public string robotPort { get; set; } = string.Empty; + } + + /// + /// 不知道是啥 paramvalue点位跟load一样 + /// + public class ParamEntity + { + /// + /// 参数名称 默认空字符串 + /// + public string paramname { get; set; } = string.Empty; + + /// + /// 参数值 默认空字符串 + /// + public string paramvalue { get; set; } = string.Empty; + } + + /// + /// 下发任务成功响应数据 + /// + public class ResponseAddTaskDataEntity + { + /// + /// AGV任务ID + /// + public string guid { get; set; } + } +} diff --git a/SlnMesnac.Model/AirportApiEntity/AGVCallSingalEntity.cs b/SlnMesnac.Model/AirportApiEntity/AGVCallSingalEntity.cs deleted file mode 100644 index b58e770..0000000 --- a/SlnMesnac.Model/AirportApiEntity/AGVCallSingalEntity.cs +++ /dev/null @@ -1,39 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace SlnMesnac.Model.AirportApiEntity -{ - public class AGVCallSingalEntity - { - /// - /// AGV编号 - /// - public string AGVNo { get; set; } - - /// - /// AGV类型 - /// - public string AGVType { get; set; } - - /// - /// 起始地编号 - /// - public string StartingPointNo { get; set; } - - /// - /// 目的地编号 - /// - public string DestinationNo { get; set; } - - /// - /// 任务编号 - /// - public string TaskNo { get; set; } - - /// - /// 信号发送时间 - /// - public string SignalSendTime { get; set; } - } -} diff --git a/SlnMesnac.Model/AirportApiEntity/AGVMapPositionEntity.cs b/SlnMesnac.Model/AirportApiEntity/AGVMapPositionEntity.cs new file mode 100644 index 0000000..4b4ad49 --- /dev/null +++ b/SlnMesnac.Model/AirportApiEntity/AGVMapPositionEntity.cs @@ -0,0 +1,45 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace SlnMesnac.Model.AirportApiEntity +{ + /// + /// 获取当前地图所有位置点请求实体类(get方法) + /// + [Obsolete] + public class AGVRequestMapPositionEntity + { + /// + /// 地图ID + /// + public string mapId { get; set; } + } + + /// + /// 当前地图所有位置点响应数据实体类 + /// + public class ResponseMapPositionDataEntity + { + + /// + /// 点位名称 + /// + public string name { get; set; } + + /// + /// 所属地图ID + /// + public string mapId { get; set; } + + /// + /// 位置点类型 0:普通 1:⾼精度 2:充电桩 3:闲置点 + /// + public int type { get; set; } + + /// + /// 点位ID + /// + public string guid { get; set; } + } +} diff --git a/SlnMesnac.Model/AirportApiEntity/AGVOperationalTaskEntity.cs b/SlnMesnac.Model/AirportApiEntity/AGVOperationalTaskEntity.cs new file mode 100644 index 0000000..bdf044c --- /dev/null +++ b/SlnMesnac.Model/AirportApiEntity/AGVOperationalTaskEntity.cs @@ -0,0 +1,37 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace SlnMesnac.Model.AirportApiEntity +{ + /// + /// 取消/终止任务请求实体类 + /// + public class AGVRequestOperationalTaskEntity + { + /// + /// 任务ID + /// + public string taskid { get; set; } + + /// + /// 状态:0:终止 4:取消 + /// + public int state { get; set; } + + /// + /// 操作源 + /// + public string operatingSource { get; set; } + + /// + /// 操作用户 + /// + public string operatingUser { get; set; } + + /// + /// 操作说明 + /// + public string remark { get; set; } + } +} diff --git a/SlnMesnac.Model/AirportApiEntity/AGVResponseEntity.cs b/SlnMesnac.Model/AirportApiEntity/AGVResponseEntity.cs new file mode 100644 index 0000000..f01fec5 --- /dev/null +++ b/SlnMesnac.Model/AirportApiEntity/AGVResponseEntity.cs @@ -0,0 +1,34 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace SlnMesnac.Model.AirportApiEntity +{ + /// + /// AGV返回值 根类型 实体类 + /// + /// + public class AGVResponseEntity where T : class + { + /// + /// 代码 + /// + public int code { get; set; } + + /// + /// 数据体 + /// + public T? Data { get; set; } + + /// + /// 信息 + /// + public string message { get; set; } + + /// + /// 计数 + /// + public int? count { get; set; } + } + +} diff --git a/SlnMesnac.Model/AirportApiEntity/AGVRobotAtrributeEntity.cs b/SlnMesnac.Model/AirportApiEntity/AGVRobotAtrributeEntity.cs new file mode 100644 index 0000000..53e02d4 --- /dev/null +++ b/SlnMesnac.Model/AirportApiEntity/AGVRobotAtrributeEntity.cs @@ -0,0 +1,127 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace SlnMesnac.Model.AirportApiEntity +{ + /// + /// 获取车辆所有信息响应实体类 + /// + public class ResponseRobotAtrributeDataEntity + { + + /// + /// 机器人ID + /// + public string Guid { get; set; } + + /// + /// 机器人名称 + /// + public string Name { get; set; } + + /// + /// 运动状态 + /// 0:暂⽆信息 1:待机 2:执⾏任务 3:充电中 4:暂停 5:急停 6:异常 7:建图中 8:等待 9:调度控制 + /// ?(文档空缺)任务暂停 51:同步 52:脱机 + /// + public int AgvMoveStatus { get; set; } + + /// + /// 任务模板ID + /// + public string jobId { get; set; } + + /// + /// 子任务ID + /// + public string orderId { get; set; } + + /// + /// 任务ID + /// + public string TaskID { get; set; } + + /// + /// 当前执行动作 + /// + public CurrentActionEntity currentAction { get; set; } + + /// + /// 错误 + /// + public List error { get; set; } + + } + + /// + /// 车辆当前执行动作实体类 + /// + public class CurrentActionEntity + { + /// + /// 动作ID + /// + public string guid { get; set; } + + /// + /// 任务类型 + /// 1:移动 2:播放声⾳ 3:亮灯带 4:停留 5:检查位置状态 6:占地⾯积 7:切换地图 8:移动⾄预备位置 9:停靠 + /// 10:相对移动 11:等待 12:if else 13:设置plc 14:等待plc 15:停⽌⾳效 16:停⽌灯带 17:暂停 18:loop + /// 23:while 29:任务模板 + /// + public string actionType { get; set; } + + /// + /// 参数列表 + /// + public List Parames { get; set; } + } + + /// + /// 车辆动作参数实体类 + /// + public class AGVCurrentActionParamesEntity + { + /// + /// 动作参数guid + /// + public string guid { get; set; } + + /// + /// 参数名称 + /// + public string paramName { get; set; } + + /// + /// 动作类型 + /// + public int type { get; set; } + + /// + /// 参数值 + /// + public string value { get; set; } + } + + /// + /// 车辆错误信息实体类 + /// + public class AGVErrorEntity + { + /// + /// 错误码 + /// + public int errorCode { get; set; } + + /// + /// 错误模块 + /// + public int errorModule { get; set; } + + /// + /// 错误消息 + /// + public string errorMsg { get; set; } + } +} diff --git a/SlnMesnac.Model/AirportApiEntity/AGVArrivalSingalEntity.cs b/SlnMesnac.Model/AirportApiEntity/AGVSingalEntity.cs similarity index 94% rename from SlnMesnac.Model/AirportApiEntity/AGVArrivalSingalEntity.cs rename to SlnMesnac.Model/AirportApiEntity/AGVSingalEntity.cs index f31aafc..ba69db3 100644 --- a/SlnMesnac.Model/AirportApiEntity/AGVArrivalSingalEntity.cs +++ b/SlnMesnac.Model/AirportApiEntity/AGVSingalEntity.cs @@ -4,7 +4,7 @@ using System.Text; namespace SlnMesnac.Model.AirportApiEntity { - public class AGVArrivalSingalEntity + public class AGVSingalEntity { /// /// AGV编号 diff --git a/SlnMesnac.Model/AirportApiEntity/AGVStateEntity.cs b/SlnMesnac.Model/AirportApiEntity/AGVStateEntity.cs deleted file mode 100644 index 53b28aa..0000000 --- a/SlnMesnac.Model/AirportApiEntity/AGVStateEntity.cs +++ /dev/null @@ -1,57 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace SlnMesnac.Model.AirportApiEntity -{ - public class AGVStateRequestEntity - { - /// - /// AGV编号 - /// - public string AGVNo { get; set; } - - /// - /// 信号发送时间 - /// - public string SignalSendTime { get; set; } - } - - public class AGVStateResponseEntity - { - /// - /// AGV编号 - /// - public string AGVNo { get; set; } - - /// - /// AGV类型(1:机械臂小车,2:运载小车) - /// - public string AGVType { get; set; } - - /// - /// AGV报警状态(1:正常,2:故障) - /// - public string AGVAlarmState { get; set; } - - /// - /// AGV工作状态(1:空闲,2:忙碌) - /// - public string AGVWorkState { get; set; } - - /// - /// 报警信息 - /// - public string AlarmText { get; set; } - - /// - /// 任务编号 - /// - public string TaskNo { get; set; } - - /// - /// 信号发送时间 - /// - public string SignalSendTime { get; set; } - } -} diff --git a/SlnMesnac.Model/AirportApiEntity/AGVTaskStateDetailEntity.cs b/SlnMesnac.Model/AirportApiEntity/AGVTaskStateDetailEntity.cs new file mode 100644 index 0000000..94cb4ff --- /dev/null +++ b/SlnMesnac.Model/AirportApiEntity/AGVTaskStateDetailEntity.cs @@ -0,0 +1,43 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace SlnMesnac.Model.AirportApiEntity +{ + /// + /// 查询任务状态请求实体类 + /// + public class AGVRequestTaskStateDetailEntity + { + /// + /// 任务ID + /// + public string taskId { get; set; } + } + + /// + /// 任务状态响应数据 + /// + public class ResponseTaskStateDetailDataEntity + { + /// + /// 任务ID + /// + public string taskId { get; set; } + + /// + /// 状态 0:已终⽌ 1:待执⾏ 2:正在执⾏ 3:已完成 4:已取消 5:已暂停 6:匹配中 7: 核验中 + /// + public int state { get; set; } + + /// + /// 车辆ID + /// + public string robotId { get; set; } + + /// + /// 车辆名称 + /// + public string robotName { get; set; } + } +} diff --git a/SlnMesnac.Model/AirportApiEntity/ManipulatorStartWorkEntity.cs b/SlnMesnac.Model/AirportApiEntity/ManipulatorStartWorkEntity.cs deleted file mode 100644 index 8cf312a..0000000 --- a/SlnMesnac.Model/AirportApiEntity/ManipulatorStartWorkEntity.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace SlnMesnac.Model.AirportApiEntity -{ - public class ManipulatorStartWorkEntity - { - - /// - /// 机械臂编号 - /// - public string ManipulatorNo { get; set; } - - /// - /// 运载小车编号 - /// - public string CarryAGVNo { get; set; } - - /// - /// 传送带编号 - /// - public string ConveyorNo { get; set; } - - /// - /// 任务编号 - /// - public string TaskNo { get; set; } - - /// - /// 信号发送时间 - /// - public string SignalSendTime { get; set; } - - } -} diff --git a/SlnMesnac.Model/AirportApiEntity/ManipulatorStateEntity.cs b/SlnMesnac.Model/AirportApiEntity/ManipulatorStateEntity.cs deleted file mode 100644 index be865ae..0000000 --- a/SlnMesnac.Model/AirportApiEntity/ManipulatorStateEntity.cs +++ /dev/null @@ -1,54 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace SlnMesnac.Model.AirportApiEntity -{ - public class ManipulatorStateRequestEntity - { - /// - /// 机械臂编号 - /// - public string ManipulatorNo { get; set; } - - /// - /// 信号发送时间 - /// - public string SignalSendTime { get; set; } - } - - - public class ManipulatorStateResponseEntity - { - /// - /// 机械臂编号 - /// - public string ManipulatorNo { get; set; } - - /// - /// 机械臂报警状态(1:正常,2:故障) - /// - public string ManipulatorAlarmState { get; set; } - - /// - /// 机械臂工作状态(1:空闲,2:工作) - /// - public string ManipulatorWorkState { get; set; } - - /// - /// 报警信息 - /// - public string AlarmText { get; set; } - - /// - /// 任务编号 - /// - public string TaskNo { get; set; } - - /// - /// 信号发送时间 - /// - public string SignalSendTime { get; set; } - } - -} \ No newline at end of file diff --git a/SlnMesnac.Model/AirportApiEntity/ManipulatorWorkDoneEntity.cs b/SlnMesnac.Model/AirportApiEntity/ManipulatorWorkDoneEntity.cs deleted file mode 100644 index bffa616..0000000 --- a/SlnMesnac.Model/AirportApiEntity/ManipulatorWorkDoneEntity.cs +++ /dev/null @@ -1,61 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace SlnMesnac.Model.AirportApiEntity -{ - public class ManipulatorWorkDoneEntity - { - - /// - /// 机械臂编号 - /// - public string ManipulatorNo { get; set; } - - /// - /// 运载小车编号 - /// - public string CarryAGVNo { get; set; } - - /// - /// 传送带编号 - /// - public string ConveyorNo { get; set; } - - /// - /// 此次抓取数量 - /// - public int NowCarryNumber { get; set; } - - /// - /// 小车装载数量 - /// - public int CarrierLoadNumber { get; set; } - - /// - /// 此次工作总抓取数量 - /// - public int AllCarryNumber { get; set; } - - /// - /// 装载方向(1:机械臂小车,2:装载小车) - /// - public string LoadLocation { get; set; } - - /// - /// 工作是否结束(0:未结束,1:结束) - /// - public string WorkIsDone { get; set; } - - /// - /// 任务编号 - /// - public string TaskNo { get; set; } - - /// - /// 信号发送时间 - /// - public string SignalSendTime { get; set; } - - } -} diff --git a/SlnMesnac.TouchSocket/AirPorthttpClient.cs b/SlnMesnac.TouchSocket/AirPorthttpClient.cs index 8b27196..d3b4444 100644 --- a/SlnMesnac.TouchSocket/AirPorthttpClient.cs +++ b/SlnMesnac.TouchSocket/AirPorthttpClient.cs @@ -70,18 +70,7 @@ namespace SlnMesnac.TouchSocket /// public static string AGVCallRequest() { - JToken responseValue = AirportAGVClient.InvokeT("POST:", null, new AGVArrivalSingalEntity()); - - return responseValue.ToString(); - } - - /// - /// 机械臂开始工作请求 - /// - /// - public static string ManipulatorStartRequest() - { - JToken responseValue = AirportAGVClient.InvokeT("POST:", null, new AGVArrivalSingalEntity()); + JToken responseValue = AirportAGVClient.InvokeT("POST:", null, new AGVSingalEntity()); return responseValue.ToString(); } @@ -108,26 +97,5 @@ namespace SlnMesnac.TouchSocket return aGVStateResponseEntity; } - /// - /// 机械臂状态请求 - /// - /// - /// - public static ManipulatorStateResponseEntity ManipulatorStateRequest(ManipulatorStateRequestEntity manipulatorStateRequest) - { - JToken responseValue = AirportAGVClient.InvokeT("POST:/m1/5051269-4712337-default/apitest/manipulatortest", null, manipulatorStateRequest); - if (responseValue == null) - { - return new ManipulatorStateResponseEntity(); - } - string json = responseValue.ToString(); - if (string.IsNullOrEmpty(json)) - { - return new ManipulatorStateResponseEntity(); - } - ManipulatorStateResponseEntity manipulatorState = new ManipulatorStateResponseEntity(); - manipulatorState = JsonSerializer.Deserialize(json); - return manipulatorState; - } } } diff --git a/SlnMesnac.TouchSocket/ApiServer.cs b/SlnMesnac.TouchSocket/ApiServer.cs index 30b7e31..f294450 100644 --- a/SlnMesnac.TouchSocket/ApiServer.cs +++ b/SlnMesnac.TouchSocket/ApiServer.cs @@ -36,7 +36,7 @@ namespace SlnMesnac.TouchSocket } - public delegate void AGVArrivalStart(string message, AGVArrivalSingalEntity aGVArrivalSingalEntity); + public delegate void AGVArrivalStart(string message, AGVSingalEntity aGVArrivalSingalEntity); /// /// AGV到位信号刷新 /// @@ -49,32 +49,12 @@ namespace SlnMesnac.TouchSocket /// [EnableCors("cors")] [WebApi(HttpMethodType.POST)] - public object AGVArrivalSignal(string messageHeader, AGVArrivalSingalEntity aGVArrivalSingalEntity) + public object AGVSignal(string messageHeader, AGVSingalEntity aGVArrivalSingalEntity) { AGVArrivalStartEvent?.Invoke(messageHeader, aGVArrivalSingalEntity); return "Success"; } - public delegate void ManipulatorWorkDoneStart(string message, ManipulatorWorkDoneEntity manipulatorWorkDoneEntity); - /// - /// 机械臂抓取完毕事件刷新 - /// - public event ManipulatorWorkDoneStart ManipulatorWorkDoneEvent; - - /// - /// 机械臂抓取完毕信号接口 - /// - /// - /// - [EnableCors("cors")] - [WebApi(HttpMethodType.POST)] - public object ManipulatorWorkDone(string messageHeader, ManipulatorWorkDoneEntity manipulatorWorkDoneEntity) - { - ManipulatorWorkDoneEvent?.Invoke(messageHeader, manipulatorWorkDoneEntity); - return "Success"; - } - - public void SubscribeToAGVArrivalEvent() { // 订阅 AGV 到位事件 @@ -82,7 +62,7 @@ namespace SlnMesnac.TouchSocket } // 处理 AGV 到位事件的方法 - public void OnAGVArrival(string message, AGVArrivalSingalEntity aGVArrivalSingalEntity) + public void OnAGVArrival(string message, AGVSingalEntity aGVArrivalSingalEntity) { Console.WriteLine($"收到AGV到位信号: {message}"); Console.WriteLine($"AGV编号: {aGVArrivalSingalEntity.AGVNo}, 到达位置: {aGVArrivalSingalEntity.DestinationNo}"); diff --git a/SlnMesnac.WPF/MainWindow.xaml.cs b/SlnMesnac.WPF/MainWindow.xaml.cs index 6a06a5e..d1341fe 100644 --- a/SlnMesnac.WPF/MainWindow.xaml.cs +++ b/SlnMesnac.WPF/MainWindow.xaml.cs @@ -32,9 +32,7 @@ namespace SlnMesnac.WPF private void Button_Click(object sender, RoutedEventArgs e) { - var a = AirPorthttpClient.ManipulatorStateRequest(new ManipulatorStateRequestEntity()); - var b = AirPorthttpClient.AGVStateRequest(new AGVStateRequestEntity()); - +