|
@@ -86,36 +86,68 @@ namespace TimedUpload.QuartzJobs
|
|
|
|
|
|
string newSecondaryToDMACode = Constants.SecondaryToDMACode;
|
|
|
// 处理设备列表
|
|
|
+ #region
|
|
|
// for (int i = 0; i < dtDevice.Rows.Count; i++)
|
|
|
// {
|
|
|
- //DataRow dr = dtDevice.Rows[i];
|
|
|
- string id = "2023/1/17 15:37";//dr["更新时间"].ToString();
|
|
|
- string deviceCode = "wwkj006";// dr["编码"].ToString();
|
|
|
- string PressureIn = "0";//dr["泵进口压力"].ToString();
|
|
|
- string PressureOut = "10.802";//dr["泵出口压力"].ToString();
|
|
|
- string PressureSet = "0";//dr["泵设定压力"].ToString();
|
|
|
- string InstantFlow = "0";//dr["瞬时流量"].ToString();
|
|
|
- string TotalFlow = "0";//dr["净累计流量"].ToString();
|
|
|
- string PositiveToTalFlow = "0";//dr["正累计流量"].ToString();
|
|
|
- string NegativeTotalFlow = "0";//dr["负累计流量"].ToString();
|
|
|
- string PH = "0";//dr["PH"].ToString();
|
|
|
- string Chlorine = "0";//dr["余氯"].ToString();
|
|
|
- string Turbidity = "0";//dr["浊度"].ToString();
|
|
|
- string LiquidHeight = "0";//dr["水箱液位"].ToString();
|
|
|
- string VoltageA = "0";//dr["电压AB"].ToString();
|
|
|
- string VoltageB = "0";//dr["电压AC"].ToString();
|
|
|
- string VoltageC = "0";//dr["电压BC"].ToString();
|
|
|
- string CurrentA = "0";//dr["电流A"].ToString();
|
|
|
- string CurrentB = "0";//dr["电流B"].ToString();
|
|
|
- string CurrentC = "0";//dr["电流C"].ToString();
|
|
|
- string Consumption = "0";//dr["用电量"].ToString();
|
|
|
- string LackWater ="0";//dr["缺水报警"].ToString();
|
|
|
- string OverPressure = "0";//dr["超压报警"].ToString();
|
|
|
- string HouseInlet = "1";//dr["进水报警"].ToString(); // 进水报警0为正常,1为进水。
|
|
|
- string TubeBurst = "0";//dr["爆管报警"].ToString();
|
|
|
- string NetState = "0";//dr["网络状态"].ToString(); // 0代表通讯正常,1代表网络故障,2代表现场485设备通讯故障
|
|
|
-
|
|
|
- string readTime = "2023/1/17 15:37:14";//dr["日期"].ToString().Trim() + " " + dr["时间"].ToString().Trim();
|
|
|
+ //DataRow dr = dtDevice.Rows[i];
|
|
|
+ //string id = "2023/1/17 15:37";//dr["更新时间"].ToString();
|
|
|
+ //string deviceCode = "wwkj006";// dr["编码"].ToString();
|
|
|
+ //string PressureIn = "0";//dr["泵进口压力"].ToString();
|
|
|
+ //string PressureOut = "10.802";//dr["泵出口压力"].ToString();
|
|
|
+ //string PressureSet = "0";//dr["泵设定压力"].ToString();
|
|
|
+ //string InstantFlow = "0";//dr["瞬时流量"].ToString();
|
|
|
+ //string TotalFlow = "0";//dr["净累计流量"].ToString();
|
|
|
+ //string PositiveToTalFlow = "0";//dr["正累计流量"].ToString();
|
|
|
+ //string NegativeTotalFlow = "0";//dr["负累计流量"].ToString();
|
|
|
+ //string PH = "0";//dr["PH"].ToString();
|
|
|
+ //string Chlorine = "0";//dr["余氯"].ToString();
|
|
|
+ //string Turbidity = "0";//dr["浊度"].ToString();
|
|
|
+ //string LiquidHeight = "0";//dr["水箱液位"].ToString();
|
|
|
+ //string VoltageA = "0";//dr["电压AB"].ToString();
|
|
|
+ //string VoltageB = "0";//dr["电压AC"].ToString();
|
|
|
+ //string VoltageC = "0";//dr["电压BC"].ToString();
|
|
|
+ //string CurrentA = "0";//dr["电流A"].ToString();
|
|
|
+ //string CurrentB = "0";//dr["电流B"].ToString();
|
|
|
+ //string CurrentC = "0";//dr["电流C"].ToString();
|
|
|
+ //string Consumption = "0";//dr["用电量"].ToString();
|
|
|
+ //string LackWater ="0";//dr["缺水报警"].ToString();
|
|
|
+ //string OverPressure = "0";//dr["超压报警"].ToString();
|
|
|
+ //string HouseInlet = "1";//dr["进水报警"].ToString(); // 进水报警0为正常,1为进水。
|
|
|
+ //string TubeBurst = "0";//dr["爆管报警"].ToString();
|
|
|
+ //string NetState = "0";//dr["网络状态"].ToString(); // 0代表通讯正常,1代表网络故障,2代表现场485设备通讯故障
|
|
|
+
|
|
|
+ //string readTime = "2023/1/17 15:37:14";//dr["日期"].ToString().Trim() + " " + dr["时间"].ToString().Trim();
|
|
|
+ #endregion
|
|
|
+ for (int i = 0; i < dtDevice.Rows.Count; i++)
|
|
|
+ {
|
|
|
+ DataRow dr = dtDevice.Rows[i];
|
|
|
+ string id = dr["更新时间"].ToString();
|
|
|
+ string deviceCode = dr["编码"].ToString();
|
|
|
+ string PressureIn = dr["泵进口压力"].ToString();
|
|
|
+ string PressureOut = dr["泵出口压力"].ToString();
|
|
|
+ string PressureSet = dr["泵设定压力"].ToString();
|
|
|
+ string InstantFlow = dr["瞬时流量"].ToString();
|
|
|
+ string TotalFlow = dr["净累计流量"].ToString();
|
|
|
+ string PositiveToTalFlow = dr["正累计流量"].ToString();
|
|
|
+ string NegativeTotalFlow = dr["负累计流量"].ToString();
|
|
|
+ string PH = dr["PH"].ToString();
|
|
|
+ string Chlorine = dr["余氯"].ToString();
|
|
|
+ string Turbidity = dr["浊度"].ToString();
|
|
|
+ string LiquidHeight = dr["水箱液位"].ToString();
|
|
|
+ string VoltageA = dr["电压AB"].ToString();
|
|
|
+ string VoltageB = dr["电压AC"].ToString();
|
|
|
+ string VoltageC = dr["电压BC"].ToString();
|
|
|
+ string CurrentA = dr["电流A"].ToString();
|
|
|
+ string CurrentB = dr["电流B"].ToString();
|
|
|
+ string CurrentC = dr["电流C"].ToString();
|
|
|
+ string Consumption = dr["用电量"].ToString();
|
|
|
+ string LackWater = dr["缺水报警"].ToString();
|
|
|
+ string OverPressure = dr["超压报警"].ToString();
|
|
|
+ string HouseInlet = dr["进水报警"].ToString(); // 进水报警0为正常,1为进水。
|
|
|
+ string TubeBurst = dr["爆管报警"].ToString();
|
|
|
+ string NetState = dr["网络状态"].ToString(); // 0代表通讯正常,1代表网络故障,2代表现场485设备通讯故障
|
|
|
+
|
|
|
+ string readTime = dr["日期"].ToString().Trim() + " " + dr["时间"].ToString().Trim();
|
|
|
|
|
|
Dictionary<string, object> deviceMap = new Dictionary<string, object>();
|
|
|
deviceMap["DeviceCode"] = deviceCode;
|
|
@@ -145,7 +177,7 @@ namespace TimedUpload.QuartzJobs
|
|
|
deviceMap["NetState"] = NetState;
|
|
|
ArrayList meterDataList = new ArrayList();
|
|
|
// 处理泵的数据
|
|
|
- for (int j = 1; j < 1; j++)
|
|
|
+ for (int j = 1; j < 4; j++)
|
|
|
{
|
|
|
Dictionary<string, object> meterMap = new Dictionary<string, object>();
|
|
|
string colPre = "";
|
|
@@ -162,27 +194,27 @@ namespace TimedUpload.QuartzJobs
|
|
|
break;
|
|
|
}
|
|
|
|
|
|
- //string meterCode = "wwkj" + j.ToString().PadLeft(3, '0');
|
|
|
- //string frequency = dr[colPre + "频率"].ToString();
|
|
|
- //string current = dr[colPre + "电流"].ToString();
|
|
|
- //string runState = dr[colPre + "运行状态"].ToString();
|
|
|
- //string power = dr[colPre + "功率"].ToString();
|
|
|
- //string voltage = dr[colPre + "电压"].ToString();
|
|
|
-
|
|
|
- //meterMap["PumpCode"] = meterCode;
|
|
|
- //meterMap["ReadTime"] = readTime;
|
|
|
- //meterMap["Frequency"] = frequency;
|
|
|
- //meterMap["Current"] = current;
|
|
|
- //meterMap["RunState"] = runState;
|
|
|
- //meterMap["Power"] = power;
|
|
|
- //meterMap["Voltage"] = voltage;
|
|
|
+ string meterCode = "wwkj" + j.ToString().PadLeft(3, '0');
|
|
|
+ string frequency = dr[colPre + "频率"].ToString();
|
|
|
+ string current = dr[colPre + "电流"].ToString();
|
|
|
+ string runState = dr[colPre + "运行状态"].ToString();
|
|
|
+ string power = dr[colPre + "功率"].ToString();
|
|
|
+ string voltage = dr[colPre + "电压"].ToString();
|
|
|
+
|
|
|
+ meterMap["PumpCode"] = meterCode;
|
|
|
+ meterMap["ReadTime"] = readTime;
|
|
|
+ meterMap["Frequency"] = frequency;
|
|
|
+ meterMap["Current"] = current;
|
|
|
+ meterMap["RunState"] = runState;
|
|
|
+ meterMap["Power"] = power;
|
|
|
+ meterMap["Voltage"] = voltage;
|
|
|
meterDataList.Add(meterMap);
|
|
|
}
|
|
|
|
|
|
- //if (meterDataList.Count == 0)
|
|
|
- //{
|
|
|
- // continue;
|
|
|
- //}
|
|
|
+ if (meterDataList.Count == 0)
|
|
|
+ {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
deviceMap["PumpData"] = meterDataList;
|
|
|
|
|
|
|
|
@@ -197,26 +229,26 @@ namespace TimedUpload.QuartzJobs
|
|
|
}
|
|
|
|
|
|
// 判断数据是否需要同步分区计量
|
|
|
- //if ("1".Equals(Constants.SecondaryToDMA))
|
|
|
- //{
|
|
|
- // string deviceCodeTemp = SecondaryToDMA(dr, channels, properties, newSecondaryToDMACode);
|
|
|
+ if ("1".Equals(Constants.SecondaryToDMA))
|
|
|
+ {
|
|
|
+ string deviceCodeTemp = SecondaryToDMA(dr, channels, properties, newSecondaryToDMACode);
|
|
|
|
|
|
|
|
|
- // if ("".Equals(newSecondaryToDMACode))
|
|
|
- // {
|
|
|
- // newSecondaryToDMACode = deviceCodeTemp;
|
|
|
- // }
|
|
|
- // else
|
|
|
- // {
|
|
|
+ if ("".Equals(newSecondaryToDMACode))
|
|
|
+ {
|
|
|
+ newSecondaryToDMACode = deviceCodeTemp;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
|
|
|
- // newSecondaryToDMACode = newSecondaryToDMACode + "," + deviceCodeTemp;
|
|
|
- // }
|
|
|
- //}
|
|
|
+ newSecondaryToDMACode = newSecondaryToDMACode + "," + deviceCodeTemp;
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
// 删除数据
|
|
|
string deleteSql = "DELETE FROM [dbo].[二供通用泵站] where 更新时间 = '" + id + "' and 编码 = '" + deviceCode + "'";
|
|
|
dbHelper.ExecuteNonQuery(deleteSql);
|
|
|
- //}
|
|
|
+ }
|
|
|
if ("1".Equals(Constants.SecondaryToDMA))
|
|
|
{
|
|
|
UpdateAppConfig("SecondaryToDMACode", newSecondaryToDMACode);
|