|
|
@@ -25,14 +25,14 @@ namespace EasyTemplate.Service
|
|
|
public int AccOver { get; set; } // 累计超标记录
|
|
|
public int AccOverAlert { get; set; } // 累计严重超标记录
|
|
|
public int AccTotal { get; set; } // 累计总数
|
|
|
- public int AccOver2 { get; set; } // 累计二级超标记录
|
|
|
+ public int AccOver2 { get; set; } // 累计超标2记录
|
|
|
|
|
|
public int ContinueDays { get; set; } // 连续超标天数
|
|
|
- public int ContinueDays2 { get; set; } // 连续二级超标天数
|
|
|
+ public int ContinueDays2 { get; set; } // 连续超标2天数
|
|
|
public int ContinueDaysAlert { get; set; } // 连续严重超标天数
|
|
|
|
|
|
public int LastRate { get; set; } // 最后累计超标率
|
|
|
- public int LastRate2 { get; set; } // 最后二级超标率
|
|
|
+ public int LastRate2 { get; set; } // 最后超标率2
|
|
|
public int LastRateAlert { get; set; } // 最后严重超标率
|
|
|
}
|
|
|
|
|
|
@@ -220,15 +220,20 @@ namespace EasyTemplate.Service
|
|
|
newState.LastRate2 = newState.AccTotal == 0 ? 0 : (newState.AccOver2 * 100) / newState.AccTotal;
|
|
|
newState.LastRateAlert = newState.AccTotal == 0 ? 0 : (newState.AccOverAlert * 100) / newState.AccTotal;
|
|
|
|
|
|
+ // 设置统计结果
|
|
|
+ SetStatsFromState(stats, newState);
|
|
|
+
|
|
|
// 根据模式判断并更新连续天数
|
|
|
ApplyWarningRules(newState, isBeijingMode, refCount, refPrewarningIndex,
|
|
|
refPrewarningIndexAlert, isZhejiangSpecial);
|
|
|
|
|
|
// 保存到缓存
|
|
|
stateCache[0] = newState;
|
|
|
-
|
|
|
- // 设置统计结果
|
|
|
- SetStatsFromState(stats, newState);
|
|
|
+
|
|
|
+
|
|
|
+ SetStatsFromState_continue_days(stats, newState);
|
|
|
+
|
|
|
+
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
@@ -257,6 +262,9 @@ namespace EasyTemplate.Service
|
|
|
currentState.LastRate2 = currentState.AccTotal == 0 ? 0 : (currentState.AccOver2 * 100) / currentState.AccTotal;
|
|
|
currentState.LastRateAlert = currentState.AccTotal == 0 ? 0 : (currentState.AccOverAlert * 100) / currentState.AccTotal;
|
|
|
|
|
|
+ // 设置统计结果
|
|
|
+ SetStatsFromState(stats, currentState);
|
|
|
+
|
|
|
// 根据模式判断并更新连续天数
|
|
|
ApplyWarningRules(currentState, isBeijingMode, refCount, refPrewarningIndex,
|
|
|
refPrewarningIndexAlert, isZhejiangSpecial);
|
|
|
@@ -264,8 +272,7 @@ namespace EasyTemplate.Service
|
|
|
// 保存到缓存
|
|
|
stateCache[currentIndex] = currentState;
|
|
|
|
|
|
- // 设置统计结果
|
|
|
- SetStatsFromState(stats, currentState);
|
|
|
+ SetStatsFromState_continue_days(stats, currentState);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
@@ -274,7 +281,7 @@ namespace EasyTemplate.Service
|
|
|
private void ApplyWarningRules(AccumulatedState state, bool isBeijingMode, int refCount,
|
|
|
int refPrewarningIndex, int refPrewarningIndexAlert, bool isZhejiangSpecial)
|
|
|
{
|
|
|
- if (isBeijingMode)
|
|
|
+ if (isBeijingMode)//isBeijingMode
|
|
|
{
|
|
|
// === 北京模式(ref_reach_count)===
|
|
|
// 规则:超标率>=阈值 且 总笔数>=5 时,连续天数 +1
|
|
|
@@ -344,7 +351,7 @@ namespace EasyTemplate.Service
|
|
|
state.ContinueDaysAlert = 0;
|
|
|
}
|
|
|
|
|
|
- // 二级超标判断(广东中石化)
|
|
|
+ // 超标 2 判断(广东中石化)
|
|
|
if (state.LastRate2 >= refPrewarningIndex)
|
|
|
{
|
|
|
state.ContinueDays2++;
|
|
|
@@ -401,6 +408,14 @@ namespace EasyTemplate.Service
|
|
|
stats.total_overproofrate_alert = state.LastRateAlert;
|
|
|
}
|
|
|
|
|
|
+ private void SetStatsFromState_continue_days(WarningStatistics stats, AccumulatedState state)
|
|
|
+ {
|
|
|
+ stats.continue_days = state.ContinueDays;
|
|
|
+ stats.continue_days_2 = state.ContinueDays2;
|
|
|
+ stats.continue_days_alert = state.ContinueDaysAlert;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
/// <summary>
|
|
|
/// 计算累计统计数据(原始版本,保留用于兼容)
|
|
|
/// 规则:从最早日期正向迭代到当前日期,累加统计并在满足条件时清零
|
|
|
@@ -411,7 +426,7 @@ namespace EasyTemplate.Service
|
|
|
int acc_over = 0; // 累计超标记录
|
|
|
int acc_over_alert = 0; // 累计严重超标记录
|
|
|
int acc_total = 0; // 累计总数
|
|
|
- int acc_over_2 = 0; // 累计二级超标记录(广东中石化)
|
|
|
+ int acc_over_2 = 0; // 累计超标 2 记录(广东中石化)
|
|
|
|
|
|
// 连续天数计数器
|
|
|
int continue_days = 0;
|
|
|
@@ -519,7 +534,7 @@ namespace EasyTemplate.Service
|
|
|
continue_days_alert = 0;
|
|
|
}
|
|
|
|
|
|
- // 二级超标判断(广东中石化)
|
|
|
+ // 超标 2 判断(广东中石化)
|
|
|
if (last_rate_2 >= refPrewarningIndex) // || day.continueoverproof == 1
|
|
|
{
|
|
|
continue_days_2++;
|