From d35bb711f8d3d267b44b4a80c20e31dabf309ae7 Mon Sep 17 00:00:00 2001
From: lu <99954486@qq.com>
Date: 星期二, 14 一月 2025 08:17:18 +0800
Subject: [PATCH] 其它入库

---
 DevApp/Gs.DevApp/UserControl/UcBtnPrint.cs |  115 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 114 insertions(+), 1 deletions(-)

diff --git a/DevApp/Gs.DevApp/UserControl/UcBtnPrint.cs b/DevApp/Gs.DevApp/UserControl/UcBtnPrint.cs
index 046441e..01c25d3 100644
--- a/DevApp/Gs.DevApp/UserControl/UcBtnPrint.cs
+++ b/DevApp/Gs.DevApp/UserControl/UcBtnPrint.cs
@@ -1,4 +1,10 @@
-锘縰sing DevExpress.XtraEditors;
+锘縰sing DevExpress.Utils.VisualEffects;
+using DevExpress.XtraBars;
+using DevExpress.XtraEditors;
+using Gs.DevApp.DevFrm.Rpt;
+using Gs.DevApp.DevFrm.Sys;
+using Gs.DevApp.ToolBox;
+using Newtonsoft.Json;
 using System;
 using System.Collections.Generic;
 using System.ComponentModel;
@@ -16,6 +22,113 @@
         public UcBtnPrint()
         {
             InitializeComponent();
+            btnReport.Click += BtnReport_ItemClick;
+            btnDesign.Click += BtnDesign_ItemClick;
+
+          
         }
+        /// <summary>
+        ///     鍏抽敭瀛楋紝涓�鑸槸涓婚敭
+        /// </summary>
+        public string guidKey { get; set; }
+        /// <summary>
+        ///     鎶ヨ〃锛屽湪鏁版嵁搴撲腑瑕佸敮涓�,濡傦細瀛樺偍杩囩▼鍚峽鍏ュ弬1鍚峾鍏ュ弬鍊�,鍏ュ弬2鍚峾鍏ュ弬鍊紏
+        /// </summary>
+        public string rptParameter { get; set; }
+
+
+        /// <summary>
+        /// 璁剧疆鎶ヨ〃
+        /// </summary>
+        public event EventHandler btnDesignClick;
+
+        /// <summary>
+        /// 鎶ヨ〃
+        /// </summary>
+        public event EventHandler btnReportClick;
+
+        private void BtnReport_ItemClick(object sender, EventArgs e)
+        {
+            if (btnReportClick != null)
+                btnReportClick(this, e);
+            else
+                return;
+
+            if (rptParameter == "return false")
+                return;
+            if (string.IsNullOrEmpty(rptParameter))
+            {
+                MsgHelper.ShowError("娌℃湁鎸囧畾鎶ヨ〃鍙傛暟锛岃鑱旂郴鎶�鏈紑鍙戜汉鍛橈紒");
+                return;
+            }
+            var _bl = false;
+            _bl = _ckRptService();
+            if (_bl)
+            {
+                try
+                {
+                    using (Form frm = new RptPreview(guidKey, rptParameter))
+                    {
+                        frm.ShowDialog();
+                    }
+                }
+                catch (Exception)
+                {
+                }
+                return;
+            }
+
+            MsgHelper.ShowError("娌℃湁璁捐妯℃澘锛岃鍏堣璁℃ā鏉匡紒");
+        }
+
+        private void BtnDesign_ItemClick(object sender, EventArgs e)
+        {
+            if (btnDesignClick != null)
+                btnDesignClick(this, e);
+            else
+                return;
+
+            if (string.IsNullOrEmpty(rptParameter))
+            {
+                MsgHelper.ShowError("娌℃湁鎸囧畾鎶ヨ〃鍙傛暟锛岃鑱旂郴鎶�鏈紑鍙戜汉鍛橈紒");
+                return;
+            }
+            var _bl = false;
+            _bl = _ckRptService();
+            //濡傛灉宸茬粡鏈夋ā鏉夸簡锛岀洿鎺ユ墦寮�璁剧疆妯℃澘
+            if (_bl)
+            {
+                var frm = new EasyRptDesign(guidKey, rptParameter);
+                frm.ShowDialog();
+                return;
+            }
+            //鍚﹀垯鍚戝璁捐妯℃澘
+            var rptWizard = new ShowRptWizard(guidKey, rptParameter);
+            rptWizard.ShowDialog();
+        }
+        private bool _ckRptService()
+        {
+            try
+            {
+                var _obj = new
+                {
+                    guid = guidKey,
+                    rptParameter,
+                    isDesign = 1
+                };
+                var strJson = UtilityHelper.HttpPost("", "Report/GetRptData",
+                    JsonConvert.SerializeObject(_obj));
+                var _rtn = UtilityHelper.ReturnToDynamic(strJson);
+                if (_rtn.rtnCode > 0) return true;
+                return false;
+            }
+            catch (Exception ex)
+            {
+                MsgHelper.Warning("鎻愮ず锛�" + ex.Message);
+                return true;
+            }
+            return false;
+        }
+
     }
 }

--
Gitblit v1.9.3