Пример #1
0
        //选择算法模块
        private void cb_calcumodulename_SelectedIndexChanged(object sender, EventArgs e)
        {
            pslmodulesname = this.cb_calcumodulename.Text;
            PSLModule selectmodule = pslmodules.Where(a => (a.modulename == pslmodulesname)).First();

            pslmodulesoutputdesc   = selectmodule.moduleoutputdescs.Split(';');
            pslmodulesoutputdesccn = selectmodule.moduleoutputdescscn.Split(';');

            tb_calcupara.Text = selectmodule.moduleparaexample;
        }
Пример #2
0
        //读取pslconfig表的配置信息:1、检查fid是否是从0开始的连续整数。2、返回结果、按照fid进行排序
        public static List <PSLCalcuItem> ReadConfig()
        {
            ErrorFlag = false;
            string sqlStr = "";

            //读取计算组件信息
            List <PSLModule> modulesinfo;

            //从算法信息数据表中读取算法信息
            try
            {
                modulesinfo = PSLModulesDAO.ReadData();
            }
            catch (Exception ex)
            {
                ErrorFlag = true;
                string messageStr;
                messageStr  = String.Format("DAO层PSLModulesDAO.ReadData()错误:---------->") + Environment.NewLine;
                messageStr += String.Format("错误信息:{0}", ex.ToString());
                logHelper.Error(messageStr);
                return(null);
            }
            //读取计算配置信息
            try
            {
                DbHelper dbhelper = new DbHelper();
                //从pscalcuconfig表读取
                string fields = "pslcalcuconfig.fid,"
                                //源标签基本信息
                                + "pslcalcuconfig.sourcetagname,"
                                + "pslcalcuconfig.sourcetagdb,"
                                + "pslcalcuconfig.sourcetagdesc,"
                                + "pslcalcuconfig.sourcetagdim,"
                                + "pslcalcuconfig.sourcetagmrb,"
                                + "pslcalcuconfig.sourcetagmre,"
                                //计算公式配置信息 1、名称
                                + "pslcalcuconfig.fmodulename,"
                                + "pslcalcuconfig.fnode,"
                                + "pslcalcuconfig.fgroup,"
                                + "pslcalcuconfig.forder,"
                                // + "pslmodules.moduleclass,"                       //fclass在pslmodules表中,不在pslcalcuconfig中出现。用于反射调用。
                                //计算公式配置信息 2、算法
                                + "pslcalcuconfig.falgorithmsflag,"
                                + "pslcalcuconfig.fparas,"
                                + "pslcalcuconfig.fcondpslnames,"
                                + "pslcalcuconfig.fcondexpression,"
                                                                  //计算公式配置信息 3、结果
                                + "pslcalcuconfig.foutputtable,"
                                + "pslcalcuconfig.foutputnumber," //foutputnumber在pslmodules表中,不在pslcalcuconfig中出现。用于计算引擎循环
                                + "pslcalcuconfig.foutputpsltagnames,"
                                                                  //计算公式配置信息 4、周期
                                + "pslcalcuconfig.finterval,"
                                + "pslcalcuconfig.fintervaltype,"
                                + "pslcalcuconfig.fdelay,"
                                //计算时间
                                + "pslcalcuconfig.fstarttime"
                ;

                sqlStr = String.Format("use psldb;select {0} from pslcalcuconfig ORDER BY `fid` ASC", fields);
                IDataReader         reader        = dbhelper.ExecuteReader(sqlStr);
                List <PSLCalcuItem> pslcalcuitems = IDataReader2PSLCalcuItems(reader);
                reader.Close();

                //添加结算结果是否允许空值的属性值
                foreach (PSLCalcuItem item in pslcalcuitems)
                {
                    PSLModule module = modulesinfo.Where(a => a.modulename == item.fmodulename).ToList()[0];
                    item.foutputpermitnull = module.moduleoutputpermitnull;
                }

                //按照fid升序排列
                pslcalcuitems.OrderBy(a => a.fid);

                //过滤属于本结算节点的计算项
                pslcalcuitems = pslcalcuitems.Where(a => a.fnode == APPConfig.realcalcu_calcunode).ToList();     //将计算项中计算节点号与当前计算节点一致的过滤出来

                //过滤后给属于本节点的计算项添加序号Index
                for (int i = 0; i < pslcalcuitems.Count; i++)
                {
                    pslcalcuitems[i].index = i;
                }

                /*20180927,添加分布式计算功能,必须放弃这一个限制。页面的刷新采用pslcalcuitems新添加字段index来完成
                 * //检查fid是否是从0开始的连续整数
                 * //如果此检测通过,则能够保证pslcalcuitems.fid和listview的对应关系。
                 * for (int i = 0; i < pslcalcuitems.Count; i++)
                 * {
                 *  if (pslcalcuitems[i].fid != i + 1)
                 *  {
                 *      MessageBox.Show("导入的计算配置信息有误,fid号不是从0开始的连续整数!");
                 *      return new List<PSLCalcuItem>();
                 *  }
                 * }
                 */
                return(pslcalcuitems);
            }
            catch (Exception ex)
            {
                ErrorFlag = true;
                string messageStr;
                messageStr = String.Format("DAO层PSLCalcuConfigDAO.ReadConfig()错误:---------->");
                logHelper.Error(messageStr);
                messageStr = String.Format("sql语句:{0}", sqlStr);
                logHelper.Error(messageStr);
                messageStr = String.Format("错误信息:{0}", ex.ToString());
                logHelper.Error(messageStr);
                return(null);
            }
        }