杨前锦
2025-07-01 a93b0e99036c24b9bd58c79bf5e7364b1ba28bae
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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using HH.WCS.Mobox3.HD.util;
using Newtonsoft.Json;
 
namespace HH.WCS.Mobox3.HD.dispatch
{
    internal class HL
    {
        private static readonly HttpHelper apiHelper = new HttpHelper();
        private static readonly string baseUrl = Settings.HLSeverUrl;
 
        public static bool CreateOrder(TaskInfoModel model)
        {
            var msg = "";
            var result = false;
            var request = JsonConvert.SerializeObject(model);
            LogHelper.Info("CreateOrder-入参:" + request, "合力");
            var response = apiHelper.Post(baseUrl + "/heliagv/wmsApi/createOrder", request);
            msg = $"[HL-CreateOrder] request={request} response={response}";
            Console.WriteLine(msg);
            LogHelper.Info("CreateOrder-出参:" + msg, "合力");
            if (response != "")
            {
                try
                {
                    var dataResult = JsonConvert.DeserializeObject<HLResult>(response);
                    if (dataResult.success)
                    {
                        result = true;
                    }
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.Message);
                }
            }
            else
            {
                msg = "[HL-CreateOrder]创建订单失败";
                Console.WriteLine(msg);
            }
 
            LogHelper.Info(msg, "合力");
            return result;
        }
 
        public static string queryOrder(string orderId)
        {
            var msg = "";
            var result = "";
            var request = JsonConvert.SerializeObject(orderId);
            var response = apiHelper.Post(baseUrl + "/heliagv/wmsApi/queryOrder", request);
            msg = $"[HL-queryOrder] request={request} response={response}";
            Console.WriteLine(msg);
            if (response != "")
            {
                try
                {
                    var dataResult = JsonConvert.DeserializeObject<HLResult>(response);
                    if (dataResult.success)
                    {
                        result = dataResult.result;
                    }
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.Message);
                }
            }
            else
            {
                msg = "[HL-queryOrder]查询订单失败";
                Console.WriteLine(msg);
            }
 
            LogHelper.Info(msg, "合力");
            return result;
        }
 
        public class TaskInfoModel { 
            public string orderId { get; set; } // 订单ID(任务唯一标识)
            public string operateType { get; set; } // 任务类型(10:入库 20:出库等)
            public string fetchPosition { get; set; } // 取货库位
            public string fetchLevel { get; set; } // 取货层高
            public string deliverPosition { get; set; } // 放货库位
            public string deliverLevel { get; set; } // 放货层高
            public string priority { get; set; } // 优先级(默认180)
            public string source { get; set; } // 搬运任务的创建源头:controller、wms
            public string coilNo { get; set; } // 钢卷号
            public string shootNo { get; set; } // 牌号
            public string heatNo { get; set; } // 炉号
            public string spec { get; set; } // 钢卷规格
            public string mouldName { get; set; } // 模具名称
            public string mouldTyep { get; set; } //模具类型
            public string mouldNo { get; set; } // 模具编号
            public string trayCode { get; set; } // 托盘编码
        }
 
        public class HLResult
        { 
            public string message { get; set; }
            public bool success { get; set; }
            public string e { get; set; }
            public string result { get; set; }
        }
    }
}