@@ -1602,36 +1602,91 @@ | |||||
主键 | 主键 | ||||
</summary> | </summary> | ||||
</member> | </member> | ||||
<member name="P:BPA.MES.Base.Application.Services.AGVService.Dtos.AGVThirdPartyInputBaseDto.robotJobId"> | |||||
<member name="T:BPA.MES.Base.Application.Services.AGVService.Dtos.AGVExecuteReplyDto"> | |||||
<summary> | |||||
任务完成回报Dto | |||||
</summary> | |||||
</member> | |||||
<member name="P:BPA.MES.Base.Application.Services.AGVService.Dtos.AGVExecuteReplyDto.robotJobId"> | |||||
<summary> | <summary> | ||||
上游系统任务号,全局唯一 | 上游系统任务号,全局唯一 | ||||
</summary> | </summary> | ||||
</member> | </member> | ||||
<member name="P:BPA.MES.Base.Application.Services.AGVService.Dtos.AGVThirdPartyInputBaseDto.warehouseId"> | |||||
<member name="P:BPA.MES.Base.Application.Services.AGVService.Dtos.AGVExecuteReplyDto.warehouseId"> | |||||
<summary> | <summary> | ||||
仓库编号 | 仓库编号 | ||||
</summary> | </summary> | ||||
</member> | </member> | ||||
<member name="P:BPA.MES.Base.Application.Services.AGVService.Dtos.AGVThirdPartyInputBaseDto.jobId"> | |||||
<member name="P:BPA.MES.Base.Application.Services.AGVService.Dtos.AGVExecuteReplyDto.jobId"> | |||||
<summary> | <summary> | ||||
任务快仓系统编号 | 任务快仓系统编号 | ||||
</summary> | </summary> | ||||
</member> | </member> | ||||
<member name="P:BPA.MES.Base.Application.Services.AGVService.Dtos.AGVThirdPartyInputBaseDto.state"> | |||||
<member name="P:BPA.MES.Base.Application.Services.AGVService.Dtos.AGVExecuteReplyDto.state"> | |||||
<summary> | <summary> | ||||
</summary> | </summary> | ||||
</member> | </member> | ||||
<member name="P:BPA.MES.Base.Application.Services.AGVService.Dtos.AGVThirdPartyInputBaseDto.jobType"> | |||||
<member name="P:BPA.MES.Base.Application.Services.AGVService.Dtos.AGVExecuteReplyDto.jobType"> | |||||
<summary> | <summary> | ||||
内部任务类型 | 内部任务类型 | ||||
</summary> | </summary> | ||||
</member> | </member> | ||||
<member name="P:BPA.MES.Base.Application.Services.AGVService.Dtos.AGVThirdPartyInputBaseDto.jobData"> | |||||
<member name="P:BPA.MES.Base.Application.Services.AGVService.Dtos.AGVExecuteReplyDto.jobData"> | |||||
<summary> | <summary> | ||||
数据字段 | 数据字段 | ||||
</summary> | </summary> | ||||
</member> | </member> | ||||
<member name="T:BPA.MES.Base.Application.Services.AGVService.Dtos.AGVLoadAndUnloadDto"> | |||||
<summary> | |||||
上下料交互请求DTO | |||||
</summary> | |||||
</member> | |||||
<member name="P:BPA.MES.Base.Application.Services.AGVService.Dtos.AGVLoadAndUnloadDto.agvCode"> | |||||
<summary> | |||||
AGV编号 | |||||
</summary> | |||||
</member> | |||||
<member name="P:BPA.MES.Base.Application.Services.AGVService.Dtos.AGVLoadAndUnloadDto.containerCode"> | |||||
<summary> | |||||
容器编号,如果一次上/下多个容器,则多个容器用英文逗号分隔 | |||||
</summary> | |||||
</member> | |||||
<member name="P:BPA.MES.Base.Application.Services.AGVService.Dtos.AGVLoadAndUnloadDto.equipmentId"> | |||||
<summary> | |||||
上游设备ID | |||||
</summary> | |||||
</member> | |||||
<member name="P:BPA.MES.Base.Application.Services.AGVService.Dtos.AGVLoadAndUnloadDto.equipmentIds"> | |||||
<summary> | |||||
上游设备ID,多个用英文逗号分隔 | |||||
</summary> | |||||
</member> | |||||
<member name="P:BPA.MES.Base.Application.Services.AGVService.Dtos.AGVLoadAndUnloadDto.jobId"> | |||||
<summary> | |||||
快仓任务编号 | |||||
</summary> | |||||
</member> | |||||
<member name="P:BPA.MES.Base.Application.Services.AGVService.Dtos.AGVLoadAndUnloadDto.msgId"> | |||||
<summary> | |||||
消息ID | |||||
</summary> | |||||
</member> | |||||
<member name="P:BPA.MES.Base.Application.Services.AGVService.Dtos.AGVLoadAndUnloadDto.command"> | |||||
<summary> | |||||
交互阶段LOAD:上料阶段 UNLOAD:下料阶段 | |||||
</summary> | |||||
</member> | |||||
<member name="P:BPA.MES.Base.Application.Services.AGVService.Dtos.AGVLoadAndUnloadDto.robotJobId"> | |||||
<summary> | |||||
上游任务号 | |||||
</summary> | |||||
</member> | |||||
<member name="T:BPA.MES.Base.Application.Services.AGVService.Dtos.GoodsToGoods"> | |||||
<summary> | |||||
货到货 | |||||
</summary> | |||||
</member> | |||||
<member name="P:BPA.MES.Base.Application.Services.AGVService.Dtos.GoodsToGoods.agvCode"> | <member name="P:BPA.MES.Base.Application.Services.AGVService.Dtos.GoodsToGoods.agvCode"> | ||||
<summary> | <summary> | ||||
AGV编号 | AGV编号 | ||||
@@ -1811,6 +1866,48 @@ | |||||
<param name="kCCancelRequest"></param> | <param name="kCCancelRequest"></param> | ||||
<returns></returns> | <returns></returns> | ||||
</member> | </member> | ||||
<member name="M:BPA.MES.Base.Application.Services.AGVService.Services.AGVThirdPartyService.ExecuteReplyAsync(BPA.MES.Base.Application.Services.AGVService.Dtos.AGVExecuteReplyRequest)"> | |||||
<summary> | |||||
任务回调 | |||||
</summary> | |||||
<param name="input"></param> | |||||
<returns></returns> | |||||
</member> | |||||
<member name="M:BPA.MES.Base.Application.Services.AGVService.Services.AGVThirdPartyService.LoadAndUnloadAsync(BPA.MES.Base.Application.Services.AGVService.Dtos.AGVLoadAndUnloadRequest)"> | |||||
<summary> | |||||
AGV上下料交互请求 | |||||
</summary> | |||||
<param name="input"></param> | |||||
<returns></returns> | |||||
</member> | |||||
<member name="M:BPA.MES.Base.Application.Services.AGVService.Services.IAGVThirdPartyService.ExecuteAsync(BPA.AGV.KCExecuteRequest)"> | |||||
<summary> | |||||
下发任务 | |||||
</summary> | |||||
<param name="cExecuteRequest"></param> | |||||
<returns></returns> | |||||
</member> | |||||
<member name="M:BPA.MES.Base.Application.Services.AGVService.Services.IAGVThirdPartyService.CancelAsync(BPA.AGV.KCCancelRequest)"> | |||||
<summary> | |||||
取消任务 | |||||
</summary> | |||||
<param name="kCCancelRequest"></param> | |||||
<returns></returns> | |||||
</member> | |||||
<member name="M:BPA.MES.Base.Application.Services.AGVService.Services.IAGVThirdPartyService.ExecuteReplyAsync(BPA.MES.Base.Application.Services.AGVService.Dtos.AGVExecuteReplyRequest)"> | |||||
<summary> | |||||
任务回调 | |||||
</summary> | |||||
<param name="input"></param> | |||||
<returns></returns> | |||||
</member> | |||||
<member name="M:BPA.MES.Base.Application.Services.AGVService.Services.IAGVThirdPartyService.LoadAndUnloadAsync(BPA.MES.Base.Application.Services.AGVService.Dtos.AGVLoadAndUnloadRequest)"> | |||||
<summary> | |||||
AGV上下料交互请求 | |||||
</summary> | |||||
<param name="input"></param> | |||||
<returns></returns> | |||||
</member> | |||||
<member name="T:BPA.MES.Base.Application.Services.AgvPointService"> | <member name="T:BPA.MES.Base.Application.Services.AgvPointService"> | ||||
<summary> | <summary> | ||||
名 称 :AGV点位管理 | 名 称 :AGV点位管理 | ||||
@@ -6,7 +6,21 @@ using System.Threading.Tasks; | |||||
namespace BPA.MES.Base.Application.Services.AGVService.Dtos | namespace BPA.MES.Base.Application.Services.AGVService.Dtos | ||||
{ | { | ||||
public class AGVThirdPartyInputBaseDto | |||||
public class AGVExecuteReplyRequest | |||||
{ | |||||
public AGVExecuteReplyDto Event { get; set; } | |||||
} | |||||
public class AGVLoadAndUnloadRequest | |||||
{ | |||||
public AGVLoadAndUnloadDto Event { get; set; } | |||||
} | |||||
/// <summary> | |||||
/// 任务完成回报Dto | |||||
/// </summary> | |||||
public class AGVExecuteReplyDto | |||||
{ | { | ||||
/// <summary> | /// <summary> | ||||
/// 上游系统任务号,全局唯一 | /// 上游系统任务号,全局唯一 | ||||
@@ -31,7 +45,7 @@ namespace BPA.MES.Base.Application.Services.AGVService.Dtos | |||||
/// <summary> | /// <summary> | ||||
/// 内部任务类型 | /// 内部任务类型 | ||||
/// </summary> | /// </summary> | ||||
public jobType jobType { get; set; } | |||||
public string jobType { get; set; } | |||||
/// <summary> | /// <summary> | ||||
/// 数据字段 | /// 数据字段 | ||||
@@ -40,7 +54,57 @@ namespace BPA.MES.Base.Application.Services.AGVService.Dtos | |||||
} | } | ||||
/// <summary> | |||||
/// 上下料交互请求DTO | |||||
/// </summary> | |||||
public class AGVLoadAndUnloadDto | |||||
{ | |||||
/// <summary> | |||||
/// AGV编号 | |||||
/// </summary> | |||||
public string agvCode { get; set; } | |||||
/// <summary> | |||||
/// 容器编号,如果一次上/下多个容器,则多个容器用英文逗号分隔 | |||||
/// </summary> | |||||
public string containerCode { get; set; } | |||||
/// <summary> | |||||
/// 上游设备ID | |||||
/// </summary> | |||||
public long equipmentId { get; set; } | |||||
/// <summary> | |||||
/// 上游设备ID,多个用英文逗号分隔 | |||||
/// </summary> | |||||
public string equipmentIds { get; set; } | |||||
/// <summary> | |||||
/// 快仓任务编号 | |||||
/// </summary> | |||||
public string jobId { get; set; } | |||||
/// <summary> | |||||
/// 消息ID | |||||
/// </summary> | |||||
public string msgId { get; set; } | |||||
/// <summary> | |||||
/// 交互阶段LOAD:上料阶段 UNLOAD:下料阶段 | |||||
/// </summary> | |||||
public string command { get; set; } | |||||
/// <summary> | |||||
/// 上游任务号 | |||||
/// </summary> | |||||
public string robotJobId { get; set; } | |||||
} | |||||
/// <summary> | |||||
/// 货到货 | |||||
/// </summary> | |||||
public class GoodsToGoods | public class GoodsToGoods | ||||
{ | { | ||||
/// <summary> | /// <summary> | ||||
@@ -195,6 +259,7 @@ namespace BPA.MES.Base.Application.Services.AGVService.Dtos | |||||
/// 1) 辊筒货位到货位搬运 | /// 1) 辊筒货位到货位搬运 | ||||
/// </summary> | /// </summary> | ||||
SLOT_ROLLER_MOVE = 1, | SLOT_ROLLER_MOVE = 1, | ||||
POINT_ROLLER_MOVE=2 | |||||
} | } | ||||
} | } |
@@ -1,4 +1,8 @@ | |||||
using BPA.AGV; | using BPA.AGV; | ||||
using BPA.MES.Base.Application.Services.AGVService.Dtos; | |||||
using MQTTnet.Client; | |||||
using MQTTnet.Client.Publishing; | |||||
using Newtonsoft.Json; | |||||
using System; | using System; | ||||
using System.Collections.Generic; | using System.Collections.Generic; | ||||
using System.Linq; | using System.Linq; | ||||
@@ -8,12 +12,15 @@ using System.Threading.Tasks; | |||||
namespace BPA.MES.Base.Application.Services.AGVService.Services | namespace BPA.MES.Base.Application.Services.AGVService.Services | ||||
{ | { | ||||
[AllowAnonymous, NonUnify] | |||||
[ApiDescriptionSettings("AGV管理", Name = "AgvThirdParty", Tag = "AGV第三方api", KeepName = true, SplitCamelCase = true, KeepVerb = true)] | [ApiDescriptionSettings("AGV管理", Name = "AgvThirdParty", Tag = "AGV第三方api", KeepName = true, SplitCamelCase = true, KeepVerb = true)] | ||||
public class AGVThirdPartyService:IAGVThirdPartyService, ITransient, IDynamicApiController | public class AGVThirdPartyService:IAGVThirdPartyService, ITransient, IDynamicApiController | ||||
{ | { | ||||
private readonly AGVHandler _aGVHandler; | private readonly AGVHandler _aGVHandler; | ||||
public AGVThirdPartyService(AGVHandler aGVHandler) | |||||
private readonly IMqttClient _client; | |||||
public AGVThirdPartyService(AGVHandler aGVHandler, IMqttClient client) | |||||
{ | { | ||||
_client = client; | |||||
_aGVHandler = aGVHandler; | _aGVHandler = aGVHandler; | ||||
} | } | ||||
@@ -54,6 +61,57 @@ namespace BPA.MES.Base.Application.Services.AGVService.Services | |||||
return await _aGVHandler.CancelAsync(kCCancelRequest); | return await _aGVHandler.CancelAsync(kCCancelRequest); | ||||
} | } | ||||
/// <summary> | |||||
/// 任务回调 | |||||
/// </summary> | |||||
/// <param name="input"></param> | |||||
/// <returns></returns> | |||||
[HttpPost] | |||||
public async Task<bool> ExecuteReplyAsync(AGVExecuteReplyRequest input) | |||||
{ | |||||
try | |||||
{ | |||||
var applicationMessage = new MQTTnet.MqttApplicationMessageBuilder() | |||||
.WithTopic("robotjob.report") | |||||
.WithPayload(JsonConvert.SerializeObject(input.Event)) | |||||
.WithAtLeastOnceQoS() | |||||
.Build(); | |||||
var result = await _client.PublishAsync(applicationMessage); | |||||
return result.ReasonCode == MqttClientPublishReasonCode.Success; | |||||
} | |||||
catch (Exception e) | |||||
{ | |||||
return false; | |||||
} | |||||
} | |||||
/// <summary> | |||||
/// AGV上下料交互请求 | |||||
/// </summary> | |||||
/// <param name="input"></param> | |||||
/// <returns></returns> | |||||
[HttpPost] | |||||
public async Task<bool> LoadAndUnloadAsync(AGVLoadAndUnloadRequest input) | |||||
{ | |||||
try | |||||
{ | |||||
var applicationMessage = new MQTTnet.MqttApplicationMessageBuilder() | |||||
.WithTopic("rollerjob.upstreamrequest") | |||||
.WithPayload(JsonConvert.SerializeObject(input.Event)) | |||||
.WithAtLeastOnceQoS() | |||||
.Build(); | |||||
var result = await _client.PublishAsync(applicationMessage); | |||||
return result.ReasonCode == MqttClientPublishReasonCode.Success; | |||||
} | |||||
catch (Exception e) | |||||
{ | |||||
return false; | |||||
} | |||||
} | |||||
} | } | ||||
} | } |
@@ -1,4 +1,6 @@ | |||||
using System; | |||||
using BPA.AGV; | |||||
using BPA.MES.Base.Application.Services.AGVService.Dtos; | |||||
using System; | |||||
using System.Collections.Generic; | using System.Collections.Generic; | ||||
using System.Linq; | using System.Linq; | ||||
using System.Text; | using System.Text; | ||||
@@ -6,7 +8,37 @@ using System.Threading.Tasks; | |||||
namespace BPA.MES.Base.Application.Services.AGVService.Services | namespace BPA.MES.Base.Application.Services.AGVService.Services | ||||
{ | { | ||||
public class IAGVThirdPartyService | |||||
public interface IAGVThirdPartyService | |||||
{ | { | ||||
/// <summary> | |||||
/// 下发任务 | |||||
/// </summary> | |||||
/// <param name="cExecuteRequest"></param> | |||||
/// <returns></returns> | |||||
Task<KCResponse> ExecuteAsync(KCExecuteRequest cExecuteRequest); | |||||
/// <summary> | |||||
/// 取消任务 | |||||
/// </summary> | |||||
/// <param name="kCCancelRequest"></param> | |||||
/// <returns></returns> | |||||
Task<KCResponse> CancelAsync(KCCancelRequest kCCancelRequest); | |||||
/// <summary> | |||||
/// 任务回调 | |||||
/// </summary> | |||||
/// <param name="input"></param> | |||||
/// <returns></returns> | |||||
Task<bool> ExecuteReplyAsync(AGVExecuteReplyRequest input); | |||||
/// <summary> | |||||
/// AGV上下料交互请求 | |||||
/// </summary> | |||||
/// <param name="input"></param> | |||||
/// <returns></returns> | |||||
Task<bool> LoadAndUnloadAsync(AGVLoadAndUnloadRequest input); | |||||
} | } | ||||
} | } |
@@ -45,16 +45,17 @@ public class Startup : AppStartup | |||||
services.AddWebApiClient(); | services.AddWebApiClient(); | ||||
services.AddAGV(op => | services.AddAGV(op => | ||||
{ | { | ||||
op = new AGVOptions() | |||||
new AGVOptions() | |||||
{ | { | ||||
Header=new KCOption() | Header=new KCOption() | ||||
{ | { | ||||
AppKey="43", | |||||
AppSecret="12", | |||||
RequestId= "43", | |||||
Timestamp= "2234234324", | |||||
Version= "2.9" | |||||
} | |||||
AppKey="43", | |||||
AppSecret="12", | |||||
RequestId= "43", | |||||
Timestamp= "2234234324", | |||||
Version= "2.9" | |||||
}, | |||||
Sign="123456" | |||||
}; | }; | ||||
}); | }); | ||||