fix
zhangqian
2023-09-16 0d3d5a03d100614e0216249ec5ebbbbef8ff174c
api/v1/plc.go
@@ -6,10 +6,8 @@
   "apsClient/model/response"
   _ "apsClient/model/response"
   "apsClient/pkg/contextx"
   "apsClient/pkg/ecode"
   "apsClient/pkg/plc"
   "apsClient/pkg/plc/apacheplc4x"
   "apsClient/service"
   "fmt"
   "github.com/gin-gonic/gin"
   "github.com/spf13/cast"
)
@@ -35,15 +33,9 @@
   resp.FinishNumber = cast.ToInt(finishNumber)
   resp.TotalNumber = cast.ToInt(totalNumber)
   plcConfig, code := service.NewDevicePlcService().GetDevicePlc()
   if code != ecode.OK {
      return
   }
   plcStatus := 1 //断开连接
   ipAddr := fmt.Sprintf("%s:%v", plcConfig.Address, plcConfig.Port)
   conn, err := plc.GetModbusConnection(ipAddr)
   if err == nil && conn.IsConnected() {
   isConnect := apacheplc4x.IsConnect()
   if isConnect {
      if resp.FinishNumber > 0 { //生产
         plcStatus = 2
      } else { //待机