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 
 | 
    { 
 | 
        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("未定义的区域号!"); 
 | 
                if (MethodName == "EnteriorLeav") 
 | 
                    remark = requestin.Type == 1 ? "AGV正在进入" : "AGV正在离开"; 
 | 
                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; 
 | 
        } 
 | 
    } 
 | 
} 
 |