Explorar el Código

水厂 添加个数据库连接

jochu_liu hace 1 año
padre
commit
b3cfd0f9a9

+ 30 - 3
TimedUpload/QuartzJobs/ChangleWorkmanshipDataUploadJob.cs

@@ -74,7 +74,7 @@ namespace TimedUpload.QuartzJobs
                 #region 获取水质
                 string ph = "0", chlorine = "0", turbidity = "0";
                 string waterQulitySql = @"SELECT TOP 2 [RecordName],[RecordValue] FROM [dbo].[历史记录] where DevId = 3 order by GetDateTime DESC";
-                DataTable waterQulityDt = dbHelper.Fill(waterQulitySql);
+                DataTable waterQulityDt = waterQulityDbHelper.Fill(waterQulitySql);
                 if (waterQulityDt != null && waterQulityDt.Rows.Count > 0)
                 {
                     for (int i = 0; i < waterQulityDt.Rows.Count; i++)
@@ -125,7 +125,7 @@ namespace TimedUpload.QuartzJobs
                     ,[出水端实际压力] 泵出口压力
                     ,[进水端实际压力] 泵进口压力
                     FROM [dbo].[历史记录_000015_" + yearStr + "]  order by id DESC";
-                DataTable dtDevice = dbHelper.Fill(factorySql);
+                DataTable dtDevice = secondDbHelper.Fill(factorySql);
                 if (dtDevice == null || dtDevice.Rows.Count == 0)
                 {
                     return;
@@ -211,7 +211,7 @@ namespace TimedUpload.QuartzJobs
                         ,[qingshuichiFluidLevel] 清水池液位
                     FROM[Waterwell].[dbo].[WaterFactoryDaliyRecord] order by id DESC";
 
-                DataTable dtDevice = dbHelper.Fill(factorySql);
+                DataTable dtDevice = waterFactoryDbHelper.Fill(factorySql);
                 if (dtDevice == null || dtDevice.Rows.Count == 0)
                 {
                     return;
@@ -272,6 +272,33 @@ namespace TimedUpload.QuartzJobs
         }
 
         static IDbProvider dbHelper
+        {
+            get
+            {
+                var DbDefine = DbFactoryProvider.GetProvider(CurrentDbType.SqlServer, Constants.DbConncetion);
+                return DbDefine;
+            }
+        }
+
+        static IDbProvider waterFactoryDbHelper
+        {
+            get
+            {
+                var DbDefine = DbFactoryProvider.GetProvider(CurrentDbType.SqlServer, Constants.changleWaterFactoryDb);
+                return DbDefine;
+            }
+        }
+
+        static IDbProvider waterQulityDbHelper
+        {
+            get
+            {
+                var DbDefine = DbFactoryProvider.GetProvider(CurrentDbType.SqlServer, Constants.changLeWaterQualityDb);
+                return DbDefine;
+            }
+        }
+
+        static IDbProvider secondDbHelper
         {
             get
             {

+ 20 - 1
TimedUpload/quartz_jobs.xml

@@ -225,7 +225,7 @@
       </cron>
     </trigger>-->
     <!--昌乐水质数据定时上传数据-->
-    <job>
+    <!-- <job>
       <name>ChangleWaterQualityDataJob</name>
       <group>ChangleWaterQualityData</group>
       <description>昌乐水质数据定时上传服务</description>
@@ -242,6 +242,25 @@
         <start-time>2017-08-08T00:00:00+08:00</start-time>
         <cron-expression>0 0 1 * * ? *</cron-expression>
       </cron>
+    </trigger> -->
+    <!--昌乐工艺图数据定时上传数据-->
+    <job>
+      <name>ChangleWorkmanshipDataJob</name>
+      <group>ChangleWorkmanshipData</group>
+      <description>昌乐水质数据定时上传服务</description>
+      <job-type>TimedUpload.QuartzJobs.ChangleWorkmanshipDataUploadJob,TimedUpload</job-type>
+      <durable>true</durable>
+      <recover>false</recover>
+    </job>
+    <trigger>
+      <cron>
+        <name>ChangleWorkmanshipDataJobTrigger</name>
+        <group>ChangleWorkmanshipData</group>
+        <job-name>ChangleWorkmanshipDataJob</job-name>
+        <job-group>ChangleWorkmanshipData</job-group>
+        <start-time>2017-08-08T00:00:00+08:00</start-time>
+        <cron-expression>0 0 1 * * ? *</cron-expression>
+      </cron>
     </trigger>
   </schedule>
 </job-scheduling-data>