From 13dac95f9486c7e68788271f4ac89dfa77c28915 Mon Sep 17 00:00:00 2001
From: lu <123456>
Date: 星期三, 08 十月 2025 16:25:54 +0800
Subject: [PATCH] bug

---
 DevApp/Gs.DevApp/DevFrm/FQC/Frm_FQCItem.cs |  149 ++++++++++++++++++++++++++++++++++++++-----------
 1 files changed, 115 insertions(+), 34 deletions(-)

diff --git a/DevApp/Gs.DevApp/DevFrm/FQC/Frm_FQCItem.cs b/DevApp/Gs.DevApp/DevFrm/FQC/Frm_FQCItem.cs
index 41e5c1b..add87b6 100644
--- a/DevApp/Gs.DevApp/DevFrm/FQC/Frm_FQCItem.cs
+++ b/DevApp/Gs.DevApp/DevFrm/FQC/Frm_FQCItem.cs
@@ -1,7 +1,4 @@
-锘縰sing DevExpress.ClipboardSource.SpreadsheetML;
-using DevExpress.XtraEditors;
-using DevExpress.XtraEditors.Repository;
-using DevExpress.XtraPrinting.Native;
+锘縰sing DevExpress.XtraEditors;
 using Gs.DevApp.Entity;
 using Gs.DevApp.ToolBox;
 using Gs.DevApp.UserControl;
@@ -9,16 +6,12 @@
 using Newtonsoft.Json.Linq;
 using System;
 using System.Collections.Generic;
-using System.ComponentModel;
 using System.Configuration;
 using System.Data;
 using System.Drawing;
-using System.Linq;
 using System.Net;
-using System.Text;
 using System.Threading.Tasks;
 using System.Windows.Forms;
-using System.Windows.Media.Animation;
 
 namespace Gs.DevApp.DevFrm.FQC
 {
@@ -30,7 +23,6 @@
         public Frm_FQCItem()
         {
             InitializeComponent();
-
             // 缁戝畾浜嬩欢
             gridView2.CellValueChanged += gridView2_CellValueChanged;
             gridView3.CellValueChanged += gridView3_CellValueChanged;
@@ -42,16 +34,15 @@
             this.toolBarMenu1.btnDelClick += ToolBarMenu1_btnDelClick1;
             this.toolBarMenu1.btnEscClick += ToolBarMenu1_btnEscClick;
             this.toolBarMenu1.btnQueryClick += ToolBarMenu1_btnQueryClick;
-
+            txt_SampleSize1.Leave += txt_SampleSize1_Leave;
+            txt_SampleSize2.Leave += txt_SampleSize2_Leave;
             // 娣诲姞鎶芥牱鏂规硶涓嬫媺妗嗕簨浠�
             this.txt_SampleMethod.SelectedIndexChanged += Txt_SampleMethod_SelectedIndexChanged;
-
-            //this.toolBarMenu1.getXmlConfig();
-
+            this.toolBarMenu1.getXmlConfig();
             // 璁剧疆GridView鍙傛暟
             Gs.DevApp.ToolBox.UtilityHelper.SetGridViewParameterMx(gridView2);
             Gs.DevApp.ToolBox.UtilityHelper.SetGridViewParameterMx(gridView3);
-            Gs.DevApp.ToolBox.UtilityHelper.SetGridViewParameter(gridView1, picCheckBox, this, "checkStatus", "", (value) =>
+            Gs.DevApp.ToolBox.UtilityHelper.SetGridViewParameter(gridView1, null, this, "checkStatus", "", (value) =>
             {
                 Gs.DevApp.ToolBox.UtilityHelper.JumpTab(xtraTabControl1, 0);
             }, tips);
@@ -79,26 +70,33 @@
             if (comboBox != null)
             {
                 string selectedValue = comboBox.Text.Trim();
-                
+                int sampleSize = 0;
+
                 if (selectedValue == "鍖�閫�")
                 {
                     // 閫夋嫨鍖�閫熸椂锛氬惎鐢ㄥ寑閫熸娊鏍锋暟锛岀鐢ㄩ殢鏈烘娊鏍锋暟
                     txt_SampleSize1.Properties.ReadOnly = false;
                     txt_SampleSize1.Properties.Appearance.BackColor = Color.White;
-                    
+
                     txt_SampleSize2.Properties.ReadOnly = true;
                     txt_SampleSize2.Properties.Appearance.BackColor = Color.WhiteSmoke;
                     txt_SampleSize2.Text = ""; // 娓呯┖闅忔満鎶芥牱鏁�
+
+                    if (int.TryParse(txt_SampleSize1.Text.Trim(), out int size))
+                        sampleSize = size;
                 }
                 else if (selectedValue == "闅忔満")
                 {
                     // 閫夋嫨闅忔満鏃讹細鍚敤闅忔満鎶芥牱鏁帮紝绂佺敤鍖�閫熸娊鏍锋暟
                     txt_SampleSize2.Properties.ReadOnly = false;
                     txt_SampleSize2.Properties.Appearance.BackColor = Color.White;
-                    
+
                     txt_SampleSize1.Properties.ReadOnly = true;
                     txt_SampleSize1.Properties.Appearance.BackColor = Color.WhiteSmoke;
                     txt_SampleSize1.Text = ""; // 娓呯┖鍖�閫熸娊鏍锋暟
+
+                    if (int.TryParse(txt_SampleSize2.Text.Trim(), out int size))
+                        sampleSize = size;
                 }
                 else
                 {
@@ -106,12 +104,53 @@
                     txt_SampleSize1.Properties.ReadOnly = true;
                     txt_SampleSize1.Properties.Appearance.BackColor = Color.WhiteSmoke;
                     txt_SampleSize1.Text = "";
-                    
+
                     txt_SampleSize2.Properties.ReadOnly = true;
                     txt_SampleSize2.Properties.Appearance.BackColor = Color.WhiteSmoke;
                     txt_SampleSize2.Text = "";
                 }
+
+                UpdateGridViewColumns(sampleSize);
             }
+        }
+
+        private void UpdateGridViewColumns(int sampleSize)
+        {
+            if (sampleSize < 0 || sampleSize > 16)
+                return;
+
+            // 鑾峰彇鎵�鏈夊�煎垪锛堝��1鍒板��16锛�
+            var valueColumns = new[]
+            {
+                gridColumn11, // 鍊�1
+                gridColumn12, // 鍊�2
+                gridColumn13, // 鍊�3
+                gridColumn14, // 鍊�4
+                gridColumn15, // 鍊�5
+                gridColumn16, // 鍊�6
+                gridColumn18, // 鍊�7
+                gridColumn19, // 鍊�8
+                gridColumn36, // 鍊�9
+                gridColumn37, // 鍊�10
+                gridColumn38, // 鍊�11
+                gridColumn39, // 鍊�12
+                gridColumn40, // 鍊�13
+                gridColumn49, // 鍊�14
+                gridColumn50, // 鍊�15
+                gridColumn51  // 鍊�16
+            };
+
+            // 璁剧疆鍒楃殑鍙鎬�
+            for (int i = 0; i < valueColumns.Length; i++)
+            {
+                if (valueColumns[i] != null)
+                {
+                    valueColumns[i].Visible = i < sampleSize;
+                }
+            }
+
+            // 鍒锋柊GridView
+            gridView2.BestFitColumns();
         }
 
         /// <summary>
@@ -121,12 +160,12 @@
         {
             // 鏍规嵁褰撳墠鎶芥牱鏂规硶鍊艰缃緭鍏ユ鐘舵��
             string currentSampleMethod = txt_SampleMethod.Text.Trim();
-            
+
             if (currentSampleMethod == "鍖�閫�")
             {
                 txt_SampleSize1.Properties.ReadOnly = false;
                 txt_SampleSize1.Properties.Appearance.BackColor = Color.White;
-                
+
                 txt_SampleSize2.Properties.ReadOnly = true;
                 txt_SampleSize2.Properties.Appearance.BackColor = Color.LightGray;
             }
@@ -134,7 +173,7 @@
             {
                 txt_SampleSize2.Properties.ReadOnly = false;
                 txt_SampleSize2.Properties.Appearance.BackColor = Color.White;
-                
+
                 txt_SampleSize1.Properties.ReadOnly = true;
                 txt_SampleSize1.Properties.Appearance.BackColor = Color.LightGray;
             }
@@ -143,7 +182,7 @@
                 // 鏈�夋嫨鏃朵袱涓兘绂佺敤
                 txt_SampleSize1.Properties.ReadOnly = true;
                 txt_SampleSize1.Properties.Appearance.BackColor = Color.LightGray;
-                
+
                 txt_SampleSize2.Properties.ReadOnly = true;
                 txt_SampleSize2.Properties.Appearance.BackColor = Color.LightGray;
             }
@@ -275,7 +314,7 @@
             Gs.DevApp.ToolBox.UtilityHelper.SetDefaultTable(gcMain1, gridView1);
             Gs.DevApp.ToolBox.UtilityHelper.SetDefaultTable(gridControl1, gridView2);
             Gs.DevApp.ToolBox.UtilityHelper.SetDefaultTable(gridControl2, gridView3);
-            
+
             // 鍒濆鍖栨娊鏍锋暟杈撳叆妗嗙姸鎬�
             InitializeSampleSizeControls();
         }
@@ -287,11 +326,12 @@
                 lbGuid, txt_Guid, gridView1);
             if (string.IsNullOrEmpty(rowGuid))
             {
-                MsgHelper.Warning("璇峰厛閫夋嫨浣犺鎿嶄綔鐨勮锛�");
+                MsgHelper.ShowError("璇峰厛閫夋嫨浣犺鎿嶄綔鐨勮锛�");
                 return;
             }
             Gs.DevApp.ToolBox.UtilityHelper.JumpTab(xtraTabControl1, 3);
             getModel(rowGuid);
+         
         }
 
         /// <summary>
@@ -311,23 +351,23 @@
                 itemName = txt_ItemName.Text.Trim(), // 浜у搧鍚嶇О
                 itemModel = txt_ItemModel.Text.Trim(), // 瑙勬牸鍨嬪彿
                 brand = txt_Brand.Text.Trim(), // 鍟嗘爣
-                productionDate = txt_ProductionDate.Text.Trim(), // 鐢熶骇鏃ユ湡
+                productionDate = txt_productionDate.Text.Trim(), // 鐢熶骇鏃ユ湡
                 temperature = txt_Temperature.Text.Trim(), // 瀹ゆ俯
                 voltage = txt_Voltage.Text.Trim(), // 鐢靛帇
                 lineNo = txt_LineNo.Text.Trim(), // 绾垮彿
                 batch = txt_Batch.Text.Trim(), // 鎵归噺
                 classes = txt_Classes.Text.Trim(), // 鐝
-                checkResult = txt_CheckResult.Text.Trim(), // 妫�楠岀粨鏋�
-                acRe_A = txt_AcRe_A.Text.Trim(), // AC/Re A绫�
-                acRe_B = txt_AcRe_B.Text.Trim(), // AC/Re B绫�
-                acRe_C = txt_AcRe_C.Text.Trim(), // AC/Re C绫�
+                checkResult = txt_checkResult.Text.Trim(), // 妫�楠岀粨鏋�
+                acRe_A = txt_acReA.Text.Trim(), // AC/Re A绫�
+                acRe_B = txt_acReB.Text.Trim(), // AC/Re B绫�
+                acRe_C = txt_acReC.Text.Trim(), // AC/Re C绫�
                 processResults = txt_ProcessResults.Text.Trim(), // 澶勭悊缁撴灉
                 sampleMethod = txt_SampleMethod.Text.Trim(), // 鎶芥牱
                 sampleSize1 = txt_SampleSize1.Text.Trim(), // 鍖�閫熸娊鏍锋暟
                 sampleSize2 = txt_SampleSize2.Text.Trim(), // 闅忔満鎶芥牱鏁�
                 sampleSize3 = txt_SampleSize3.Text.Trim(), // 鏍锋湰鏁�
-                jy_USER = txt_JY_USER.Text.Trim(), // 妫�楠屼汉
-                jy_DATE = txt_JY_DATE.Text.Trim(), // 妫�楠屾椂闂�
+                jy_USER = txt_jyNAME.Text.Trim(), // 妫�楠屼汉
+                jy_DATE = txt_jyDATE.Text.Trim(), // 妫�楠屾椂闂�
                 sp_USER = txt_SP_USER.Text.Trim(), // 瀹℃壒浜�
                 sp_DATE = txt_SP_DATE.Text.Trim(), // 瀹℃壒鏃ユ湡
                 remark = txt_Remark.Text.Trim(), // 澶囨敞
@@ -427,7 +467,10 @@
         private void getPageList(int curPage)
         {
             gcMain1.DataSource = null;
-            var _sbSqlWhere = UtilityHelper.GetSearchWhere(_filterList);
+            System.Text.StringBuilder _sbSqlWhere = new System.Text.StringBuilder();
+            _sbSqlWhere.Append(" and OrgId in");
+            _sbSqlWhere.Append(ToolBox.UtilityHelper.GetOrgWhere());
+            _sbSqlWhere.Append(UtilityHelper.GetSearchWhere(_filterList));
             var pgq = new PageQueryModel(curPage, this.pageBar1.RowsCount, "", "", "", _sbSqlWhere.ToString());
             var json = JsonConvert.SerializeObject(pgq);
             try
@@ -492,7 +535,7 @@
                     dynamic dy = _rtn.rtnData;
                     lbGuid.Text = strGuid;
                     UtilityHelper.SetValueByObj(this.layoutMx1.Controls, dy, isEdit);
-                    
+
                     // 鎺у埗鏄庣粏琛ㄥ彲缂栬緫鐘舵��
                     List<DevExpress.XtraGrid.Views.Grid.GridView> gvList = new List<DevExpress.XtraGrid.Views.Grid.GridView>();
                     gvList.Add(gridView2);  // 椤圭洰鏍囧噯瀛愯〃
@@ -500,7 +543,7 @@
                     UtilityHelper.SetValueByObj(this.layoutMx1.Controls, dy, isEdit, gvList);
 
                     JObject _job = JObject.Parse(strJson);
-                    
+
                     // 澶勭悊椤圭洰鏍囧噯瀛愯〃鏁版嵁
                     JArray array1 = new JArray();
                     if (_job["rtnData"]["list"] != null)
@@ -545,6 +588,14 @@
                         {
                             Gs.DevApp.ToolBox.UtilityHelper.SetDefaultTable(gridControl2, gridView3);
                         }
+                    }
+                    if (int.TryParse(txt_SampleSize1.Text.Trim(), out int size))
+                    {
+                        UpdateGridViewColumns(size);
+                    }
+                    else
+                    {
+                        UpdateGridViewColumns(0);
                     }
                 }
                 else
@@ -633,5 +684,35 @@
                 }
             }
         }
+
+        private void txt_SampleSize1_Leave(object sender, EventArgs e)
+        {
+            if (txt_SampleMethod.Text.Trim() == "鍖�閫�")
+            {
+                if (int.TryParse(txt_SampleSize1.Text.Trim(), out int size))
+                {
+                    UpdateGridViewColumns(size);
+                }
+                else
+                {
+                    UpdateGridViewColumns(0);
+                }
+            }
+        }
+
+        private void txt_SampleSize2_Leave(object sender, EventArgs e)
+        {
+            if (txt_SampleMethod.Text.Trim() == "闅忔満")
+            {
+                if (int.TryParse(txt_SampleSize2.Text.Trim(), out int size))
+                {
+                    UpdateGridViewColumns(size);
+                }
+                else
+                {
+                    UpdateGridViewColumns(0);
+                }
+            }
+        }
     }
 }
\ No newline at end of file

--
Gitblit v1.9.3