schangxiang@126.com
2025-09-17 ff43ddf18764629ff875478e4e47a7281cbd230a
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
using iWareCommon.Utils;
using iWareModel.Entity.AGV;
using iWareModel.Entity.WCS;
using Newtonsoft.Json;
using System;
 
namespace iWareCC.Common.Helper
{
    /// <summary>
    /// 跟WCS交互的帮助类
    /// </summary>
    public class WcsRequestHelper
    {
 
        /// <summary>
        /// 查询指定任务的状态情况
        /// </summary>
        /// <param name="agvTaskParam"></param>
        /// <returns></returns>
        public static WCSTaskOutput GetBatchTask(string json)
        {
            //var utl = string.Format(wcsApiHost + @"GetBatchTask?Timestamp={0}&Creator={1}", "cc", DateTime.Now.ToString());
            //var result = HttpHelper.Post(utl, json);
 
 
            var utl = string.Format(@"GetBatchTask?Timestamp={0}&Creator={1}", "cc", DateTime.Now.ToString());
            var result = new HTTPService(FormCC.WcsIp).postContentForString(utl, json, "");
 
            if (result == null)
            {
                throw new Exception("创建失败!");
            }
            Log4NetHelper.WriteErrorLog(LogType.SrmTaskFinish, "GetBatchTask返回的值:" + result + ",参数:json:" + json + ",地址:" + FormCC.WcsIp + "/GetBatchTask");
            var data = JsonConvert.DeserializeObject<WCSTaskOutput>(result);
            return data;
        }
 
 
        /// <summary>
        /// 修改优先级
        /// </summary>
        /// <param name="json"></param>
        /// <param name="wmsTaskNo"></param>
        /// <param name="priority"></param>
        /// <returns></returns>
        /// <exception cref="Exception"></exception>
        public static WCSTaskOutput UpdatePriority(string json, string wmsTaskNo, int priority)
        {
            //var utl = string.Format(wcsApiHost + @"GetBatchTask?Timestamp={0}&Creator={1}", "cc", DateTime.Now.ToString());
            //var result = HttpHelper.Post(utl, json);
 
 
            var utl = string.Format(@"UpdatePriority?Timestamp={0}&Creator={1}&wmsTaskNo={2}&Priority={3}", "cc", DateTime.Now.ToString()
                , wmsTaskNo, priority
                );
            var result = new HTTPService(FormCC.WcsIp).postContentForString(utl, json, "");
 
            if (result == null)
            {
                throw new Exception("修改优先级失败!");
            }
            Log4NetHelper.WriteErrorLog(LogType.SrmTaskFinish, "GetBatchTask返回的值:" + result + ",参数:json:" + json + ",地址:" + FormCC.WcsIp + "/GetBatchTask");
            var data = JsonConvert.DeserializeObject<WCSTaskOutput>(result);
            return data;
        }
 
    }
}