using Newtonsoft.Json; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using WIDESEAWCS_Common; 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 { response = HttpManager.HttpPostAsync(url, postData).Result; MESResponse res = JsonConvert.DeserializeObject(response); return res; } catch (Exception ex) { throw new Exception(ex.Message); } } 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(response); return res; } catch (Exception ex) { throw new Exception(ex.Message); } } } }