V1.0.0.7 - 2025/12/22

* Database improved all
This commit is contained in:
2025-12-22 12:46:46 +09:00
parent 79fea6964b
commit 0af235eb3d
14 changed files with 642 additions and 364 deletions

View File

@@ -1,14 +1,15 @@
using System;
using DevExpress.XtraEditors;
using LFP_Manager.DataStructure;
using LFP_Manager.Utils;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using DevExpress.XtraEditors;
using LFP_Manager.Utils;
using LFP_Manager.DataStructure;
namespace LFP_Manager.Controls
{
@@ -35,6 +36,11 @@ namespace LFP_Manager.Controls
#region PUBLIC UPDATE
public void UpdateConfig(CommConfig aConfig)
{
this.Config = aConfig;
}
public void EventUpdate(int id, string aEvent)
{
if (this.InvokeRequired)
@@ -123,21 +129,38 @@ namespace LFP_Manager.Controls
meDataLog.Text = "";
}
private void BtnRefresh_Click(object sender, EventArgs e)
private async void BtnRefresh_Click(object sender, EventArgs e)
{
if (Config != null)
{
try
{
string modelName = csConstData.UART_MODEL[Config.UartModelIndex];
AlarmHistory = csDbUtils.GetBmsAlarmDataByDataTable(modelName, DateTime.Now, "");
if (Config == null) return;
AlarmHistoryUpdate(AlarmHistory);
}
catch (Exception ex)
BtnRefresh.Enabled = false;
Cursor = Cursors.WaitCursor;
try
{
// DB 조회는 백그라운드에서
var now = DateTime.Now;
var table = await Task.Run(() => csDbUtils.GetBmsAlarmDataByDataTable(Config, now, ""));
// UI 바인딩
Action bind = () =>
{
_ = MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
AlarmHistory = table ?? new DataTable();
GvAlarmHistory.DataSource = AlarmHistory;
};
if (InvokeRequired)
BeginInvoke(new MethodInvoker(() => bind())); // ← 새 MethodInvoker 생성
else
bind();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
finally
{
Cursor = Cursors.Default;
BtnRefresh.Enabled = true;
}
}
@@ -166,8 +189,7 @@ namespace LFP_Manager.Controls
{
try
{
string modelName = csConstData.UART_MODEL[Config.UartModelIndex];
AlarmHistory = csDbUtils.GetBmsAlarmDataByDataTable(modelName, DateTime.Now, "");
AlarmHistory = csDbUtils.GetBmsAlarmDataByDataTable(Config, DateTime.Now, "");
AlarmHistoryUpdate(AlarmHistory);
}
@@ -180,8 +202,7 @@ namespace LFP_Manager.Controls
{
try
{
string modelName = csConstData.UART_MODEL[Config.UartModelIndex];
AlarmHistory = csDbUtils.GetBmsAlarmDataByDataTable(modelName, DateTime.Now, "");
AlarmHistory = csDbUtils.GetBmsAlarmDataByDataTable(Config, DateTime.Now, "");
AlarmHistoryUpdate(AlarmHistory);
}