From aa8f2ab61f7c87640de7817b77758c78e9c45792 Mon Sep 17 00:00:00 2001
From: lu <99954486@qq.com>
Date: 星期六, 15 三月 2025 10:54:01 +0800
Subject: [PATCH] 样品检验

---
 DevApp/Gs.DevApp/DevFrm/QC/Frm_MesQmCheckitemDt.cs |  144 +++++++++++++++++++++++++++++++++++++-----------
 1 files changed, 111 insertions(+), 33 deletions(-)

diff --git a/DevApp/Gs.DevApp/DevFrm/QC/Frm_MesQmCheckitemDt.cs b/DevApp/Gs.DevApp/DevFrm/QC/Frm_MesQmCheckitemDt.cs
index 8df7648..1894c76 100644
--- a/DevApp/Gs.DevApp/DevFrm/QC/Frm_MesQmCheckitemDt.cs
+++ b/DevApp/Gs.DevApp/DevFrm/QC/Frm_MesQmCheckitemDt.cs
@@ -18,7 +18,6 @@
     {
         private List<FilterEntity> _filterList = new List<FilterEntity>();
         private readonly string _webServiceName = "MesQmCheckitemManager/";
-
         public Frm_MesQmCheckitemDt()
         {
             InitializeComponent();
@@ -31,6 +30,7 @@
             toolBarMenu1.btnQueryClick += ToolBarMenu1_btnQueryClick;
             toolBarMenu1.btnChkClick += ToolBarMenu1_btnChkClick;
             toolBarMenu1.btnPiZhunClick += ToolBarMenu1_btnPiZhunClick;
+            this.toolBarMenu1.getXmlConfig();
             Gs.DevApp.ToolBox.UtilityHelper.SetGridViewParameterMx(gvMx1);
             Gs.DevApp.ToolBox.UtilityHelper.SetGridViewParameter(gridView1, picCheckBox, this, "foneChecked", "", (value) =>
             {
@@ -136,7 +136,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>
@@ -196,7 +196,7 @@
                 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);
+                UtilityHelper.ChangeEnableByControl(this.layoutMx1.Controls, true, gvList);
             }
         }
 
@@ -212,11 +212,11 @@
             var gridViews = new List<GridView>();
             gridViews.Add(gvMx1);
             gridViews.Add(gridView2);
-            UtilityHelper.CleanValueByControl(panel1.Controls, true, gridViews);
+            UtilityHelper.CleanValueByControl(this.layoutMx1.Controls, true, gridViews);
             UtilityHelper.SetDefaultTable(gcMx1, gvMx1);
             xtraTabPageCopy.PageEnabled = false;
         }
-
+      
         /// <summary>
         ///     淇濆瓨浜嬩欢
         /// </summary>
@@ -225,15 +225,21 @@
         private void ToolBarMenu1_btnSaveClick(object sender, EventArgs e)
         {
             toolBarMenu1.isSetBtn = false;
-            string _ItemId = txt_ItemId.GetId();
+            string _ItemId = txt_itemId.GetId();
             if (string.IsNullOrEmpty(_ItemId))
             {
                 MsgHelper.Warning("璇烽�夋嫨鐗╂枡锛�");
-                txt_ItemId.Focus();
+                txt_itemId.Focus();
                 return;
             }
             gvMx1.CloseEditor();
+            gvMx1.PostEditor();
             gvMx1.UpdateCurrentRow();
+            if (gvMx1.DataRowCount <= 0)
+            {
+                MsgHelper.Warning("椤圭洰鏄庣粏涓嶈兘涓虹┖锛�");
+                return;
+            }
             try
             {
                 var lst = new List<MesQmCheckitemDt>();
@@ -241,6 +247,65 @@
                 {
                     var row = gvMx1.GetDataRow(i);
                     if (row != null)
+                    {
+                        if (string.IsNullOrEmpty(row["forder"].ToString()))
+                        {
+                            MsgHelper.ShowError("椤哄簭涓嶈兘涓虹┖锛�");
+                            return;
+                        }
+                        if (string.IsNullOrEmpty(row["FcheckItem"].ToString()))
+                        {
+                            MsgHelper.ShowError("妫�楠岄」鐩笉鑳戒负绌猴紒");
+                            return;
+                        }
+                        if (string.IsNullOrEmpty(row["FcheckTool"].ToString()))
+                        {
+                            MsgHelper.ShowError("妫�楠屽伐鍏蜂笉鑳戒负绌猴紒");
+                            return;
+                        }
+                        if (string.IsNullOrEmpty(row["SampleSizeNo"].ToString()))
+                        {
+                            MsgHelper.ShowError("妫�楠屾爣鍑嗕笉鑳戒负绌猴紒");
+                            return;
+                        }
+                        if (string.IsNullOrEmpty(row["FcheckLevel"].ToString()))
+                        {
+                            MsgHelper.ShowError("妫�楠屾按骞充笉鑳戒负绌猴紒");
+                            return;
+                        }
+                        if (string.IsNullOrEmpty(row["FacLevel"].ToString()))
+                        {
+                            MsgHelper.ShowError("鎺ュ彈姘村钩涓嶈兘涓虹┖锛�");
+                            return;
+                        }
+                        string _Fstand = row["Fstand"].ToString();
+                        string _FupAllow = row["FupAllow"].ToString();
+                        string _FdownAllow = row["FdownAllow"].ToString();
+                        //鍋囧涓変釜閮戒负绌洪�氳繃
+                        if (string.IsNullOrEmpty(_Fstand) && string.IsNullOrEmpty(_FupAllow) && string.IsNullOrEmpty(_FdownAllow))
+                        {
+
+                        }
+                        else
+                        {
+                            if (!string.IsNullOrEmpty(_Fstand) && !string.IsNullOrEmpty(_FupAllow) && !string.IsNullOrEmpty(_FdownAllow))
+                            {
+                                decimal _Fstand_f = Gs.DevApp.ToolBox.UtilityHelper.ToDecimal(_Fstand);
+                                decimal _FupAllow_f = Gs.DevApp.ToolBox.UtilityHelper.ToDecimal(_FupAllow);
+                                decimal _FdownAllow_f = Gs.DevApp.ToolBox.UtilityHelper.ToDecimal(_FdownAllow);
+                                if (_Fstand_f >= _FdownAllow_f && _Fstand_f <= _FupAllow_f) { }
+                                else
+                                {
+                                    MsgHelper.ShowError("鏍囧噯鍊煎繀椤诲湪涓婇檺鍜屼笅闄愪箣闂达紒");
+                                    return;
+                                }
+                            }
+                            else
+                            {
+                                MsgHelper.ShowError("璇峰~鍐欐纭殑涓婇檺锛屾爣鍑嗗�硷紝涓嬮檺锛�");
+                                return;
+                            }
+                        }
                         lst.Add(new MesQmCheckitemDt
                         {
                             Guid = UtilityHelper.ToGuid(row["guid"].ToString()),
@@ -249,13 +314,14 @@
                             SampleSizeNo = row["SampleSizeNo"].ToString(),
                             FcheckTool = row["FcheckTool"].ToString(),
                             FcheckLevel = row["FcheckLevel"].ToString(),
-                            Fstand = row["Fstand"].ToString(),
+                            Fstand = Gs.DevApp.ToolBox.UtilityHelper.GetDecimal(row["Fstand"].ToString()),
                             FacLevel = row["FacLevel"].ToString(),
                             FspecRequ = row["FspecRequ"].ToString(),
                             Memo = row["memo"].ToString(),
-                            FupAllow = row["FupAllow"].ToString(),
-                            FdownAllow = row["FdownAllow"].ToString(),
+                            FupAllow = Gs.DevApp.ToolBox.UtilityHelper.GetDecimal(row["FupAllow"].ToString()),
+                            FdownAllow = Gs.DevApp.ToolBox.UtilityHelper.GetDecimal(row["FdownAllow"].ToString()),
                         });
+                    }
                 }
                 var _obj = new MesQmCheckitem
                 {
@@ -282,7 +348,7 @@
                         var gridViews = new List<GridView>();
                         gridViews.Add(gvMx1);
                         gridViews.Add(gridView2);
-                        UtilityHelper.ChangeEnableByControl(panel1.Controls, false, gridViews);
+                        UtilityHelper.ChangeEnableByControl(this.layoutMx1.Controls, false, gridViews);
                     }
                 }
                 catch (Exception ex)
@@ -296,7 +362,7 @@
             }
 
         }
-
+       
         /// <summary>
         /// </summary>
         /// <param name="curPage">绗嚑椤�</param>
@@ -306,7 +372,7 @@
             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());
+                "org.FNumber asc ,b.item_no asc,a.FVERSION desc", "", "", _sbSqlWhere.ToString());
             var json = JsonConvert.SerializeObject(pgq);
             try
             {
@@ -316,16 +382,18 @@
                     UtilityHelper.ReturnToTablePage(strReturn);
                 if (dd.rtnCode > 0)
                 {
+                    gcMain1.DataSource = null;
                     DataTable dt = dd.rtnData.list;
-                    gcMain.BindingContext = new BindingContext();
+                    gcMain1.BindingContext = new BindingContext();
                     gridView1.ColumnFilterChanged -= GridView1_ColumnFilterChanged;
                     if (dt.Rows.Count > 0)
                     {
-                        gcMain.DataSource = dt;
-                        gcMain.ForceInitialize();
+                        gcMain1.DataSource = dt;
+                        gcMain1.ForceInitialize();
+                        gridView1.BestFitColumns();
                     }
                     else
-                        UtilityHelper.SetDefaultTable(gcMain, gridView1);
+                        UtilityHelper.SetDefaultTable(gcMain1, gridView1);
                     gridView1.ColumnFilterChanged += GridView1_ColumnFilterChanged;
                     pageBar1.TotalPages = dd.rtnData.pages;//鎬婚〉
                     pageBar1.CurrentPage = curPage;//褰撳墠椤�
@@ -340,7 +408,6 @@
             {
                 MsgHelper.Warning("鎻愮ず锛�" + ex.Message);
             }
-
         }
 
         private void getModel(string strGuid)
@@ -369,22 +436,20 @@
                 {
                     var dy = _rtn.rtnData;
                     lbGuid.Text = strGuid;
-                    var gvList =
-                        new List<GridView>();
+                    var gvList = new List<GridView>();
                     gvList.Add(gvMx1);
-                    UtilityHelper.SetValueByObj(panel1.Controls, dy,
+                    UtilityHelper.SetValueByObj(this.layoutMx1.Controls, dy,
                         isEdit, gvList);
                     var _job = JObject.Parse(strJson);
                     var array = new JArray();
                     foreach (var a in _job["rtnData"]["list"]) array.Add(a);
-                    var dt =
-                        JsonConvert.DeserializeObject<DataTable>(
-                            array.ToString());
+                    var dt = JsonConvert.DeserializeObject<DataTable>(array.ToString());
                     if (dt.Rows.Count > 0)
                     {
                         gcMx1.BindingContext = new BindingContext();
                         gcMx1.DataSource = dt;
                         gcMx1.ForceInitialize();
+                        gvMx1.BestFitColumns();
                     }
                     else
                     {
@@ -432,7 +497,6 @@
             }
             if (!MsgHelper.AskQuestion("浣犻�夋嫨浜嗐��" + rowName + "銆戯紝纭畾" + strMsg + "鍚楋紵"))
                 return;
-
             var _obj = new
             {
                 guid = rowGuid,
@@ -448,28 +512,43 @@
                 if (_rtn.rtnCode > 0 && _rtn.rtnData.outSum * 1 > 0)
                 {
                     if (xtraTabControl1.SelectedTabPageIndex == 1)
+                    {
                         getModel(lbGuid.Text.Trim());
-                    else
+                        UtilityHelper.SetCheckIco(gridView1, "foneChecked", "foneCheckor", "foneCheckdate", picCheckBox, this, _inFieldValue>0?"1":"0");
+                    }
+                    else {
+                        //娉ㄦ剰锛岃繖閲屽拰鍏跺畠椤甸潰鏈夌偣涓嶄竴鏍�
                         getPageList(this.pageBar1.CurrentPage);
+                        int rowHandle = gridView1.LocateByValue("guid", rowGuid);
+                        gridView1.FocusedRowHandle = rowHandle;
+                    }
                 }
             }
             catch (Exception ex)
             {
                 MsgHelper.Warning("鎻愮ず锛�" + ex.Message);
             }
-
         }
-
 
         #region 浠ヤ笅涓虹绉嶄笅鎷�
         private void _setIno()
         {
-            txt_ItemId.EditChanged += (s, e) =>
+            this.txt_fSubsidiary.EditChanged += (s, e) =>
             {
-                txt_itemModel.Text = this.txt_ItemId.GetModel();
-                txt_itemNo.Text = this.txt_ItemId.GetCode();
+                string _orgId = txt_fSubsidiary.GetId();
+                if (string.IsNullOrEmpty(_orgId))
+                    return;
+                txt_itemId.getSuppler(_orgId);
+                //txt_gg.Text ="";
+                //txt_itemNo.Text = "";
             };
-          
+            txt_itemId.EditChanged += (s, e) =>
+            {
+                if (!string.IsNullOrEmpty(this.txt_itemId.GetModel()))
+                    txt_gg.Text = this.txt_itemId.GetModel();
+                if (!string.IsNullOrEmpty(this.txt_itemId.GetCode()))
+                    txt_itemNo.Text = this.txt_itemId.GetCode();
+            };
             _getListJyxm();
             _getListJygj();
             _getListJybz();
@@ -710,6 +789,5 @@
                 MsgHelper.Warning("鎻愮ず锛�" + ex.Message);
             }
         }
-
     }
 }
\ No newline at end of file

--
Gitblit v1.9.3