Browse Source

获取正常年份

jochu_liu 1 year ago
parent
commit
56a464ace4
1 changed files with 2 additions and 2 deletions
  1. 2 2
      TimedUpload/QuartzJobs/ChangleSecondPumpDataJob.cs

+ 2 - 2
TimedUpload/QuartzJobs/ChangleSecondPumpDataJob.cs

@@ -89,7 +89,7 @@ namespace TimedUpload.QuartzJobs
 
                 for (int k = 0; k < dtDevice.Rows.Count; k++)
                 {
-                    string table = "历史记录_" + dtDevice.Rows[k]["devId"].ToString().PadLeft(6,'0')+DateTime.Now.AddYears(-1).Year.ToString();
+                    string table = "历史记录_" + dtDevice.Rows[k]["devId"].ToString().PadLeft(6,'0')+DateTime.Now.Year.ToString();
                     String sql = @"SELECT TOP 2000 [id]
                         ,[设备ID],[记录时间],[采集时间]
                         ,[设备状态],[通讯状态],[数据来源]
@@ -109,7 +109,7 @@ namespace TimedUpload.QuartzJobs
                         ,[出水设定压力],[出水端实际压力]
                         ,[进水设定压力],[进水端实际压力]
                         ,[瞬时流量],[累计流量]
-                    FROM [dbo].[历史记录_000015_2022] where 采集时间 > '" + Convert.ToDateTime(dtDevice.Rows[k]["uploadTime"]).ToString("yyyy-MM-dd HH:mm:ss") + "' ORDER BY 采集时间";
+                    FROM "+ table + " where 采集时间 > '" + Convert.ToDateTime(dtDevice.Rows[k]["uploadTime"]).ToString("yyyy-MM-dd HH:mm:ss") + "' ORDER BY 采集时间";
                     DataTable dtHistory = dbHelper.Fill(sql); 
                     for (int i = 0; i < dtHistory.Rows.Count; i++)
                     {