From e5e1a11d932a7d3172243ba03deedbcd68a69540 Mon Sep 17 00:00:00 2001
From: lu <99954486@qq.com>
Date: 星期三, 02 四月 2025 17:00:17 +0800
Subject: [PATCH] 现场

---
 DevApp/Gs.DevApp/DevFrm/QC/Frm_MesDefectType.cs |  130 ++++++++++++++++++-------------------------
 1 files changed, 55 insertions(+), 75 deletions(-)

diff --git a/DevApp/Gs.DevApp/DevFrm/QC/Frm_MesDefectType.cs b/DevApp/Gs.DevApp/DevFrm/QC/Frm_MesDefectType.cs
index cb61b86..1f39d22 100644
--- a/DevApp/Gs.DevApp/DevFrm/QC/Frm_MesDefectType.cs
+++ b/DevApp/Gs.DevApp/DevFrm/QC/Frm_MesDefectType.cs
@@ -24,28 +24,20 @@
             this.toolBarMenu1.btnLoadClick += ToolBarMenu1_btnLoadClick;
             this.toolBarMenu1.btnDelClick += ToolBarMenu1_btnDelClick1;
             this.toolBarMenu1.btnEscClick += ToolBarMenu1_btnEscClick;
-            this.toolBarMenu1.btnQueryClick += ToolBarMenu1_btnQueryClick;
-            gcMain.MouseDoubleClick += GcMain_MouseDoubleClick;
-            Gs.DevApp.ToolBox.UtilityHelper.SetGridSear(gridView1);
+            this.toolBarMenu1.getXmlConfig();
+            Gs.DevApp.ToolBox.UtilityHelper.SetGridViewParameter(gridView1,null, null, "", "", (value) =>
+            {
+                Gs.DevApp.ToolBox.UtilityHelper.JumpTab(xtraTabControl1, 0);
+            });
+            Gs.DevApp.ToolBox.UtilityHelper.SetTabParameter(gridView1, xtraTabControl1, pageBar1, (value) =>
+            {
+                getModel(value);
+            }, (value) =>
+            {
+                getPageList(this.pageBar1.CurrentPage);
+            });
             getPageList(1);
             pageBar1.PagerEvent += PageBar1_PagerEvent;
-        }
-        private async void GridView1_ColumnFilterChanged(object sender, EventArgs e)
-        {
-            _filterList = Gs.DevApp.ToolBox.UtilityHelper.GetDilter(gridView1.Columns);
-            await Task.Delay(100);
-            getPageList(1);
-        }
-        /// <summary>
-        /// 鍙屽嚮浜嬩欢
-        /// </summary>
-        /// <param name="sender"></param>
-        /// <param name="e"></param>
-        private void GcMain_MouseDoubleClick(object sender, MouseEventArgs e)
-        {
-            string rowGuid = Gs.DevApp.ToolBox.UtilityHelper.GetCurrentDoubleRow(gridView1, e, "guid");
-            if (!string.IsNullOrEmpty(rowGuid))
-                getModel(rowGuid, false, 999);
         }
         /// <summary>
         /// 鍒嗛〉浜嬩欢
@@ -56,31 +48,7 @@
         {
             getPageList(curPage);
         }
-        /// <summary>
-        /// 鏌ヨ浜嬩欢
-        /// </summary>
-        /// <param name="sender"></param>
-        /// <param name="e"></param>
-        private void ToolBarMenu1_btnQueryClick(object sender, EventArgs e)
-        {
-            gridView1.ColumnFilterChanged -= GridView1_ColumnFilterChanged;
-            gridView1.ActiveFilter.Clear();
-            gridView1.ColumnFilterChanged += GridView1_ColumnFilterChanged;
-            var frm = new ShowFilter(gridView1.Columns, _filterList);
-            frm.UpdateParent += Frm_UpdateParent;
-            frm.ShowDialog();
-        }
-        /// <summary>
-        /// 鏌ヨ鍥炶皟
-        /// </summary>
-        /// <param name="sender"></param>
-        /// <param name="e"></param>
-        private void Frm_UpdateParent(object sender, UpdateParentEventArgs e)
-        {
-            _filterList = e.FilterList;
-            getPageList(1);
-        }
-
+       
         /// <summary>
         /// 鍙栨秷浜嬩欢
         /// </summary>
@@ -88,7 +56,7 @@
         /// <param name="e"></param>
         private void ToolBarMenu1_btnEscClick(object sender, EventArgs e)
         {
-            UtilityHelper.JumpToTab(xtraTabControl1, 0);
+            Gs.DevApp.ToolBox.UtilityHelper.JumpTab(xtraTabControl1, 1);
         }
 
         /// <summary>
@@ -99,7 +67,7 @@
         private void ToolBarMenu1_btnDelClick1(object sender, EventArgs e)
         {
             string rowGuid = "", rowName = "";
-             (rowGuid, rowName) = UtilityHelper.GetCurrentRow(xtraTabControl1, lbGuid, txt_typeNo, gridView1, "typeNo");
+            (rowGuid, rowName) = UtilityHelper.GetCurrentRow(xtraTabControl1, lbGuid, txt_typeNo, gridView1, "typeNo");
             if (string.IsNullOrEmpty(rowGuid))
             {
                 ToolBox.MsgHelper.Warning("璇峰厛閫夋嫨浣犺鎿嶄綔鐨勮锛�");
@@ -116,8 +84,11 @@
                 ReturnModel<dynamic> _rtn = ToolBox.UtilityHelper.ReturnToDynamic(strJson);
                 if (_rtn.rtnCode > 0)
                 {
-                    UtilityHelper.JumpToTab(xtraTabControl1, 0);
-                    getPageList(1);
+                    if (xtraTabControl1.SelectedTabPageIndex == 0)
+                    { }
+                    else
+                        Gs.DevApp.ToolBox.UtilityHelper.JumpTab(xtraTabControl1, 2);
+                    getPageList(this.pageBar1.CurrentPage);
                 }
                 ToolBox.MsgHelper.Warning("鎻愮ず锛�" + _rtn.rtnMsg);
             }
@@ -135,17 +106,18 @@
         private void ToolBarMenu1_btnLoadClick(object sender, EventArgs e)
         {
             if (xtraTabControl1.SelectedTabPageIndex == 1)
-                getModel(lbGuid.Text.Trim(), false, 999);
+                getModel(lbGuid.Text.Trim());
             else
             {
-                _filterList.Clear();
-                if (gridView1.ActiveFilter.Count > 0)
-                {
-                    gridView1.ColumnFilterChanged -= GridView1_ColumnFilterChanged;
-                    gridView1.ActiveFilter.Clear();
-                    gridView1.ColumnFilterChanged += GridView1_ColumnFilterChanged;
-                }
-                getPageList(1);
+                //_filterList.Clear();
+                //if (gridView1.ActiveFilter.Count > 0)
+                //{
+                //    gridView1.ColumnFilterChanged -= GridView1_ColumnFilterChanged;
+                //    gridView1.ActiveFilter.Clear();
+                //    gridView1.ColumnFilterChanged += GridView1_ColumnFilterChanged;
+                //}
+                //getPageList(1);
+                getPageList(this.pageBar1.CurrentPage);
             }
         }
         /// <summary>
@@ -162,7 +134,15 @@
                 ToolBox.MsgHelper.Warning("璇峰厛閫夋嫨浣犺鎿嶄綔鐨勮锛�");
                 return;
             }
-            getModel(rowGuid, true, 1);
+            Gs.DevApp.ToolBox.UtilityHelper.JumpTab(xtraTabControl1, 3);
+            if (xtraTabControl1.SelectedTabPageIndex == 1)
+            {
+                getModel(rowGuid);
+            }
+            else
+            {
+                UtilityHelper.ChangeEnableByControl(this.layoutMx1.Controls, true);
+            }
         }
         /// <summary>
         /// 鏂板浜嬩欢
@@ -171,10 +151,9 @@
         /// <param name="e"></param>
         private void ToolBarMenu1_btnAddClick(object sender, EventArgs e)
         {
-            UtilityHelper.JumpToTab(xtraTabControl1, 1);
             lbGuid.Text = "";
-            UtilityHelper.CleanValueByControl(this.panel1.Controls, true);
-
+            Gs.DevApp.ToolBox.UtilityHelper.JumpTab(xtraTabControl1, 4);
+            UtilityHelper.CleanValueByControl(this.layoutMx1.Controls, true);
         }
         /// <summary>
         /// 淇濆瓨浜嬩欢
@@ -193,8 +172,8 @@
             var _obj = new MesDefectType()
             {
                 Guid = UtilityHelper.ToGuid(lbGuid.Text.Trim()),
-                TypeNo=txt_typeNo.Text.Trim(),
-                TypeMemo=txt_typeMemo.Text.Trim(),
+                TypeNo = txt_typeNo.Text.Trim(),
+                TypeMemo = txt_typeMemo.Text.Trim(),
             };
             try
             {
@@ -205,7 +184,8 @@
                 {
                     lbGuid.Text = _rtn.rtnData;
                     toolBarMenu1.isSetBtn = true;
-                    UtilityHelper.ChangeEnableByControl(this.panel1.Controls, false);
+                    UtilityHelper.ChangeEnableByControl(this.layoutMx1.Controls, false);
+                    toolBarMenu1.currentAction = "";
                 }
             }
             catch (Exception ex)
@@ -221,7 +201,6 @@
         /// <param name="pageSize">姣忛〉鍑犳潯</param>
         private void getPageList(int curPage)
         {
-
             var _sbSqlWhere = UtilityHelper.GetSearchWhere(_filterList);
             var pgq = new PageQueryModel(curPage, this.pageBar1.RowsCount, "a.type_no",
             "asc", "", _sbSqlWhere.ToString());
@@ -234,16 +213,15 @@
                 if (dd.rtnCode > 0)
                 {
                     DataTable dt = dd.rtnData.list;
-                    gcMain.BindingContext = new BindingContext();
-                    gridView1.ColumnFilterChanged -= GridView1_ColumnFilterChanged;
+                    gcMain1.BindingContext = new BindingContext();
                     if (dt.Rows.Count > 0)
                     {
-                        gcMain.DataSource = dt;
-                        gcMain.ForceInitialize();
+                        gcMain1.DataSource = dt;
+                        gcMain1.ForceInitialize();
+                        gridView1.BestFitColumns(); Gs.DevApp.ToolBox.UtilityHelper.SetGridLayout(gridView1);
                     }
                     else
-                        UtilityHelper.SetDefaultTable(gcMain, gridView1);
-                    gridView1.ColumnFilterChanged += GridView1_ColumnFilterChanged;
+                        UtilityHelper.SetDefaultTable(gcMain1, gridView1);
                     pageBar1.TotalPages = dd.rtnData.pages;//鎬婚〉
                     pageBar1.CurrentPage = curPage;//褰撳墠椤�
                     pageBar1.RecordCount = dd.rtnData.total;//鎬昏褰曟暟
@@ -265,14 +243,16 @@
         /// <param name="strGuid">涓婚敭</param>
         /// <param name="isEdit">鏄惁鍙紪杈�</param>
         /// <param name="tabIdx">閫夐」鍗″簭鍙�</param>
-        private void getModel(string strGuid, bool isEdit, int tabIdx)
+        private void getModel(string strGuid)
         {
+            bool isEdit = false;
+            if (toolBarMenu1.currentAction == "add") return;
+            if (toolBarMenu1.currentAction == "edit") isEdit = true;
             if (string.IsNullOrEmpty(strGuid))
             {
                 ToolBox.MsgHelper.Warning("璇峰厛閫夋嫨浣犺鎿嶄綔鐨勮锛�");
                 return;
             }
-            UtilityHelper.JumpToTab(xtraTabControl1, tabIdx);
             var _obj = new
             {
                 guid = strGuid,//涓诲缓
@@ -285,7 +265,7 @@
                 {
                     dynamic dy = _rtn.rtnData;
                     lbGuid.Text = strGuid;
-                    UtilityHelper.SetValueByObj(this.panel1.Controls, dy, isEdit);
+                    UtilityHelper.SetValueByObj(this.layoutMx1.Controls, dy, isEdit);
 
                 }
                 else

--
Gitblit v1.9.3