修改构建protoRepository bug;增加获取道岔状态的函数

This commit is contained in:
joylink_zhangsai 2023-09-26 13:45:01 +08:00
parent d14b35fb92
commit f13d1ed468
2 changed files with 15 additions and 3 deletions

View File

@ -16,7 +16,11 @@ func ChangeTurnoutState(simulation *VerifySimulation, status *state.SwitchState,
panic(&dto.ErrorDto{Code: dto.ArgumentParseError, Message: "参数转换出错"}) panic(&dto.ErrorDto{Code: dto.ArgumentParseError, Message: "参数转换出错"})
} }
uid := QueryUidByMidAndIndex(mapId, int32(index), &graphicData.Turnout{}) uid := QueryUidByMidAndIndex(mapId, int32(index), &graphicData.Turnout{})
entities.TurnToNormal(simulation.WorldId, uid) if status.Normal {
entities.TurnToNormal(simulation.WorldId, uid)
} else if status.Reverse {
entities.TurnToReverse(simulation.WorldId, uid)
}
//log.Default().Printf("修改道岔【UID:%s】\n", uid) //log.Default().Printf("修改道岔【UID:%s】\n", uid)
//allSwitchMap := &simulation.Memory.Status.SwitchStateMap //allSwitchMap := &simulation.Memory.Status.SwitchStateMap
//d, ok := allSwitchMap.Load(uid) //d, ok := allSwitchMap.Load(uid)

View File

@ -209,9 +209,13 @@ func relateRelay(repo *proto.Repository, relayGi *graphicData.RelayCabinetGraphi
continue continue
} }
for _, group := range relationship.Combinationtypes { for _, group := range relationship.Combinationtypes {
var relayUIds []string
for _, relayId := range group.RefRelays {
relayUIds = append(relayUIds, uidsMap.RelayIds[relayId].Uid)
}
turnout.RelayGroups = append(turnout.RelayGroups, &proto.RelayGroup{ turnout.RelayGroups = append(turnout.RelayGroups, &proto.RelayGroup{
Code: group.Code, Code: group.Code,
RelayIds: group.RefRelays, RelayIds: relayUIds,
}) })
} }
case graphicData.RelatedRef_signal: case graphicData.RelatedRef_signal:
@ -220,9 +224,13 @@ func relateRelay(repo *proto.Repository, relayGi *graphicData.RelayCabinetGraphi
continue continue
} }
for _, group := range relationship.Combinationtypes { for _, group := range relationship.Combinationtypes {
var relayUIds []string
for _, relayId := range group.RefRelays {
relayUIds = append(relayUIds, uidsMap.RelayIds[relayId].Uid)
}
signal.RelayGroups = append(signal.RelayGroups, &proto.RelayGroup{ signal.RelayGroups = append(signal.RelayGroups, &proto.RelayGroup{
Code: group.Code, Code: group.Code,
RelayIds: group.RefRelays, RelayIds: relayUIds,
}) })
} }
} }