|
@@ -79,30 +79,30 @@ func (deviceCollectionService *DeviceCollectionService) CreateDeviceCollection(c |
|
@@ -79,30 +79,30 @@ func (deviceCollectionService *DeviceCollectionService) CreateDeviceCollection(c |
79
|
}
|
79
|
}
|
80
|
|
80
|
|
81
|
//处理设备数据
|
81
|
//处理设备数据
|
82
|
- switch deviceCollection.DeviceType {
|
|
|
83
|
- case domain.DeviceTypeBaoXianJi, domain.DeviceTypeChuanChuanJi, domain.DeviceTypeFengKouJi, domain.DeviceTypeFengXiangJi:
|
|
|
84
|
- if v, ok := deviceCollection.Values["count"]; ok {
|
|
|
85
|
- curCount, errCurCount := strconv.Atoi(fmt.Sprintf("%v", v))
|
|
|
86
|
- v, ok = lastDeviceCollectionRecord.Values["count"]
|
|
|
87
|
- if ok {
|
|
|
88
|
- lastCount, errLastCount := strconv.Atoi(fmt.Sprintf("%v", v))
|
|
|
89
|
- if errLastCount == nil && errCurCount == nil && lastCount <= curCount {
|
|
|
90
|
- deviceCollection.Values["count"] = curCount - lastCount
|
|
|
91
|
- } else {
|
|
|
92
|
- deviceCollection.Values["count"] = 0
|
|
|
93
|
- /*
|
|
|
94
|
- 设备统计的数量超过一定范围会重置为0,特殊处理0操作
|
|
|
95
|
- */
|
|
|
96
|
- if lastCount > 10000000 && curCount < 1000 {
|
|
|
97
|
- deviceCollection.Values["count"] = curCount
|
|
|
98
|
- }
|
|
|
99
|
- }
|
82
|
+ //switch deviceCollection.DeviceType {
|
|
|
83
|
+ //case domain.DeviceTypeBaoXianJi, domain.DeviceTypeChuanChuanJi, domain.DeviceTypeFengKouJi, domain.DeviceTypeFengXiangJi:
|
|
|
84
|
+ if v, ok := deviceCollection.Values["count"]; ok {
|
|
|
85
|
+ curCount, errCurCount := strconv.Atoi(fmt.Sprintf("%v", v))
|
|
|
86
|
+ v, ok = lastDeviceCollectionRecord.Values["count"]
|
|
|
87
|
+ if ok {
|
|
|
88
|
+ lastCount, errLastCount := strconv.Atoi(fmt.Sprintf("%v", v))
|
|
|
89
|
+ if errLastCount == nil && errCurCount == nil && lastCount <= curCount {
|
|
|
90
|
+ deviceCollection.Values["count"] = curCount - lastCount
|
100
|
} else {
|
91
|
} else {
|
101
|
deviceCollection.Values["count"] = 0
|
92
|
deviceCollection.Values["count"] = 0
|
|
|
93
|
+ /*
|
|
|
94
|
+ 设备统计的数量超过一定范围会重置为0,特殊处理0操作
|
|
|
95
|
+ */
|
|
|
96
|
+ if lastCount > 10000000 && curCount < 1000 {
|
|
|
97
|
+ deviceCollection.Values["count"] = curCount
|
|
|
98
|
+ }
|
102
|
}
|
99
|
}
|
|
|
100
|
+ } else {
|
|
|
101
|
+ deviceCollection.Values["count"] = 0
|
103
|
}
|
102
|
}
|
104
|
- break
|
|
|
105
|
}
|
103
|
}
|
|
|
104
|
+ // break
|
|
|
105
|
+ //}
|
106
|
err = domainService.SendWorkshopDeviceData(deviceCollection)
|
106
|
err = domainService.SendWorkshopDeviceData(deviceCollection)
|
107
|
if err != nil {
|
107
|
if err != nil {
|
108
|
log.Logger.Error("车间设备数据加入redis失败:" + err.Error())
|
108
|
log.Logger.Error("车间设备数据加入redis失败:" + err.Error())
|