2024-06-21 09:30:10 +08:00
|
|
|
|
using CirculateTool.Attribute;
|
2024-05-14 16:30:56 +08:00
|
|
|
|
using WcsMain.Business.CommonAction;
|
|
|
|
|
|
|
|
|
|
|
|
namespace WcsMain.Business.CirculationTask.CommonCirculation;
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 数据清理
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
[Circulation("数据清理")]
|
|
|
|
|
|
public class DataClear(ClearData clearData)
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 定时清理无用数据, ---- 每隔10分钟清理一次
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <returns></returns>
|
2024-08-15 13:13:38 +08:00
|
|
|
|
[CirculationTime(["03:00"], "数据清理")]
|
2024-06-21 10:14:13 +08:00
|
|
|
|
public void ClearDataCirculate()
|
2024-05-14 16:30:56 +08:00
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
|
|
|
|
|
// 清理日志文件 -- 清理多少天之前
|
2024-06-21 14:37:27 +08:00
|
|
|
|
int logCount = clearData.ClearLogFile(100);
|
2024-05-14 16:30:56 +08:00
|
|
|
|
ConsoleLog.Tip(logCount > 0, $"[数据清理]日志文件:{logCount}");
|
|
|
|
|
|
|
2024-06-21 14:37:27 +08:00
|
|
|
|
// 清理数据库
|
|
|
|
|
|
clearData.ClearDataBase();
|
2024-05-14 16:30:56 +08:00
|
|
|
|
}
|
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
|
{
|
2024-06-11 12:33:14 +08:00
|
|
|
|
ConsoleLog.Exception($"【数据清理】线程发生异常,异常信息:{ex}");
|
2024-05-14 16:30:56 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|