增加断相保护器模型及相关构建逻辑
This commit is contained in:
parent
e8a3f635b9
commit
88ea4862b4
@ -176,18 +176,18 @@ func buildProtoRepository(mapIds []int32) (*proto.Repository, error) {
|
||||
exceptStationGiMapIds = append(exceptStationGiMapIds, mapId)
|
||||
}
|
||||
}
|
||||
//将继电器与设备关联
|
||||
//构建并关联电子元件
|
||||
for _, mapId := range exceptStationGiMapIds {
|
||||
giType := QueryGiType(mapId)
|
||||
if giType == graphicData.PictureType_RelayCabinetLayout {
|
||||
relayGi := QueryGiData[*graphicData.RelayCabinetGraphicStorage](mapId)
|
||||
relateRelay(repo, relayGi, mapId)
|
||||
buildAndRelateElectronicComponent(repo, relayGi, mapId)
|
||||
}
|
||||
}
|
||||
return repo, nil
|
||||
}
|
||||
|
||||
func relateRelay(repo *proto.Repository, relayGi *graphicData.RelayCabinetGraphicStorage, mapId int32) {
|
||||
func buildAndRelateElectronicComponent(repo *proto.Repository, relayGi *graphicData.RelayCabinetGraphicStorage, mapId int32) {
|
||||
uidsMap := queryUidStructure[*relayUidStructure](mapId)
|
||||
city := relayGi.UniqueIdPrefix.City
|
||||
lineId := relayGi.UniqueIdPrefix.LineId
|
||||
@ -196,7 +196,13 @@ func relateRelay(repo *proto.Repository, relayGi *graphicData.RelayCabinetGraphi
|
||||
repo.Relays = append(repo.Relays, &proto.Relay{
|
||||
Id: uidsMap.RelayIds[relay.Common.Id].Uid,
|
||||
Code: relay.Code,
|
||||
Model: relay.NewModel.String(),
|
||||
Model: convertRelayModel(relay.NewModel),
|
||||
})
|
||||
}
|
||||
for _, pfp := range relayGi.PhaseFailureProtectors {
|
||||
repo.PhaseFailureProtectors = append(repo.PhaseFailureProtectors, &proto.PhaseFailureProtector{
|
||||
Id: uidsMap.RelayIds[pfp.Common.Id].Uid,
|
||||
Code: pfp.Code,
|
||||
})
|
||||
}
|
||||
turnoutMap := make(map[string]*proto.Turnout)
|
||||
@ -215,17 +221,18 @@ func relateRelay(repo *proto.Repository, relayGi *graphicData.RelayCabinetGraphi
|
||||
continue
|
||||
}
|
||||
for _, group := range relationship.Combinationtypes {
|
||||
var relayUIds []string
|
||||
var componentIds []string
|
||||
for _, relayId := range group.RefRelays {
|
||||
if uidsMap.RelayIds[relayId] == nil {
|
||||
continue
|
||||
}
|
||||
relayUIds = append(relayUIds, uidsMap.RelayIds[relayId].Uid)
|
||||
componentIds = append(componentIds, uidsMap.RelayIds[relayId].Uid)
|
||||
}
|
||||
turnout.RelayGroups = append(turnout.RelayGroups, &proto.RelayGroup{
|
||||
Code: group.Code,
|
||||
RelayIds: relayUIds,
|
||||
})
|
||||
turnout.ElectronicComponentGroups = append(turnout.ElectronicComponentGroups,
|
||||
&proto.ElectronicComponentGroup{
|
||||
Code: group.Code,
|
||||
ComponentIds: componentIds,
|
||||
})
|
||||
}
|
||||
case graphicData.RelatedRef_signal:
|
||||
signal := signalMap[GenerateElementUid(city, lineId, []string{station}, relationship.Code)]
|
||||
@ -233,22 +240,48 @@ func relateRelay(repo *proto.Repository, relayGi *graphicData.RelayCabinetGraphi
|
||||
continue
|
||||
}
|
||||
for _, group := range relationship.Combinationtypes {
|
||||
var relayUIds []string
|
||||
var componentIds []string
|
||||
for _, relayId := range group.RefRelays {
|
||||
if uidsMap.RelayIds[relayId] == nil {
|
||||
continue
|
||||
}
|
||||
relayUIds = append(relayUIds, uidsMap.RelayIds[relayId].Uid)
|
||||
componentIds = append(componentIds, uidsMap.RelayIds[relayId].Uid)
|
||||
}
|
||||
signal.RelayGroups = append(signal.RelayGroups, &proto.RelayGroup{
|
||||
Code: group.Code,
|
||||
RelayIds: relayUIds,
|
||||
})
|
||||
signal.ElectronicComponentGroups = append(signal.ElectronicComponentGroups,
|
||||
&proto.ElectronicComponentGroup{
|
||||
Code: group.Code,
|
||||
ComponentIds: componentIds,
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func convertRelayModel(modelType graphicData.Relay_ModelType) proto.Relay_Model {
|
||||
switch modelType {
|
||||
case graphicData.Relay_Unknown:
|
||||
return proto.Relay_Unknown
|
||||
case graphicData.Relay_JPXC_1000:
|
||||
return proto.Relay_JPXC_1000
|
||||
case graphicData.Relay_JPXC_1700:
|
||||
return proto.Relay_JPXC_1700
|
||||
case graphicData.Relay_JWJXC_480:
|
||||
return proto.Relay_JWJXC_480
|
||||
case graphicData.Relay_JWJXC_H125_80:
|
||||
return proto.Relay_JWJXC_H125_80
|
||||
case graphicData.Relay_JWXC_1700:
|
||||
return proto.Relay_JWXC_1700
|
||||
case graphicData.Relay_JWXC_H340:
|
||||
return proto.Relay_JWXC_H340
|
||||
case graphicData.Relay_JYJXC_160_260:
|
||||
return proto.Relay_JYJXC_160_260
|
||||
case graphicData.Relay_JZXC_H18:
|
||||
return proto.Relay_JZXC_H18
|
||||
default:
|
||||
panic(fmt.Sprintf("意料之外的继电器型号:%s", modelType))
|
||||
}
|
||||
}
|
||||
|
||||
func fillProtoRepository(repo *proto.Repository, storage *graphicData.RtssGraphicStorage, mapId int32) {
|
||||
axleCountingMap := make(map[string]*graphicData.AxleCounting)
|
||||
uidsMap := queryUidStructure[*stationUidStructure](mapId)
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit d743f0be7c203172884bc07fa76e0c61e550386e
|
||||
Subproject commit d36ba6fc7dfe5235ace72be522566e55aadd34e1
|
Loading…
Reference in New Issue
Block a user