Пример #1
0
        public string GetReport(WaterMLog waterMLog)
        {
            var FBusinessObject = new List <WaterMLog>
            {
                waterMLog
            };
            var reportFilePath = Path.Combine(AppConsts.AppRootPath, "upload", "reportfiles", "WaterMLog.frx");//FileHelper.MapPath("\\ReportFiles\\WaterMLog.frx");
            var dataSetName    = "WaterMLog";
            var exportFormat   = "html";

            return(FastReportHelper.GetReportString(reportFilePath, dataSetName, FBusinessObject, exportFormat));
        }
Пример #2
0
        public async Task <IActionResult> CreateReportJson([FromBody] BaseInput input)
        {
            var waterMLog = new WaterMLog();

            waterMLog.HospialName = await _organizeApp.GetHospitalName();

            waterMLog.HospialLogo = await _organizeApp.GetHospitalLogo();

            var json      = input.KeyValue.ToJObject();
            var startDate = json.Value <DateTime>("startDate");
            var endDate   = json.Value <DateTime>("endDate").AddDays(1);
            var rows      = await _waterMLogApp.GetList(startDate, endDate);

            //操作者
            var operatePersonIds = rows.Select(t => t.F_OperatePerson).Distinct();
            //核对者
            var checkPersonIds = rows.Select(t => t.F_CheckPerson).Distinct();
            var unionIds       = operatePersonIds.Union(checkPersonIds).Distinct().ToList();
            var filterUsers    = _usersService.GetUserNameDict("")
                                 .Where(t => unionIds.Contains(t.F_Id))
                                 .Select(t =>
                                         new
            {
                Id       = t.F_Id,
                RealName = t.F_RealName
            }).ToList();

            waterMLog.StartDate = startDate.ToDateString();
            waterMLog.EndDate   = endDate.AddDays(-1).ToDateString();
            waterMLog.PrintDate = DateTime.Now.Date.ToDateString();
            foreach (var item in rows.OrderBy(t => t.F_LogDate))
            {
                item.F_OperatePerson = item.F_OperatePerson == null
                    ? ""
                    : filterUsers.FirstOrDefault(t => t.Id == item.F_OperatePerson)?.RealName;
                item.F_CheckPerson = item.F_CheckPerson == null
                    ? ""
                    : filterUsers.FirstOrDefault(t => t.Id == item.F_CheckPerson)?.RealName;
                waterMLog.Items.Add(new WaterMLogPrint
                {
                    Id            = item.F_Id,
                    LogDate       = item.F_LogDate.ToDateString(),
                    Value1        = item.F_Value1 == null ? "" : item.F_Value1.ToFloat(2).ToString(),
                    Value2        = item.F_Value2 == null ? "" : item.F_Value2.ToFloat(2).ToString(),
                    Value3        = item.F_Value3 == null ? "" : item.F_Value3.ToFloat(2).ToString(),
                    Value4        = item.F_Value4 == null ? "" : item.F_Value4.ToFloat(2).ToString(),
                    Value5        = item.F_Value5 == null ? "" : item.F_Value5.ToFloat(2).ToString(),
                    Value6        = item.F_Value6 == null ? "" : item.F_Value6.ToFloat(2).ToString(),
                    Value7        = item.F_Value7 == null ? "" : item.F_Value7.ToFloat(2).ToString(),
                    Value8        = item.F_Value8 == null ? "" : item.F_Value8.ToFloat(2).ToString(),
                    Value9        = item.F_Value9 == null ? "" : item.F_Value9.ToFloat(2).ToString(),
                    Option1       = item.F_Option1.ToBool() ? "√" : "",
                    Option2       = item.F_Option2.ToBool() ? "√" : "",
                    Option3       = item.F_Option3.ToBool() ? "√" : "",
                    Option4       = item.F_Option4.ToBool() ? "√" : "",
                    Option5       = item.F_Option5.ToBool() ? "完成" : "",
                    Option6       = item.F_Option6.ToBool() ? "正常" : "",
                    OperatePerson = item.F_OperatePerson,
                    CheckPerson   = item.F_OperatePerson,
                    Memo          = item.F_Memo
                });
            }
            return(Content(_waterMLogApp.GetReport(waterMLog)));
        }