修改異常sql
This commit is contained in:
parent
9c5c9ca84c
commit
9e9fbeb921
@ -360,10 +360,35 @@ namespace SolarPower.Repository.Implement
|
|||||||
{
|
{
|
||||||
DateTime start;
|
DateTime start;
|
||||||
DateTime end;
|
DateTime end;
|
||||||
var sql = @$"select pr.FormId as FormId, pr.Id as ErrorID, a.id, site_id, `timestamp`, FROM_UNIXTIME((`timestamp` / 1000), '%Y-%m-%d %H:%i:%s') dev_time , a.sourceState err_status, FROM_UNIXTIME( (a.normalTime / 1000), '%Y-%m-%d %H:%i:%s') normalTime,
|
//var sql = @$"select pr.FormId as FormId, pr.Id as ErrorID, a.id, site_id, `timestamp`, FROM_UNIXTIME((`timestamp` / 1000), '%Y-%m-%d %H:%i:%s') dev_time , a.sourceState err_status, FROM_UNIXTIME( (a.normalTime / 1000), '%Y-%m-%d %H:%i:%s') normalTime,
|
||||||
a.alarmClass, b.alarmClass as alarmClassName,ps.Name as PowerStationName,
|
// a.alarmClass, b.alarmClass as alarmClassName,ps.Name as PowerStationName,
|
||||||
errDevice, err_valueKind, errValue, FROM_UNIXTIME( (a.lastUpdate / 1000), '%Y-%m-%d %H:%i:%s') lastUpdate,
|
// errDevice, err_valueKind, errValue, FROM_UNIXTIME( (a.lastUpdate / 1000), '%Y-%m-%d %H:%i:%s') lastUpdate,
|
||||||
case when c.errMsg_tw is null then d.errMsg_tw else c.errMsg_tw end errMsg
|
// case when c.errMsg_tw is null then d.errMsg_tw else c.errMsg_tw end errMsg
|
||||||
|
// from err_main a
|
||||||
|
// left join alarmorion_orionalarmclass b on a.alarmclass = b.id
|
||||||
|
// left join ref_err_device c on trim(b.alarmClass) = c.deviceType
|
||||||
|
// left join ref_err_inv d on lower(b.alarmClass) = d.deviceType
|
||||||
|
// # and case when lower(b.alarmClass) = 'inverter' and err_valuekind = 'e' then errvalue else '' end = d.errCode
|
||||||
|
// and a.errDeviceBrand = d.brend and a.errDeviceModel = d.model and a.errValue = d.errCode
|
||||||
|
// left join power_station ps on ps.Code = site_id
|
||||||
|
// left join operation_record pr on pr.ErrorCode = a.id
|
||||||
|
// WHERE a.sourceState = @Status AND ps.Id = @PowerStationId ";
|
||||||
|
var sql = @$"select pr.FormId as FormId, pr.Id as ErrorID, a.id, site_id, `timestamp`, FROM_UNIXTIME((`timestamp` / 1000), '%Y-%m-%d %H:%i:%s') dev_time ,
|
||||||
|
a.sourceState err_status, FROM_UNIXTIME( (a.normalTime / 1000), '%Y-%m-%d %H:%i:%s') normalTime,
|
||||||
|
a.alarmClass, b.alarmClass as alarmClassName,ps.Name as PowerStationName, errDevice, err_valueKind, errValue, FROM_UNIXTIME( (a.lastUpdate / 1000), '%Y-%m-%d %H:%i:%s') lastUpdate, c.errMsg_tw cerrMsg_tw, d.errMsg_tw derrMsg_tw,
|
||||||
|
case when c.errMsg_tw is null then
|
||||||
|
case when err_valueKind = 'b' then d.errMsg_tw
|
||||||
|
when err_valueKind = 'd' then CONCAT(d.errMsg_tw, ': ', round(a.errValue, 2))
|
||||||
|
when d.errMsg_tw is null then a.errValue
|
||||||
|
when a.errValue is null then d.errMsg_tw
|
||||||
|
else CONCAT(a.errValue, ', ' , ifNull(d.errMsg_tw, '')) end
|
||||||
|
else
|
||||||
|
case when err_valueKind = 'b' then c.errMsg_tw
|
||||||
|
when err_valueKind = 'd' then CONCAT(c.errMsg_tw, ': ', round(a.errValue, 2))
|
||||||
|
when c.errMsg_tw is null then a.errValue
|
||||||
|
when a.errValue is null then c.errMsg_tw
|
||||||
|
else CONCAT(a.errValue, ', ' , ifNull(c.errMsg_tw, '')) end
|
||||||
|
end errMsg
|
||||||
from err_main a
|
from err_main a
|
||||||
left join alarmorion_orionalarmclass b on a.alarmclass = b.id
|
left join alarmorion_orionalarmclass b on a.alarmclass = b.id
|
||||||
left join ref_err_device c on trim(b.alarmClass) = c.deviceType
|
left join ref_err_device c on trim(b.alarmClass) = c.deviceType
|
||||||
@ -374,7 +399,6 @@ namespace SolarPower.Repository.Implement
|
|||||||
left join operation_record pr on pr.ErrorCode = a.id
|
left join operation_record pr on pr.ErrorCode = a.id
|
||||||
WHERE a.sourceState = @Status AND ps.Id = @PowerStationId ";
|
WHERE a.sourceState = @Status AND ps.Id = @PowerStationId ";
|
||||||
|
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(post.Range))
|
if (!string.IsNullOrEmpty(post.Range))
|
||||||
{
|
{
|
||||||
post.StartTime = post.Range.Split('-')[0] + " 00:00:00";
|
post.StartTime = post.Range.Split('-')[0] + " 00:00:00";
|
||||||
@ -415,10 +439,22 @@ namespace SolarPower.Repository.Implement
|
|||||||
{
|
{
|
||||||
DateTime start;
|
DateTime start;
|
||||||
DateTime end;
|
DateTime end;
|
||||||
var sql = @$"select pr.FormId as FormId, pr.Id as ErrorID, a.id, site_id, `timestamp`, FROM_UNIXTIME((`timestamp` / 1000), '%Y-%m-%d %H:%i:%s') dev_time , a.sourceState err_status, FROM_UNIXTIME( (a.normalTime / 1000), '%Y-%m-%d %H:%i:%s') normalTime,
|
var sql = @$"select pr.FormId as FormId, pr.Id as ErrorID, a.id, site_id, `timestamp`, FROM_UNIXTIME((`timestamp` / 1000), '%Y-%m-%d %H:%i:%s') dev_time ,
|
||||||
a.alarmClass, b.alarmClass as alarmClassName,ps.Name as PowerStationName,ps.Id as PowerStationId,
|
a.sourceState err_status, FROM_UNIXTIME( (a.normalTime / 1000), '%Y-%m-%d %H:%i:%s') normalTime,
|
||||||
errDevice, err_valueKind, errValue, FROM_UNIXTIME( (a.lastUpdate / 1000), '%Y-%m-%d %H:%i:%s') lastUpdate,
|
a.alarmClass, b.alarmClass as alarmClassName,ps.Name as PowerStationName, errDevice, err_valueKind, errValue, FROM_UNIXTIME( (a.lastUpdate / 1000), '%Y-%m-%d %H:%i:%s') lastUpdate, c.errMsg_tw cerrMsg_tw, d.errMsg_tw derrMsg_tw,
|
||||||
case when c.errMsg_tw is null then d.errMsg_tw else c.errMsg_tw end errMsg
|
case when c.errMsg_tw is null then
|
||||||
|
case when err_valueKind = 'b' then d.errMsg_tw
|
||||||
|
when err_valueKind = 'd' then CONCAT(d.errMsg_tw, ': ', round(a.errValue, 2))
|
||||||
|
when d.errMsg_tw is null then a.errValue
|
||||||
|
when a.errValue is null then d.errMsg_tw
|
||||||
|
else CONCAT(a.errValue, ', ' , ifNull(d.errMsg_tw, '')) end
|
||||||
|
else
|
||||||
|
case when err_valueKind = 'b' then c.errMsg_tw
|
||||||
|
when err_valueKind = 'd' then CONCAT(c.errMsg_tw, ': ', round(a.errValue, 2))
|
||||||
|
when c.errMsg_tw is null then a.errValue
|
||||||
|
when a.errValue is null then c.errMsg_tw
|
||||||
|
else CONCAT(a.errValue, ', ' , ifNull(c.errMsg_tw, '')) end
|
||||||
|
end errMsg
|
||||||
from err_main a
|
from err_main a
|
||||||
join alarmorion_orionalarmclass b on a.alarmclass = b.id
|
join alarmorion_orionalarmclass b on a.alarmclass = b.id
|
||||||
left join ref_err_device c on trim(b.alarmClass) = c.deviceType
|
left join ref_err_device c on trim(b.alarmClass) = c.deviceType
|
||||||
|
|||||||
@ -2812,7 +2812,7 @@
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$("#Invertercard-Name").html(rel.data.name);
|
$("#Invertercard-Name").html(rel.data.name);
|
||||||
$("#Invertercard-kwh").html(rel.data.kwh.toFixed(2));
|
$("#Invertercard-kwh").html(rel.data.today_kWh.toFixed(2));
|
||||||
@if (ViewBag.myUser.Role.Auths.Contains("ShowMoney"))
|
@if (ViewBag.myUser.Role.Auths.Contains("ShowMoney"))
|
||||||
{
|
{
|
||||||
<text>
|
<text>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user