[BackendWorkerService]修改月歸檔起訖時間邏輯
This commit is contained in:
		
							parent
							
								
									30457e621f
								
							
						
					
					
						commit
						0615483bb4
					
				@ -6,6 +6,7 @@ using Microsoft.Extensions.Logging;
 | 
				
			|||||||
using Microsoft.Extensions.Options;
 | 
					using Microsoft.Extensions.Options;
 | 
				
			||||||
using Newtonsoft.Json;
 | 
					using Newtonsoft.Json;
 | 
				
			||||||
using Newtonsoft.Json.Linq;
 | 
					using Newtonsoft.Json.Linq;
 | 
				
			||||||
 | 
					using NPOI.SS.Formula.Functions;
 | 
				
			||||||
using Quartz;
 | 
					using Quartz;
 | 
				
			||||||
using Repository.BackendRepository.Interface;
 | 
					using Repository.BackendRepository.Interface;
 | 
				
			||||||
using Repository.Helper;
 | 
					using Repository.Helper;
 | 
				
			||||||
@ -674,7 +675,7 @@ namespace BackendWorkerService.Quartz.Jobs
 | 
				
			|||||||
                                    }
 | 
					                                    }
 | 
				
			||||||
                                }
 | 
					                                }
 | 
				
			||||||
                            }
 | 
					                            }
 | 
				
			||||||
                            await task_Detail.InsertWorkTime_End("ArchiveElectricMeterDayJob", "Day", "任務完成");
 | 
					                            await task_Detail.InsertWorkTime_End("ArchiveElectricMeterDayJob", "Day", "水電表天任務完成");
 | 
				
			||||||
                        }
 | 
					                        }
 | 
				
			||||||
                        catch (Exception exception)
 | 
					                        catch (Exception exception)
 | 
				
			||||||
                        {
 | 
					                        {
 | 
				
			||||||
@ -1102,9 +1103,9 @@ namespace BackendWorkerService.Quartz.Jobs
 | 
				
			|||||||
                            var preDay = now.AddDays(-1); //取得前一天
 | 
					                            var preDay = now.AddDays(-1); //取得前一天
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                            var dayInMonth = DateTime.DaysInMonth(preDay.Year, preDay.Month);
 | 
					                            var dayInMonth = DateTime.DaysInMonth(preDay.Year, preDay.Month);
 | 
				
			||||||
                            var FirstDay = preDay.AddDays(- dayInMonth + 1);
 | 
					                            var FirstDay = new DateTime(preDay.Year, preDay.Month, 1);
 | 
				
			||||||
                            //var LastDay = now.AddMonths(1).AddDays(-now.AddMonths(1).Day);  // 這是抓到該月最後一天
 | 
					                            //var LastDay = now.AddMonths(1).AddDays(-now.AddMonths(1).Day);  // 這是抓到該月最後一天
 | 
				
			||||||
                            var LastDay = FirstDay.AddMonths(1);  //但實際應該抓隔月第一天
 | 
					                            var LastDay = now;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -1600,7 +1601,7 @@ namespace BackendWorkerService.Quartz.Jobs
 | 
				
			|||||||
                                    await backgroundServiceMsSqlRepository.ExecuteSql(mySql, waterArchiveMonthRawDatas);
 | 
					                                    await backgroundServiceMsSqlRepository.ExecuteSql(mySql, waterArchiveMonthRawDatas);
 | 
				
			||||||
                                }
 | 
					                                }
 | 
				
			||||||
                            }
 | 
					                            }
 | 
				
			||||||
                            await task_Detail.InsertWorkTime_End("ArchiveElectricMeterDayJob", "Month", "任務完成");
 | 
					                            await task_Detail.InsertWorkTime_End("ArchiveElectricMeterDayJob", "Month", "水電表月任務完成");
 | 
				
			||||||
                        }
 | 
					                        }
 | 
				
			||||||
                        catch (Exception exception)
 | 
					                        catch (Exception exception)
 | 
				
			||||||
                        {
 | 
					                        {
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user