From 8ba0a125eb7302d8c51d3c85cf8ea8a4de5413db Mon Sep 17 00:00:00 2001
From: zhangzengfei <zhangzengfei@smartai.com>
Date: 星期六, 25 五月 2024 17:56:27 +0800
Subject: [PATCH] 修复ape类型判断

---
 service/nvcs.go |   31 +++++++++++++++++++++++++------
 1 files changed, 25 insertions(+), 6 deletions(-)

diff --git a/service/nvcs.go b/service/nvcs.go
index 7af51b1..acb1177 100644
--- a/service/nvcs.go
+++ b/service/nvcs.go
@@ -6,7 +6,6 @@
 	"fmt"
 	"io/ioutil"
 	"net"
-	"strings"
 	"time"
 
 	"gat1400Exchange/config"
@@ -35,6 +34,12 @@
 type ElevatorData struct {
 	Elevator []Elevator `json:"Elevator"`
 }
+
+const (
+	RunStop = iota
+	RunUp
+	RunDown
+)
 
 // 瀵规帴缃戠粶瑙嗛瀛楃鍙犲姞鍣�,鎺ユ敹udp鍙戦�佺殑妤煎眰淇℃伅, 鏇存柊device鍦板潃
 func NVCSA1UDPServer() {
@@ -87,6 +92,23 @@
 			continue
 		}
 
+		// 璁剧疆osd  鏍煎紡 "1F 鍥� 鏋�"
+		if config.NVCSConf.OSD != "" {
+			floorText := data.Elevator[0].Status.FloorName
+			//if data.Elevator[0].Status.RunDir == RunStop {
+			//	floorText = floorText + "鍋�"
+			//} else if data.Elevator[0].Status.RunDir == RunUp {
+			//	floorText = floorText + "涓�"
+			//} else {
+			//	floorText = floorText + "涓�"
+			//}
+
+			floorText = floorText + " " + config.NVCSConf.OSD
+
+			// 璋冪敤hik api 灏嗘枃瀛楁坊鍔犲埌osd鐨勫乏涓嬭
+			AddFloorToOSD(floorText)
+		}
+
 		if data.Elevator[0].Status.RunDir > 0 {
 			continue
 		}
@@ -94,11 +116,8 @@
 		elevator := data.Elevator[0]
 
 		// 绋嬪簭閮ㄧ讲鍦ㄨ澶囩, 瀛楃鍙犲姞鍣ㄤ笂鎶ョ殑鍚嶇О鍏佽涓虹┖. 鍦ㄤ簯绔�, 鍚嶇О蹇呴』涓庢憚鍍忔満鐩稿悓
-		if config.ServeConf.Role != "agent" {
-			elevator.Name = strings.Trim(elevator.Name, " ")
-			if elevator.Name == "" {
-				continue
-			}
+		if elevator.Name == "" {
+			elevator.Name = "1"
 		}
 
 		var d = models.Positions{

--
Gitblit v1.8.0