新标准判定流程

--select * from OperationLog

--update OperationLog set OperateDate='2000-01-01 00:00:00' where id='12'


--修改结果
update RemoteDetection set DETECTIONSTATE='1',Highemissions='0',IsValid='1'

--判断无效数据
update RemoteDetection set DETECTIONSTATE=3,Highemissions=3,IsValid=0
from RemoteDetection v
where REMOTEDETECTIONID=v.REMOTEDETECTIONID and WINDSPEED>5 or Humidity>85
or (Temperature<-20 or Temperature>45)

--不判定数据
update RemoteDetection set DETECTIONSTATE='2',Highemissions='2'
from RemoteDetection v
where REMOTEDETECTIONID=v.REMOTEDETECTIONID and IsValid='1'
and (VLPNCOLOR='05' or (ISNULL(SF,0)<=30 and FUELTYPE is Null))

--判断超限
update RemoteDetection set DETECTIONSTATE=0
from RemoteDetection v
where REMOTEDETECTIONID=v.REMOTEDETECTIONID
and IsValid='1'
and (
(ISNULL(RgB,0)>1 and FUELTYPE is Null )
or (ISNULL(RgB,0)>1 and FUELTYPE='B' )
or (ISNULL(SF,0)>30 and FUELTYPE='B')
or (ISNULL(SF,0)>30 and FUELTYPE is Null)
)

--判断高排
update RemoteDetection set Highemissions=1
from RemoteDetection v
where REMOTEDETECTIONID=v.REMOTEDETECTIONID
and IsValid='1'
and (
ISNULL(NO,0)>1500 and FUELTYPE='B'
)

update RemoteDetection set co=0,no=0,sf=0,RgB=0,hc=0,co2=0 where VLPNCOLOR ='05' and right(left(vlpn,3),1)!='F' and right(vlpn,1)!='F'

--第一步
update OperationLog set OperateDate='2000-01-01 00:00:00' where Operator='prc_TelemetryDataByDay'

--第二步
truncate table Telemetry_staticsByDay

猜你喜欢

转载自www.cnblogs.com/luoguixin/p/12933384.html