Browse Source

update 去掉重复的阈值赋值

dev
lucas 10 months ago
parent
commit
57843c874f
  1. 21
      et_Info/InfoHandler.go
  2. 1
      node/go.mod

21
et_Info/InfoHandler.go

@ -34,20 +34,21 @@ func (the *InfoHandler) getStationInfo(p *common_models.ProcessData) *common_mod
p.Stations = s p.Stations = s
} else { } else {
//无法查询到完整的 重新获取 //无法查询到完整的 重新获取
log.Printf("重获取设备[%s]的 DeviceStationObj", p.DeviceData.DeviceId)
stationIds, err := the.configHelper.GetDeviceStationIds(p.DeviceData.DeviceId) stationIds, err := the.configHelper.GetDeviceStationIds(p.DeviceData.DeviceId)
if err != nil { if err != nil {
log.Printf("GetDeviceStationIds err =>%s", err.Error())
} }
p.Stations, err = the.configHelper.GetStations(stationIds...) p.Stations, err = the.configHelper.GetStations(stationIds...)
the.getFormulaInfo(p) the.getFormulaInfo(p)
//补全 设备数据输入单位
p.DeviceData.RawUnit = p.DeviceData.DeviceInfo.DeviceMeta.GetOutputUnit()
//存储测点obj
err = the.configHelper.SetDeviceStationObjs(p.DeviceData.DeviceId, p.Stations) err = the.configHelper.SetDeviceStationObjs(p.DeviceData.DeviceId, p.Stations)
if err != nil { if err != nil {
log.Printf("缓存异常 err=%s", err.Error()) log.Printf("缓存异常 err=%s", err.Error())
} }
} }
//补全 设备数据输入单位
p.DeviceData.RawUnit = p.DeviceData.DeviceInfo.DeviceMeta.GetOutputUnit()
the.getThresholdInfo(p)
return p return p
} }
@ -72,7 +73,15 @@ func (the *InfoHandler) getFormulaInfo(p *common_models.ProcessData) {
func (the *InfoHandler) getThresholdInfo(p *common_models.ProcessData) { func (the *InfoHandler) getThresholdInfo(p *common_models.ProcessData) {
for _, stationInfo := range p.Stations { for i, stationInfo := range p.Stations {
the.configHelper.GetStationThreshold(stationInfo.Info.Id) if stationInfo.Info.Id == 14 {
log.Println("==")
}
threshold, err := the.configHelper.GetStationThreshold(stationInfo.Info.Id)
if err == nil && threshold != nil && threshold.Items != nil {
//p.Stations[i].Threshold = threshold
log.Println("==", i)
}
} }
log.Println("=")
} }

1
node/go.mod

@ -43,7 +43,6 @@ require (
github.com/jcmturner/rpc/v2 v2.0.3 // indirect github.com/jcmturner/rpc/v2 v2.0.3 // indirect
github.com/klauspost/compress v1.17.7 // indirect github.com/klauspost/compress v1.17.7 // indirect
github.com/magiconair/properties v1.8.7 // indirect github.com/magiconair/properties v1.8.7 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/oapi-codegen/runtime v1.0.0 // indirect github.com/oapi-codegen/runtime v1.0.0 // indirect
github.com/pelletier/go-toml/v2 v2.1.0 // indirect github.com/pelletier/go-toml/v2 v2.1.0 // indirect

Loading…
Cancel
Save