public IList <JSYD> GetJSYDByZJDDataSourceViewModel(ZJDDataSourceViewModel model) { ObservableCollection <ZJDXZDM> zjdXZDM = ZJDXZDMCustom.GetExcelToZJDXZDM(model.ZJDXZDMTablePath); ObservableCollection <JTCY> hzs = JTCYCustom.GetExcelToHZS(model.JTCYTablePath); //户主必须要先检查 zjdDao.ChecSFZ(hzs, model); ObservableCollection <JSYD> jsyds = JSYDCustom.GetExcelToJSYDS(model.JSYDTablePath); IWorkbook workbook = ExcelRead.ReadExcel(model.NFTablePath); ObservableCollection <NF> nfs = NFCustom.GetExcelToNFS(workbook.GetSheetAt(0)); ObservableCollection <Floor> floors = FloorCustom.GetExcelToFloors(workbook.GetSheetAt(1)); ObservableCollection <Zdinfo> zdinfos = ZdinfoCustom.GetMDBToZdinfos(model.ZdinfoMDBPath); Dictionary <string, JSYD> jsydDic = MyUtils.Utils.GetGroupDic("ZDNUM", jsyds); JSYDCustom.SetZdinfo(jsydDic, zdinfos); ObservableCollection <JSYD> gyrs = JSYDCustom.GetExcelToGYRS(model.JSYDTablePath); JSYDCustom.SetHZs(jsyds, gyrs, hzs); JSYDCustom.SetNF(jsydDic, nfs); JSYDCustom.SetFloor(jsydDic, floors); JSYDCustom.SetZJDXZDM(jsydDic, zjdXZDM); ObservableCollection <QZB> qzbs = QZBCustom.GetMDBToQZB(model.QZ_BSMDBPath); JSYDCustom.SetQZBs(jsyds, qzbs); ObservableCollection <JZXInfo> jzxs = JZXInfoCustom.GetMDBToJZX(model.QZ_BSMDBPath); JSYDCustom.SetJZXs(jsyds, jzxs); return(jsyds); }
/// <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); }
private void TableChange_Click(object sender, RoutedEventArgs e) { IList <FileNameCustom> files = addFileViewModel.Files; if (files.Count > 0) { string shpmjPath = FileUtils.SelectSingleExcelFile("选择shp面积表格"); if (shpmjPath == null || shpmjPath == "") { return; } string saveDir = FileManager.FileUtils.SeleFileDir("选择保存的文件夹"); if (saveDir == null || saveDir == "") { return; } WaitFormCustom.ShowCustom(); Dictionary <string, string> dkbmMJDic = ExcelManager.ExcelRead.ReadExcelToDic(shpmjPath, 0); foreach (FileNameCustom fileNameCustom in files) { bool flag = true; IList <JTCY> jTCies = JTCYCustom.ReadJTCYExcel(fileNameCustom.FilePath); IList <JTCY> hzs = JTCYCustom.ExtractHZs(jTCies); if (hzs == null) { return; } IList <DK> dks = DKCustom.ReadDKExcel(fileNameCustom.FilePath); string area; string dkbm; JTCYCustom.SetJTCY_DK(hzs, dks); foreach (JTCY hz in hzs) { hz.CBFBM = System.IO.Path.GetFileNameWithoutExtension(fileNameCustom.FilePath) + hz.CBFBM; } string zh = "512081" + System.IO.Path.GetFileNameWithoutExtension(fileNameCustom.FilePath).Substring(6, 8); foreach (DK dk in dks) { dkbm = dk.DKBM; if (MyUtils.Utils.IsStrNull(dkbm)) { MessageBox.Show("文件:" + fileNameCustom.FilePath + ",地块编码有为空"); flag = false; break; } if (dkbmMJDic.TryGetValue(zh + dkbm, out area)) { double areaMJ; if (double.TryParse(area, out areaMJ)) { dk.SCMJ = areaMJ.ToString("f2"); } } else { { MessageBox.Show("地块编码:" + zh + dkbm + ",在shp面积中没有找到"); flag = false; break; } } } if (hzs != null && flag) { //导出数据 fileNameCustom.IsSuccess = JTCYCustom.ExportBsicInformationExcel(hzs, saveDir); } } WaitFormCustom.CloseWaitForm(); } else { MessageBox.Show("你还没有添加任何文件!!!"); } }
public void ExportZJD_SPB(JSYD jsyd, string saveDir) { string docTempletePath = JSYDCustom.SPBDocPath; XWPFDocument doc = WordRead.Read(docTempletePath); 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("JTCYCount", jsyd.HZs[0].JTCies.Count + ""); replaceDic.Add("JTCYs", JTCYCustom.ToStringJTCYs(jsyd.HZs[0])); WordWrite.ReplaceText(doc, replaceDic); //替换符号 Dictionary <String, IList <RunCustomer> > docDic = WordRead.GetDocxDic(doc); IList <RunCustomer> customers; //房屋来源 if (docDic.TryGetValue(jsyd.NFs[0].FWLY, out customers)) { WordWrite.ReplaceSmpbol(customers[0]); } //土地证位置是第一个 if (docDic.TryGetValue(jsyd.NFs[0].YJTTDSYZ, out customers)) { WordWrite.ReplaceSmpbol(customers[0]); } //房产证位置是第二个 if (docDic.TryGetValue(jsyd.NFs[0].YFWSYQZ, out customers)) { WordWrite.ReplaceSmpbol(customers[1]); } if (jsyd.GYFS == "共同共有") { if (docDic.TryGetValue("是", out customers)) { WordWrite.ReplaceSmpbol(customers[1]); } if (docDic.TryGetValue("共同共有", out customers)) { WordWrite.ReplaceSmpbol(customers[0]); } } else { if (docDic.TryGetValue("否", out customers)) { WordWrite.ReplaceSmpbol(customers[1]); } } string saveName = GetZJDSaveFileName(jsyd, saveDir, docTempletePath); WordWrite.SaveToFile(doc, saveName); }