fix
This commit is contained in:
@@ -99,6 +99,114 @@ public static partial class EEMStatus
|
||||
queryok = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 배터리데이터수신시 값을 기록한다.
|
||||
/// </summary>
|
||||
public static void MakeBMSInformation_INFO()
|
||||
{
|
||||
if (PUB.BMS.Current_DataTime.Year == 1982 || LastBMSIFTime == PUB.BMS.Current_DataTime || PUB.setting.MCID.isEmpty()) return;
|
||||
try
|
||||
{
|
||||
// BMS 데이터 취득 (실제 BMS 객체에서 데이터를 가져와야 함)
|
||||
// 예시: var bms = Project.Device.BMS.Instance;
|
||||
var mcid = Project.PUB.setting.MCID;
|
||||
var timestr = PUB.BMS.Current_DataTime.ToString("yyyy-MM-dd HH:mm:ss");
|
||||
|
||||
// BMS 데이터 (실제 값으로 교체 필요)
|
||||
var info_volt = PUB.BMS.Current_Volt;// "null"; // bms.Voltage
|
||||
var info_current = PUB.BMS.Current_Amp;// "null"; // bms.Current
|
||||
var info_capa = PUB.BMS.Current_MaxAmp;// "null"; // bms.Capacity
|
||||
var info_level = PUB.BMS.Current_Level;// "null"; // bms.Level
|
||||
var info_temp1 = PUB.BMS.Current_temp1;// "null"; // bms.Temp1
|
||||
var info_temp2 = PUB.BMS.Current_temp2;// "null"; // bms.Temp2
|
||||
var cell_volt1 = PUB.BMS.CellVoltage[0];// "null"; // bms.CellVolt1
|
||||
var cell_volt2 = PUB.BMS.CellVoltage[1]; // bms.CellVolt2
|
||||
var cell_volt3 = PUB.BMS.CellVoltage[2]; // bms.CellVolt3
|
||||
var cell_volt4 = PUB.BMS.CellVoltage[3]; // bms.CellVolt4
|
||||
var cell_volt5 = PUB.BMS.CellVoltage[4]; // bms.CellVolt5
|
||||
var cell_volt6 = PUB.BMS.CellVoltage[5]; // bms.CellVolt6
|
||||
var cell_volt7 = PUB.BMS.CellVoltage[6]; // bms.CellVolt7
|
||||
var cell_volt8 = PUB.BMS.CellVoltage[7]; // bms.CellVolt8
|
||||
|
||||
// Status 폴더에 SQL 파일 생성
|
||||
var path = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Status");
|
||||
if (System.IO.Directory.Exists(path) == false)
|
||||
System.IO.Directory.CreateDirectory(path);
|
||||
|
||||
var file = System.IO.Path.Combine(path, $"{DateTime.Now.ToString("HHmmssfff")}_BMS_INF.sql");
|
||||
|
||||
var sql = "insert into AGV_Shuttle_BMS(MCID,wdate,info_volt,info_current,info_capa,info_level,info_temp1,info_temp2) " +
|
||||
"values('{0}','{1}',{2},{3},{4},{5},{6},{7})";
|
||||
|
||||
sql = string.Format(sql, mcid, timestr, info_volt, info_current, info_capa, info_level, info_temp1, info_temp2);
|
||||
|
||||
System.IO.File.WriteAllText(file, sql, System.Text.Encoding.Default);
|
||||
LastBMSIFTime = DateTime.Now;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
// 오류 로깅 (필요시 PUB.log.Add 등으로 처리)
|
||||
Console.WriteLine($"MakeBMSInformation Error: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
static DateTime LastBMSIFTime = DateTime.Now;
|
||||
static DateTime LastBMSCVTime = DateTime.Now;
|
||||
|
||||
/// <summary>
|
||||
/// 배터리데이터수신시 값을 기록한다.
|
||||
/// </summary>
|
||||
public static void MakeBMSInformation_Cell()
|
||||
{
|
||||
if (PUB.BMS.Current_CellTime.Year == 1982 || LastBMSCVTime == PUB.BMS.Current_CellTime || PUB.setting.MCID.isEmpty()) return;
|
||||
try
|
||||
{
|
||||
// BMS 데이터 취득 (실제 BMS 객체에서 데이터를 가져와야 함)
|
||||
// 예시: var bms = Project.Device.BMS.Instance;
|
||||
var mcid = Project.PUB.setting.MCID;
|
||||
var timestr = PUB.BMS.Current_CellTime.ToString("yyyy-MM-dd HH:mm:ss");
|
||||
|
||||
// BMS 데이터 (실제 값으로 교체 필요)
|
||||
var info_volt = PUB.BMS.Current_Volt;// "null"; // bms.Voltage
|
||||
var info_current = PUB.BMS.Current_Amp;// "null"; // bms.Current
|
||||
var info_capa = PUB.BMS.Current_MaxAmp;// "null"; // bms.Capacity
|
||||
var info_level = PUB.BMS.Current_Level;// "null"; // bms.Level
|
||||
var info_temp1 = PUB.BMS.Current_temp1;// "null"; // bms.Temp1
|
||||
var info_temp2 = PUB.BMS.Current_temp2;// "null"; // bms.Temp2
|
||||
var cell_volt1 = PUB.BMS.CellVoltage[0];// "null"; // bms.CellVolt1
|
||||
var cell_volt2 = PUB.BMS.CellVoltage[1]; // bms.CellVolt2
|
||||
var cell_volt3 = PUB.BMS.CellVoltage[2]; // bms.CellVolt3
|
||||
var cell_volt4 = PUB.BMS.CellVoltage[3]; // bms.CellVolt4
|
||||
var cell_volt5 = PUB.BMS.CellVoltage[4]; // bms.CellVolt5
|
||||
var cell_volt6 = PUB.BMS.CellVoltage[5]; // bms.CellVolt6
|
||||
var cell_volt7 = PUB.BMS.CellVoltage[6]; // bms.CellVolt7
|
||||
var cell_volt8 = PUB.BMS.CellVoltage[7]; // bms.CellVolt8
|
||||
|
||||
// Status 폴더에 SQL 파일 생성
|
||||
var path = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Status");
|
||||
if (System.IO.Directory.Exists(path) == false)
|
||||
System.IO.Directory.CreateDirectory(path);
|
||||
|
||||
var file = System.IO.Path.Combine(path, $"{DateTime.Now.ToString("HHmmssfff")}_BMS_CV.sql");
|
||||
|
||||
var sql = "insert into AGV_Shuttle_BMS(MCID,wdate," +
|
||||
"cell_volt1,cell_volt2,cell_volt3,cell_volt4,cell_volt5,cell_volt6,cell_volt7,cell_volt8) " +
|
||||
"values('{0}','{1}',{2},{3},{4},{5},{6},{7},{8},{9})";
|
||||
|
||||
sql = string.Format(sql, mcid, timestr,
|
||||
cell_volt1, cell_volt2, cell_volt3, cell_volt4,
|
||||
cell_volt5, cell_volt6, cell_volt7, cell_volt8);
|
||||
|
||||
System.IO.File.WriteAllText(file, sql, System.Text.Encoding.Default);
|
||||
LastBMSCVTime = DateTime.Now;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
// 오류 로깅 (필요시 PUB.log.Add 등으로 처리)
|
||||
Console.WriteLine($"MakeBMSInformation Error: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
public static void UpdateStatusSQL(eSMStep status, bool _extrun = false, string remark = "")
|
||||
{
|
||||
var tsrun = DateTime.Now - StatusChecktime;
|
||||
|
||||
Reference in New Issue
Block a user