Browse Source

update 设备数据字段映射 监测原型判断

dev
lucas 1 month ago
parent
commit
88371baad2
  1. 8
      et_calc/dataCalc.go

8
et_calc/dataCalc.go

@ -103,14 +103,14 @@ func (the *CalcHandler) calcFormula(p *common_models.ProcessData) *common_models
for inK, inV := range resultData {
inUnit := resultUnit[inK]
outKey := device.DeviceFactorProto.FieldVal[inK]
if outKey == "" {
log.Printf("设备[%s]字段[%s]无绑定的监测原型[%s-%s] 字段输出", device.IotaDeviceId, inK, protoObj.Name, protoObj.Code)
continue
}
outUnit := protoObj.GetProtoItem(outKey).UnitName
k := the.unitHelper.GetUnitTransK(inUnit, outUnit)
if v, ok := inV.(float64); ok {
if outKey != "" {
outMap[outKey] = common_calc.Decimal(v*k, 5)
} else { //无映射关系的 用原有key
outMap[inK] = common_calc.Decimal(v, 5)
}
} else {
outMap[outKey] = inV
}

Loading…
Cancel
Save