bug
lu
2 天以前 9702c6a4dc358c7bff2eb18c8426229a0140e34a
DevApp/Gs.DevApp/UserControl/UcToolBarMenu.cs
@@ -3,6 +3,9 @@
using DevExpress.XtraGrid;
using DevExpress.XtraGrid.Views.Grid;
using DevExpress.XtraLayout;
using DevExpress.XtraRichEdit.Model;
using DevExpress.XtraWaitForm;
using Gs.DevApp.DevFrm;
using Gs.DevApp.DevFrm.QC;
using Gs.DevApp.DevFrm.Rpt;
using Gs.DevApp.DevFrm.Sys;
@@ -62,8 +65,9 @@
            btnGongZi.ItemClick += BtnGongZi_ItemClick;
            btnLianBan.ItemClick += BtnLianBan_ItemClick;
            btnGx.ItemClick += BtnGx_ItemClick;
            btnWeight.ItemClick += BtnWeight_ItemClick;
            btnBaoGao.ItemClick += BtnBaoGao_ItemClick;
            btnPingZhi.ItemClick += BtnPingZhi_ItemClick;
            btnFPingZhi.ItemClick += BtnFPingZhi_ItemClick;
            var lst = new List<string>();
            foreach (BarItem item in barManager1.Items)
                if (item is BarLargeButtonItem largeButtonItem)
@@ -75,34 +79,6 @@
        /// <summary>
        /// 启动称重
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        /// <exception cref="NotImplementedException"></exception>
        private void BtnWeight_ItemClick(object sender, ItemClickEventArgs e)
        {
            bool isOpen = false;
            foreach (Form form in Application.OpenForms)
            {
                if (form is WeightIqc)
                {
                    isOpen = true;
                    //form.Activate(); // 激活已存在的窗体
                    //form.MaximizeBox = true;
                    //form.TopMost = true;
                    MsgHelper.ShowInformation("已经打开了,请勿重复打开!");
                    break;
                }
            }
            if (!isOpen)
            {
                var form = new WeightIqc();
                form.Show();
            }
        }
        /// <summary>
        ///     初始化按钮状态
        /// </summary>
        protected override void OnCreateControl()
@@ -110,7 +86,6 @@
            base.OnCreateControl();
            if (Parent != null) getNamespace();
        }
        private bool _isCk(int _type)
        {
            Form parentForm = this.FindForm();
@@ -146,13 +121,11 @@
            }
            return false;
        }
        private void BtnCaiGouFchk_ItemClick(object sender, ItemClickEventArgs e)
        {
            if (btnCaiGouFchkClick != null)
                btnCaiGouFchkClick(this, e);
        }
        private void BtnCaiGouChk_ItemClick(object sender, ItemClickEventArgs e)
        {
            if (btnCaiGouChkClick != null)
@@ -363,7 +336,6 @@
                frm.ShowDialog();
                return;
            }
            MsgHelper.ShowError("没有设计模板,请先设计模板!");
        }
@@ -403,7 +375,6 @@
            if (btnAllClick != null)
                btnAllClick(this, e);
        }
        private void BtnLianBan_ItemClick(object sender, ItemClickEventArgs e)
        {
            if (btnLianBanClick != null)
@@ -425,6 +396,17 @@
            if (btnBaoGaoClick != null)
                btnBaoGaoClick(this, e);
        }
        private void BtnFPingZhi_ItemClick(object sender, ItemClickEventArgs e)
        {
            if (btnFPingZhiClick != null)
                btnFPingZhiClick(this, e);
        }
        private void BtnPingZhi_ItemClick(object sender, ItemClickEventArgs e)
        {
            if (btnPingZhiClick != null)
                btnPingZhiClick(this, e);
        }
        /// <summary>
        /// 取消时,还原按钮可用性
        /// </summary>
@@ -464,15 +446,16 @@
                lst.Add(btnShouHouFchk.Name);
                lst.Add(btnGongZi.Name);
                lst.Add(btnLianBan.Name);
                lst.Add(btnFPingZhi.Name);
                lst.Add(btnPingZhi.Name);
                // lst.Add(btnEsc.Name);
                lst.Add(btnGx.Name);
                lst.Add(btnWeight.Name);
                lst.Add(btnBaoGao.Name);
                _enabledBtn(lst);
                this.currentAction = "esc";
                if (btnEscClick != null) btnEscClick(this, e);
            }
        }
        /// <summary>
        /// 保存成功后,还原按钮可用性
@@ -517,9 +500,11 @@
                    lst.Add(btnOut.Name);
                    lst.Add(btnGongZi.Name);
                    lst.Add(btnLianBan.Name);
                    lst.Add(btnFPingZhi.Name);
                    lst.Add(btnPingZhi.Name);
                    // lst.Add(btnEsc.Name);
                    lst.Add(btnGx.Name);
                    lst.Add(btnWeight.Name);
                    lst.Add(btnBaoGao.Name);
                    _enabledBtn(lst);
                }
            }
@@ -545,7 +530,7 @@
            lst.Add(btnLayout.Name);
            lst.Add(btnFont.Name);
            lst.Add(btnLog.Name);
            lst.Add(btnWeight.Name);
            lst.Add(btnBaoGao.Name);
            _enabledBtn(lst);
            this.currentAction = "edit";
            if (btnEdtClick != null) btnEdtClick(this, e);
@@ -573,7 +558,6 @@
            lst.Add(btnHelp.Name);
            lst.Add(btnLayout.Name);
            lst.Add(btnFont.Name);
            lst.Add(btnWeight.Name);
            _enabledBtn(lst);
            this.currentAction = "add";
            if (btnAddClick != null) btnAddClick(this, e);
@@ -786,7 +770,6 @@
                    //        continue;
                    //    }
                    //}
                    //按钮是否在权限表中
                    var exists = dt.AsEnumerable().Any(row =>
                        row.Field<string>("name") == item.Caption);
@@ -800,7 +783,6 @@
                            _enabledList.Add(_btnName);
                    }
                }
                //默认启用的按钮
                _enabledList.Add(btnLoad.Name);
                _enabledList.Add(btnHelp.Name);
@@ -1055,6 +1037,17 @@
        /// 生成报告
        /// </summary>
        public event EventHandler btnBaoGaoClick;
        /// <summary>
        ///     品质
        /// </summary>
        public event EventHandler btnPingZhiClick;
        /// <summary>
        ///    反品质
        /// </summary>
        public event EventHandler btnFPingZhiClick;
        #endregion
        #region 公共属性
@@ -1100,6 +1093,47 @@
        #endregion
        /// <summary>
        ///
        /// </summary>
        /// <param name="inType"></param>
        public void SetAllButton(int inType)
        {
            var lstBtn = new List<string>();
            if (inType == 0)
            {
                lstBtn.Add(btnSave.Name);
                lstBtn.Add(btnEsc.Name);
                foreach (BarItem item in barManager1.Items)
                    if (item is BarLargeButtonItem largeButtonItem)
                    {
                        if (!lstBtn.Contains(item.Name))
                            largeButtonItem.Enabled = true;
                        else
                            largeButtonItem.Enabled = false;
                    }
                return;
            }
            if (inType == 2)
            {
                lstBtn.Add(btnHelp.Name);
                lstBtn.Add(btnLoad.Name);
                lstBtn.Add(btnQuery.Name);
                lstBtn.Add(btnLayout.Name);
                lstBtn.Add(btnFont.Name);
                lstBtn.Add(btnAdd.Name);
                foreach (BarItem item in barManager1.Items)
                    if (item is BarLargeButtonItem largeButtonItem)
                    {
                        if (lstBtn.Contains(item.Name))
                            largeButtonItem.Enabled = true;
                        else
                            largeButtonItem.Enabled = false;
                    }
                return;
            }
        }
        /// <summary>
        /// 查找gridView
@@ -1198,7 +1232,6 @@
                parentForm = this.Parent as Form;
            else
                parentForm = this.Parent.Parent as Form;
            string _formNamespace = parentForm.GetType().FullName;
            List<DevExpress.XtraGrid.Views.Grid.GridView> gvList = getGvList();
            List<DevExpress.XtraLayout.LayoutControl> layList = getLayList();
@@ -1309,5 +1342,6 @@
                ToolBox.MsgHelper.Warning("提示:" + ex.Message);
            }
        }
    }
}