wangxinhui
2024-12-18 26f2e904ba44c900e6c61ebf15f97b063324f65b
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
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;
        }
    }
}