过/欠标调整

This commit is contained in:
tiger_zhou 2024-10-17 16:54:50 +08:00
parent 2f7e505437
commit 073f5e3156
4 changed files with 17 additions and 17 deletions

View File

@ -82,7 +82,7 @@ message Repository {
repeated GasEnvironment gasEnvironments = 320;
}
message StopPosition{
uint32 id = 1;
string id = 1;
uint32 linkId = 2;
uint32 linkOffset = 3;
Kilometer km = 4;

View File

@ -1781,7 +1781,7 @@ type StopPosition struct {
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Id uint32 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
LinkId uint32 `protobuf:"varint,2,opt,name=linkId,proto3" json:"linkId,omitempty"`
LinkOffset uint32 `protobuf:"varint,3,opt,name=linkOffset,proto3" json:"linkOffset,omitempty"`
Km *Kilometer `protobuf:"bytes,4,opt,name=km,proto3" json:"km,omitempty"`
@ -1822,11 +1822,11 @@ func (*StopPosition) Descriptor() ([]byte, []int) {
return file_model_proto_rawDescGZIP(), []int{1}
}
func (x *StopPosition) GetId() uint32 {
func (x *StopPosition) GetId() string {
if x != nil {
return x.Id
}
return 0
return ""
}
func (x *StopPosition) GetLinkId() uint32 {
@ -6334,7 +6334,7 @@ var file_model_proto_rawDesc = []byte{
0x47, 0x61, 0x73, 0x45, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x0f,
0x67, 0x61, 0x73, 0x45, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x22,
0xe7, 0x01, 0x0a, 0x0c, 0x53, 0x74, 0x6f, 0x70, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e,
0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x02, 0x69, 0x64,
0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64,
0x12, 0x16, 0x0a, 0x06, 0x6c, 0x69, 0x6e, 0x6b, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d,
0x52, 0x06, 0x6c, 0x69, 0x6e, 0x6b, 0x49, 0x64, 0x12, 0x1e, 0x0a, 0x0a, 0x6c, 0x69, 0x6e, 0x6b,
0x4f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0a, 0x6c, 0x69,

View File

@ -67,16 +67,12 @@ func buildModels(source *proto.Repository, repository *Repository) error {
}
repository.stationMap[m.Id()] = m
}
for _, sp := range source.StopPosition {
//calibrationKilometer(sp.Km, repository)
tid := strconv.Itoa(int(sp.Id))
t := NewStopPosition(tid, sp.Km, sp.CoachNum)
repository.StopPosition[tid] = t
}
for _, protoData := range source.PhysicalSections {
m := NewPhysicalSection(protoData.Id)
repository.physicalSectionMap[m.Id()] = m
}
for _, protoData := range source.AxleCountingSections {
m := NewAxleCountingSection(protoData.Id, protoData.TurnoutAndPos)
repository.axleCountingSectionMap[m.Id()] = m
@ -102,6 +98,11 @@ func buildModels(source *proto.Repository, repository *Repository) error {
protoData.Type, protoData.LeuIndex, protoData.IndexInLeu)
repository.responderMap[m.Id()] = m
}
for _, sp := range source.StopPosition {
calibrationKilometer(sp.Km, repository)
t := NewStopPosition(sp.Id, sp.Km, sp.CoachNum)
repository.StopPosition[t.Id()] = t
}
for _, protoData := range source.Slopes {
for _, km := range protoData.Kms {
calibrationKilometer(km, repository)
@ -634,8 +635,7 @@ func buildResponderRelationShip(source *proto.Repository, repository *Repository
}
func buildStopPositionRelationShip(source *proto.Repository, repository *Repository) error {
for _, protoData := range source.StopPosition {
tid := strconv.Itoa(int(protoData.Id))
responder := repository.StopPosition[tid]
responder := repository.StopPosition[protoData.Id]
if protoData.SectionId != "" {
repository.physicalSectionMap[protoData.SectionId].bindDevices(responder)
}
@ -1024,6 +1024,7 @@ func getATurnoutPort(turnouts []*Turnout, visitedTurnoutMap map[string]bool) *Tu
port: port,
}
key := buildTurnoutPortKey(tp)
fmt.Println(fmt.Sprintf("找到对应的道岔端点%v,id:%v %v", key, turnout.Id(), port))
if !visitedTurnoutMap[key] {
visitedTurnoutMap[key] = true
return tp
@ -1043,9 +1044,6 @@ func relateDevicesAndLink(repo *Repository, link *Link, startKm *proto.Kilometer
if visitedModelMap[device.Id()] {
continue
}
if device.Id() == "508" {
fmt.Println("aaaaaaaaaaaaaaaaa")
}
linkPositionDevice, ok := device.(LinkPositionDevice)
if !ok {
return fmt.Errorf("device [%s:%s] not implements LinkPositionDevice", device.Id(), device.Type().String())

View File

@ -1,6 +1,8 @@
package repository
import "joylink.club/rtsssimulation/repository/model/proto"
import (
"joylink.club/rtsssimulation/repository/model/proto"
)
type Transponder struct {
Identity