From efec800478214f3a412f879d2b51c2968515995d Mon Sep 17 00:00:00 2001
From: zhangqian <zhangqian@123.com>
Date: 星期六, 25 十一月 2023 17:04:25 +0800
Subject: [PATCH] plc断开连接时获取工序最后一次报工数量作为加工数

---
 api/v1/device.go |   11 +++++------
 1 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/api/v1/device.go b/api/v1/device.go
index 04ef6f9..5bcb18d 100644
--- a/api/v1/device.go
+++ b/api/v1/device.go
@@ -2,15 +2,12 @@
 
 import (
 	"apsClient/conf"
-	"apsClient/constvar"
-	"apsClient/crontask"
 	"apsClient/model/request"
 	"apsClient/model/response"
 	_ "apsClient/model/response"
 	"apsClient/pkg/contextx"
 	"apsClient/pkg/ecode"
 	"apsClient/pkg/logx"
-	"apsClient/pkg/safe"
 	"apsClient/service"
 	"github.com/gin-gonic/gin"
 )
@@ -35,6 +32,11 @@
 		return
 	}
 	list, err := service.GetDeviceIDList()
+	if err != nil {
+		logx.Errorf("SetCurrentDeviceId GetDeviceIDList err:%v", err)
+		ctx.Fail(ecode.DBErr)
+		return
+	}
 	findFlag := false
 	for _, item := range list {
 		if item == params.CurrentDeviceID {
@@ -47,9 +49,6 @@
 	}
 	service.SetDeviceIDToFile(params.CurrentDeviceID)
 	conf.Conf.CurrentDeviceID = params.CurrentDeviceID
-	safe.Go(func() {
-		_ = crontask.RestartTask(conf.Conf.SerfClusterStatus != constvar.SerfClusterStatusSlave)
-	})
 	ctx.Ok()
 }
 

--
Gitblit v1.8.0