...
|
...
|
@@ -61,12 +61,6 @@ func (deviceCollectionService *DeviceCollectionService) CreateDeviceCollection(c |
|
|
if deviceCollection, err := deviceCollectionRepository.Save(newDeviceCollection); err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
} else {
|
|
|
//err = domainService.SendWorkshopDeviceData(deviceCollection)
|
|
|
//if err != nil {
|
|
|
// log.Logger.Error("车间设备数据加入redis失败:" + err.Error())
|
|
|
// return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
//}
|
|
|
|
|
|
if err := transactionContext.CommitTransaction(); err != nil {
|
|
|
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
|
}
|
...
|
...
|
@@ -127,8 +121,6 @@ func (deviceCollectionService *DeviceCollectionService) DeviceCollection(createD |
|
|
}
|
|
|
|
|
|
//计算区间的产能
|
|
|
//switch deviceCollection.DeviceType {
|
|
|
//case domain.DeviceTypeBaoXianJi, domain.DeviceTypeChuanChuanJi, domain.DeviceTypeFengKouJi, domain.DeviceTypeFengXiangJi:
|
|
|
if v, ok := newDeviceCollection.Values["Count"]; ok {
|
|
|
newDeviceCollection.Values["total"] = v // 记录原始值
|
|
|
newDeviceCollection.Values["Count"] = 0
|
...
|
...
|
@@ -146,12 +138,14 @@ func (deviceCollectionService *DeviceCollectionService) DeviceCollection(createD |
|
|
}
|
|
|
}
|
|
|
}
|
|
|
// TODO:测试假数据,后期注释掉
|
|
|
//if createDeviceCollectionCommand.DeviceType == domain.DeviceTypeChuanChuanJi {
|
|
|
// newDeviceCollection.Values["Count"] = rand.Intn(300)
|
|
|
//}
|
|
|
deviceCollection, err := deviceCollectionRepository.Save(newDeviceCollection)
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
}
|
|
|
// break
|
|
|
//}
|
|
|
err = domainService.SendWorkshopDeviceData(deviceCollection)
|
|
|
if err != nil {
|
|
|
log.Logger.Error("车间设备数据加入redis失败:" + err.Error())
|
...
|
...
|
|