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/DevFrm/QC/Frm_MesQmCheckitemDt.cs |  213 ++++++++++++++++++++++++++++-------------------------
 1 files changed, 113 insertions(+), 100 deletions(-)

diff --git a/DevApp/Gs.DevApp/DevFrm/QC/Frm_MesQmCheckitemDt.cs b/DevApp/Gs.DevApp/DevFrm/QC/Frm_MesQmCheckitemDt.cs
index a253ac4..a61d089 100644
--- a/DevApp/Gs.DevApp/DevFrm/QC/Frm_MesQmCheckitemDt.cs
+++ b/DevApp/Gs.DevApp/DevFrm/QC/Frm_MesQmCheckitemDt.cs
@@ -31,33 +31,48 @@
             toolBarMenu1.btnQueryClick += ToolBarMenu1_btnQueryClick;
             toolBarMenu1.btnChkClick += ToolBarMenu1_btnChkClick;
             toolBarMenu1.btnPiZhunClick += ToolBarMenu1_btnPiZhunClick;
-            gcMain.MouseDoubleClick += GcMain_MouseDoubleClick;
-            Gs.DevApp.ToolBox.UtilityHelper.SetGridSear(gridView1, picCheckBox, this, "foneChecked", "");
-            Gs.DevApp.ToolBox.UtilityHelper.SetGridSearMx(gvMx1);
+            Gs.DevApp.ToolBox.UtilityHelper.SetGridViewParameterMx(gvMx1);
+            Gs.DevApp.ToolBox.UtilityHelper.SetGridViewParameter(gridView1, picCheckBox, this, "foneChecked", "", (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;
             _setIno();
+            btnSelect.Click += (s, e) =>
+            {
+                var frm = new SelectCheckDt("jyxm");
+                frm.UpdateParent += (ss, ee) =>
+                {
+                    var lst = ee.DynamicList;
+                    var json = JsonConvert.SerializeObject(lst);
+                    DataTable _newTable = (DataTable)JsonConvert.DeserializeObject(json, (typeof(DataTable)));
+                    DataTable _oldTable = (DataTable)gridControl2.DataSource;
+                    DataRow[] sourceRows = _newTable.Select();
+                    for (int i = 0; i < sourceRows.Length; i++)
+                    {
+                        _oldTable.ImportRow(sourceRows[i]);
+                    }
+                    gridControl2.BindingContext = new BindingContext();
+                    gridControl2.DataSource = _oldTable;
+                    gridControl2.ForceInitialize();
+                };
+                frm.ShowDialog();
+            };
             btnSave.Click += BtnSave_Click;
         }
-
         private void GridView1_ColumnFilterChanged(object sender, EventArgs e)
         {
             _filterList = Gs.DevApp.ToolBox.UtilityHelper.GetDilter(gridView1.Columns);
             Task.Delay(100);
             getPageList(1);
-        }
-        /// <summary>
-        ///     鍙屽嚮浜嬩欢
-        /// </summary>
-        /// <param name="sender"></param>
-        /// <param name="e"></param>
-        private void GcMain_MouseDoubleClick(object sender, MouseEventArgs e)
-        {
-            var rowGuid =
-                UtilityHelper.GetCurrentDoubleRow(gridView1,
-                    e, "guid");
-            if (!string.IsNullOrEmpty(rowGuid))
-                getModel(rowGuid, false, 999);
         }
 
         /// <summary>
@@ -142,7 +157,7 @@
         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();
@@ -170,8 +185,18 @@
                 MsgHelper.Warning("璇峰厛閫夋嫨浣犺鎿嶄綔鐨勮锛�");
                 return;
             }
-            getModel(rowGuid, true, 1);
-
+            Gs.DevApp.ToolBox.UtilityHelper.JumpTab(xtraTabControl1, 3);
+            if (xtraTabControl1.SelectedTabPageIndex == 1)
+            {
+                getModel(rowGuid);
+            }
+            else
+            {
+                List<DevExpress.XtraGrid.Views.Grid.GridView> gvList = new List<DevExpress.XtraGrid.Views.Grid.GridView>();
+                gvList.Add(gvMx1);
+                gvList.Add(gridView2);
+                UtilityHelper.ChangeEnableByControl(panel1.Controls, true, gvList);
+            }
         }
 
         /// <summary>
@@ -181,13 +206,12 @@
         /// <param name="e"></param>
         private void ToolBarMenu1_btnAddClick(object sender, EventArgs e)
         {
-            UtilityHelper.JumpToTab(xtraTabControl1, 1);
             lbGuid.Text = "";
-            var gridViews =
-                new List<GridView>();
+            Gs.DevApp.ToolBox.UtilityHelper.JumpTab(xtraTabControl1, 4);
+            var gridViews = new List<GridView>();
             gridViews.Add(gvMx1);
-            UtilityHelper.CleanValueByControl(panel1.Controls, true,
-                gridViews);
+            gridViews.Add(gridView2);
+            UtilityHelper.CleanValueByControl(panel1.Controls, true, gridViews);
             UtilityHelper.SetDefaultTable(gcMx1, gvMx1);
             xtraTabPageCopy.PageEnabled = false;
         }
@@ -209,59 +233,67 @@
             }
             gvMx1.CloseEditor();
             gvMx1.UpdateCurrentRow();
-            var lst = new List<MesQmCheckitemDt>();
-            for (var i = 0; i < gvMx1.DataRowCount; i++)
-            {
-                var row = gvMx1.GetDataRow(i);
-                if (row != null)
-                    lst.Add(new MesQmCheckitemDt
-                    {
-                        Guid = UtilityHelper.ToGuid(row["guid"].ToString()),
-                        Forder = 1,
-                        FcheckItem = row["FcheckItem"].ToString(),
-                        SampleSizeNo = row["SampleSizeNo"].ToString(),
-                        FcheckTool = row["FcheckTool"].ToString(),
-                        FcheckLevel = row["FcheckLevel"].ToString(),
-                        Fstand = row["Fstand"].ToString(),
-                        FacLevel = row["FacLevel"].ToString(),
-                        FspecRequ = row["FspecRequ"].ToString(),
-                        Memo = row["memo"].ToString(),
-                        FupAllow = row["FupAllow"].ToString(),
-                        FdownAllow = row["FdownAllow"].ToString(),
-                    });
-            }
-            var _obj = new MesQmCheckitem
-            {
-                Guid = UtilityHelper.ToGuid(lbGuid.Text.Trim()),
-                ItemId = long.Parse(_ItemId),
-                Memo = txt_memo.Text.Trim(),
-                ItemNo = txt_itemNo.Text.Trim(),
-                Ftype = "1",
-                Fversion = Gs.DevApp.ToolBox.UtilityHelper.ToLong(txt_fversion.Text.Trim()),
-                list = lst
-            };
             try
             {
-                var strJson = UtilityHelper.HttpPost("",
-                    _webServiceName + "EditModel",
-                    JsonConvert.SerializeObject(_obj));
-                var _rtn =
-                    UtilityHelper.ReturnToDynamic(strJson);
-                MsgHelper.Warning("鎻愮ず锛�" + _rtn.rtnMsg);
-                if (_rtn.rtnCode > 0)
+                var lst = new List<MesQmCheckitemDt>();
+                for (var i = 0; i < gvMx1.DataRowCount; i++)
                 {
-                    lbGuid.Text = _rtn.rtnData;
-                    toolBarMenu1.isSetBtn = true;
-                    var gridViews = new List<GridView>();
-                    gridViews.Add(gvMx1);
-                    UtilityHelper.ChangeEnableByControl(panel1.Controls, false,
-                        gridViews);
+                    var row = gvMx1.GetDataRow(i);
+                    if (row != null)
+                        lst.Add(new MesQmCheckitemDt
+                        {
+                            Guid = UtilityHelper.ToGuid(row["guid"].ToString()),
+                            Forder = int.Parse(row["forder"].ToString()),
+                            FcheckItem = row["FcheckItem"].ToString(),
+                            SampleSizeNo = row["SampleSizeNo"].ToString(),
+                            FcheckTool = row["FcheckTool"].ToString(),
+                            FcheckLevel = row["FcheckLevel"].ToString(),
+                            Fstand = row["Fstand"].ToString(),
+                            FacLevel = row["FacLevel"].ToString(),
+                            FspecRequ = row["FspecRequ"].ToString(),
+                            Memo = row["memo"].ToString(),
+                            FupAllow = row["FupAllow"].ToString(),
+                            FdownAllow = row["FdownAllow"].ToString(),
+                        });
+                }
+                var _obj = new MesQmCheckitem
+                {
+                    Guid = UtilityHelper.ToGuid(lbGuid.Text.Trim()),
+                    ItemId = long.Parse(_ItemId),
+                    Memo = txt_memo.Text.Trim(),
+                    ItemNo = txt_itemNo.Text.Trim(),
+                    Ftype = "1",
+                    Fversion = Gs.DevApp.ToolBox.UtilityHelper.ToLong(txt_fversion.Text.Trim()),
+                    list = lst
+                };
+                try
+                {
+                    var strJson = UtilityHelper.HttpPost("",
+                        _webServiceName + "EditModel",
+                        JsonConvert.SerializeObject(_obj));
+                    var _rtn =
+                        UtilityHelper.ReturnToDynamic(strJson);
+                    MsgHelper.Warning("鎻愮ず锛�" + _rtn.rtnMsg);
+                    if (_rtn.rtnCode > 0)
+                    {
+                        lbGuid.Text = _rtn.rtnData;
+                        toolBarMenu1.isSetBtn = true;
+                        var gridViews = new List<GridView>();
+                        gridViews.Add(gvMx1);
+                        gridViews.Add(gridView2);
+                        UtilityHelper.ChangeEnableByControl(panel1.Controls, false, gridViews);
+                    }
+                }
+                catch (Exception ex)
+                {
+                    MsgHelper.Warning("鎻愮ず锛�" + ex.Message);
                 }
             }
             catch (Exception ex)
             {
-                MsgHelper.Warning("鎻愮ず锛�" + ex.Message);
+                MsgHelper.ShowError("鎻愮ず锛�" + ex.Message);
             }
+
         }
 
         /// <summary>
@@ -271,6 +303,7 @@
         private void getPageList(int curPage)
         {
             var _sbSqlWhere = UtilityHelper.GetSearchWhere(_filterList);
+            _sbSqlWhere += " and b.guid is not null";
             var pgq = new PageQueryModel(curPage, this.pageBar1.RowsCount,
                 "a.create_date", "asc", "", _sbSqlWhere.ToString());
             var json = JsonConvert.SerializeObject(pgq);
@@ -309,14 +342,16 @@
 
         }
 
-        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))
             {
                 MsgHelper.Warning("璇峰厛閫夋嫨浣犺鎿嶄綔鐨勮锛�");
                 return;
             }
-            UtilityHelper.JumpToTab(xtraTabControl1, tabIdx);
             xtraTabPageCopy.PageEnabled = !isEdit;
             var _obj = new
             {
@@ -325,7 +360,6 @@
             try
             {
                 var strJson = UtilityHelper.HttpPost("",
-                         // _webServiceName + "GetModelIQC",
                          _webServiceName + "GetModel",
                     JsonConvert.SerializeObject(_obj));
                 var _rtn =
@@ -353,11 +387,9 @@
                     }
                     else
                     {
-                        UtilityHelper.SetDefaultTable(gcMx1,
-                            gvMx1);
+                        UtilityHelper.SetDefaultTable(gcMx1, gvMx1);
                     }
-                    UtilityHelper.SetDefaultTable(gridControl2,
-                         gridView2);
+                    UtilityHelper.SetDefaultTable(gridControl2, gridView2);
                 }
                 else
                 {
@@ -415,9 +447,9 @@
                 if (_rtn.rtnCode > 0 && _rtn.rtnData.outSum * 1 > 0)
                 {
                     if (xtraTabControl1.SelectedTabPageIndex == 1)
-                        getModel(lbGuid.Text.Trim(), false, 999);
+                        getModel(lbGuid.Text.Trim());
                     else
-                        getPageList(1);
+                        getPageList(this.pageBar1.CurrentPage);
                 }
             }
             catch (Exception ex)
@@ -436,26 +468,7 @@
                 txt_itemModel.Text = this.txt_ItemId.GetModel();
                 txt_itemNo.Text = this.txt_ItemId.GetCode();
             };
-            btnSelect.Click += (s, e) =>
-            {
-                var frm = new SelectCheckDt();
-                frm.UpdateParent += (ss, ee) =>
-                {
-                    var lst = ee.DynamicList;
-                    var json = JsonConvert.SerializeObject(lst);
-                    DataTable _newTable = (DataTable)JsonConvert.DeserializeObject(json, (typeof(DataTable)));
-                    DataTable _oldTable = (DataTable)gridControl2.DataSource;
-                    DataRow[] sourceRows = _newTable.Select();
-                    for (int i = 0; i < sourceRows.Length; i++)
-                    {
-                        _oldTable.ImportRow(sourceRows[i]);
-                    }
-                    gridControl2.BindingContext = new BindingContext();
-                    gridControl2.DataSource = _oldTable;
-                    gridControl2.ForceInitialize();
-                };
-                frm.ShowDialog();
-            };
+          
             _getListJyxm();
             _getListJygj();
             _getListJybz();
@@ -619,7 +632,7 @@
                         _webServiceName + "DeleteModelMx",
                         JsonConvert.SerializeObject(lst));
                     var _rtn = UtilityHelper.ReturnToDynamic(strJson);
-                    if (_rtn.rtnCode > 0) getModel(lbGuid.Text, true, 1);
+                    if (_rtn.rtnCode > 0) getModel(lbGuid.Text);
                     MsgHelper.Warning("鎻愮ず锛�" + _rtn.rtnMsg);
                 }
                 catch (Exception ex)

--
Gitblit v1.9.3