/// <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; }
/// <summary> /// 线编码 /// </summary> private void CjpllCode() { //try //{ Maticsoft.BLL.cjplp cjplpBLL = new Maticsoft.BLL.cjplp(); #region 线表编码 //街道的编码 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(); //获取待拆分的线表数据 cjpll cjpllBLL = new cjpll(); List <Maticsoft.Model.cjpll> cjpllModelList = cjpllBLL.GetModelList(""); for (int i = 0; i < cjpllModelList.Count; i++) { for (int j = 0; j < streetnoModeList.Count; j++) { if (!String.IsNullOrEmpty(cjpllModelList[i].Exp_No0) && !String.IsNullOrEmpty(cjpllModelList[i].Exp_No1) && !String.IsNullOrEmpty(cjpllModelList[i].Type) && !String.IsNullOrEmpty(cjpllModelList[i].Sdate) && cjpllModelList[i].FileName.Contains(streetnoModeList[j].shortname)) { cjplp exp_No0Model = cjplpBLL.GetModel(cjpllModelList[i].Exp_No0); cjplp exp_No1Model = cjplpBLL.GetModel(cjpllModelList[i].Exp_No1); if (exp_No0Model != null && exp_No1Model != null && !string.IsNullOrEmpty(exp_No0Model.Exp_No) && !string.IsNullOrEmpty(exp_No1Model.Exp_No)) { // string tmp = "type like '" + cjpllModelList[i].Type.Substring(0, 2) + // "%' and Lno like '" + // cjpllModelList[i].Type.Substring(0, 2) + // cjpllModelList[i].Sdate.Substring(0, 4) + // streetnoModeList[j].strnolast5 + "__" + // exp_No0Model.Exp_No.Substring(13) + // exp_No1Model.Exp_No.Substring(13) + "'"; //查询街道编码不为空的列 List <recordtable> recordtablesModelList = recordtableBll.GetModelList("type like '" + cjpllModelList[i].Type.Substring(0, 2) + "%' and Lno like '" + cjpllModelList[i].Type.Substring(0, 2) + cjpllModelList[i].Sdate.Substring(0, 4) + streetnoModeList[j].strnolast5 + "__" + exp_No0Model.Exp_No.Substring(13) + exp_No1Model.Exp_No.Substring(13) + "'"); //1.填充起点、终点编码 cjpllModelList[i].S_Point = exp_No0Model.Exp_No; cjpllModelList[i].E_Point = exp_No1Model.Exp_No; //2.计算管线编码 if (recordtablesModelList.Count == 0) { //计算管线编号 cjpllModelList[i].Lno = cjpllModelList[i].Type.Substring(0, 2) + cjpllModelList[i].Sdate.Substring(0, 4) + streetnoModeList[j].strnolast5 + "01" + exp_No0Model.Exp_No.Substring(13) + exp_No1Model.Exp_No.Substring(13); //2.插入记录表 recordtableModel.type = cjpllModelList[i].Type.Substring(0, 2); recordtableModel.year = cjpllModelList[i].Sdate.Substring(0, 4); recordtableModel.strnolast5 = streetnoModeList[j].strnolast5; recordtableModel.inteno = 1; recordtableModel.serino = Convert.ToInt32(exp_No0Model.Exp_No.Substring(13)) + Convert.ToInt32(exp_No1Model.Exp_No.Substring(13)); recordtableModel.typeYear = cjpllModelList[i].Type.Substring(0, 2) + cjpllModelList[i].Sdate.Substring(0, 4); recordtableModel.typeYearStrnolast5 = cjpllModelList[i].Type.Substring(0, 2) + cjpllModelList[i].Sdate.Substring(0, 4) + streetnoModeList[j].strnolast5; recordtableModel.typeYearStrnolast5Inteno = cjpllModelList[i].Type.Substring(0, 2) + cjpllModelList[i].Sdate.Substring(0, 4) + streetnoModeList[j].strnolast5 + "01"; recordtableModel.inteserino = exp_No0Model.Exp_No.Substring(13) + exp_No1Model.Exp_No.Substring(13); recordtableModel.Lno = cjpllModelList[i].Type.Substring(0, 2) + cjpllModelList[i].Sdate.Substring(0, 4) + streetnoModeList[j].strnolast5 + "01" + exp_No0Model.Exp_No.Substring(13) + exp_No1Model.Exp_No.Substring(13); recordtableBll.Add(recordtableModel); // Console.WriteLine("线线线添加" + recordtableModel.Lno); } else { List <int> seriaList = new List <int>(); for (int k = 0; k < recordtablesModelList.Count; k++) { seriaList.Add(Convert.ToInt16(recordtablesModelList[k].Lno.Substring(11, 2))); } //计算管线编号 cjpllModelList[i].Lno = cjpllModelList[i].Type.Substring(0, 2) + cjpllModelList[i].Sdate.Substring(0, 4) + streetnoModeList[j].strnolast5 + seriaList.Max().ToString().PadLeft(2, '0') + exp_No0Model.Exp_No.Substring(13) + exp_No1Model.Exp_No.Substring(13); //2.插入记录表 recordtableModel.inteno = seriaList.Max(); recordtableModel.typeYearStrnolast5Inteno = cjpllModelList[i].Type.Substring(0, 2) + cjpllModelList[i].Sdate.Substring(0, 4) + streetnoModeList[j].strnolast5 + seriaList.Max().ToString().PadLeft(2, '0'); recordtableModel.Lno = cjpllModelList[i].Type.Substring(0, 2) + cjpllModelList[i].Sdate.Substring(0, 4) + streetnoModeList[j].strnolast5 + seriaList.Max().ToString().PadLeft(2, '0') + exp_No0Model.Exp_No.Substring(13) + exp_No1Model.Exp_No.Substring(13); recordtableBll.Update(recordtableModel); // Console.WriteLine("线线线更新" + recordtableModel.Lno); } //3.计算管线长度 if (!String.IsNullOrEmpty(exp_No0Model.X.ToString()) && !String.IsNullOrEmpty(exp_No0Model.Y.ToString()) && !String.IsNullOrEmpty(exp_No1Model.X.ToString()) && !String.IsNullOrEmpty(exp_No1Model.Y.ToString())) { cjpllModelList[i].PipeLength = (decimal)calculatePipeLength(exp_No0Model, exp_No1Model); } cjpllModelList[i].LnoTime = DateTime.Now.ToString() + "." + DateTime.Now.Millisecond.ToString(); //更新管线计算内容 cjpllBLL.Update(cjpllModelList[i]); break; } } } } #endregion //} //catch (Exception e) //{ // Console.WriteLine(e); // throw; //} }
/// <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; } }