|
|
|
@ -565,10 +565,13 @@ namespace Ems.CollectService.Analysis
|
|
|
|
|
|
|
|
|
|
recordDnbInstant.zxyg = recordDnbInstant.zxyg == appConfig.virtualValue ? 0 : recordDnbInstant.zxyg;
|
|
|
|
|
|
|
|
|
|
var info = SqlSugarHelper.Db.Insertable<RecordDnbInstant>(recordDnbInstant).ExecuteCommand();
|
|
|
|
|
if (info > 0)
|
|
|
|
|
if (FIlterDnbInstant(recordDnbInstant))
|
|
|
|
|
{
|
|
|
|
|
logger.Info($"仪表:{recordDnbInstant.monitorId}数据保存成功");
|
|
|
|
|
var info = SqlSugarHelper.Db.Insertable<RecordDnbInstant>(recordDnbInstant).ExecuteCommand();
|
|
|
|
|
if (info > 0)
|
|
|
|
|
{
|
|
|
|
|
logger.Info($"仪表:{recordDnbInstant.monitorId}数据保存成功");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}catch(Exception ex)
|
|
|
|
@ -577,6 +580,60 @@ namespace Ems.CollectService.Analysis
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 过滤数据,与前一条相差超过4000不进行保存
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="dnbInstant"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
private bool FIlterDnbInstant(RecordDnbInstant dnbInstant)
|
|
|
|
|
{
|
|
|
|
|
bool result = true;
|
|
|
|
|
|
|
|
|
|
do
|
|
|
|
|
{
|
|
|
|
|
RecordDnbInstant lastDnbInstant = SqlSugarHelper.Db.Queryable<RecordDnbInstant>()
|
|
|
|
|
.First(x => x.monitorId == dnbInstant.monitorId);
|
|
|
|
|
|
|
|
|
|
if (lastDnbInstant == null)
|
|
|
|
|
{
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
BaseMonitorInfo monitorInfo = SqlSugarHelper.Db.Queryable<BaseMonitorInfo>()
|
|
|
|
|
.First(x => x.MonitorId == dnbInstant.monitorId);
|
|
|
|
|
|
|
|
|
|
if (monitorInfo == null)
|
|
|
|
|
{
|
|
|
|
|
result = false;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (monitorInfo.Pt == 0 || monitorInfo.Pt == null)
|
|
|
|
|
{
|
|
|
|
|
monitorInfo.Pt = 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (monitorInfo.Ct == 0 || monitorInfo.Ct == null)
|
|
|
|
|
{
|
|
|
|
|
monitorInfo.Ct = 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
decimal? lastZxyg = lastDnbInstant.zxyg * monitorInfo.Pt * monitorInfo.Ct;
|
|
|
|
|
|
|
|
|
|
decimal? dnbInstantZxyg = dnbInstant.zxyg * monitorInfo.Pt * monitorInfo.Ct;
|
|
|
|
|
|
|
|
|
|
decimal? zxygRes = dnbInstantZxyg - lastZxyg;
|
|
|
|
|
var appConfigDifferenceValue = appConfig.differenceValue == 0 ? 4000 : appConfig.differenceValue;
|
|
|
|
|
if ( zxygRes >= appConfigDifferenceValue)
|
|
|
|
|
{
|
|
|
|
|
logger.Info($"仪表:{dnbInstant.monitorId}与上一条数据相差超过4000,不进行保存");
|
|
|
|
|
result = false;
|
|
|
|
|
}
|
|
|
|
|
} while (false);
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 水表数据
|
|
|
|
|
/// </summary>
|
|
|
|
|