From 774355ca4d9085e579b4bc931c26df54c79866f3 Mon Sep 17 00:00:00 2001 From: tiger_zhou Date: Tue, 19 Mar 2024 14:49:44 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=97=E8=BD=A6=E5=89=8D=E7=AB=AF=E6=93=8D?= =?UTF-8?q?=E4=BD=9C=E6=8E=A5=E5=8F=A3=EF=BC=8C=E5=88=97=E8=BD=A6=E8=BF=9E?= =?UTF-8?q?=E6=8E=A5=E4=B8=89=E6=96=B9=E6=98=A0=E5=B0=84=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E5=8F=8Aws=E8=BF=94=E5=9B=9E=E5=88=97=E8=BD=A6=E8=BF=9E?= =?UTF-8?q?=E6=8E=A5=E7=8A=B6=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dto/state_proto/device_state.pb.go | 2 +- message_server/simulation.go | 2 +- message_server/train_control_ms.go | 27 +++++++++---------- .../wayside/memory/wayside_memory_map.go | 4 +-- 4 files changed, 17 insertions(+), 18 deletions(-) diff --git a/dto/state_proto/device_state.pb.go b/dto/state_proto/device_state.pb.go index c56e6be..dc239aa 100644 --- a/dto/state_proto/device_state.pb.go +++ b/dto/state_proto/device_state.pb.go @@ -902,7 +902,7 @@ type TrainConnState struct { Conn bool `protobuf:"varint,1,opt,name=conn,proto3" json:"conn,omitempty"` ConnType TrainConnState_TrainConnType `protobuf:"varint,2,opt,name=connType,proto3,enum=state.TrainConnState_TrainConnType" json:"connType,omitempty"` - TrainControlMapId uint32 `protobuf:"varint,3,opt,name=TrainControlMapId,proto3" json:"TrainControlMapId,omitempty"` + TrainControlMapId uint32 `protobuf:"varint,3,opt,name=TrainControlMapId,proto3" json:"TrainControlMapId,omitempty"` //关联的列车控制mapId } func (x *TrainConnState) Reset() { diff --git a/message_server/simulation.go b/message_server/simulation.go index 4a94a3a..145a0c2 100644 --- a/message_server/simulation.go +++ b/message_server/simulation.go @@ -47,7 +47,7 @@ func Start(vs *memory.VerifySimulation) { case data_proto.PictureType_RelayCabinetLayout: // 继电器柜 _default.AddTasks(vs.SimulationId, NewRccMs(vs, mapId)) case data_proto.PictureType_TrainControlCab: - _default.AddTasks(vs.SimulationId, NewTrainControlMs(vs)) + _default.AddTasks(vs.SimulationId, NewTrainControlMs(vs, mapId)) } } } diff --git a/message_server/train_control_ms.go b/message_server/train_control_ms.go index 3d8faa5..ccdf16c 100644 --- a/message_server/train_control_ms.go +++ b/message_server/train_control_ms.go @@ -2,7 +2,6 @@ package message_server import ( "fmt" - "joylink.club/bj-rtsts-server/dto/data_proto" "joylink.club/bj-rtsts-server/dto/state_proto" "joylink.club/bj-rtsts-server/message_server/ms_api" "joylink.club/bj-rtsts-server/mqtt" @@ -12,21 +11,21 @@ import ( ) // 综合后备盘IBP消息服务 -func NewTrainControlMs(vs *memory.VerifySimulation) ms_api.MsgTask { - var findMapId int32 = 0 - for _, d := range vs.MapIds { - mapData := memory.QueryGiType(d) - if mapData == data_proto.PictureType_TrainControlCab { - findMapId = d - break +func NewTrainControlMs(vs *memory.VerifySimulation, mapId int32) ms_api.MsgTask { + /* var findMapId int32 = 0 + for _, d := range vs.MapIds { + mapData := memory.QueryGiType(d) + if mapData == data_proto.PictureType_TrainControlCab { + findMapId = d + break + } } - } - if findMapId == 0 { - slog.Error("未找到对应的列城控制图形") - return nil - } - return ms_api.NewScheduleTask(fmt.Sprintf("地图[%d]列车控制", findMapId), func() error { + if findMapId == 0 { + slog.Error("未找到对应的列城控制图形") + return nil + }*/ + return ms_api.NewScheduleTask(fmt.Sprintf("地图[%d]列车控制", mapId), func() error { allTrainMap := &vs.Memory.Status.TrainStateMap allTrainMap.Range(func(key, value any) bool { trainId := fmt.Sprintf("%v", key) diff --git a/ts/simulation/wayside/memory/wayside_memory_map.go b/ts/simulation/wayside/memory/wayside_memory_map.go index b7b287d..c0616bc 100644 --- a/ts/simulation/wayside/memory/wayside_memory_map.go +++ b/ts/simulation/wayside/memory/wayside_memory_map.go @@ -39,8 +39,8 @@ func PublishMapVerifyStructure(graphic *dto.PublishedDto) { message = &data_proto.PslGraphicStorage{} case data_proto.PictureType_IBP: message = &data_proto.IBPGraphicStorage{} - /* case data_proto.PictureType_TrainControlCab: - message = &data_proto.TccGraphicStorage{}*/ + case data_proto.PictureType_TrainControlCab: + message = &data_proto.TccGraphicStorage{} } err := proto.Unmarshal(graphic.Proto, message)