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);
            }
        }
 public CommunicationSiemensPlc(int pclCode, SiemensConnectInfo Param)
 {
     this.PLCCode   = pclCode;
     this.ConnParam = Param;
 }