zhangqian
2023-08-24 e6c81b3916494ef51edc21774a27402d0f16c49c
model/device_plc.go
@@ -1,6 +1,7 @@
package model
import (
   "apsClient/constvar"
   "apsClient/pkg/sqlitex"
   "encoding/json"
   "fmt"
@@ -14,11 +15,13 @@
      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"`
      Method     constvar.PlcMethod `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"` //plc ip地址, method = modbusTCP用
      Port       int    `gorm:"type:int(11);comment:端口" json:"port"`            //plc 端口号,  method =  modbusTCP用
      BaudRate   int    `gorm:"type:int(11);comment:波特率"  json:"baudRate"`      //串口波特率, method = serial时 用
      SerialName string `gorm:"type:int(11);comment:串口名称"  json:"serialName"`   //串口名称,method = serial时 用
      IsOpen     bool   `gorm:"type:tinyint(1);comment:是否开启" json:"isOpen"`
      Detail     string `gorm:"type:varchar(2048);comment:数据详情" json:"-"`