From c36373bf842b43df04758bd6f5a4201eaae6fe4c Mon Sep 17 00:00:00 2001
From: lu <123456>
Date: 星期三, 15 十月 2025 10:12:39 +0800
Subject: [PATCH] 称重

---
 DevApp/Gs.WeightLine/Form1.cs   |   21 ++++++++-------------
 DevApp/Gs.WeightIqc/App.config  |    3 ++-
 DevApp/Gs.WeightLine/App.config |    4 +++-
 DevApp/Gs.WeightIqc/Form1.cs    |   18 ++++++------------
 4 files changed, 19 insertions(+), 27 deletions(-)

diff --git a/DevApp/Gs.WeightIqc/App.config b/DevApp/Gs.WeightIqc/App.config
index 7ee61e9..564929d 100644
--- a/DevApp/Gs.WeightIqc/App.config
+++ b/DevApp/Gs.WeightIqc/App.config
@@ -5,7 +5,8 @@
 	</startup>
 	<appSettings>
 		<add key="WebApiUrl" value="http://192.168.1.145:81/" />
-		<add key="TimingMailInterval" value="10000" />
+		<add key="TimingMailInterval" value="1000" />
+		<add key="TimingMailIntervalStop" value="500" />
 		<add key="LogPath" value="logs" />
 	</appSettings>
 </configuration>
\ No newline at end of file
diff --git a/DevApp/Gs.WeightIqc/Form1.cs b/DevApp/Gs.WeightIqc/Form1.cs
index 6586897..71c88c9 100644
--- a/DevApp/Gs.WeightIqc/Form1.cs
+++ b/DevApp/Gs.WeightIqc/Form1.cs
@@ -5,17 +5,12 @@
 using NModbus.Serial;
 using System;
 using System.Collections.Generic;
-using System.ComponentModel;
 using System.Configuration;
-using System.Data;
-using System.Drawing;
 using System.IO.Ports;
 using System.Linq;
-using System.Text;
 using System.Threading;
-using System.Threading.Tasks;
 using System.Windows.Forms;
-using static System.Windows.Forms.VisualStyles.VisualStyleElement;
+
 
 namespace Gs.WeightIqc
 {
@@ -26,16 +21,15 @@
         private Form1.HandleInterfaceUpdataDelegate interfaceUpdataHandle;
         private Dictionary<string, Thread> dicThread = new Dictionary<string, Thread>();
         private System.Windows.Forms.Timer timer1 = new System.Windows.Forms.Timer();
+        int int32 = int.Parse(ConfigurationManager.AppSettings["TimingMailInterval"].ToString());
+        int int32Stop = int.Parse(ConfigurationManager.AppSettings["TimingMailIntervalStop"].ToString());
         public Form1()
         {
             InitializeComponent();
             GetComList();
             #region MyRegion
             int int32 = 10000;
-            string _vanishingSeconds = ConfigurationManager.AppSettings["TimingMailInterval"];
-            if (!string.IsNullOrEmpty(_vanishingSeconds))
-                int32 = int.Parse(_vanishingSeconds);
-            this.timer1.Interval = int32;
+            this.timer1.Interval = int32;//姣忛殧閰嶇疆绉掕涓�娆$О閲�
             this.button1.Enabled = true;
             this.button2.Enabled = false;
             this.cmbBaudRate.SelectedIndex = 1;
@@ -191,11 +185,11 @@
                     }
                     addModel(single.ToString(), int32.ToString());
                     ToolBox.LogHelper.Debug(this.ToString(), "single:" + single.ToString() + ",flag:" + flag.ToString() + ",int32:" + int32.ToString());
-                    Thread.Sleep(2000);
+                    Thread.Sleep(int32Stop);
                 }
                 catch (Exception ex)
                 {
-                    Thread.Sleep(2000);
+                    Thread.Sleep(int32Stop);
                 }
             }
         }
diff --git a/DevApp/Gs.WeightLine/App.config b/DevApp/Gs.WeightLine/App.config
index d50b33f..e1470ab 100644
--- a/DevApp/Gs.WeightLine/App.config
+++ b/DevApp/Gs.WeightLine/App.config
@@ -7,7 +7,9 @@
   </configSections>
 	<appSettings>
 		<add key="WebApiUrl" value="http://192.168.1.145:81/" />
-		<add key="TimingMailInterval" value="10000" />
+		<add key="TimingMailInterval" value="1000" />
+		<add key="TimingMailIntervalStop" value="500" />
+		<add key="TimingMailIntervalGridView" value="5000" />
 		<add key="LogPath" value="logs" />
 	</appSettings>
   <applicationSettings>
diff --git a/DevApp/Gs.WeightLine/Form1.cs b/DevApp/Gs.WeightLine/Form1.cs
index 4acabbe..a6dff1c 100644
--- a/DevApp/Gs.WeightLine/Form1.cs
+++ b/DevApp/Gs.WeightLine/Form1.cs
@@ -5,17 +5,14 @@
 using NModbus.Serial;
 using System;
 using System.Collections.Generic;
-using System.ComponentModel;
 using System.Configuration;
 using System.Data;
 using System.Drawing;
 using System.IO.Ports;
 using System.Linq;
-using System.Text;
 using System.Threading;
-using System.Threading.Tasks;
 using System.Windows.Forms;
-using static System.Windows.Forms.VisualStyles.VisualStyleElement;
+
 
 namespace Gs.WeightLine
 {
@@ -27,19 +24,17 @@
         private Form1.HandleInterfaceUpdataDelegate interfaceUpdataHandle;
         private Dictionary<string, Thread> dicThread = new Dictionary<string, Thread>();
         private System.Windows.Forms.Timer timer1 = new System.Windows.Forms.Timer();
-
-        System.Timers.Timer timerGridview = new System.Timers.Timer(10000);
+        int int32 = int.Parse(ConfigurationManager.AppSettings["TimingMailInterval"].ToString());
+        int int32Stop = int.Parse(ConfigurationManager.AppSettings["TimingMailIntervalStop"].ToString());
+        private static double int32GridView = double.Parse(ConfigurationManager.AppSettings["TimingMailIntervalGridView"].ToString());
+        System.Timers.Timer timerGridview = new System.Timers.Timer(int32GridView);
         public Form1()
         {
             InitializeComponent();
             GetComList();
             comLine.getSuppler("");
             #region MyRegion
-            int int32 = 10000;
-            string _vanishingSeconds = ConfigurationManager.AppSettings["TimingMailInterval"];
-            if (!string.IsNullOrEmpty(_vanishingSeconds))
-                int32 = int.Parse(_vanishingSeconds);
-            this.timer1.Interval = int32;
+            this.timer1.Interval = int32;//姣忛殧閰嶇疆绉掕涓�娆$О閲�
             this.button1.Enabled = true;
             this.button2.Enabled = false;
             this.comLine.IsReadly = false;
@@ -270,11 +265,11 @@
                     }
                     addModel(single.ToString(), int32.ToString());
                     LogHelper.Debug(this.ToString(), "single:" + single.ToString() + ",flag:" + flag.ToString() + ",int32:" + int32.ToString());
-                    Thread.Sleep(2000);
+                    Thread.Sleep(int32Stop);
                 }
                 catch (Exception ex)
                 {
-                    Thread.Sleep(2000);
+                    Thread.Sleep(int32Stop);
                 }
             }
         }

--
Gitblit v1.9.3