Exemple #1
0
        /// <summary>
        /// 未编码的数据检查
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void barButtonItemUncoding_ItemClick(object sender, ItemClickEventArgs e)
        {
            //切换到属性页面
            // this.xtraTabControlMain.SelectedTabPage = this.xtraTabPageLine;
            this.gridViewLine.BestFitColumns();
            this.gridViewLine.HorzScrollVisibility        = DevExpress.XtraGrid.Views.Base.ScrollVisibility.Always;
            this.gridViewLine.OptionsView.ColumnAutoWidth = false;

            //1.获取到待拆分的数据
            Maticsoft.BLL.cjplp cjplpBLL       = new Maticsoft.BLL.cjplp();
            List <cjplp>        cjplpModelList = cjplpBLL.GetModelList("Exp_No is null or trim(Exp_No)=''");

            this.gridControlPointTable.DataSource = cjplpModelList;

            //获取待拆分的线表数据
            cjpll cjpllBLL = new cjpll();
            List <Maticsoft.Model.cjpll> cjpllModelList = cjpllBLL.GetModelList("Lno is null or trim(Lno)=''");

            this.gridControlLineTable.DataSource = cjpllModelList;
        }
Exemple #2
0
        /// <summary>
        /// 点编码
        /// </summary>
        private static void CjplpCode()
        {
            try
            {
                //街道的编码
                streetno streetnoBLL = new streetno();
                List <Maticsoft.Model.streetno> streetnoModeList = streetnoBLL.GetModelList("shortname is not NULL");

                //顺序编码表
                recordtable recordtableModel             = new recordtable();
                Maticsoft.BLL.recordtable recordtableBll = new Maticsoft.BLL.recordtable();

                #region 点表编码

                //1.获取到待拆分的数据
                Maticsoft.BLL.cjplp cjplpBLL       = new Maticsoft.BLL.cjplp();
                List <cjplp>        cjplpModelList = cjplpBLL.GetModelList("");

                for (int i = 0; i < cjplpModelList.Count; i++)
                {
                    //编码不存在的情况下才进行编码,否则不进行编码
                    if (cjplpModelList[i] != null && String.IsNullOrEmpty(cjplpModelList[i].Exp_No))
                    {
                        //字段类型为空,加了条件判断
                        if (!string.IsNullOrEmpty(cjplpModelList[i].Type) && cjplpModelList[i].Type.Length >= 2)
                        {
                            //查询街道编码不为空的列
                            List <recordtable> recordtablesModelList =
                                recordtableBll.GetModelList("type like '" + cjplpModelList[i].Type.Substring(0, 2) + "%'");
                            //如果数据库中没有此编码,则进行第一次编码
                            if (recordtablesModelList.Count == 0)
                            {
                                for (int j = 0; j < streetnoModeList.Count; j++)
                                {
                                    if (!String.IsNullOrEmpty(cjplpModelList[i].FileName) &&
                                        !String.IsNullOrEmpty(cjplpModelList[i].Type) &&
                                        !String.IsNullOrEmpty(cjplpModelList[i].Sdate) &&
                                        cjplpModelList[i].FileName.Contains(streetnoModeList[j].shortname))
                                    {
                                        //更新:给原始管点编号
                                        cjplpModelList[i].Exp_No = cjplpModelList[i].Type.Substring(0, 2) +
                                                                   cjplpModelList[i].Sdate.Substring(0, 4) +
                                                                   streetnoModeList[j].strnolast5 + "0100001";
                                        cjplpModelList[i].ExpNoTime =
                                            DateTime.Now.ToString() + "." + DateTime.Now.Millisecond.ToString();
                                        cjplpBLL.Update(cjplpModelList[i]);

                                        //添加:数据库记录文件
                                        recordtableModel.type       = cjplpModelList[i].Type.Substring(0, 2);
                                        recordtableModel.year       = cjplpModelList[i].Sdate.Substring(0, 4);
                                        recordtableModel.strnolast5 = streetnoModeList[j].strnolast5;
                                        recordtableModel.inteno     = 1;
                                        recordtableModel.serino     = 1;
                                        recordtableModel.typeYear   = cjplpModelList[i].Type.Substring(0, 2) +
                                                                      cjplpModelList[i].Sdate.Substring(0, 4);
                                        recordtableModel.typeYearStrnolast5 = cjplpModelList[i].Type.Substring(0, 2) +
                                                                              cjplpModelList[i].Sdate.Substring(0, 4) +
                                                                              streetnoModeList[j].strnolast5;
                                        recordtableModel.typeYearStrnolast5Inteno = cjplpModelList[i].Type.Substring(0, 2) +
                                                                                    cjplpModelList[i].Sdate.Substring(0, 4) +
                                                                                    streetnoModeList[j].strnolast5 + "01";
                                        recordtableModel.inteserino = "0100001";
                                        recordtableModel.Exp_No     = cjplpModelList[i].Type.Substring(0, 2) +
                                                                      cjplpModelList[i].Sdate.Substring(0, 4) +
                                                                      streetnoModeList[j].strnolast5 + "0100001";
                                        recordtableBll.Add(recordtableModel);
                                        // Console.WriteLine("点点点添加" + recordtableModel.Exp_No);
                                        break;
                                    }
                                }
                            }
                            else
                            {
                                for (int j = 0; j < streetnoModeList.Count; j++)
                                {
                                    if (!String.IsNullOrEmpty(cjplpModelList[i].FileName) &&
                                        !String.IsNullOrEmpty(cjplpModelList[i].Type) &&
                                        !String.IsNullOrEmpty(cjplpModelList[i].Sdate) &&
                                        cjplpModelList[i].FileName.Contains(streetnoModeList[j].shortname))
                                    {
                                        string temptypeYearStrnolast5 =
                                            cjplpModelList[i].Type.Substring(0, 2) +
                                            cjplpModelList[i].Sdate.Substring(0, 4) +
                                            streetnoModeList[j].strnolast5;

                                        // string temptypeYear =
                                        //     cjplpModelList[i].Type.Substring(0, 2) +
                                        //     cjplpModelList[i].Sdate.Substring(0, 4);


                                        for (int k = 0; k < recordtablesModelList.Count; k++)
                                        {
                                            //如果前3段相同,则更新最后的交汇顺序号和排水管点顺序号
                                            if (recordtablesModelList[k].typeYearStrnolast5 == temptypeYearStrnolast5)
                                            {
                                                //获取数据库信息
                                                string dbInteserino  = recordtablesModelList[k].inteserino;
                                                string newInteserino = string.Empty;
                                                if (Convert.ToInt32(dbInteserino.Substring(2)) != 99999)
                                                {
                                                    //排水管点顺序号变化
                                                    newInteserino =
                                                        dbInteserino.Substring(0, 2) +
                                                        ((Convert.ToInt32(dbInteserino.Substring(2)) + 1).ToString()
                                                         .PadLeft(5, '0'));

                                                    //recordTableModelList表的变化
                                                    // recordtablesModelList[k].inteno = 1;
                                                    recordtablesModelList[k].serino =
                                                        (Convert.ToInt32(dbInteserino.Substring(2)) + 1);

                                                    // recordtablesModelList[k].typeYearStrnolast5Inteno = cjplpModelList[i].Type.Substring(0, 2) +
                                                    //                                                     cjplpModelList[i].Sdate.Substring(0, 4) +
                                                    //                                                     streetnoModeList[j].strnolast5 + "01";
                                                    recordtablesModelList[k].inteserino = newInteserino;
                                                }
                                                else
                                                {
                                                    //交汇点顺序号变化
                                                    newInteserino =
                                                        (Convert.ToInt32(dbInteserino.Substring(0, 2)) + 1).ToString()
                                                        .PadLeft(2, '0') +
                                                        "00001";

                                                    //recordTableModelList表的变化
                                                    recordtablesModelList[k].inteno =
                                                        Convert.ToInt32(dbInteserino.Substring(0, 2)) + 1;
                                                    recordtablesModelList[k].serino = 1;

                                                    recordtablesModelList[k].typeYearStrnolast5Inteno =
                                                        temptypeYearStrnolast5 +
                                                        (Convert.ToInt32(dbInteserino.Substring(0, 2)) + 1).ToString()
                                                        .PadLeft(2, '0');

                                                    recordtablesModelList[k].inteserino = newInteserino;
                                                }

                                                //更新:给原始管点编号并添加进数据库
                                                cjplpModelList[i].Exp_No    = temptypeYearStrnolast5 + newInteserino;
                                                cjplpModelList[i].ExpNoTime =
                                                    DateTime.Now.ToString() + "." + DateTime.Now.Millisecond.ToString();
                                                cjplpBLL.Update(cjplpModelList[i]);

                                                //更新recordtable表
                                                recordtablesModelList[k].Exp_No = temptypeYearStrnolast5 + newInteserino;
                                                recordtableBll.Update(recordtablesModelList[k]);
                                                // Console.WriteLine("点点点更新" + recordtablesModelList[k].Exp_No);
                                            }
                                            else
                                            {
                                                //如果前2段相同,街道不同,则更新最后三段(后3端需要进行重新编码,然后写入数据库中
                                                for (int m = 0; m < streetnoModeList.Count; m++)
                                                {
                                                    if (!String.IsNullOrEmpty(cjplpModelList[i].FileName) &&
                                                        !String.IsNullOrEmpty(cjplpModelList[i].Type) &&
                                                        !String.IsNullOrEmpty(cjplpModelList[i].Sdate) &&
                                                        cjplpModelList[i].FileName.Contains(streetnoModeList[m].shortname))
                                                    {
                                                        //更新给原始管点编号
                                                        cjplpModelList[i].Exp_No = cjplpModelList[i].Type.Substring(0, 2) +
                                                                                   cjplpModelList[i].Sdate.Substring(0, 4) +
                                                                                   streetnoModeList[m].strnolast5 + "0100001";
                                                        cjplpModelList[i].ExpNoTime =
                                                            DateTime.Now.ToString() + "." + DateTime.Now.Millisecond.ToString();
                                                        cjplpBLL.Update(cjplpModelList[i]);

                                                        //添加数据库记录文件
                                                        recordtableModel.type       = cjplpModelList[i].Type.Substring(0, 2);
                                                        recordtableModel.year       = cjplpModelList[i].Sdate.Substring(0, 4);
                                                        recordtableModel.strnolast5 = streetnoModeList[m].strnolast5;
                                                        recordtableModel.inteno     = 1;
                                                        recordtableModel.serino     = 1;
                                                        recordtableModel.typeYear   = cjplpModelList[i].Type.Substring(0, 2) +
                                                                                      cjplpModelList[i].Sdate.Substring(0, 4);
                                                        recordtableModel.typeYearStrnolast5 =
                                                            cjplpModelList[i].Type.Substring(0, 2) +
                                                            cjplpModelList[i].Sdate.Substring(0, 4) +
                                                            streetnoModeList[m].strnolast5;
                                                        recordtableModel.typeYearStrnolast5Inteno =
                                                            cjplpModelList[i].Type.Substring(0, 2) +
                                                            cjplpModelList[i].Sdate.Substring(0, 4) +
                                                            streetnoModeList[m].strnolast5 + "01";
                                                        recordtableModel.inteserino = "0100001";
                                                        recordtableModel.Exp_No     = cjplpModelList[i].Type.Substring(0, 2) +
                                                                                      cjplpModelList[i].Sdate.Substring(0, 4) +
                                                                                      streetnoModeList[m].strnolast5 + "0100001";
                                                        recordtableBll.Add(recordtableModel);
                                                        // Console.WriteLine("点点点添加" + recordtableModel.Exp_No);

                                                        break;
                                                    }
                                                }
                                            }


                                            break;
                                        }

                                        break;
                                    }
                                }
                            }
                        }
                    }
                }

                #endregion
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                throw;
            }
        }
Exemple #3
0
        /// <summary>
        /// 拆分数据 </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void barButtonItemMergeData_ItemClick(object sender, ItemClickEventArgs e)
        {
            try
            {
                //todo:拆分点表
                //1.获取到待拆分的数据
                Maticsoft.BLL.cjplp cjplpBLL = new Maticsoft.BLL.cjplp();
                // string pointSqlStr = "select * from cjplp";
                List <cjplp> cjplpModelList = cjplpBLL.GetModelList("");

                pipeobjectencode pipeobjectencodeBLL = new pipeobjectencode();
                // string pipeobjectencode = "select * from pipeobjectencode";
                List <Maticsoft.Model.pipeobjectencode> pipeobjectencodesModelList =
                    pipeobjectencodeBLL.GetModelList("");

                JudgePoint judgePoint = new JudgePoint();
                for (int i = 0; i < cjplpModelList.Count; i++)
                {
                    //2.类型判断
                    //3.计算信息填充-点号信息和编码信息

                    //todo:管点号不为空或者为null-也就是必须进行编码
                    if (!String.IsNullOrEmpty(cjplpModelList[i].Exp_No))
                    {
                        //附属物不为空
                        if (cjplpModelList[i] != null && !String.IsNullOrEmpty(cjplpModelList[i].Subsid))
                        {
                            for (int j = 0; j < pipeobjectencodesModelList.Count; j++)
                            {
                                if (!String.IsNullOrEmpty(pipeobjectencodesModelList[j].objname) &&
                                    pipeobjectencodesModelList[j].objname == cjplpModelList[i].Subsid)
                                {
                                    //C#在运行时通过类的名称实例化一个类
                                    string className = "MainProject.ImplementClasses." +
                                                       pipeobjectencodesModelList[j].tablename + "Implements";
                                    Type t = Type.GetType(className);
                                    SplitTableInterface b1 = Activator.CreateInstance(t, cjplpModelList[i],
                                                                                      pipeobjectencodesModelList[j].code) as SplitTableInterface;
                                    // judgePoint.judge(new PS_MANHOLEImplements(pipeobjectencodesModelList[j].objname, cjplpModelList[i]));
                                    judgePoint.judge(b1);
                                }
                            }
                        }
                        else if (cjplpModelList[i] != null && !String.IsNullOrEmpty(cjplpModelList[i].Feature))
                        {
                            //附属物为空,但是特征不为空

                            for (int j = 0; j < pipeobjectencodesModelList.Count; j++)
                            {
                                if (!String.IsNullOrEmpty(pipeobjectencodesModelList[j].objname) &&
                                    pipeobjectencodesModelList[j].objname == cjplpModelList[i].Feature)
                                {
                                    // string tempTableName = pipeobjectencodesModelList[j].tablename;

                                    //C#在运行时通过类的名称实例化一个类
                                    string className = "MainProject.ImplementClasses." +
                                                       pipeobjectencodesModelList[j].tablename + "Implements";
                                    Type t = Type.GetType(className);
                                    SplitTableInterface b1 = Activator.CreateInstance(t, cjplpModelList[i],
                                                                                      pipeobjectencodesModelList[j].code) as SplitTableInterface;

                                    // judgePoint.judge(new PS_MANHOLEImplements(pipeobjectencodesModelList[j].objname, cjplpModelList[i]));
                                    judgePoint.judge(b1);
                                }
                            }
                        }
                        else
                        {
                            //todo:附属物、特征都为空
                        }
                    }
                }


                //todo:拆分线表
                cjpll cjpllBLL = new cjpll();
                List <Maticsoft.Model.cjpll>            cjpllModelList = cjpllBLL.GetModelList("");
                List <Maticsoft.Model.pipeobjectencode> pipeobjectencodesLineModelList =
                    pipeobjectencodeBLL.GetModelList("objcate=0");

                for (int i = 0; i < cjpllModelList.Count; i++)
                {
                    //todo:管点号不为空或者为null-也就是必须进行编码
                    if (!String.IsNullOrEmpty(cjpllModelList[i].Lno))
                    {
                        for (int j = 0; j < pipeobjectencodesLineModelList.Count; j++)
                        {
                            if (cjpllModelList[i].Type.Contains(pipeobjectencodesLineModelList[j].objtype))
                            {
                                Console.WriteLine(pipeobjectencodesLineModelList[j].tablename);
                                //C#在运行时通过类的名称实例化一个类
                                string className = "MainProject.ImplementClasses." +
                                                   pipeobjectencodesLineModelList[j].tablename + "Implements";
                                Type t = Type.GetType(className);
                                SplitTableInterface b1 = Activator.CreateInstance(t, cjpllModelList[i],
                                                                                  pipeobjectencodesLineModelList[j].code) as SplitTableInterface;

                                // judgePoint.judge(new PS_MANHOLEImplements(pipeobjectencodesLineModelList[j].objname, cjplpModelList[i]));
                                judgePoint.judge(b1);
                            }
                        }
                    }
                }


                MessageBox.Show("拆分成功!");
            }
            catch (Exception exception)
            {
                Console.WriteLine(exception);
                throw;
            }
        }