| | |
| | | } |
| | | |
| | | func (slf DevicePlcService) GetDevicePlc() (*model.DevicePlc, int) { |
| | | DevicePlc, err := model.NewDevicePlcSearch().SetDeviceId(conf.Conf.CurrentDeviceID).First() |
| | | devicePlc, err := model.NewDevicePlcSearch().SetDeviceId(conf.Conf.CurrentDeviceID).First() |
| | | if err == gorm.ErrRecordNotFound { |
| | | logx.Errorf("GetDevicePlc failed:%v", err) |
| | | return &model.DevicePlc{ |
| | |
| | | logx.Errorf("GetDevicePlc failed:%v", err) |
| | | return nil, ecode.DBErr |
| | | } |
| | | if len(devicePlc.Details) == 0 { |
| | | return nil, ecode.PlcAddressError |
| | | } |
| | | |
| | | return DevicePlc, ecode.OK |
| | | return devicePlc, ecode.OK |
| | | } |
| | | |
| | | func (slf DevicePlcService) GetDeviceChannelAmount() (int, error) { |