using Newtonsoft.Json;
|
using System;
|
using System.Collections.Generic;
|
using System.Linq;
|
using System.Text;
|
using System.Threading.Tasks;
|
using WIDESEAWCS_Common;
|
using WIDESEAWCS_Common.ServiceLog;
|
using WIDESEAWCS_Core.Helper;
|
using WIDESEAWCS_DTO.TaskInfo;
|
using static System.Net.WebRequestMethods;
|
|
namespace WIDESEAWCS_TaskInfoService
|
{
|
public class ApiInvoke
|
{
|
public static MESResponse SendTaskCMD(MESSendCMD sendCmd)
|
{
|
|
string postData = sendCmd.Serialize();
|
string url = AppSettings.Configuration.GetSection("MESApi").Value;
|
string response = "";
|
try
|
{
|
ServiceLogger.WriteDebug("SendTaskCMD", $"请求参数:{postData}");
|
response = HttpManager.HttpPostAsync(url, postData).Result;
|
ServiceLogger.WriteDebug("SendTaskCMD", $"响应参数:{response}");
|
MESResponse res = JsonConvert.DeserializeObject<MESResponse>(response);
|
return res;
|
}
|
catch (Exception ex)
|
{
|
ServiceLogger.WriteDebug("SendTaskCMD", $"异常描述:{ex.Message}--{ex.StackTrace}--{ex.InnerException}");
|
return null;
|
}
|
}
|
|
public static MESResponse DeliveryPlanCMD(DeliveryPlan sendCmd)
|
{
|
|
string postData = sendCmd.Serialize();
|
string url = AppSettings.Configuration.GetSection("ConveyorLineApi").Value;
|
string response = "";
|
try
|
{
|
response = HttpManager.HttpPostAsync(url, postData).Result;
|
MESResponse res = JsonConvert.DeserializeObject<MESResponse>(response);
|
return res;
|
}
|
catch (Exception ex)
|
{
|
throw new Exception(ex.Message);
|
}
|
}
|
|
}
|
}
|