From 957c6e65ba3be503e57aa5037f91c2f6950a2692 Mon Sep 17 00:00:00 2001
From: 啊鑫 <t2856754968@163.com>
Date: 星期五, 01 十一月 2024 15:01:15 +0800
Subject: [PATCH] 期初条码打印浏览

---
 DevApp/Gs.DevApp/DevFrm/QC/Frm_MesQmAql1.cs |  178 +++++++++++++++++++++++++++++++++++++++++++++++++++--------
 1 files changed, 154 insertions(+), 24 deletions(-)

diff --git a/DevApp/Gs.DevApp/DevFrm/QC/Frm_MesQmAql1.cs b/DevApp/Gs.DevApp/DevFrm/QC/Frm_MesQmAql1.cs
index cfebf8c..c57c9f3 100644
--- a/DevApp/Gs.DevApp/DevFrm/QC/Frm_MesQmAql1.cs
+++ b/DevApp/Gs.DevApp/DevFrm/QC/Frm_MesQmAql1.cs
@@ -1,5 +1,5 @@
 using DevExpress.XtraGrid.Views.Grid;
-using DevExpress.XtraGrid.Views.Grid.ViewInfo;
+using Gs.DevApp.DevFrm.QC.Models;
 using Gs.DevApp.Entity;
 using Gs.DevApp.ToolBox;
 using Newtonsoft.Json;
@@ -25,7 +25,9 @@
             this.toolBarMenu1.btnLoadClick += ToolBarMenu1_btnLoadClick;
             this.toolBarMenu1.btnDelClick += ToolBarMenu1_btnDelClick1;
             this.toolBarMenu1.btnEscClick += ToolBarMenu1_btnEscClick;
-            this.toolBarMenu1.btnQueryClick += ToolBarMenu1_btnQueryClick;
+            toolBarMenu1.btnChkClick += ToolBarMenu1_btnChkClick;
+            toolBarMenu1.btnFChkClick += ToolBarMenu1_btnFChkClick;
+            toolBarMenu1.btnPiZhunClick += ToolBarMenu1_btnPiZhunClick;
             gcMain.MouseDoubleClick += GcMain_MouseDoubleClick;
             getPageList(1, UtilityHelper.GetPageSize());
             pageBar1.PagerEvent += PageBar1_PagerEvent;
@@ -43,6 +45,61 @@
                 Rectangle r = new Rectangle(gridView1.GridControl.Width / 2 - 100, e.Bounds.Top + 45, e.Bounds.Right - 5, e.Bounds.Height - 5);
                 e.Graphics.DrawString(str, f, Brushes.Gray, r);
             };
+        }
+        /// <summary>
+        /// 鎵瑰噯
+        /// </summary>
+        /// <param name="sender"></param>
+        /// <param name="e"></param>
+        private void ToolBarMenu1_btnPiZhunClick(object sender, EventArgs e)
+        {
+            string rowGuid, rowName;
+            (rowGuid, rowName) = UtilityHelper.GetCurrentRow(xtraTabControl1,
+                lbGuid, txt_sampleSizeNo, gridView1);
+            try
+            {
+                string strJson = UtilityHelper.HttpPost("", _webServiceName + "Approval", JsonConvert.SerializeObject(rowGuid));
+                ReturnModel<dynamic> _rtn = ToolBox.UtilityHelper.ReturnToDynamic(strJson);
+                if (_rtn.rtnCode > 0)
+                {
+                    UtilityHelper.JumpToTab(xtraTabControl1, 0);
+                    getPageList(1, UtilityHelper.GetPageSize());
+                }
+                ToolBox.MsgHelper.Warning("鎻愮ず锛�" + _rtn.rtnMsg);
+            }
+            catch (Exception ex)
+            {
+                ToolBox.MsgHelper.Warning("鎻愮ず锛�" + ex.Message);
+            }
+        }
+
+        /// <summary>
+        ///     鍙嶅鏍�
+        /// </summary>
+        /// <param name="sender"></param>
+        /// <param name="e"></param>
+        /// <exception cref="NotImplementedException"></exception>
+        private void ToolBarMenu1_btnFChkClick(object sender, EventArgs e)
+        {
+            toolBarMenu1.guidKey = "";
+            string rowGuid, rowName;
+            (rowGuid, rowName) = UtilityHelper.GetCurrentRow(xtraTabControl1,
+                lbGuid, txt_sampleSizeNo, gridView1);
+            toolBarMenu1.guidKey = rowGuid;
+        }
+
+        /// <summary>
+        ///     瀹℃牳浜嬩欢
+        /// </summary>
+        /// <param name="sender"></param>
+        /// <param name="e"></param>
+        private void ToolBarMenu1_btnChkClick(object sender, EventArgs e)
+        {
+            toolBarMenu1.guidKey = "";
+            string rowGuid, rowName;
+            (rowGuid, rowName) = UtilityHelper.GetCurrentRow(xtraTabControl1,
+                lbGuid, txt_sampleSizeNo, gridView1);
+            toolBarMenu1.guidKey = rowGuid;
         }
 
         /// <summary>
@@ -64,17 +121,6 @@
         private void PageBar1_PagerEvent(int curPage, int pageSize)
         {
             getPageList(curPage, pageSize);
-        }
-        /// <summary>
-        /// 鏌ヨ浜嬩欢
-        /// </summary>
-        /// <param name="sender"></param>
-        /// <param name="e"></param>
-        private void ToolBarMenu1_btnQueryClick(object sender, EventArgs e)
-        {
-            Gs.DevApp.UserControl.ShowFilter frm = new Gs.DevApp.UserControl.ShowFilter(gridView1.Columns, _filterList);
-            frm.UpdateParent += Frm_UpdateParent;
-            frm.ShowDialog();
         }
         /// <summary>
         /// 鏌ヨ鍥炶皟
@@ -105,7 +151,7 @@
         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_sampleSizeNo, gridView1);
             if (string.IsNullOrEmpty(rowGuid))
             {
                 ToolBox.MsgHelper.Warning("璇峰厛閫夋嫨浣犺鎿嶄綔鐨勮锛�");
@@ -151,7 +197,7 @@
         private void ToolBarMenu1_btnEdtClick(object sender, EventArgs e)
         {
             string rowGuid = "", rowName = "";
-            // (rowGuid, rowName) = UtilityHelper.GetCurrentRow(xtraTabControl1, lbGuid, txt_billNo, gridView1);
+            (rowGuid, rowName) = UtilityHelper.GetCurrentRow(xtraTabControl1, lbGuid, txt_sampleSizeNo, gridView1);
             if (string.IsNullOrEmpty(rowGuid))
             {
                 ToolBox.MsgHelper.Warning("璇峰厛閫夋嫨浣犺鎿嶄綔鐨勮锛�");
@@ -168,10 +214,14 @@
         {
             UtilityHelper.JumpToTab(xtraTabControl1, 1);
             lbGuid.Text = "";
-            List<DevExpress.XtraGrid.Views.Grid.GridView> gridViews = new List<DevExpress.XtraGrid.Views.Grid.GridView>();
+            List<GridView> gridViews = new List<GridView>();
             gridViews.Add(gvMx1);
+            gridViews.Add(gvMx2);
             UtilityHelper.CleanValueByControl(this.panel1.Controls, true, gridViews);
-            Gs.DevApp.ToolBox.UtilityHelper.SetDefaultTable(gcMx1, gvMx1);
+             UtilityHelper.SetDefaultTable(gcMx1, gvMx1);
+            UtilityHelper.SetDefaultTable(gcMx2, gvMx2);
+            txt_createDate.Text = DateTime.Now.ToString("G");
+            txt_fversion.Text = "1";
         }
         /// <summary>
         /// 淇濆瓨浜嬩欢
@@ -187,10 +237,89 @@
                 txt_sampleSizeNo.Focus();
                 return;
             }
-            var _obj = new
-            {
-                guid = lbGuid.Text.Trim(),//涓诲缓
 
+            if (string.IsNullOrEmpty(txt_sampleSizeName.Text.Trim()))
+            {
+                Gs.DevApp.ToolBox.MsgHelper.Warning("鏍囧噯鍚嶇О涓嶈兘涓虹┖锛�");
+                txt_sampleSizeName.Focus();
+                return;
+            }
+            gvMx1.CloseEditor();
+            gvMx1.UpdateCurrentRow();
+            gvMx2.CloseEditor();
+            gvMx2.UpdateCurrentRow();
+            var qmaql2 = new List<MesQmAql2>();
+            for (var i = 0; i < gvMx1.DataRowCount; i++)
+            {
+                var row = gvMx1.GetDataRow(i);
+                if (row != null)
+                    qmaql2.Add(new MesQmAql2
+                    {
+                        Guid = UtilityHelper.ToGuid(row["Guid"].ToString()),
+                        LotFrom = Convert.ToInt32(row["LotFrom"].ToString()),
+                        LotTo = Convert.ToInt32(row["LotTo"].ToString()),
+                        FlevelS1 = row["FlevelS1"].ToString(),
+                        FlevelS2 = row["FlevelS2"].ToString(),
+                        FlevelS3 = row["FlevelS3"].ToString(),
+                        FlevelS4 = row["FlevelS4"].ToString(),
+                        FlevelI = row["FlevelI"].ToString(),
+                        FlevelIi = row["FlevelIi"].ToString(),
+                        FlevelIii = row["FlevelIii"].ToString(),
+                        Memo = row["Memo"].ToString()
+                    });
+            }
+            var qmaql3 = new List<MesQmAql3>();
+            for (var i = 0; i < gvMx2.DataRowCount; i++)
+            {
+                var row = gvMx2.GetDataRow(i);
+                if (row != null)
+                    qmaql3.Add(new MesQmAql3
+                    {
+                        Guid = UtilityHelper.ToGuid(row["Guid"].ToString()),
+                        FsampleSizeWord = Convert.ToInt32(row["FsampleSizeWord"].ToString()),
+                        SampleSizeWord = row["SampleSizeWord"].ToString(),
+                        Aql00010 = Convert.ToInt32(row["Aql00010"].ToString()),
+                        Aql00015 = Convert.ToInt32(row["Aql00015"].ToString()),
+                        Aql00025 = Convert.ToInt32(row["Aql00025"].ToString()),
+                        Aql00040 = Convert.ToInt32(row["Aql00040"].ToString()),
+                        Aql00065 = Convert.ToInt32(row["Aql00065"].ToString()),
+                        Aql0010 = Convert.ToInt32(row["Aql0010"].ToString()),
+                        Aql0015 = Convert.ToInt32(row["Aql0015"].ToString()),
+                        Aql0025 = Convert.ToInt32(row["Aql0025"].ToString()),
+                        Aql0040 = Convert.ToInt32(row["Aql0040"].ToString()),
+                        Aql0065 = Convert.ToInt32(row["Aql0065"].ToString()),
+                        Aql0100 = Convert.ToInt32(row["Aql0100"].ToString()),
+                        Aql0150 = Convert.ToInt32(row["Aql0150"].ToString()),
+                        Aql0250 = Convert.ToInt32(row["Aql0250"].ToString()),
+                        Aql0400 = Convert.ToInt32(row["Aql0400"].ToString()),
+                        Aql0650 = Convert.ToInt32(row["Aql0650"].ToString()),
+                        Aql1000 = Convert.ToInt32(row["Aql1000"].ToString()),
+                        Memo = row["Memo"].ToString()
+                    });
+            }
+            if (qmaql2.Count <= 0)
+            {
+                Gs.DevApp.ToolBox.MsgHelper.Warning("鏍锋湰閲忓瓙鐮佷笉鑳戒负绌猴紒");
+                return;
+            }
+            if (qmaql3.Count <= 0)
+            {
+                Gs.DevApp.ToolBox.MsgHelper.Warning("鎶芥牱鏂规涓嶈兘涓虹┖锛�");
+                return;
+            }
+            var _obj = new MesQmAql1
+            {
+                Guid = UtilityHelper.ToGuid(lbGuid.Text.Trim()),
+                SampleSizeNo = txt_sampleSizeNo.Text.Trim(),
+                SampleSizeName = txt_sampleSizeName.Text.Trim(),
+                Memo = txt_memo.Text.Trim(),
+                CreateDate = DateTime.Now,
+                FtwoChecked = false,
+                Isenabled = false,
+                FoneChecked = false,
+                Fversion = Convert.ToInt32(txt_fversion.Text.Trim()),
+                MesQmAql2s = qmaql2,
+                MesQmAql3s = qmaql3
             };
             try
             {
@@ -201,7 +330,10 @@
                 {
                     lbGuid.Text = _rtn.rtnData;
                     toolBarMenu1.isSetBtn = true;
-                    UtilityHelper.ChangeEnableByControl(this.panel1.Controls, false);
+                    List<GridView> gridViews = new List<GridView>();
+                    gridViews.Add(gvMx1);
+                    gridViews.Add(gvMx2);
+                    UtilityHelper.ChangeEnableByControl(this.panel1.Controls, false, gridViews);
                 }
             }
             catch (Exception ex)
@@ -282,7 +414,6 @@
                     {
                         array.Add(a);
                     }
-
                     DataTable dt = JsonConvert.DeserializeObject<DataTable>(array.ToString());
                     if (dt.Rows.Count > 0)
                     {
@@ -311,8 +442,6 @@
                     {
                         Gs.DevApp.ToolBox.UtilityHelper.SetDefaultTable(gcMx2, gvMx2);
                     }
-
-
                 }
                 else
                     ToolBox.MsgHelper.Warning("鎻愮ず锛�" + _rtn.rtnMsg);
@@ -323,5 +452,6 @@
             }
         }
 
+     
     }
 }
\ No newline at end of file

--
Gitblit v1.9.3