Ejemplo n.º 1
0
        public FrmSecondDMain()
        {
            InitializeComponent();
            this.Text = "AGV调度系统实时显示";
            bool isSucc = true;

            try
            {
                ConnectConfigTool.setDBase();
            }
            catch (Exception ex)
            {
                MsgBox.ShowError(ex.Message + "请检查...");
                isSucc = false;
            }
            if (ConnectConfigTool.DBase == null || !isSucc)
            {
                //弹出维护数据库维护界面
                using (FrmSysConnSet frm = new FrmSysConnSet())
                {
                    if (frm.ShowDialog() != DialogResult.OK)
                    {
                        Application.ExitThread();
                        Application.Exit();
                        return;
                    }
                }
            }
            using (WaitDialogForm dialog = new WaitDialogForm("正在启动,请稍后...", "提示"))
            {
                InitCanvas("", false);
            }
        }
Ejemplo n.º 2
0
        public FrmLogin()
        {
            InitializeComponent();
            //判断数据库链接
            bool isSucc = true;

            try
            {
                ConnectConfigTool.setDBase();
            }
            catch (Exception ex)
            {
                MsgBox.ShowError(ex.Message + "请检查...");
                isSucc = false;
            }
            if (ConnectConfigTool.DBase == null || !isSucc)
            {
                //弹出维护数据库维护界面
                using (FrmSysConnSet frm = new FrmSysConnSet())
                {
                    if (frm.ShowDialog() != DialogResult.OK)
                    {
                        Application.ExitThread();
                        Application.Exit();
                        return;
                    }
                    else
                    {
                        ConnectConfigTool.setDBase();
                    }
                }
            }
        }
Ejemplo n.º 3
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            try
            {
                this.label1.Focus();
                if (Valide())
                {
                    using (DevExpress.Utils.WaitDialogForm dialog = new DevExpress.Utils.WaitDialogForm("正在测试数据库连接,请稍后...", "提示"))
                    {
                        if (TestdataBaseInfo == null)
                        {
                            TestdataBaseInfo = new DataBaseInfo();
                        }
                        TestdataBaseInfo.DataBaseName = this.txtDBName.Text.Trim();
                        TestdataBaseInfo.DbSource     = this.txtIP.Text.Trim();
                        TestdataBaseInfo.Pwd          = this.txtPass.Text.Trim();
                        TestdataBaseInfo.Uid          = this.txtUser.Text.Trim();

                        IDbOperator dbTesthqOperator = CreateDbOperator.DbOperatorInstance(TestdataBaseInfo);
                        //测试数据库
                        if (dbTesthqOperator.ServerIsThrough())
                        {
                        }
                        else
                        {
                            MsgBox.ShowError("数据库地址不正确!");
                            return;
                        }
                    }
                    DataTable dt = ConnectConfigTool.GetDataTableStruct();
                    DataRow   dr = dt.NewRow();
                    dr["DBIP"]       = this.txtIP.Text.Trim();
                    dr["DBName"]     = this.txtDBName.Text.Trim();
                    dr["DBUser"]     = this.txtUser.Text.Trim();
                    dr["DBPass"]     = this.txtPass.Text.Trim();
                    dr["ServerIP"]   = this.txtServeIP.Text.Trim();
                    dr["ServerPort"] = this.txtServePort.Text.Trim();
                    dt.Rows.Add(dr);
                    DtToTxt(dt);
                    ConnectConfigTool.setDBase();
                    MsgBox.ShowWarn("保存成功!");
                    if (MsgBox.ShowQuestion("是否重新加载地图?") == DialogResult.Yes)
                    {
                        this.DialogResult = DialogResult.OK;
                    }
                    else
                    {
                        this.DialogResult = DialogResult.Cancel;
                    }
                    this.Close();
                    return;
                }
            }
            catch (Exception ex)
            { MsgBox.ShowError(ex.Message); }
        }
Ejemplo n.º 4
0
 static void Main()
 {
     Application.EnableVisualStyles();
     Application.SetCompatibleTextRenderingDefault(false);
     try
     {
         ConnectConfigTool.setDBase();
     }
     catch (Exception ex)
     {
         MsgBox.ShowError(ex.Message + "请检查...");
         Application.Exit();
         return;
     }
     Application.Run(new FrmMain());
 }
Ejemplo n.º 5
0
        public FrmSimula3D()
        {
            InitializeComponent();
            this.MouseWheel += new System.Windows.Forms.MouseEventHandler(this.OnMouseWheel);

            bool isSucc = true;

            try
            {
                ConnectConfigTool.setDBase();
            }
            catch (Exception ex)
            {
                MsgBox.ShowError(ex.Message + "请检查...");
                isSucc = false;
            }
            if (ConnectConfigTool.DBase == null || !isSucc)
            {
                //弹出维护数据库维护界面
                using (FrmSysConnSet frm = new FrmSysConnSet())
                {
                    if (frm.ShowDialog() != DialogResult.OK)
                    {
                        Application.ExitThread();
                        Application.Exit();
                        return;
                    }
                }
            }
            try
            {
                ConnectConfigTool.setDBase();
            }
            catch (Exception ex)
            {
                MsgBox.ShowError(ex.Message + "请检查...");
                return;
            }
        }
Ejemplo n.º 6
0
        private bool InitAndStartServer()
        {
            try
            {
                DelegateState.InvokeDispatchStateEvent("正在读取数据库连接...");
                ConnectConfigTool.setDBase();
                if (ConnectConfigTool.DBase == null)
                {
                    DelegateState.InvokeDispatchStateEvent("数据库连接文件不存在!");
                    return(false);
                }
                IDbOperator dbOperator = CreateDbOperator.DbOperatorInstance(ConnectConfigTool.DBase);
                if (dbOperator == null)
                {
                    DelegateState.InvokeDispatchStateEvent("数据库连接文件不存在!");
                    return(false);
                }
                bool IsConnectDB = false;

                try
                {
                    IsConnectDB = dbOperator.ServerIsThrough();
                }
                catch (Exception ex)
                {
                    DelegateState.InvokeDispatchStateEvent("数据库连接失败【" + ex.Message + "】");
                }
                if (!IsConnectDB)
                {
                    return(false);
                }
                CoreData.dbOperator = dbOperator;
                #region 读取系统参数
                DelegateState.InvokeDispatchStateEvent("正在读取系统参数...");
                DataTable dtSysparameter = CoreData.dbOperator.LoadDatas("QuerySyspara");
                foreach (DataRow row in dtSysparameter.Rows)
                {
                    CoreData.SysParameter[row["ParameterCode"].ToString()] = row["ParameterValue"].ToString();
                }
                DelegateState.InvokeDispatchStateEvent("读取系统参数成功...");
                #endregion
                DataTable dtAllCallBox = CoreData.dbOperator.LoadDatas("QueryAllCallBox");
                CoreData.AllCallBoxes = DataToObject.TableToEntity <CallBoxInfo>(dtAllCallBox);
                DataTable dtAllCallBoxDetail = CoreData.dbOperator.LoadDatas("QueryAllCallBoxDetails");
                CoreData.AllCallBoxDetail = DataToObject.TableToEntity <CallBoxDetail>(dtAllCallBoxDetail);
                //读取储位
                DataTable dtstorage = CoreData.dbOperator.LoadDatas("QueryAllStore");
                CoreData.StorageList = DataToObject.TableToEntity <StorageInfo>(dtstorage);

                //读取区域
                DataTable dtarea = CoreData.dbOperator.LoadDatas("LoadAllArea");
                CoreData.AllAreaList = DataToObject.TableToEntity <AreaInfo>(dtarea);

                //初始化呼叫器通信
                Seccions.Clear();
                foreach (CallBoxInfo callbox in CoreData.AllCallBoxes)
                {
                    //if (callbox.CallBoxID != 5)
                    //{
                    //    continue;
                    //}
                    SiemensConnectInfo ConnConfig = new SiemensConnectInfo()
                    {
                        ServerIP = callbox.CallBoxIP, Port = callbox.CallBoxPort
                    };

                    CommunicationSiemensPlc Commer = new CommunicationSiemensPlc(callbox.CallBoxID, ConnConfig);
                    if (!Commer.InitSiemens())
                    {
                        DelegateState.InvokeDispatchStateEvent("初始化呼叫器:" + callbox.CallBoxID.ToString() + "IP:" + "callbox.CallBoxIP" + "失败!");
                        continue;
                    }
                    Commer.Start();
                    Seccions.Add(Commer);
                }
                DelegateState.InvokeDispatchStateEvent("初始化成功...");
                return(true);
            }
            catch (Exception ex)
            {
                DelegateState.InvokeDispatchStateEvent(ex.Message);
                return(false);
            }
        }