/// <summary> /// 启动生成下载的数据文件处理 /// </summary> /// <param name="fileType"></param> /// <returns></returns> public bool createFile(string rndPrefix, string fileType) { try { SetControlTextStr(lblMsg, "createFile", "INFO"); TJClient.JKTJ.ClientDoService webService = new TJClient.JKTJ.ClientDoService(); webService.Url = System.Configuration.ConfigurationManager.AppSettings["GwtjUrl"]; //webService.Timeout = 900000; if (ConfigurationManager.AppSettings["WaitTimeSec"] != null && int.Parse(ConfigurationManager.AppSettings["WaitTimeSec"]) > 0) { webService.Timeout = int.Parse(ConfigurationManager.AppSettings["WaitTimeSec"]); } else { webService.Timeout = 900000; } SetControlTextStr(lblMsg, webService.Url, "INFO"); //获取下载文件的地址 string fileUrl = webService.downLoadInfoByParm(rndPrefix, DataDownLoad_TJ_Para.yljgbm, DataDownLoad_TJ_Para.czList, fileType); SetControlTextStr(lblMsg, fileUrl, "INFO"); //下载返回结果处理 string[] fileUrlList = fileUrl.Split(new char[] { '-' }); if (fileUrlList.Length > 0 && fileUrlList[0].Equals("1")) { //正常返回结果(文件的下载地址) fileUrl = fileUrlList[1]; fileDownloadUrl = fileUrlList[1]; } else { SetControlTextStr(lblMsg, "createFile:" + fileUrl, "Error"); return(false); } } catch (Exception ex) { SetControlTextStr(lblMsg, "createFile:" + ex.Message, "Error"); //throw new Exception(string.Format("获取文件地址错误!{0}", ex.Message)); return(false); } return(true); }
/// <summary> /// 生成下载的数据文件并获得下载的文件的下载地址 /// </summary> /// <param name="fileType"></param> /// <returns></returns> public bool getDownLoadFileList(string rndPrefix, string fileType) { try { SetControlTextStr(lblMsg, "getDownLoadFileList", "INFO"); TJClient.JKTJ.ClientDoService webService = new TJClient.JKTJ.ClientDoService(); webService.Url = System.Configuration.ConfigurationManager.AppSettings["GwtjUrl"]; //webService.Timeout = 900000; if (ConfigurationManager.AppSettings["WaitTimeSec"] != null && int.Parse(ConfigurationManager.AppSettings["WaitTimeSec"]) > 0) { webService.Timeout = int.Parse(ConfigurationManager.AppSettings["WaitTimeSec"]); } else { webService.Timeout = 900000; } SetControlTextStr(lblMsg, webService.Url, "INFO"); //获取下载文件的地址 string fileUrl = webService.downLoadInfoByParm_upload(rndPrefix, DataDownLoad_TJ_Para.yljgbm, DataDownLoad_TJ_Para.czList, fileType); SetControlTextStr(lblMsg, fileUrl, "INFO"); //下载返回结果处理 string[] fileUrlList = fileUrl.Split(new char[] { '-' }); if (fileUrlList.Length > 0 && fileUrlList[0].Equals("1")) { //处理文件的生成状态 if (fileUrlList.Length == 4) { if (fileUrlList[3].Equals("1")) { //文件全部生成完成,并获取到了下载地址 isFileDownloadAll = true; } else if (fileUrlList[3].Equals("2")) { //文件没有全部生成完成,获取到了部分文件的下载地址 isFileDownloadAll = false; } else { //停止获取文件 可能出现了异常 isFileDownloadAll = true; } } //正常返回结果(文件的下载地址) fileUrl = fileUrlList[1]; fileDownloadUrl = fileUrlList[1]; //基础数据 if (fileUrlList[2].Length > 0) { if (fileType.Equals("1")) { fileJcsjList = fileUrlList[2].Split(new char[] { '|' }); } else if (fileType.Equals("2"))//档案数据 { fileDaList = fileUrlList[2].Split(new char[] { '|' }); } else if (fileType.Equals("3"))//上次体检信息 { fileTjxxList = fileUrlList[2].Split(new char[] { '|' }); } } } else { //停止获取文件 isFileDownloadAll = true; } } catch (Exception ex) { //发生异常时,停止获取文件 isFileDownloadAll = true; SetControlTextStr(lblMsg, "createFile:" + ex.Message, "Error"); //throw new Exception(string.Format("获取文件地址错误!{0}", ex.Message)); return(false); } return(true); }