From 8d44a6ea0ab8850f0d95ea97880fc08d7851c5f7 Mon Sep 17 00:00:00 2001
From: lu <99954486@qq.com>
Date: 星期六, 14 十二月 2024 21:49:02 +0800
Subject: [PATCH] 1

---
 DevApp/Gs.DevApp/DevFrm/QiTa/Frm_MesItemTbl.cs          |  142 +++++++++++++++++++++++++++++++++--
 DevApp/Gs.DevApp/App.config                             |    4 
 DevApp/Gs.DevApp/DevFrm/QiTa/Frm_MesItemTbl.Designer.cs |   53 +++++++++++++
 DevApp/Gs.DevApp/ToolBox/UtilityHelper.cs               |    6 
 4 files changed, 189 insertions(+), 16 deletions(-)

diff --git a/DevApp/Gs.DevApp/App.config b/DevApp/Gs.DevApp/App.config
index 3ac99d8..e695006 100644
--- a/DevApp/Gs.DevApp/App.config
+++ b/DevApp/Gs.DevApp/App.config
@@ -28,8 +28,8 @@
 		</assemblyBinding>
 	</runtime>
     <appSettings>
-		 <add key="WebApiUrl" value="http://localhost:5263/" />
-	     <!--<add key="WebApiUrl" value="http://192.168.1.145:81/" />--> 
+		<!-- <add key="WebApiUrl" value="http://localhost:5263/" />-->
+		<add key="WebApiUrl" value="http://192.168.1.145:81/" /> 
         <add key="LogPath" value="logs" />
         <add key="ProductName" value="骞挎繁绉戞妧 G-MES V2.0" />
         <add key="PageSize" value="50" />
diff --git a/DevApp/Gs.DevApp/DevFrm/QiTa/Frm_MesItemTbl.Designer.cs b/DevApp/Gs.DevApp/DevFrm/QiTa/Frm_MesItemTbl.Designer.cs
index 2c93a3d..d2c11cc 100644
--- a/DevApp/Gs.DevApp/DevFrm/QiTa/Frm_MesItemTbl.Designer.cs
+++ b/DevApp/Gs.DevApp/DevFrm/QiTa/Frm_MesItemTbl.Designer.cs
@@ -29,6 +29,11 @@
         /// </summary>
         private void InitializeComponent()
         {
+            DevExpress.XtraEditors.Controls.EditorButtonImageOptions editorButtonImageOptions1 = new DevExpress.XtraEditors.Controls.EditorButtonImageOptions();
+            DevExpress.Utils.SerializableAppearanceObject serializableAppearanceObject1 = new DevExpress.Utils.SerializableAppearanceObject();
+            DevExpress.Utils.SerializableAppearanceObject serializableAppearanceObject2 = new DevExpress.Utils.SerializableAppearanceObject();
+            DevExpress.Utils.SerializableAppearanceObject serializableAppearanceObject3 = new DevExpress.Utils.SerializableAppearanceObject();
+            DevExpress.Utils.SerializableAppearanceObject serializableAppearanceObject4 = new DevExpress.Utils.SerializableAppearanceObject();
             this.gvMx1tld009 = new DevExpress.XtraGrid.Columns.GridColumn();
             this.gvMx1tld007 = new DevExpress.XtraGrid.Columns.GridColumn();
             this.gvMx1tld006 = new DevExpress.XtraGrid.Columns.GridColumn();
@@ -44,6 +49,8 @@
             this.gridColumn3 = new DevExpress.XtraGrid.Columns.GridColumn();
             this.gridColumn1 = new DevExpress.XtraGrid.Columns.GridColumn();
             this.gridColumn2 = new DevExpress.XtraGrid.Columns.GridColumn();
+            this.gvMxDel = new DevExpress.XtraGrid.Columns.GridColumn();
+            this.repositoryItemButtonEdit1 = new DevExpress.XtraEditors.Repository.RepositoryItemButtonEdit();
             this.panelMx1 = new DevExpress.XtraEditors.PanelControl();
             this.lbMxGuid = new DevExpress.XtraEditors.LabelControl();
             this.txt_iCount_1 = new DevExpress.XtraEditors.TextEdit();
@@ -124,9 +131,11 @@
             this.btnSelect = new DevExpress.XtraEditors.SimpleButton();
             this.labelControl11 = new DevExpress.XtraEditors.LabelControl();
             this.lbGuid = new System.Windows.Forms.Label();
+            this.picCheckBox = new System.Windows.Forms.PictureBox();
             this.tabMxPage1.SuspendLayout();
             ((System.ComponentModel.ISupportInitialize)(this.gcMx1)).BeginInit();
             ((System.ComponentModel.ISupportInitialize)(this.gvMx1)).BeginInit();
+            ((System.ComponentModel.ISupportInitialize)(this.repositoryItemButtonEdit1)).BeginInit();
             ((System.ComponentModel.ISupportInitialize)(this.panelMx1)).BeginInit();
             this.panelMx1.SuspendLayout();
             ((System.ComponentModel.ISupportInitialize)(this.txt_iCount_1.Properties)).BeginInit();
@@ -157,6 +166,7 @@
             ((System.ComponentModel.ISupportInitialize)(this.txt_tbl020.Properties)).BeginInit();
             ((System.ComponentModel.ISupportInitialize)(this.txt_tbl013.Properties)).BeginInit();
             ((System.ComponentModel.ISupportInitialize)(this.txt_tbl005.Properties)).BeginInit();
+            ((System.ComponentModel.ISupportInitialize)(this.picCheckBox)).BeginInit();
             this.SuspendLayout();
             // 
             // gvMx1tld009
@@ -290,6 +300,8 @@
             this.gcMx1.Location = new System.Drawing.Point(0, 98);
             this.gcMx1.MainView = this.gvMx1;
             this.gcMx1.Name = "gcMx1";
+            this.gcMx1.RepositoryItems.AddRange(new DevExpress.XtraEditors.Repository.RepositoryItem[] {
+            this.repositoryItemButtonEdit1});
             this.gcMx1.Size = new System.Drawing.Size(1124, 272);
             this.gcMx1.TabIndex = 0;
             this.gcMx1.ViewCollection.AddRange(new DevExpress.XtraGrid.Views.Base.BaseView[] {
@@ -309,7 +321,8 @@
             this.gvMx1tld007,
             this.gvMx1tld009,
             this.gridColumn1,
-            this.gridColumn2});
+            this.gridColumn2,
+            this.gvMxDel});
             this.gvMx1.GridControl = this.gcMx1;
             this.gvMx1.Name = "gvMx1";
             this.gvMx1.OptionsBehavior.AllowAddRows = DevExpress.Utils.DefaultBoolean.True;
@@ -344,6 +357,27 @@
             this.gridColumn2.Visible = true;
             this.gridColumn2.VisibleIndex = 10;
             this.gridColumn2.Width = 94;
+            // 
+            // gvMxDel
+            // 
+            this.gvMxDel.Caption = "绉诲嚭";
+            this.gvMxDel.ColumnEdit = this.repositoryItemButtonEdit1;
+            this.gvMxDel.MinWidth = 25;
+            this.gvMxDel.Name = "gvMxDel";
+            this.gvMxDel.Visible = true;
+            this.gvMxDel.VisibleIndex = 12;
+            this.gvMxDel.Width = 94;
+            // 
+            // repositoryItemButtonEdit1
+            // 
+            this.repositoryItemButtonEdit1.AutoHeight = false;
+            editorButtonImageOptions1.Image = global::Gs.DevApp.Properties.Resources.removegroupfooter_16x16;
+            editorButtonImageOptions1.ImageToTextAlignment = DevExpress.XtraEditors.ImageAlignToText.LeftCenter;
+            this.repositoryItemButtonEdit1.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] {
+            new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Glyph, "绉诲嚭", -1, true, true, false, editorButtonImageOptions1, new DevExpress.Utils.KeyShortcut(System.Windows.Forms.Keys.None), serializableAppearanceObject1, serializableAppearanceObject2, serializableAppearanceObject3, serializableAppearanceObject4, "", null, null, DevExpress.Utils.ToolTipAnchor.Default)});
+            this.repositoryItemButtonEdit1.Name = "repositoryItemButtonEdit1";
+            this.repositoryItemButtonEdit1.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.HideTextEditor;
+            this.repositoryItemButtonEdit1.ButtonClick += new DevExpress.XtraEditors.Controls.ButtonPressedEventHandler(this.repositoryItemButtonEdit1_ButtonClick);
             // 
             // panelMx1
             // 
@@ -1296,17 +1330,30 @@
             this.lbGuid.TabIndex = 1;
             this.lbGuid.Visible = false;
             // 
+            // picCheckBox
+            // 
+            this.picCheckBox.Image = global::Gs.DevApp.Properties.Resources.ico_noCheck;
+            this.picCheckBox.Location = new System.Drawing.Point(1016, 45);
+            this.picCheckBox.Name = "picCheckBox";
+            this.picCheckBox.Size = new System.Drawing.Size(100, 50);
+            this.picCheckBox.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
+            this.picCheckBox.TabIndex = 5;
+            this.picCheckBox.TabStop = false;
+            this.picCheckBox.Visible = false;
+            // 
             // Frm_MesItemTbl
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 18F);
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
             this.ClientSize = new System.Drawing.Size(1128, 704);
+            this.Controls.Add(this.picCheckBox);
             this.Controls.Add(this.xtraTabControl1);
             this.Controls.Add(this.toolBarMenu1);
             this.Name = "Frm_MesItemTbl";
             this.tabMxPage1.ResumeLayout(false);
             ((System.ComponentModel.ISupportInitialize)(this.gcMx1)).EndInit();
             ((System.ComponentModel.ISupportInitialize)(this.gvMx1)).EndInit();
+            ((System.ComponentModel.ISupportInitialize)(this.repositoryItemButtonEdit1)).EndInit();
             ((System.ComponentModel.ISupportInitialize)(this.panelMx1)).EndInit();
             this.panelMx1.ResumeLayout(false);
             this.panelMx1.PerformLayout();
@@ -1339,6 +1386,7 @@
             ((System.ComponentModel.ISupportInitialize)(this.txt_tbl020.Properties)).EndInit();
             ((System.ComponentModel.ISupportInitialize)(this.txt_tbl013.Properties)).EndInit();
             ((System.ComponentModel.ISupportInitialize)(this.txt_tbl005.Properties)).EndInit();
+            ((System.ComponentModel.ISupportInitialize)(this.picCheckBox)).EndInit();
             this.ResumeLayout(false);
 
         }
@@ -1450,5 +1498,8 @@
         private DevExpress.XtraEditors.CheckEdit txt_tbl020;
         private DevExpress.XtraEditors.CheckEdit txt_tbl013;
         private DevExpress.XtraGrid.Columns.GridColumn gridColumn3;
+        private DevExpress.XtraGrid.Columns.GridColumn gvMxDel;
+        private DevExpress.XtraEditors.Repository.RepositoryItemButtonEdit repositoryItemButtonEdit1;
+        private System.Windows.Forms.PictureBox picCheckBox;
     }
 }
\ No newline at end of file
diff --git a/DevApp/Gs.DevApp/DevFrm/QiTa/Frm_MesItemTbl.cs b/DevApp/Gs.DevApp/DevFrm/QiTa/Frm_MesItemTbl.cs
index d535da3..6230111 100644
--- a/DevApp/Gs.DevApp/DevFrm/QiTa/Frm_MesItemTbl.cs
+++ b/DevApp/Gs.DevApp/DevFrm/QiTa/Frm_MesItemTbl.cs
@@ -25,8 +25,10 @@
             this.toolBarMenu1.btnDelClick += ToolBarMenu1_btnDelClick1;
             this.toolBarMenu1.btnEscClick += ToolBarMenu1_btnEscClick;
             this.toolBarMenu1.btnQueryClick += ToolBarMenu1_btnQueryClick;
+            toolBarMenu1.btnChkClick += ToolBarMenu1_btnChkClick;
+            toolBarMenu1.btnFChkClick += ToolBarMenu1_btnFChkClick;
             gcMain.MouseDoubleClick += GcMain_MouseDoubleClick;
-            Gs.DevApp.ToolBox.UtilityHelper.SetGridSear(gridView1);
+            Gs.DevApp.ToolBox.UtilityHelper.SetGridSear(gridView1, picCheckBox, this, "tbl013");
             getPageList(1);
             pageBar1.PagerEvent += PageBar1_PagerEvent;
             //閫夋嫨闇�瑕佸叆搴撶殑鏄庣粏
@@ -120,7 +122,26 @@
             _filterList = e.FilterList;
             getPageList(1);
         }
+        /// <summary>
+        ///     瀹℃牳浜嬩欢
+        /// </summary>
+        /// <param name="sender"></param>
+        /// <param name="e"></param>
+        private void ToolBarMenu1_btnChkClick(object sender, EventArgs e)
+        {
+            _toolCk(1);
+        }
 
+        /// <summary>
+        ///     鍙嶅鏍�
+        /// </summary>
+        /// <param name="sender"></param>
+        /// <param name="e"></param>
+        /// <exception cref="NotImplementedException"></exception>
+        private void ToolBarMenu1_btnFChkClick(object sender, EventArgs e)
+        {
+            _toolCk(0);
+        }
         /// <summary>
         /// 鍙栨秷浜嬩欢
         /// </summary>
@@ -139,31 +160,37 @@
         private void ToolBarMenu1_btnDelClick1(object sender, EventArgs e)
         {
             string rowGuid = "", rowName = "";
-            (rowGuid, rowName) = UtilityHelper.GetCurrentRow(xtraTabControl1, lbGuid, txt_billNo, gridView1);
+            (rowGuid, rowName) = UtilityHelper.GetCurrentRow(xtraTabControl1,
+                lbGuid, txt_billNo, gridView1, "billNo");
             if (string.IsNullOrEmpty(rowGuid))
             {
-                ToolBox.MsgHelper.Warning("璇峰厛閫夋嫨浣犺鎿嶄綔鐨勮锛�");
+                MsgHelper.Warning("璇峰厛閫夋嫨浣犺鎿嶄綔鐨勮锛�");
                 return;
             }
             if (!MsgHelper.AskQuestion("浣犻�夋嫨浜嗐��" + rowName + "銆戯紝纭畾鍒犻櫎鍚楋紵"))
                 return;
-            List<dynamic> lst = new List<dynamic>();
-            lst.Add(rowGuid);
-            var _obj = lst;
+            var _obj = new
+            {
+                guid = rowGuid,
+                mxGuid = Guid.Empty.ToString(),
+            };
             try
             {
-                string strJson = UtilityHelper.HttpPost("", _webServiceName + "DeleteModel", JsonConvert.SerializeObject(_obj));
-                ReturnModel<dynamic> _rtn = ToolBox.UtilityHelper.ReturnToDynamic(strJson);
+                var strJson = UtilityHelper.HttpPost("",
+                    _webServiceName + "DeleteModelOrMx",
+                    JsonConvert.SerializeObject(_obj));
+                var _rtn = UtilityHelper.ReturnToDynamic(strJson);
                 if (_rtn.rtnCode > 0)
                 {
                     UtilityHelper.JumpToTab(xtraTabControl1, 0);
                     getPageList(1);
                 }
-                ToolBox.MsgHelper.Warning("鎻愮ず锛�" + _rtn.rtnMsg);
+
+                MsgHelper.Warning("鎻愮ず锛�" + _rtn.rtnMsg);
             }
             catch (Exception ex)
             {
-                ToolBox.MsgHelper.Warning("鎻愮ず锛�" + ex.Message);
+                MsgHelper.Warning("鎻愮ず锛�" + ex.Message);
             }
         }
 
@@ -383,5 +410,100 @@
                 ToolBox.MsgHelper.Warning("鎻愮ず锛�" + ex.Message);
             }
         }
+
+        private void repositoryItemButtonEdit1_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
+        {
+            var rowhandle = gvMx1.FocusedRowHandle;
+            if (rowhandle < 0)
+                return;
+            if (e.Button.Index == 0)
+            {
+                var dr = gvMx1.GetDataRow(rowhandle);
+                var mxGuid = dr["tlid"].ToString();
+                if (!MsgHelper.AskQuestion("浣犻�夋嫨浜�1鏉℃暟鎹紝纭畾鍒犻櫎鍚楋紵"))
+                    return;
+                if (string.IsNullOrEmpty(mxGuid))
+                {
+                    gvMx1.DeleteRow(rowhandle);
+                    return;
+                }
+                var _obj = new
+                {
+                    guid = lbGuid.Text.Trim(),
+                    mxGuid = mxGuid,
+                };
+                try
+                {
+                    var strJson = UtilityHelper.HttpPost("",
+                        _webServiceName + "DeleteModelOrMx",
+                        JsonConvert.SerializeObject(_obj));
+                    var _rtn = UtilityHelper.ReturnToDynamic(strJson);
+                    if (_rtn.rtnCode > 0)
+                    {
+                        if (_rtn.rtnCode > 0) getModel(lbGuid.Text, true, 1);
+                    }
+                    MsgHelper.Warning("鎻愮ず锛�" + _rtn.rtnMsg);
+                }
+                catch (Exception ex)
+                {
+                    MsgHelper.Warning("鎻愮ず锛�" + ex.Message);
+                }
+            }
+        }
+
+
+        /// <summary>
+        /// 宸ュ叿鏉′簨浠�
+        /// </summary>
+        /// <param name="inFieldValue"></param>
+        private void _toolCk(int _inFieldValue)
+        {
+            string strMsg = "";
+            switch (_inFieldValue)
+            {
+                case 1:
+                    strMsg = "瀹℃牳";
+                    break;
+                case 0:
+                    strMsg = "鍙嶅鏍�";
+                    break;
+            };
+            toolBarMenu1.guidKey = "";
+            string rowGuid, rowName;
+            (rowGuid, rowName) = UtilityHelper.GetCurrentRow(xtraTabControl1, lbGuid, txt_billNo, gridView1, "billNo");
+            if (string.IsNullOrEmpty(rowGuid))
+            {
+                MsgHelper.Warning("璇峰厛閫夋嫨浣犺鎿嶄綔鐨勮锛�");
+                return;
+            }
+            if (!MsgHelper.AskQuestion("浣犻�夋嫨浜嗐��" + rowName + "銆戯紝纭畾" + strMsg + "鍚楋紵"))
+                return;
+
+            var _obj = new
+            {
+                guid = rowGuid,
+                inFieldValue = _inFieldValue,
+            };
+            try
+            {
+                var strJson = UtilityHelper.HttpPost("",
+                    _webServiceName + "EditModelSubmit",
+                    JsonConvert.SerializeObject(_obj));
+                var _rtn = UtilityHelper.ReturnToDynamic(strJson);
+                MsgHelper.Warning(_rtn.rtnData.outMsg.ToString());
+                if (_rtn.rtnCode > 0)
+                {
+                    if (xtraTabControl1.SelectedTabPageIndex == 1)
+                        getModel(lbGuid.Text.Trim(), false, 999);
+                    else
+                        getPageList(1);
+                }
+            }
+            catch (Exception ex)
+            {
+                MsgHelper.Warning("鎻愮ず锛�" + ex.Message);
+            }
+
+        }
     }
 }
\ No newline at end of file
diff --git a/DevApp/Gs.DevApp/ToolBox/UtilityHelper.cs b/DevApp/Gs.DevApp/ToolBox/UtilityHelper.cs
index dd32cf5..f7d8211 100644
--- a/DevApp/Gs.DevApp/ToolBox/UtilityHelper.cs
+++ b/DevApp/Gs.DevApp/ToolBox/UtilityHelper.cs
@@ -1451,7 +1451,7 @@
         /// <param name="fm">褰撳墠绐椾綋</param>
         /// <param name="fileName">瀛楁</param>
         /// <param name="icoName">鍥炬爣璺緞</param>
-        public static void SetGridSear(GridView gridView1, PictureBox btnChkIco = null, Form fm = null, string fileName = "checkStatus", string icoName = "")
+        public static void SetGridSear(GridView gridView1, PictureBox picCheckBox = null, Form fm = null, string fileName = "checkStatus", string icoName = "")
         {
             //   gridView1.OptionsView.ColumnAutoWidth = false;鑷姩璋冩暣鍒楀
             foreach (GridColumn column in gridView1.Columns)
@@ -1483,11 +1483,11 @@
                     e.Bounds.Top + 45, e.Bounds.Right - 5, e.Bounds.Height - 5);
                 e.Graphics.DrawString(str, f, Brushes.Gray, r);
             };
-            if (btnChkIco != null)
+            if (picCheckBox != null)
             {
                 gridView1.FocusedRowChanged += (s, e) =>
                 {
-                    UtilityHelper.SetCheckIco(s, btnChkIco, fm, fileName, icoName);
+                    UtilityHelper.SetCheckIco(s, picCheckBox, fm, fileName, icoName);
                 };
             }
         }

--
Gitblit v1.9.3