【增加地图元素commonId转换方法】
This commit is contained in:
parent
e4818dae33
commit
3edeec44c6
@ -1,6 +1,6 @@
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.31.0
|
||||
// protoc-gen-go v1.28.1
|
||||
// protoc v4.23.1
|
||||
// source: request.proto
|
||||
|
||||
|
@ -37,7 +37,8 @@ func (ms *IbpMs) OnTick() ([]*ms_api.TopicMsg, error) {
|
||||
var msgArr []*ms_api.TopicMsg
|
||||
mapData := memory.QueryGiData[*graphicData.RtssGraphicStorage](ms.mapId)
|
||||
for _, station := range mapData.Stations {
|
||||
channel := ms.handlerIBPChannelName(station.Common.Id)
|
||||
sid := memory.GetMapElementId(station.Common)
|
||||
channel := ms.handlerIBPChannelName(sid)
|
||||
stationIbpState, err := ms.collectStationIbpState(station)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@ -59,7 +60,8 @@ func (ms *IbpMs) collectStationIbpState(station *graphicData.Station) (*state.Pu
|
||||
if station.RefIbpMapCode == "" {
|
||||
return nil, nil
|
||||
}
|
||||
stationUid := memory.QueryUidByMidAndComId(ms.mapId, station.Common.Id, &graphicData.Station{})
|
||||
sid := memory.GetMapElementId(station.Common)
|
||||
stationUid := memory.QueryUidByMidAndComId(ms.mapId, sid, &graphicData.Station{})
|
||||
ibpMapId, ibpStorage := memory.GetStorageIBPMapData(station.RefIbpMapCode)
|
||||
ibpUidsMap := memory.QueryUidStructure[*memory.IBPUidStructure](ibpMapId)
|
||||
buttonStates, err := ms.collectIBPButtonState(stationUid, ibpUidsMap, ibpStorage.IbpButtons)
|
||||
@ -93,14 +95,14 @@ func (ms *IbpMs) collectStationIbpState(station *graphicData.Station) (*state.Pu
|
||||
func (ms *IbpMs) collectIBPButtonState(stationUid string, uidsMap *memory.IBPUidStructure, ibpButtons []*graphicData.IBPButton) ([]*state.ButtonState, error) {
|
||||
var states []*state.ButtonState
|
||||
for _, data := range ibpButtons { // 按钮
|
||||
uid := stationUid + "_" + uidsMap.IbpButtonIds[data.Common.Id].Uid
|
||||
did := memory.GetMapElementId(data.Common)
|
||||
uid := stationUid + "_" + uidsMap.IbpButtonIds[did].Uid
|
||||
entry, ok := entity.GetEntityByUid(ms.vs.World, uid)
|
||||
if !ok {
|
||||
//slog.Warn("ibp按钮实体不存在: World id=%d, uid=%s", ms.vs.World.Id(), uid)
|
||||
continue
|
||||
}
|
||||
if entry.HasComponent(component.ButtonTag) {
|
||||
states = append(states, getIBPButtonState(data.Common.Id, entry))
|
||||
states = append(states, getIBPButtonState(did, entry))
|
||||
}
|
||||
}
|
||||
return states, nil
|
||||
@ -123,14 +125,14 @@ func getIBPButtonState(id string, entry *ecs.Entry) *state.ButtonState {
|
||||
func (ms *IbpMs) collectIBPAlarmState(stationUid string, uidsMap *memory.IBPUidStructure, ibpAlarms []*graphicData.IbpAlarm) ([]*state.AlarmState, error) {
|
||||
var states []*state.AlarmState
|
||||
for _, data := range ibpAlarms { // 报警器
|
||||
uid := stationUid + "_" + uidsMap.IbpAlarmIds[data.Common.Id].Uid
|
||||
did := memory.GetMapElementId(data.Common)
|
||||
uid := stationUid + "_" + uidsMap.IbpAlarmIds[did].Uid
|
||||
entry, ok := entity.GetEntityByUid(ms.vs.World, uid)
|
||||
if !ok {
|
||||
//slog.Warn("ibp报警器实体不存在: World id=%d, uid=%s", ms.vs.World.Id(), uid)
|
||||
continue
|
||||
}
|
||||
if entry.HasComponent(component.AlarmTag) {
|
||||
states = append(states, &state.AlarmState{Id: data.Common.Id, Active: component.BitStateType.Get(entry).Val})
|
||||
states = append(states, &state.AlarmState{Id: did, Active: component.BitStateType.Get(entry).Val})
|
||||
}
|
||||
}
|
||||
return states, nil
|
||||
@ -140,14 +142,14 @@ func (ms *IbpMs) collectIBPAlarmState(stationUid string, uidsMap *memory.IBPUidS
|
||||
func (ms *IbpMs) collectIBPLightState(stationUid string, uidsMap *memory.IBPUidStructure, ibpLights []*graphicData.IbpLight) ([]*state.LightState, error) {
|
||||
var states []*state.LightState
|
||||
for _, data := range ibpLights { // 指示灯
|
||||
uid := stationUid + "_" + uidsMap.IbpLightIds[data.Common.Id].Uid
|
||||
did := memory.GetMapElementId(data.Common)
|
||||
uid := stationUid + "_" + uidsMap.IbpLightIds[did].Uid
|
||||
entry, ok := entity.GetEntityByUid(ms.vs.World, uid)
|
||||
if !ok {
|
||||
//slog.Warn("ibp指示灯实体不存在: World id=%d, uid=%s", ms.vs.World.Id(), uid)
|
||||
continue
|
||||
}
|
||||
if entry.HasComponent(component.LightTag) {
|
||||
states = append(states, &state.LightState{Id: data.Common.Id, Active: component.BitStateType.Get(entry).Val})
|
||||
states = append(states, &state.LightState{Id: did, Active: component.BitStateType.Get(entry).Val})
|
||||
}
|
||||
}
|
||||
return states, nil
|
||||
@ -157,14 +159,14 @@ func (ms *IbpMs) collectIBPLightState(stationUid string, uidsMap *memory.IBPUidS
|
||||
func (ms *IbpMs) collectIBPKeyState(stationUid string, uidsMap *memory.IBPUidStructure, ibpKeys []*graphicData.IbpKey) ([]*state.KeyState, error) {
|
||||
var states []*state.KeyState
|
||||
for _, data := range ibpKeys { // 钥匙
|
||||
uid := stationUid + "_" + uidsMap.IbpKeyIds[data.Common.Id].Uid
|
||||
did := memory.GetMapElementId(data.Common)
|
||||
uid := stationUid + "_" + uidsMap.IbpKeyIds[did].Uid
|
||||
entry, ok := entity.GetEntityByUid(ms.vs.World, uid)
|
||||
if !ok {
|
||||
//slog.Warn("ibp钥匙实体不存在: World id=%d, uid=%s", ms.vs.World.Id(), uid)
|
||||
continue
|
||||
}
|
||||
if entry.HasComponent(component.KeyTag) {
|
||||
states = append(states, &state.KeyState{Id: data.Common.Id, Gear: component.GearStateType.Get(entry).Val})
|
||||
states = append(states, &state.KeyState{Id: did, Gear: component.GearStateType.Get(entry).Val})
|
||||
}
|
||||
}
|
||||
return states, nil
|
||||
|
@ -38,7 +38,8 @@ func (p *PslMs) OnTick() ([]*ms_api.TopicMsg, error) {
|
||||
var msgArr []*ms_api.TopicMsg
|
||||
mapData := memory.QueryGiData[*graphicData.RtssGraphicStorage](p.mapId)
|
||||
for _, box := range mapData.GateBoxs {
|
||||
channel := p.handlerPSLChannelName(box.Common.Id)
|
||||
did := memory.GetMapElementId(box.Common)
|
||||
channel := p.handlerPSLChannelName(did)
|
||||
state, err := p.collectGateBoxPSLState(box)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@ -61,8 +62,9 @@ func (p *PslMs) handlerPSLChannelName(gateBoxId string) string {
|
||||
|
||||
func (p *PslMs) collectGateBoxPSLState(box *graphicData.GatedBox) (*state.PushedDevicesStatus, error) {
|
||||
world := p.vs.World
|
||||
did := memory.GetMapElementId(box.Common)
|
||||
uidStructure := memory.QueryUidStructure[*memory.StationUidStructure](p.mapId)
|
||||
boxUid := uidStructure.GateBoxIds[box.Common.Id].Uid
|
||||
boxUid := uidStructure.GateBoxIds[did].Uid
|
||||
mkxEntry, ok := entity.GetEntityByUid(world, boxUid)
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("[id:%s]的门控箱实体找不到", boxUid)
|
||||
|
@ -100,7 +100,8 @@ func (ms *SfpMs) collectPsdStates() ([]*state.PsdState, error) {
|
||||
data := memory.QueryGiData[*graphicData.RtssGraphicStorage](ms.mapId)
|
||||
var psdStateArr []*state.PsdState
|
||||
for _, door := range data.ScreenDoors {
|
||||
uid := uidStructure.PsdIds[door.Common.Id].Uid
|
||||
did := memory.GetMapElementId(door.Common)
|
||||
uid := uidStructure.PsdIds[did].Uid
|
||||
psdEntry, ok := entity.GetEntityByUid(world, uid)
|
||||
if ok {
|
||||
list := component.AsdListType.Get(psdEntry).List
|
||||
@ -115,7 +116,7 @@ func (ms *SfpMs) collectPsdStates() ([]*state.PsdState, error) {
|
||||
}
|
||||
}
|
||||
psdStateArr = append(psdStateArr, &state.PsdState{
|
||||
Id: door.Common.Id,
|
||||
Id: did,
|
||||
AsdStates: asdStates,
|
||||
Mgj: component.PsdStateType.Get(psdEntry).Close,
|
||||
})
|
||||
@ -330,9 +331,10 @@ func (ms *SfpMs) collectPlatformStates() ([]*state.PlatformState, error) {
|
||||
uidsMap := memory.QueryUidStructure[*memory.StationUidStructure](ms.mapId)
|
||||
platformScreenDoorMap := wrapScreenDoorToPlatform(mapData)
|
||||
for _, platform := range mapData.Platforms {
|
||||
pid := memory.GetMapElementId(platform.Common)
|
||||
stationCommonId := platform.RefStationId
|
||||
if stationCommonId == "" {
|
||||
return nil, fmt.Errorf("站台没有绑定车站:id=%s", platform.Common.Id)
|
||||
return nil, fmt.Errorf("站台没有绑定车站:id=%v", pid)
|
||||
}
|
||||
uidInfo := uidsMap.StationIds[stationCommonId]
|
||||
if uidInfo == nil {
|
||||
@ -342,7 +344,7 @@ func (ms *SfpMs) collectPlatformStates() ([]*state.PlatformState, error) {
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("车站实体不存在: World id=%d, uid=%s", ms.vs.World.Id(), uidInfo.Uid)
|
||||
}
|
||||
sta := &state.PlatformState{Id: platform.Common.Id}
|
||||
sta := &state.PlatformState{Id: pid}
|
||||
isX := strings.Contains(platform.Code, "下行站台") //下行站台
|
||||
if entry.HasComponent(component.EmpElectronicType) { // 紧急停车继电器
|
||||
empElectronic := component.EmpElectronicType.Get(entry)
|
||||
@ -363,7 +365,7 @@ func (ms *SfpMs) collectPlatformStates() ([]*state.PlatformState, error) {
|
||||
sta.SpksState = append(sta.SpksState, &state.ReplyState{Code: "SPKS4", Xh: getRelayXqVal(spkElectronic.SPKSS4J)})
|
||||
}
|
||||
}
|
||||
psdId := platformScreenDoorMap[platform.Common.Id]
|
||||
psdId := platformScreenDoorMap[pid]
|
||||
if psdId != "" {
|
||||
psdUid, ok := uidsMap.PsdIds[psdId]
|
||||
if !ok {
|
||||
@ -398,7 +400,7 @@ func (ms *SfpMs) collectPlatformStates() ([]*state.PlatformState, error) {
|
||||
func wrapScreenDoorToPlatform(mapData *graphicData.RtssGraphicStorage) map[string]string {
|
||||
platformMap := make(map[string]string, len(mapData.Platforms))
|
||||
for _, s := range mapData.ScreenDoors {
|
||||
platformMap[s.RefPlatformId] = s.Common.Id
|
||||
platformMap[s.RefPlatformId] = memory.GetMapElementId(s.Common)
|
||||
}
|
||||
return platformMap
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.31.0
|
||||
// protoc-gen-go v1.28.1
|
||||
// protoc v4.23.1
|
||||
// source: ibpGraphics.proto
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.31.0
|
||||
// protoc-gen-go v1.28.1
|
||||
// protoc v4.23.1
|
||||
// source: picture.proto
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.31.0
|
||||
// protoc-gen-go v1.28.1
|
||||
// protoc v4.23.1
|
||||
// source: pslGraphics.proto
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.31.0
|
||||
// protoc-gen-go v1.28.1
|
||||
// protoc v4.23.1
|
||||
// source: relayCabinetLayoutGraphics.proto
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,6 +1,6 @@
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.31.0
|
||||
// protoc-gen-go v1.28.1
|
||||
// protoc v4.23.1
|
||||
// source: device_state.proto
|
||||
|
||||
|
@ -42,7 +42,7 @@ func getIbpUidByMapIdAndStationId(mapId int32, stationId string) (*IBPUidStructu
|
||||
giData := QueryGiData[*graphicData.RtssGraphicStorage](mapId)
|
||||
var station *graphicData.Station
|
||||
for _, s := range giData.Stations {
|
||||
if s.Common.Id == stationId {
|
||||
if GetMapElementId(s.Common) == stationId {
|
||||
station = s
|
||||
break
|
||||
}
|
||||
|
@ -7,6 +7,7 @@ import (
|
||||
"sync"
|
||||
|
||||
"joylink.club/bj-rtsts-server/dto"
|
||||
"joylink.club/bj-rtsts-server/sys_error"
|
||||
"joylink.club/bj-rtsts-server/ts/protos/graphicData"
|
||||
"joylink.club/rtsssimulation/repository"
|
||||
)
|
||||
@ -15,6 +16,7 @@ var giUidMap sync.Map
|
||||
|
||||
type elementIdStructure struct {
|
||||
CommonId string
|
||||
Id uint32
|
||||
Code string
|
||||
Uid string
|
||||
}
|
||||
@ -56,6 +58,36 @@ type deviceRelateUidPriex struct {
|
||||
isPSD bool
|
||||
}
|
||||
|
||||
// 获取地图元素ID
|
||||
func GetMapElementId(common *graphicData.CommonInfo) string {
|
||||
return common.Id
|
||||
}
|
||||
|
||||
func getMapELementCode(code ...string) string {
|
||||
for _, c := range code {
|
||||
if c != "" {
|
||||
return c
|
||||
}
|
||||
}
|
||||
panic(sys_error.New("传入Code至少一个不为空"))
|
||||
}
|
||||
|
||||
// 获取关联的车站名
|
||||
func handleRefStationName(stationMap map[string]*graphicData.Station, sid []string) []string {
|
||||
var stationNames []string
|
||||
for _, id := range sid {
|
||||
if id == "" {
|
||||
continue
|
||||
}
|
||||
stationName := id
|
||||
if stationMap[id] != nil {
|
||||
stationName = stationMap[id].StationName
|
||||
}
|
||||
stationNames = append(stationNames, stationName)
|
||||
}
|
||||
return stationNames
|
||||
}
|
||||
|
||||
// 获取UID的前缀信息
|
||||
func getUIdPrefix(prefix interface{}) (string, string, string) {
|
||||
switch p := prefix.(type) {
|
||||
@ -83,25 +115,27 @@ func filterOtherLineDevice(data *graphicData.RtssGraphicStorage) {
|
||||
}
|
||||
}
|
||||
for _, d := range data.Section {
|
||||
if otherDeviceIdMap[d.Common.Id] {
|
||||
did := GetMapElementId(d.Common)
|
||||
if otherDeviceIdMap[did] {
|
||||
continue
|
||||
}
|
||||
otherDeviceIdMap[d.Common.Id] = (strings.TrimSpace(d.Code) == "" || d.Code == "G000")
|
||||
otherDeviceIdMap[did] = (strings.TrimSpace(d.Code) == "" || d.Code == "G000")
|
||||
}
|
||||
// 处理物理区段
|
||||
var sections []*graphicData.Section
|
||||
for _, d := range data.Section {
|
||||
if otherDeviceIdMap[d.Common.Id] {
|
||||
slog.Warn("区段[id:%s][code:%s]设备是其他线路设备已过滤", d.Common.Id, d.Code)
|
||||
did := GetMapElementId(d.Common)
|
||||
if otherDeviceIdMap[did] {
|
||||
slog.Warn("区段[id:%v][code:%s]设备是其他线路设备已过滤", did, d.Code)
|
||||
continue
|
||||
}
|
||||
if d.PaRef != nil && otherDeviceIdMap[d.PaRef.Id] {
|
||||
d.PaRef = nil
|
||||
slog.Warn("区段[id:%s][code:%s]设备A端是其他线路设备已置空", d.Common.Id, d.Code)
|
||||
slog.Warn("区段[id:%v][code:%s]设备A端是其他线路设备已置空", did, d.Code)
|
||||
}
|
||||
if d.PbRef != nil && otherDeviceIdMap[d.PbRef.Id] {
|
||||
d.PbRef = nil
|
||||
slog.Warn("区段[id:%s][code:%s]设备B端是其他线路设备已置空", d.Common.Id, d.Code)
|
||||
slog.Warn("区段[id:%v][code:%s]设备B端是其他线路设备已置空", did, d.Code)
|
||||
}
|
||||
var acs []string
|
||||
for _, id := range d.AxleCountings {
|
||||
@ -120,8 +154,9 @@ func filterOtherLineDevice(data *graphicData.RtssGraphicStorage) {
|
||||
// 处理计轴
|
||||
var axleCounts []*graphicData.AxleCounting
|
||||
for _, d := range data.AxleCountings {
|
||||
if otherDeviceIdMap[d.Common.Id] {
|
||||
slog.Warn("计轴[id:%s][code:%s]设备其他线路设备已过滤", d.Common.Id, d.Code)
|
||||
did := GetMapElementId(d.Common)
|
||||
if otherDeviceIdMap[did] {
|
||||
slog.Warn("计轴[id:%v][code:%s]设备其他线路设备已过滤", did, d.Code)
|
||||
continue
|
||||
}
|
||||
var refs []*graphicData.RelatedRef
|
||||
@ -138,21 +173,22 @@ func filterOtherLineDevice(data *graphicData.RtssGraphicStorage) {
|
||||
// 处理道岔
|
||||
var turnouts []*graphicData.Turnout
|
||||
for _, d := range data.Turnouts {
|
||||
if otherDeviceIdMap[d.Common.Id] {
|
||||
slog.Warn("道岔[id:%s][code:%s]设备其他线路设备已过滤", d.Common.Id, d.Code)
|
||||
did := GetMapElementId(d.Common)
|
||||
if otherDeviceIdMap[did] {
|
||||
slog.Warn("道岔[id:%v][code:%s]设备其他线路设备已过滤", did, d.Code)
|
||||
continue
|
||||
}
|
||||
if d.PaRef != nil && otherDeviceIdMap[d.PaRef.Id] {
|
||||
d.PaRef = nil
|
||||
slog.Warn("道岔[id:%s][code:%s]设备A端是其他线路设备已置空", d.Common.Id, d.Code)
|
||||
slog.Warn("道岔[id:%v][code:%s]设备A端是其他线路设备已置空", did, d.Code)
|
||||
}
|
||||
if d.PbRef != nil && otherDeviceIdMap[d.PbRef.Id] {
|
||||
d.PbRef = nil
|
||||
slog.Warn("道岔[id:%s][code:%s]设备B端是其他线路设备已置空", d.Common.Id, d.Code)
|
||||
slog.Warn("道岔[id:%v][code:%s]设备B端是其他线路设备已置空", did, d.Code)
|
||||
}
|
||||
if d.PcRef != nil && otherDeviceIdMap[d.PcRef.Id] {
|
||||
d.PcRef = nil
|
||||
slog.Warn("道岔[id:%s][code:%s]设备C端是其他线路设备已置空", d.Common.Id, d.Code)
|
||||
slog.Warn("道岔[id:%v][code:%s]设备C端是其他线路设备已置空", did, d.Code)
|
||||
}
|
||||
if d.PaTrackSectionId != "" && otherDeviceIdMap[d.PaTrackSectionId] {
|
||||
d.PaTrackSectionId = ""
|
||||
@ -169,8 +205,9 @@ func filterOtherLineDevice(data *graphicData.RtssGraphicStorage) {
|
||||
// 处理信号机
|
||||
var signals []*graphicData.Signal
|
||||
for _, d := range data.Signals {
|
||||
if otherDeviceIdMap[d.Common.Id] {
|
||||
slog.Warn("信号机[id:%s][code:%s]设备其他线路设备已过滤", d.Common.Id, d.Code)
|
||||
did := GetMapElementId(d.Common)
|
||||
if otherDeviceIdMap[did] {
|
||||
slog.Warn("信号机[id:%v][code:%s]设备其他线路设备已过滤", did, d.Code)
|
||||
continue
|
||||
}
|
||||
signals = append(signals, d)
|
||||
@ -179,8 +216,9 @@ func filterOtherLineDevice(data *graphicData.RtssGraphicStorage) {
|
||||
// 处理应答器
|
||||
var transponders []*graphicData.Transponder
|
||||
for _, d := range data.Transponders {
|
||||
if otherDeviceIdMap[d.Common.Id] {
|
||||
slog.Warn("应答器[id:%s][code:%s]设备其他线路设备已过滤", d.Common.Id, d.Code)
|
||||
did := GetMapElementId(d.Common)
|
||||
if otherDeviceIdMap[did] {
|
||||
slog.Warn("应答器[id:%v][code:%s]设备其他线路设备已过滤", did, d.Code)
|
||||
continue
|
||||
}
|
||||
transponders = append(transponders, d)
|
||||
@ -209,144 +247,83 @@ func initStationUid(data *graphicData.RtssGraphicStorage) *StationUidStructure {
|
||||
// 处理车站信息
|
||||
stationMap := make(map[string]*graphicData.Station)
|
||||
for _, s := range data.Stations {
|
||||
stationMap[s.Common.Id] = s
|
||||
stationName := s.StationName
|
||||
if stationName == "" {
|
||||
stationName = s.Code
|
||||
}
|
||||
gus.StationIds[s.Common.Id] = &elementIdStructure{
|
||||
CommonId: s.Common.Id,
|
||||
eid, stationName := GetMapElementId(s.Common), getMapELementCode(s.StationName, s.Code)
|
||||
stationMap[eid] = s
|
||||
gus.StationIds[eid] = &elementIdStructure{
|
||||
CommonId: eid,
|
||||
Code: stationName,
|
||||
Uid: GenerateElementUid(city, lineId, nil, stationName),
|
||||
}
|
||||
}
|
||||
// 初始化计轴信息
|
||||
for _, a := range data.AxleCountings {
|
||||
var stationNames []string
|
||||
for _, id := range a.CentralizedStations {
|
||||
if id == "" {
|
||||
continue
|
||||
}
|
||||
stationName := id
|
||||
if stationMap[id] != nil {
|
||||
stationName = stationMap[id].StationName
|
||||
}
|
||||
stationNames = append(stationNames, stationName)
|
||||
}
|
||||
code := a.Code
|
||||
if code == "" {
|
||||
code = a.Common.Id
|
||||
}
|
||||
gus.AxlePointIds[a.Common.Id] = &elementIdStructure{
|
||||
CommonId: a.Common.Id,
|
||||
eid := GetMapElementId(a.Common)
|
||||
code := getMapELementCode(a.Code, eid)
|
||||
stationNames := handleRefStationName(stationMap, a.CentralizedStations)
|
||||
gus.AxlePointIds[eid] = &elementIdStructure{
|
||||
CommonId: eid,
|
||||
Code: code,
|
||||
Uid: GenerateElementUid(city, lineId, stationNames, code),
|
||||
}
|
||||
}
|
||||
// 初始化道岔信息
|
||||
for _, t := range data.Turnouts {
|
||||
var stationNames []string
|
||||
for _, id := range t.CentralizedStations {
|
||||
if id == "" {
|
||||
continue
|
||||
}
|
||||
stationName := id
|
||||
if stationMap[id] != nil {
|
||||
stationName = stationMap[id].StationName
|
||||
}
|
||||
stationNames = append(stationNames, stationName)
|
||||
}
|
||||
code := t.Code
|
||||
if code == "" {
|
||||
code = t.Common.Id
|
||||
}
|
||||
gus.TurnoutIds[t.Common.Id] = &elementIdStructure{
|
||||
CommonId: t.Common.Id,
|
||||
eid := GetMapElementId(t.Common)
|
||||
code := getMapELementCode(t.Code, eid)
|
||||
stationNames := handleRefStationName(stationMap, t.CentralizedStations)
|
||||
gus.TurnoutIds[eid] = &elementIdStructure{
|
||||
CommonId: eid,
|
||||
Code: code,
|
||||
Uid: GenerateElementUid(city, lineId, stationNames, code),
|
||||
}
|
||||
}
|
||||
// 初始化物理区段信息
|
||||
for _, s := range data.Section {
|
||||
var stationNames []string
|
||||
for _, id := range s.CentralizedStations {
|
||||
if id == "" {
|
||||
continue
|
||||
}
|
||||
stationName := id
|
||||
if stationMap[id] != nil {
|
||||
stationName = stationMap[id].StationName
|
||||
}
|
||||
stationNames = append(stationNames, stationName)
|
||||
}
|
||||
code := s.Code
|
||||
if code == "" {
|
||||
code = s.Common.Id
|
||||
}
|
||||
gus.PhysicalSectionIds[s.Common.Id] = &elementIdStructure{
|
||||
CommonId: s.Common.Id,
|
||||
eid := GetMapElementId(s.Common)
|
||||
code := getMapELementCode(s.Code, eid)
|
||||
stationNames := handleRefStationName(stationMap, s.CentralizedStations)
|
||||
gus.PhysicalSectionIds[eid] = &elementIdStructure{
|
||||
CommonId: eid,
|
||||
Code: code,
|
||||
Uid: GenerateElementUid(city, lineId, stationNames, code),
|
||||
}
|
||||
}
|
||||
// 初始化信号机信息
|
||||
for _, s := range data.Signals {
|
||||
var stationNames []string
|
||||
for _, id := range s.CentralizedStations {
|
||||
if id == "" {
|
||||
continue
|
||||
}
|
||||
stationName := id
|
||||
if stationMap[id] != nil {
|
||||
stationName = stationMap[id].StationName
|
||||
}
|
||||
stationNames = append(stationNames, stationName)
|
||||
}
|
||||
code := s.Code
|
||||
if code == "" {
|
||||
code = s.Common.Id
|
||||
}
|
||||
gus.SignalIds[s.Common.Id] = &elementIdStructure{
|
||||
CommonId: s.Common.Id,
|
||||
eid := GetMapElementId(s.Common)
|
||||
code := getMapELementCode(s.Code, eid)
|
||||
stationNames := handleRefStationName(stationMap, s.CentralizedStations)
|
||||
gus.SignalIds[eid] = &elementIdStructure{
|
||||
CommonId: eid,
|
||||
Code: code,
|
||||
Uid: GenerateElementUid(city, lineId, stationNames, code),
|
||||
}
|
||||
}
|
||||
// 初始化应答器
|
||||
for _, t := range data.Transponders {
|
||||
var stationNames []string
|
||||
for _, id := range t.CentralizedStations {
|
||||
if id == "" {
|
||||
continue
|
||||
}
|
||||
stationName := id
|
||||
if stationMap[id] != nil {
|
||||
stationName = stationMap[id].StationName
|
||||
}
|
||||
stationNames = append(stationNames, stationName)
|
||||
}
|
||||
code := t.Code
|
||||
if code == "" {
|
||||
code = t.Common.Id
|
||||
}
|
||||
gus.TransponderIds[t.Common.Id] = &elementIdStructure{
|
||||
CommonId: t.Common.Id,
|
||||
eid := GetMapElementId(t.Common)
|
||||
code := getMapELementCode(t.Code, eid)
|
||||
stationNames := handleRefStationName(stationMap, t.CentralizedStations)
|
||||
gus.TransponderIds[eid] = &elementIdStructure{
|
||||
CommonId: eid,
|
||||
Code: code,
|
||||
Uid: GenerateElementUid(city, lineId, stationNames, code),
|
||||
}
|
||||
}
|
||||
// 初始化坡度
|
||||
for _, s := range data.Slopes {
|
||||
gus.SlopeIds[s.Common.Id] = &elementIdStructure{
|
||||
CommonId: s.Common.Id,
|
||||
Uid: GenerateElementUid(city, lineId, nil, s.Common.Id),
|
||||
eid := GetMapElementId(s.Common)
|
||||
gus.SlopeIds[eid] = &elementIdStructure{
|
||||
CommonId: eid,
|
||||
Uid: GenerateElementUid(city, lineId, nil, eid),
|
||||
}
|
||||
}
|
||||
// 初始化曲线
|
||||
for _, c := range data.Curvatures {
|
||||
gus.CurvatureIds[c.Common.Id] = &elementIdStructure{
|
||||
CommonId: c.Common.Id,
|
||||
Uid: GenerateElementUid(city, lineId, nil, c.Common.Id),
|
||||
eid := GetMapElementId(c.Common)
|
||||
gus.CurvatureIds[eid] = &elementIdStructure{
|
||||
CommonId: eid,
|
||||
Uid: GenerateElementUid(city, lineId, nil, eid),
|
||||
}
|
||||
}
|
||||
//处理车站关联的组合信息
|
||||
@ -361,13 +338,14 @@ func initStationUid(data *graphicData.RtssGraphicStorage) *StationUidStructure {
|
||||
}
|
||||
// 初始化站场图按钮
|
||||
for _, b := range data.EsbButtons {
|
||||
p := refMap[b.Common.Id]
|
||||
eid := GetMapElementId(b.Common)
|
||||
p := refMap[eid]
|
||||
code := b.Code
|
||||
if p != nil {
|
||||
code = p.deviceCode + "_" + p.typeCode + "_" + b.Code
|
||||
}
|
||||
gus.ButtonIds[b.Common.Id] = &elementIdStructure{
|
||||
CommonId: b.Common.Id,
|
||||
gus.ButtonIds[eid] = &elementIdStructure{
|
||||
CommonId: eid,
|
||||
Code: b.Code,
|
||||
Uid: GenerateElementUid(city, lineId, nil, code),
|
||||
}
|
||||
@ -375,9 +353,10 @@ func initStationUid(data *graphicData.RtssGraphicStorage) *StationUidStructure {
|
||||
// 站台
|
||||
platformMap := make(map[string]*graphicData.Platform)
|
||||
for _, platform := range data.Platforms {
|
||||
platformMap[platform.Common.Id] = platform
|
||||
gus.PlatformIds[platform.Common.Id] = &elementIdStructure{
|
||||
CommonId: platform.Common.Id,
|
||||
eid := GetMapElementId(platform.Common)
|
||||
platformMap[eid] = platform
|
||||
gus.PlatformIds[eid] = &elementIdStructure{
|
||||
CommonId: eid,
|
||||
Code: platform.Code,
|
||||
Uid: GenerateElementUid(city, lineId, nil, platform.Code),
|
||||
}
|
||||
@ -389,9 +368,10 @@ func initStationUid(data *graphicData.RtssGraphicStorage) *StationUidStructure {
|
||||
if station == nil { //线路数据有问题
|
||||
continue
|
||||
}
|
||||
psd_station_map[door.Common.Id] = station.StationName
|
||||
gus.PsdIds[door.Common.Id] = &elementIdStructure{
|
||||
CommonId: door.Common.Id,
|
||||
eid := GetMapElementId(door.Common)
|
||||
psd_station_map[eid] = station.StationName
|
||||
gus.PsdIds[eid] = &elementIdStructure{
|
||||
CommonId: eid,
|
||||
Code: door.Code,
|
||||
Uid: GenerateElementUid(city, lineId, []string{station.StationName}, door.Code),
|
||||
}
|
||||
@ -399,8 +379,9 @@ func initStationUid(data *graphicData.RtssGraphicStorage) *StationUidStructure {
|
||||
// 门控箱
|
||||
for _, box := range data.GateBoxs {
|
||||
stationName := psd_station_map[box.RefScreenDoor]
|
||||
gus.GateBoxIds[box.Common.Id] = &elementIdStructure{
|
||||
CommonId: box.Common.Id,
|
||||
eid := GetMapElementId(box.Common)
|
||||
gus.GateBoxIds[eid] = &elementIdStructure{
|
||||
CommonId: eid,
|
||||
Code: box.Code,
|
||||
Uid: GenerateElementUid(city, lineId, []string{stationName}, box.Code),
|
||||
}
|
||||
@ -418,10 +399,11 @@ func initStationUid(data *graphicData.RtssGraphicStorage) *StationUidStructure {
|
||||
if station == nil {
|
||||
continue
|
||||
}
|
||||
gus.SpksSwitchIds[spk.Common.Id] = &elementIdStructure{
|
||||
CommonId: spk.Common.Id,
|
||||
eid := GetMapElementId(spk.Common)
|
||||
gus.SpksSwitchIds[eid] = &elementIdStructure{
|
||||
CommonId: eid,
|
||||
Code: spk.Code,
|
||||
Uid: station.Uid + "_key_" + spk.Code,
|
||||
Uid: station.Uid + "_key_SPKS_" + spk.Code,
|
||||
}
|
||||
}
|
||||
return gus
|
||||
@ -448,15 +430,17 @@ func initRelayCabinetUid(data *graphicData.RelayCabinetGraphicStorage) *RelayUid
|
||||
// 获取公共前缀
|
||||
city, lineId, station := getUIdPrefix(data.UniqueIdPrefix)
|
||||
for _, r := range data.RelayCabinets {
|
||||
rus.RelayCabinetIds[r.Common.Id] = &elementIdStructure{
|
||||
CommonId: r.Common.Id,
|
||||
eid := GetMapElementId(r.Common)
|
||||
rus.RelayCabinetIds[eid] = &elementIdStructure{
|
||||
CommonId: eid,
|
||||
Code: r.Code,
|
||||
Uid: GenerateElementUid(city, lineId, []string{station}, r.Common.Id),
|
||||
Uid: GenerateElementUid(city, lineId, []string{station}, eid),
|
||||
}
|
||||
}
|
||||
// city+line+车站+设备code+继电器组合的code+继电器的code
|
||||
for _, r := range data.Relays {
|
||||
p := refMap[r.Common.Id]
|
||||
eid := GetMapElementId(r.Common)
|
||||
p := refMap[eid]
|
||||
code := r.Code
|
||||
if p != nil {
|
||||
code = p.deviceCode + "_" + p.typeCode + "_" + r.Code
|
||||
@ -465,14 +449,15 @@ func initRelayCabinetUid(data *graphicData.RelayCabinetGraphicStorage) *RelayUid
|
||||
if p != nil && (p.isStation || p.isPSD) {
|
||||
stationArr = nil
|
||||
}
|
||||
rus.RelayIds[r.Common.Id] = &elementIdStructure{
|
||||
CommonId: r.Common.Id,
|
||||
rus.RelayIds[eid] = &elementIdStructure{
|
||||
CommonId: eid,
|
||||
Code: r.Code,
|
||||
Uid: GenerateElementUid(city, lineId, stationArr, code),
|
||||
}
|
||||
}
|
||||
for _, r := range data.PhaseFailureProtectors {
|
||||
p := refMap[r.Common.Id]
|
||||
eid := GetMapElementId(r.Common)
|
||||
p := refMap[eid]
|
||||
code := r.Code
|
||||
if p != nil {
|
||||
code = p.deviceCode + "_" + p.typeCode + "_" + r.Code
|
||||
@ -481,8 +466,8 @@ func initRelayCabinetUid(data *graphicData.RelayCabinetGraphicStorage) *RelayUid
|
||||
if p != nil && (p.isStation || p.isPSD) {
|
||||
stationArr = nil
|
||||
}
|
||||
rus.RelayIds[r.Common.Id] = &elementIdStructure{
|
||||
CommonId: r.Common.Id,
|
||||
rus.RelayIds[eid] = &elementIdStructure{
|
||||
CommonId: eid,
|
||||
Code: r.Code,
|
||||
Uid: GenerateElementUid(city, lineId, stationArr, code),
|
||||
}
|
||||
@ -516,34 +501,38 @@ func initIBPUid(data *graphicData.IBPGraphicStorage) *IBPUidStructure {
|
||||
}
|
||||
// 处理按钮Uid
|
||||
for _, d := range data.IbpButtons {
|
||||
rus.IbpButtonIds[d.Common.Id] = &elementIdStructure{
|
||||
CommonId: d.Common.Id,
|
||||
eid := GetMapElementId(d.Common)
|
||||
rus.IbpButtonIds[eid] = &elementIdStructure{
|
||||
CommonId: eid,
|
||||
Code: d.Code,
|
||||
Uid: "button_" + codeFun(d.Common.Id, d.Code),
|
||||
Uid: "button_" + codeFun(eid, d.Code),
|
||||
}
|
||||
}
|
||||
// 处理钥匙Uid
|
||||
for _, d := range data.IbpKeys {
|
||||
rus.IbpKeyIds[d.Common.Id] = &elementIdStructure{
|
||||
CommonId: d.Common.Id,
|
||||
eid := GetMapElementId(d.Common)
|
||||
rus.IbpKeyIds[eid] = &elementIdStructure{
|
||||
CommonId: eid,
|
||||
Code: d.Code,
|
||||
Uid: "key_" + codeFun(d.Common.Id, d.Code),
|
||||
Uid: "key_" + codeFun(eid, d.Code),
|
||||
}
|
||||
}
|
||||
// 处理报警器Uid
|
||||
for _, d := range data.IbpAlarms {
|
||||
rus.IbpAlarmIds[d.Common.Id] = &elementIdStructure{
|
||||
CommonId: d.Common.Id,
|
||||
eid := GetMapElementId(d.Common)
|
||||
rus.IbpAlarmIds[eid] = &elementIdStructure{
|
||||
CommonId: eid,
|
||||
Code: d.Code,
|
||||
Uid: "alarm_" + codeFun(d.Common.Id, d.Code),
|
||||
Uid: "alarm_" + codeFun(eid, d.Code),
|
||||
}
|
||||
}
|
||||
// 处理指示灯Uid
|
||||
for _, d := range data.IbpLights {
|
||||
rus.IbpLightIds[d.Common.Id] = &elementIdStructure{
|
||||
CommonId: d.Common.Id,
|
||||
eid := GetMapElementId(d.Common)
|
||||
rus.IbpLightIds[eid] = &elementIdStructure{
|
||||
CommonId: eid,
|
||||
Code: d.Code,
|
||||
Uid: "light_" + codeFun(d.Common.Id, d.Code),
|
||||
Uid: "light_" + codeFun(eid, d.Code),
|
||||
}
|
||||
}
|
||||
return rus
|
||||
@ -552,7 +541,8 @@ func initIBPUid(data *graphicData.IBPGraphicStorage) *IBPUidStructure {
|
||||
// 构建仿真内所有地图UID映射信号布置图ID,这里为了解决多地图时根据UID反向寻找,避免多次循环地图,直接获取平面布置图元素
|
||||
func buildRepositoryAllUidsMap(mapIds []int32, repo *repository.Repository) map[string]*elementIdStructure {
|
||||
mapLen := len(repo.CheckPointList()) + len(repo.PhysicalSectionList()) + len(repo.SignalList()) +
|
||||
len(repo.TurnoutList()) + len(repo.ResponderList()) + len(repo.SlopeList()) + len(repo.SectionalCurvatureList())
|
||||
len(repo.TurnoutList()) + len(repo.ResponderList()) + len(repo.SlopeList()) +
|
||||
len(repo.SectionalCurvatureList())
|
||||
allUidMap := make(map[string]*elementIdStructure, mapLen)
|
||||
saveToAllUidMap := func(es map[string]*elementIdStructure) {
|
||||
for _, e := range es {
|
||||
|
@ -604,8 +604,9 @@ func buildAndRelateElectronicComponent(repo *proto.Repository, relayGi *graphicD
|
||||
stationUid := GenerateElementUid(city, lineId, nil, station)
|
||||
relayMap := make(map[string]*proto.Relay)
|
||||
for _, relay := range relayGi.Relays {
|
||||
rid := GetMapElementId(relay.Common)
|
||||
repoRelay := &proto.Relay{
|
||||
Id: relayUidStructure.RelayIds[relay.Common.Id].Uid,
|
||||
Id: relayUidStructure.RelayIds[rid].Uid,
|
||||
Code: relay.Code,
|
||||
Model: convertRelayModel(relay.NewModel),
|
||||
StationId: stationUid,
|
||||
@ -614,8 +615,9 @@ func buildAndRelateElectronicComponent(repo *proto.Repository, relayGi *graphicD
|
||||
relayMap[repoRelay.Id] = repoRelay
|
||||
}
|
||||
for _, pfp := range relayGi.PhaseFailureProtectors {
|
||||
pid := GetMapElementId(pfp.Common)
|
||||
repo.PhaseFailureProtectors = append(repo.PhaseFailureProtectors, &proto.PhaseFailureProtector{
|
||||
Id: relayUidStructure.RelayIds[pfp.Common.Id].Uid,
|
||||
Id: relayUidStructure.RelayIds[pid].Uid,
|
||||
Code: pfp.Code,
|
||||
})
|
||||
}
|
||||
@ -958,13 +960,14 @@ func fillProtoRepository(repo *proto.Repository, storage *graphicData.RtssGraphi
|
||||
axleCountingMap := make(map[string]*graphicData.AxleCounting)
|
||||
uidsMap := QueryUidStructure[*StationUidStructure](mapId)
|
||||
for _, data := range storage.AxleCountings {
|
||||
axleCountingMap[data.Common.Id] = data
|
||||
id := GetMapElementId(data.Common)
|
||||
axleCountingMap[id] = data
|
||||
cpType := proto.CheckPointType_AxleCounter
|
||||
if data.Type == graphicData.AxleCounting_SectionBoundary {
|
||||
cpType = proto.CheckPointType_Boundary
|
||||
}
|
||||
cp := &proto.CheckPoint{
|
||||
Id: data.Common.Id,
|
||||
Id: id,
|
||||
Km: convertKm(data.KilometerSystem),
|
||||
Type: cpType,
|
||||
DevicePorts: convertDevicePorts(data.AxleCountingRef),
|
||||
@ -986,7 +989,7 @@ func fillProtoRepository(repo *proto.Repository, storage *graphicData.RtssGraphi
|
||||
}
|
||||
}
|
||||
physicalSection := &proto.PhysicalSection{
|
||||
Id: data.Common.Id,
|
||||
Id: GetMapElementId(data.Common),
|
||||
ADevicePort: convertDevicePort(data.PaRef),
|
||||
BDevicePort: convertDevicePort(data.PbRef),
|
||||
TurnoutIds: turnoutIds,
|
||||
@ -1010,7 +1013,7 @@ func fillProtoRepository(repo *proto.Repository, storage *graphicData.RtssGraphi
|
||||
switchMachineType = proto.Turnout_ZDJ9_Double
|
||||
}
|
||||
turnout := &proto.Turnout{
|
||||
Id: data.Common.Id,
|
||||
Id: GetMapElementId(data.Common),
|
||||
Km: km,
|
||||
ADevicePort: convertDevicePort(data.PaRef),
|
||||
BDevicePort: convertDevicePort(data.PbRef),
|
||||
@ -1029,7 +1032,7 @@ func fillProtoRepository(repo *proto.Repository, storage *graphicData.RtssGraphi
|
||||
turnoutPort = convertDevicePort(data.RefDev)
|
||||
}
|
||||
signal := &proto.Signal{
|
||||
Id: data.Common.Id,
|
||||
Id: GetMapElementId(data.Common),
|
||||
Km: convertKm(data.KilometerSystem),
|
||||
SectionId: sectionId,
|
||||
TurnoutPort: turnoutPort,
|
||||
@ -1048,7 +1051,7 @@ func fillProtoRepository(repo *proto.Repository, storage *graphicData.RtssGraphi
|
||||
turnoutPort = convertDevicePort(data.TransponderRef)
|
||||
}
|
||||
responder := &proto.Transponder{
|
||||
Id: data.Common.Id,
|
||||
Id: GetMapElementId(data.Common),
|
||||
Km: convertKm(data.KilometerSystem),
|
||||
SectionId: sectionId,
|
||||
TurnoutPort: turnoutPort,
|
||||
@ -1073,11 +1076,11 @@ func fillProtoRepository(repo *proto.Repository, storage *graphicData.RtssGraphi
|
||||
}
|
||||
slopeKsMap := make(map[string]*graphicData.SlopeKiloMarker)
|
||||
for _, data := range storage.SlopeKiloMarker {
|
||||
slopeKsMap[data.Common.Id] = data
|
||||
slopeKsMap[GetMapElementId(data.Common)] = data
|
||||
}
|
||||
curveKsMap := make(map[string]*graphicData.CurvatureKiloMarker)
|
||||
for _, data := range storage.CurvatureKiloMarker {
|
||||
curveKsMap[data.Common.Id] = data
|
||||
curveKsMap[GetMapElementId(data.Common)] = data
|
||||
}
|
||||
for _, data := range storage.Slopes {
|
||||
var kms []*proto.Kilometer
|
||||
@ -1085,7 +1088,7 @@ func fillProtoRepository(repo *proto.Repository, storage *graphicData.RtssGraphi
|
||||
kms = append(kms, convertKm(slopeKsMap[id].KilometerSystem[0]))
|
||||
}
|
||||
slope := &proto.Slope{
|
||||
Id: data.Common.Id,
|
||||
Id: GetMapElementId(data.Common),
|
||||
Kms: kms,
|
||||
Degree: data.SlopeNumber,
|
||||
}
|
||||
@ -1097,7 +1100,7 @@ func fillProtoRepository(repo *proto.Repository, storage *graphicData.RtssGraphi
|
||||
kms = append(kms, convertKm(curveKsMap[id].KilometerSystem[0]))
|
||||
}
|
||||
slope := &proto.SectionalCurvature{
|
||||
Id: data.Common.Id,
|
||||
Id: GetMapElementId(data.Common),
|
||||
Kms: kms,
|
||||
Radius: data.CurvatureNumber,
|
||||
}
|
||||
@ -1113,7 +1116,7 @@ func fillProtoRepository(repo *proto.Repository, storage *graphicData.RtssGraphi
|
||||
// 初始化站场图按钮
|
||||
for _, data := range storage.EsbButtons {
|
||||
repo.Buttons = append(repo.Buttons, &proto.Button{
|
||||
Id: uidsMap.ButtonIds[data.Common.Id].Uid,
|
||||
Id: uidsMap.ButtonIds[GetMapElementId(data.Common)].Uid,
|
||||
Code: data.Code,
|
||||
ButtonType: proto.Button_Reset_Press,
|
||||
})
|
||||
@ -1126,7 +1129,7 @@ func fillProtoRepository(repo *proto.Repository, storage *graphicData.RtssGraphi
|
||||
// 处理车站信息
|
||||
for _, data := range storage.Stations {
|
||||
station := &proto.Station{
|
||||
Id: uidsMap.StationIds[data.Common.Id].Uid,
|
||||
Id: uidsMap.StationIds[GetMapElementId(data.Common)].Uid,
|
||||
Code: data.StationName,
|
||||
}
|
||||
// 关联车站的设备
|
||||
@ -1160,8 +1163,9 @@ func fillProtoRepository(repo *proto.Repository, storage *graphicData.RtssGraphi
|
||||
}
|
||||
//门控箱
|
||||
for _, data := range storage.GateBoxs {
|
||||
boxUidInfo := uidsMap.GateBoxIds[GetMapElementId(data.Common)]
|
||||
mkx := &proto.Mkx{
|
||||
Id: uidsMap.GateBoxIds[data.Common.Id].Uid,
|
||||
Id: boxUidInfo.Uid,
|
||||
PsdId: uidsMap.PsdIds[data.RefScreenDoor].Uid,
|
||||
}
|
||||
repo.Mkxs = append(repo.Mkxs, mkx)
|
||||
@ -1169,7 +1173,7 @@ func fillProtoRepository(repo *proto.Repository, storage *graphicData.RtssGraphi
|
||||
pslStorage := QueryGiData[*graphicData.PslGraphicStorage](pslMapId)
|
||||
for _, button := range pslStorage.PslButtons {
|
||||
repoButton := &proto.Button{
|
||||
Id: uidsMap.GateBoxIds[data.Common.Id].Uid + "_" + button.Code,
|
||||
Id: boxUidInfo.Uid + "_" + button.Code,
|
||||
Code: button.Code,
|
||||
ButtonType: proto.Button_Reset_Press,
|
||||
HasLight: true,
|
||||
@ -1188,9 +1192,10 @@ func fillProtoRepository(repo *proto.Repository, storage *graphicData.RtssGraphi
|
||||
//站台
|
||||
platformMap := make(map[string]*graphicData.Platform)
|
||||
for _, data := range storage.Platforms {
|
||||
platformMap[data.Common.Id] = data
|
||||
platformId := GetMapElementId(data.Common)
|
||||
platformMap[platformId] = data
|
||||
platform := &proto.Platform{
|
||||
Id: uidsMap.PlatformIds[data.Common.Id].Uid,
|
||||
Id: uidsMap.PlatformIds[platformId].Uid,
|
||||
Code: data.Code,
|
||||
}
|
||||
repo.Platforms = append(repo.Platforms, platform)
|
||||
@ -1208,7 +1213,7 @@ func fillProtoRepository(repo *proto.Repository, storage *graphicData.RtssGraphi
|
||||
})
|
||||
}
|
||||
psd := &proto.Psd{
|
||||
Id: uidsMap.PsdIds[data.Common.Id].Uid,
|
||||
Id: uidsMap.PsdIds[GetMapElementId(data.Common)].Uid,
|
||||
AsdAmount: storage.ScreenDoorConfig.SonDoorAmount,
|
||||
AsdGroups: asdGroups,
|
||||
PlatformId: uidsMap.PlatformIds[data.RefPlatformId].Uid,
|
||||
@ -1226,8 +1231,9 @@ func handlerIBPDeviceToStation(station *proto.Station, repo *proto.Repository, i
|
||||
uidMap := QueryUidStructure[*IBPUidStructure](mapId)
|
||||
deviceMap := make(map[string]*proto.ElectronicComponent) // 对应的设备类型
|
||||
for _, data := range storage.IbpButtons { // 处理按钮
|
||||
id := GetMapElementId(data.Common)
|
||||
b := &proto.Button{
|
||||
Id: station.Id + "_" + uidMap.IbpButtonIds[data.Common.Id].Uid,
|
||||
Id: station.Id + "_" + uidMap.IbpButtonIds[id].Uid,
|
||||
Code: data.Code,
|
||||
ButtonType: proto.Button_NO_Reset_Press,
|
||||
HasLight: data.HasLight,
|
||||
@ -1235,41 +1241,44 @@ func handlerIBPDeviceToStation(station *proto.Station, repo *proto.Repository, i
|
||||
if data.IsSelfReset {
|
||||
b.ButtonType = proto.Button_Reset_Press
|
||||
}
|
||||
deviceMap[data.Common.Id] = &proto.ElectronicComponent{
|
||||
deviceMap[id] = &proto.ElectronicComponent{
|
||||
Id: b.Id,
|
||||
DeviceType: proto.DeviceType_DeviceType_Button,
|
||||
}
|
||||
repo.Buttons = append(repo.Buttons, b)
|
||||
}
|
||||
for _, data := range storage.IbpKeys { // 钥匙
|
||||
id := GetMapElementId(data.Common)
|
||||
b := &proto.Key{
|
||||
Id: station.Id + "_" + uidMap.IbpKeyIds[data.Common.Id].Uid,
|
||||
Id: station.Id + "_" + uidMap.IbpKeyIds[id].Uid,
|
||||
Code: data.Code,
|
||||
Gear: 2,
|
||||
}
|
||||
deviceMap[data.Common.Id] = &proto.ElectronicComponent{
|
||||
deviceMap[id] = &proto.ElectronicComponent{
|
||||
Id: b.Id,
|
||||
DeviceType: proto.DeviceType_DeviceType_Key,
|
||||
}
|
||||
repo.Keys = append(repo.Keys, b)
|
||||
}
|
||||
for _, data := range storage.IbpAlarms { // 报警器
|
||||
id := GetMapElementId(data.Common)
|
||||
b := &proto.Alarm{
|
||||
Id: station.Id + "_" + uidMap.IbpAlarmIds[data.Common.Id].Uid,
|
||||
Id: station.Id + "_" + uidMap.IbpAlarmIds[id].Uid,
|
||||
Code: data.Code,
|
||||
}
|
||||
deviceMap[data.Common.Id] = &proto.ElectronicComponent{
|
||||
deviceMap[id] = &proto.ElectronicComponent{
|
||||
Id: b.Id,
|
||||
DeviceType: proto.DeviceType_DeviceType_Alarm,
|
||||
}
|
||||
repo.Alarms = append(repo.Alarms, b)
|
||||
}
|
||||
for _, data := range storage.IbpLights { // 指示灯,
|
||||
id := GetMapElementId(data.Common)
|
||||
b := &proto.Light{
|
||||
Id: station.Id + "_" + uidMap.IbpLightIds[data.Common.Id].Uid,
|
||||
Id: station.Id + "_" + uidMap.IbpLightIds[id].Uid,
|
||||
Code: data.Code,
|
||||
}
|
||||
deviceMap[data.Common.Id] = &proto.ElectronicComponent{
|
||||
deviceMap[id] = &proto.ElectronicComponent{
|
||||
Id: b.Id,
|
||||
DeviceType: proto.DeviceType_DeviceType_Light,
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user