From b331c9990a0396301e934daffe095f99d62d1c89 Mon Sep 17 00:00:00 2001
From: zhangqian <zhangqian@123.com>
Date: 星期三, 27 九月 2023 15:58:49 +0800
Subject: [PATCH] 任务获取修改,状态2只返回已开始和已结束的

---
 model/device_plc.go |   32 ++++++++++++++++++++------------
 1 files changed, 20 insertions(+), 12 deletions(-)

diff --git a/model/device_plc.go b/model/device_plc.go
index ae1e43c..fc8330e 100644
--- a/model/device_plc.go
+++ b/model/device_plc.go
@@ -1,6 +1,7 @@
 package model
 
 import (
+	"apsClient/constvar"
 	"apsClient/pkg/sqlitex"
 	"encoding/json"
 	"fmt"
@@ -12,24 +13,31 @@
 	// DevicePlc 璁惧鐨凱LC閰嶇疆
 	DevicePlc struct {
 		gorm.Model `json:"-"`
-		Id         int    `gorm:"primarykey;type:int;" json:"id"`
-		Brand      string `gorm:"type:varchar(191);comment:PLC鍝佺墝" json:"brand"`
-		Method     string `gorm:"type:varchar(191);comment:鎺ュ彛鏂瑰紡" json:"method"`
-		PortName   string `gorm:"type:varchar(191);comment:绔彛鍚嶇О" json:"portName"`
-		Frequency  int    `gorm:"type:int(11);comment:鏁版嵁鏇存柊棰戠巼 0-瀹炴椂鏇存柊 1-1娆�/绉�" json:"frequency"`
-		Address    string `gorm:"type:varchar(191);comment:PLC鍦板潃" json:"address"`
-		Port       int    `gorm:"type:int(11);comment:绔彛" json:"port"`
-		IsOpen     bool   `gorm:"type:tinyint(1);comment:鏄惁寮�鍚�" json:"isOpen"`
+		Id         int                `gorm:"primarykey;type:int;" json:"id"`
+		Brand      string             `gorm:"type:varchar(191);comment:PLC鍝佺墝" json:"brand"`
+		Method     constvar.PlcMethod `gorm:"type:varchar(191);comment:鎺ュ彛鏂瑰紡" json:"method"`
+		//PortName   string `gorm:"type:varchar(191);comment:绔彛鍚嶇О" json:"portName"`
+		//Frequency  int    `gorm:"comment:鏁版嵁鏇存柊棰戠巼 0-瀹炴椂鏇存柊 1-1娆�/绉�" json:"frequency"`
+		Address    string `gorm:"type:varchar(191);comment:PLC鍦板潃" json:"address"` //plc ip鍦板潃锛� method = modbusTCP鐢�
+		Port       int    `gorm:"comment:绔彛" json:"port"`                         //plc 绔彛鍙凤紝  method =  modbusTCP鐢�
+		BaudRate   int    `gorm:"comment:娉㈢壒鐜�"  json:"baudRate"`                   //涓插彛娉㈢壒鐜囷紝 method = serial鏃� 鐢�
+		SerialName string `gorm:"comment:涓插彛鍚嶇О"  json:"serialName"`                //涓插彛鍚嶇О锛宮ethod = serial鏃� 鐢�
+		IsOpen     bool   `gorm:"comment:鏄惁寮�鍚�" json:"isOpen"`
 		Detail     string `gorm:"type:varchar(2048);comment:鏁版嵁璇︽儏" json:"-"`
 
 		Details []*DevicePlcAddress `gorm:"-" json:"details"`
+
+		MaxTryTimes     int   `gorm:"-" json:"-"` //鏈�澶у啓鍏ラ噸璇曟鏁�
+		CurrentTryTimes int   `gorm:"-" json:"-"` //褰撳墠鍐欏叆閲嶈瘯娆℃暟
+		CurrentErr      error `gorm:"-" json:"-"` //褰撳墠鎶ラ敊
 	}
 
 	DevicePlcAddress struct {
-		StartAddress int    `json:"startAddress"` // 鏁版嵁璧峰鍦板潃
-		Length       int    `json:"length"`       // 鏁版嵁闀垮害
-		Type         string `json:"type"`         // 鏁版嵁绫诲瀷
-		FieldName    string `json:"fieldName"`    // 瀵瑰簲绯荤粺瀛楁
+		Channel      int32                             `json:"channel"`      // 鏁版嵁璧峰鍦板潃
+		StartAddress int                               `json:"startAddress"` // 鏁版嵁璧峰鍦板潃
+		Length       int                               `json:"length"`       // 鏁版嵁闀垮害
+		Type         constvar.PlcStartAddressValueType `json:"type"`         // 鏁版嵁绫诲瀷
+		FieldName    constvar.PlcStartAddressType      `json:"fieldName"`    // 瀵瑰簲绯荤粺瀛楁
 	}
 
 	DevicePlcSearch struct {

--
Gitblit v1.8.0