using Autofac.Core;
|
using System;
|
using System.Collections.Generic;
|
using System.Linq;
|
using System.Text;
|
using System.Threading.Tasks;
|
using WIDESEA_Common.APIEnum;
|
using WIDESEA_Core;
|
using WIDESEA_Core.Helper;
|
using WIDESEA_DTO.AGV;
|
using WIDESEA_External.Model;
|
|
namespace WIDESEA_External.AGVService
|
{
|
public class InvokeAGVService : IInvokeAGVService
|
{
|
public static IInvokeAGVService Intance
|
{
|
get { return App.GetService<IInvokeAGVService>(); }
|
}
|
/// <summary>
|
/// 发送AGV任务
|
/// </summary>
|
/// <param name="taskModel"></param>
|
/// <returns></returns>
|
public WebResponseContent SendAgvTask(AgvTaskModel taskModel)
|
{
|
WebResponseContent content = new WebResponseContent();
|
try
|
{
|
string apiAddress = AppSettings.Get(APIEnum.AgvSendTask.ToString());
|
string response = HttpHelper.Post(apiAddress, taskModel.Serialize());
|
AgvResponseContent agvContent= response.DeserializeObject<AgvResponseContent>();
|
if (agvContent.Code=="200")
|
{
|
content.OK(agvContent.Message);
|
}
|
else
|
{
|
content.Error(agvContent.Message);
|
}
|
}
|
catch (Exception ex)
|
{
|
content.Error(ex.Message);
|
}
|
return content;
|
}
|
public WebResponseContent AGVSecureReply(AgvSecureModel secureModel)
|
{
|
WebResponseContent content = new WebResponseContent();
|
try
|
{
|
string apiAddress = AppSettings.Get(APIEnum.AGVSecureReply.ToString());
|
string response = HttpHelper.Post(apiAddress, secureModel.Serialize());
|
AgvResponseContent agvContent = response.DeserializeObject<AgvResponseContent>();
|
if (agvContent.Code == "200")
|
{
|
content.OK(agvContent.Message);
|
}
|
else
|
{
|
content.Error(agvContent.Message);
|
}
|
}
|
catch (Exception ex)
|
{
|
content.Error(ex.Message);
|
}
|
return content;
|
}
|
}
|
}
|