1
zxx
2025-07-07 3428deadb4b60ef25dbd06fbf53905fc51c7616e
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
74
75
76
77
78
79
80
81
82
83
84
85
using HH.WCS.XiaoMi.util;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using static HH.WCS.XiaoMi.dispatch.HanAo;
 
namespace HH.WCS.XiaoMi.LISTA.dispatch
{
    public class XMWcsHelper
    {
        private static readonly HttpHelper apiHelper = new HttpHelper();
        private static readonly string baseUrl = Settings.WcsSeverUrl;
 
 
        //https://wcs2-dev.ev.mioffice.cn/api/Interface/AMR/positionApply                
 
        /// <summary>
        /// 目标位置申请接口
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public static ApplyResult GetPositionApply(ApplyModel model)
        {
            var msg = "";
            var dataResult = new ApplyResult() { body = new body { },header = new header { } };
            var request = JsonConvert.SerializeObject(model);
            var response = apiHelper.Post(baseUrl + "/api/Interface/AMR/positionApply", request);
            msg = $"[xiaomi-GetPositionApply] request={request} response={response}";
            Console.WriteLine(msg);
            if (response != "")
            {
                try
                {
                    dataResult = JsonConvert.DeserializeObject<ApplyResult>(response);
                    LogHelper.Info($"GetPositionApply返回参数{JsonConvert.SerializeObject(dataResult)}", "小米");
                    return dataResult;
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.Message);
                }
            }
            else
            {
                msg = "[xiaomi-GetPositionApply]目标位置申请失败";
                Console.WriteLine(msg);
            }
            LogHelper.Info(msg, "小米");
            return dataResult;
        }
 
 
 
        /// <summary>
        /// 目标位置申请参数
        /// </summary>
        public class ApplyModel
        {
            public string wcsTaskCode { get; set; }
        }
 
        /// <summary>
        /// 目标位置申请返回结果
        /// </summary>
        public class ApplyResult
        {
            public header header { get; set; }
            public body body { get; set; }
        }
        public class header
        {
            public string code { get; set; }
            public string desc { get; set; }
        }
        public class body
        {
            public string pointCode { get; set; }
            public string targetType { get; set; }
        }
        
    }
}