日志重写

This commit is contained in:
a88359121
2025-07-31 11:04:47 +08:00
parent a803360523
commit 941564d8a4
28 changed files with 325 additions and 399 deletions
+9 -7
View File
@@ -1,6 +1,7 @@
using JinYuan.Helper;
using JinYuan.Models;
using JinYuan.VirtualDataLibrary;
using PLCCommunication;
using System;
using System.Windows.Forms;
@@ -38,20 +39,21 @@ namespace LargeSquareOne
this.dgv_Log.Rows[rowCount].Cells[2].Value = info;
// 设置最新行为活动行 (当前行)
this.dgv_Log.CurrentCell = this.dgv_Log.Rows[this.dgv_Log.Rows.Count - 1].Cells[0];
}
//存储到数据库
CommonMethods.db.AddReturnBool(new SysLog()
var model = new SysLog()
{
InsertTime = CurrentTime,
LogType = "系统日志",
Note = info,
AlarmType = isError ? "错误" : "信息",
Operater = CommonMethods.currentAdmin.LoginName
});
};
//存储到数据库
var b = CommonMethods.db.AddReturnBool(model);
if (!b)
{
LoggerHelp.WriteError($"数据库记录失败. 表:SysLog,内容:{model.ToJsonString()}");
}
}
/// <summary>