123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Text.RegularExpressions;
- using System.Configuration;
- using AGV_WPF.Models;
- using HslCommunication.Profinet.Siemens;
- using System.Data;
- using Newtonsoft.Json.Linq;
- using HslCommunication.LogNet;
- namespace AGV_WPF_Global
- {
- class GlobalPara
- {
- public static string ByteToHexString(byte[] buffer)
- {
- if (buffer != null)
- {
- StringBuilder builder = new StringBuilder(buffer.Length * 3);
- foreach (byte data in buffer)
- {
- builder.Append(Convert.ToString(data, 16).PadLeft(2, '0').PadRight(3, ' '));
- }
- if (builder != null)
- {
- return builder.ToString().ToUpper();
- }
- else return "";
- }
- return "";
- }
- public static void LoadData()
- {
- Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
- //读卡检测开关
- if (!config.AppSettings.Settings.AllKeys.Contains(strOpenReadCheck))
- {
- config.AppSettings.Settings.Add(strOpenReadCheck, "False");
- GlobalPara.IsEnableReadCheck = false;
- }
- else
- {
- bool temp;
- if (bool.TryParse(config.AppSettings.Settings[strOpenReadCheck].Value, out temp))
- {
- GlobalPara.IsEnableReadCheck = temp;
- }
- else
- GlobalPara.IsEnableReadCheck = false;
- }
- if (!config.AppSettings.Settings.AllKeys.Contains(strStartParallel))
- {
- config.AppSettings.Settings.Add(strOpenReadCheck, "False");
- GlobalPara.IsEnablePallel = false;
- }
- else
- {
- bool temp;
- if (bool.TryParse(config.AppSettings.Settings[strStartParallel].Value, out temp))
- {
- GlobalPara.IsEnablePallel = temp;
- }
- else
- GlobalPara.IsEnablePallel = false;
- }
- /*启用路线显示*/
- if (!config.AppSettings.Settings.AllKeys.Contains(strRouteView))
- {
- config.AppSettings.Settings.Add(strOpenReadCheck, "False");
- GlobalPara.IsEnableRouteView = false;
- }
- else
- {
- bool temp;
- if (bool.TryParse(config.AppSettings.Settings[strRouteView].Value, out temp))
- {
- GlobalPara.IsEnableRouteView = temp;
- }
- else
- GlobalPara.IsEnableRouteView = false;
- }
- //漏读检测开关
- if (!config.AppSettings.Settings.AllKeys.Contains(strOpenMissReadCheck))
- {
- config.AppSettings.Settings.Add(strOpenMissReadCheck, "False");
- GlobalPara.IsEnableMissReadCheck = false;
- }
- else
- {
- bool temp;
- if (bool.TryParse(config.AppSettings.Settings[strOpenMissReadCheck].Value, out temp))
- {
- GlobalPara.IsEnableMissReadCheck = temp;
- }
- else
- GlobalPara.IsEnableMissReadCheck = false;
- }
- //多读检测开关
- if (!config.AppSettings.Settings.AllKeys.Contains(strOpenExtraReadCheck))
- {
- config.AppSettings.Settings.Add(strOpenExtraReadCheck, "False");
- GlobalPara.IsEnableExtraReadCheck = false;
- }
- else
- {
- bool temp;
- if (bool.TryParse(config.AppSettings.Settings[strOpenExtraReadCheck].Value, out temp))
- {
- GlobalPara.IsEnableExtraReadCheck = temp;
- }
- else
- GlobalPara.IsEnableExtraReadCheck = false;
- }
- //离线检测开关
- if (!config.AppSettings.Settings.AllKeys.Contains(strOpenOffLineCheck))
- {
- config.AppSettings.Settings.Add(strOpenOffLineCheck, "False");
- GlobalPara.IsEnableOffLineCheck = false;
- }
- else
- {
- bool temp;
- if (bool.TryParse(config.AppSettings.Settings[strOpenOffLineCheck].Value, out temp))
- {
- GlobalPara.IsEnableOffLineCheck = temp;
- }
- else
- GlobalPara.IsEnableOffLineCheck = false;
- }
- //连接恢复检测开关
- if (!config.AppSettings.Settings.AllKeys.Contains(strOpenRecoverCheck))
- {
- config.AppSettings.Settings.Add(strOpenRecoverCheck, "False");
- GlobalPara.IsEnableRecoverCheck = false;
- }
- else
- {
- bool temp;
- if (bool.TryParse(config.AppSettings.Settings[strOpenRecoverCheck].Value, out temp))
- {
- GlobalPara.IsEnableRecoverCheck = temp;
- }
- else
- GlobalPara.IsEnableRecoverCheck = false;
- }
- //通信方式
- if (!config.AppSettings.Settings.AllKeys.Contains(strCommType))
- {
- config.AppSettings.Settings.Add(strCommType, "1");
- GlobalPara.type = 1;
- }
- else
- {
- int temp;
- if (int.TryParse(config.AppSettings.Settings[strCommType].Value, out temp))
- {
- GlobalPara.type = temp;
- }
- else
- GlobalPara.type = 1;
- }
- //Wifi通信方式,主机IP
- if (!config.AppSettings.Settings.AllKeys.Contains(strHostIP))
- {
- config.AppSettings.Settings.Add(strHostIP, "127.0.0.1");
- GlobalPara.HostIP = "127.0.0.1";
- }
- else
- {
- string str = "127.0.0.1";
- if (Regex.IsMatch(config.AppSettings.Settings[strHostIP].Value, @"^\d{1,3}.\d{1,3}.\d{1,3}.\d{1,3}$"))
- {
- GlobalPara.HostIP = config.AppSettings.Settings[strHostIP].Value;
- }
- else
- {
- GlobalPara.HostIP = str;
- }
- }
- if (!config.AppSettings.Settings.AllKeys.Contains(strHostIPSPS))
- {
- config.AppSettings.Settings.Add(strHostIPSPS, "127.0.0.1");
- GlobalPara.strHostIPSPS = "127.0.0.1";
- }
- else
- {
- string str = "127.0.0.1";
- if (Regex.IsMatch(config.AppSettings.Settings[strHostIPSPS].Value, @"^\d{1,3}.\d{1,3}.\d{1,3}.\d{1,3}$"))
- {
- GlobalPara.HostIPSPS = config.AppSettings.Settings[strHostIPSPS].Value;
- }
- else
- {
- GlobalPara.HostIPSPS = str;
- }
- }
- if (!config.AppSettings.Settings.AllKeys.Contains(strMesURL))
- {
- config.AppSettings.Settings.Add(strMesURL, "http://10.140.4.15:9090/aisEsbApi/pmc/core/interf/PmcCoreHjReportStation");
- GlobalPara.MesURL = "http://10.140.4.15:9090/aisEsbApi/pmc/core/interf/PmcCoreHjReportStation";
- }
- else
- {
- {
- GlobalPara.MesURL = config.AppSettings.Settings[strMesURL].Value;
- }
-
- }
- if (!config.AppSettings.Settings.AllKeys.Contains(strSPSURL))
- {
- config.AppSettings.Settings.Add(strSPSURL, "http://10.140.35.21:10010/AGV/AGVLeave");
- GlobalPara.SPSURL = "http://10.140.35.21:10010/AGV/AGVLeave";
- }
- else
- {
- {
- GlobalPara.SPSURL = config.AppSettings.Settings[strSPSURL].Value;
- }
- }
- if (!config.AppSettings.Settings.AllKeys.Contains(strTrafficAreaRequestURL))
- {
- config.AppSettings.Settings.Add(strTrafficAreaRequestURL, "http://URLValue/AGVAPI?do=Requery®ion=RegionValue");
- GlobalPara.TrafficAreaRequestURL = @"http://URLValue/AGVAPI?do=Requery®ion=RegionValue";
- // GlobalPara.TrafficAreaRequestURL = "http://URLValue/AGVAPI";
- }
- else
- {
- {
- GlobalPara.TrafficAreaRequestURL = config.AppSettings.Settings[strTrafficAreaRequestURL].Value;
- }
- }
- if (!config.AppSettings.Settings.AllKeys.Contains(strTrafficAreaResponseURL))
- {
- config.AppSettings.Settings.Add(strTrafficAreaResponseURL, "http://URLValue/AGVAPI?do=SetAGVState®ion=RegionValue&oper=OperValue");
- GlobalPara.TrafficAreaResponseURL = @"http://URLValue/AGVAPI?do=SetAGVState®ion=RegionValue&oper=OperValue";
- //GlobalPara.TrafficAreaResponseURL = "http://URLValue/AGVAPI";
- }
- else
- {
- {
- GlobalPara.TrafficAreaResponseURL = config.AppSettings.Settings[strTrafficAreaResponseURL].Value;
- }
- }
- //WCF服务主机IP
- if (!config.AppSettings.Settings.AllKeys.Contains(strWcfServerIP))
- {
- config.AppSettings.Settings.Add(strWcfServerIP, "127.0.0.1");
- GlobalPara.WcfServerIP = "127.0.0.1";
- }
- else
- {
- string str = "127.0.0.1";
- if (Regex.IsMatch(config.AppSettings.Settings[strWcfServerIP].Value, @"^\d{1,3}.\d{1,3}.\d{1,3}.\d{1,3}$"))
- {
- GlobalPara.WcfServerIP = config.AppSettings.Settings[strWcfServerIP].Value;
- }
- else
- {
- GlobalPara.WcfServerIP = str;
- }
- }
- //Excel文件路径
- if (!config.AppSettings.Settings.AllKeys.Contains(strExcelFile))
- {
- config.AppSettings.Settings.Add(strExcelFile, @"数据.xls");
- GlobalPara.excelFile = @"数据.xls";
- }
- else
- {
- GlobalPara.excelFile = config.AppSettings.Settings[strExcelFile].Value;
- }
- //区域名称
- if (!config.AppSettings.Settings.AllKeys.Contains(strAreaName))
- {
- config.AppSettings.Settings.Add(strAreaName, @"区域1");
- GlobalPara.areaName = @"区域1";
- }
- else
- {
- GlobalPara.areaName = config.AppSettings.Settings[strAreaName].Value;
- }
- //掉线计数
- if (!config.AppSettings.Settings.AllKeys.Contains(strOffLineCount))
- {
- config.AppSettings.Settings.Add(strOffLineCount, "8");
- GlobalPara.OffLineCount = 0;
- }
- else
- {
- int temp;
- if (int.TryParse(config.AppSettings.Settings[strOffLineCount].Value, out temp))
- {
- GlobalPara.OffLineCount = temp;
- }
- else
- GlobalPara.OffLineCount = 8;
- }
- //是否异常截图
- if (!config.AppSettings.Settings.AllKeys.Contains(strSavePic))
- {
- config.AppSettings.Settings.Add(strSavePic, "False");
- GlobalPara.IsExceptionSavePic = false;
- }
- else
- {
- bool temp;
- if (bool.TryParse(config.AppSettings.Settings[strSavePic].Value, out temp))
- {
- GlobalPara.IsExceptionSavePic = temp;
- }
- else
- GlobalPara.IsExceptionSavePic = false;
- }
- //AGV图标宽
- if (!config.AppSettings.Settings.AllKeys.Contains(strAgvIconW))
- {
- config.AppSettings.Settings.Add(strAgvIconW, "24");
- GlobalPara.AgvIconW = 24;
- }
- else
- {
- int temp;
- if (int.TryParse(config.AppSettings.Settings[strAgvIconW].Value, out temp))
- {
- GlobalPara.AgvIconW = temp;
- }
- else
- GlobalPara.AgvIconW = 24;
- }
- //AGV图标高
- if (!config.AppSettings.Settings.AllKeys.Contains(strAgvIconH))
- {
- config.AppSettings.Settings.Add(strAgvIconH, "24");
- GlobalPara.AgvIconH = 24;
- }
- else
- {
- int temp;
- if (int.TryParse(config.AppSettings.Settings[strAgvIconH].Value, out temp))
- {
- GlobalPara.AgvIconH = temp;
- }
- else
- GlobalPara.AgvIconH = 24;
- }
- //通信周期
- if (!config.AppSettings.Settings.AllKeys.Contains(strComCycle))
- {
- config.AppSettings.Settings.Add(strComCycle, "550");
- GlobalPara.ComCycle = 550;
- }
- else
- {
- int temp;
- if (int.TryParse(config.AppSettings.Settings[strComCycle].Value, out temp))
- {
- GlobalPara.ComCycle = temp;
- }
- else
- GlobalPara.ComCycle = 550;
- }
- //通讯端口
- if (!config.AppSettings.Settings.AllKeys.Contains(strUDPPort))
- {
- config.AppSettings.Settings.Add(strUDPPort, "8899");
- GlobalPara.UdpComPort = 8899;
- }
- else
- {
- int temp;
- if (int.TryParse(config.AppSettings.Settings[strUDPPort].Value, out temp))
- {
- GlobalPara.UdpComPort = temp;
- }
- else
- GlobalPara.UdpComPort = 8899;
- }
- //通讯端口
- if (!config.AppSettings.Settings.AllKeys.Contains(strUDPPort))
- {
- config.AppSettings.Settings.Add(strUDPPort, "8899");
- GlobalPara.UdpComPort = 8899;
- }
- else
- {
- int temp;
- if (int.TryParse(config.AppSettings.Settings[strUDPPort].Value, out temp))
- {
- GlobalPara.UdpComPort = temp;
- }
- else
- GlobalPara.UdpComPort = 8899;
- }
- //通讯端口
- if (!config.AppSettings.Settings.AllKeys.Contains(strHostSPSPort))
- {
- config.AppSettings.Settings.Add(strHostSPSPort, "63300");
- GlobalPara.HostIPSPSPort = 63300;
- }
- else
- {
- int temp;
- if (int.TryParse(config.AppSettings.Settings[strHostSPSPort].Value, out temp))
- {
- GlobalPara.HostIPSPSPort = temp;
- }
- else
- GlobalPara.HostIPSPSPort = 63300;
- }
- //测试开关
- if (!config.AppSettings.Settings.AllKeys.Contains(strTryFlag))
- {
- config.AppSettings.Settings.Add(strTryFlag, "False");
- GlobalPara.TryFlag = false;
- }
- else
- {
- bool temp;
- if (bool.TryParse(config.AppSettings.Settings[strTryFlag].Value, out temp))
- {
- GlobalPara.TryFlag = temp;
- }
- else
- GlobalPara.TryFlag = false;
- }
- //测试用远程主机IP
- if (!config.AppSettings.Settings.AllKeys.Contains(strTryIP))
- {
- config.AppSettings.Settings.Add(strTryIP, "127.0.0.1");
- GlobalPara.TryIP = "127.0.0.1";
- }
- else
- {
- string str = "127.0.0.1";
- if (Regex.IsMatch(config.AppSettings.Settings[strTryIP].Value, @"^\d{1,3}.\d{1,3}.\d{1,3}.\d{1,3}$"))
- {
- GlobalPara.TryIP = config.AppSettings.Settings[strTryIP].Value;
- }
- else
- {
- GlobalPara.TryIP = str;
- }
- }
- //远程客户端使能
- if (!config.AppSettings.Settings.AllKeys.Contains(strEnableRemote))
- {
- config.AppSettings.Settings.Add(strEnableRemote, GlobalPara.IsEnableRemote.ToString());
- //GlobalPara.IsEnableRecoverCheck = false;
- }
- else
- {
- bool temp;
- if (bool.TryParse(config.AppSettings.Settings[strEnableRemote].Value, out temp))
- {
- GlobalPara.IsEnableRemote = temp;
- }
- else
- GlobalPara.IsEnableRemote = false;
- }
- //新版数据分享使能
- if (!config.AppSettings.Settings.AllKeys.Contains(strEnableDataShare))
- {
- config.AppSettings.Settings.Add(strEnableDataShare, GlobalPara.IsEnableDataShare.ToString());
- //GlobalPara.IsEnableRecoverCheck = false;
- }
- else
- {
- bool temp;
- if (bool.TryParse(config.AppSettings.Settings[strEnableDataShare].Value, out temp))
- {
- GlobalPara.IsEnableDataShare = temp;
- }
- else
- GlobalPara.IsEnableDataShare = false;
- }
- //使用新版协议还是旧版协议
- if (!config.AppSettings.Settings.AllKeys.Contains(strUseNewProtrol))
- {
- config.AppSettings.Settings.Add(strUseNewProtrol, GlobalPara.UseNewProtrol.ToString());
- //GlobalPara.IsEnableRecoverCheck = false;
- }
- else
- {
- bool temp;
- if (bool.TryParse(config.AppSettings.Settings[strUseNewProtrol].Value, out temp))
- {
- GlobalPara.UseNewProtrol = temp;
- }
- else
- GlobalPara.UseNewProtrol = false;
- }
- //Eol 停站判断时间
- if (!config.AppSettings.Settings.AllKeys.Contains(strEOLCheckSecs))
- {
- config.AppSettings.Settings.Add(strEOLCheckSecs, GlobalPara.EOLCheckSecs.ToString());
- //GlobalPara.IsEnableRecoverCheck = false;
- }
- else
- {
- int temp;
- if (int.TryParse(config.AppSettings.Settings[strEOLCheckSecs].Value, out temp))
- {
- GlobalPara.EOLCheckSecs = temp;
- }
- else
- GlobalPara.EOLCheckSecs = 5;
- }
- //远程调试使能
- if (!config.AppSettings.Settings.AllKeys.Contains(strDebugFlag))
- {
- config.AppSettings.Settings.Add(strDebugFlag, GlobalPara.DebugFlag.ToString());
- //GlobalPara.IsEnableRecoverCheck = false;
- }
- else
- {
- bool temp;
- if (bool.TryParse(config.AppSettings.Settings[strDebugFlag].Value, out temp))
- {
- GlobalPara.DebugFlag = temp;
- }
- else
- GlobalPara.DebugFlag = false;
- }
- //远程调试IP
- if (!config.AppSettings.Settings.AllKeys.Contains(strDebugIP))
- {
- config.AppSettings.Settings.Add(strDebugIP, "127.0.0.1");
- GlobalPara.DebugIP = "127.0.0.1";
- }
- else
- {
- string str = "127.0.0.1";
- if (Regex.IsMatch(config.AppSettings.Settings[strDebugIP].Value, @"^\d{1,3}.\d{1,3}.\d{1,3}.\d{1,3}$"))
- {
- GlobalPara.DebugIP = config.AppSettings.Settings[strDebugIP].Value;
- }
- else
- {
- GlobalPara.DebugIP = str;
- }
- }
- //数据处理类型
- if (!config.AppSettings.Settings.AllKeys.Contains(strDataHandleType))
- {
- config.AppSettings.Settings.Add(strDataHandleType, "0");
- GlobalPara.DataHandleType = 0;
- }
- else
- {
- int temp;
- if (int.TryParse(config.AppSettings.Settings[strDataHandleType].Value, out temp))
- {
- GlobalPara.DataHandleType = temp;
- }
- else
- GlobalPara.DataHandleType = 0;
- }
- //电池查询周期
- if (!config.AppSettings.Settings.AllKeys.Contains(strBatteryQueryTime))
- {
- config.AppSettings.Settings.Add(strBatteryQueryTime, "4000");
- GlobalPara.BatteryQueryTime = 4000;
- }
- else
- {
- int temp;
- if (int.TryParse(config.AppSettings.Settings[strBatteryQueryTime].Value, out temp))
- {
- GlobalPara.BatteryQueryTime = temp;
- }
- else
- GlobalPara.DataHandleType = 4000;
- }
- //Log文件存放目录
- if (!config.AppSettings.Settings.AllKeys.Contains(strLogDirectory))
- {
- config.AppSettings.Settings.Add(strLogDirectory, @"C:\Log");
- GlobalPara.LogDirectory = @"C:\Log";
- }
- else
- {
- GlobalPara.LogDirectory = config.AppSettings.Settings[strLogDirectory].Value;
- }
- if (!config.AppSettings.Settings.AllKeys.Contains(strIsNeedToReplyPLCImmediately))
- {
- config.AppSettings.Settings.Add(strIsNeedToReplyPLCImmediately, GlobalPara.IsNeedToReplyPLCImmediately.ToString());
- //GlobalPara.IsEnableRecoverCheck = false;
- }
- else
- {
- bool temp;
- if (bool.TryParse(config.AppSettings.Settings[strIsNeedToReplyPLCImmediately].Value, out temp))
- {
- GlobalPara.IsNeedToReplyPLCImmediately = temp;
- }
- else
- GlobalPara.IsNeedToReplyPLCImmediately = false;
- }
- //最后保存设置
- config.Save();
- }
- #region 配置项字符串
- public static string strControlCOMName = "ControlCOMName";
- public static string strOpenReadCheck = "OpenReadCheck";
- public static string strOpenMissReadCheck = "OpenMissReadCheck";
- public static string strOpenExtraReadCheck = "OpenExtraReadCheck";
- public static string strOpenOffLineCheck = "OpenOffLineCheck";
- public static string strOpenRecoverCheck = "OpenRecoverCheck";
- public static string strCommType = "CommType";
- public static string strHostIP = "HostIP";
- public static string strHostIPSPS = "HostIPSPS";
- public static string strMesURL = "MesURL";
- public static string strSPSURL = "SPSURL";
- public static string strTrafficAreaRequestURL = "TrafficAreaRequestURL";
- public static string strTrafficAreaResponseURL = "TrafficAreaResponseURL";
- public static string strWcfServerIP = "WcfServerIP";
- public static string strExcelFile = "ExcelFile";
- public static string strAreaName = "AREANAME";
- public static string strOffLineCount = "OFFLINECOUNT";
- public static string strSavePic = "SAVEPIC";
- public static string strAgvIconW = "AGVICONW";
- public static string strAgvIconH = "AGVICONH";
- public static string strComCycle = "ComCycle";
- public static string strUDPPort = "UDPPort";
- public static string strHostSPSPort = "HostSPSPort";
- public static string strTryFlag = "TryFlag";
- public static string strTryIP = "TryIP";
- public static string strEnableRemote = "EnableRemote";
- public static string strDebugFlag = "DebugFlag";
- public static string strDebugIP = "DebugIP";
- public static string strDataHandleType = "HandleType";
- public static string strLogDirectory = "LogDir";
- public static string strBatteryQueryTime = "BatteryQueryTime";
- public static string strStartParallel = "StartParallel";//是否启用平行标志
- public static string strRouteView = "RouteView";//以路线的形式显示。
- public static string strEnableDataShare = "EnableDataShare";//TCP共享数据
- public static string strUseNewProtrol = "UseNewProtrol";
- public static string strEOLCheckSecs = "EOLCheckSecs";
- public static string strIsNeedToReplyPLCImmediately = "IsNeedToReplyPLCImmediately";
- #endregion
- #region 共享变量,不保存配置
- public static string strName;
- public static string userid;
- public static bool IsManager = true;
- public static string linkDirectory = "Link";
- public static string readCheckRecordName = "漏读记录";
- public static int LocalTcpPort = 9999;//远程访问本地TCP端口
- public static int LocalTcpPort1 = 8059;//远程访问本地TCP端口
-
- public static int RetransportUdpPort = 10000;//转发用UDP端口
- public static Services.CommunicationBase communication;
- public static DataTable DtWirelessBox = new DataTable();
- public static LogNetDateTime logNetDateTimeTrans; //透传结果记录
- public static AGV_WPF.WirelessDockingSystem wirelessDockingSystem;
- public static List<JObject> ListBoxData = new List<JObject>();
- #endregion
- #region 共享变量,保存配置
- public static string Gcontrolcomname = "COM1";
- public static List<string> ComNameList = new List<string>();
- public static string excelFile = @"数据.xls";
- public static int type = 0;
- public static bool IsExceptionSavePic = false;
- public static string areaName = "区域1";
- public static int OffLineCount = 8;
- public static int AgvIconW = 24;
- public static int AgvIconH = 24;
- public static bool IsEnableReadCheck = false;//读卡检测功能开关
- public static bool IsEnableExtraReadCheck = false;//多读卡检测功能开关
- public static bool IsEnableMissReadCheck = false;//漏读卡检测功能开关
- public static bool IsEnableOffLineCheck = false;//离线检测功能开关
- public static bool IsEnableRecoverCheck = false;//连接恢复检测功能开关
- public static bool IsEnablePallel = false;//启用平行路线管制
- public static bool IsEnableRouteView = false;//启用路线的形式显示
- public static string HostIP;
- public static string HostIPSPS;
- public static string WcfServerIP;
- public static int ComCycle = 550;//通信周期
- public static bool TryFlag = false;
- public static string TryIP = "127.0.0.1";
- public static bool DebugFlag = false;//可以作废,胡文辉20170405
- public static string DebugIP = "127.0.0.1";//可以作废,胡文辉20170405
- public static bool IsEnableRemote = false;
- public static int DataHandleType = 0;//数据处理方式,0为事件中解析数据,1单独线程处理
- public static string LogDirectory = @"C:\Log";//日志文件存放位置
- public static int BatteryQueryTime = 4000;//电池信息查询周期
- public static bool IsEnableDataShare = false;//是否开启远程数据共享
- public static bool UseNewProtrol = false;
- public static int EOLCheckSecs = 5;
- public static List<byte[]> dispatchList = new List<byte[]>();
- public static SiemensS7Net s701;
- public static List<string> BoxMarkLists;
- public static Dictionary<string, bool> EmStopMark = new Dictionary<string, bool>();
- public static DataTable dtSKQPLCs;
- public static SiemensS7Net s702;
- public static List<string> ReleaseMarkList = new List<string>();
- public static bool Gloal1063Flag;
- public static int UdpComPort = 8899;//网络方式通信,本地UDP端口
- public static int HostIPSPSPort = 63300;
- public static AGV_WPF.Tools.CConfigData gs_configInfo = new AGV_WPF.Tools.CConfigData();
- public static List<byte[]> SendBytesList = new List<byte[]>();
- public static bool IsNeedToReplyPLCImmediately = false;
- public static string MesURL = "http://10.140.4.15:9090/aisEsbApi/pmc/core/interf/PmcCoreHjReportStation";
- public static string SPSURL = "http://10.140.35.21:10010/AGV/AGVLeave";
- public static string TrafficAreaRequestURL = @"http://URLValue/AGVAPI?do=Requery®ion=RegionValue";
- public static string TrafficAreaResponseURL = @"http://URLValue/AGVAPI?do=SetAGVState®ion=RegionValue&oper=OperValue";
- public enum DBControlValues:int
- {
- NoAction=0,
- OKRelease=1,
- NGRelease=2,
- StopImmediate=3,
- StopRelease=4
- }
- public enum DBRunValues
- {
- Unknow = 0,
- Running = 1,
- Pause = 2,
- StopOnStation = 3,
- EmergencyStop=4
- }
- #endregion
- #region 自己添加的键值对,用于缓存数据
- public static Dictionary<int, AGVInfoModel> AgvInfoDic = new Dictionary<int, AGVInfoModel>();//建立10M的缓存区存放AGV动态信息
- public static Dictionary<string, SiemensS7Net> PLCTestDic = new Dictionary<string, SiemensS7Net>();//建立10M的缓存区存放AGV动态信息
- public static Dictionary<int, TrafficAreaModel> TrafficBuffer = new Dictionary<int, TrafficAreaModel>();//该缓存区用于存放AGV管制区信息
- public static Dictionary<int, int> TrafficMarkBuffer = new Dictionary<int, int>();//存放现有管制区的地标卡号对应表信息
- public static Dictionary<int, byte[]> dicAGVBytes = new Dictionary<int, byte[]>();
- public static bool IsRealOpenSystem = false;
- public static Dictionary<int, AGVInfoModel> dicTraffic = new Dictionary<int, AGVInfoModel>();//启动系统前管制就位情况
- public static Dictionary<int, decimal> dicAGVPower = new Dictionary<int, decimal>();
-
- public static bool IsOneKeySleep = false;//是否已休眠 休眠状态下不分配
- public static List<int> SleepAGVNumList = new List<int>(); //一键休眠中的agv
- public static List<int> WakeUpAGVNumList = new List<int>(); //一键唤醒中的agv
- public static int SingleSWAGVNum = -1; //单台休眠/唤醒的agv
- public static bool isSingleControl = false; //单台或批量操作
- public static List<string> lastReadMarkList = new List<string>();//AGV最后读卡记录
- public static Dictionary<DataRow, SiemensS7Net> plcs = new Dictionary<DataRow, SiemensS7Net>();
- public static List<AGVInfoModel> ListReleaseObj = new List<AGVInfoModel>();
- #endregion
- #region CRC 字节值表
- public static byte[] auchCRCHi = {
- 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x01, 0xC0,
- 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41,
- 0x00, 0xC1, 0x81, 0x40, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0,
- 0x80, 0x41, 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40,
- 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1,
- 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x01, 0xC0, 0x80, 0x41,
- 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1,
- 0x81, 0x40, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41,
- 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x01, 0xC0,
- 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, 0x00, 0xC1, 0x81, 0x40,
- 0x01, 0xC0, 0x80, 0x41, 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1,
- 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40,
- 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x01, 0xC0,
- 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, 0x00, 0xC1, 0x81, 0x40,
- 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0,
- 0x80, 0x41, 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40,
- 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x01, 0xC0,
- 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41,
- 0x00, 0xC1, 0x81, 0x40, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0,
- 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41,
- 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0,
- 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, 0x00, 0xC1, 0x81, 0x40,
- 0x01, 0xC0, 0x80, 0x41, 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1,
- 0x81, 0x40, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41,
- 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x01, 0xC0,
- 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40
- };
- /* CRC低位字节值表*/
- public static byte[] auchCRCLo = {
- 0x00, 0xC0, 0xC1, 0x01, 0xC3, 0x03, 0x02, 0xC2, 0xC6, 0x06,
- 0x07, 0xC7, 0x05, 0xC5, 0xC4, 0x04, 0xCC, 0x0C, 0x0D, 0xCD,
- 0x0F, 0xCF, 0xCE, 0x0E, 0x0A, 0xCA, 0xCB, 0x0B, 0xC9, 0x09,
- 0x08, 0xC8, 0xD8, 0x18, 0x19, 0xD9, 0x1B, 0xDB, 0xDA, 0x1A,
- 0x1E, 0xDE, 0xDF, 0x1F, 0xDD, 0x1D, 0x1C, 0xDC, 0x14, 0xD4,
- 0xD5, 0x15, 0xD7, 0x17, 0x16, 0xD6, 0xD2, 0x12, 0x13, 0xD3,
- 0x11, 0xD1, 0xD0, 0x10, 0xF0, 0x30, 0x31, 0xF1, 0x33, 0xF3,
- 0xF2, 0x32, 0x36, 0xF6, 0xF7, 0x37, 0xF5, 0x35, 0x34, 0xF4,
- 0x3C, 0xFC, 0xFD, 0x3D, 0xFF, 0x3F, 0x3E, 0xFE, 0xFA, 0x3A,
- 0x3B, 0xFB, 0x39, 0xF9, 0xF8, 0x38, 0x28, 0xE8, 0xE9, 0x29,
- 0xEB, 0x2B, 0x2A, 0xEA, 0xEE, 0x2E, 0x2F, 0xEF, 0x2D, 0xED,
- 0xEC, 0x2C, 0xE4, 0x24, 0x25, 0xE5, 0x27, 0xE7, 0xE6, 0x26,
- 0x22, 0xE2, 0xE3, 0x23, 0xE1, 0x21, 0x20, 0xE0, 0xA0, 0x60,
- 0x61, 0xA1, 0x63, 0xA3, 0xA2, 0x62, 0x66, 0xA6, 0xA7, 0x67,
- 0xA5, 0x65, 0x64, 0xA4, 0x6C, 0xAC, 0xAD, 0x6D, 0xAF, 0x6F,
- 0x6E, 0xAE, 0xAA, 0x6A, 0x6B, 0xAB, 0x69, 0xA9, 0xA8, 0x68,
- 0x78, 0xB8, 0xB9, 0x79, 0xBB, 0x7B, 0x7A, 0xBA, 0xBE, 0x7E,
- 0x7F, 0xBF, 0x7D, 0xBD, 0xBC, 0x7C, 0xB4, 0x74, 0x75, 0xB5,
- 0x77, 0xB7, 0xB6, 0x76, 0x72, 0xB2, 0xB3, 0x73, 0xB1, 0x71,
- 0x70, 0xB0, 0x50, 0x90, 0x91, 0x51, 0x93, 0x53, 0x52, 0x92,
- 0x96, 0x56, 0x57, 0x97, 0x55, 0x95, 0x94, 0x54, 0x9C, 0x5C,
- 0x5D, 0x9D, 0x5F, 0x9F, 0x9E, 0x5E, 0x5A, 0x9A, 0x9B, 0x5B,
- 0x99, 0x59, 0x58, 0x98, 0x88, 0x48, 0x49, 0x89, 0x4B, 0x8B,
- 0x8A, 0x4A, 0x4E, 0x8E, 0x8F, 0x4F, 0x8D, 0x4D, 0x4C, 0x8C,
- 0x44, 0x84, 0x85, 0x45, 0x87, 0x47, 0x46, 0x86, 0x82, 0x42,
- 0x43, 0x83, 0x41, 0x81, 0x80, 0x40
- };
- #endregion
- }
- }
|