| 
					
				 | 
			
			
				@@ -90,6 +90,7 @@ namespace XdCxRhDW 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             _ = XlScan(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             _ = XlClear(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             _ = ClearLocalFile(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            _ = ClearLog(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             await XlLonCalc(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         private void StartWebApi() 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -284,6 +285,29 @@ namespace XdCxRhDW 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        private async Task ClearLog() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            using (RHDWContext db = new RHDWContext()) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                try 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    var time1 = DateTime.Today.AddDays(-7); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    var time2 = DateTime.Today.AddDays(-30); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    var delItems = await db.LogRes.Where(p => p.LogTime < time1 && p.LogType != EnumLogType.Error).ToListAsync(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    db.LogRes.RemoveRange(delItems); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    var delItems2 = await db.LogRes.Where(p => p.LogTime < time2 && p.LogType == EnumLogType.Error).ToListAsync(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    db.LogRes.RemoveRange(delItems2); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    await db.SaveChangesAsync(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                catch (Exception ex) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    Serilog.Log.Error(ex, "清理日志信息异常!"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            await Task.Delay(3600 * 1000); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         private void btn_ItemClick(object sender, ItemClickEventArgs e) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             var btnTxt = e?.Item?.Caption?.Trim() ?? "任务管理"; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -345,47 +369,55 @@ namespace XdCxRhDW 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         private void StartProcess() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            KillProcess(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            Process pro = new Process(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            var servicesDir = Directory.GetDirectories(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Service\\"), "*", SearchOption.TopDirectoryOnly); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            foreach (var item in servicesDir) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            Task.Run(() => 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                try 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                KillProcess(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                Process pro = new Process(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                var servicesDir = Directory.GetDirectories(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Service\\"), "*", SearchOption.TopDirectoryOnly); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                foreach (var item in servicesDir) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    string exeName = Path.GetFileNameWithoutExtension(item); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    string exeFile = $"{item}\\{exeName}.exe"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    pro.StartInfo.FileName = exeFile; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    pro.StartInfo.WindowStyle = ProcessWindowStyle.Hidden; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    pro.StartInfo.Arguments = $"http://127.0.0.1:{SysConfig.Config.HttpPort}"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    pro.Start(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                catch (Exception ex) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    Serilog.Log.Error(ex, $"启动【{item}】中的服务异常"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    DxHelper.MsgBoxHelper.ShowError($"启动【{item}】中的服务异常"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    try 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        string exeName = Path.GetFileNameWithoutExtension(item); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        string exeFile = $"{item}\\{exeName}.exe"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        pro.StartInfo.FileName = exeFile; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        pro.StartInfo.WindowStyle = ProcessWindowStyle.Hidden; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        pro.StartInfo.Arguments = $"http://127.0.0.1:{SysConfig.Config.HttpPort}"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        pro.Start(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    catch (Exception ex) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        Serilog.Log.Error(ex, $"启动【{item}】中的服务异常"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        DxHelper.MsgBoxHelper.ShowError($"启动【{item}】中的服务异常"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         private void KillProcess() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            List<Process> list = new List<Process>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            var servicesDir = Directory.GetDirectories(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Service\\"), "*", SearchOption.TopDirectoryOnly); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            foreach (var item in servicesDir) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                string exeName = Path.GetFileNameWithoutExtension(item); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                list.AddRange(Process.GetProcessesByName(exeName)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            foreach (var item in list) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            try 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                try 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                List<Process> list = new List<Process>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                var servicesDir = Directory.GetDirectories(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Service\\"), "*", SearchOption.TopDirectoryOnly); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                foreach (var item in servicesDir) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    item.Kill(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    string exeName = Path.GetFileNameWithoutExtension(item); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    list.AddRange(Process.GetProcessesByName(exeName)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                catch 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                foreach (var item in list) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    try 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        item.Kill(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    catch 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            catch 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            { } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 } 
			 |