【新增】防淹门构建为车库门模型逻辑

【bug】当缺少继电器时,车库门的ecs系统逻辑和状态发送逻辑执行出错
This commit is contained in:
thesai 2024-04-01 13:31:38 +08:00
parent 32c575125f
commit 3ae2f14a16
5 changed files with 16 additions and 8 deletions

View File

@ -3,9 +3,8 @@ package ms_api
import (
"context"
"fmt"
"log/slog"
"time"
"joylink.club/bj-rtsts-server/sys_error"
)
type MsgTask interface {
@ -52,7 +51,7 @@ mainLoop:
}
err := t.fn()
if err != nil {
panic(sys_error.New(fmt.Sprintf("仿真任务【%s】状态消息收集异常", t.name), err))
slog.Error(fmt.Sprintf("仿真任务【%s】状态消息收集异常", t.name), err)
}
time.Sleep(t.interval)
}

View File

@ -108,8 +108,11 @@ func collectCkmOrFymStates(world ecs.World, mapId int32, gates []*data_proto.Gar
commonId := ckm.Common.Id
entry, ok := entity.GetEntityByUid(world, ckmUidMap[commonId].Uid)
if ok {
circuit := component.CkmCircuitType.Get(entry)
mgj := component.BitStateType.Get(circuit.MGJ).Val
mgj := false
if entry.HasComponent(component.CkmCircuitType) {
circuit := component.CkmCircuitType.Get(entry)
mgj = component.BitStateType.Get(circuit.MGJ).Val
}
var ckmParam *request_proto.CkmParam
if entry.HasComponent(appcomponent.CkmParamType) {
ckmParam = appcomponent.CkmParamType.Get(entry)

@ -1 +1 @@
Subproject commit cf783364fefdcadef3bf1e88eb1d6b2dd12a3cc7
Subproject commit cf942ab3182e5d31030850929e1fc130350edf85

@ -1 +1 @@
Subproject commit d22b534a54ee04a3a4fdf3fe9514674961416ccb
Subproject commit 3c209fc66ee14dfcca3f3ad18ce37d0096e4a73b

View File

@ -1327,7 +1327,13 @@ func fillProtoRepository(repo *proto.Repository, storage *data_proto.RtssGraphic
handlerIBPDeviceToStation(station, boxUidInfo.Uid, repo, data.RefIbpMapCode)
}
//车库门和车库门PSL
for _, data := range storage.GarageDoors {
fillCkmOrFym(repo, storage.GarageDoors, uidsMap)
//防淹门和防淹门PSL
fillCkmOrFym(repo, storage.FloodGates, uidsMap)
}
func fillCkmOrFym(repo *proto.Repository, doors []*data_proto.GarageDoor, uidsMap *StationUidStructure) {
for _, data := range doors {
//车库门
ckmId := GetMapElementId(data.Common)
ckm := &proto.Ckm{