111
cjs
2025-06-06 03e67373c4c3bef21936ec1f9037f2ebcd434583
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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
using Hanhe.iWCS.Common;
using Hanhe.iWCS.DeviceDriver;
using Hanhe.iWCS.MData;
using Hanhe.iWCS.Model;
using MongoDB.Driver;
using MongoDB.Driver.Builders;
using System;
using System.Collections.Generic;
using Newtonsoft.Json;
using Hanhe.iWCS.Business;
using Hanhe.iWCS.ZheJiangHuaKaiModel;
using HH.AMS.WebApi.Models;
using HH.AMS.WebApi.Controllers;
 
namespace Hanhe.iWCS.ZheJiangHuaKaiProtocol
{
    public class WmsHelper {
        private static WebApiHelper helper = new WebApiHelper();
        public static void WMSTaskFeedBack(string taskNo, int state) {
            HardwareAccessObject hao = HardwareAccessHelper.Instance.GetEquipmentsHAO(Constants.WMS_DEVICE_TYPE_WMS);
            string msg = string.Empty;
            if (hao != null) {
                TN_I_TASK_MST task = null;
                try {
                    IMongoQuery query = Query.EQ("CN_S_TASK_NO", taskNo);
                    task = MongoDBSingleton.Instance.FindOne<TN_I_TASK_MST>(query, typeof(TN_I_TASK_MST).Name);
 
                }
                catch (Exception e) {
                    CMMLog.Error(e.Message, e);
                }
 
                //任务回报API调用
                if (task != null) {
                    if (task.CN_S_STATUS != "删除中" && state == 7) {
                        var query = Query.And(Query.EQ("CN_S_TASK_NO", task.CN_S_TASK_NO), Query.EQ("CN_S_ACTION_CODE", 4));
                        TN_I_TASK_DTL_ACTION_TrackLog trackLogCommand = MongoDBSingleton.Instance.FindOne<TN_I_TASK_DTL_ACTION_TrackLog>(query, typeof(TN_I_TASK_DTL_ACTION_TrackLog).Name);
                        if (trackLogCommand == null) {
                            state = 12;//没有取货完成说明是空取
                        }
                        CMMLog.Error(string.Format("【反馈WMS任务状态】异常取消,任务号={0},来源号={1}", task.CN_S_TASK_NO, task.CN_S_SOURCE_NO));
                    }
                    string msgData = "{\"taskNo\":\"" + task.CN_S_SOURCE_NO + "\",\"stateNo\":\"" + state + "\",\"taskType\":\"转运\"}";
                    string reqStr = "任务号=" + task.CN_S_SOURCE_NO + ";状态=" + state;
                    string feedback = "";
                    try {
                        //Console.WriteLine(hao.WebUrl + "ExecuteState");
                        feedback = helper.WebPost(hao.WebUrl + "ExecuteState", msgData);
                        //feedback = hao._WebApiClientInstance.GetWebRequest(hao.WebUrl + "ExecuteState", msgData, "application/json");
                        if (!string.IsNullOrEmpty(feedback)) {
                            Console.WriteLine(feedback);
                            //var DynamicObject = JsonConvert.DeserializeObject<dynamic>(feedback);
                            //var res = feedback.Replace("{", "").Replace("}", "").Replace(":", "=").Replace(",", ";").Replace('"', ' ');
                            //if (DynamicObject.success.ToString() == "True") {
                            //    string errData = "{\"CN_S_INTERFACE\":\"WMS接口\",\"CN_S_INTERFACE_NOTE\":\"调用成功\",\"CN_S_REQUEST\":\"" + reqStr + "\",\"CN_S_RESPONSE\":\"" + res + "\",\"CN_S_ADDRESS\":\"" + hao._WebApiClientInstance.WebApiUrl + "ExecuteState\"}";
                            //    AMSLoggerAPI.RequestInterfaceLog(errData);
 
                            //    msg = "【反馈WMS任务状态-" + state + "】调用成功!调用WebUrl=" + hao.WebUrl + "ExecuteState;输入参数=" + msgData + ";任务号=" + taskNo;
                            //}
                            //else {
                            //    string errMsg = DynamicObject.errCode + "-" + DynamicObject.errMsg;
                            //    string errData = "{\"CN_S_INTERFACE\":\"WMS接口\",\"CN_S_INTERFACE_NOTE\":\"调用失败\",\"CN_S_REQUEST\":\"" + reqStr + "\",\"CN_S_RESPONSE\":\"" + res + "\",\"CN_S_ADDRESS\":\"" + hao._WebApiClientInstance.WebApiUrl + "ExecuteState\"}";
                            //    AMSLoggerAPI.RequestInterfaceLog(errData);
 
                            //    msg = "【反馈WMS任务状态-" + state + "】调用失败!错误原因=" + errMsg + ";调用WebUrl=" + hao.WebUrl + "wmsapi/ExecuteState;输入参数=" + msgData + ";任务号=" + taskNo;
                            //}
                        }
                        else {
                            string errMsg = "参数反馈空值";
                            string errData = "{\"CN_S_INTERFACE\":\"WMS接口\",\"CN_S_INTERFACE_NOTE\":\"调用失败\",\"CN_S_REQUEST\":\"" + reqStr + "\",\"CN_S_RESPONSE\":\"" + feedback + "\",\"CN_S_ADDRESS\":\"" + hao._WebApiClientInstance.WebApiUrl + "ExecuteState\"}";
 
                            msg = "【反馈WMS任务状态-" + state + "】调用失败!错误原因=" + errMsg + ";调用WebUrl=" + hao.WebUrl + "wmsapi/ExecuteState;输入参数=" + msgData + ";任务号=" + taskNo;
                        }
                    }
                    catch (Exception e) {
 
                        CMMLog.Error(string.Format("【反馈WMS任务状态】异常{0}", e.Message), e);
                    }
 
                }
                else {
                    msg = string.Format("无法通知WMS,任务{0}不存在!", taskNo);
                }
 
            }
            else {
                msg = string.Format("调用wms失败,ams工作中心没有设置!");
            }
            CMMLog.Info(msg);
        }
 
        public static void WMSFeedBackBySourceNo(string sourceNo, int state) {
            HardwareAccessObject hao = HardwareAccessHelper.Instance.GetEquipmentsHAO(Constants.WMS_DEVICE_TYPE_WMS);
            string msg = string.Empty;
            if (hao != null) {
 
                string msgData = "{\"taskNo\":\"" + sourceNo + "\",\"stateNo\":\"" + state + "\",\"taskType\":\"转运\"}";
                string reqStr = "任务号=" + sourceNo + ";状态=" + state;
                string feedback = "";
                try {
                    feedback = hao._WebApiClientInstance.GetWebRequest(hao.WebUrl + "wmsapi/ExecuteState", msgData, "application/json");
                    if (!string.IsNullOrEmpty(feedback)) {
                        Console.WriteLine(feedback);
                        var DynamicObject = JsonConvert.DeserializeObject<dynamic>(feedback);
                        var res = feedback.Replace("{", "").Replace("}", "").Replace(":", "=").Replace(",", ";").Replace('"', ' ');
                        if (DynamicObject.success.ToString() == "True") {
                            string errData = "{\"CN_S_INTERFACE\":\"WMS接口\",\"CN_S_INTERFACE_NOTE\":\"调用成功\",\"CN_S_REQUEST\":\"" + reqStr + "\",\"CN_S_RESPONSE\":\"" + res + "\",\"CN_S_ADDRESS\":\"" + hao._WebApiClientInstance.WebApiUrl + "ExecuteState\"}";
 
                            msg = "【反馈WMS任务状态-" + state + "】调用成功!调用WebUrl=" + hao.WebUrl + "wmsapi/ExecuteState;输入参数=" + msgData + ";任务来源号=" + sourceNo;
                        }
                        else {
                            string errMsg = DynamicObject.errCode + "-" + DynamicObject.errMsg;
                            string errData = "{\"CN_S_INTERFACE\":\"WMS接口\",\"CN_S_INTERFACE_NOTE\":\"调用失败\",\"CN_S_REQUEST\":\"" + reqStr + "\",\"CN_S_RESPONSE\":\"" + res + "\",\"CN_S_ADDRESS\":\"" + hao._WebApiClientInstance.WebApiUrl + "ExecuteState\"}";
 
                            msg = "【反馈WMS任务状态-" + state + "】调用失败!错误原因=" + errMsg + ";调用WebUrl=" + hao.WebUrl + "wmsapi/ExecuteState;输入参数=" + msgData + ";任务来源号=" + sourceNo;
                        }
                    }
                    else {
                        string errMsg = "参数反馈空值";
                        string errData = "{\"CN_S_INTERFACE\":\"WMS接口\",\"CN_S_INTERFACE_NOTE\":\"调用失败\",\"CN_S_REQUEST\":\"" + reqStr + "\",\"CN_S_RESPONSE\":\"" + feedback + "\",\"CN_S_ADDRESS\":\"" + hao._WebApiClientInstance.WebApiUrl + "ExecuteState\"}";
 
                        msg = "【反馈WMS任务状态-" + state + "】调用失败!错误原因=" + errMsg + ";调用WebUrl=" + hao.WebUrl + "wmsapi/ExecuteState;输入参数=" + msgData + ";任务来源号=" + sourceNo;
                    }
                }
                catch (Exception e) {
 
                    CMMLog.Error(string.Format("【反馈WMS任务状态】异常{0}", e.Message), e);
                }
 
            }
            else {
                msg = string.Format("调用wms失败,ams工作中心没有设置!");
            }
            CMMLog.Info(msg);
        }
 
 
 
        public class WMSResponseModel {
            //{"success":false,"errCode":null,"errMsg":"算法返回结果库存不足","okList":[],"failList":[{"index":0,"errCode":null,"errMsg":"算法返回结果库存不足"}],"tasks":[]}
            public bool success { get; set; }
            public string errMsg { get; set; }
            public string errCode { get; set; }
            //public OKInfo[] tasks { get; set; }
            //public FailInfo[] failList { get; set; }
            public OKInfo[] okList { get; set; }
            public class FailInfo {
                public int index { get; set; }
                public string errCode { get; set; }
                public string errMsg { get; set; }
            }
 
            public class OKInfo {
                public string taskNo { get; set; }
                public string startStock { get; set; }
                public string startArea { get; set; }
                public string startBit { get; set; }
                public string endStock { get; set; }
                public string endArea { get; set; }
                public string endBit { get; set; }
                /// <summary>
                /// 是否需要打包(Y/N)
                /// </summary>
                public string CN_C_IS_LOT_OU { get; set; }
                /// <summary>
                /// 是否尾托散托
                /// </summary>
                public string lastTrayAlarm { get; set; }
                /// <summary>
                /// 是否扫码异常
                /// </summary>
                public string scanAlarm { get; set; }
                /// <summary>
                /// 未扫描到/与工单不符
                /// </summary>
                public string scanAlarmMsg { get; set; }
            }
        }
        public class ItemData {
            public string itemCode { get; set; }
            public string itemState { get; set; }
            public string qty { get; set; }
            public string itemFeature { get; set; }
            public string ProductionDate { get; set; }
 
        }
        public static void Check() {
            string feedback = "{\"success\":false,\"errCode\":null,\"errMsg\":\"算法返回结果库存不足\",\"okList\":[],\"failList\":[{\"index\":0,\"errCode\":null,\"errMsg\":\"算法返回结果库存不足\"}],\"tasks\":[]}";
            var wmsResponse = JsonConvert.DeserializeObject<WMSResponseModel>(feedback);
        }
 
 
 
        #region 新版
 
        public static string WMSIn(string startBit, string ProduceLine, string isTransport, string taskType, string itemCode,string isRian,string needAlarm, ref string taskNo)
        {
            string result = "";
            HardwareAccessObject hao = HardwareAccessHelper.Instance.GetEquipmentsHAO(Constants.WMS_DEVICE_TYPE_WMS);
            string msg = "";
            if (hao != null)
            {
 
                //http://192.168.1.199:9001/api/wmsapi/InWorkArea
                WMSInModel model = new WMSInModel();
                model.startBit = startBit;//起点位置
                model.produceLine = ProduceLine;//产线
                model.isTransport = isTransport;//是否转运
                model.taskType = taskType;//任务类型
                model.isRian = isRian;//是否雨天(Y/N)
                model.needCreateAMSTask = "Y";
                model.data = new List<ItemData>();
                model.trayCode = "";
 
                model.needAlarm = needAlarm;//是否需要报警
                model.priority = 1;
 
                ItemData item = new ItemData();
                item.itemCode = itemCode;
                item.itemFeature = "";
                item.ProductionDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                item.itemState = "";
                item.qty = "";
                model.data.Add(item);// = itemCode;//物料编码
 
 
 
                string msgData = JsonConvert.SerializeObject(new List<WMSInModel>() { model });
                string reqStr = "起点=" + startBit;
                string feedback = "";
 
                try
                {
                    //hao.WebUrl = "http://192.168.1.199:9001/api/";
                    feedback = helper.WebPost(hao.WebUrl + "WmsApi/InWorkArea", msgData);
                    //feedback = hao._WebApiClientInstance.HttpWebApi(hao.WebUrl + "wmsapi/InWorkArea", msgData, "application/json");
                    if (!string.IsNullOrEmpty(feedback))
                    {
                        //CMMLog.Debug(feedback);
                        //"{\"Success\":false,\"ErrCode\":null,\"ErrMsg\":\"\",\"OkList\":[],\"FailList\":[{\"Index\":0,\"ErrCode\":null,\"ErrMsg\":\"未找到aaa位置的所属仓库\"}],\"Tasks\":[]}"
                        //var wmsResponse = JsonConvert.DeserializeObject<WMSResponseModel>(feedback);
                        var wmsResponse = JsonConvert.DeserializeObject<WMSResponseModel>(JsonConvert.DeserializeObject<dynamic>(feedback));
                        var res = feedback.Replace("{", "").Replace("}", "").Replace(":", "=").Replace(",", ";").Replace('"', ' ');
                        if (wmsResponse.success == true)
                        {
                            string info = "{\"CN_S_INTERFACE\":\"WMS接口\",\"CN_S_INTERFACE_NOTE\":\"调用成功\",\"CN_S_REQUEST\":\"" + reqStr + "\",\"CN_S_RESPONSE\":\"" + res + "\",\"CN_S_ADDRESS\":\"" + hao._WebApiClientInstance.WebApiUrl + "InWorkArea\"}";
                            //AMSLoggerAPI.RequestInterfaceLog(info);
                            var ok = wmsResponse.okList[0];
                            result = ok.endBit;
                            taskNo = ok.taskNo;
                            msg = "【调用wms获取入库货位】成功!返回结果=" + result + ";调用WebUrl=" + hao.WebUrl + "InWorkArea;输入参数=" + msgData;
 
                        }
                        else
                        {
                                //如果失败需要记录报警信息
                                var ok = wmsResponse.okList[0];
                                if(ok.lastTrayAlarm=="Y")//是否尾托散托(Y/N)
                                {
                                TN_ErrorInfo EI=new TN_ErrorInfo()
                                {
                                    startBit=startBit,
                                    ProductionLine=ProduceLine,
                                    isTransport=isTransport,
                                    taskType=taskType,
                                    Type=1,//尾托报警
                                    Content = "扫码异常",
                                    CreateDate=DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")
                                };
                            HuaKaiApiController.ErrorInfo_Add(EI);
                            }
                            if (ok.scanAlarm == "Y")//是否扫码异常(Y/N)
                            {
                                string MSG = ok.scanAlarmMsg;// 未扫描到/与工单不符
 
                                TN_ErrorInfo EI = new TN_ErrorInfo()
                                {
                                    startBit = startBit,
                                    ProductionLine = ProduceLine,
                                    isTransport = isTransport,
                                    taskType = taskType,
                                    Type = 2,//扫码异常报警
                                    Content = MSG,
                                    CreateDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")
                                };
                                HuaKaiApiController.ErrorInfo_Add(EI);
                            }
 
                            string errMsg = wmsResponse.errCode + "-" + wmsResponse.errMsg;
                            string errData = "{\"CN_S_INTERFACE\":\"WMS接口\",\"CN_S_INTERFACE_NOTE\":\"调用失败\",\"CN_S_REQUEST\":\"" + reqStr + "\",\"CN_S_RESPONSE\":\"" + res + "\",\"CN_S_ADDRESS\":\"" + hao._WebApiClientInstance.WebApiUrl + "InWorkArea\"}";
                            //AMSLoggerAPI.RequestInterfaceLog(errData);
                            msg = "【调用wms获取入库货位】失败!错误原因=" + errMsg + ";调用WebUrl=" + hao.WebUrl + "InWorkArea;输入参数=" + msgData;
                        }
                    }
                    else
                    {
                        string errMsg = "参数反馈空值";
                        string info = "{\"CN_S_INTERFACE\":\"WMS接口\",\"CN_S_INTERFACE_NOTE\":\"调用失败\",\"CN_S_REQUEST\":\"" + reqStr + "\",\"CN_S_RESPONSE\":\"" + errMsg + "\",\"CN_S_ADDRESS\":\"" + hao._WebApiClientInstance.WebApiUrl + "InWorkArea\"}";
                        //AMSLoggerAPI.RequestInterfaceLog(info);
 
                        msg = "【调用wms获取入库货位】失败!错误原因=" + errMsg + ";调用WebUrl=" + hao.WebUrl + "InWorkArea;输入参数=" + msgData;
                    }
                }
                catch (Exception e)
                {
                    CMMLog.Error(string.Format("【调用wms获取入库货位失败】异常{0}", e.Message), e);
 
                }
 
            }
            else
            {
                msg = string.Format("调用wms失败,ams工作中心没有设置!");
            }
            CMMLog.Info(msg);
            Console.WriteLine(msg);
            return result;
        }
 
        public static string WMSOut(string endBit, string itemCode, ref string taskNo)
        {
            string result = "";
            HardwareAccessObject hao = HardwareAccessHelper.Instance.GetEquipmentsHAO(Constants.WMS_DEVICE_TYPE_WMS);
            string msg = "";
            if (hao != null)
            {
                //http://192.168.1.199:9001/api/wmsapi/InWorkArea
                WMSOutModel model = new WMSOutModel();
                model.endBit = endBit;
                model.data = new List<ItemData>();
 
                string msgData = JsonConvert.SerializeObject(new List<WMSOutModel>() { model });
                string reqStr = "结束点=" + endBit;
                string feedback = "";
 
                try
                {
                    //hao.WebUrl = "http://192.168.1.199:9001/api/";
                    feedback = helper.WebPost(hao.WebUrl + "OutWorkArea", msgData);
                    if (!string.IsNullOrEmpty(feedback))
                    {
                        //CMMLog.Debug(feedback);
                        //{"success":false,"errCode":null,"errMsg":"算法返回结果库存不足","okList":[],"failList":[{"index":0,"errCode":null,"errMsg":"算法返回结果库存不足"}],"tasks":[]}" 
                        var wmsResponse = JsonConvert.DeserializeObject<WMSResponseModel>(JsonConvert.DeserializeObject<dynamic>(feedback));
                        //var wmsResponse = JsonConvert.DeserializeObject<WMSResponseModel>(feedback);
                        var res = feedback.Replace("{", "").Replace("}", "").Replace(":", "=").Replace(",", ";").Replace('"', ' ');
                        if (wmsResponse.success == true)
                        {
                            string info = "{\"CN_S_INTERFACE\":\"WMS接口\",\"CN_S_INTERFACE_NOTE\":\"调用成功\",\"CN_S_REQUEST\":\"" + reqStr + "\",\"CN_S_RESPONSE\":\"" + res + "\",\"CN_S_ADDRESS\":\"" + hao._WebApiClientInstance.WebApiUrl + "OutWorkArea\"}";
                            //AMSLoggerAPI.RequestInterfaceLog(info);
                            var ok = wmsResponse.okList[0];
                            result = ok.startBit;
                            taskNo = ok.taskNo;
                            msg = "【调用wms获取出库货位】成功!返回结果=" + result + ";调用WebUrl=" + hao.WebUrl + "OutWorkArea;输入参数=" + msgData;
 
                        }
                        else
                        {
                            string errMsg = wmsResponse.errCode + "-" + wmsResponse.errMsg;
                            string errData = "{\"CN_S_INTERFACE\":\"WMS接口\",\"CN_S_INTERFACE_NOTE\":\"调用失败\",\"CN_S_REQUEST\":\"" + reqStr + "\",\"CN_S_RESPONSE\":\"" + res + "\",\"CN_S_ADDRESS\":\"" + hao._WebApiClientInstance.WebApiUrl + "OutWorkArea\"}";
                            //AMSLoggerAPI.RequestInterfaceLog(errData);
                            msg = "【调用wms获取出库货位】失败!错误原因=" + errMsg + ";调用WebUrl=" + hao.WebUrl + "OutWorkArea;输入参数=" + msgData;
 
                        }
                    }
                    else
                    {
                        string errMsg = "参数反馈空值";
                        string info = "{\"CN_S_INTERFACE\":\"WMS接口\",\"CN_S_INTERFACE_NOTE\":\"调用失败\",\"CN_S_REQUEST\":\"" + reqStr + "\",\"CN_S_RESPONSE\":\"" + errMsg + "\",\"CN_S_ADDRESS\":\"" + hao._WebApiClientInstance.WebApiUrl + "OutWorkArea\"}";
                        //AMSLoggerAPI.RequestInterfaceLog(info);
 
                        msg = "【调用wms获取出库货位】失败!错误原因=" + errMsg + ";调用WebUrl=" + hao.WebUrl + "OutWorkArea;输入参数=" + msgData;
                    }
                }
                catch (Exception e)
                {
                    CMMLog.Error(string.Format("【调用wms获取出库货位失败】异常{0}", e.Message), e);
 
                }
 
            }
            else
            {
                msg = string.Format("调用wms失败,ams工作中心没有设置!");
            }
            CMMLog.Info(msg);
            Console.WriteLine(msg);
            return result;
        }
        
        /// <summary>
        /// 汉和WMS任务回报
        /// </summary>
        /// <param name="hao">系统驱动</param>
        /// <param name="taskNo">任务号</param>
        /// <param name="state">任务状态</param>
        /// <param name="taskType">任务类型</param>
        public static bool HHWMSTaskFeedBack(HardwareAccessObject hao, string taskNo, string state, string taskType) {
            bool bResult = false;
            string msg = string.Empty;
            //任务回报API调用
            string msgData = "{\"taskNo\":\"" + taskNo + "\",\"stateNo\":\"" + state + "\"}";
            string reqStr = "任务号=" + taskNo + ";状态=" + state;
            string feedback = hao._WebApiClientInstance.GetWebRequest(hao.WebUrl + "WmsApi/ExecuteState", msgData, "application/json");
            if (!string.IsNullOrEmpty(feedback)) {
                var DynamicObject = JsonConvert.DeserializeObject<dynamic>(feedback);
                if (DynamicObject.success.ToString() == "True") {
                    bResult = true;
                    msg = "【汉和WMS反馈任务状态-" + state + "】调用成功!调用WebUrl=" + hao.WebUrl + ";输入参数=" + msgData;
 
                }
                else {
                    string errMsg = DynamicObject.errCode + "-" + DynamicObject.errMsg;
                    msg = "【汉和WMS反馈任务状态-" + state + "】调用失败!错误原因=" + errMsg + ";调用WebUrl=" + hao.WebUrl + ";输入参数=" + msgData;
 
                }
            }
            else {
                string errMsg = "参数反馈空值";
                msg = "【汉和WMS反馈任务状态-" + state + "】调用失败!错误原因=" + errMsg + ";调用WebUrl=" + hao.WebUrl + ";输入参数=" + msgData;
 
            }
            Console.WriteLine(msg);
            CMMLog.Info(msg);
            return bResult;
        }
 
        public class WMSInModel
        {
            public string trayCode { get; set; }
            public string needCreateAMSTask { get; set; }
            public string startBit { get; set; }//起点位置
            public string produceLine { get; set; }//产线
            public string isTransport { get; set; }//是否转运Y/N
            public string taskType { get; set; }//AMS中任务类型
            public string isRian { get; set; }//是否雨天(Y/N)
            public string needAlarm { get; set; }//是否需要报警(Y/N)
            public int priority { get; set; }//优先级
            public string projectCode { get; set; }
            public List<ItemData> data { get; set; }
 
            public string locationGear { get; set; }
        }
        public class WMSOutModel
        {
            public string trayCode { get; set; }
            public string endBit { get; set; }
            public string projectCode { get; set; }
            public List<ItemData> data { get; set; }
        }
        #endregion
    }
}