diff --git a/shangjian/.vs/BL/v17/.suo b/shangjian/.vs/BL/v17/.suo
deleted file mode 100644
index 22b8af1..0000000
Binary files a/shangjian/.vs/BL/v17/.suo and /dev/null differ
diff --git a/shangjian/XGLFinishPro/App.config b/shangjian/XGLFinishPro/App.config
index 6be8e9c..5b859af 100644
--- a/shangjian/XGLFinishPro/App.config
+++ b/shangjian/XGLFinishPro/App.config
@@ -15,9 +15,9 @@
-
+
-
+
diff --git a/shangjian/XGLFinishPro/Views/weighWindows.xaml b/shangjian/XGLFinishPro/Views/weighWindows.xaml
index 744a173..7ce90d2 100644
--- a/shangjian/XGLFinishPro/Views/weighWindows.xaml
+++ b/shangjian/XGLFinishPro/Views/weighWindows.xaml
@@ -94,31 +94,31 @@
-
+
-
+
-
+
-
+
-
-
+
+
-
+
@@ -173,7 +173,7 @@
-
+
@@ -185,11 +185,11 @@
-
+
-
+
diff --git a/shangjian/XGLFinishPro/Views/weighWindows.xaml.cs b/shangjian/XGLFinishPro/Views/weighWindows.xaml.cs
index 44740d7..9709f1c 100644
--- a/shangjian/XGLFinishPro/Views/weighWindows.xaml.cs
+++ b/shangjian/XGLFinishPro/Views/weighWindows.xaml.cs
@@ -25,6 +25,8 @@ using XGL.Dats.DBServiceFinishProd;
using XGL.Models;
using XGL.Models.Model.OrderPrepare;
using System.Text.RegularExpressions;
+using System.Configuration;
+
namespace XGLFinishPro.Views
{
///
@@ -102,9 +104,13 @@ namespace XGLFinishPro.Views
dispatcher = Application.Current.Dispatcher;
// 创建一个新的SerialPort实例
serialPort = new SerialPort();
-
+ string portName = ConfigurationManager.AppSettings["weigh"];
+ if (!string.IsNullOrEmpty(portName))
+ {
+ serialPort.PortName = portName;
+ }
// 设置串口号和波特率
- serialPort.PortName = "COM12"; // 串口号根据实际情况设置
+ //serialPort.PortName = "COM12"; // 串口号根据实际情况设置
serialPort.BaudRate = 9600; // 波特率根据实际情况设置
// 设置其他串口参数,如数据位、校验位等
@@ -140,7 +146,7 @@ namespace XGLFinishPro.Views
Match match1 = Regex.Match(data, @"(\d+\.\d+)");
string bb = match1.Groups[1].Value;
upDateDate(bb);
- UpdateUI(data);
+ UpdateUI(bb);
break; // 读到数据后跳出循环
}
}
@@ -213,34 +219,40 @@ namespace XGLFinishPro.Views
private void Button_Click_2(object sender, RoutedEventArgs e)
{
string wher = "";
- if (!renwubianhao1.Text.IsNullOrEmpty())
+ // 使用Dispatcher.Invoke确保在UI线程上执行更新操作
+ dispatcher.Invoke(() =>
{
- wher += " and qct.check_no LIKE '%" + renwubianhao1.Text + "%'";
- }
- if (!jianyanjiedian1.Text.IsNullOrEmpty())
- {
- wher += " and qt.check_name LIKE '%" + jianyanjiedian1.Text + "%'";
- }
- if (!jianyanwuliao1.Text.IsNullOrEmpty())
- {
- wher += " and qct.material_name LIKE '%" + jianyanwuliao1.Text + "%'";
- }
- if (!dateStart.Text.IsNullOrEmpty())
- {
- wher += " and qct.income_time='" + dateStart.Text+"'";
- }
- var dataTable = userDbWareHouse.WeighingTask(wher);
- if (dataTable != null && dataTable.Rows.Count > 0)
- {
- // 绑定 DataTable 到 DataGrid
- WeighingTaskDateTable.ItemsSource = null;
- WeighingTaskDateTable.ItemsSource = dataTable.DefaultView;
- }
- else
- {
- // 清空 DataGrid
- WeighingTaskDateTable.ItemsSource = null;
- }
+ // 更新UI控件
+ if (!renwubianhao1.Text.IsNullOrEmpty())
+ {
+ wher += " and qct.check_no LIKE '%" + renwubianhao1.Text + "%'";
+ }
+ if (!jianyanjiedian1.Text.IsNullOrEmpty())
+ {
+ wher += " and qt.check_name LIKE '%" + jianyanjiedian1.Text + "%'";
+ }
+ if (!jianyanwuliao1.Text.IsNullOrEmpty())
+ {
+ wher += " and qct.material_name LIKE '%" + jianyanwuliao1.Text + "%'";
+ }
+ if (!dateStart.Text.IsNullOrEmpty())
+ {
+ wher += " and qct.income_time='" + dateStart.Text + "'";
+ }
+ var dataTable = userDbWareHouse.WeighingTask(wher);
+ if (dataTable != null && dataTable.Rows.Count > 0)
+ {
+ // 绑定 DataTable 到 DataGrid
+ WeighingTaskDateTable.ItemsSource = null;
+ WeighingTaskDateTable.ItemsSource = dataTable.DefaultView;
+ }
+ else
+ {
+ // 清空 DataGrid
+ WeighingTaskDateTable.ItemsSource = null;
+ }
+ });
+
}
///
@@ -315,6 +327,7 @@ namespace XGLFinishPro.Views
checkTaskModel.actual_value = null;
}
userDbWareHouse.InsertCheckTaskDetail(checkTaskModel.actual_value, checkTaskModel.record_id);
+ Button_Click_2(null, null);
// 从数据源中移除该项
}
}