串口逻辑,数据库读写逻辑修改

This commit is contained in:
sc committed 2025-09-10 21:42:52 +08:00
commit 4af9042d5f
18 files changed
+658 -599

No files matched your search

+2 -7
View File
@@ -34,9 +34,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.EX
public partial class ManualDyelot : Window
{
private SQLiteHelper SQLiteHelpers = null; //定义数据库
private readonly string DBAddress = Environment.CurrentDirectory + "\\DataBase\\SCCM.db"; //数据库路径
DataTable dyelotdat = new DataTable();
DataTable dyelotdat = new DataTable();
public static string Machines;
DataTable mach = new DataTable();
DataTable RRODUCTdataTable = new DataTable(); //建立RRODUCT缓存
@@ -125,8 +123,6 @@ namespace SunlightCentralizedControlManagement_SCCM_.EX
if (string.IsNullOrEmpty(comboBoxMachine.Text)) return;//未输入机台时返回
try
{
SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
SQLiteHelpers.Open(); //打开数据库
Dictionary<string, object> Dyelot_DAT = new Dictionary<string, object>();//缓存函数
for (int x = 0; x < RRODUCTdataTable.Rows.Count; x++)
{
@@ -144,10 +140,9 @@ namespace SunlightCentralizedControlManagement_SCCM_.EX
Dyelot_DAT.Add("DispenseStartTime", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
Dyelot_DAT.Add("Grams", RRODUCTdataTable.Rows[x]["TARGET_WT"]);
Dyelot_DAT.Add("Amount", RRODUCTdataTable.Rows[x]["Amount"]);
SQLiteHelpers.InsertData("Dyelot", Dyelot_DAT);//行插入
MainWindowViewModel.SQLiteHelpers.InsertData("Dyelot", Dyelot_DAT);//行插入
Dyelot_DAT.Clear();
}
SQLiteHelpers.Close(); //关闭连接
LogGing.ExchangeDATA("Dyelot=" + dyelot.Text + ";Machine=" + comboBoxMachine.Text +
";Program=------;User=" + MainWindowViewModel.USER_data + ";");