duyongjia
2024-12-03 14aaca9a2e1da2849d602487a52094ee26bbe30a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
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);
            }
        }
 
    }
}