From f73f610cdf4b0666dc139a51e72353b88f8f25ab Mon Sep 17 00:00:00 2001
From: zhangzengfei <zhangzengfei@smartai.com>
Date: 星期四, 19 十月 2023 17:27:17 +0800
Subject: [PATCH] 为保证正确获取集群状态, 添加程序启动时读取system-service运行状态
---
model/common/common.go | 50 +++++++++++++++++++++++++++++++++++++++-----------
1 files changed, 39 insertions(+), 11 deletions(-)
diff --git a/model/common/common.go b/model/common/common.go
index 5eafc0d..9df61af 100644
--- a/model/common/common.go
+++ b/model/common/common.go
@@ -51,6 +51,7 @@
OutputMaterials []*ProcedureMaterial `json:"outputMaterials"` // 杈撳嚭鐗╂枡鍒楄〃
Workers []*ProcedureWorker `json:"workers"` // 浜哄憳鍒楄〃
AllProcedureNames []string `json:"allProcedureNames"` // 鎵�灞炲伐鍗曞伐搴忓垪琛�
+ Channel int32 `json:"channel"` //閫氶亾搴忓彿
}
DeliverScheduleTask struct {
@@ -68,25 +69,25 @@
KeyData []byte
AddressData []byte
DeviceId string
- PlcAddressList []*PlcAddress
- PlcConfig PlcConfig
+ PlcAddressList []*PlcAddress //plc 瀹屾垚閲忥紝鎬婚噺锛� 璇诲啓鍦板潃
+ PlcConfig PlcConfig //鐢ㄧ綉鍙h繕鏄鍙d互鍙婄綉鍙p port
}
PlcConfig struct {
- Brand string `gorm:"type:varchar(191);comment:PLC鍝佺墝" json:"brand"`
- Method constvar.PlcMethod `gorm:"type:varchar(191);comment:鎺ュ彛鏂瑰紡" json:"method"`
- 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"` //涓插彛鍚嶇О锛宮ethod = serial鏃� 鐢�
- IsOpen bool `gorm:"type:tinyint(1);comment:鏄惁寮�鍚�" json:"isOpen"`
- Detail string `gorm:"type:varchar(2048);comment:鏁版嵁璇︽儏" json:"-"`
+ Brand string `gorm:"type:varchar(191)" json:"brand"` //comment:PLC鍝佺墝
+ Method constvar.PlcMethod `gorm:"type:varchar(191)" json:"method"` //comment:鎺ュ彛鏂瑰紡
+ Address string `gorm:"type:varchar(191)" json:"address"` //plc ip鍦板潃锛� method = modbusTCP鐢�
+ Port int `gorm:"type:int(11)" json:"port"` //plc 绔彛鍙凤紝 method = modbusTCP鐢�
+ BaudRate int `gorm:"type:int(11)" json:"baudRate"` //涓插彛娉㈢壒鐜囷紝 method = serial鏃� 鐢�
+ SerialName string `gorm:"type:int(11)" json:"serialName"` //涓插彛鍚嶇О锛宮ethod = serial鏃� 鐢�
+ IsOpen bool `gorm:"type:tinyint(1)" json:"isOpen"`
+ Detail string `gorm:"type:varchar(2048)" json:"-"`
Details []*PlcAddress `gorm:"-" json:"details"`
}
PlcAddress struct {
DeviceID string `json:"deviceID"` // 璁惧id
- Position int `json:"position"` // 鐢熶骇浣嶇疆锛屼竴涓満鍣ㄥ彲鑳芥湁澶氫釜鏈轰綅锛岄渶瑕佸垎鍒厤缃畃lc鍦板潃
+ Channel int `json:"channel"` // 鐢熶骇閫氶亾on锛屼竴涓満鍣ㄥ彲鑳芥湁澶氫釜鏈轰綅锛岄渶瑕佸垎鍒厤缃畃lc鍦板潃
StartAddress int `json:"startAddress"` // 鏁版嵁璧峰鍦板潃
Length int `json:"length"` // 鏁版嵁闀垮害
Type string `json:"type"` // 鏁版嵁绫诲瀷
@@ -125,3 +126,30 @@
IsProcessing bool //鏄惁澶勭悊涓�
IsFinish bool //鏄惁瀹屾垚
}
+
+type Device struct {
+ ID string `gorm:"comment:涓婚敭ID;primaryKey;type:varchar(191);" json:"id"`
+ DeviceProcedureAttr []*DeviceProcedureAttr `json:"deviceProcedureAttr"` // 璁惧宸ュ簭灞炴�у垪琛�
+ ExtChannelAmount int `gorm:"type:tinyint;comment:棰濆鐨勯�氶亾鏁伴噺;default:0;" json:"extChannelAmount"`
+}
+type DeviceProcedureAttr struct {
+ ProcedureID string `gorm:"index;type:varchar(191);comment:宸ュ簭ID" json:"procedureId"`
+ ProcedureName string `gorm:"type:varchar(191);comment:宸ュ簭鍚嶇О" json:"procedureName"`
+ DeviceID string `gorm:"index;type:varchar(191);not null;comment:璁惧ID" json:"deviceId"`
+}
+
+type PullDataType string
+
+const (
+ PullDataTypeProcessModel = "process_model"
+)
+
+// MsgPullDataRequest 鎷夊彇浜戠鏁版嵁
+type MsgPullDataRequest struct {
+ DataType PullDataType `json:"dataType"` //瑕佹媺鍙栫殑鏁版嵁绫诲瀷
+}
+
+type MsgPullDataResponse struct {
+ DataType PullDataType `json:"dataType"` //瑕佹媺鍙栫殑鏁版嵁绫诲瀷
+ Data interface{} //杩斿洖鐨勬暟鎹�
+}
--
Gitblit v1.8.0