|
@@ -72,22 +72,26 @@ namespace TimedUpload.QuartzJobs
|
|
|
log.Info("营收户表基础数据同步任务开始执行.................\r\n");
|
|
|
while (true)
|
|
|
{
|
|
|
-
|
|
|
- string sql = "SELECT top 100 b.CM_ID,c.RouteCode,RouteName,a.CustomerCode,a.CustomerName,b.ElecAddress,b.DetailedAddress MeterAddress,a.DetailedAddress CustomerAddress";
|
|
|
- sql += " FROM BCS_Customer a,BCS_CustomerMeter b, BCS_MeterReadingRoute c WHERE a.Cus_ID = b.Cus_ID and b.Mrr_ID = c.MRR_ID ";
|
|
|
- sql += " AND b.CM_ID > " + meterId + " ORDER BY CM_ID";
|
|
|
+ DataTable dt = null;
|
|
|
+ try
|
|
|
+ {
|
|
|
+ string sql = "SELECT top 100 b.CM_ID,c.RouteCode,RouteName,a.CustomerCode,a.CustomerName,b.ElecAddress,b.DetailedAddress MeterAddress,a.DetailedAddress CustomerAddress";
|
|
|
+ sql += " FROM BCS_Customer a,BCS_CustomerMeter b, BCS_MeterReadingRoute c WHERE a.Cus_ID = b.Cus_ID and b.Mrr_ID = c.MRR_ID ";
|
|
|
+ sql += " AND b.CM_ID > " + meterId + " ORDER BY CM_ID";
|
|
|
|
|
|
- // log.Info(sql);
|
|
|
-
|
|
|
- DataTable dt = dbHelper.Fill(sql);
|
|
|
+ dt = dbHelper.Fill(sql);
|
|
|
+ }
|
|
|
+ catch (Exception ex)
|
|
|
+ {
|
|
|
+ log.Info("营收户表基础数据同步查询数据异常" + ex.StackTrace + "\r\n");
|
|
|
+ }
|
|
|
|
|
|
- // log.Info("营业收费户表 | " + dt.Rows.Count);
|
|
|
if (dt == null || dt.Rows.Count == 0)
|
|
|
{
|
|
|
break;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
+ log.Info("营收户表基础数据同步获取记录数:【" + dt.Rows.Count + "】................\r\n");
|
|
|
|
|
|
StringBuilder message = new StringBuilder();
|
|
|
for (int i = 0; i < dt.Rows.Count; i++)
|
|
@@ -97,10 +101,7 @@ namespace TimedUpload.QuartzJobs
|
|
|
{
|
|
|
DataRow dr = dt.Rows[i];
|
|
|
|
|
|
- if (i == dt.Rows.Count - 1)
|
|
|
- {
|
|
|
- meterId = Convert.ToString(dr["CM_ID"]);
|
|
|
- }
|
|
|
+ meterId = Convert.ToString(dr["CM_ID"]);
|
|
|
|
|
|
string meterLineNo = Convert.ToString(dr["RouteCode"]);
|
|
|
string meterLineName = Convert.ToString(dr["RouteName"]);
|
|
@@ -147,39 +148,42 @@ namespace TimedUpload.QuartzJobs
|
|
|
private void SendZoneMeterUserHis(Dictionary<string, IModel> channels, Dictionary<string, IBasicProperties> properties)
|
|
|
{
|
|
|
string userMeterReadId = Constants.UserMeterReadId;
|
|
|
- //log.Info("营收户表抄表数据同步任务开始执行.................\r\n");
|
|
|
+ log.Info("营收户表抄表数据同步任务开始执行.................\r\n");
|
|
|
while (true)
|
|
|
{
|
|
|
-
|
|
|
- string sql = "SELECT top 100 UsedWater_ID,CM_ID,ThisMeterNumber,ThisMeterDt,BetweenMeteNumber,b.CreateDT FROM BCS_UsedWater b";
|
|
|
- sql += " WHERE b.BM_ID >= " + bmId + " AND b.UsedWater_ID > " + userMeterReadId + " ORDER BY b.BM_ID,b.UsedWater_ID";
|
|
|
- // log.Info(sql);
|
|
|
- DataTable dt = dbHelper.Fill(sql);
|
|
|
+ DataTable dt = null;
|
|
|
+ try
|
|
|
+ {
|
|
|
+ string sql = "SELECT top 100 UsedWater_ID,CM_ID,ThisMeterNumber,ThisMeterDt,BetweenMeteNumber,b.CreateDT FROM BCS_UsedWater b";
|
|
|
+ sql += " WHERE b.BM_ID >= " + bmId + " AND b.UsedWater_ID > " + userMeterReadId + " ORDER BY b.BM_ID,b.UsedWater_ID";
|
|
|
+ dt = dbHelper.Fill(sql);
|
|
|
+ }
|
|
|
+ catch (Exception ex)
|
|
|
+ {
|
|
|
+ log.Info("营收户表抄表数据同步查询数据异常" + ex.StackTrace + "\r\n");
|
|
|
+ }
|
|
|
|
|
|
if (dt == null || dt.Rows.Count == 0)
|
|
|
{
|
|
|
|
|
|
break;
|
|
|
}
|
|
|
+ log.Info("营收户表抄表数据同步获取记录数:【" + dt.Rows.Count + "】................\r\n");
|
|
|
|
|
|
StringBuilder message = new StringBuilder();
|
|
|
for (int i = 0; i < dt.Rows.Count; i++)
|
|
|
{
|
|
|
message.Clear();
|
|
|
-
|
|
|
- DataRow dr = dt.Rows[i];
|
|
|
-
|
|
|
- if (i == dt.Rows.Count - 1)
|
|
|
+ try
|
|
|
{
|
|
|
+ DataRow dr = dt.Rows[i];
|
|
|
userMeterReadId = Convert.ToString(dr["UsedWater_ID"]);
|
|
|
- }
|
|
|
|
|
|
- string meterCode = Convert.ToString(dr["CM_ID"]);
|
|
|
- string getDateTime = Convert.ToDateTime(dr["ThisMeterDt"]).ToString("yyyy-MM-dd HH:mm:ss");
|
|
|
- string currReadingValue = Convert.ToString(dr["ThisMeterNumber"]);
|
|
|
- string waterUsed = Convert.ToString(dr["BetweenMeteNumber"]);
|
|
|
- try
|
|
|
- {
|
|
|
+ string meterCode = Convert.ToString(dr["CM_ID"]);
|
|
|
+ string getDateTime = Convert.ToDateTime(dr["ThisMeterDt"]).ToString("yyyy-MM-dd HH:mm:ss");
|
|
|
+ string currReadingValue = Convert.ToString(dr["ThisMeterNumber"]);
|
|
|
+ string waterUsed = Convert.ToString(dr["BetweenMeteNumber"]);
|
|
|
+
|
|
|
message.Append("{");
|
|
|
message.Append("\"meterCode\": \"").Append(meterCode).Append("\",");
|
|
|
message.Append("\"fromWhere\": \"").Append(manufacturerCode).Append("\",");
|