From b7232e7c2b14c09e4de77182cb659fc16e6a563b Mon Sep 17 00:00:00 2001
From: zhangqian <zhangqian@123.com>
Date: 星期六, 25 十一月 2023 17:20:41 +0800
Subject: [PATCH] 没有plc时允许获取任务

---
 service/device_plc.go |    7 ++-----
 1 files changed, 2 insertions(+), 5 deletions(-)

diff --git a/service/device_plc.go b/service/device_plc.go
index d76e781..ecff338 100644
--- a/service/device_plc.go
+++ b/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
 }

--
Gitblit v1.8.0