| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Data.Entity.Core.Common.CommandTrees; |
| | | using System.Data.Entity.Core.Common.CommandTrees.ExpressionBuilder; |
| | | using System.Data.Entity.Validation; |
| | | using System.Data.SqlTypes; |
| | | using System.Diagnostics; |
| | |
| | | { |
| | | try |
| | | { |
| | | //Thread.Sleep(8 * 60 * 60 * 1000);//每天8小时一次 |
| | | Thread.Sleep(20 * 60 * 1000);//20分钟执行一次 |
| | | |
| | | //每天凌晨1、3、5、6执行一次 |
| | | var hour = DateTime.Now.Hour; |
| | | if (!(hour == 1 || hour == 3 || hour == 5 || hour == 6)) |
| | | { |
| | | continue; |
| | | } |
| | | |
| | | try |
| | | { |
| | | LogTextHelper.BatchDeleteLog(); |
| | |
| | | |
| | | try |
| | | { |
| | | ClearDataHandler.Delete_WorkPieceInfoLog(-7); |
| | | ClearDataHandler.Delete_WorkPieceInfoLog(7); |
| | | |
| | | ClearDataHandler.Delete_WorkPieceLog(-7); |
| | | ClearDataHandler.Delete_WorkPieceLog(4); |
| | | |
| | | ClearDataHandler.Delete_AccessInterfaceLogForRequest(7); |
| | | |
| | | ClearDataHandler.Delete_QualityDataInfoLog(7); |
| | | |
| | | ClearDataHandler.Delete_sys_log_op(7); |
| | | |
| | | ClearDataHandler.Delete_sys_log_ex(7); |
| | | |
| | | ClearDataHandler.Delete_EquipmentWorkingLog(7); |
| | | |
| | | Log4NetHelper.WriteInfoLog(logType, $"定时删除表数据成功:"); |
| | | } |
| | |
| | | } |
| | | |
| | | |
| | | //处理OP60的数据 |
| | | try |
| | | { |
| | | LogTextHelper.BatchDeleteLog(@"Q:\Measuring_Data_df_Copy", 20); |
| | | Log4NetHelper.WriteInfoLog(logType, $"处理OP60的数据(Q:\\Measuring_Data_df_Copy)-定时删除数据成功:"); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | Log4NetHelper.WriteErrorLog(logType, $"处理OP60的数据(Q:\\Measuring_Data_df_Copy)-定时删除数据异常:", ex); |
| | | } |
| | | |
| | | try |
| | | { |
| | | LogTextHelper.BatchDeleteLog(@"Q:\Measuring_Data_dfq", 20); |
| | | Log4NetHelper.WriteInfoLog(logType, $"处理OP60的数据(Q:\\Measuring_Data_dfq)-定时删除数据"); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | Log4NetHelper.WriteErrorLog(logType, $"处理OP60的数据(Q:\\Measuring_Data_dfq)-定时删除数据异常:", ex); |
| | | } |
| | | |
| | | |
| | | //处理OP80的数据 |
| | | try |
| | | { |
| | | LogTextHelper.BatchDeleteLog(@"X:\CA4GC20TD_COPY", 20); |
| | | Log4NetHelper.WriteInfoLog(logType, $"处理OP80的数据(X:\\CA4GC20TD_COPY)-定时删除数据:"); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | Log4NetHelper.WriteErrorLog(logType, $"处理OP80的数据(X:\\CA4GC20TD_COPY)-定时删除数据异常:", ex); |
| | | } |
| | | |
| | | try |
| | | { |
| | | LogTextHelper.BatchDeleteLog(@"X:\CA4GC20TD_Error", 60); |
| | | Log4NetHelper.WriteInfoLog(logType, $"处理OP80的数据(X:\\CA4GC20TD_Error)-定时删除数据:"); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | Log4NetHelper.WriteErrorLog(logType, $"处理OP80的数据(X:\\CA4GC20TD_Error)-定时删除数据异常:", ex); |
| | | } |
| | | |
| | | try |
| | | { |
| | | LogTextHelper.BatchDeleteLog(@"X:\CA4GC20TD_NoNum", 60); |
| | | Log4NetHelper.WriteInfoLog(logType, $"处理OP80的数据(X:\\CA4GC20TD_NoNum)-定时删除数据"); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | Log4NetHelper.WriteErrorLog(logType, $"处理OP80的数据(X:\\CA4GC20TD_NoNum)-定时删除数据异常:", ex); |
| | | } |
| | | |
| | | |
| | | |
| | | try |
| | | { |
| | | //处理OP20的数据 |
| | | LogTextHelper.BatchDeleteLog(@"W:\", 20); |
| | | Log4NetHelper.WriteInfoLog(logType, $"处理OP20的数据-定时删除数据:"); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | Log4NetHelper.WriteErrorLog(logType, $"处理OP20的数据-定时删除数据异常:", ex); |
| | | } |
| | | |
| | | |
| | | Thread.Sleep(8 * 60 * 60 * 1000);//每天8小时一次 |
| | | } |
| | | catch (Exception ex) |
| | | { |