【增加日志打印】

This commit is contained in:
weizhihong 2023-12-07 16:15:29 +08:00
parent 83f49b80c9
commit feace07dea
1 changed files with 11 additions and 9 deletions

View File

@ -2,6 +2,7 @@ package memory
import (
"fmt"
"log/slog"
"strings"
"sync"
@ -91,13 +92,16 @@ func filterOtherLineDevice(data *graphicData.RtssGraphicStorage) {
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)
continue
}
if d.PaRef != nil && otherDeviceIdMap[d.PaRef.Id] {
d.PaRef = nil
slog.Warn("区段[id:%s][code:%s]设备A端是其他线路设备已置空", d.Common.Id, 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)
}
var acs []string
for _, id := range d.AxleCountings {
@ -106,9 +110,6 @@ func filterOtherLineDevice(data *graphicData.RtssGraphicStorage) {
}
acs = append(acs, id)
}
if len(d.AxleCountings) > 1 && len(acs) == 0 {
continue
}
d.AxleCountings = acs
if otherDeviceIdMap[d.TrackSectionId] {
d.TrackSectionId = ""
@ -120,6 +121,7 @@ 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)
continue
}
var refs []*graphicData.RelatedRef
@ -137,16 +139,20 @@ 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)
continue
}
if d.PaRef != nil && otherDeviceIdMap[d.PaRef.Id] {
d.PaRef = nil
slog.Warn("道岔[id:%s][code:%s]设备A端是其他线路设备已置空", d.Common.Id, 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)
}
if d.PcRef != nil && otherDeviceIdMap[d.PcRef.Id] {
d.PcRef = nil
slog.Warn("道岔[id:%s][code:%s]设备C端是其他线路设备已置空", d.Common.Id, d.Code)
}
if d.PaTrackSectionId != "" && otherDeviceIdMap[d.PaTrackSectionId] {
d.PaTrackSectionId = ""
@ -164,9 +170,7 @@ func filterOtherLineDevice(data *graphicData.RtssGraphicStorage) {
var signals []*graphicData.Signal
for _, d := range data.Signals {
if otherDeviceIdMap[d.Common.Id] {
continue
}
if d.RefDev != nil && otherDeviceIdMap[d.RefDev.Id] {
slog.Warn("信号机[id:%s][code:%s]设备其他线路设备已过滤", d.Common.Id, d.Code)
continue
}
signals = append(signals, d)
@ -176,9 +180,7 @@ func filterOtherLineDevice(data *graphicData.RtssGraphicStorage) {
var transponders []*graphicData.Transponder
for _, d := range data.Transponders {
if otherDeviceIdMap[d.Common.Id] {
continue
}
if d.TransponderRef != nil && otherDeviceIdMap[d.TransponderRef.Id] {
slog.Warn("应答器[id:%s][code:%s]设备其他线路设备已过滤", d.Common.Id, d.Code)
continue
}
transponders = append(transponders, d)