【去除警告变量,重新生成草稿model】

This commit is contained in:
weizhihong 2023-08-25 15:35:00 +08:00
parent f2409f5b1f
commit 5610230d08
9 changed files with 21 additions and 43 deletions

View File

@ -42,7 +42,7 @@ func init() {
vobc.RegisterTrainInfoHandler(func(info []byte) { vobc.RegisterTrainInfoHandler(func(info []byte) {
zap.S().Debug("接到列车信息", info) zap.S().Debug("接到列车信息", info)
for _, simulation := range GetSimulationArr() { for _, simulation := range GetSimulationArr() {
simulation.Memory.Status.TrainStateMap.Range(func(key, value any) bool { simulation.Memory.Status.TrainStateMap.Range(func(_, value any) bool {
train := value.(*state.TrainState) train := value.(*state.TrainState)
if train.Show { // 上线列车 if train.Show { // 上线列车
// 拼接列车ID // 拼接列车ID
@ -119,7 +119,7 @@ func createSimulationId(mapId int32) string {
// 获取仿真列表 // 获取仿真列表
func ListAllSimulations() []*dto.SimulationInfoRepDto { func ListAllSimulations() []*dto.SimulationInfoRepDto {
simArr := []*dto.SimulationInfoRepDto{} simArr := []*dto.SimulationInfoRepDto{}
simulationMap.Range(func(k, v any) bool { simulationMap.Range(func(_, v any) bool {
s := v.(*memory.VerifySimulation) s := v.(*memory.VerifySimulation)
simArr = append(simArr, &dto.SimulationInfoRepDto{ simArr = append(simArr, &dto.SimulationInfoRepDto{
SimulationId: s.SimulationId, SimulationId: s.SimulationId,
@ -142,7 +142,7 @@ func FindSimulation(simulationId string) *memory.VerifySimulation {
// 获取普通仿真数组 // 获取普通仿真数组
func GetSimulationArr() []*memory.VerifySimulation { func GetSimulationArr() []*memory.VerifySimulation {
result := []*memory.VerifySimulation{} result := []*memory.VerifySimulation{}
simulationMap.Range(func(k, v any) bool { simulationMap.Range(func(_, v any) bool {
result = append(result, v.(*memory.VerifySimulation)) result = append(result, v.(*memory.VerifySimulation))
return true return true
}) })
@ -234,28 +234,6 @@ func buildLineBaseInfo(vs *memory.VerifyStructure) *dynamics.LineBaseInfo {
BRelTurnoutPoint: link.BRelatedSwitchRef.Port.Name(), BRelTurnoutPoint: link.BRelatedSwitchRef.Port.Name(),
}) })
} }
//for _, slope := range vs.SlopeModelMap {
// id, _ := strconv.Atoi(slope.Index)
// slopes = append(slopes, &dynamics.Slope{
// ID: int32(id),
// StartLinkId: slope.StartLinkIndex,
// StartLinkOffset: slope.StartLinkOffset,
// EndLinkId: slope.EndLinkIndex,
// EndLinkOffset: slope.EndLinkOffset,
// DegreeTrig: slope.DegreeTrig,
// })
//}
//for _, curve := range vs.CurveModelMap {
// id, _ := strconv.Atoi(curve.Index)
// curves = append(curves, &dynamics.Curve{
// ID: int32(id),
// StartLinkId: curve.StartLinkIndex,
// StartLinkOffset: curve.StartLinkOffset,
// EndLinkId: curve.EndLinkIndex,
// EndLinkOffset: curve.EndLinkOffset,
// Curvature: curve.Curvature,
// })
//}
return &dynamics.LineBaseInfo{ return &dynamics.LineBaseInfo{
LinkList: links, LinkList: links,
SlopeList: slopes, SlopeList: slopes,

View File

@ -137,10 +137,10 @@ func calcGraphicLenByTurnout(turnout *buildCalcTurnoutStruct, p graphicData.Rela
func getGraphicSectionRefDevices(refVal *graphicData.RelatedRef, deviceMap map[string]*graphicData.CalculateLink_DevicePosition, func getGraphicSectionRefDevices(refVal *graphicData.RelatedRef, deviceMap map[string]*graphicData.CalculateLink_DevicePosition,
section *buildCalcSectionStruct, offset int32, prevKm int64) (int32, int64) { section *buildCalcSectionStruct, offset int32, prevKm int64) (int32, int64) {
dealFunc := func(p *graphicData.AxleCounting, d map[string]*graphicData.CalculateLink_DevicePosition, o int32, pk int64) (int32, int64) { dealFunc := func(p *graphicData.AxleCounting, d map[string]*graphicData.CalculateLink_DevicePosition, o int32, pk int64) (int32, int64) {
if p != nil && deviceMap[p.Common.Id] == nil { if p != nil && d[p.Common.Id] == nil {
resultOff := o + int32(math.Abs(float64(p.KilometerSystem.Kilometer-pk))) resultOff := o + int32(math.Abs(float64(p.KilometerSystem.Kilometer-pk)))
resultPK := p.KilometerSystem.Kilometer resultPK := p.KilometerSystem.Kilometer
deviceMap[p.Common.Id] = &graphicData.CalculateLink_DevicePosition{ d[p.Common.Id] = &graphicData.CalculateLink_DevicePosition{
DeviceId: p.Common.Id, DeviceId: p.Common.Id,
Offset: resultOff, Offset: resultOff,
DeviceType: graphicData.RelatedRef_AxleCounting.String(), DeviceType: graphicData.RelatedRef_AxleCounting.String(),

View File

@ -363,7 +363,7 @@ func initGraphicStructure(graphicData *graphicData.RtssGraphicStorage, verifyStr
// 初始化信号机信息 // 初始化信号机信息
initGraphicSignal(graphicData.Signals, verifyStructure, graphicDataMap) initGraphicSignal(graphicData.Signals, verifyStructure, graphicDataMap)
// 初始化坡度和曲线端点 // 初始化坡度和曲线端点
initPoints(graphicData, verifyStructure, graphicDataMap) initPoints(graphicData, verifyStructure)
// 初始化Link信息 // 初始化Link信息
initLinks(graphicData.CalculateLink, verifyStructure, graphicDataMap) initLinks(graphicData.CalculateLink, verifyStructure, graphicDataMap)
// 初始化坡度 // 初始化坡度
@ -422,7 +422,7 @@ func initSlopes(slopes []*graphicData.Slope, vs *VerifyStructure, dataMap *Graph
} }
} }
func initPoints(storage *graphicData.RtssGraphicStorage, vs *VerifyStructure, dataMap *GraphicInfoMapStructure) { func initPoints(storage *graphicData.RtssGraphicStorage, vs *VerifyStructure) {
for _, slopeKm := range storage.SlopeKiloMarker { for _, slopeKm := range storage.SlopeKiloMarker {
vs.PointMap[slopeKm.Common.Id] = &device.PointModel{ vs.PointMap[slopeKm.Common.Id] = &device.PointModel{
DeviceModel: face.DeviceModel{ DeviceModel: face.DeviceModel{

View File

@ -3,7 +3,7 @@ package memory
import ( import (
"fmt" "fmt"
"github.com/golang/protobuf/proto" "google.golang.org/protobuf/proto"
"joylink.club/bj-rtsts-server/ats/verify/protos/state" "joylink.club/bj-rtsts-server/ats/verify/protos/state"
) )
@ -26,7 +26,7 @@ func ChangeAxleSectionState(simulation *VerifySimulation, status *state.SectionS
func GetAllAxleSectionState(simulation *VerifySimulation) []*state.SectionState { func GetAllAxleSectionState(simulation *VerifySimulation) []*state.SectionState {
allSectionMap := &simulation.Memory.Status.AxleSectionStateMap allSectionMap := &simulation.Memory.Status.AxleSectionStateMap
var sectionArr []*state.SectionState var sectionArr []*state.SectionState
allSectionMap.Range(func(k, v any) bool { allSectionMap.Range(func(_, v any) bool {
sectionArr = append(sectionArr, v.(*state.SectionState)) sectionArr = append(sectionArr, v.(*state.SectionState))
return true return true
}) })

View File

@ -3,7 +3,7 @@ package memory
import ( import (
"fmt" "fmt"
"github.com/golang/protobuf/proto" "google.golang.org/protobuf/proto"
"joylink.club/bj-rtsts-server/ats/verify/protos/state" "joylink.club/bj-rtsts-server/ats/verify/protos/state"
) )
@ -26,7 +26,7 @@ func ChangePhysicalSectionState(simulation *VerifySimulation, status *state.Sect
func GetAllPhysicalSectionState(simulation *VerifySimulation) []*state.SectionState { func GetAllPhysicalSectionState(simulation *VerifySimulation) []*state.SectionState {
allSectionMap := &simulation.Memory.Status.PhysicalSectionStateMap allSectionMap := &simulation.Memory.Status.PhysicalSectionStateMap
var sectionArr []*state.SectionState var sectionArr []*state.SectionState
allSectionMap.Range(func(k, v any) bool { allSectionMap.Range(func(_, v any) bool {
sectionArr = append(sectionArr, v.(*state.SectionState)) sectionArr = append(sectionArr, v.(*state.SectionState))
return true return true
}) })

View File

@ -12,7 +12,7 @@ import (
"joylink.club/bj-rtsts-server/dto" "joylink.club/bj-rtsts-server/dto"
"joylink.club/bj-rtsts-server/dynamics" "joylink.club/bj-rtsts-server/dynamics"
"github.com/golang/protobuf/proto" "google.golang.org/protobuf/proto"
"joylink.club/bj-rtsts-server/ats/verify/protos/state" "joylink.club/bj-rtsts-server/ats/verify/protos/state"
) )
@ -99,7 +99,7 @@ func RemoveTrainState(simulation *VerifySimulation, id string) {
func GetAllTrainState(simulation *VerifySimulation) []*state.TrainState { func GetAllTrainState(simulation *VerifySimulation) []*state.TrainState {
allTrainMap := &simulation.Memory.Status.TrainStateMap allTrainMap := &simulation.Memory.Status.TrainStateMap
var trainArr []*state.TrainState var trainArr []*state.TrainState
allTrainMap.Range(func(k, v any) bool { allTrainMap.Range(func(_, v any) bool {
trainArr = append(trainArr, v.(*state.TrainState)) trainArr = append(trainArr, v.(*state.TrainState))
return true return true
}) })
@ -110,7 +110,7 @@ func GetAllTrainState(simulation *VerifySimulation) []*state.TrainState {
func GetUpdatedTrainState(simulation *VerifySimulation) []*state.TrainState { func GetUpdatedTrainState(simulation *VerifySimulation) []*state.TrainState {
changeTrainMap := &simulation.Memory.ChangeStatus.TrainStateMap changeTrainMap := &simulation.Memory.ChangeStatus.TrainStateMap
var trainArr []*state.TrainState var trainArr []*state.TrainState
changeTrainMap.Range(func(k, v any) bool { changeTrainMap.Range(func(_, v any) bool {
d := v.(*state.TrainState) d := v.(*state.TrainState)
trainArr = append(trainArr, d) trainArr = append(trainArr, d)
return true return true

View File

@ -4,7 +4,7 @@ import (
"fmt" "fmt"
"sync" "sync"
"github.com/golang/protobuf/proto" "google.golang.org/protobuf/proto"
"joylink.club/bj-rtsts-server/ats/verify/protos/state" "joylink.club/bj-rtsts-server/ats/verify/protos/state"
) )
@ -29,7 +29,7 @@ func ChangeTurnoutState(simulation *VerifySimulation, status *state.SwitchState)
func GetAllTurnoutState(simulation *VerifySimulation) []*state.SwitchState { func GetAllTurnoutState(simulation *VerifySimulation) []*state.SwitchState {
allSwitchMap := &simulation.Memory.Status.SwitchStateMap allSwitchMap := &simulation.Memory.Status.SwitchStateMap
var switchArr []*state.SwitchState var switchArr []*state.SwitchState
allSwitchMap.Range(func(k, v any) bool { allSwitchMap.Range(func(_, v any) bool {
switchArr = append(switchArr, v.(*state.SwitchState)) switchArr = append(switchArr, v.(*state.SwitchState))
return true return true
}) })
@ -40,7 +40,7 @@ func GetAllTurnoutState(simulation *VerifySimulation) []*state.SwitchState {
func GetChangeTurnoutState(simulation *VerifySimulation) []*state.SwitchState { func GetChangeTurnoutState(simulation *VerifySimulation) []*state.SwitchState {
changeSwitchMap := &simulation.Memory.ChangeStatus.SwitchStateMap changeSwitchMap := &simulation.Memory.ChangeStatus.SwitchStateMap
var switchArr []*state.SwitchState var switchArr []*state.SwitchState
changeSwitchMap.Range(func(k, v any) bool { changeSwitchMap.Range(func(_, v any) bool {
d := v.(*state.SwitchState) d := v.(*state.SwitchState)
switchArr = append(switchArr, &state.SwitchState{ switchArr = append(switchArr, &state.SwitchState{
Id: d.Id, Id: d.Id,

View File

@ -30,7 +30,7 @@ func newDrafting(db *gorm.DB, opts ...gen.DOOption) drafting {
_drafting.ID = field.NewInt32(tableName, "id") _drafting.ID = field.NewInt32(tableName, "id")
_drafting.Name = field.NewString(tableName, "name") _drafting.Name = field.NewString(tableName, "name")
_drafting.Category = field.NewString(tableName, "category") _drafting.Category = field.NewString(tableName, "category")
_drafting.Type = field.NewString(tableName, "type") _drafting.Type = field.NewInt32(tableName, "type")
_drafting.Proto = field.NewBytes(tableName, "proto") _drafting.Proto = field.NewBytes(tableName, "proto")
_drafting.CreatorID = field.NewInt32(tableName, "creator_id") _drafting.CreatorID = field.NewInt32(tableName, "creator_id")
_drafting.CreatedAt = field.NewTime(tableName, "created_at") _drafting.CreatedAt = field.NewTime(tableName, "created_at")
@ -48,7 +48,7 @@ type drafting struct {
ID field.Int32 // id ID field.Int32 // id
Name field.String // 草稿图名称 Name field.String // 草稿图名称
Category field.String // 厂家编码 Category field.String // 厂家编码
Type field.String // 数据类型 Type field.Int32 // 数据类型
Proto field.Bytes // 绘图数据 Proto field.Bytes // 绘图数据
CreatorID field.Int32 // 创建人id CreatorID field.Int32 // 创建人id
CreatedAt field.Time // 创建时间 CreatedAt field.Time // 创建时间
@ -72,7 +72,7 @@ func (d *drafting) updateTableName(table string) *drafting {
d.ID = field.NewInt32(table, "id") d.ID = field.NewInt32(table, "id")
d.Name = field.NewString(table, "name") d.Name = field.NewString(table, "name")
d.Category = field.NewString(table, "category") d.Category = field.NewString(table, "category")
d.Type = field.NewString(table, "type") d.Type = field.NewInt32(table, "type")
d.Proto = field.NewBytes(table, "proto") d.Proto = field.NewBytes(table, "proto")
d.CreatorID = field.NewInt32(table, "creator_id") d.CreatorID = field.NewInt32(table, "creator_id")
d.CreatedAt = field.NewTime(table, "created_at") d.CreatedAt = field.NewTime(table, "created_at")

View File

@ -15,7 +15,7 @@ type Drafting struct {
ID int32 `gorm:"column:id;primaryKey;autoIncrement:true;comment:id" json:"id"` // id ID int32 `gorm:"column:id;primaryKey;autoIncrement:true;comment:id" json:"id"` // id
Name string `gorm:"column:name;not null;comment:草稿图名称" json:"name"` // 草稿图名称 Name string `gorm:"column:name;not null;comment:草稿图名称" json:"name"` // 草稿图名称
Category string `gorm:"column:category;comment:厂家编码" json:"category"` // 厂家编码 Category string `gorm:"column:category;comment:厂家编码" json:"category"` // 厂家编码
Type string `gorm:"column:type;comment:数据类型" json:"type"` // 数据类型 Type int32 `gorm:"column:type;comment:数据类型" json:"type"` // 数据类型
Proto []byte `gorm:"column:proto;comment:绘图数据" json:"proto"` // 绘图数据 Proto []byte `gorm:"column:proto;comment:绘图数据" json:"proto"` // 绘图数据
CreatorID int32 `gorm:"column:creator_id;not null;comment:创建人id" json:"creator_id"` // 创建人id CreatorID int32 `gorm:"column:creator_id;not null;comment:创建人id" json:"creator_id"` // 创建人id
CreatedAt time.Time `gorm:"column:created_at;not null;comment:创建时间" json:"created_at"` // 创建时间 CreatedAt time.Time `gorm:"column:created_at;not null;comment:创建时间" json:"created_at"` // 创建时间