internal static IList <JTCY> ExtractHZs(IList <JTCY> jTCies) { IList <JTCY> hzs = new List <JTCY>(); Dictionary <string, IList <JTCY> > bmDic = Utils.GetGroupDicToList("CBFBM", jTCies); foreach (string bm in bmDic.Keys) { try { JTCY hz = ExtractHZ(bmDic[bm]); hzs.Add(hz); } catch (Exception e) { MessageBox.Show(e.Message); return(null); } } return(hzs); }
/// <summary> /// 检查单个户主 /// </summary> /// <param name="hz"></param> private void CheckHZ(JTCY hz, int cellIndex) { Dictionary <string, string> yhzgxDic = JTCYCustom.YHZGXDic; IList <JTCY> jtcys = hz.JTCies; foreach (JTCY jtcy in jtcys) { if (!Utils.CheckIDCard18(jtcy.GMSFHM)) { CheckZJDWriteError(jtcy.Row, cellIndex, "证件号码不符合规则"); } //检查关系 是否符合规则 string yhzgx = jtcy.YHZGX; if (yhzgx != null && !yhzgxDic.ContainsKey(yhzgx)) { CheckZJDWriteError(jtcy.Row, cellIndex, yhzgx + ":关系不是标准"); } } }
private void OpenExcel_Click(object sender, RoutedEventArgs e) { string path = FileUtils.SelectSingleExcelFile(); if (Utils.CheckFileExists(path)) { Dictionary <string, string> dic = SheetToDic(path); if (dic != null) { IList <FileReplaceNameModel> fileReplaceNameModels = new List <FileReplaceNameModel>(); foreach (string srcPath in dic.Keys) { FileReplaceNameModel model = new FileReplaceNameModel { FilePath = srcPath, NewFileName = dic[srcPath] }; fileReplaceNameModels.Add(model); } filePagerPage.AddObject(fileReplaceNameModels); } } }
public void AddFile(IList <string> files2) { IList <FileNameCustom> fileNameCustoms = new List <FileNameCustom>(); if (!Utils.CheckListExists(files2)) { return; } if (Utils.IsStrNull(Filter)) { for (int a = 0; a < files2.Count; a++) { FileNameCustom custom = new FileNameCustom(files2[a]); fileNameCustoms.Add(custom); } addFilePagerPage.AddObject(fileNameCustoms); return; } IList <string> files = new List <string>(); int count = files2.Count; string[] filters = FileterToEndWith(); for (int a = 0; a < count; a++) { string path = files2[a]; string ex = System.IO.Path.GetExtension(path); if (path != null && Array.IndexOf(filters, ex) != -1) { files.Add(path); } } for (int a = 0; a < files.Count; a++) { FileNameCustom custom = new FileNameCustom(files[a]); fileNameCustoms.Add(custom); } addFilePagerPage.AddObject(fileNameCustoms); }
/// <summary> /// 检查重复的身份证 /// </summary> /// <param name="hzs"></param> /// <returns></returns> public IList <string> ChecSFZ(IList <JTCY> hzs, ZJDDataSourceViewModel model) { IList <string> errors = new List <string>(); IList <JTCY> jtcys = JTCYCustom.GetAllJTCY(hzs); Dictionary <string, IList <JTCY> > sfzDic = Utils.GetGroupDicToList("GMSFHM", jtcys); foreach (string sfz in sfzDic.Keys) { IList <JTCY> sfzList = sfzDic[sfz]; if (sfzList.Count > 1) { foreach (JTCY jtcy in sfzList) { if (sfz == "") { errors.Add(sfz + ",证件号码为空"); } else { CheckZJDWriteError(jtcy.Row, model.JTCYTableErrorCellIndex, "证件号码重复"); } } } else { if (!Utils.CheckIDCard18(sfz)) { if (sfz == "") { CheckZJDWriteError(sfzList[0].Row, model.JTCYTableErrorCellIndex, "证件号码为空"); } else { CheckZJDWriteError(sfzList[0].Row, model.JTCYTableErrorCellIndex, "证件号码不符合规则"); } } } } return(errors); }
/// <summary> /// excel 转换为jtcy 对象 /// </summary> /// <param name="path">Excel路径</param> /// <returns></returns> public static ObservableCollection <JTCY> GetExcelToHZS(string path) { ObservableCollection <JTCY> list = ExcelUtils.GetExcelToObjectToObservableCollection <JTCY>(path, XMLPath); ObservableCollection <JTCY> hzs = GetJTCYSToHz(list); //户主放在第一位 for (int b = 0; b < hzs.Count; b++) { JTCY hz = hzs[b]; if (Utils.IsStrNull(hz.GMSFHM)) { hzs.RemoveAt(b); b--; continue; } IList <JTCY> jTCies = hz.JTCies; for (int a = 1; a < jTCies.Count; a++) { JTCY jTCY = jTCies[a]; if (jTCY.YHZGX == "户主") { jTCies.RemoveAt(a); jTCies.Insert(0, jTCY); break; } } for (int a = 2; a < jTCies.Count; a++) { JTCY jTCY = jTCies[a]; if (jTCY.YHZGX == "妻") { jTCies.RemoveAt(a); jTCies.Insert(1, jTCY); break; } } } return(hzs); }
internal static void SetHZs(IList <JSYD> jsyds, IList <JSYD> gyrs, IList <JTCY> hzs) { Dictionary <string, JTCY> hzZJHMDic = null; try { hzZJHMDic = MyUtils.Utils.GetGroupDic("GMSFHM", hzs); } catch (Exception e) { MessageBox.Show("家庭成员表:证件号码:" + e.Message); return; } Dictionary <string, IList <JSYD> > gyrDic = Utils.GetGroupDicToList("ZDNUM", gyrs); JTCY hz; IList <JSYD> gyrTem; foreach (JSYD jsyd in jsyds) { string zjhm = jsyd.ZJHM; if (!Utils.IsStrNull(zjhm) && hzZJHMDic.TryGetValue(zjhm, out hz)) { jsyd.HZs.Add(hz); } // string zdnum = jsyd.ZDNUM; if (gyrDic.TryGetValue(zdnum, out gyrTem)) { foreach (JSYD gyr in gyrTem) { zjhm = gyr.ZJHM; if (!Utils.IsStrNull(zjhm) && hzZJHMDic.TryGetValue(zjhm, out hz)) { jsyd.HZs.Add(hz); } } } } }
/// <summary> /// 所有家庭成员 设置到户主中 去 /// </summary> /// <param name="jtcys"></param> /// <returns></returns> private static ObservableCollection <JTCY> GetJTCYSToHz(ObservableCollection <JTCY> jtcys) { if (jtcys == null) { return(null); } string tem = ""; int index = 1; foreach (JTCY jtcy in jtcys) { if (!Utils.IsStrNull(jtcy.CBFBM)) { tem = (index++) + ""; jtcy.CBFBM = tem; } else { jtcy.CBFBM = tem; } } Dictionary <string, ObservableCollection <JTCY> > jtcyGroupDic = Utils.GetGroupDicToList("CBFBM", jtcys); ObservableCollection <JTCY> hzs = new ObservableCollection <JTCY>(); foreach (string cbfbm in jtcyGroupDic.Keys) { IList <JTCY> oneJTCY = jtcyGroupDic[cbfbm]; JTCY hz = FindOneJtcyHZ(oneJTCY); if (hz != null) { hz.JTCies = oneJTCY; hzs.Add(hz); } } return(hzs); }
/// <summary> /// 内容,1为开始,2为包含,3结束,4相等,不填为相等 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void SelectRepalceFile_Click(object sender, RoutedEventArgs e) { IList <string> paths = FileUtils.SelectExcelFiles(); if (Utils.CheckListExists(paths)) { IList <ReplaceViewModel> list = new List <ReplaceViewModel>(); foreach (string path in paths) { if (Utils.CheckFileExists(path)) { ISheet sheet = ExcelRead.ReadExcelSheet(path, 0); foreach (IRow row in sheet) { var replaceModel = new ReplaceViewModel(); for (int a = 0; a < 3; a++) { ICell cell = row.GetCell(a); if (cell == null || cell.CellType == CellType.Blank) { if (a == 3) { cell = row.CreateCell(a); cell.SetCellValue(4); } break; } cell.SetCellType(CellType.String); string value = cell.StringCellValue; switch (a) { case 0: replaceModel.OldText = value; break; case 1: replaceModel.NewText = value; break; case 2: int gx; if (int.TryParse(value, out gx)) { switch (gx) { case 0: replaceModel.StrRelation = MyUtils.StrRelation.StartsWith; break; case 1: replaceModel.StrRelation = MyUtils.StrRelation.Contains; break; case 2: replaceModel.StrRelation = MyUtils.StrRelation.EndsWith; break; case 3: replaceModel.StrRelation = MyUtils.StrRelation.Equals; break; } } else { replaceModel.StrRelation = MyUtils.StrRelation.Equals; } break; } } list.Add(replaceModel); } } } replacePagerPage.AddObject(list); } }
/// <summary> /// 导出 农村土地家庭承包农户基本情况信息表(一) /// </summary> /// <param name="hzs"></param> public static bool ExportBsicInformationExcel(IList <JTCY> hzs, string saveDir) { Dictionary <string, string> dklbDic = new Dictionary <string, string>(); dklbDic.Add("10", "承包地"); dklbDic.Add("21", "自留地"); dklbDic.Add("22", "机动地"); dklbDic.Add("23", "开荒地"); dklbDic.Add("99", "其他集体土地"); if (Utils.IsStrNull(saveDir)) { return(false); } string basicInformationExxcelTemplete = System.AppDomain.CurrentDomain.BaseDirectory + "CBDTemplete\\农村土地家庭承包农户基本情况信息表(一)模板.xls"; Dictionary <int, XMLTable> ClazzDic = XMLRead.GetXmlToXMLTabl(System.AppDomain.CurrentDomain.BaseDirectory + "CBDTemplete\\WriteJTCYBaicInformationExcel.xml"); Dictionary <string, XMLObject> xmlObjectDic = XMLRead.XmlToObjects(System.AppDomain.CurrentDomain.BaseDirectory + "CBDTemplete\\WriteJTCYBaicInformationExcel.xml"); string basicInformationExxcelTemplete2 = System.AppDomain.CurrentDomain.BaseDirectory + "CBDTemplete\\农村土地承包经营权(家庭承包)台帐(二)模板.xls"; Dictionary <int, XMLTable> ClazzDic2 = XMLRead.GetXmlToXMLTabl(System.AppDomain.CurrentDomain.BaseDirectory + "CBDTemplete\\WriteDKBaicInformationExcel.xml"); Dictionary <string, XMLObject> xmlObjectDic2 = XMLRead.XmlToObjects(System.AppDomain.CurrentDomain.BaseDirectory + "CBDTemplete\\WriteDKBaicInformationExcel.xml"); string cbfbm; if (Utils.CheckListExists(hzs)) { DMToText(hzs); foreach (JTCY hz in hzs) { string cbfdz = hz.DZ; if (!cbfdz.EndsWith("组")) { cbfdz = cbfdz.Substring(0, cbfdz.LastIndexOf("组")) + "组"; } int index = cbfdz.IndexOf("镇"); if (index == -1) { index = cbfdz.IndexOf("乡"); } hz.DZ = cbfdz.Substring(index + 1, cbfdz.Length - index - 1); XMLTable xmlTable = ClazzDic[0]; IWorkbook workbook = ExcelRead.ReadExcel(basicInformationExxcelTemplete); ISheet sheet = workbook.GetSheetAt(0); //家庭成员表行数据插入 ExcelWrite.WriteObjects(sheet, xmlTable, hz.jTCies); //家庭成员表 文字替换 ExcelWrite.ReplaceTextByXMLObject(sheet, hz, xmlObjectDic); ExcelWrite.Save(workbook, saveDir + "//TZ-" + hz.CBFBM.Substring(0, 14) + " " + cbfdz + "\\TZ4 -" + hz.CBFBM + "-1农村土地家庭承包农户基本情况信息表(一).xls"); //写地块表 Dictionary <string, string> tdlylxDic = ExcelRead.ReadExcelToDic(System.AppDomain.CurrentDomain.BaseDirectory + "CBDTemplete\\土地利用类型映射表.xlsx", 0); IList <DK> dks = hz.DKs; if (dks == null) { continue; } foreach (DK dk in dks) { if (dk.DKLB == "21") { dk.ZLDMJ = Math.Round(dk.HTMJ, 2).ToString("f2"); } else { dk.ELCBMJ = Math.Round(dk.HTMJ, 2).ToString("f2"); } string dklb = dk.DKLB; if (dklb != null) { if (dklbDic.TryGetValue(dklb, out dklb)) { //地块类别无法识别的情况 dk.DKLB = dklb; } } string tdlylx = dk.TDLYLX; if (tdlylx != null) { if (tdlylxDic.TryGetValue(tdlylx, out tdlylx)) { dk.TDLYLX = tdlylx; } } } IWorkbook workbook2 = ExcelRead.ReadExcel(basicInformationExxcelTemplete2); ISheet sheet2 = workbook2.GetSheetAt(0); ExcelWrite.ReplaceTextByXMLObject(sheet2, hz, xmlObjectDic); ExcelWrite.WriteObjects(sheet2, ClazzDic2[0], hz.DKs); for (int a = 0; a < dks.Count; a++) { IRow row = sheet.GetRow(a + 5); } ExcelWrite.Save(workbook2, saveDir + "//TZ-" + hz.CBFBM.Substring(0, 14) + " " + cbfdz + "\\TZ4 -" + hz.CBFBM + "-2农村土地承包经营权(家庭承包)台帐(二).xls"); } return(true); } return(false); }
public void ExportZJD(IList <JSYD> jsyds, ZJDExportDataViewModel model) { foreach (JSYD jsyd in jsyds) { if (Utils.CheckListExists(jsyd.HZs) && Utils.CheckListExists(jsyd.NFs) && Utils.CheckListExists(jsyd.Floors)) { ExportZJD(jsyd, model); } } }
public void ExportZJD_QJDCB(JSYD jsyd, string saveDir) { string docTempletePath = JSYDCustom.QJDCBDocPath; XWPFDocument doc = WordRead.Read(docTempletePath); //写入界址签章表 IList <QZB> qzbs = jsyd.QZBs; WordWrite.SetTableRowObj(doc, qzbs, JZXInfoCustom.qzbReflect); //写入标示表 IList <JZXInfo> jzxinfos = jsyd.JZXInfos; JZXInfoCustom.CreateBSB(doc, jzxinfos); Dictionary <string, XMLObject> jsydXML = XMLRead.XmlToObjects(JSYDCustom.JSYDXMLPath); WordWrite.ReplaceText(doc, jsydXML, jsyd); Dictionary <string, XMLObject> xzdmXML = XMLRead.XmlToObjects(JSYDCustom.ZJDXZDMMLPath); WordWrite.ReplaceText(doc, xzdmXML, jsyd.ZJDXZDM); Dictionary <string, XMLObject> jtcyXML = XMLRead.XmlToObjects(JSYDCustom.JTCYXMLPath); WordWrite.ReplaceText(doc, jtcyXML, jsyd.HZs[0]); Dictionary <string, XMLObject> nfXML = XMLRead.XmlToObjects(JSYDCustom.NFXMLPath); WordWrite.ReplaceText(doc, nfXML, jsyd.NFs[0]); Dictionary <string, string> replaceDic = new Dictionary <string, string>(); replaceDic.Add("Company", "四川旭普信息产业发展有限公司"); string zdnum = jsyd.ZDNUM; replaceDic.Add("Qjbh", zdnum.Substring(6, 3) + "-" + zdnum.Substring(9, 3) + "-" + zdnum.Substring(12, 2) + "-" + zdnum.Substring(14, 5)); //本宗地已取得原土地使用证: 简镇清集用(1990)字第0304 - 37号; 原房屋所有权证: 简农房权字第1002010383号; StringBuilder sb = new StringBuilder(); string str = jsyd.YTDSYZSH; if (!Utils.IsStrNull(str)) { sb.Append("原土地使用证:" + str + ";"); } str = jsyd.NFs[0].SYQZH; if (!Utils.IsStrNull(str)) { sb.Append("原房屋所有权证:" + str + ";"); } if (sb.Length > 0) { sb.Insert(0, "本宗地已取得"); } replaceDic.Add("Tag0", sb.ToString()); WordWrite.ReplaceText(doc, replaceDic); string saveName = GetZJDSaveFileName(jsyd, saveDir, docTempletePath); WordWrite.SaveToFile(doc, saveName); }
/// <summary> /// 检查农房表 /// </summary> /// <param name="jsyd"></param> /// <param name="nfs"></param> private string CheckNF(IList <NF> nfs, int cellIndex) { StringBuilder sb = new StringBuilder(); NF nf = nfs[0]; double tem = 0; //检查层数 int csInt; foreach (NF nf1 in nfs) { tem += nf1.CJZMJ; if (nf1.SZC == null) { continue; } string[] csArray = nf1.SZC.Split('、'); foreach (string csStr in csArray) { if (int.TryParse(csStr, out csInt)) { if (nf.ZCS < csInt) { sb.Append("、所在层中有 大于 总层 的数字"); CheckZJDWriteError(nf1.Row, cellIndex, "、所在层中有 大于 总层 的数字"); } } else { sb.Append("、所在层中填写有不是数字"); CheckZJDWriteError(nf1.Row, cellIndex, "、所在层中填写有不是数字"); } } if (nf1.CZTJG + "结构" != nf1.JG) { sb.Append("、层主体结构 与 结构一致"); CheckZJDWriteError(nf1.Row, cellIndex, "、层主体结构一致"); } } if (Math.Abs(nf.JZMJ - tem) > 0.001) { sb.Append("、层建筑面积 与 建筑面积不相等"); CheckZJDWriteError(nf.Row, cellIndex, "、层建筑面积 与 建筑面积不相等字"); } if (nf.JZMJ < nf.FZMJ) { sb.Append("、层建筑面积 小于 建筑面积"); CheckZJDWriteError(nf.Row, cellIndex, "、层建筑面积 小于 建筑面积"); } for (int a = 1; a < nfs.Count; a++) { NF temNF = nfs[a]; if (nf.SYQZH != temNF.SYQZH) { sb.Append("、所有权号不一致"); CheckZJDWriteError(temNF.Row, cellIndex, "、所有权号不一致"); } if (nf.QLRMC != temNF.QLRMC) { sb.Append("、权利人名称不一致"); CheckZJDWriteError(temNF.Row, cellIndex, "、权利人名称不一致"); } if (nf.ZJHM != temNF.ZJHM) { sb.Append("、证件号码不一致"); CheckZJDWriteError(temNF.Row, cellIndex, "、证件号码不一致"); } if (nf.ZCS != temNF.ZCS) { sb.Append("、总层数不一致"); CheckZJDWriteError(temNF.Row, cellIndex, "、总层数不一致"); } if (nf.JZMJ != temNF.JZMJ) { sb.Append("、建筑面积不一致"); CheckZJDWriteError(temNF.Row, cellIndex, "、建筑面积不一致"); } if (nf.ZCS != temNF.CS) { sb.Append("、总层数 与 层数不一致"); CheckZJDWriteError(temNF.Row, cellIndex, "、总层数 与 层数不一致"); } if (nf.FWLY != temNF.FWLY) { sb.Append("、房屋来源 不一致"); CheckZJDWriteError(temNF.Row, cellIndex, "、房屋来源 不一致"); } if (nf.YJTTDSYZ != temNF.YJTTDSYZ) { sb.Append("、土地权属来源(是否有原件)不一致"); CheckZJDWriteError(temNF.Row, cellIndex, "、房屋来源 不一致"); } if (nf.YFWSYQZ != temNF.YFWSYQZ) { sb.Append("、房屋权属来源(是否有原件)不一致"); CheckZJDWriteError(temNF.Row, cellIndex, "、房屋权属来源(是否有原件)不一致"); } if (nf.JGRQ != temNF.JGRQ) { sb.Append("、竣工日期不一致"); CheckZJDWriteError(temNF.Row, cellIndex, "、竣工日期不一致"); } if (nf.ZL != temNF.ZL) { sb.Append("、坐落不一致"); CheckZJDWriteError(temNF.Row, cellIndex, "、坐落不一致"); } if (nf.ZL != temNF.ZL) { sb.Append("、产权来源不一致"); CheckZJDWriteError(temNF.Row, cellIndex, "、产权来源不一致"); } if (nf.ZL != temNF.ZL) { sb.Append("、产权来源不一致"); CheckZJDWriteError(temNF.Row, cellIndex, "、产权来源不一致"); } } //(nf.YJTTDSYZ == "已提交原件" || nf.YFWSYQZ == "已提交原件") || ( if (nf.YJTTDSYZ == "未确权颁证" && nf.YFWSYQZ == "未确权颁证") { if (nf.FWLY != "其他情形") { sb.Append("、房屋来源不是其他情形"); CheckZJDWriteError(nf.Row, cellIndex, "、产权来源不一致"); } if (nf.CQLY != "自建") { sb.Append("、产权来源不是自建"); CheckZJDWriteError(nf.Row, cellIndex, "、产权来源不是自建"); } } else { if (!(nf.FWLY == "改建扩建" || nf.FWLY == "其他情形")) { sb.Append("、房屋来源不是改建扩建"); CheckZJDWriteError(nf.Row, cellIndex, "、房屋来源不是改建扩建、其他情形"); } if (!(nf.CQLY == "翻建" || nf.CQLY == "自建")) { sb.Append("、产权来源不是翻建"); CheckZJDWriteError(nf.Row, cellIndex, "、产权来源不是翻建、自建"); } } if (Utils.IsStrNull(nf.SYQZH)) { if (nf.YFWSYQZ != "未确权颁证") { sb.Append("、无证号,但填写的是 确权颁证"); CheckZJDWriteError(nf.Row, cellIndex, "、无证号,但填写的是 确权颁证"); } } else { if (nf.YFWSYQZ == "未确权颁证") { sb.Append("、有证号,但填写的是 未确权颁证"); CheckZJDWriteError(nf.Row, cellIndex, "、有证号,但填写的是 未确权颁证"); } } if (sb.Length > 0) { sb.Insert(0, "农房表自查:"); return(sb.ToString()); } return(""); }
public IList <string> CheckZJD(JSYD jsyd, ZJDDataSourceViewModel model) { IList <string> erros = new List <string>(); ZJDXZDM xzdm = jsyd.ZJDXZDM; Zdinfo zdinfo = jsyd.Zdinfo; string error; if (zdinfo == null) { CheckZJDWriteError(jsyd.Row, model.JSYDTableErrorCellIndex, "未找到宗地表"); erros.Add("未找到宗地表"); } else { error = CheckJSYD_Zdinfo(jsyd, zdinfo, model.JSYDTableErrorCellIndex); if (error != "") { erros.Add(error); } } IList <NF> nfs = jsyd.NFs; if (nfs == null) { CheckZJDWriteError(jsyd.Row, model.JSYDTableErrorCellIndex, "未找到农房表"); erros.Add("未找到农房表"); } else { error = CheckNF(nfs, model.NFTableErrorCellIndex); if (error != "") { erros.Add(error); } IList <Floor> floors = jsyd.Floors; if (floors == null) { CheckZJDWriteError(jsyd.Row, model.JSYDTableErrorCellIndex, "未找到分层表"); erros.Add("未找到分层表"); } else { if (Utils.IsStrNull(jsyd.YTDSYZSH) && nfs[0].YJTTDSYZ != "未确权颁证") { erros.Add("无土地证 农房表 填写的不是 未确权颁证"); } error = CheckFloor(floors, model.FloorTableErrorCellIndex); if (error != "") { erros.Add(error); } error = CheckNF_Floor(nfs, floors, model.FloorTableErrorCellIndex); if (error != "") { erros.Add(error); } } } IList <JTCY> hzs = jsyd.HZs; CheckHZs(hzs, model.JTCYTableErrorCellIndex); IList <QZB> qzbs = jsyd.QZBs; IList <JZXInfo> jzxInfos = jsyd.JZXInfos; return(erros); }