修改模型数据构建bug;屏蔽门所有继电器都会构建为实体

This commit is contained in:
joylink_zhangsai 2023-11-07 14:30:08 +08:00
parent 1e2b0bd729
commit efa53c2354
3 changed files with 20 additions and 20 deletions

@ -1 +1 @@
Subproject commit dfe96a977ccb283510934a15dfa0f3303620c278
Subproject commit a6dfa6fffb7ecfe6630280a838092d208c0e3c1a

View File

@ -186,20 +186,20 @@ func initStationUid(data *graphicData.RtssGraphicStorage) *StationUidStructure {
if station == nil { //线路数据有问题
continue
}
psd_station_map[door.Common.Id] = station.Common.Id
psd_station_map[door.Common.Id] = station.StationName
gus.PsdIds[door.Common.Id] = &elementIdStructure{
CommonId: door.Common.Id,
Code: door.Code,
Uid: GenerateElementUid(city, lineId, []string{station.Common.Id}, door.Code),
Uid: GenerateElementUid(city, lineId, []string{station.StationName}, door.Code),
}
}
// 门控箱
for _, box := range data.GateBoxs {
stationId := psd_station_map[box.RefScreenDoor]
stationName := psd_station_map[box.RefScreenDoor]
gus.GateBoxIds[box.Common.Id] = &elementIdStructure{
CommonId: box.Common.Id,
Code: box.Code,
Uid: GenerateElementUid(city, lineId, []string{stationId}, box.Code),
Uid: GenerateElementUid(city, lineId, []string{stationName}, box.Code),
}
}
// SPKS人员防护

View File

@ -495,7 +495,7 @@ func buildProtoRepository(mapIds []int32) (*proto.Repository, error) {
}
func buildAndRelateElectronicComponent(repo *proto.Repository, relayGi *graphicData.RelayCabinetGraphicStorage, mapId int32) {
uidsMap := QueryUidStructure[*RelayUidStructure](mapId)
relayUidStructure := QueryUidStructure[*RelayUidStructure](mapId)
city := relayGi.UniqueIdPrefix.City
lineId := relayGi.UniqueIdPrefix.LineId
station := relayGi.UniqueIdPrefix.BelongsConcentrationStation
@ -503,7 +503,7 @@ func buildAndRelateElectronicComponent(repo *proto.Repository, relayGi *graphicD
relayMap := make(map[string]*proto.Relay)
for _, relay := range relayGi.Relays {
repoRelay := &proto.Relay{
Id: uidsMap.RelayIds[relay.Common.Id].Uid,
Id: relayUidStructure.RelayIds[relay.Common.Id].Uid,
Code: relay.Code,
Model: convertRelayModel(relay.NewModel),
StationId: stationUid,
@ -513,7 +513,7 @@ func buildAndRelateElectronicComponent(repo *proto.Repository, relayGi *graphicD
}
for _, pfp := range relayGi.PhaseFailureProtectors {
repo.PhaseFailureProtectors = append(repo.PhaseFailureProtectors, &proto.PhaseFailureProtector{
Id: uidsMap.RelayIds[pfp.Common.Id].Uid,
Id: relayUidStructure.RelayIds[pfp.Common.Id].Uid,
Code: pfp.Code,
})
}
@ -547,10 +547,10 @@ func buildAndRelateElectronicComponent(repo *proto.Repository, relayGi *graphicD
for _, group := range relationship.Combinationtypes {
var componentIds []string
for _, relayId := range group.RefRelays {
if uidsMap.RelayIds[relayId] == nil {
if relayUidStructure.RelayIds[relayId] == nil {
continue
}
componentIds = append(componentIds, uidsMap.RelayIds[relayId].Uid)
componentIds = append(componentIds, relayUidStructure.RelayIds[relayId].Uid)
}
turnout.ElectronicComponentGroups = append(turnout.ElectronicComponentGroups,
&proto.ElectronicComponentGroup{
@ -570,10 +570,10 @@ func buildAndRelateElectronicComponent(repo *proto.Repository, relayGi *graphicD
group := relationship.Combinationtypes[0]
var componentIds []string
for _, relayId := range group.RefRelays {
if uidsMap.RelayIds[relayId] == nil {
if relayUidStructure.RelayIds[relayId] == nil {
continue
}
componentIds = append(componentIds, uidsMap.RelayIds[relayId].Uid)
componentIds = append(componentIds, relayUidStructure.RelayIds[relayId].Uid)
}
signal.Code = group.Code
signal.ElectronicComponentGroups = append(signal.ElectronicComponentGroups,
@ -589,11 +589,11 @@ func buildAndRelateElectronicComponent(repo *proto.Repository, relayGi *graphicD
for _, group := range relationship.Combinationtypes {
d := &proto.ElectronicGroup{Code: group.Code}
for _, relayId := range group.RefRelays {
if uidsMap.RelayIds[relayId] == nil {
if relayUidStructure.RelayIds[relayId] == nil {
continue
}
d.Components = append(d.Components, &proto.ElectronicComponent{
Id: uidsMap.RelayIds[relayId].Uid,
Id: relayUidStructure.RelayIds[relayId].Uid,
DeviceType: proto.DeviceType_DeviceType_Relay,
})
}
@ -607,10 +607,10 @@ func buildAndRelateElectronicComponent(repo *proto.Repository, relayGi *graphicD
for _, group := range relationship.Combinationtypes {
var componentIds []string
for _, relayId := range group.RefRelays {
if uidsMap.RelayIds[relayId] == nil {
if relayUidStructure.RelayIds[relayId] == nil {
continue
}
componentIds = append(componentIds, uidsMap.RelayIds[relayId].Uid)
componentIds = append(componentIds, relayUidStructure.RelayIds[relayId].Uid)
}
psd.ElectronicComponentGroups = append(psd.ElectronicComponentGroups,
&proto.ElectronicComponentGroup{
@ -655,11 +655,11 @@ func buildAndRelateElectronicComponent(repo *proto.Repository, relayGi *graphicD
if com.Code == "LS" { // 零散组合
d := &proto.ElectronicGroup{Code: com.Code}
for _, relayId := range com.RefRelays {
if uidsMap.RelayIds[relayId] == nil {
if relayUidStructure.RelayIds[relayId] == nil {
continue
}
d.Components = append(d.Components, &proto.ElectronicComponent{
Id: uidsMap.RelayIds[relayId].Uid,
Id: relayUidStructure.RelayIds[relayId].Uid,
DeviceType: proto.DeviceType_DeviceType_Relay,
})
}
@ -670,9 +670,9 @@ func buildAndRelateElectronicComponent(repo *proto.Repository, relayGi *graphicD
// 处理该集中站采集、驱动配置信息
centralizedStationId := GenerateElementUid(city, lineId, nil, station)
ref := queryCentralizedStationRef(centralizedStationId, repo)
ref.CjList = append(ref.CjList, handlerRelayGiCj(uidsMap, centralizedStationId, relayGi.CiCjList)...)
ref.CjList = append(ref.CjList, handlerRelayGiCj(relayUidStructure, centralizedStationId, relayGi.CiCjList)...)
sortQcTable(ref.CjList)
ref.QdList = append(ref.QdList, handlerRelayGiQd(uidsMap, centralizedStationId, relayGi.CiQdList)...)
ref.QdList = append(ref.QdList, handlerRelayGiQd(relayUidStructure, centralizedStationId, relayGi.CiQdList)...)
sortQcTable(ref.QdList)
}