From b55079652a50b5e506c2ce77d73c84ec11aef7fc Mon Sep 17 00:00:00 2001 From: lu <99954486@qq.com> Date: 星期六, 19 四月 2025 12:37:08 +0800 Subject: [PATCH] 生产退库 --- DevApp/Gs.DevApp/DevFrm/FrmMain.cs | 74 ++++++++++++++++++++++++++++++------- 1 files changed, 60 insertions(+), 14 deletions(-) diff --git a/DevApp/Gs.DevApp/DevFrm/FrmMain.cs b/DevApp/Gs.DevApp/DevFrm/FrmMain.cs index 206cd38..78e48dc 100644 --- a/DevApp/Gs.DevApp/DevFrm/FrmMain.cs +++ b/DevApp/Gs.DevApp/DevFrm/FrmMain.cs @@ -1,12 +1,4 @@ -锘縰sing System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Configuration; -using System.Data; -using System.Drawing; -using System.Reflection; -using System.Windows.Forms; -using DevExpress.XtraBars; +锘縰sing DevExpress.XtraBars; using DevExpress.XtraBars.FluentDesignSystem; using DevExpress.XtraBars.Navigation; using DevExpress.XtraTab; @@ -16,6 +8,14 @@ using Gs.DevApp.ToolBox; using Newtonsoft.Json; using Newtonsoft.Json.Linq; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Configuration; +using System.Data; +using System.Drawing; +using System.Reflection; +using System.Windows.Forms; namespace Gs.DevApp.DevFrm { @@ -99,7 +99,7 @@ Gs.DevApp.DevFrm.User.SysMenu frm = new SysMenu(); frm.ShowDialog(); }; - // tab.ContextMenuStrip = cms1; + // tab.ContextMenuStrip = cms1; } private void Tab_MouseDown(object sender, MouseEventArgs e) @@ -187,7 +187,7 @@ var strJson = UtilityHelper.HttpPost("", "User/GetUserLoginInfo", JsonConvert.SerializeObject(_obj)); Size _size; string _caption; Color _color; Padding _pad; - (_size, _caption, _color, _pad) =Gs.DevApp.ToolBox.UtilityHelper.getLoading(); + (_size, _caption, _color, _pad) = Gs.DevApp.ToolBox.UtilityHelper.getLoading(); DevExpress.Utils.WaitDialogForm wdf = new DevExpress.Utils.WaitDialogForm("鍔犺浇杩涘害:", _caption, _size); wdf.BackColor = _color; wdf.Padding = _pad; @@ -302,7 +302,7 @@ /// <param name="tabText">褰撳墠閫夐」鍗¢〉Text鏍囬</param> /// <param name="newFormName">褰撳墠閫夐」鍗′腑鐨勬柊绐椾綋璺緞锛岀被鍚�</param> public void AddTabpage(XtraTabControl tabControl, string tabPageName, - string tabText, string newFormName, Image imgIcon) + string tabText, string newFormName, Image imgIcon,string InitializeVal="") { if (IsTabpageExsit(tabControl, tabPageName)) return; var newPage = new XtraTabPage(); @@ -311,7 +311,7 @@ newPage.Tooltip = newPage.Name; newPage.Appearance.Header.Font = tab.Appearance.Font; newPage.ImageOptions.Image = imgIcon; - var fm = AddNewForm(newFormName); + var fm = AddNewForm(newFormName, InitializeVal); if (fm != null) { newPage.Controls.Add(fm); @@ -367,7 +367,7 @@ /// 鍦ㄩ�夐」鍗′腑鐢熸垚绐椾綋 /// </summary> /// <param name="form">绐椾綋鍚嶇О</param> - private Form AddNewForm(string formName) + private Form AddNewForm(string formName,string InitializeVal) { try { @@ -383,6 +383,21 @@ newForm.ControlBox = false; newForm.Dock = DockStyle.Fill; newForm.Visible = true; + //瀹炵幇瀛愮獥浣撶殑濮旀墭beg + EventInfo evt = newForm.GetType().GetEvent("UpdateParent", + BindingFlags.NonPublic | BindingFlags.Instance + | BindingFlags.Public + ); + if (evt != null) + evt.AddEventHandler(newForm, new EventHandler<UpdateParentEventArgs>(UpdateParent_OnChange)); + if (!string.IsNullOrEmpty(InitializeVal)) { + Assembly assembly = Assembly.GetExecutingAssembly(); + Type type = assembly.GetType(formName); + MethodInfo method = type.GetMethod("Initialize"); // 鑾峰彇Initialize鏂规硶鐨勪俊鎭� + if (method != null) + method.Invoke(newForm, new object[] { InitializeVal }); // 璋冪敤Initialize鏂规硶骞朵紶閫掑弬鏁� + } + //瀹炵幇瀛愮獥浣撶殑濮旀墭end return newForm; } catch (Exception) @@ -392,6 +407,37 @@ return null; } + //瀹炵幇瀛愮獥浣撶殑濮旀墭beg + private void UpdateParent_OnChange(object sender, UpdateParentEventArgs e) + { + List<string> _val = e.StringList; + string _formName = _val[0];//绫诲悕 + string _parm1= _val[1]; + var _obj = new + { + guid = _formName //涓诲缓 + }; + try + { + var strJson = UtilityHelper.HttpPost("", "MenuAction/GetModelByNameSpace", + JsonConvert.SerializeObject(_obj)); + var _rtn = UtilityHelper.ReturnToDynamic(strJson); + if (_rtn.rtnCode > 0) + { + var dy = _rtn.rtnData; + string tabPageName = dy.guid.ToString() + "_page"; + string tabText = dy.name.ToString(); //褰撳墠閫夐」鍗¢〉Text鏍囬 + string newFormName = dy.formPath.ToString(); //瀛樿矾寰勶紝绫诲悕 + Image imgIcon = UtilityHelper.GetImgFromResource(dy.icon.ToString(), 2); + AddTabpage(tab, tabPageName, tabText,newFormName, imgIcon, _parm1); + } + } + catch (Exception ex) + { + MsgHelper.Warning("鎻愮ず锛�" + ex.Message); + } + } + //瀹炵幇瀛愮獥浣撶殑濮旀墭end private int _userOut() { var _obj = new -- Gitblit v1.9.3