add - 添加AGV接口的实体类

master
SoulStar 4 months ago
parent 06b6dc503c
commit 1171d1cd87

@ -0,0 +1,22 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace SlnMesnac.Model.AirportApiEntity
{
/// <summary>
/// 获取当前激活地图信息响应实体类
/// </summary>
public class ResponseActiveMapDataEntity
{
/// <summary>
/// 地图ID
/// </summary>
public string guid { get; set; }
/// <summary>
/// 地图名称
/// </summary>
public string name { get; set; }
}
}

@ -0,0 +1,125 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace SlnMesnac.Model.AirportApiEntity
{
/// <summary>
/// 下发任务请求实体类
/// </summary>
public class AGVRequestAddTaskEntity
{
/// <summary>
/// 任务单ID-AGVC的任务ID
/// </summary>
public string businessOrderId { get; set; }
/// <summary>
/// 设备类型
/// </summary>
public string RobotType { get; set; }
/// <summary>
/// 优先级 默认值0
/// </summary>
public int priority { get; set; } = 0;
/// <summary>
/// 机器人ID
/// </summary>
public string roborId { get; set; }
/// <summary>
/// 分组ID 默认空
/// </summary>
public string group { get; set; } = string.Empty;
/// <summary>
/// 任务来源,调度系统名称 默认值Mesnac
/// </summary>
public string taskSource { get; set; } = "Mesnac";
/// <summary>
/// 任务类型 0)none 默认值3
/// </summary>
public int taskType { get; set; } = 3;
/// <summary>
/// 验证任务 0不验证 1需要验证 传0
/// </summary>
public int verifyStatus { get; set; }
/// <summary>
/// 是否允许分⻋执⾏(默认FALSE)
/// </summary>
public int? enableSplitCar { get; set; }
/// <summary>
/// 任务描述
/// </summary>
public string? desc { get; set; }
/// <summary>
/// 装货点
/// </summary>
public List<LoadsEntity> load { get; set; }
/// <summary>
/// 卸货点
/// </summary>
public List<LoadsEntity> unload { get; set; }
}
/// <summary>
/// 装载/卸载点位
/// </summary>
public class LoadsEntity
{
/// <summary>
/// 任务模板 默认空字符串
/// </summary>
public string jobid { get; set; } = string.Empty;
/// <summary>
/// 地图中的点位 默认空字符串
/// </summary>
public string loaction { get; set; } = string.Empty;
/// <summary>
/// 参数 数据跟location一样
/// </summary>
public List<ParamEntity> param { get; set; }
/// <summary>
/// 默认空字符串
/// </summary>
public string robotPort { get; set; } = string.Empty;
}
/// <summary>
/// 不知道是啥 paramvalue点位跟load一样
/// </summary>
public class ParamEntity
{
/// <summary>
/// 参数名称 默认空字符串
/// </summary>
public string paramname { get; set; } = string.Empty;
/// <summary>
/// 参数值 默认空字符串
/// </summary>
public string paramvalue { get; set; } = string.Empty;
}
/// <summary>
/// 下发任务成功响应数据
/// </summary>
public class ResponseAddTaskDataEntity
{
/// <summary>
/// AGV任务ID
/// </summary>
public string guid { get; set; }
}
}

@ -1,39 +0,0 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace SlnMesnac.Model.AirportApiEntity
{
public class AGVCallSingalEntity
{
/// <summary>
/// AGV编号
/// </summary>
public string AGVNo { get; set; }
/// <summary>
/// AGV类型
/// </summary>
public string AGVType { get; set; }
/// <summary>
/// 起始地编号
/// </summary>
public string StartingPointNo { get; set; }
/// <summary>
/// 目的地编号
/// </summary>
public string DestinationNo { get; set; }
/// <summary>
/// 任务编号
/// </summary>
public string TaskNo { get; set; }
/// <summary>
/// 信号发送时间
/// </summary>
public string SignalSendTime { get; set; }
}
}

@ -0,0 +1,45 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace SlnMesnac.Model.AirportApiEntity
{
/// <summary>
/// 获取当前地图所有位置点请求实体类get方法
/// </summary>
[Obsolete]
public class AGVRequestMapPositionEntity
{
/// <summary>
/// 地图ID
/// </summary>
public string mapId { get; set; }
}
/// <summary>
/// 当前地图所有位置点响应数据实体类
/// </summary>
public class ResponseMapPositionDataEntity
{
/// <summary>
/// 点位名称
/// </summary>
public string name { get; set; }
/// <summary>
/// 所属地图ID
/// </summary>
public string mapId { get; set; }
/// <summary>
/// 位置点类型 0普通 1⾼精度 2充电桩 3闲置点
/// </summary>
public int type { get; set; }
/// <summary>
/// 点位ID
/// </summary>
public string guid { get; set; }
}
}

@ -0,0 +1,37 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace SlnMesnac.Model.AirportApiEntity
{
/// <summary>
/// 取消/终止任务请求实体类
/// </summary>
public class AGVRequestOperationalTaskEntity
{
/// <summary>
/// 任务ID
/// </summary>
public string taskid { get; set; }
/// <summary>
/// 状态0终止 4取消
/// </summary>
public int state { get; set; }
/// <summary>
/// 操作源
/// </summary>
public string operatingSource { get; set; }
/// <summary>
/// 操作用户
/// </summary>
public string operatingUser { get; set; }
/// <summary>
/// 操作说明
/// </summary>
public string remark { get; set; }
}
}

@ -0,0 +1,34 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace SlnMesnac.Model.AirportApiEntity
{
/// <summary>
/// AGV返回值 根类型 实体类
/// </summary>
/// <typeparam name="T"></typeparam>
public class AGVResponseEntity<T> where T : class
{
/// <summary>
/// 代码
/// </summary>
public int code { get; set; }
/// <summary>
/// 数据体
/// </summary>
public T? Data { get; set; }
/// <summary>
/// 信息
/// </summary>
public string message { get; set; }
/// <summary>
/// 计数
/// </summary>
public int? count { get; set; }
}
}

@ -0,0 +1,127 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace SlnMesnac.Model.AirportApiEntity
{
/// <summary>
/// 获取车辆所有信息响应实体类
/// </summary>
public class ResponseRobotAtrributeDataEntity
{
/// <summary>
/// 机器人ID
/// </summary>
public string Guid { get; set; }
/// <summary>
/// 机器人名称
/// </summary>
public string Name { get; set; }
/// <summary>
/// 运动状态
/// 0暂⽆信息 1待机 2执⾏任务 3充电中 4暂停 5急停 6异常 7建图中 8等待 9调度控制
/// ?(文档空缺)任务暂停 51同步 52脱机
/// </summary>
public int AgvMoveStatus { get; set; }
/// <summary>
/// 任务模板ID
/// </summary>
public string jobId { get; set; }
/// <summary>
/// 子任务ID
/// </summary>
public string orderId { get; set; }
/// <summary>
/// 任务ID
/// </summary>
public string TaskID { get; set; }
/// <summary>
/// 当前执行动作
/// </summary>
public CurrentActionEntity currentAction { get; set; }
/// <summary>
/// 错误
/// </summary>
public List<AGVErrorEntity> error { get; set; }
}
/// <summary>
/// 车辆当前执行动作实体类
/// </summary>
public class CurrentActionEntity
{
/// <summary>
/// 动作ID
/// </summary>
public string guid { get; set; }
/// <summary>
/// 任务类型
/// 1移动 2播放声⾳ 3亮灯带 4停留 5检查位置状态 6占地⾯积 7切换地图 8移动⾄预备位置 9停靠
/// 10相对移动 11等待 12if else 13设置plc 14:等待plc 15停⽌⾳效 16停⽌灯带 17:暂停 18loop
/// 23while 29任务模板
/// </summary>
public string actionType { get; set; }
/// <summary>
/// 参数列表
/// </summary>
public List<AGVCurrentActionParamesEntity> Parames { get; set; }
}
/// <summary>
/// 车辆动作参数实体类
/// </summary>
public class AGVCurrentActionParamesEntity
{
/// <summary>
/// 动作参数guid
/// </summary>
public string guid { get; set; }
/// <summary>
/// 参数名称
/// </summary>
public string paramName { get; set; }
/// <summary>
/// 动作类型
/// </summary>
public int type { get; set; }
/// <summary>
/// 参数值
/// </summary>
public string value { get; set; }
}
/// <summary>
/// 车辆错误信息实体类
/// </summary>
public class AGVErrorEntity
{
/// <summary>
/// 错误码
/// </summary>
public int errorCode { get; set; }
/// <summary>
/// 错误模块
/// </summary>
public int errorModule { get; set; }
/// <summary>
/// 错误消息
/// </summary>
public string errorMsg { get; set; }
}
}

@ -4,7 +4,7 @@ using System.Text;
namespace SlnMesnac.Model.AirportApiEntity
{
public class AGVArrivalSingalEntity
public class AGVSingalEntity
{
/// <summary>
/// AGV编号

@ -1,57 +0,0 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace SlnMesnac.Model.AirportApiEntity
{
public class AGVStateRequestEntity
{
/// <summary>
/// AGV编号
/// </summary>
public string AGVNo { get; set; }
/// <summary>
/// 信号发送时间
/// </summary>
public string SignalSendTime { get; set; }
}
public class AGVStateResponseEntity
{
/// <summary>
/// AGV编号
/// </summary>
public string AGVNo { get; set; }
/// <summary>
/// AGV类型1机械臂小车2运载小车
/// </summary>
public string AGVType { get; set; }
/// <summary>
/// AGV报警状态1正常2故障
/// </summary>
public string AGVAlarmState { get; set; }
/// <summary>
/// AGV工作状态1空闲2忙碌
/// </summary>
public string AGVWorkState { get; set; }
/// <summary>
/// 报警信息
/// </summary>
public string AlarmText { get; set; }
/// <summary>
/// 任务编号
/// </summary>
public string TaskNo { get; set; }
/// <summary>
/// 信号发送时间
/// </summary>
public string SignalSendTime { get; set; }
}
}

@ -0,0 +1,43 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace SlnMesnac.Model.AirportApiEntity
{
/// <summary>
/// 查询任务状态请求实体类
/// </summary>
public class AGVRequestTaskStateDetailEntity
{
/// <summary>
/// 任务ID
/// </summary>
public string taskId { get; set; }
}
/// <summary>
/// 任务状态响应数据
/// </summary>
public class ResponseTaskStateDetailDataEntity
{
/// <summary>
/// 任务ID
/// </summary>
public string taskId { get; set; }
/// <summary>
/// 状态 0已终⽌ 1待执⾏ 2正在执⾏ 3已完成 4已取消 5已暂停 6匹配中 7: 核验中
/// </summary>
public int state { get; set; }
/// <summary>
/// 车辆ID
/// </summary>
public string robotId { get; set; }
/// <summary>
/// 车辆名称
/// </summary>
public string robotName { get; set; }
}
}

@ -1,36 +0,0 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace SlnMesnac.Model.AirportApiEntity
{
public class ManipulatorStartWorkEntity
{
/// <summary>
/// 机械臂编号
/// </summary>
public string ManipulatorNo { get; set; }
/// <summary>
/// 运载小车编号
/// </summary>
public string CarryAGVNo { get; set; }
/// <summary>
/// 传送带编号
/// </summary>
public string ConveyorNo { get; set; }
/// <summary>
/// 任务编号
/// </summary>
public string TaskNo { get; set; }
/// <summary>
/// 信号发送时间
/// </summary>
public string SignalSendTime { get; set; }
}
}

@ -1,54 +0,0 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace SlnMesnac.Model.AirportApiEntity
{
public class ManipulatorStateRequestEntity
{
/// <summary>
/// 机械臂编号
/// </summary>
public string ManipulatorNo { get; set; }
/// <summary>
/// 信号发送时间
/// </summary>
public string SignalSendTime { get; set; }
}
public class ManipulatorStateResponseEntity
{
/// <summary>
/// 机械臂编号
/// </summary>
public string ManipulatorNo { get; set; }
/// <summary>
/// 机械臂报警状态1正常2故障
/// </summary>
public string ManipulatorAlarmState { get; set; }
/// <summary>
/// 机械臂工作状态1空闲2工作
/// </summary>
public string ManipulatorWorkState { get; set; }
/// <summary>
/// 报警信息
/// </summary>
public string AlarmText { get; set; }
/// <summary>
/// 任务编号
/// </summary>
public string TaskNo { get; set; }
/// <summary>
/// 信号发送时间
/// </summary>
public string SignalSendTime { get; set; }
}
}

@ -1,61 +0,0 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace SlnMesnac.Model.AirportApiEntity
{
public class ManipulatorWorkDoneEntity
{
/// <summary>
/// 机械臂编号
/// </summary>
public string ManipulatorNo { get; set; }
/// <summary>
/// 运载小车编号
/// </summary>
public string CarryAGVNo { get; set; }
/// <summary>
/// 传送带编号
/// </summary>
public string ConveyorNo { get; set; }
/// <summary>
/// 此次抓取数量
/// </summary>
public int NowCarryNumber { get; set; }
/// <summary>
/// 小车装载数量
/// </summary>
public int CarrierLoadNumber { get; set; }
/// <summary>
/// 此次工作总抓取数量
/// </summary>
public int AllCarryNumber { get; set; }
/// <summary>
/// 装载方向1机械臂小车2装载小车
/// </summary>
public string LoadLocation { get; set; }
/// <summary>
/// 工作是否结束0未结束1结束
/// </summary>
public string WorkIsDone { get; set; }
/// <summary>
/// 任务编号
/// </summary>
public string TaskNo { get; set; }
/// <summary>
/// 信号发送时间
/// </summary>
public string SignalSendTime { get; set; }
}
}

@ -70,18 +70,7 @@ namespace SlnMesnac.TouchSocket
/// <returns></returns>
public static string AGVCallRequest()
{
JToken responseValue = AirportAGVClient.InvokeT<JToken>("POST:", null, new AGVArrivalSingalEntity());
return responseValue.ToString();
}
/// <summary>
/// 机械臂开始工作请求
/// </summary>
/// <returns></returns>
public static string ManipulatorStartRequest()
{
JToken responseValue = AirportAGVClient.InvokeT<JToken>("POST:", null, new AGVArrivalSingalEntity());
JToken responseValue = AirportAGVClient.InvokeT<JToken>("POST:", null, new AGVSingalEntity());
return responseValue.ToString();
}
@ -108,26 +97,5 @@ namespace SlnMesnac.TouchSocket
return aGVStateResponseEntity;
}
/// <summary>
/// 机械臂状态请求
/// </summary>
/// <param name="manipulatorStateRequest"></param>
/// <returns></returns>
public static ManipulatorStateResponseEntity ManipulatorStateRequest(ManipulatorStateRequestEntity manipulatorStateRequest)
{
JToken responseValue = AirportAGVClient.InvokeT<JToken>("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<ManipulatorStateResponseEntity>(json);
return manipulatorState;
}
}
}

@ -36,7 +36,7 @@ namespace SlnMesnac.TouchSocket
}
public delegate void AGVArrivalStart(string message, AGVArrivalSingalEntity aGVArrivalSingalEntity);
public delegate void AGVArrivalStart(string message, AGVSingalEntity aGVArrivalSingalEntity);
/// <summary>
/// AGV到位信号刷新
/// </summary>
@ -49,32 +49,12 @@ namespace SlnMesnac.TouchSocket
/// <returns></returns>
[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);
/// <summary>
/// 机械臂抓取完毕事件刷新
/// </summary>
public event ManipulatorWorkDoneStart ManipulatorWorkDoneEvent;
/// <summary>
/// 机械臂抓取完毕信号接口
/// </summary>
/// <param name="messageHeader"></param>
/// <returns></returns>
[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}");

@ -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());

Loading…
Cancel
Save