Exemplo n.º 1
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();
                    }
                }
            }
        }
Exemplo n.º 2
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);
            }
        }
Exemplo 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); }
        }
Exemplo n.º 4
0
 /// <summary>
 /// 加载所有指令档案
 /// </summary>
 /// <returns></returns>
 public static IList <CmdInfo> Load_Cmd()
 {
     try
     {
         IDbOperator     dbOperator = CreateDbOperator.DbOperatorInstance(ConnectConfigTool.DBase);
         DataTable       dtResult   = dbOperator.LoadDatas("Load_Cmd");
         IList <CmdInfo> CmdInfos   = ConnectConfigTool.TableToEntity <CmdInfo>(dtResult);
         return(CmdInfos);
     }
     catch (Exception ex)
     { throw ex; }
 }
Exemplo n.º 5
0
 /// <summary>
 /// 加载调度程序里配置信息
 /// </summary>
 /// <returns></returns>
 public static IList <DispatchAssembly> Load_DisptchAssembly()
 {
     try
     {
         IDbOperator dbOperator = CreateDbOperator.DbOperatorInstance(ConnectConfigTool.DBase);
         DataTable   dtResult   = dbOperator.LoadDatas("Load_DisptchAssembly");
         IList <DispatchAssembly> DispatchAssems = ConnectConfigTool.TableToEntity <DispatchAssembly>(dtResult);
         return(DispatchAssems);
     }
     catch (Exception ex)
     { throw ex; }
 }
Exemplo n.º 6
0
 /// <summary>
 /// 根据呼叫器ID加载呼叫器配置明细
 /// </summary>
 /// <param name="CallBoxID"></param>
 /// <returns></returns>
 public static IList <CallBoxDetail> LoadCallBoxDetails(int CallBoxID)
 {
     try
     {
         IDbOperator dbOperator = CreateDbOperator.DbOperatorInstance(ConnectConfigTool.DBase);
         Hashtable   dic        = new Hashtable();
         dic["CallBoxID"] = CallBoxID;
         DataTable dt = dbOperator.LoadDatas("LoadCallBoxDetails", dic);
         return(ConnectConfigTool.TableToEntity <CallBoxDetail>(dt));
     }
     catch (Exception ex)
     { throw ex; }
 }
Exemplo n.º 7
0
 /// <summary>
 /// 加载用户可操作按钮
 /// </summary>
 public static IList <SysOprButtonToCategory> LoadUserOprBtn(string UserID)
 {
     try
     {
         IDbOperator dbOperator = CreateDbOperator.DbOperatorInstance(ConnectConfigTool.DBase);
         Hashtable   hs         = new Hashtable();
         hs["UserID"] = UserID;
         DataTable dt = dbOperator.LoadDatas("QueryUserOperButttons", hs);
         return(ConnectConfigTool.TableToEntity <SysOprButtonToCategory>(dt));
     }
     catch (Exception ex)
     { throw ex; }
 }
Exemplo n.º 8
0
 /// <summary>
 /// 加载所有的地标
 /// </summary>
 /// <returns></returns>
 public static IList <LandMarkShap> LoadLandShaps()
 {
     try
     {
         IDbOperator          dbOperator = CreateDbOperator.DbOperatorInstance(ConnectConfigTool.DBase);
         Hashtable            hs         = new Hashtable();
         DataTable            dt         = dbOperator.LoadDatas("getLandMarks", hs);
         IList <LandMarkShap> lands      = ConnectConfigTool.TableToEntity <LandMarkShap>(dt);
         return(lands);
     }
     catch (Exception ex)
     { throw ex; }
 }
Exemplo n.º 9
0
 /// <summary>
 /// 加载所有的车辆信息
 /// </summary>
 /// <returns></returns>
 public static IList <CarInfo> LoadCarShap()
 {
     try
     {
         IDbOperator     dbOperator = CreateDbOperator.DbOperatorInstance(ConnectConfigTool.DBase);
         Hashtable       hs         = new Hashtable();
         DataTable       dt         = dbOperator.LoadDatas("LoadAGVAchive", hs);
         IList <CarInfo> Cars       = ConnectConfigTool.TableToEntity <CarInfo>(dt);
         return(Cars);
     }
     catch (Exception ex)
     { throw ex; }
 }
Exemplo n.º 10
0
 /// <summary>
 /// 匹配线段配置
 /// </summary>
 /// <returns></returns>
 public static IList <RouteFragmentConfigInfo> Load_RouteFragment()
 {
     try
     {
         IDbOperator dbOperator = CreateDbOperator.DbOperatorInstance(ConnectConfigTool.DBase);
         Hashtable   hs         = new Hashtable();
         DataTable   dtResult   = dbOperator.LoadDatas("Load_RouteFragment");
         IList <RouteFragmentConfigInfo> RouteFragmens = ConnectConfigTool.TableToEntity <RouteFragmentConfigInfo>(dtResult);
         return(RouteFragmens);
     }
     catch (Exception ex)
     { throw ex; }
 }
Exemplo n.º 11
0
 public static IList <TraJunctionSegInfo> QueryJunctionSeg(int TraJunctionID)
 {
     try
     {
         IDbOperator dbOperator = CreateDbOperator.DbOperatorInstance(ConnectConfigTool.DBase);
         Hashtable   hs         = new Hashtable();
         hs["TraJunctionID"] = TraJunctionID;
         DataTable dt = dbOperator.LoadDatas("QueryJunctionSeg", hs);
         IList <TraJunctionSegInfo> segs = ConnectConfigTool.TableToEntity <TraJunctionSegInfo>(dt);
         return(segs);
     }
     catch (Exception e)
     { throw e; }
 }
Exemplo n.º 12
0
 /// <summary>
 /// 根据任务配置明细加载其必经地标档案
 /// </summary>
 /// <returns></returns>
 public static IList <TaskConfigMustPass> LoadTaskMustPass(string TaskConditonCode, int TaskConfigDetailID)
 {
     try
     {
         IDbOperator dbOperator = CreateDbOperator.DbOperatorInstance(ConnectConfigTool.DBase);
         Hashtable   dic        = new Hashtable();
         dic["TaskConditonCode"]   = TaskConditonCode;
         dic["TaskConfigDetailID"] = TaskConfigDetailID;
         DataTable dt = dbOperator.LoadDatas("LoadTaskMustPass", dic);
         return(ConnectConfigTool.TableToEntity <TaskConfigMustPass>(dt));
     }
     catch (Exception ex)
     { throw ex; }
 }
Exemplo n.º 13
0
 /// <summary>
 /// 根据任务明细查询相应必经地标的动作档案信息
 /// </summary>
 /// <returns></returns>
 public static IList <TaskConfigMustPass> LoadIOActiones(string TaskConditonCode, int TaskConfigDetailID)
 {
     try
     {
         IDbOperator dbOperator = CreateDbOperator.DbOperatorInstance(ConnectConfigTool.DBase);
         Hashtable   hs         = new Hashtable();
         hs["TaskConditonCode"]   = TaskConditonCode;
         hs["TaskConfigDetailID"] = TaskConfigDetailID;
         DataTable dtResult = dbOperator.LoadDatas("LoadMustPassbyConditonCode");
         IList <TaskConfigMustPass> TaskConfigMustPasses = ConnectConfigTool.TableToEntity <TaskConfigMustPass>(dtResult);
         return(TaskConfigMustPasses);
     }
     catch (Exception ex)
     { throw ex; }
 }
Exemplo n.º 14
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());
 }
Exemplo n.º 15
0
 private void FrmSysConnSet_Shown(object sender, EventArgs e)
 {
     try
     {
         DataTable dt = ConnectConfigTool.TxtToDT();
         if (dt != null && dt.Rows.Count > 0)
         {
             this.txtIP.Text        = dt.Rows[0]["DBIP"].ToString();
             this.txtDBName.Text    = dt.Rows[0]["DBName"].ToString();
             this.txtPass.Text      = dt.Rows[0]["DBPass"].ToString();
             this.txtUser.Text      = dt.Rows[0]["DBUser"].ToString();
             this.txtServeIP.Text   = dt.Rows[0]["ServerIP"].ToString();
             this.txtServePort.Text = dt.Rows[0]["ServerPort"].ToString();
         }
         this.label1.Focus();
     }
     catch (Exception ex)
     { MsgBox.ShowError(ex.Message); }
 }
Exemplo n.º 16
0
 /// <summary>
 /// 加载agv的当前路线
 /// </summary>
 public static List <LandmarkInfo> LoadCarRoute(CarInfo Car)
 {
     try
     {
         IDbOperator         dbOperator = CreateDbOperator.DbOperatorInstance(ConnectConfigTool.DBase);
         List <LandmarkInfo> route      = new List <LandmarkInfo>();
         Hashtable           dic        = new Hashtable();
         dic["AGVID"] = Car.AgvID;
         DataTable dt = dbOperator.LoadDatas("QueryAGVRoute", dic);
         if (dt != null && dt.Rows.Count > 0)
         {
             string RouteLandCodes = dt.Rows[0]["RouteLandCodes"].ToString();
             if (string.IsNullOrEmpty(RouteLandCodes))
             {
                 return(route);
             }
             else
             {
                 string[] LandCodes = RouteLandCodes.Split(',');
                 foreach (string item in LandCodes)
                 {
                     LandmarkInfo Land = CoreData.AllLands.FirstOrDefault(p => p.LandmarkCode == item);
                     if (Land == null)
                     {
                         continue;
                     }
                     else
                     {
                         route.Add(ConnectConfigTool.CreateDeepCopy <LandmarkInfo>(Land));
                     }
                 }
             }
             return(route);
         }
         else
         {
             return(route);
         }
     }
     catch (Exception ex)
     { throw ex; }
 }
Exemplo n.º 17
0
 /// <summary>
 /// 根据IO动作ID加载对应的IO动作信息
 /// </summary>
 public static DispatchTaskInfo LoadTaskByNo(string No)
 {
     try
     {
         IDbOperator dbOperator = CreateDbOperator.DbOperatorInstance(ConnectConfigTool.DBase);
         Hashtable   hs         = new Hashtable();
         hs["dispatchNo"] = No;
         DataTable dt = dbOperator.LoadDatas("LoadTaskByNo", hs);
         IList <DispatchTaskInfo> Tasks = ConnectConfigTool.TableToEntity <DispatchTaskInfo>(dt);
         if (Tasks != null && Tasks.Count > 0)
         {
             return(Tasks.FirstOrDefault());
         }
         else
         {
             return(null);
         }
     }
     catch (Exception e)
     { throw e; }
 }
Exemplo n.º 18
0
 /// <summary>
 /// 根据呼叫器ID加载呼叫器信息
 /// </summary>
 /// <param name="BoxID"></param>
 /// <returns></returns>
 public static CallBoxInfo LoadAllCallBoxByID(int BoxID)
 {
     try
     {
         IDbOperator dbOperator = CreateDbOperator.DbOperatorInstance(ConnectConfigTool.DBase);
         Hashtable   dic        = new Hashtable();
         dic["CallBoxID"] = BoxID;
         DataTable           dt           = dbOperator.LoadDatas("LoadCallBoxByID", dic);
         IList <CallBoxInfo> CallBoxInfos = ConnectConfigTool.TableToEntity <CallBoxInfo>(dt);
         if (CallBoxInfos == null || (CallBoxInfos != null && CallBoxInfos.Count <= 0))
         {
             return(null);
         }
         else
         {
             return(CallBoxInfos.FirstOrDefault());
         }
     }
     catch (Exception ex)
     { throw ex; }
 }
Exemplo n.º 19
0
 /// <summary>
 /// 根据IO动作ID加载对应的IO动作信息
 /// </summary>
 public static IOActionInfo LoadAllIOAction(int IOActionID)
 {
     try
     {
         IDbOperator dbOperator = CreateDbOperator.DbOperatorInstance(ConnectConfigTool.DBase);
         Hashtable   hs         = new Hashtable();
         hs["IOActionID"] = IOActionID;
         DataTable            dt         = dbOperator.LoadDatas("LoadIOActionByID");
         IList <IOActionInfo> IOActiones = ConnectConfigTool.TableToEntity <IOActionInfo>(dt);
         if (IOActiones != null && IOActiones.Count > 0)
         {
             return(IOActiones.FirstOrDefault());
         }
         else
         {
             return(null);
         }
     }
     catch (Exception e)
     { throw e; }
 }
Exemplo n.º 20
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;
            }
        }
Exemplo n.º 21
0
 /// <summary>
 /// 根据条件加载任务明细
 /// </summary>
 /// <returns></returns>
 public static DispatchTaskDetail LoadTaskDetailByNo(string disPatchNo, int DetailID)
 {
     try
     {
         IDbOperator dbOperator = CreateDbOperator.DbOperatorInstance(ConnectConfigTool.DBase);
         Hashtable   dic        = new Hashtable();
         dic["dispatchNo"] = disPatchNo;
         dic["DetailID"]   = DetailID;
         DataTable dtTaskDetailInfo            = dbOperator.LoadDatas("LoadTaskDetailByNo", dic);
         IList <DispatchTaskDetail> TaskDetail = ConnectConfigTool.TableToEntity <DispatchTaskDetail>(dtTaskDetailInfo);
         if (TaskDetail != null && TaskDetail.Count > 0)
         {
             return(TaskDetail[0]);
         }
         else
         {
             return(null);
         }
     }
     catch (Exception ex)
     { throw ex; }
 }
Exemplo n.º 22
0
 public static DispatchTaskDetail GetTaskDetail(string No, int id)
 {
     try
     {
         IDbOperator dbOperator = CreateDbOperator.DbOperatorInstance(ConnectConfigTool.DBase);
         Hashtable   dic        = new Hashtable();
         dic["dispatchNo"]   = No;
         dic["TaskDetailID"] = id;
         DataTable          dtDetail = dbOperator.LoadDatas("GetTaskDetail", dic);
         DispatchTaskDetail detail   = null;
         if (dtDetail != null && dtDetail.Rows.Count > 0)
         {
             detail = ConnectConfigTool.TableToEntity <DispatchTaskDetail>(dtDetail)[0];
             return(detail);
         }
         else
         {
             return(null);
         }
     }
     catch (Exception ex)
     { throw ex; }
 }
Exemplo n.º 23
0
 /// <summary>
 /// 验证用于信息
 /// </summary>
 /// <returns></returns>
 public static UserInfo LoadUserInfo(string UserID, string PassWord)
 {
     try
     {
         IDbOperator dbOperator = CreateDbOperator.DbOperatorInstance(ConnectConfigTool.DBase);
         Hashtable   dic        = new Hashtable();
         dic["UserID"]   = UserID;
         dic["PassWord"] = PassWord;
         DataTable dtUser = dbOperator.LoadDatas("LoadUserInfo", dic);
         UserInfo  user   = null;
         if (dtUser != null && dtUser.Rows.Count > 0)
         {
             user = ConnectConfigTool.TableToEntity <UserInfo>(dtUser)[0];
             return(user);
         }
         else
         {
             return(null);
         }
     }
     catch (Exception ex)
     { throw ex; }
 }
Exemplo n.º 24
0
 /// <summary>
 /// 根据条件加载任务信息
 /// </summary>
 public static IList <DispatchTaskInfo> LoadDispatchTask(string Condition)
 {
     try
     {
         IDbOperator dbOperator = CreateDbOperator.DbOperatorInstance(ConnectConfigTool.DBase);
         Hashtable   dic        = new Hashtable();
         dic["TaskState"] = Condition;
         dic["CurrDate"]  = DateTime.Now.ToString("yyyyMMdd");
         dic["PreDate"]   = DateTime.Now.AddDays(-1).ToString("yyyyMMdd");
         DataTable dtTaskInfo           = dbOperator.LoadDatas("LoadTaskInfo", dic);
         IList <DispatchTaskInfo> Tasks = ConnectConfigTool.TableToEntity <DispatchTaskInfo>(dtTaskInfo);
         foreach (DispatchTaskInfo item in Tasks)
         {
             dic["dispatchNo"] = item.dispatchNo;
             DataTable dtTaskDetail = dbOperator.LoadDatas("LoadTaskDetail", dic);
             IList <DispatchTaskDetail> TaskDetail = ConnectConfigTool.TableToEntity <DispatchTaskDetail>(dtTaskDetail);
             item.TaskDetail = TaskDetail;
         }
         return(Tasks);
     }
     catch (Exception ex)
     { throw ex; }
 }
Exemplo n.º 25
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);
            }
        }
Exemplo n.º 26
0
 public FrmConditonSet(IList <DetailCondition> has_Conditons)
 {
     InitializeComponent();
     HasConditons = ConnectConfigTool.CreateDeepCopy <IList <DetailCondition> >(has_Conditons);
 }
Exemplo n.º 27
0
        private void btnQuery_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            try
            {
                this.gvDetail.Focus();
                if (QueryInfo == null)
                {
                    MsgBox.ShowWarn("报表" + QueryCode + "不完整!");
                    return;
                }
                try
                {
                    foreach (DetailCondition item in QueryInfo.Condition)
                    {
                        switch (item.control_type)
                        {
                        case 0:
                            TextBox txt = pnlCondition.Controls.Find(item.ConditionCode, true)[0] as TextBox;
                            item.RealyValue = txt.Text.Trim();
                            break;

                        case 1:
                            DateTimePicker dtp = pnlCondition.Controls.Find(item.ConditionCode, true)[0] as DateTimePicker;
                            item.RealyValue = dtp.Value.ToString("yyyy/MM/dd");
                            break;

                        case 2:
                            ComboBox cbx      = pnlCondition.Controls.Find(item.ConditionCode, true)[0] as ComboBox;
                            string[] value    = item.ConditionValue.Split(';');
                            string   contian  = value.Where(P => P.Contains(cbx.Text.ToString())).FirstOrDefault();
                            string   reaValue = contian.Split(':')[0];
                            item.RealyValue = reaValue;
                            break;

                        default: break;
                        }
                    }
                }
                catch (Exception ex)
                {
                    MsgBox.ShowError("报表条件配置有误!\r\n" + ex.Message);
                }
                DataTable res = AGVDAccess.AGVClientDAccess.ExcuteBI(QueryInfo);
                if (res == null)
                {
                    return;
                }
                DataTable Data = ConnectConfigTool.CreateDeepCopy <DataTable>(res);
                foreach (DataColumn col in res.Columns)
                {
                    int count = QueryInfo.Fileds.Where(P => P.FiledCode.Equals(col.ColumnName)).Count();
                    if (count == 0)
                    {
                        Data.Columns.Remove(col.ColumnName);
                    }
                }
                this.gcDetail.DataSource = Data;
                gcDetail.Refresh();
                //实现汇总方式
                ModiFyName();
            }
            catch (Exception ex)
            { MsgBox.ShowError(ex.Message); }
        }
Exemplo n.º 28
0
 public FrmDetailSqlSet(DetailQueryInfo queryinfo)
 {
     InitializeComponent();
     QueryInfo = ConnectConfigTool.CreateDeepCopy <DetailQueryInfo>(queryinfo);
 }