/// <summary> /// 从房产库查询数据构建BDC插入实例 /// </summary> /// <param name="slbh"></param> /// <returns></returns> private static List <DOC_BINFILE> GetDoc_Binfile(string slbh, string fcslbh) { List <VolEleArcDtl> veads = ImportDAL.GetVolEleArcDtl(fcslbh); List <DOC_BINFILE> list = new List <DOC_BINFILE>(); //if(null!=Res_list && Res_list.Count>0) //{ // foreach (Result res in Res_list) // { Thread.Sleep(200); foreach (VolEleArcDtl v in veads) { v.imgName = v.imgName.Replace(@"\\192.168.134.245\", "").Replace(@"\\192.168.100.202\", "").Replace(@"K:\", "").Replace(@"\\192.168.100.202 \", ""); v.imgName = v.imgName.Replace("\\", "/"); VolEleArc vea = GetVolEleArc(v.VolEleArc_ID); DOC_BINFILE doc_binfile = new DOC_BINFILE(); doc_binfile.BINID = GetCID(slbh, vea.EleArcName); if (doc_binfile.BINID != "") { doc_binfile.FTPATH = v.imgName; doc_binfile.FILEID = Guid.NewGuid().ToString(); doc_binfile.FILENAME = vea.EleArcName; doc_binfile.EXTNAME = GetExtName(v.imgName); doc_binfile.ISCOMPRESSED = "否"; doc_binfile.ISENCRYPTED = "否"; list.Add(doc_binfile); } } // } //} return(list); }
private static void QSPicUploadToFtp(string slbh, string base64Str, DOC_BINFILE doc_binfile) { FTPHelper ftpHelper = new FTPHelper(); FTP souFTp = new FTP() { hostname = ConfigurationManager.AppSettings["FCFtpIP"], username = ConfigurationManager.AppSettings["FCFtpUser"], password = ConfigurationManager.AppSettings["FCFtpPWD"], port = ConfigurationManager.AppSettings["FCFtpPort"], }; FTP tagFTP = new FTP() { hostname = ConfigurationManager.AppSettings["FtpAddr"], username = ConfigurationManager.AppSettings["FtpUser"], password = ConfigurationManager.AppSettings["FtpPwd"], port = ConfigurationManager.AppSettings["FtpPort"] }; string tmpPath = ConfigurationManager.AppSettings["TmpPath"]; string yearDir = slbh.Substring(0, 4); string monthDir = slbh.Substring(4, 2); string dayDir = slbh.Substring(6, 2); string sortDir = slbh.Substring(8); string path = ftpDir + "/" + yearDir + "/" + monthDir + "/" + dayDir + "/" + sortDir; if (!ftpHelper.DirectoryExist(ftpDir + "/" + yearDir, tagFTP)) { ftpHelper.MakeDir(ftpDir + "/" + yearDir, tagFTP); } if (!ftpHelper.DirectoryExist(ftpDir + "/" + yearDir + "/" + monthDir, tagFTP)) { ftpHelper.MakeDir(ftpDir + "/" + yearDir + "/" + monthDir, tagFTP); } if (!ftpHelper.DirectoryExist(ftpDir + "/" + yearDir + "/" + monthDir + "/" + dayDir, tagFTP)) { ftpHelper.MakeDir(ftpDir + "/" + yearDir + "/" + monthDir + "/" + dayDir, tagFTP); } if (!ftpHelper.DirectoryExist(ftpDir + "/" + yearDir + "/" + monthDir + "/" + dayDir + "/" + sortDir, tagFTP)) { try { ftpHelper.MakeDir(ftpDir + "/" + yearDir + "/" + monthDir + "/" + dayDir + "/" + sortDir, tagFTP); } catch { } } //if(!FTPHelper.DirectoryExist(path,tagFTP)) //{ // FTPHelper.MakeDir(path, tagFTP); //} string source = tmpPath + "\\" + GetFileName(doc_binfile.FTPATH); CreateImgByBase64(base64Str, source); FileInfo fi = new FileInfo(source); doc_binfile.FTPATH = ftpHelper.UploadFtp("", source, path, tagFTP); fi.Delete(); }
internal static void UpDateDoc_binfile(DOC_BINFILE doc_bin) { string sql = " update doc_binfile set fileid=:fileid, filename=:filename, extname=:extname, filesize=:filesize, isencrypted=:isencrypted, iscompressed=:iscompressed, ftpath=:ftpath where binid=:binid"; List <DbParameter> list = new List <DbParameter>(); ListAdd(list, ":fileid", doc_bin.FILEID); ListAdd(list, ":filename", doc_bin.FILENAME); ListAdd(list, ":extname", doc_bin.EXTNAME); ListAdd(list, ":filesize", doc_bin.FILESIZE); ListAdd(list, ":isencrypted", doc_bin.ISENCRYPTED); ListAdd(list, ":iscompressed", doc_bin.ISCOMPRESSED); ListAdd(list, ":ftpath", doc_bin.FTPATH); ListAdd(list, ":binid", doc_bin.BINID); lock (lockKey) { DbHelper dbHelper = new DbHelper(); dbHelper.Conn = new Oracle.DataAccess.Client.OracleConnection(WDK); dbHelper.SetProvider(MyDBType.Oracle); dbHelper.ExecuteNonQuery(dbHelper.Conn, System.Data.CommandType.Text, sql, list.ToArray()); dbHelper.Conn.Close(); } }
private static void ImportQS(string base64Str, string sLBH, string userName) { string path = sLBH + "_完税凭证.jpg"; string cid = GetCID(sLBH, "完税凭证", "文件夹", userName); DOC_BINFILE doc_binfile = new DOC_BINFILE(); string binid = GetCID(sLBH, "完税凭证", "文件", userName, cid);//att.CID; doc_binfile.BINID = binid; doc_binfile.FTPATH = path; doc_binfile.FILEID = Guid.NewGuid().ToString(); doc_binfile.FILENAME = "完税凭证"; doc_binfile.EXTNAME = "jpg";//GetExtName(v.imgName); doc_binfile.ISCOMPRESSED = "否"; doc_binfile.ISENCRYPTED = "否"; QSPicUploadToFtp(sLBH, base64Str, doc_binfile); if (ImportDAL.ExistDoc_binfile(doc_binfile)) { ImportDAL.UpDateDoc_binfile(doc_binfile); } else { ImportDAL.InsertDoc_binfile(doc_binfile); } }
public static void UploadToFtp(string slbh, DOC_BINFILE item) { FTP souFTp = new FTP() { hostname = ConfigurationManager.AppSettings["FCFtpIP"], username = ConfigurationManager.AppSettings["FCFtpUser"], password = ConfigurationManager.AppSettings["FCFtpPWD"] }; FTP tagFTP = new FTP() { hostname = ConfigurationManager.AppSettings["FtpAddr"], username = ConfigurationManager.AppSettings["FtpUser"], password = ConfigurationManager.AppSettings["FtpPwd"] }; string tmpPath = ConfigurationManager.AppSettings["TmpPath"]; string yearDir = slbh.Substring(0, 4); string monthDir = slbh.Substring(4, 2); string dayDir = slbh.Substring(6, 2); string sortDir = slbh.Substring(8); string path = yearDir + "/" + monthDir + "/" + dayDir + "/" + sortDir; if (!FTPHelper.DirectoryExist(yearDir, tagFTP)) { FTPHelper.MakeDir(yearDir, tagFTP); } if (!FTPHelper.DirectoryExist(yearDir + "/" + monthDir, tagFTP)) { FTPHelper.MakeDir(yearDir + "/" + monthDir, tagFTP); } if (!FTPHelper.DirectoryExist(yearDir + "/" + monthDir + "/" + dayDir, tagFTP)) { FTPHelper.MakeDir(yearDir + "/" + monthDir + "/" + dayDir, tagFTP); } if (!FTPHelper.DirectoryExist(yearDir + "/" + monthDir + "/" + dayDir + "/" + sortDir, tagFTP)) { FTPHelper.MakeDir(yearDir + "/" + monthDir + "/" + dayDir + "/" + sortDir, tagFTP); } //if(!FTPHelper.DirectoryExist(path,tagFTP)) //{ // FTPHelper.MakeDir(path, tagFTP); //} string source = FTPHelper.DownloadFtp(tmpPath + "\\" + GetFileName(item.FTPATH), "", item.FTPATH, souFTp); FileInfo fi = new FileInfo(source); FTPHelper.UploadFtp("", source, path, tagFTP); fi.Delete(); }
internal static bool ExistDoc_binfile(DOC_BINFILE item) { string sql = "select count(1) from doc_binfile where binid='{0}'"; sql = string.Format(sql, item.BINID); DbHelper.Conn = new OracleConnection(WDK); DbHelper.SetProvider(MyDBType.Oracle); int count = Convert.ToInt32(DbHelper.ExecuteScalar(DbHelper.Conn, System.Data.CommandType.Text, sql, null)); if (count > 0) { return(true); } return(false); }
private static List <DOC_BINFILE> GetDoc_binfile_list(PageParams pageParams) { DataTable cid_dt = BDCDA_DAL.GetCID(pageParams); List <DOC_BINFILE> list = new List <DOC_BINFILE>(); if (null != cid_dt && cid_dt.Rows.Count > 0) { foreach (DataRow row in cid_dt.Rows) { DOC_BINFILE doc = BDCDA_DAL.GetDoc_binfile(row[0].ToString()); if (null != doc) { list.Add(doc); } } } return(list); }
/// <summary> /// 从房产库查询数据构建BDC插入实例 /// </summary> /// <param name="slbh"></param> /// <returns></returns> private static List <DOC_BINFILE> GetDoc_Binfile(string slbh) { //string[] args = new string[1]; //args[0] = "China"; //object result= WebServiceHelper.InvokeWebService(WebSrvUrl, WebSrvMethon, args); //List<Result> Res_list = (List<Result>)result; List <VolEleArcDtl> veads = ImportDAL.GetVolEleArcDtl(slbh); List <DOC_BINFILE> list = new List <DOC_BINFILE>(); //if(null!=Res_list && Res_list.Count>0) //{ // foreach (Result res in Res_list) // { foreach (VolEleArcDtl v in veads) { v.imgName = v.imgName.Replace(@"\\192.168.100.202 \", "").Replace(@"K:\", ""); VolEleArc vea = GetVolEleArc(v.VolEleArc_ID); DOC_BINFILE doc_binfile = new DOC_BINFILE(); doc_binfile.BINID = GetCID(slbh, vea.EleArcName); if (doc_binfile.BINID != "") { doc_binfile.FTPATH = v.imgName; doc_binfile.FILEID = Guid.NewGuid().ToString(); doc_binfile.FILENAME = vea.EleArcName; doc_binfile.EXTNAME = "JPG"; doc_binfile.ISCOMPRESSED = "否"; doc_binfile.ISENCRYPTED = "否"; list.Add(doc_binfile); } } // } //} return(list); }
private static List <VolEleArcDtl> GetVolEleArcDtl(List <VolEleArc> volEleArc, PageParams pageParams) { List <VolEleArcDtl> list = new List <VolEleArcDtl>(); List <DOC_BINFILE> doc_bin_list = GetDoc_binfile_list(pageParams); for (int i = 0; i < doc_bin_list.Count; i++) { DOC_BINFILE doc = doc_bin_list[i]; VolEleArcDtl volEleArcDtl = new VolEleArcDtl(); volEleArcDtl.VolEleArc_ID = volEleArc[i].EleArcVol_ID; volEleArcDtl.VolEleArcDtl_id = CreateGuid(32); volEleArcDtl.imgName = doc.FTPATH; try { volEleArcDtl.PageNo = null == doc.PAGECOUNT ? 0 : Convert.ToInt32(doc.PAGECOUNT); } catch { } volEleArcDtl.ScanDate = DateTime.Now.ToString("YYYYMMdd"); list.Add(volEleArcDtl); } return(list); }
private static void ImportFCDA(string slbh, string FCslbh, string user, ref int count) { List <Result> list = new List <Result>(); List <VolEleArc> vol_list = ImportDAL.GetVolEleArc_list(FCslbh); string errStr = ""; foreach (VolEleArc vol in vol_list) { Result res = new Result(); string cid = GetCID(slbh, vol.EleArcName, "文件夹", user); List <VolEleArcDtl> dtlList = ImportDAL.GetVolEleArcDtlByVol(vol.EleArcVol_ID); if (null != dtlList && dtlList.Count > 0) { count = dtlList.Count; for (int i = 0; i < dtlList.Count; i++) { try { VolEleArcDtl v = dtlList[i]; v.imgName = v.imgName.Replace(@"\\192.168.134.245\", "").Replace(@"\\192.168.100.202\", "").Replace(@"K:\", "").Replace(@"\\192.168.100.202 \", ""); v.imgName = v.imgName.Replace("\\", "/"); DOC_BINFILE doc_binfile = new DOC_BINFILE(); string EleArcName = ""; if (i == 0) { EleArcName = vol.EleArcName; } if (i > 0) { EleArcName = vol.EleArcName + "-" + i; } string binid = GetCID(slbh, EleArcName, "文件", user, cid);//att.CID; doc_binfile.BINID = binid; doc_binfile.FTPATH = v.imgName; doc_binfile.FILEID = Guid.NewGuid().ToString(); doc_binfile.FILENAME = vol.EleArcName; doc_binfile.EXTNAME = GetExtName(v.imgName); doc_binfile.ISCOMPRESSED = "否"; doc_binfile.ISENCRYPTED = "否"; UploadToFtp(FCslbh, doc_binfile); if (ImportDAL.ExistDoc_binfile(doc_binfile)) { ImportDAL.UpDateDoc_binfile(doc_binfile); } else { ImportDAL.InsertDoc_binfile(doc_binfile); } } catch (Exception ex) { if (!errStr.Contains(ex.Message)) { errStr += ex.Message; } continue; } } } } if (!string.IsNullOrEmpty(errStr)) { throw new Exception(errStr); } }