zhangqian
2023-11-25 b7232e7c2b14c09e4de77182cb659fc16e6a563b
没有plc时允许获取任务
1个文件已修改
7 ■■■■ 已修改文件
service/device_plc.go 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
service/device_plc.go
@@ -8,7 +8,6 @@
    "apsClient/pkg/logx"
    "apsClient/pkg/structx"
    "encoding/json"
    "errors"
    "github.com/jinzhu/gorm"
)
@@ -48,12 +47,10 @@
func (slf DevicePlcService) GetDeviceChannelAmount() (int, error) {
    plcConfig, code := slf.GetDevicePlc()
    if code != ecode.OK || plcConfig.ID == 0 {
        logx.Errorf("GetDeviceChannelAmount failed:%v, code:%v", plcConfig, code)
        return 0, errors.New("未获取到PLC地址,请在工艺模型库中上传!")
        return 1, nil
    }
    if len(plcConfig.Details) == 0 {
        logx.Errorf("GetDeviceChannelAmount failed, addressList == 0, %+v", plcConfig)
        return 0, errors.New("未获取到PLC地址,请在工艺模型库中上传!")
        return 1, nil
    }
    return len(plcConfig.Details) / 2, nil
}