/// <summary> /// 展示某个特巡报告,用于生成报表数据 /// </summary> /// <param name="data"></param> /// <returns></returns> public Stream ShowReport(string reportid) { #region 查找数据 ResShowReport response = new ResShowReport(); bool success = false; try { if (reportid != null && reportid != String.Empty) { string patrolno = PatrolEntity.getPatrolNobyReportId(reportid); if (patrolno != null && patrolno != String.Empty) { DataTable header = PatrolEntity.getPatrolHeader4Report(patrolno); DataTable detail = PatrolEntity.getPatrolDetail4Report(patrolno); //DataTable facadeList = PatrolEntity.getFacadeList4Report(patrolno); List <PatrolDetailInfo> detailList = ResShowReport.getPatrolDetailList(detail); response.patrol_header = ResShowReport.getPatrolHeader(header); response.facade_list = ResShowReport.getFacadeImageList(detailList); response.patrol_detail_list = detailList; //设置成功状态 success = true; } } } catch (Exception ex) { Console.WriteLine(ex.Message); #region 日志输出 CommonInfo.Error("显示特巡报告书数据错误" + ex.Message); #endregion } //返回消息体 if (success) { response.SetSuccess(); } else { ////默认是失败 //response.SetFailed(); } //将消息序列化为Json格式数据 DataContractJsonSerializer obj2Json = new DataContractJsonSerializer(typeof(ResShowReport)); MemoryStream ms = new MemoryStream(); obj2Json.WriteObject(ms, response); //注意一定要设置流的位置到开始位置,否则没有消息输出 ms.Position = 0; return(ms); #endregion }
/// <summary> /// 获取特巡报告书需要的打印数据 /// </summary> /// <param name="patrolno"></param> /// <returns></returns> public ResShowReport GetData(string patrolno) { ResShowReport response = null; if (patrolno != null && patrolno != String.Empty) { response = new ResShowReport(); DataTable header = PatrolEntity.getPatrolHeader4Report(patrolno); DataTable detail = PatrolEntity.getPatrolDetail4Report(patrolno); //DataTable facadeList = PatrolEntity.getFacadeList4Report(patrolno); List <PatrolDetailInfo> detailList = ResShowReport.getPatrolDetailList(detail); response.patrol_header = ResShowReport.getPatrolHeader(header); response.facade_list = ResShowReport.getFacadeImageList(detailList); response.patrol_detail_list = detailList; } return(response); }