App.xaml.cs 6.63 KB
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Shapes;
using System.Windows.Threading;

namespace XingYe_ACS
{
    /// <summary>
    /// App.xaml 的交互逻辑
    /// </summary>
    public partial class App : Application
    {
        System.Threading.Mutex mutex;

        public App()
        {
            this.Startup += new StartupEventHandler(App_Startup);
        }

        void App_Startup(object sender, StartupEventArgs e)
        {
            bool ret;
            mutex = new System.Threading.Mutex(true, "ElectronicNeedleTherapySystem1", out ret);
            if (!ret)
            {
                MessageBox.Show("已有一个ACS程序实例运行,请勿重新运行");
                Environment.Exit(0);
            }
        }
        public static int GsHeight = XingYe_ACS.Properties.Settings.Default.GsHeight;    //点上下间隔像素
        public static int GsWidth = XingYe_ACS.Properties.Settings.Default.GsWidth;  //点左右间隔像素
        public static long HeightMin = 0;   //地图最小值Y
        public static long HeightMax = 0;   //地图最大值Y
        public static long WidthMin = 0;    //地图最小值X
        public static long WidthMax = 0;    //地图最大值X
        public static List<Rectangle> ShelfSharp = new List<Rectangle>();   //地图货架显示集合
        public static List<Ellipse> AgvSharp = new List<Ellipse>(); //地图小车显示集合
        public static List<Ellipse> PointSharp = new List<Ellipse>();   //地图点显示集合
        public static List<Path> PathSharp = new List<Path>();  //地图路径显示集合
        public static Canvas Canvas_Monit = null;   //控制界面显示
        public static DateTime ReadS7Time = DateTime.MinValue;

        public static MainWindow WinMain = null;
        public static Dispatcher AppDispatcher;    //线程
        public static string ConSql = XingYe_ACS.Properties.Settings.Default.ConSql;   //数据库
        public static string Ip = XingYe_ACS.Properties.Settings.Default.ServiceIP;   //服务端Ip
        public static int Port = XingYe_ACS.Properties.Settings.Default.ServicePort;    //端口号
        public static int ServerConactNum = XingYe_ACS.Properties.Settings.Default.ConactNum;  //监听数量
        public static int KeyAreaNum = XingYe_ACS.Properties.Settings.Default.KeyAreaNum;  //区域个数
        public static bool IsTest = XingYe_ACS.Properties.Settings.Default.IsTest;  //测试程序
        public static float FullCharge = XingYe_ACS.Properties.Settings.Default.FullCharge;//满电量
        public static float SafeCharge = XingYe_ACS.Properties.Settings.Default.SafeCharge;//安全电量
        public static float DangerCharge = XingYe_ACS.Properties.Settings.Default.DangerCharge;//危险电量
        public static float MinCharges = XingYe_ACS.Properties.Settings.Default.MinCharges;//危险电量
        public static int TaskTime = XingYe_ACS.Properties.Settings.Default.TaskTime;
        public static int TaskWaitTime = XingYe_ACS.Properties.Settings.Default.taskWaitTime;

        public static string DoorIp1 = XingYe_ACS.Properties.Settings.Default.DoorIp1;   //1号模块
        public static string DoorIp2 = XingYe_ACS.Properties.Settings.Default.DoorIp2;   //2号模块
        public static string S7IP = XingYe_ACS.Properties.Settings.Default.S7IP;   //S7通讯地址
        public static int AgvLength = XingYe_ACS.Properties.Settings.Default.AgvLength;  //AGV车身长度

        public static List<BaseStruct.Config_ClientControl> ClientWork = new List<BaseStruct.Config_ClientControl>();
        public static Common.Log ExFile = new Common.Log();   //存入日志
        public static Common.Sharp Sharp = new Common.Sharp();   //存入日志

        public static List<BaseStruct.Agv> AgvList = new List<BaseStruct.Agv>();//AGV集合
        public static List<BaseStruct.Station> StationList = new List<BaseStruct.Station>();//站台集合
        public static List<BaseStruct.Point> PointList = new List<BaseStruct.Point>();//Point集合
        public static List<BaseStruct.Cpos> CopsList = new List<BaseStruct.Cpos>();//储位集合
        public static ObservableCollection<BaseStruct.FTask> TaskList = new ObservableCollection<BaseStruct.FTask>();//主任务集合
        public static List<BaseStruct.Config_TaskSplit> Config_TaskSplitList = new List<BaseStruct.Config_TaskSplit>();//任务分解设置集合
        public static List<BaseStruct.Config_ErrMsg> Config_ErrMsgList = new List<BaseStruct.Config_ErrMsg>();//错误说明列表
        public static List<BaseStruct.TaskAgvGroup> TaskAgvGroupList = new List<BaseStruct.TaskAgvGroup>();//任务AGV群组匹配关系
        public static List<BaseStruct.SingleControl> SingleControlList = new List<BaseStruct.SingleControl>();//单步控制集合
        public static List<BaseStruct.Config_Point> Config_PointList = new List<BaseStruct.Config_Point>();//旋转锁定点配置集合
        public static List<BaseStruct.Hoister> HoisterList = new List<BaseStruct.Hoister>();//提升机集合
        public static List<BaseStruct.Point> DemoPointList = new List<BaseStruct.Point>();//DemoPoint集合
        //关机小车集合
        public static int offAgv = 0;
        public static DateTime offTime;
        public static List<string> offAgvNo = new List<string>();

        #region 测试全局变量
        //测试行走循环任务变量
        public static int StartWalk = 0;
        public static List<string> AgvNo = new List<string>();
        public static List<string> EndPoint =  new List<string>();
        public static List<string> StartPoint =  new List<string>();
        //测试耦合旋转循环任务变量
        public static int RotateTask = 0;
        public static List<string> RotateAgvNo = new List<string>();
        public static List<string> RotateStartPoint = new List<string>();
        //测试升降循环任务变量 
        public static int LiftTask = 0;
        public static List<string> LiftAgvNo = new List<string>();
        public static List<string> LiftStartPoint = new List<string>();

        //测试托盘旋转循环任务变量 
        public static int PalletTask = 0;
        public static List<string> PalletAgvNo = new List<string>();
        public static List<string> PalletStartPoint = new List<string>();

        //测试充电电量监测
        public static int ChargeTask = 0;

        //异常小车集合
        public static List<string> errAgv = new List<string>();
        #endregion
    }
}