From 4411e9f4d11941ff3869a2a4cfb5093f26a2e07d Mon Sep 17 00:00:00 2001
From: lu <99954486@qq.com>
Date: 星期三, 15 一月 2025 10:26:24 +0800
Subject: [PATCH] 委外
---
DevApp/Gs.DevApp/DevFrm/Rpt/RptPreview.cs | 106 +++++++++++++++++++++++++++--------------------------
1 files changed, 54 insertions(+), 52 deletions(-)
diff --git a/DevApp/Gs.DevApp/DevFrm/Rpt/RptPreview.cs b/DevApp/Gs.DevApp/DevFrm/Rpt/RptPreview.cs
index e9e66fc..dfad8ad 100644
--- a/DevApp/Gs.DevApp/DevFrm/Rpt/RptPreview.cs
+++ b/DevApp/Gs.DevApp/DevFrm/Rpt/RptPreview.cs
@@ -1,86 +1,88 @@
-锘�
-using DevExpress.XtraEditors;
-using Gs.DevApp.Entity;
-using Gs.DevApp.ToolBox;
-using Newtonsoft.Json;
-using System;
-using System.Collections.Generic;
-using System.ComponentModel;
+锘縰sing System;
using System.Data;
-using System.Drawing;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using System.Windows.Forms;
-using DevExpress.XtraBars.Navigation;
-using DevExpress.XtraTab;
-using System;
-using System.Collections.Generic;
-using System.Data;
-using System.Drawing;
-using System.Reflection;
-using System.Windows.Forms;
-using Gs.DevApp.ToolBox;
-using Newtonsoft.Json;
-using Gs.DevApp.Entity;
-using Newtonsoft.Json.Linq;
using System.IO;
+using DevExpress.Utils.VisualEffects;
+using DevExpress.XtraEditors;
+using FastReport;
+using Gs.DevApp.ToolBox;
+using Newtonsoft.Json;
+using Newtonsoft.Json.Linq;
namespace Gs.DevApp.DevFrm.Rpt
{
- public partial class RptPreview : DevExpress.XtraEditors.XtraForm
+ public partial class RptPreview : XtraForm
{
- private string _reportType;
- public RptPreview(string reportType)
+ private readonly string _rptParameter;
+ private readonly string _rptGuid;
+ public RptPreview(string strGuid, string rptParameter)
{
- _reportType = reportType;
+ _rptParameter = rptParameter;
+ _rptGuid = strGuid;
InitializeComponent();
- getPageList();
+ Text = _rptParameter + "鎶ヨ〃鏌ョ湅锛�";
+ getRptData();
}
/// <summary>
- /// 璇诲彇鎶ヨ〃鏁版嵁鍒楄〃
+ /// 璇诲彇鎶ヨ〃鏁版嵁
/// </summary>
- private void getPageList()
+ private void getRptData()
{
var _obj = new
{
- reportType = _reportType,
- sortName = "a.userName",
- sortOrder = "asc",
- keyWhere = ""
+ rptParameter = _rptParameter,
+ guid = _rptGuid,
+ isDesign = 0
};
try
{
- string strJson = UtilityHelper.HttpPost("", "Report/GetUserRoleReport", JsonConvert.SerializeObject(_obj));
- JObject _job = JObject.Parse(strJson);
- string rtnCode = _job["rtnCode"].ToString();
+ var strJson = UtilityHelper.HttpPost("", "Report/GetRptData",
+ JsonConvert.SerializeObject(_obj));
+ var _job = JObject.Parse(strJson);
+ var rtnCode = _job["rtnCode"].ToString();
if (int.Parse(rtnCode) > 0)
{
- JArray array = new JArray();
- foreach (var a in _job["rtnData"]["list"])
- {
- array.Add(a);
- }
- DataTable dt = JsonConvert.DeserializeObject<DataTable>(array.ToString());
- DataSet ds = new DataSet();
- dt.TableName = "Table1";
- ds.Tables.Add(dt);
- FastReport.Report report = new FastReport.Report();
- byte[] buffer = (byte[])_job["rtnData"]["reportData"];
- using (MemoryStream Stream = new MemoryStream(buffer))
+ //妯℃澘
+ var report = new Report();
+ var buffer = (byte[])_job["rtnData"]["reportTemplateData"];
+ using (var Stream = new MemoryStream(buffer))
{
report.Load(Stream);
}
+ //涓昏〃
+ var array = new JArray();
+ foreach (var a in _job["rtnData"]["zb"]) array.Add(a);
+ var _zb =JsonConvert.DeserializeObject<DataTable>(array.ToString());
+ _zb.TableName = "zb";
+ //鏄庣粏琛�1
+ var array1 = new JArray();
+ foreach (var a in _job["rtnData"]["mx1"]) array1.Add(a);
+ var _mx1 =JsonConvert.DeserializeObject<DataTable>( array1.ToString());
+ _mx1.TableName = "mx1";
+ //鏄庣粏琛�2
+ var array2 = new JArray();
+ foreach (var a in _job["rtnData"]["mx2"]) array2.Add(a);
+ var _mx2 =JsonConvert.DeserializeObject<DataTable>(array2.ToString());
+ _mx2.TableName = "mx2";
+ //鍔犲埌鏁版嵁闆嗕腑
+ var ds = new DataSet();
+ ds.Tables.Add(_zb);
+ ds.Tables.Add(_mx1);
+ ds.Tables.Add(_mx2);
report.RegisterData(ds);
report.Preview = previewControl1;
report.Prepare();
report.ShowPrepared();
}
+ else
+ {
+ MsgHelper.Warning("鎻愮ず锛�" + _job["rtnMsg"]);
+ this.Close();
+ }
}
catch (Exception ex)
{
- ToolBox.MsgHelper.Warning("鎻愮ず锛�" + ex.Message);
+ MsgHelper.Warning("鎻愮ず锛�" + ex.Message);
}
}
}
--
Gitblit v1.9.3