1097 lines
37 KiB
C#
1097 lines
37 KiB
C#
using System;
|
||
using System.Collections.Generic;
|
||
using System.Data;
|
||
using System.Drawing;
|
||
using System.Windows.Forms;
|
||
using DevExpress.XtraBars;
|
||
using WMS.Frm.Base;
|
||
using DevExpress.XtraTab;
|
||
using WMS.Common;
|
||
using DevExpress.XtraBars.Ribbon;
|
||
using DevExpress.XtraNavBar;
|
||
using WMS.Ctrl;
|
||
using System.Threading;
|
||
using WMS.Model.Base;
|
||
using WMS.FrmBaseData;
|
||
using DevExpress.XtraEditors;
|
||
using DevExpress.XtraEditors.Controls;
|
||
using WMS.Business;
|
||
using WMS.Business.Base;
|
||
using Scada;
|
||
|
||
namespace WMS.Frm
|
||
{
|
||
/// <summary>
|
||
/// 窗体框架该类存放公共信息
|
||
/// </summary>
|
||
public partial class FrmSysFrame : RibbonForm
|
||
{
|
||
|
||
#region 变量声明
|
||
/// <summary>
|
||
/// 当前登录用户信息
|
||
/// </summary>
|
||
public static UserDataModel userData = new UserDataModel();
|
||
|
||
/// <summary>
|
||
/// xml的路径
|
||
/// </summary>
|
||
public static string xmlFile = string.Empty;
|
||
/// <summary>
|
||
/// 为查询参数表获得时间间隔服务
|
||
/// </summary>
|
||
int iTime = 10;
|
||
public int frmIndex = -1;
|
||
public DataSet UserRoleDs = new DataSet();
|
||
#endregion
|
||
|
||
#region 构造函数
|
||
public FrmSysFrame()
|
||
{
|
||
Control.CheckForIllegalCrossThreadCalls = false;
|
||
ThreadExceptionDialog.CheckForIllegalCrossThreadCalls = false;
|
||
InitializeComponent();
|
||
|
||
|
||
}
|
||
#endregion
|
||
|
||
#region 打开一个table页在右侧栏
|
||
/// <summary>
|
||
/// 打开一个table页在右侧栏
|
||
/// </summary>
|
||
/// <param name="Form_Child"></param>
|
||
/// <param name="e"></param>
|
||
public bool OfOpenWindow(Form fnew, string name, string caption)
|
||
{
|
||
|
||
string ls_form_name = name;
|
||
if (ls_form_name == "" || ls_form_name == null) { return false; }
|
||
if (frmIndex > -1 && ls_form_name == tab_list.TabPages[frmIndex].Name)
|
||
{
|
||
tab_list.SelectedTabPage = tab_list.TabPages[frmIndex];
|
||
return false;
|
||
|
||
}
|
||
else
|
||
{
|
||
try
|
||
{
|
||
|
||
this.tab_list.SelectedPageChanged -=
|
||
new DevExpress.XtraTab.TabPageChangedEventHandler(this.tab_list_SelectedPageChanged);
|
||
XtraTabPage new_page = tab_list.TabPages.Add();
|
||
tab_list.SelectedTabPage = new_page;
|
||
new Thread(delegate ()
|
||
{
|
||
|
||
// LogWriteText.WriteLog(" OfOpenWindow" + DateTime.Now.ToString() );
|
||
this.Invoke(new MethodInvoker(delegate ()
|
||
{
|
||
|
||
new_page.ResumeLayout(false);
|
||
new_page.Text = caption;
|
||
new_page.Name = ls_form_name;
|
||
new_page.TooltipTitle = ls_form_name;
|
||
new_page.BackColor = Color.Blue;
|
||
new_page.ImageIndex = btnImage;
|
||
fnew.TopLevel = false;
|
||
fnew.FormBorderStyle = FormBorderStyle.None;
|
||
|
||
fnew.Visible = true;
|
||
fnew.Dock = DockStyle.Fill;
|
||
new_page.Controls.Add(fnew);
|
||
tab_list.TabPages.IndexOf(new_page);
|
||
frmIndex = tab_list.SelectedTabPageIndex;
|
||
|
||
this.tab_list.SelectedPageChanged += new DevExpress.XtraTab.TabPageChangedEventHandler(this.tab_list_SelectedPageChanged);
|
||
|
||
}));
|
||
}).Start();
|
||
|
||
return true;
|
||
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
SystemCommon.ShowErrorMessageBox("系统出错" + ex.Message.ToString());
|
||
return false;
|
||
}
|
||
}
|
||
|
||
}
|
||
#endregion
|
||
|
||
#region 系统加载
|
||
/// <summary>
|
||
/// 系统加载
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
private void FrmSysFrame_Load(object sender, EventArgs e)
|
||
{
|
||
DevExpress.XtraSplashScreen.SplashScreenManager.CloseForm();
|
||
lkb_StorName.Text = userData.STORAGE_NAME;//仓库名称
|
||
lkb_UserName.Text = userData.NAME; //用户姓名
|
||
FunRibbon.Minimized = true;
|
||
FunRibbon.HideApplicationButtonContentControl();
|
||
MenuBar.Items.Clear();
|
||
MenuBar.Groups.Clear();
|
||
// #region 获取用户权限 加载菜单
|
||
////获取用户权限
|
||
UserRoleDs = IBussFactory<BussSystemUser>.Instance().GetUserRole(userData.USER_ID);
|
||
SetUserMenu(UserRoleDs.Tables[0], "0", null);
|
||
|
||
//调整分辨率
|
||
ctlAppearance_position(SystemInformation.VirtualScreen.Width, SystemInformation.VirtualScreen.Height);
|
||
// AddLoadFrm();//数据采集及监控系统
|
||
}
|
||
private void AddLoadFrm()
|
||
{
|
||
FrmScada frmScada = new FrmScada();
|
||
frmScada.TopLevel = false;
|
||
frmScada.FormBorderStyle = FormBorderStyle.None;
|
||
frmScada.userData = userData;
|
||
frmScada.Visible = true;
|
||
frmScada.Dock = DockStyle.Fill;
|
||
panelControl1.Controls.Add(frmScada);
|
||
|
||
}
|
||
private void FunRibbon_ApplicationButtonClick(object sender, EventArgs e)
|
||
{
|
||
// throw new NotImplementedException();
|
||
}
|
||
#endregion
|
||
|
||
#region 根据用户权限设加载菜单
|
||
/// <summary>
|
||
/// 根据用户权限设加载菜单
|
||
/// </summary>
|
||
/// <param name="dt">菜单集合</param>
|
||
/// <param name="Menu_Id">菜单编号</param>
|
||
private void SetUserMenu(DataTable dt, string Menu_Id, NavBarGroup group)
|
||
{
|
||
DataRow[] dr = dt.Select("P_MENU_ID = '" + Menu_Id + "'", "MENU_SORT");
|
||
for (int i = 0; i < dr.Length; i++)
|
||
{
|
||
if (dr[i]["STATUS"].ToString() == "1")
|
||
{
|
||
if (dr[i]["P_MENU_ID"].ToString() == "0")
|
||
{
|
||
group = new NavBarGroup();
|
||
group.Caption = " " + dr[i]["MENU_NAME"].ToString();
|
||
group.Appearance.Font = new
|
||
System.Drawing.Font("微软雅黑", 10);
|
||
|
||
group.Appearance.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center;
|
||
// group.Expanded = true;
|
||
// group.ExpandChanged += new EventHandler<ExpandedEventArgs>(m_ExpandChanged);
|
||
if (dr[i]["MENU_IMAGE"] != null)
|
||
{
|
||
group.LargeImageIndex = int.Parse(dr[i]["MENU_IMAGE"].ToString());
|
||
}
|
||
//group.ItemChanged += new System.EventHandler(this.navBarGroup1_ItemChanged);
|
||
MenuBar.Groups.Add(group);
|
||
|
||
|
||
SetUserMenu(dt, dr[i]["MENU_ID"].ToString(), group);
|
||
}
|
||
else
|
||
{
|
||
DevExpress.XtraNavBar.NavBarItem item = new DevExpress.XtraNavBar.NavBarItem();
|
||
|
||
//设置子菜单图片
|
||
int imgIndex = int.Parse(dr[i]["MENU_IMAGE"].ToString());
|
||
if (imgIndex < imageCollection3.Images.Count)
|
||
{
|
||
item.SmallImageIndex = imgIndex;
|
||
}
|
||
item.Appearance.Font = new System.Drawing.Font("微软雅黑", 10);
|
||
item.Caption = dr[i]["MENU_NAME"].ToString();
|
||
item.Name = dr[i]["MENU_FORM"].ToString();
|
||
item.Tag = dr[i]["MENU_TAG"].ToString() + ":" + dr[i]["MENU_ID"].ToString()+":"+ dr[i]["MENU_VAL"].ToString();
|
||
|
||
item.LinkClicked += new DevExpress.XtraNavBar.NavBarLinkEventHandler(this.navBarItem_LinkClicked);
|
||
group.ItemLinks.Add(item);
|
||
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
void NavBar_Click(object sender, EventArgs e)
|
||
{
|
||
throw new NotImplementedException();
|
||
}
|
||
#endregion
|
||
|
||
#region 调窗体的大小
|
||
private void ctlAppearance_position(int width, int height)
|
||
{
|
||
this.Location = new Point(this.Width / 1200, this.Height / 800);
|
||
this.Size = new Size(width - 2, height - 37);
|
||
}
|
||
#endregion
|
||
|
||
#region 选择事件
|
||
/// <summary>
|
||
/// 选择事件
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
private void tab_list_SelectedPageChanged(object sender, TabPageChangedEventArgs e)
|
||
{
|
||
if (tab_list.SelectedTabPageIndex < 0 || tab_list.TabPages[tab_list.SelectedTabPageIndex].Controls.Count == 0)
|
||
{
|
||
return;
|
||
}
|
||
object frmObject = tab_list.TabPages[tab_list.SelectedTabPageIndex].Controls[0];
|
||
frmIndex = tab_list.SelectedTabPageIndex;
|
||
|
||
fnew = frmObject as FormBase;
|
||
if (fnew != null)
|
||
{
|
||
fnew.userData = userData;
|
||
SetUserRoleButton();
|
||
//FunRibbon.Minimized = false;
|
||
}
|
||
else
|
||
{
|
||
FunRibbon.Minimized = true;
|
||
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
#region 关闭按钮
|
||
/// <summary>
|
||
/// 关闭按钮
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
private void tab_list_CloseButtonClick(object sender, EventArgs e)
|
||
{
|
||
TabClose();
|
||
}
|
||
|
||
private void tab_list_MouseDoubleClick(object sender, MouseEventArgs e)
|
||
{
|
||
TabClose();
|
||
}
|
||
|
||
private void TabClose()
|
||
{
|
||
|
||
if (frmIndex < 0)
|
||
{
|
||
return;
|
||
}
|
||
//index = FormBase.FrmIndex--;
|
||
string ls_tabname = tab_list.SelectedTabPage.Name;
|
||
if (tab_list.TabPages[frmIndex].Controls.Count == 0)
|
||
{
|
||
return;
|
||
}
|
||
|
||
fnew.Close();
|
||
fnew.Dispose();
|
||
tab_list.TabPages.Remove(tab_list.SelectedTabPage);
|
||
//tab_list.SelectedTabPage = tab_list.TabPages[index];
|
||
tab_list.SelectedTabPage = tab_list.TabPages[tab_list.TabPages.Count - 1];
|
||
frmIndex = tab_list.TabPages.Count - 1;
|
||
|
||
if (tab_list.TabPages.Count - 1 == 0)
|
||
{
|
||
if (ribbonButton.ItemLinks.Count > 0)
|
||
{
|
||
ribbonButton.ItemLinks.Clear();
|
||
FunRibbon.Minimized = true;
|
||
}
|
||
}
|
||
|
||
}
|
||
#endregion
|
||
|
||
#region 单击事件
|
||
/// <summary>
|
||
/// 单击事件,NavBarItem 控件的Tag 存放是文件的路径,Name 跟类的名称一样
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
/// FormBase fnew;
|
||
///
|
||
FormBase fnew;
|
||
int btnImage = 0;
|
||
private void navBarItem_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
|
||
{
|
||
try
|
||
{
|
||
LoadForm load = new LoadForm();
|
||
string errText = string.Empty;
|
||
try
|
||
{
|
||
DevExpress.XtraSplashScreen.SplashScreenManager.ShowForm(load, load.GetType(), false, true, true, 100);
|
||
DevExpress.XtraSplashScreen.SplashScreenManager.Default.SetWaitFormCaption("");//设置标题
|
||
DevExpress.XtraSplashScreen.SplashScreenManager.Default.SetWaitFormDescription("窗体加载中...");//设置文本信息
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
}
|
||
|
||
string tag = ((DevExpress.XtraNavBar.NavBarItem)sender).Tag.ToString();
|
||
string classNew = ((DevExpress.XtraNavBar.NavBarItem)sender).Name.ToString();
|
||
btnImage = e.Link.Item.SmallImageIndex;
|
||
string name = e.Link.Item.Name;
|
||
string caption = e.Link.Caption;
|
||
string classdll = tag.Split(':')[0];
|
||
string menuId = tag.Split(':')[1];
|
||
string frmVal = tag.Split(':')[2];
|
||
CreateFrmBaseClass(classdll, classNew, frmVal);
|
||
//LogWriteText.WriteLog("CreateFrmBaseClass" + DateTime.Now.ToString());
|
||
if (fnew == null)
|
||
{
|
||
try
|
||
{
|
||
DevExpress.XtraSplashScreen.SplashScreenManager.CloseForm();
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
}
|
||
|
||
return;
|
||
}
|
||
// LogWriteText.WriteLog("OpenTableFrm1" + DateTime.Now.ToString() );
|
||
OpenTableFrm(menuId, classNew, caption);
|
||
// LogWriteText.WriteLog("OpenTableFrm2" + DateTime.Now.ToString() );
|
||
try
|
||
{
|
||
DevExpress.XtraSplashScreen.SplashScreenManager.CloseForm();
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
|
||
}
|
||
|
||
fnew.Focus();
|
||
dockManager1.Panels[0].HideSliding();
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
|
||
string errMsg = ex.Message;
|
||
}
|
||
|
||
|
||
}
|
||
|
||
public void CreateFrmBaseClass(string classdll, string classNew,string frmVal)
|
||
{
|
||
|
||
object frmObject = Instance(classdll, classNew);
|
||
if (frmObject == null)
|
||
{
|
||
return;
|
||
}
|
||
fnew = frmObject as FormBase;
|
||
|
||
|
||
if (fnew != null)
|
||
{
|
||
|
||
fnew.userData = userData;
|
||
fnew.frmVal = frmVal;
|
||
fnew.createfrm += new FormBase.frmSystemCreate(fnew_openfrm);
|
||
fnew.openfrmTab += new FormBase.OpenFrmTab(fnew_openfrmTab);
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// 根据菜单的id,反射出菜单的窗体
|
||
/// </summary>
|
||
/// <param name="menuId"></param>
|
||
/// <param name="classNew"></param>
|
||
/// <param name="caption"></param>
|
||
/// <returns></returns>
|
||
public bool OpenTableFrm(string menuId, string classNew, string caption)
|
||
{
|
||
string err = string.Empty;
|
||
|
||
if (ribbonButton.ItemLinks.Count > 0)
|
||
{
|
||
|
||
ribbonButton.ItemLinks.Clear();
|
||
|
||
}
|
||
#region 加载窗体的控件
|
||
new Thread((ThreadStart)delegate
|
||
{
|
||
// LogWriteText.WriteLog(" OpenTableFrm" + DateTime.Now.ToString() );
|
||
#region 动态加载按钮
|
||
if (fnew != null)
|
||
{
|
||
if (fnew.frmButtonItem.Count > 0)
|
||
{
|
||
|
||
SetUserRoleButton();
|
||
|
||
return;
|
||
}
|
||
///如果已经初始化则执行以上的代码,否则执行下面代码
|
||
fnew.Menu_Id = menuId;
|
||
DataRow[] dr = UserRoleDs.Tables[1].Select("MENU_ID = '" + fnew.Menu_Id + "'");
|
||
if (dr.Length > 0)
|
||
{
|
||
DataTable tbMenuFnt = dr.CopyToDataTable(); //FormBase.UserRoleDs.Tables[1].Select("MENU_ID=" fnew.Menu_Id).CopyToDataTable();
|
||
fnew.DtFun = tbMenuFnt;// tbMenuFnt;
|
||
SetUserRoleButton(tbMenuFnt, fnew.Menu_Id);
|
||
}
|
||
else
|
||
{
|
||
|
||
|
||
FunRibbon.Minimized = true;
|
||
|
||
}
|
||
}
|
||
#endregion
|
||
}).Start();
|
||
|
||
if (fnew != null)
|
||
return OfOpenWindow(fnew, classNew, caption);
|
||
else
|
||
return false;
|
||
#endregion
|
||
|
||
}
|
||
|
||
public bool fnew_openfrmTab(string menuId, string classNew, string caption)
|
||
{
|
||
return OpenTableFrm(menuId, classNew, caption);
|
||
}
|
||
public FormBase fnew_openfrm(string tag, string frmName)
|
||
{
|
||
CreateFrmBaseClass(tag, frmName,"0");
|
||
|
||
return fnew;
|
||
|
||
}
|
||
#endregion
|
||
|
||
#region 单件模式实例化类 返回当前子类
|
||
/// <summary>
|
||
///实例话窗体类。返回一个窗体类
|
||
/// </summary>
|
||
/// <param name="nameForm"></param>
|
||
/// <returns></returns>
|
||
public object Instance(string nameForm, string className)
|
||
{
|
||
|
||
object objType = new object();
|
||
for (int i = 0; i < tab_list.TabPages.Count; i++)
|
||
{
|
||
if (className == tab_list.TabPages[i].Name.ToString())
|
||
{
|
||
if (i == frmIndex)
|
||
{
|
||
return tab_list.TabPages[i].Controls[0];
|
||
}
|
||
frmIndex = i;
|
||
if (tab_list.TabPages[i].Controls.Count > 0)
|
||
{
|
||
return tab_list.TabPages[i].Controls[0];
|
||
}
|
||
else
|
||
{
|
||
return null;
|
||
}
|
||
}
|
||
}
|
||
|
||
try
|
||
{
|
||
string appPath = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetModules()[0].FullyQualifiedName);
|
||
objType = (FormBase)System.Reflection.Assembly.LoadFile(appPath + "\\" + nameForm + ".dll").GetType(nameForm + "." + className).GetConstructor(System.Type.EmptyTypes).Invoke(null);
|
||
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
SystemCommon.ShowInfoMessageBox("ERROR" + ex.Message.ToString().Trim());
|
||
return null;
|
||
}
|
||
return objType;
|
||
}
|
||
#endregion
|
||
|
||
#region 根据操作权限生成导航按钮
|
||
///// <summary>
|
||
///// 当控件已经 初始化一次后调用内存内的
|
||
///// </summary>
|
||
private void SetUserRoleButton()
|
||
{
|
||
|
||
|
||
try
|
||
{
|
||
|
||
if (ribbonButton.ItemLinks.Count > 0)
|
||
{
|
||
|
||
ribbonButton.ItemLinks.Clear();
|
||
|
||
}
|
||
if (fnew.frmButtonItem.Count > 0)
|
||
|
||
{
|
||
FunRibbon.Minimized = false;
|
||
foreach (KeyValuePair<string, DevExpress.XtraBars.BarButtonItem> barButton in fnew.frmButtonItem)
|
||
{
|
||
|
||
ribbonButton.ItemLinks.Add(barButton.Value, true);
|
||
// ribbonButton.ItemLinks[ribbonButton.ItemLinks.Count - 1].BeginGroup = true;
|
||
}
|
||
|
||
ribbonButton.ItemLinks.Add(skinRibbonGalleryBarItem1);
|
||
|
||
|
||
}
|
||
|
||
else
|
||
{
|
||
//FunRibbon.Hide();
|
||
|
||
// ribbonButton.Visible = false;
|
||
FunRibbon.Minimized = true;
|
||
// FunRibbon.HideApplicationButtonContentControl();
|
||
}
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
|
||
LogWriteText.WriteLog("MENU ERROR" );
|
||
}
|
||
|
||
|
||
}
|
||
/// <summary>
|
||
/// 动态加载 fnew.GetType().GetMethod("").Invoke(fnew, null);
|
||
/// </summary>
|
||
/// <param name="dt"></param>
|
||
/// <param name="Fun_Id"></param>
|
||
/// <param name="Menu_Id"></param>
|
||
/// <param name="ribbonPage"></param>
|
||
/// <param name="ribbonPageGroup"></param>
|
||
private void SetUserRoleButton(DataTable dt, string Fun_Id)
|
||
{
|
||
if (dt.Rows.Count == 0)
|
||
{
|
||
FunRibbon.Minimized = true;
|
||
return;
|
||
}
|
||
else
|
||
{
|
||
FunRibbon.Minimized = false;
|
||
}
|
||
|
||
foreach (DataRow row in dt.Rows)
|
||
{
|
||
|
||
if (row["FUN_Name"].ToString().Trim().Length > 0)
|
||
{
|
||
if (FunRibbon != null)
|
||
{
|
||
DevExpress.XtraBars.BarButtonItem barButton = new BarButtonItem();
|
||
// ribbonPage = new DevExpress.XtraBars.Ribbon.RibbonPage();
|
||
barButton.Name = row["FUN_Name"].ToString();
|
||
barButton.Caption = row["Fun_Dictory"].ToString();
|
||
barButton.Tag = row["FUN_TAG"].ToString();
|
||
|
||
barButton.ItemClick += new ItemClickEventHandler(barButton_ItemClick);
|
||
if (row["Fun_Image"].ToString().Trim().Length > 0)
|
||
{
|
||
try
|
||
{
|
||
barButton.ImageUri.Uri = row["Fun_Image"].ToString();
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
SystemCommon.ShowInfoMessageBox(barButton.Name + "图片路径出错了:" + barButton.ImageUri.Uri);
|
||
continue;
|
||
}
|
||
|
||
|
||
}
|
||
|
||
barButton.Enabled = true;
|
||
barButton.Appearance.Options.UseFont = false;
|
||
ribbonButton.ItemLinks.Add(barButton, true);
|
||
|
||
barButton.Appearance.Font = new System.Drawing.Font("宋体", 11);
|
||
fnew.frmButtonItem.Add(barButton.Tag.ToString().Trim(), barButton);
|
||
barButton.AppearanceDisabled.Font = new System.Drawing.Font("宋体", 11);
|
||
barButton.ItemAppearance.SetFont(new Font("宋体", 11));
|
||
if (row["fun_method"].ToString() == "1")
|
||
{
|
||
barButton.Enabled = true;
|
||
}
|
||
else
|
||
{
|
||
barButton.Enabled = false;
|
||
|
||
}
|
||
}
|
||
}
|
||
|
||
}
|
||
ribbonButton.ItemLinks.Add(skinRibbonGalleryBarItem1);
|
||
|
||
}
|
||
|
||
private void barexitButton_ItemClick(object sender, ItemClickEventArgs e)
|
||
{
|
||
FrmSysFrame_FormClosing(null, null);
|
||
}
|
||
|
||
private void barButton_ItemClick(object sender, ItemClickEventArgs e)
|
||
{
|
||
if (e.Item.Tag != null && e.Item.Tag.ToString() != "")
|
||
{
|
||
string method = e.Item.Tag.ToString();
|
||
if (fnew.GetType().GetMethod(method) != null)
|
||
{
|
||
fnew.GetType().GetMethod(method).Invoke(fnew, null);
|
||
}
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
/// <summary>
|
||
/// 窗体关闭
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
private void FrmSysFrame_FormClosing(object sender, FormClosingEventArgs e)
|
||
{
|
||
if (MessageBox.Show("确定要退出系统?", "系统提示", MessageBoxButtons.YesNo, MessageBoxIcon.Asterisk, MessageBoxDefaultButton.Button2) == DialogResult.Yes)
|
||
{
|
||
this.Dispose();
|
||
this.Close();
|
||
}
|
||
else
|
||
{
|
||
e.Cancel = true;
|
||
}
|
||
}
|
||
|
||
private void barButtonItem4_ItemClick(object sender, ItemClickEventArgs e)
|
||
{
|
||
FrmSelect frm = new FrmSelect(fnew.FrmSelectModle);
|
||
if (frm.ShowDialog() == System.Windows.Forms.DialogResult.OK)
|
||
{
|
||
fnew.LoadListData(frm.SelectData);
|
||
}
|
||
}
|
||
|
||
#region 窗体的KeyDown事件
|
||
private void FrmSysFrame_KeyDown(object sender, KeyEventArgs e)
|
||
{
|
||
if (e.Control)
|
||
{
|
||
|
||
if (e.KeyCode == Keys.F)
|
||
{
|
||
if (fnew != null)
|
||
{
|
||
if (fnew.FrmSelectModle != null)
|
||
{
|
||
FrmSelect frm = new FrmSelect(fnew.FrmSelectModle);
|
||
if (frm.ShowDialog() == System.Windows.Forms.DialogResult.OK)
|
||
{
|
||
fnew.LoadListData(frm.SelectData);
|
||
}
|
||
}
|
||
}
|
||
}
|
||
else if (e.KeyCode == Keys.G)
|
||
{
|
||
if (fnew != null)
|
||
{
|
||
if (fnew.frmButtonItem.ContainsKey("ChooseGoods") && fnew.frmButtonItem["ChooseGoods"].Enabled == true)
|
||
{
|
||
fnew.ChooseGoods();
|
||
}
|
||
else if (fnew.frmButtonItem.ContainsKey("Select") && fnew.frmButtonItem["Select"].Enabled == true)
|
||
{
|
||
fnew.Select();
|
||
}
|
||
}
|
||
}
|
||
else if (e.KeyCode == Keys.D1)
|
||
{
|
||
if (fnew != null)
|
||
{
|
||
if (fnew.frmButtonItem.ContainsKey("Add") && fnew.frmButtonItem["Add"].Enabled == true)
|
||
{
|
||
fnew.Add();
|
||
}
|
||
else if (fnew.frmButtonItem.ContainsKey("AddTab") && fnew.frmButtonItem["AddTab"].Enabled == true)
|
||
{
|
||
fnew.AddTab();
|
||
}
|
||
else if (fnew.frmButtonItem.ContainsKey("AddShelf") && fnew.frmButtonItem["AddShelf"].Enabled == true)
|
||
{
|
||
fnew.AddShelf();
|
||
}
|
||
}
|
||
}
|
||
//else if (e.KeyCode == Keys.C)
|
||
//{
|
||
// if (fnew != null)
|
||
// {
|
||
// if (fnew.frmButtonItem.ContainsKey("Clear") && fnew.frmButtonItem["Clear"].Enabled == true)
|
||
// {
|
||
// fnew.Clear();
|
||
// }
|
||
// }
|
||
//}
|
||
else if (e.KeyCode == Keys.E)
|
||
{
|
||
if (fnew != null)
|
||
{
|
||
if (fnew.frmButtonItem.ContainsKey("Edit") && fnew.frmButtonItem["Edit"].Enabled == true)
|
||
{
|
||
fnew.Edit();
|
||
}
|
||
}
|
||
}
|
||
else if (e.KeyCode == Keys.D)
|
||
{
|
||
if (fnew != null)
|
||
{
|
||
if (fnew.frmButtonItem.ContainsKey("Del") && fnew.frmButtonItem["Del"].Enabled == true)
|
||
{
|
||
fnew.Del();
|
||
}
|
||
}
|
||
}
|
||
else if (e.KeyCode == Keys.P)
|
||
{
|
||
if (fnew != null)
|
||
{
|
||
if (fnew.frmButtonItem.ContainsKey("Print") && fnew.frmButtonItem["Print"].Enabled == true)
|
||
{
|
||
fnew.Print();
|
||
}
|
||
}
|
||
}
|
||
else if (e.KeyCode == Keys.R)
|
||
{
|
||
if (fnew != null)
|
||
{
|
||
if (fnew.frmButtonItem.ContainsKey("Refresh") && fnew.frmButtonItem["Refresh"].Enabled == true)
|
||
{
|
||
fnew.Refresh();
|
||
}
|
||
}
|
||
}
|
||
else if (e.KeyCode == Keys.S)
|
||
{
|
||
if (fnew != null)
|
||
{
|
||
if (fnew.frmButtonItem.ContainsKey("Save") && fnew.frmButtonItem["Save"].Enabled == true)
|
||
{
|
||
fnew.Save();
|
||
}
|
||
}
|
||
}
|
||
else if (e.KeyCode == Keys.Q)
|
||
{
|
||
if (fnew != null)
|
||
{
|
||
if (fnew.frmButtonItem.ContainsKey("Search") && fnew.frmButtonItem["Search"].Enabled == true)
|
||
{
|
||
fnew.Search();
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
private void groupControl1_Resize(object sender, EventArgs e)
|
||
{
|
||
Size beforeResizeSize = this.Size;
|
||
//base.WndProc(ref m);
|
||
//窗口resize之后的大小
|
||
Size afterResizeSize = this.Size;
|
||
//获得变化比例
|
||
float percentWidth = (float)afterResizeSize.Width / beforeResizeSize.Width;
|
||
float percentHeight = (float)afterResizeSize.Height / beforeResizeSize.Height;
|
||
foreach (Control control in this.Controls)
|
||
{
|
||
//按比例改变控件大小
|
||
control.Width = (int)(control.Width * percentWidth);
|
||
control.Height = (int)(control.Height * percentHeight);
|
||
//为了不使控件之间覆盖 位置也要按比例变化
|
||
control.Left = (int)(control.Left * percentWidth);
|
||
control.Top = (int)(control.Top * percentHeight);
|
||
//改变控件字体大小
|
||
//control.Font = new Font(control.Font.Name, control.Font.Size * Math.Min(percentHeight, percentHeight), control.Font.Style, control.Font.Unit);
|
||
}
|
||
}
|
||
|
||
|
||
|
||
|
||
/// <summary>
|
||
/// 用户连接到用户资料
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
private void lkb_UserName_MouseClick(object sender, MouseEventArgs e)
|
||
{
|
||
FormBase formBase = fnew_openfrm("WMS.FrmSystems", "FrmUser");//创建窗体
|
||
if (formBase != null)
|
||
{
|
||
//FrmUser frmuser = new FrmUser();
|
||
//// userData.IP = "111";
|
||
////OpenTabAddFrm打开窗体,打开之前检测该窗体是否已经被打开 是则返回false
|
||
//if (!fnew_openfrmTab("0103", "FrmUser", "用户资料-" + lkb_UserName.Text))
|
||
//{
|
||
// frmuser.FrmUser_Load(null, null);//如果已经被打开,执行一下窗体加载方法
|
||
//}
|
||
}
|
||
|
||
|
||
}
|
||
|
||
|
||
|
||
/// <summary>
|
||
/// pictureBox 单击事件
|
||
/// </summary>
|
||
/// <param name="pic_Box"></param>
|
||
private void PitcureBox_Click(PictureBox pic_Box)
|
||
{
|
||
LoadForm load = new LoadForm();
|
||
DevExpress.XtraSplashScreen.SplashScreenManager.ShowForm(load, load.GetType(), false, true, false, 70);
|
||
DevExpress.XtraSplashScreen.SplashScreenManager.Default.SetWaitFormDescription("窗体加载中...");
|
||
string tag = pic_Box.Tag.ToString();
|
||
|
||
string classdll = tag.Split(':')[0].ToString();
|
||
string classNew = tag.Split(':')[1].ToString();
|
||
string menuId = tag.Split(':')[2].ToString();
|
||
string caption = tag.Split(':')[3].ToString();
|
||
CreateFrmBaseClass(classdll, classNew,"0");
|
||
if (fnew == null)
|
||
{
|
||
|
||
DevExpress.XtraSplashScreen.SplashScreenManager.CloseForm();
|
||
return;
|
||
}
|
||
OpenTableFrm(menuId, classNew, caption);
|
||
|
||
DevExpress.XtraSplashScreen.SplashScreenManager.CloseForm();
|
||
// fnew.Select();
|
||
fnew.Focus();
|
||
|
||
}
|
||
|
||
/// <summary>
|
||
/// 入库订单
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
private void pictureBox12_Click(object sender, EventArgs e)
|
||
{
|
||
//PitcureBox_Click(pictureBox12);
|
||
}
|
||
|
||
/// <summary>
|
||
/// 收货码盘
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
private void pictureBox11_Click(object sender, EventArgs e)
|
||
{
|
||
// PitcureBox_Click(pictureBox11);
|
||
}
|
||
|
||
/// <summary>
|
||
/// 到货录入
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
private void pictureBox25_Click(object sender, EventArgs e)
|
||
{
|
||
// PitcureBox_Click(pictureBox25);
|
||
}
|
||
|
||
/// <summary>
|
||
/// 上架作业
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
private void pictureBox29_Click(object sender, EventArgs e)
|
||
{
|
||
// PitcureBox_Click(pictureBox29);
|
||
}
|
||
|
||
/// <summary>
|
||
/// 上架确认
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
private void pictureBox27_Click(object sender, EventArgs e)
|
||
{
|
||
// PitcureBox_Click(pictureBox27);
|
||
}
|
||
|
||
/// <summary>
|
||
/// 收获验收
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
private void pictureBox28_Click(object sender, EventArgs e)
|
||
{
|
||
// PitcureBox_Click(pictureBox28);
|
||
}
|
||
|
||
/// <summary>
|
||
/// 收获入库
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
private void pictureBox26_Click(object sender, EventArgs e)
|
||
{
|
||
// PitcureBox_Click(pictureBox26);
|
||
}
|
||
|
||
/// <summary>
|
||
/// 盘点任务
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
private void pictureBox19_Click(object sender, EventArgs e)
|
||
{
|
||
// PitcureBox_Click(pictureBox19);
|
||
}
|
||
|
||
/// <summary>
|
||
/// 盘点
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
private void pictureBox20_Click(object sender, EventArgs e)
|
||
{
|
||
// PitcureBox_Click(pictureBox20);
|
||
}
|
||
|
||
/// <summary>
|
||
/// 库存调整单
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
private void pictureBox22_Click(object sender, EventArgs e)
|
||
{
|
||
// PitcureBox_Click(pictureBox22);
|
||
}
|
||
|
||
/// <summary>
|
||
/// 库存调整
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
private void pictureBox38_Click(object sender, EventArgs e)
|
||
{
|
||
// PitcureBox_Click(pictureBox38);
|
||
}
|
||
|
||
/// <summary>
|
||
/// 出库通知单
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
private void pictureBox30_Click(object sender, EventArgs e)
|
||
{
|
||
// PitcureBox_Click(pictureBox30);
|
||
}
|
||
|
||
/// <summary>
|
||
/// 订单分拣
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
private void pictureBox32_Click(object sender, EventArgs e)
|
||
{
|
||
// PitcureBox_Click(pictureBox32);
|
||
}
|
||
|
||
/// <summary>
|
||
/// 包装复核
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
private void pictureBox18_Click(object sender, EventArgs e)
|
||
{//
|
||
// PitcureBox_Click(pictureBox18);
|
||
}
|
||
|
||
/// <summary>
|
||
/// 包装称重
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
private void pictureBox13_Click(object sender, EventArgs e)
|
||
{
|
||
// PitcureBox_Click(pictureBox13);
|
||
}
|
||
|
||
private void timer1_Tick(object sender, EventArgs e)
|
||
{
|
||
|
||
}
|
||
|
||
|
||
private void tab_list_MouseHover(object sender, EventArgs e)
|
||
{
|
||
dockManager1.Panels[0].HideSliding();
|
||
}
|
||
|
||
private void FunRibbon_MouseMove(object sender, MouseEventArgs e)
|
||
{
|
||
dockManager1.Panels[0].HideSliding();
|
||
}
|
||
|
||
private void MenuBar_Leave(object sender, EventArgs e)
|
||
{
|
||
try
|
||
{
|
||
dockManager1.Panels[0].HideSliding();
|
||
}
|
||
catch (Exception ex) { }
|
||
|
||
}
|
||
|
||
private void xtraTabPage2_Paint(object sender, PaintEventArgs e)
|
||
{
|
||
|
||
}
|
||
|
||
private void tabPage1_Click(object sender, EventArgs e)
|
||
{
|
||
|
||
}
|
||
|
||
private void LocShow_Click(object sender, EventArgs e)
|
||
{
|
||
|
||
}
|
||
|
||
private void panelControl1_Paint(object sender, PaintEventArgs e)
|
||
{
|
||
|
||
}
|
||
}
|
||
}
|
||
|