分支自 SuZhouGuanHong/TaiYuanTaiZhong

dengjunjie
2024-01-31 50fd5cc9cfad08714c4daa6d481c5293ff2ae6b1
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
using Newtonsoft.Json;
using OfficeOpenXml.FormulaParsing.Excel.Functions.Text;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Security.Policy;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Linq;
using WIDESEA_Comm.LogInfo;
using WIDESEA_Core.EFDbContext;
using WIDESEA_Core.FreeDB;
using WIDESEA_Core.Utilities;
using WIDESEA_Entity.DomainModels;
using WIDESEA_Entity.ToAGV;
 
namespace WIDESEA_WCS
{
    public partial class ToAGVServer
    {
        FreeDB freeDB = new FreeDB();
        static AGVRespone respone = new AGVRespone();
        static AGVRequestin requestin = new AGVRequestin();
        /// <summary>
        /// AGV申请进入区域
        /// </summary>
        /// <param name="v"></param>
        /// <returns></returns>
        /// <exception cref="NotImplementedException"></exception>
        public static AGVRespone AGVRequestin(string json)
        {
            return GetSetGantry(json, "AGVRequestin", "AGV申请进入区域");
        }
        /// <summary>
        ///  AGV正在(进入/离开)
        /// </summary>
        /// <param name="v"></param>
        /// <returns></returns>
        /// <exception cref="NotImplementedException"></exception>
        public static AGVRespone EnteriorLeav(string json)
        {
            return GetSetGantry(json, "EnteriorLeav", "AGV正在(进入/离开)");
        }
        /// <summary>
        /// AGV更新区域状态
        /// </summary>
        /// <param name="v"></param>
        /// <returns></returns>
        /// <exception cref="NotImplementedException"></exception>
        public static AGVRespone AGVOutofArea(string json)
        {
            return GetSetGantry(json, "AGVOutofArea", "AGV更新区域状态");
        }
        /// <summary>
        /// AGV获取桁架区域状态
        /// </summary>
        /// <param name="v"></param>
        /// <returns></returns>
        /// <exception cref="NotImplementedException"></exception>
        public static AGVRespone GantryOutofArea(string json)
        {
            return GetSetGantry(json, "GantryOutofArea", "AGV获取桁架区域状态");
        }
        public static AGVRespone GetSetGantry(string json, string MethodName, string remark)
        {
            try
            {
                if (string.IsNullOrEmpty(json) || json == "null")
                    throw new Exception("未获取到请求参数数据");
                requestin = JsonConvert.DeserializeObject<AGVRequestin>(json);
                if (requestin.AreaNr < 1 || requestin.AreaNr > 4)
                    throw new Exception("未定义的区域号!");
                respone = AGVandGantry.GetSetGantry(requestin, MethodName);
            }
            catch (Exception ex)
            {
                respone.Message = ex.Message;
            }
            WritePCSLog.LogAdd(requestin.AreaNr.ToString(), respone.success == 1 ? "成功 " : "失败", "WMS", "AGV", json, JsonConvert.SerializeObject(respone), remark, MethodName, respone.Message);
            return respone;
        }
    }
}