【地图元素ID类型改变】

This commit is contained in:
weizhihong 2023-12-14 13:04:48 +08:00
parent 3edeec44c6
commit 52cdb57d47
17 changed files with 1632 additions and 1933 deletions

View File

@ -381,7 +381,7 @@ type TurnoutOperationReq struct {
SimulationId string `protobuf:"bytes,1,opt,name=simulationId,proto3" json:"simulationId,omitempty"` // 仿真id SimulationId string `protobuf:"bytes,1,opt,name=simulationId,proto3" json:"simulationId,omitempty"` // 仿真id
MapId int32 `protobuf:"varint,2,opt,name=mapId,proto3" json:"mapId,omitempty"` // 图id MapId int32 `protobuf:"varint,2,opt,name=mapId,proto3" json:"mapId,omitempty"` // 图id
DeviceId string `protobuf:"bytes,3,opt,name=deviceId,proto3" json:"deviceId,omitempty"` // 设备id DeviceId uint32 `protobuf:"varint,3,opt,name=deviceId,proto3" json:"deviceId,omitempty"` // 设备id
Operation Turnout_Operation `protobuf:"varint,4,opt,name=operation,proto3,enum=request.Turnout_Operation" json:"operation,omitempty"` // 道岔操作 Operation Turnout_Operation `protobuf:"varint,4,opt,name=operation,proto3,enum=request.Turnout_Operation" json:"operation,omitempty"` // 道岔操作
} }
@ -431,11 +431,11 @@ func (x *TurnoutOperationReq) GetMapId() int32 {
return 0 return 0
} }
func (x *TurnoutOperationReq) GetDeviceId() string { func (x *TurnoutOperationReq) GetDeviceId() uint32 {
if x != nil { if x != nil {
return x.DeviceId return x.DeviceId
} }
return "" return 0
} }
func (x *TurnoutOperationReq) GetOperation() Turnout_Operation { func (x *TurnoutOperationReq) GetOperation() Turnout_Operation {
@ -570,7 +570,7 @@ type PsdOperationReq struct {
SimulationId string `protobuf:"bytes,1,opt,name=simulationId,proto3" json:"simulationId,omitempty"` // 仿真id SimulationId string `protobuf:"bytes,1,opt,name=simulationId,proto3" json:"simulationId,omitempty"` // 仿真id
MapId int32 `protobuf:"varint,2,opt,name=mapId,proto3" json:"mapId,omitempty"` // 图id MapId int32 `protobuf:"varint,2,opt,name=mapId,proto3" json:"mapId,omitempty"` // 图id
DeviceId string `protobuf:"bytes,3,opt,name=deviceId,proto3" json:"deviceId,omitempty"` // 设备id DeviceId uint32 `protobuf:"varint,3,opt,name=deviceId,proto3" json:"deviceId,omitempty"` // 设备id
Operation Psd_Operation `protobuf:"varint,4,opt,name=operation,proto3,enum=request.Psd_Operation" json:"operation,omitempty"` // 操作 Operation Psd_Operation `protobuf:"varint,4,opt,name=operation,proto3,enum=request.Psd_Operation" json:"operation,omitempty"` // 操作
AsdCodes []int32 `protobuf:"varint,5,rep,packed,name=asdCodes,proto3" json:"asdCodes,omitempty"` //无法关闭/无法开启故障涉及的滑动门的编号 AsdCodes []int32 `protobuf:"varint,5,rep,packed,name=asdCodes,proto3" json:"asdCodes,omitempty"` //无法关闭/无法开启故障涉及的滑动门的编号
Group int32 `protobuf:"varint,6,opt,name=group,proto3" json:"group,omitempty"` //开门操作的编组 Group int32 `protobuf:"varint,6,opt,name=group,proto3" json:"group,omitempty"` //开门操作的编组
@ -622,11 +622,11 @@ func (x *PsdOperationReq) GetMapId() int32 {
return 0 return 0
} }
func (x *PsdOperationReq) GetDeviceId() string { func (x *PsdOperationReq) GetDeviceId() uint32 {
if x != nil { if x != nil {
return x.DeviceId return x.DeviceId
} }
return "" return 0
} }
func (x *PsdOperationReq) GetOperation() Psd_Operation { func (x *PsdOperationReq) GetOperation() Psd_Operation {
@ -671,7 +671,7 @@ var file_request_proto_rawDesc = []byte{
0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x73, 0x69, 0x6d, 0x75, 0x6c, 0x61, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x73, 0x69, 0x6d, 0x75, 0x6c, 0x61,
0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x6d, 0x61, 0x70, 0x49, 0x64, 0x18, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x6d, 0x61, 0x70, 0x49, 0x64, 0x18,
0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x6d, 0x61, 0x70, 0x49, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x6d, 0x61, 0x70, 0x49, 0x64, 0x12, 0x1a, 0x0a, 0x08,
0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x49, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x49, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x08,
0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x49, 0x64, 0x12, 0x38, 0x0a, 0x09, 0x6f, 0x70, 0x65, 0x72, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x49, 0x64, 0x12, 0x38, 0x0a, 0x09, 0x6f, 0x70, 0x65, 0x72,
0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1a, 0x2e, 0x72, 0x65, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1a, 0x2e, 0x72, 0x65,
0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x54, 0x75, 0x72, 0x6e, 0x6f, 0x75, 0x74, 0x2e, 0x4f, 0x70, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x54, 0x75, 0x72, 0x6e, 0x6f, 0x75, 0x74, 0x2e, 0x4f, 0x70,
@ -721,7 +721,7 @@ var file_request_proto_rawDesc = []byte{
0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x73, 0x69, 0x6d, 0x75, 0x6c, 0x61, 0x74, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x73, 0x69, 0x6d, 0x75, 0x6c, 0x61, 0x74,
0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x6d, 0x61, 0x70, 0x49, 0x64, 0x18, 0x02, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x6d, 0x61, 0x70, 0x49, 0x64, 0x18, 0x02,
0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x6d, 0x61, 0x70, 0x49, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x64, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x6d, 0x61, 0x70, 0x49, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x64,
0x65, 0x76, 0x69, 0x63, 0x65, 0x49, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x49, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x08, 0x64,
0x65, 0x76, 0x69, 0x63, 0x65, 0x49, 0x64, 0x12, 0x34, 0x0a, 0x09, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x65, 0x76, 0x69, 0x63, 0x65, 0x49, 0x64, 0x12, 0x34, 0x0a, 0x09, 0x6f, 0x70, 0x65, 0x72, 0x61,
0x74, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x16, 0x2e, 0x72, 0x65, 0x71, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x16, 0x2e, 0x72, 0x65, 0x71,
0x75, 0x65, 0x73, 0x74, 0x2e, 0x50, 0x73, 0x64, 0x2e, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x50, 0x73, 0x64, 0x2e, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69,

View File

@ -42,7 +42,7 @@ type AddTrainReqDto struct {
//车头所在link内的偏移量单位为mm //车头所在link内的偏移量单位为mm
HeadLinkOffset int64 `json:"headLinkOffset" form:"headLinkOffset"` HeadLinkOffset int64 `json:"headLinkOffset" form:"headLinkOffset"`
//物理区段、道岔ID //物理区段、道岔ID
Id string `json:"id" form:"id"` Id uint32 `json:"id" form:"id"`
//道岔端口 //道岔端口
DevicePort string `json:"devicePort" form:"devicePort"` DevicePort string `json:"devicePort" form:"devicePort"`
//车头所在link内的偏移量单位为mm //车头所在link内的偏移量单位为mm
@ -94,7 +94,7 @@ type SwitchOperationReqDto struct {
type SignalOperationReqDto struct { type SignalOperationReqDto struct {
SimulationId string `form:"simulationId" json:"simulationId" binding:"required"` SimulationId string `form:"simulationId" json:"simulationId" binding:"required"`
MapId int32 `json:"mapId" from:"mapId" binding:"required"` MapId int32 `json:"mapId" from:"mapId" binding:"required"`
DeviceId string `form:"id" json:"id" binding:"required"` DeviceId uint32 `form:"id" json:"id" binding:"required"`
Operation request_proto.Signal_Operation `form:"operation" json:"operation" binding:"required"` //信号机操作类型 Operation request_proto.Signal_Operation `form:"operation" json:"operation" binding:"required"` //信号机操作类型
Aspect state.Signal_Aspect `form:"aspect" json:"aspect" binding:"required"` // 当操作为Operation.Display时有效表示显示的信号 Aspect state.Signal_Aspect `form:"aspect" json:"aspect" binding:"required"` // 当操作为Operation.Display时有效表示显示的信号
} }
@ -103,7 +103,7 @@ type SignalOperationReqDto struct {
type AxleSectionOperationReqDto struct { type AxleSectionOperationReqDto struct {
SimulationId string `form:"simulationId" json:"simulationId" binding:"required"` SimulationId string `form:"simulationId" json:"simulationId" binding:"required"`
MapId int32 `json:"mapId" from:"mapId" binding:"required"` MapId int32 `json:"mapId" from:"mapId" binding:"required"`
DeviceId string `form:"id" json:"id" binding:"required"` DeviceId uint32 `form:"id" json:"id" binding:"required"`
Operation request_proto.Section_Operation `form:"operation" json:"operation"` Operation request_proto.Section_Operation `form:"operation" json:"operation"`
TrainIn bool `form:"trainIn" json:"trainIn"` TrainIn bool `form:"trainIn" json:"trainIn"`
TrainOut bool `form:"trainOut" json:"trainOut"` TrainOut bool `form:"trainOut" json:"trainOut"`
@ -111,22 +111,22 @@ type AxleSectionOperationReqDto struct {
type EsbButtonOperationReqDto struct { type EsbButtonOperationReqDto struct {
SimulationId string `form:"simulationId" json:"simulationId" binding:"required"` SimulationId string `form:"simulationId" json:"simulationId" binding:"required"`
MapId int32 `json:"mapId" from:"mapId" binding:"required"` MapId int32 `json:"mapId" from:"mapId" binding:"required"`
Id string `form:"id" json:"id" binding:"required"` Id uint32 `form:"id" json:"id" binding:"required"`
Down bool `form:"down" json:"down"` Down bool `form:"down" json:"down"`
} }
type IBPButtonOperationReqDto struct { type IBPButtonOperationReqDto struct {
SimulationId string `form:"simulationId" json:"simulationId" binding:"required"` SimulationId string `form:"simulationId" json:"simulationId" binding:"required"`
MapId int32 `json:"mapId" from:"mapId" binding:"required"` MapId int32 `json:"mapId" from:"mapId" binding:"required"`
StationId string `form:"stationId" json:"stationId" binding:"required"` StationId uint32 `form:"stationId" json:"stationId" binding:"required"`
ButtonId string `form:"buttonId" json:"buttonId" binding:"required"` ButtonId uint32 `form:"buttonId" json:"buttonId" binding:"required"`
Down bool `form:"down" json:"down"` Down bool `form:"down" json:"down"`
} }
type PslOperationReqDto struct { type PslOperationReqDto struct {
SimulationId string `form:"simulationId" json:"simulationId" binding:"required"` SimulationId string `form:"simulationId" json:"simulationId" binding:"required"`
MapId int32 `json:"mapId" from:"mapId" binding:"required"` MapId int32 `json:"mapId" from:"mapId" binding:"required"`
GateBoxId string `form:"gateBoxId" json:"gateBoxId"` GateBoxId uint32 `form:"gateBoxId" json:"gateBoxId"`
ButtonCode string `form:"buttonCode" json:"buttonCode" binding:"required"` ButtonCode string `form:"buttonCode" json:"buttonCode" binding:"required"`
Down bool `form:"down" json:"down"` Down bool `form:"down" json:"down"`
} }
@ -134,8 +134,8 @@ type PslOperationReqDto struct {
type KeyOperationReqDto struct { type KeyOperationReqDto struct {
SimulationId string `form:"simulationId" json:"simulationId" binding:"required"` SimulationId string `form:"simulationId" json:"simulationId" binding:"required"`
MapId int32 `json:"mapId" from:"mapId" binding:"required"` MapId int32 `json:"mapId" from:"mapId" binding:"required"`
StationId string `form:"stationId" json:"stationId" binding:"required"` StationId uint32 `form:"stationId" json:"stationId" binding:"required"`
KeyId string `form:"keyId" json:"keyId"` KeyId uint32 `form:"keyId" json:"keyId"`
Gear int32 `form:"gear" json:"gear"` Gear int32 `form:"gear" json:"gear"`
} }
@ -165,6 +165,6 @@ type SimulationInfoRspDtoArr []SimulationInfoRspDto
type RelayOperationReqDto struct { type RelayOperationReqDto struct {
SimulationId string `form:"simulationId" json:"simulationId" binding:"required"` SimulationId string `form:"simulationId" json:"simulationId" binding:"required"`
MapId int32 `json:"mapId" from:"mapId" binding:"required"` MapId int32 `json:"mapId" from:"mapId" binding:"required"`
Id string `form:"id" json:"id" binding:"required"` Id uint32 `form:"id" json:"id" binding:"required"`
Td bool `form:"td" json:"td"` Td bool `form:"td" json:"td"`
} }

View File

@ -12,7 +12,7 @@ func TestTurnoutOperationReqDto(t *testing.T) {
b, err := json.Marshal(&request_proto.TurnoutOperationReq{ b, err := json.Marshal(&request_proto.TurnoutOperationReq{
SimulationId: "1", SimulationId: "1",
MapId: 2, MapId: 2,
DeviceId: "3", DeviceId: 3,
Operation: 2, Operation: 2,
}) })
if err != nil { if err != nil {

View File

@ -109,7 +109,7 @@ func (ms *IbpMs) collectIBPButtonState(stationUid string, uidsMap *memory.IBPUid
} }
// 获取IBP盘按钮状态 // 获取IBP盘按钮状态
func getIBPButtonState(id string, entry *ecs.Entry) *state.ButtonState { func getIBPButtonState(id uint32, entry *ecs.Entry) *state.ButtonState {
status := &state.ButtonState{Id: id} status := &state.ButtonState{Id: id}
bit := component.BitStateType.Get(entry) bit := component.BitStateType.Get(entry)
status.Down = bit.Val status.Down = bit.Val
@ -173,6 +173,6 @@ func (ms *IbpMs) collectIBPKeyState(stationUid string, uidsMap *memory.IBPUidStr
} }
// 处理订阅通道名称 // 处理订阅通道名称
func (ms *IbpMs) handlerIBPChannelName(stationId string) string { func (ms *IbpMs) handlerIBPChannelName(stationId uint32) string {
return fmt.Sprintf(SimulationIbpTopic, ms.vs.SimulationId, ms.mapId, stationId) return fmt.Sprintf(SimulationIbpTopic, ms.vs.SimulationId, ms.mapId, stationId)
} }

View File

@ -56,7 +56,7 @@ func (p *PslMs) OnTick() ([]*ms_api.TopicMsg, error) {
func (p *PslMs) OnError(err error) {} func (p *PslMs) OnError(err error) {}
// 处理订阅通道名称 // 处理订阅通道名称
func (p *PslMs) handlerPSLChannelName(gateBoxId string) string { func (p *PslMs) handlerPSLChannelName(gateBoxId uint32) string {
return fmt.Sprintf(SimulationPslTopic, p.vs.SimulationId, p.mapId, gateBoxId) return fmt.Sprintf(SimulationPslTopic, p.vs.SimulationId, p.mapId, gateBoxId)
} }
@ -72,13 +72,19 @@ func (p *PslMs) collectGateBoxPSLState(box *graphicData.GatedBox) (*state.Pushed
mkx := component.MkxType.Get(mkxEntry) mkx := component.MkxType.Get(mkxEntry)
var buttonStateArr []*state.ButtonState var buttonStateArr []*state.ButtonState
if ok { if ok {
pslMapId := memory.QueryGiId(box.RefGatedBoxMapCode)
pslStorage := memory.QueryGiData[*graphicData.PslGraphicStorage](pslMapId)
btnUidMap := make(map[string]uint32, len(pslStorage.PslButtons))
for _, button := range pslStorage.PslButtons {
btnUidMap[boxUid+"_"+button.Code] = memory.GetMapElementId(button.Common)
}
btnArr := []*ecs.Entry{mkx.PCB, mkx.POB, mkx.PAB} btnArr := []*ecs.Entry{mkx.PCB, mkx.POB, mkx.PAB}
for _, btn := range btnArr { for _, btn := range btnArr {
if btn == nil { if btn == nil {
continue continue
} }
buttonStateArr = append(buttonStateArr, &state.ButtonState{ buttonStateArr = append(buttonStateArr, &state.ButtonState{
Id: component.UidType.Get(btn).Id, Id: btnUidMap[component.UidType.Get(btn).Id],
Down: component.BitStateType.Get(btn).Val, Down: component.BitStateType.Get(btn).Val,
Active: component.BitStateType.Get(btn).Val, Active: component.BitStateType.Get(btn).Val,
}) })

View File

@ -333,12 +333,12 @@ func (ms *SfpMs) collectPlatformStates() ([]*state.PlatformState, error) {
for _, platform := range mapData.Platforms { for _, platform := range mapData.Platforms {
pid := memory.GetMapElementId(platform.Common) pid := memory.GetMapElementId(platform.Common)
stationCommonId := platform.RefStationId stationCommonId := platform.RefStationId
if stationCommonId == "" { if stationCommonId == 0 {
return nil, fmt.Errorf("站台没有绑定车站:id=%v", pid) return nil, fmt.Errorf("站台没有绑定车站:id=%v", pid)
} }
uidInfo := uidsMap.StationIds[stationCommonId] uidInfo := uidsMap.StationIds[stationCommonId]
if uidInfo == nil { if uidInfo == nil {
return nil, fmt.Errorf("车站实体不存在uid映射:id=%s", stationCommonId) return nil, fmt.Errorf("车站实体不存在uid映射:id=%v", stationCommonId)
} }
entry, ok := entity.GetEntityByUid(ms.vs.World, uidInfo.Uid) entry, ok := entity.GetEntityByUid(ms.vs.World, uidInfo.Uid)
if !ok { if !ok {
@ -366,7 +366,7 @@ func (ms *SfpMs) collectPlatformStates() ([]*state.PlatformState, error) {
} }
} }
psdId := platformScreenDoorMap[pid] psdId := platformScreenDoorMap[pid]
if psdId != "" { if psdId != 0 {
psdUid, ok := uidsMap.PsdIds[psdId] psdUid, ok := uidsMap.PsdIds[psdId]
if !ok { if !ok {
continue continue
@ -397,8 +397,8 @@ func (ms *SfpMs) collectPlatformStates() ([]*state.PlatformState, error) {
} }
// 将屏蔽门关联到站台 // 将屏蔽门关联到站台
func wrapScreenDoorToPlatform(mapData *graphicData.RtssGraphicStorage) map[string]string { func wrapScreenDoorToPlatform(mapData *graphicData.RtssGraphicStorage) map[uint32]uint32 {
platformMap := make(map[string]string, len(mapData.Platforms)) platformMap := make(map[uint32]uint32, len(mapData.Platforms))
for _, s := range mapData.ScreenDoors { for _, s := range mapData.ScreenDoors {
platformMap[s.RefPlatformId] = memory.GetMapElementId(s.Common) platformMap[s.RefPlatformId] = memory.GetMapElementId(s.Common)
} }

View File

@ -20,9 +20,9 @@ const (
// 继电器组合柜布置图设备状态消息topic // 继电器组合柜布置图设备状态消息topic
SimulationRccTopic = SimulationTopicPrefix + "rcc/%d" SimulationRccTopic = SimulationTopicPrefix + "rcc/%d"
// PSL设备状态消息topic // PSL设备状态消息topic
SimulationPslTopic = SimulationTopicPrefix + "psl/%d/%s" SimulationPslTopic = SimulationTopicPrefix + "psl/%d/%d"
// IBP设备状态消息topic // IBP设备状态消息topic
SimulationIbpTopic = SimulationTopicPrefix + "ibp/%d/%s" SimulationIbpTopic = SimulationTopicPrefix + "ibp/%d/%d"
) )
var smsMap sync.Map var smsMap sync.Map

View File

@ -549,8 +549,9 @@ type Combinationtype struct {
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields unknownFields protoimpl.UnknownFields
Code string `protobuf:"bytes,1,opt,name=code,proto3" json:"code,omitempty"` Code string `protobuf:"bytes,1,opt,name=code,proto3" json:"code,omitempty"`
RefRelays []string `protobuf:"bytes,2,rep,name=refRelays,proto3" json:"refRelays,omitempty"` //设备关联的继电器 OldrefRelays []string `protobuf:"bytes,2,rep,name=oldrefRelays,proto3" json:"oldrefRelays,omitempty"` //设备关联的继电器
RefRelays []uint32 `protobuf:"varint,3,rep,packed,name=refRelays,proto3" json:"refRelays,omitempty"` //设备关联的继电器
} }
func (x *Combinationtype) Reset() { func (x *Combinationtype) Reset() {
@ -592,7 +593,14 @@ func (x *Combinationtype) GetCode() string {
return "" return ""
} }
func (x *Combinationtype) GetRefRelays() []string { func (x *Combinationtype) GetOldrefRelays() []string {
if x != nil {
return x.OldrefRelays
}
return nil
}
func (x *Combinationtype) GetRefRelays() []uint32 {
if x != nil { if x != nil {
return x.RefRelays return x.RefRelays
} }
@ -825,8 +833,9 @@ type CjDataItem struct {
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields unknownFields protoimpl.UnknownFields
RelayId string `protobuf:"bytes,1,opt,name=relayId,proto3" json:"relayId,omitempty"` //采集对应的继电器Id OldrelayId string `protobuf:"bytes,1,opt,name=oldrelayId,proto3" json:"oldrelayId,omitempty"` //采集对应的继电器Id
Position CjDataItem_PostionType `protobuf:"varint,2,opt,name=position,proto3,enum=relayCabinetGraphicData.CjDataItem_PostionType" json:"position,omitempty"` //继电器的位置QH对应着吸合 Position CjDataItem_PostionType `protobuf:"varint,2,opt,name=position,proto3,enum=relayCabinetGraphicData.CjDataItem_PostionType" json:"position,omitempty"` //继电器的位置QH对应着吸合
RelayId uint32 `protobuf:"varint,3,opt,name=relayId,proto3" json:"relayId,omitempty"` //采集对应的继电器Id
} }
func (x *CjDataItem) Reset() { func (x *CjDataItem) Reset() {
@ -861,9 +870,9 @@ func (*CjDataItem) Descriptor() ([]byte, []int) {
return file_relayCabinetLayoutGraphics_proto_rawDescGZIP(), []int{11} return file_relayCabinetLayoutGraphics_proto_rawDescGZIP(), []int{11}
} }
func (x *CjDataItem) GetRelayId() string { func (x *CjDataItem) GetOldrelayId() string {
if x != nil { if x != nil {
return x.RelayId return x.OldrelayId
} }
return "" return ""
} }
@ -875,6 +884,13 @@ func (x *CjDataItem) GetPosition() CjDataItem_PostionType {
return CjDataItem_Q return CjDataItem_Q
} }
func (x *CjDataItem) GetRelayId() uint32 {
if x != nil {
return x.RelayId
}
return 0
}
// 驱动 // 驱动
type CiQd struct { type CiQd struct {
state protoimpl.MessageState state protoimpl.MessageState
@ -991,7 +1007,8 @@ type QdData struct {
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields unknownFields protoimpl.UnknownFields
RefRelays []string `protobuf:"bytes,1,rep,name=refRelays,proto3" json:"refRelays,omitempty"` //驱动的继电器Id OldrefRelays []string `protobuf:"bytes,1,rep,name=oldrefRelays,proto3" json:"oldrefRelays,omitempty"` //驱动的继电器Id
RefRelays []uint32 `protobuf:"varint,2,rep,packed,name=refRelays,proto3" json:"refRelays,omitempty"` //驱动的继电器Id
} }
func (x *QdData) Reset() { func (x *QdData) Reset() {
@ -1026,7 +1043,14 @@ func (*QdData) Descriptor() ([]byte, []int) {
return file_relayCabinetLayoutGraphics_proto_rawDescGZIP(), []int{14} return file_relayCabinetLayoutGraphics_proto_rawDescGZIP(), []int{14}
} }
func (x *QdData) GetRefRelays() []string { func (x *QdData) GetOldrefRelays() []string {
if x != nil {
return x.OldrefRelays
}
return nil
}
func (x *QdData) GetRefRelays() []uint32 {
if x != nil { if x != nil {
return x.RefRelays return x.RefRelays
} }
@ -1133,61 +1157,67 @@ var file_relayCabinetLayoutGraphics_proto_rawDesc = []byte{
0x32, 0x22, 0x2e, 0x67, 0x72, 0x61, 0x70, 0x68, 0x69, 0x63, 0x44, 0x61, 0x74, 0x61, 0x2e, 0x52, 0x32, 0x22, 0x2e, 0x67, 0x72, 0x61, 0x70, 0x68, 0x69, 0x63, 0x44, 0x61, 0x74, 0x61, 0x2e, 0x52,
0x65, 0x6c, 0x61, 0x74, 0x65, 0x64, 0x52, 0x65, 0x66, 0x2e, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x65, 0x6c, 0x61, 0x74, 0x65, 0x64, 0x52, 0x65, 0x66, 0x2e, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65,
0x54, 0x79, 0x70, 0x65, 0x52, 0x0a, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x54, 0x79, 0x70, 0x65, 0x52, 0x0a, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65,
0x22, 0x43, 0x0a, 0x0f, 0x43, 0x6f, 0x6d, 0x62, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x74, 0x22, 0x67, 0x0a, 0x0f, 0x43, 0x6f, 0x6d, 0x62, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x74,
0x79, 0x70, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x79, 0x70, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28,
0x09, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x72, 0x65, 0x66, 0x52, 0x65, 0x09, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x12, 0x22, 0x0a, 0x0c, 0x6f, 0x6c, 0x64, 0x72, 0x65,
0x6c, 0x61, 0x79, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x09, 0x72, 0x65, 0x66, 0x52, 0x66, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0c, 0x6f,
0x65, 0x6c, 0x61, 0x79, 0x73, 0x22, 0x7c, 0x0a, 0x0c, 0x55, 0x6e, 0x69, 0x71, 0x75, 0x65, 0x49, 0x6c, 0x64, 0x72, 0x65, 0x66, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x73, 0x12, 0x1c, 0x0a, 0x09, 0x72,
0x64, 0x54, 0x79, 0x70, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x69, 0x74, 0x79, 0x18, 0x01, 0x20, 0x65, 0x66, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x09,
0x01, 0x28, 0x09, 0x52, 0x04, 0x63, 0x69, 0x74, 0x79, 0x12, 0x16, 0x0a, 0x06, 0x6c, 0x69, 0x6e, 0x72, 0x65, 0x66, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x73, 0x22, 0x7c, 0x0a, 0x0c, 0x55, 0x6e, 0x69,
0x65, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x6c, 0x69, 0x6e, 0x65, 0x49, 0x71, 0x75, 0x65, 0x49, 0x64, 0x54, 0x79, 0x70, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x69, 0x74,
0x64, 0x12, 0x40, 0x0a, 0x1b, 0x62, 0x65, 0x6c, 0x6f, 0x6e, 0x67, 0x73, 0x43, 0x6f, 0x6e, 0x63, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x63, 0x69, 0x74, 0x79, 0x12, 0x16, 0x0a,
0x65, 0x6e, 0x74, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x06, 0x6c, 0x69, 0x6e, 0x65, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x6c,
0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x1b, 0x62, 0x65, 0x6c, 0x6f, 0x6e, 0x67, 0x73, 0x43, 0x69, 0x6e, 0x65, 0x49, 0x64, 0x12, 0x40, 0x0a, 0x1b, 0x62, 0x65, 0x6c, 0x6f, 0x6e, 0x67, 0x73,
0x6f, 0x6e, 0x63, 0x65, 0x6e, 0x74, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x43, 0x6f, 0x6e, 0x63, 0x65, 0x6e, 0x74, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61,
0x69, 0x6f, 0x6e, 0x22, 0x5c, 0x0a, 0x04, 0x43, 0x69, 0x43, 0x6a, 0x12, 0x18, 0x0a, 0x07, 0x64, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x1b, 0x62, 0x65, 0x6c, 0x6f,
0x73, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x64, 0x73, 0x6e, 0x67, 0x73, 0x43, 0x6f, 0x6e, 0x63, 0x65, 0x6e, 0x74, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e,
0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x3a, 0x0a, 0x06, 0x63, 0x6a, 0x4c, 0x69, 0x73, 0x74, 0x18, 0x53, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x5c, 0x0a, 0x04, 0x43, 0x69, 0x43, 0x6a, 0x12,
0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x43, 0x61, 0x62, 0x18, 0x0a, 0x07, 0x64, 0x73, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05,
0x69, 0x6e, 0x65, 0x74, 0x47, 0x72, 0x61, 0x70, 0x68, 0x69, 0x63, 0x44, 0x61, 0x74, 0x61, 0x2e, 0x52, 0x07, 0x64, 0x73, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x3a, 0x0a, 0x06, 0x63, 0x6a, 0x4c,
0x43, 0x6a, 0x44, 0x61, 0x74, 0x61, 0x53, 0x65, 0x74, 0x52, 0x06, 0x63, 0x6a, 0x4c, 0x69, 0x73, 0x69, 0x73, 0x74, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x72, 0x65, 0x6c, 0x61,
0x74, 0x22, 0x5a, 0x0a, 0x09, 0x43, 0x6a, 0x44, 0x61, 0x74, 0x61, 0x53, 0x65, 0x74, 0x12, 0x12, 0x79, 0x43, 0x61, 0x62, 0x69, 0x6e, 0x65, 0x74, 0x47, 0x72, 0x61, 0x70, 0x68, 0x69, 0x63, 0x44,
0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x61, 0x74, 0x61, 0x2e, 0x43, 0x6a, 0x44, 0x61, 0x74, 0x61, 0x53, 0x65, 0x74, 0x52, 0x06, 0x63,
0x6d, 0x65, 0x12, 0x39, 0x0a, 0x07, 0x62, 0x69, 0x74, 0x4c, 0x69, 0x73, 0x74, 0x18, 0x02, 0x20, 0x6a, 0x4c, 0x69, 0x73, 0x74, 0x22, 0x5a, 0x0a, 0x09, 0x43, 0x6a, 0x44, 0x61, 0x74, 0x61, 0x53,
0x03, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x43, 0x61, 0x62, 0x69, 0x6e, 0x65, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09,
0x65, 0x74, 0x47, 0x72, 0x61, 0x70, 0x68, 0x69, 0x63, 0x44, 0x61, 0x74, 0x61, 0x2e, 0x43, 0x6a, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x39, 0x0a, 0x07, 0x62, 0x69, 0x74, 0x4c, 0x69, 0x73,
0x44, 0x61, 0x74, 0x61, 0x52, 0x07, 0x62, 0x69, 0x74, 0x4c, 0x69, 0x73, 0x74, 0x22, 0x4b, 0x0a, 0x74, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x43,
0x06, 0x43, 0x6a, 0x44, 0x61, 0x74, 0x61, 0x12, 0x41, 0x0a, 0x09, 0x72, 0x65, 0x66, 0x52, 0x65, 0x61, 0x62, 0x69, 0x6e, 0x65, 0x74, 0x47, 0x72, 0x61, 0x70, 0x68, 0x69, 0x63, 0x44, 0x61, 0x74,
0x6c, 0x61, 0x79, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x72, 0x65, 0x6c, 0x61, 0x2e, 0x43, 0x6a, 0x44, 0x61, 0x74, 0x61, 0x52, 0x07, 0x62, 0x69, 0x74, 0x4c, 0x69, 0x73,
0x61, 0x79, 0x43, 0x61, 0x62, 0x69, 0x6e, 0x65, 0x74, 0x47, 0x72, 0x61, 0x70, 0x68, 0x69, 0x63, 0x74, 0x22, 0x4b, 0x0a, 0x06, 0x43, 0x6a, 0x44, 0x61, 0x74, 0x61, 0x12, 0x41, 0x0a, 0x09, 0x72,
0x44, 0x61, 0x74, 0x61, 0x2e, 0x43, 0x6a, 0x44, 0x61, 0x74, 0x61, 0x49, 0x74, 0x65, 0x6d, 0x52, 0x65, 0x66, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x23,
0x09, 0x72, 0x65, 0x66, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x73, 0x22, 0x90, 0x01, 0x0a, 0x0a, 0x43, 0x2e, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x43, 0x61, 0x62, 0x69, 0x6e, 0x65, 0x74, 0x47, 0x72, 0x61,
0x6a, 0x44, 0x61, 0x74, 0x61, 0x49, 0x74, 0x65, 0x6d, 0x12, 0x18, 0x0a, 0x07, 0x72, 0x65, 0x6c, 0x70, 0x68, 0x69, 0x63, 0x44, 0x61, 0x74, 0x61, 0x2e, 0x43, 0x6a, 0x44, 0x61, 0x74, 0x61, 0x49,
0x61, 0x79, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x72, 0x65, 0x6c, 0x61, 0x74, 0x65, 0x6d, 0x52, 0x09, 0x72, 0x65, 0x66, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x73, 0x22, 0xb0,
0x79, 0x49, 0x64, 0x12, 0x4b, 0x0a, 0x08, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x0a, 0x0a, 0x43, 0x6a, 0x44, 0x61, 0x74, 0x61, 0x49, 0x74, 0x65, 0x6d, 0x12, 0x1e, 0x0a,
0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2f, 0x2e, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x43, 0x61, 0x62, 0x0a, 0x6f, 0x6c, 0x64, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28,
0x69, 0x6e, 0x65, 0x74, 0x47, 0x72, 0x61, 0x70, 0x68, 0x69, 0x63, 0x44, 0x61, 0x74, 0x61, 0x2e, 0x09, 0x52, 0x0a, 0x6f, 0x6c, 0x64, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x49, 0x64, 0x12, 0x4b, 0x0a,
0x43, 0x6a, 0x44, 0x61, 0x74, 0x61, 0x49, 0x74, 0x65, 0x6d, 0x2e, 0x50, 0x6f, 0x73, 0x74, 0x69, 0x08, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32,
0x6f, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x52, 0x08, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x2e, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x43, 0x61, 0x62, 0x69, 0x6e, 0x65, 0x74, 0x47, 0x72,
0x22, 0x1b, 0x0a, 0x0b, 0x50, 0x6f, 0x73, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x12, 0x61, 0x70, 0x68, 0x69, 0x63, 0x44, 0x61, 0x74, 0x61, 0x2e, 0x43, 0x6a, 0x44, 0x61, 0x74, 0x61,
0x05, 0x0a, 0x01, 0x51, 0x10, 0x00, 0x12, 0x05, 0x0a, 0x01, 0x48, 0x10, 0x01, 0x22, 0x5c, 0x0a, 0x49, 0x74, 0x65, 0x6d, 0x2e, 0x50, 0x6f, 0x73, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x79, 0x70, 0x65,
0x04, 0x43, 0x69, 0x51, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x64, 0x73, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x52, 0x08, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x18, 0x0a, 0x07, 0x72, 0x65,
0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x64, 0x73, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x6c, 0x61, 0x79, 0x49, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x07, 0x72, 0x65, 0x6c,
0x3a, 0x0a, 0x06, 0x71, 0x64, 0x4c, 0x69, 0x73, 0x74, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x61, 0x79, 0x49, 0x64, 0x22, 0x1b, 0x0a, 0x0b, 0x50, 0x6f, 0x73, 0x74, 0x69, 0x6f, 0x6e, 0x54,
0x22, 0x2e, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x43, 0x61, 0x62, 0x69, 0x6e, 0x65, 0x74, 0x47, 0x72, 0x79, 0x70, 0x65, 0x12, 0x05, 0x0a, 0x01, 0x51, 0x10, 0x00, 0x12, 0x05, 0x0a, 0x01, 0x48, 0x10,
0x61, 0x70, 0x68, 0x69, 0x63, 0x44, 0x61, 0x74, 0x61, 0x2e, 0x51, 0x64, 0x44, 0x61, 0x74, 0x61, 0x01, 0x22, 0x5c, 0x0a, 0x04, 0x43, 0x69, 0x51, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x64, 0x73, 0x43,
0x53, 0x65, 0x74, 0x52, 0x06, 0x71, 0x64, 0x4c, 0x69, 0x73, 0x74, 0x22, 0x5a, 0x0a, 0x09, 0x51, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x64, 0x73, 0x43, 0x6f,
0x64, 0x44, 0x61, 0x74, 0x61, 0x53, 0x65, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x75, 0x6e, 0x74, 0x12, 0x3a, 0x0a, 0x06, 0x71, 0x64, 0x4c, 0x69, 0x73, 0x74, 0x18, 0x02, 0x20,
0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x39, 0x0a, 0x07, 0x03, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x43, 0x61, 0x62, 0x69, 0x6e,
0x62, 0x69, 0x74, 0x4c, 0x69, 0x73, 0x74, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x65, 0x74, 0x47, 0x72, 0x61, 0x70, 0x68, 0x69, 0x63, 0x44, 0x61, 0x74, 0x61, 0x2e, 0x51, 0x64,
0x72, 0x65, 0x6c, 0x61, 0x79, 0x43, 0x61, 0x62, 0x69, 0x6e, 0x65, 0x74, 0x47, 0x72, 0x61, 0x70, 0x44, 0x61, 0x74, 0x61, 0x53, 0x65, 0x74, 0x52, 0x06, 0x71, 0x64, 0x4c, 0x69, 0x73, 0x74, 0x22,
0x68, 0x69, 0x63, 0x44, 0x61, 0x74, 0x61, 0x2e, 0x51, 0x64, 0x44, 0x61, 0x74, 0x61, 0x52, 0x07, 0x5a, 0x0a, 0x09, 0x51, 0x64, 0x44, 0x61, 0x74, 0x61, 0x53, 0x65, 0x74, 0x12, 0x12, 0x0a, 0x04,
0x62, 0x69, 0x74, 0x4c, 0x69, 0x73, 0x74, 0x22, 0x26, 0x0a, 0x06, 0x51, 0x64, 0x44, 0x61, 0x74, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65,
0x61, 0x12, 0x1c, 0x0a, 0x09, 0x72, 0x65, 0x66, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x73, 0x18, 0x01, 0x12, 0x39, 0x0a, 0x07, 0x62, 0x69, 0x74, 0x4c, 0x69, 0x73, 0x74, 0x18, 0x02, 0x20, 0x03, 0x28,
0x20, 0x03, 0x28, 0x09, 0x52, 0x09, 0x72, 0x65, 0x66, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x73, 0x42, 0x0b, 0x32, 0x1f, 0x2e, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x43, 0x61, 0x62, 0x69, 0x6e, 0x65, 0x74,
0x19, 0x5a, 0x17, 0x2e, 0x2f, 0x74, 0x73, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2f, 0x67, 0x47, 0x72, 0x61, 0x70, 0x68, 0x69, 0x63, 0x44, 0x61, 0x74, 0x61, 0x2e, 0x51, 0x64, 0x44, 0x61,
0x72, 0x61, 0x70, 0x68, 0x69, 0x63, 0x44, 0x61, 0x74, 0x61, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x74, 0x61, 0x52, 0x07, 0x62, 0x69, 0x74, 0x4c, 0x69, 0x73, 0x74, 0x22, 0x4a, 0x0a, 0x06, 0x51,
0x6f, 0x33, 0x64, 0x44, 0x61, 0x74, 0x61, 0x12, 0x22, 0x0a, 0x0c, 0x6f, 0x6c, 0x64, 0x72, 0x65, 0x66, 0x52,
0x65, 0x6c, 0x61, 0x79, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0c, 0x6f, 0x6c, 0x64,
0x72, 0x65, 0x66, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x73, 0x12, 0x1c, 0x0a, 0x09, 0x72, 0x65, 0x66,
0x52, 0x65, 0x6c, 0x61, 0x79, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x09, 0x72, 0x65,
0x66, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x73, 0x42, 0x19, 0x5a, 0x17, 0x2e, 0x2f, 0x74, 0x73, 0x2f,
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2f, 0x67, 0x72, 0x61, 0x70, 0x68, 0x69, 0x63, 0x44, 0x61,
0x74, 0x61, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
} }
var ( var (

File diff suppressed because it is too large Load Diff

View File

@ -208,7 +208,7 @@ type LinkState struct {
unknownFields protoimpl.UnknownFields unknownFields protoimpl.UnknownFields
// link索引 // link索引
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` Id uint32 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
// link上的列车id列表 // link上的列车id列表
TrainId []string `protobuf:"bytes,2,rep,name=trainId,proto3" json:"trainId,omitempty"` TrainId []string `protobuf:"bytes,2,rep,name=trainId,proto3" json:"trainId,omitempty"`
} }
@ -245,11 +245,11 @@ func (*LinkState) Descriptor() ([]byte, []int) {
return file_device_state_proto_rawDescGZIP(), []int{0} return file_device_state_proto_rawDescGZIP(), []int{0}
} }
func (x *LinkState) GetId() string { func (x *LinkState) GetId() uint32 {
if x != nil { if x != nil {
return x.Id return x.Id
} }
return "" return 0
} }
func (x *LinkState) GetTrainId() []string { func (x *LinkState) GetTrainId() []string {
@ -266,7 +266,7 @@ type SectionState struct {
unknownFields protoimpl.UnknownFields unknownFields protoimpl.UnknownFields
// 区段索引 // 区段索引
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` Id uint32 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
// 区段占用 // 区段占用
// true-占用false-出清 // true-占用false-出清
Occupied bool `protobuf:"varint,3,opt,name=occupied,proto3" json:"occupied,omitempty"` Occupied bool `protobuf:"varint,3,opt,name=occupied,proto3" json:"occupied,omitempty"`
@ -306,11 +306,11 @@ func (*SectionState) Descriptor() ([]byte, []int) {
return file_device_state_proto_rawDescGZIP(), []int{1} return file_device_state_proto_rawDescGZIP(), []int{1}
} }
func (x *SectionState) GetId() string { func (x *SectionState) GetId() uint32 {
if x != nil { if x != nil {
return x.Id return x.Id
} }
return "" return 0
} }
func (x *SectionState) GetOccupied() bool { func (x *SectionState) GetOccupied() bool {
@ -334,7 +334,7 @@ type SwitchState struct {
unknownFields protoimpl.UnknownFields unknownFields protoimpl.UnknownFields
// 道岔索引 // 道岔索引
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` Id uint32 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
// 道岔处于定位(表示) // 道岔处于定位(表示)
Normal bool `protobuf:"varint,2,opt,name=normal,proto3" json:"normal,omitempty"` Normal bool `protobuf:"varint,2,opt,name=normal,proto3" json:"normal,omitempty"`
// 道岔处于反位(表示) // 道岔处于反位(表示)
@ -401,11 +401,11 @@ func (*SwitchState) Descriptor() ([]byte, []int) {
return file_device_state_proto_rawDescGZIP(), []int{2} return file_device_state_proto_rawDescGZIP(), []int{2}
} }
func (x *SwitchState) GetId() string { func (x *SwitchState) GetId() uint32 {
if x != nil { if x != nil {
return x.Id return x.Id
} }
return "" return 0
} }
func (x *SwitchState) GetNormal() bool { func (x *SwitchState) GetNormal() bool {
@ -527,7 +527,7 @@ type SignalState struct {
unknownFields protoimpl.UnknownFields unknownFields protoimpl.UnknownFields
// 信号机索引 // 信号机索引
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` Id uint32 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
// 信号机的灯列表 // 信号机的灯列表
Aspect Signal_Aspect `protobuf:"varint,2,opt,name=aspect,proto3,enum=state.Signal_Aspect" json:"aspect,omitempty"` Aspect Signal_Aspect `protobuf:"varint,2,opt,name=aspect,proto3,enum=state.Signal_Aspect" json:"aspect,omitempty"`
} }
@ -564,11 +564,11 @@ func (*SignalState) Descriptor() ([]byte, []int) {
return file_device_state_proto_rawDescGZIP(), []int{3} return file_device_state_proto_rawDescGZIP(), []int{3}
} }
func (x *SignalState) GetId() string { func (x *SignalState) GetId() uint32 {
if x != nil { if x != nil {
return x.Id return x.Id
} }
return "" return 0
} }
func (x *SignalState) GetAspect() Signal_Aspect { func (x *SignalState) GetAspect() Signal_Aspect {
@ -624,7 +624,7 @@ type PlatformState struct {
unknownFields protoimpl.UnknownFields unknownFields protoimpl.UnknownFields
// 站台索引 // 站台索引
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` Id uint32 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
// EMP继电器状态 // EMP继电器状态
Empj bool `protobuf:"varint,2,opt,name=empj,proto3" json:"empj,omitempty"` Empj bool `protobuf:"varint,2,opt,name=empj,proto3" json:"empj,omitempty"`
// SPKS继电器状态 // SPKS继电器状态
@ -665,11 +665,11 @@ func (*PlatformState) Descriptor() ([]byte, []int) {
return file_device_state_proto_rawDescGZIP(), []int{5} return file_device_state_proto_rawDescGZIP(), []int{5}
} }
func (x *PlatformState) GetId() string { func (x *PlatformState) GetId() uint32 {
if x != nil { if x != nil {
return x.Id return x.Id
} }
return "" return 0
} }
func (x *PlatformState) GetEmpj() bool { func (x *PlatformState) GetEmpj() bool {
@ -700,7 +700,7 @@ type StationState struct {
unknownFields protoimpl.UnknownFields unknownFields protoimpl.UnknownFields
// 车站索引 // 车站索引
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` Id uint32 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
} }
func (x *StationState) Reset() { func (x *StationState) Reset() {
@ -735,11 +735,11 @@ func (*StationState) Descriptor() ([]byte, []int) {
return file_device_state_proto_rawDescGZIP(), []int{6} return file_device_state_proto_rawDescGZIP(), []int{6}
} }
func (x *StationState) GetId() string { func (x *StationState) GetId() uint32 {
if x != nil { if x != nil {
return x.Id return x.Id
} }
return "" return 0
} }
// 列车状态 // 列车状态
@ -759,7 +759,7 @@ type TrainState struct {
// 列车是否显示 // 列车是否显示
Show bool `protobuf:"varint,5,opt,name=show,proto3" json:"show,omitempty"` Show bool `protobuf:"varint,5,opt,name=show,proto3" json:"show,omitempty"`
// 列车车头所在设备ID // 列车车头所在设备ID
HeadDeviceId string `protobuf:"bytes,6,opt,name=headDeviceId,proto3" json:"headDeviceId,omitempty"` HeadDeviceId uint32 `protobuf:"varint,6,opt,name=headDeviceId,proto3" json:"headDeviceId,omitempty"`
// 列车车头所在设备偏移量 // 列车车头所在设备偏移量
HeadOffset int64 `protobuf:"varint,7,opt,name=headOffset,proto3" json:"headOffset,omitempty"` HeadOffset int64 `protobuf:"varint,7,opt,name=headOffset,proto3" json:"headOffset,omitempty"`
// 设备端口 // 设备端口
@ -849,11 +849,11 @@ func (x *TrainState) GetShow() bool {
return false return false
} }
func (x *TrainState) GetHeadDeviceId() string { func (x *TrainState) GetHeadDeviceId() uint32 {
if x != nil { if x != nil {
return x.HeadDeviceId return x.HeadDeviceId
} }
return "" return 0
} }
func (x *TrainState) GetHeadOffset() int64 { func (x *TrainState) GetHeadOffset() int64 {
@ -1446,7 +1446,7 @@ type ReplyState struct {
unknownFields protoimpl.UnknownFields unknownFields protoimpl.UnknownFields
// 继电器索引 // 继电器索引
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` Id uint32 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
// 继电器吸合状态 // 继电器吸合状态
Xh bool `protobuf:"varint,2,opt,name=xh,proto3" json:"xh,omitempty"` Xh bool `protobuf:"varint,2,opt,name=xh,proto3" json:"xh,omitempty"`
// 继电器编号 // 继电器编号
@ -1485,11 +1485,11 @@ func (*ReplyState) Descriptor() ([]byte, []int) {
return file_device_state_proto_rawDescGZIP(), []int{10} return file_device_state_proto_rawDescGZIP(), []int{10}
} }
func (x *ReplyState) GetId() string { func (x *ReplyState) GetId() uint32 {
if x != nil { if x != nil {
return x.Id return x.Id
} }
return "" return 0
} }
func (x *ReplyState) GetXh() bool { func (x *ReplyState) GetXh() bool {
@ -1512,7 +1512,7 @@ type ButtonState struct {
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields unknownFields protoimpl.UnknownFields
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` Id uint32 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
Down bool `protobuf:"varint,2,opt,name=down,proto3" json:"down,omitempty"` Down bool `protobuf:"varint,2,opt,name=down,proto3" json:"down,omitempty"`
Active bool `protobuf:"varint,3,opt,name=active,proto3" json:"active,omitempty"` // 带灯的按钮 Active bool `protobuf:"varint,3,opt,name=active,proto3" json:"active,omitempty"` // 带灯的按钮
} }
@ -1549,11 +1549,11 @@ func (*ButtonState) Descriptor() ([]byte, []int) {
return file_device_state_proto_rawDescGZIP(), []int{11} return file_device_state_proto_rawDescGZIP(), []int{11}
} }
func (x *ButtonState) GetId() string { func (x *ButtonState) GetId() uint32 {
if x != nil { if x != nil {
return x.Id return x.Id
} }
return "" return 0
} }
func (x *ButtonState) GetDown() bool { func (x *ButtonState) GetDown() bool {
@ -1576,7 +1576,7 @@ type AlarmState struct {
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields unknownFields protoimpl.UnknownFields
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` Id uint32 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
Active bool `protobuf:"varint,2,opt,name=active,proto3" json:"active,omitempty"` Active bool `protobuf:"varint,2,opt,name=active,proto3" json:"active,omitempty"`
} }
@ -1612,11 +1612,11 @@ func (*AlarmState) Descriptor() ([]byte, []int) {
return file_device_state_proto_rawDescGZIP(), []int{12} return file_device_state_proto_rawDescGZIP(), []int{12}
} }
func (x *AlarmState) GetId() string { func (x *AlarmState) GetId() uint32 {
if x != nil { if x != nil {
return x.Id return x.Id
} }
return "" return 0
} }
func (x *AlarmState) GetActive() bool { func (x *AlarmState) GetActive() bool {
@ -1632,7 +1632,7 @@ type LightState struct {
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields unknownFields protoimpl.UnknownFields
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` Id uint32 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
Active bool `protobuf:"varint,2,opt,name=active,proto3" json:"active,omitempty"` Active bool `protobuf:"varint,2,opt,name=active,proto3" json:"active,omitempty"`
} }
@ -1668,11 +1668,11 @@ func (*LightState) Descriptor() ([]byte, []int) {
return file_device_state_proto_rawDescGZIP(), []int{13} return file_device_state_proto_rawDescGZIP(), []int{13}
} }
func (x *LightState) GetId() string { func (x *LightState) GetId() uint32 {
if x != nil { if x != nil {
return x.Id return x.Id
} }
return "" return 0
} }
func (x *LightState) GetActive() bool { func (x *LightState) GetActive() bool {
@ -1688,7 +1688,7 @@ type PsdState struct {
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields unknownFields protoimpl.UnknownFields
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` //屏蔽门的id Id uint32 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` //屏蔽门的id
AsdStates []*AsdState `protobuf:"bytes,2,rep,name=asdStates,proto3" json:"asdStates,omitempty"` //滑动门状态 AsdStates []*AsdState `protobuf:"bytes,2,rep,name=asdStates,proto3" json:"asdStates,omitempty"` //滑动门状态
Mgj bool `protobuf:"varint,3,opt,name=mgj,proto3" json:"mgj,omitempty"` //屏蔽门整体的关闭(继电器)状态 Mgj bool `protobuf:"varint,3,opt,name=mgj,proto3" json:"mgj,omitempty"` //屏蔽门整体的关闭(继电器)状态
} }
@ -1725,11 +1725,11 @@ func (*PsdState) Descriptor() ([]byte, []int) {
return file_device_state_proto_rawDescGZIP(), []int{14} return file_device_state_proto_rawDescGZIP(), []int{14}
} }
func (x *PsdState) GetId() string { func (x *PsdState) GetId() uint32 {
if x != nil { if x != nil {
return x.Id return x.Id
} }
return "" return 0
} }
func (x *PsdState) GetAsdStates() []*AsdState { func (x *PsdState) GetAsdStates() []*AsdState {
@ -1824,7 +1824,7 @@ type KeyState struct {
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields unknownFields protoimpl.UnknownFields
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` Id uint32 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
Gear int32 `protobuf:"varint,2,opt,name=gear,proto3" json:"gear,omitempty"` Gear int32 `protobuf:"varint,2,opt,name=gear,proto3" json:"gear,omitempty"`
} }
@ -1860,11 +1860,11 @@ func (*KeyState) Descriptor() ([]byte, []int) {
return file_device_state_proto_rawDescGZIP(), []int{16} return file_device_state_proto_rawDescGZIP(), []int{16}
} }
func (x *KeyState) GetId() string { func (x *KeyState) GetId() uint32 {
if x != nil { if x != nil {
return x.Id return x.Id
} }
return "" return 0
} }
func (x *KeyState) GetGear() int32 { func (x *KeyState) GetGear() int32 {
@ -2292,16 +2292,16 @@ var file_device_state_proto_rawDesc = []byte{
0x0a, 0x12, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x65, 0x2e, 0x70, 0x0a, 0x12, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x65, 0x2e, 0x70,
0x72, 0x6f, 0x74, 0x6f, 0x12, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x22, 0x35, 0x0a, 0x09, 0x4c, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x22, 0x35, 0x0a, 0x09, 0x4c,
0x69, 0x6e, 0x6b, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x69, 0x6e, 0x6b, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01,
0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x74, 0x72, 0x61, 0x69, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x02, 0x69, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x74, 0x72, 0x61, 0x69,
0x6e, 0x49, 0x64, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x07, 0x74, 0x72, 0x61, 0x69, 0x6e, 0x6e, 0x49, 0x64, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x07, 0x74, 0x72, 0x61, 0x69, 0x6e,
0x49, 0x64, 0x22, 0x58, 0x0a, 0x0c, 0x53, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x49, 0x64, 0x22, 0x58, 0x0a, 0x0c, 0x53, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61,
0x74, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x74, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x02,
0x69, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x6f, 0x63, 0x63, 0x75, 0x70, 0x69, 0x65, 0x64, 0x18, 0x03, 0x69, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x6f, 0x63, 0x63, 0x75, 0x70, 0x69, 0x65, 0x64, 0x18, 0x03,
0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x6f, 0x63, 0x63, 0x75, 0x70, 0x69, 0x65, 0x64, 0x12, 0x1c, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x6f, 0x63, 0x63, 0x75, 0x70, 0x69, 0x65, 0x64, 0x12, 0x1c,
0x0a, 0x09, 0x61, 0x78, 0x6c, 0x65, 0x46, 0x61, 0x75, 0x6c, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0a, 0x09, 0x61, 0x78, 0x6c, 0x65, 0x46, 0x61, 0x75, 0x6c, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28,
0x08, 0x52, 0x09, 0x61, 0x78, 0x6c, 0x65, 0x46, 0x61, 0x75, 0x6c, 0x74, 0x22, 0xcf, 0x02, 0x0a, 0x08, 0x52, 0x09, 0x61, 0x78, 0x6c, 0x65, 0x46, 0x61, 0x75, 0x6c, 0x74, 0x22, 0xcf, 0x02, 0x0a,
0x0b, 0x53, 0x77, 0x69, 0x74, 0x63, 0x68, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x0b, 0x53, 0x77, 0x69, 0x74, 0x63, 0x68, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x0e, 0x0a, 0x02,
0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x02, 0x69, 0x64, 0x12, 0x16, 0x0a, 0x06,
0x6e, 0x6f, 0x72, 0x6d, 0x61, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x6e, 0x6f, 0x6e, 0x6f, 0x72, 0x6d, 0x61, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x6e, 0x6f,
0x72, 0x6d, 0x61, 0x6c, 0x12, 0x18, 0x0a, 0x07, 0x72, 0x65, 0x76, 0x65, 0x72, 0x73, 0x65, 0x18, 0x72, 0x6d, 0x61, 0x6c, 0x12, 0x18, 0x0a, 0x07, 0x72, 0x65, 0x76, 0x65, 0x72, 0x73, 0x65, 0x18,
0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x72, 0x65, 0x76, 0x65, 0x72, 0x73, 0x65, 0x12, 0x0e, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x72, 0x65, 0x76, 0x65, 0x72, 0x73, 0x65, 0x12, 0x0e,
@ -2322,7 +2322,7 @@ var file_device_state_proto_rawDesc = []byte{
0x79, 0x63, 0x12, 0x1a, 0x0a, 0x08, 0x6f, 0x63, 0x63, 0x75, 0x70, 0x69, 0x65, 0x64, 0x18, 0x11, 0x79, 0x63, 0x12, 0x1a, 0x0a, 0x08, 0x6f, 0x63, 0x63, 0x75, 0x70, 0x69, 0x65, 0x64, 0x18, 0x11,
0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x6f, 0x63, 0x63, 0x75, 0x70, 0x69, 0x65, 0x64, 0x22, 0x4b, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x6f, 0x63, 0x63, 0x75, 0x70, 0x69, 0x65, 0x64, 0x22, 0x4b,
0x0a, 0x0b, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x6c, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x0e, 0x0a, 0x0a, 0x0b, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x6c, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x0e, 0x0a,
0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x2c, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x02, 0x69, 0x64, 0x12, 0x2c, 0x0a,
0x06, 0x61, 0x73, 0x70, 0x65, 0x63, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x14, 0x2e, 0x06, 0x61, 0x73, 0x70, 0x65, 0x63, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x14, 0x2e,
0x73, 0x74, 0x61, 0x74, 0x65, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x6c, 0x2e, 0x41, 0x73, 0x70, 0x73, 0x74, 0x61, 0x74, 0x65, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x6c, 0x2e, 0x41, 0x73, 0x70,
0x65, 0x63, 0x74, 0x52, 0x06, 0x61, 0x73, 0x70, 0x65, 0x63, 0x74, 0x22, 0x4f, 0x0a, 0x06, 0x53, 0x65, 0x63, 0x74, 0x52, 0x06, 0x61, 0x73, 0x70, 0x65, 0x63, 0x74, 0x22, 0x4f, 0x0a, 0x06, 0x53,
@ -2332,7 +2332,7 @@ var file_device_state_proto_rawDesc = []byte{
0x05, 0x0a, 0x01, 0x55, 0x10, 0x04, 0x12, 0x06, 0x0a, 0x02, 0x48, 0x55, 0x10, 0x05, 0x12, 0x05, 0x05, 0x0a, 0x01, 0x55, 0x10, 0x04, 0x12, 0x06, 0x0a, 0x02, 0x48, 0x55, 0x10, 0x05, 0x12, 0x05,
0x0a, 0x01, 0x42, 0x10, 0x06, 0x12, 0x05, 0x0a, 0x01, 0x41, 0x10, 0x07, 0x22, 0x94, 0x01, 0x0a, 0x0a, 0x01, 0x42, 0x10, 0x06, 0x12, 0x05, 0x0a, 0x01, 0x41, 0x10, 0x07, 0x22, 0x94, 0x01, 0x0a,
0x0d, 0x50, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x0e, 0x0d, 0x50, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x0e,
0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12,
0x0a, 0x04, 0x65, 0x6d, 0x70, 0x6a, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x04, 0x65, 0x6d, 0x0a, 0x04, 0x65, 0x6d, 0x70, 0x6a, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x04, 0x65, 0x6d,
0x70, 0x6a, 0x12, 0x2f, 0x0a, 0x09, 0x73, 0x70, 0x6b, 0x73, 0x53, 0x74, 0x61, 0x74, 0x65, 0x18, 0x70, 0x6a, 0x12, 0x2f, 0x0a, 0x09, 0x73, 0x70, 0x6b, 0x73, 0x53, 0x74, 0x61, 0x74, 0x65, 0x18,
0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x73, 0x74, 0x61, 0x74, 0x65, 0x2e, 0x52, 0x65, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x73, 0x74, 0x61, 0x74, 0x65, 0x2e, 0x52, 0x65,
@ -2341,7 +2341,7 @@ var file_device_state_proto_rawDesc = []byte{
0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x73, 0x74, 0x61, 0x74, 0x65, 0x2e, 0x4d, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x73, 0x74, 0x61, 0x74, 0x65, 0x2e, 0x4d,
0x6b, 0x78, 0x4a, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x09, 0x6d, 0x6b, 0x78, 0x4a, 0x53, 0x74, 0x6b, 0x78, 0x4a, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x09, 0x6d, 0x6b, 0x78, 0x4a, 0x53, 0x74,
0x61, 0x74, 0x65, 0x22, 0x1e, 0x0a, 0x0c, 0x53, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x22, 0x1e, 0x0a, 0x0c, 0x53, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74,
0x61, 0x74, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x61, 0x74, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52,
0x02, 0x69, 0x64, 0x22, 0xad, 0x04, 0x0a, 0x0a, 0x54, 0x72, 0x61, 0x69, 0x6e, 0x53, 0x74, 0x61, 0x02, 0x69, 0x64, 0x22, 0xad, 0x04, 0x0a, 0x0a, 0x54, 0x72, 0x61, 0x69, 0x6e, 0x53, 0x74, 0x61,
0x74, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x74, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02,
0x69, 0x64, 0x12, 0x0e, 0x0a, 0x02, 0x75, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x02, 0x69, 0x64, 0x12, 0x0e, 0x0a, 0x02, 0x75, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x02,
@ -2351,7 +2351,7 @@ var file_device_state_proto_rawDesc = []byte{
0x72, 0x61, 0x69, 0x6e, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x12, 0x12, 0x0a, 0x04, 0x73, 0x68, 0x72, 0x61, 0x69, 0x6e, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x12, 0x12, 0x0a, 0x04, 0x73, 0x68,
0x6f, 0x77, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x04, 0x73, 0x68, 0x6f, 0x77, 0x12, 0x22, 0x6f, 0x77, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x04, 0x73, 0x68, 0x6f, 0x77, 0x12, 0x22,
0x0a, 0x0c, 0x68, 0x65, 0x61, 0x64, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x49, 0x64, 0x18, 0x06, 0x0a, 0x0c, 0x68, 0x65, 0x61, 0x64, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x49, 0x64, 0x18, 0x06,
0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x68, 0x65, 0x61, 0x64, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0c, 0x68, 0x65, 0x61, 0x64, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65,
0x49, 0x64, 0x12, 0x1e, 0x0a, 0x0a, 0x68, 0x65, 0x61, 0x64, 0x4f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x49, 0x64, 0x12, 0x1e, 0x0a, 0x0a, 0x68, 0x65, 0x61, 0x64, 0x4f, 0x66, 0x66, 0x73, 0x65, 0x74,
0x18, 0x07, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0a, 0x68, 0x65, 0x61, 0x64, 0x4f, 0x66, 0x66, 0x73, 0x18, 0x07, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0a, 0x68, 0x65, 0x61, 0x64, 0x4f, 0x66, 0x66, 0x73,
0x65, 0x74, 0x12, 0x1e, 0x0a, 0x0a, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x50, 0x6f, 0x72, 0x74, 0x65, 0x74, 0x12, 0x1e, 0x0a, 0x0a, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x50, 0x6f, 0x72, 0x74,
@ -2496,22 +2496,22 @@ var file_device_state_proto_rawDesc = []byte{
0x64, 0x61, 0x74, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x18, 0x1a, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0a, 0x64, 0x61, 0x74, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x18, 0x1a, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0a,
0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x22, 0x40, 0x0a, 0x0a, 0x52, 0x65, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x22, 0x40, 0x0a, 0x0a, 0x52, 0x65,
0x70, 0x6c, 0x79, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x70, 0x6c, 0x79, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01,
0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x0e, 0x0a, 0x02, 0x78, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x02, 0x69, 0x64, 0x12, 0x0e, 0x0a, 0x02, 0x78, 0x68, 0x18, 0x02,
0x20, 0x01, 0x28, 0x08, 0x52, 0x02, 0x78, 0x68, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x20, 0x01, 0x28, 0x08, 0x52, 0x02, 0x78, 0x68, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x6f, 0x64, 0x65,
0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x22, 0x49, 0x0a, 0x0b, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x22, 0x49, 0x0a, 0x0b,
0x42, 0x75, 0x74, 0x74, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x42, 0x75, 0x74, 0x74, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69,
0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x64, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x64,
0x6f, 0x77, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x04, 0x64, 0x6f, 0x77, 0x6e, 0x12, 0x6f, 0x77, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x04, 0x64, 0x6f, 0x77, 0x6e, 0x12,
0x16, 0x0a, 0x06, 0x61, 0x63, 0x74, 0x69, 0x76, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x16, 0x0a, 0x06, 0x61, 0x63, 0x74, 0x69, 0x76, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52,
0x06, 0x61, 0x63, 0x74, 0x69, 0x76, 0x65, 0x22, 0x34, 0x0a, 0x0a, 0x41, 0x6c, 0x61, 0x72, 0x6d, 0x06, 0x61, 0x63, 0x74, 0x69, 0x76, 0x65, 0x22, 0x34, 0x0a, 0x0a, 0x41, 0x6c, 0x61, 0x72, 0x6d,
0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28,
0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x61, 0x63, 0x74, 0x69, 0x76, 0x65, 0x18, 0x0d, 0x52, 0x02, 0x69, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x61, 0x63, 0x74, 0x69, 0x76, 0x65, 0x18,
0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x61, 0x63, 0x74, 0x69, 0x76, 0x65, 0x22, 0x34, 0x0a, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x61, 0x63, 0x74, 0x69, 0x76, 0x65, 0x22, 0x34, 0x0a,
0x0a, 0x4c, 0x69, 0x67, 0x68, 0x74, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x0a, 0x4c, 0x69, 0x67, 0x68, 0x74, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69,
0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x61, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x02, 0x69, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x61,
0x63, 0x74, 0x69, 0x76, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x61, 0x63, 0x74, 0x63, 0x74, 0x69, 0x76, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x61, 0x63, 0x74,
0x69, 0x76, 0x65, 0x22, 0x5b, 0x0a, 0x08, 0x50, 0x73, 0x64, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x69, 0x76, 0x65, 0x22, 0x5b, 0x0a, 0x08, 0x50, 0x73, 0x64, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12,
0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x02, 0x69, 0x64, 0x12,
0x2d, 0x0a, 0x09, 0x61, 0x73, 0x64, 0x53, 0x74, 0x61, 0x74, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x2d, 0x0a, 0x09, 0x61, 0x73, 0x64, 0x53, 0x74, 0x61, 0x74, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03,
0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x73, 0x74, 0x61, 0x74, 0x65, 0x2e, 0x41, 0x73, 0x64, 0x53, 0x74, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x73, 0x74, 0x61, 0x74, 0x65, 0x2e, 0x41, 0x73, 0x64, 0x53, 0x74,
0x61, 0x74, 0x65, 0x52, 0x09, 0x61, 0x73, 0x64, 0x53, 0x74, 0x61, 0x74, 0x65, 0x73, 0x12, 0x10, 0x61, 0x74, 0x65, 0x52, 0x09, 0x61, 0x73, 0x64, 0x53, 0x74, 0x61, 0x74, 0x65, 0x73, 0x12, 0x10,
@ -2523,7 +2523,7 @@ var file_device_state_proto_rawDesc = []byte{
0x28, 0x08, 0x52, 0x04, 0x67, 0x6d, 0x64, 0x77, 0x12, 0x10, 0x0a, 0x03, 0x6d, 0x67, 0x6a, 0x18, 0x28, 0x08, 0x52, 0x04, 0x67, 0x6d, 0x64, 0x77, 0x12, 0x10, 0x0a, 0x03, 0x6d, 0x67, 0x6a, 0x18,
0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x03, 0x6d, 0x67, 0x6a, 0x22, 0x2e, 0x0a, 0x08, 0x4b, 0x65, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x03, 0x6d, 0x67, 0x6a, 0x22, 0x2e, 0x0a, 0x08, 0x4b, 0x65,
0x79, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x79, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01,
0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x67, 0x65, 0x61, 0x72, 0x18, 0x02, 0x28, 0x0d, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x67, 0x65, 0x61, 0x72, 0x18, 0x02,
0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x67, 0x65, 0x61, 0x72, 0x22, 0x52, 0x0a, 0x09, 0x4d, 0x6b, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x67, 0x65, 0x61, 0x72, 0x22, 0x52, 0x0a, 0x09, 0x4d, 0x6b,
0x78, 0x4a, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x78, 0x4a, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x18,
0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x12, 0x31, 0x0a, 0x0a, 0x72, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x12, 0x31, 0x0a, 0x0a, 0x72,

View File

@ -8,13 +8,13 @@ import (
) )
// 操作IBP按钮 // 操作IBP按钮
func ChangeIBPButtonState(sim *VerifySimulation, mapId int32, stationId, btnId string, pressDown bool) error { func ChangeIBPButtonState(sim *VerifySimulation, mapId int32, stationId, btnId uint32, pressDown bool) error {
uidMap, err := getIbpUidByMapIdAndStationId(mapId, stationId) uidMap, err := getIbpUidByMapIdAndStationId(mapId, stationId)
if err != nil { if err != nil {
return err return err
} }
if uidMap.IbpButtonIds[btnId] == nil { if uidMap.IbpButtonIds[btnId] == nil {
return fmt.Errorf("车站【%s】按钮【%s】UID不存在", stationId, btnId) return fmt.Errorf("车站【%d】按钮【%d】UID不存在", stationId, btnId)
} }
stationUid := QueryUidByMidAndComId(mapId, stationId, &graphicData.Station{}) stationUid := QueryUidByMidAndComId(mapId, stationId, &graphicData.Station{})
if pressDown { if pressDown {
@ -25,20 +25,20 @@ func ChangeIBPButtonState(sim *VerifySimulation, mapId int32, stationId, btnId s
} }
// 操作IBP按钮 // 操作IBP按钮
func ChangeIBPKeyState(sim *VerifySimulation, mapId int32, stationId, keyId string, gear int32) error { func ChangeIBPKeyState(sim *VerifySimulation, mapId int32, stationId, keyId uint32, gear int32) error {
uidMap, err := getIbpUidByMapIdAndStationId(mapId, stationId) uidMap, err := getIbpUidByMapIdAndStationId(mapId, stationId)
if err != nil { if err != nil {
return err return err
} }
if uidMap.IbpKeyIds[keyId] == nil { if uidMap.IbpKeyIds[keyId] == nil {
return fmt.Errorf("车站【%s】钥匙【%s】UID不存在", stationId, keyId) return fmt.Errorf("车站【%d】钥匙【%d】UID不存在", stationId, keyId)
} }
stationUid := QueryUidByMidAndComId(mapId, stationId, &graphicData.Station{}) stationUid := QueryUidByMidAndComId(mapId, stationId, &graphicData.Station{})
return fi.SwitchKeyGear(sim.World, stationUid+"_"+uidMap.IbpKeyIds[keyId].Uid, gear) return fi.SwitchKeyGear(sim.World, stationUid+"_"+uidMap.IbpKeyIds[keyId].Uid, gear)
} }
// 根据平面布置图ID、列车ID获取IbpUid信息 // 根据平面布置图ID、列车ID获取IbpUid信息
func getIbpUidByMapIdAndStationId(mapId int32, stationId string) (*IBPUidStructure, error) { func getIbpUidByMapIdAndStationId(mapId int32, stationId uint32) (*IBPUidStructure, error) {
giData := QueryGiData[*graphicData.RtssGraphicStorage](mapId) giData := QueryGiData[*graphicData.RtssGraphicStorage](mapId)
var station *graphicData.Station var station *graphicData.Station
for _, s := range giData.Stations { for _, s := range giData.Stations {
@ -48,7 +48,7 @@ func getIbpUidByMapIdAndStationId(mapId int32, stationId string) (*IBPUidStructu
} }
} }
if station == nil { if station == nil {
return nil, fmt.Errorf("地图【%d】车站【%s】不存在", mapId, stationId) return nil, fmt.Errorf("地图【%d】车站【%d】不存在", mapId, stationId)
} }
if station.RefIbpMapCode == "" { if station.RefIbpMapCode == "" {

View File

@ -3,6 +3,7 @@ package memory
import ( import (
"fmt" "fmt"
"log/slog" "log/slog"
"strconv"
"strings" "strings"
"sync" "sync"
@ -15,39 +16,37 @@ import (
var giUidMap sync.Map var giUidMap sync.Map
type elementIdStructure struct { type elementIdStructure struct {
CommonId string CommonId uint32
Id uint32
Code string Code string
Uid string Uid string
} }
// 数组为Index为 common.ButtonCode, index, uid // 数组为Index为 common.ButtonCode, index, uid
type StationUidStructure struct { type StationUidStructure struct {
AxlePointIds map[string]*elementIdStructure AxlePointIds map[uint32]*elementIdStructure
TurnoutIds map[string]*elementIdStructure TurnoutIds map[uint32]*elementIdStructure
PhysicalSectionIds map[string]*elementIdStructure PhysicalSectionIds map[uint32]*elementIdStructure
SignalIds map[string]*elementIdStructure SignalIds map[uint32]*elementIdStructure
TransponderIds map[string]*elementIdStructure TransponderIds map[uint32]*elementIdStructure
SlopeIds map[string]*elementIdStructure SlopeIds map[uint32]*elementIdStructure
CurvatureIds map[string]*elementIdStructure CurvatureIds map[uint32]*elementIdStructure
ButtonIds map[string]*elementIdStructure ButtonIds map[uint32]*elementIdStructure
StationIds map[string]*elementIdStructure StationIds map[uint32]*elementIdStructure
PlatformIds map[string]*elementIdStructure PlatformIds map[uint32]*elementIdStructure
PsdIds map[string]*elementIdStructure PsdIds map[uint32]*elementIdStructure
GateBoxIds map[string]*elementIdStructure GateBoxIds map[uint32]*elementIdStructure
SpksSwitchIds map[string]*elementIdStructure SpksSwitchIds map[uint32]*elementIdStructure
} }
type RelayUidStructure struct { type RelayUidStructure struct {
RelayCabinetIds map[string]*elementIdStructure RelayIds map[uint32]*elementIdStructure
RelayIds map[string]*elementIdStructure
} }
type IBPUidStructure struct { type IBPUidStructure struct {
IbpButtonIds map[string]*elementIdStructure IbpButtonIds map[uint32]*elementIdStructure
IbpAlarmIds map[string]*elementIdStructure IbpAlarmIds map[uint32]*elementIdStructure
IbpKeyIds map[string]*elementIdStructure IbpKeyIds map[uint32]*elementIdStructure
IbpLightIds map[string]*elementIdStructure IbpLightIds map[uint32]*elementIdStructure
} }
// 获取继电器的关联关系 // 获取继电器的关联关系
@ -59,31 +58,37 @@ type deviceRelateUidPriex struct {
} }
// 获取地图元素ID // 获取地图元素ID
func GetMapElementId(common *graphicData.CommonInfo) string { func GetMapElementId(common *graphicData.CommonInfo) uint32 {
return common.Id if common.Id != 0 {
return common.Id
}
if common.Oldid != "" {
id, _ := strconv.Atoi(common.Oldid)
return uint32(id)
}
panic(sys_error.New("元素缺少主键"))
} }
func getMapELementCode(code ...string) string { func getMapELementCode(id uint32, code ...string) string {
for _, c := range code { for _, c := range code {
if c != "" { if c != "" {
return c return c
} }
} }
panic(sys_error.New("传入Code至少一个不为空")) return strconv.Itoa(int(id))
} }
// 获取关联的车站名 // 获取关联的车站名
func handleRefStationName(stationMap map[string]*graphicData.Station, sid []string) []string { func handleRefStationName(stationMap map[uint32]*graphicData.Station, sid []uint32) []string {
var stationNames []string var stationNames []string
for _, id := range sid { for _, id := range sid {
if id == "" { if id == 0 {
continue continue
} }
stationName := id if stationMap[id] == nil {
if stationMap[id] != nil { continue
stationName = stationMap[id].StationName
} }
stationNames = append(stationNames, stationName) stationNames = append(stationNames, stationMap[id].StationName)
} }
return stationNames return stationNames
} }
@ -108,7 +113,7 @@ func getUIdPrefix(prefix interface{}) (string, string, string) {
// 过滤掉其他线路的设备 // 过滤掉其他线路的设备
func filterOtherLineDevice(data *graphicData.RtssGraphicStorage) { func filterOtherLineDevice(data *graphicData.RtssGraphicStorage) {
otherDeviceIdMap := make(map[string]bool) otherDeviceIdMap := make(map[uint32]bool)
for _, ods := range data.OtherLineList { for _, ods := range data.OtherLineList {
for _, id := range ods.Ids { for _, id := range ods.Ids {
otherDeviceIdMap[id] = true otherDeviceIdMap[id] = true
@ -137,7 +142,7 @@ func filterOtherLineDevice(data *graphicData.RtssGraphicStorage) {
d.PbRef = nil d.PbRef = nil
slog.Warn("区段[id:%v][code:%s]设备B端是其他线路设备已置空", did, d.Code) slog.Warn("区段[id:%v][code:%s]设备B端是其他线路设备已置空", did, d.Code)
} }
var acs []string var acs []uint32
for _, id := range d.AxleCountings { for _, id := range d.AxleCountings {
if otherDeviceIdMap[id] { if otherDeviceIdMap[id] {
continue continue
@ -146,7 +151,7 @@ func filterOtherLineDevice(data *graphicData.RtssGraphicStorage) {
} }
d.AxleCountings = acs d.AxleCountings = acs
if otherDeviceIdMap[d.TrackSectionId] { if otherDeviceIdMap[d.TrackSectionId] {
d.TrackSectionId = "" d.TrackSectionId = 0
} }
sections = append(sections, d) sections = append(sections, d)
} }
@ -190,14 +195,14 @@ func filterOtherLineDevice(data *graphicData.RtssGraphicStorage) {
d.PcRef = nil d.PcRef = nil
slog.Warn("道岔[id:%v][code:%s]设备C端是其他线路设备已置空", did, d.Code) slog.Warn("道岔[id:%v][code:%s]设备C端是其他线路设备已置空", did, d.Code)
} }
if d.PaTrackSectionId != "" && otherDeviceIdMap[d.PaTrackSectionId] { if d.PaTrackSectionId != 0 && otherDeviceIdMap[d.PaTrackSectionId] {
d.PaTrackSectionId = "" d.PaTrackSectionId = 0
} }
if d.PbTrackSectionId != "" && otherDeviceIdMap[d.PbTrackSectionId] { if d.PbTrackSectionId != 0 && otherDeviceIdMap[d.PbTrackSectionId] {
d.PbTrackSectionId = "" d.PbTrackSectionId = 0
} }
if d.PcTrackSectionId != "" && otherDeviceIdMap[d.PcTrackSectionId] { if d.PcTrackSectionId != 0 && otherDeviceIdMap[d.PcTrackSectionId] {
d.PcTrackSectionId = "" d.PcTrackSectionId = 0
} }
turnouts = append(turnouts, d) turnouts = append(turnouts, d)
} }
@ -229,25 +234,26 @@ func filterOtherLineDevice(data *graphicData.RtssGraphicStorage) {
// 初始化平面布置图 UID // 初始化平面布置图 UID
func initStationUid(data *graphicData.RtssGraphicStorage) *StationUidStructure { func initStationUid(data *graphicData.RtssGraphicStorage) *StationUidStructure {
gus := &StationUidStructure{ gus := &StationUidStructure{
AxlePointIds: make(map[string]*elementIdStructure, len(data.AxleCountings)), AxlePointIds: make(map[uint32]*elementIdStructure, len(data.AxleCountings)),
TurnoutIds: make(map[string]*elementIdStructure, len(data.Turnouts)), TurnoutIds: make(map[uint32]*elementIdStructure, len(data.Turnouts)),
PhysicalSectionIds: make(map[string]*elementIdStructure, len(data.Section)), PhysicalSectionIds: make(map[uint32]*elementIdStructure, len(data.Section)),
SignalIds: make(map[string]*elementIdStructure, len(data.Signals)), SignalIds: make(map[uint32]*elementIdStructure, len(data.Signals)),
TransponderIds: make(map[string]*elementIdStructure, len(data.Transponders)), TransponderIds: make(map[uint32]*elementIdStructure, len(data.Transponders)),
SlopeIds: make(map[string]*elementIdStructure, len(data.Slopes)), SlopeIds: make(map[uint32]*elementIdStructure, len(data.Slopes)),
CurvatureIds: make(map[string]*elementIdStructure, len(data.Curvatures)), CurvatureIds: make(map[uint32]*elementIdStructure, len(data.Curvatures)),
ButtonIds: make(map[string]*elementIdStructure, len(data.EsbButtons)), ButtonIds: make(map[uint32]*elementIdStructure, len(data.EsbButtons)),
StationIds: make(map[string]*elementIdStructure, len(data.Stations)), StationIds: make(map[uint32]*elementIdStructure, len(data.Stations)),
PlatformIds: make(map[string]*elementIdStructure, len(data.Platforms)), PlatformIds: make(map[uint32]*elementIdStructure, len(data.Platforms)),
PsdIds: make(map[string]*elementIdStructure, len(data.ScreenDoors)), PsdIds: make(map[uint32]*elementIdStructure, len(data.ScreenDoors)),
GateBoxIds: make(map[string]*elementIdStructure, len(data.GateBoxs)), GateBoxIds: make(map[uint32]*elementIdStructure, len(data.GateBoxs)),
SpksSwitchIds: make(map[string]*elementIdStructure, len(data.SpksSwitchs)), SpksSwitchIds: make(map[uint32]*elementIdStructure, len(data.SpksSwitchs)),
} }
city, lineId, _ := getUIdPrefix(data.UniqueIdPrefix) city, lineId, _ := getUIdPrefix(data.UniqueIdPrefix)
// 处理车站信息 // 处理车站信息
stationMap := make(map[string]*graphicData.Station) stationMap := make(map[uint32]*graphicData.Station)
for _, s := range data.Stations { for _, s := range data.Stations {
eid, stationName := GetMapElementId(s.Common), getMapELementCode(s.StationName, s.Code) eid := GetMapElementId(s.Common)
stationName := getMapELementCode(eid, s.StationName, s.Code)
stationMap[eid] = s stationMap[eid] = s
gus.StationIds[eid] = &elementIdStructure{ gus.StationIds[eid] = &elementIdStructure{
CommonId: eid, CommonId: eid,
@ -258,7 +264,7 @@ func initStationUid(data *graphicData.RtssGraphicStorage) *StationUidStructure {
// 初始化计轴信息 // 初始化计轴信息
for _, a := range data.AxleCountings { for _, a := range data.AxleCountings {
eid := GetMapElementId(a.Common) eid := GetMapElementId(a.Common)
code := getMapELementCode(a.Code, eid) code := getMapELementCode(eid, a.Code)
stationNames := handleRefStationName(stationMap, a.CentralizedStations) stationNames := handleRefStationName(stationMap, a.CentralizedStations)
gus.AxlePointIds[eid] = &elementIdStructure{ gus.AxlePointIds[eid] = &elementIdStructure{
CommonId: eid, CommonId: eid,
@ -269,7 +275,7 @@ func initStationUid(data *graphicData.RtssGraphicStorage) *StationUidStructure {
// 初始化道岔信息 // 初始化道岔信息
for _, t := range data.Turnouts { for _, t := range data.Turnouts {
eid := GetMapElementId(t.Common) eid := GetMapElementId(t.Common)
code := getMapELementCode(t.Code, eid) code := getMapELementCode(eid, t.Code)
stationNames := handleRefStationName(stationMap, t.CentralizedStations) stationNames := handleRefStationName(stationMap, t.CentralizedStations)
gus.TurnoutIds[eid] = &elementIdStructure{ gus.TurnoutIds[eid] = &elementIdStructure{
CommonId: eid, CommonId: eid,
@ -280,7 +286,7 @@ func initStationUid(data *graphicData.RtssGraphicStorage) *StationUidStructure {
// 初始化物理区段信息 // 初始化物理区段信息
for _, s := range data.Section { for _, s := range data.Section {
eid := GetMapElementId(s.Common) eid := GetMapElementId(s.Common)
code := getMapELementCode(s.Code, eid) code := getMapELementCode(eid, s.Code)
stationNames := handleRefStationName(stationMap, s.CentralizedStations) stationNames := handleRefStationName(stationMap, s.CentralizedStations)
gus.PhysicalSectionIds[eid] = &elementIdStructure{ gus.PhysicalSectionIds[eid] = &elementIdStructure{
CommonId: eid, CommonId: eid,
@ -291,7 +297,7 @@ func initStationUid(data *graphicData.RtssGraphicStorage) *StationUidStructure {
// 初始化信号机信息 // 初始化信号机信息
for _, s := range data.Signals { for _, s := range data.Signals {
eid := GetMapElementId(s.Common) eid := GetMapElementId(s.Common)
code := getMapELementCode(s.Code, eid) code := getMapELementCode(eid, s.Code)
stationNames := handleRefStationName(stationMap, s.CentralizedStations) stationNames := handleRefStationName(stationMap, s.CentralizedStations)
gus.SignalIds[eid] = &elementIdStructure{ gus.SignalIds[eid] = &elementIdStructure{
CommonId: eid, CommonId: eid,
@ -302,7 +308,7 @@ func initStationUid(data *graphicData.RtssGraphicStorage) *StationUidStructure {
// 初始化应答器 // 初始化应答器
for _, t := range data.Transponders { for _, t := range data.Transponders {
eid := GetMapElementId(t.Common) eid := GetMapElementId(t.Common)
code := getMapELementCode(t.Code, eid) code := getMapELementCode(eid, t.Code)
stationNames := handleRefStationName(stationMap, t.CentralizedStations) stationNames := handleRefStationName(stationMap, t.CentralizedStations)
gus.TransponderIds[eid] = &elementIdStructure{ gus.TransponderIds[eid] = &elementIdStructure{
CommonId: eid, CommonId: eid,
@ -315,7 +321,7 @@ func initStationUid(data *graphicData.RtssGraphicStorage) *StationUidStructure {
eid := GetMapElementId(s.Common) eid := GetMapElementId(s.Common)
gus.SlopeIds[eid] = &elementIdStructure{ gus.SlopeIds[eid] = &elementIdStructure{
CommonId: eid, CommonId: eid,
Uid: GenerateElementUid(city, lineId, nil, eid), Uid: GenerateElementUid(city, lineId, nil, strconv.Itoa(int(eid))),
} }
} }
// 初始化曲线 // 初始化曲线
@ -323,11 +329,11 @@ func initStationUid(data *graphicData.RtssGraphicStorage) *StationUidStructure {
eid := GetMapElementId(c.Common) eid := GetMapElementId(c.Common)
gus.CurvatureIds[eid] = &elementIdStructure{ gus.CurvatureIds[eid] = &elementIdStructure{
CommonId: eid, CommonId: eid,
Uid: GenerateElementUid(city, lineId, nil, eid), Uid: GenerateElementUid(city, lineId, nil, strconv.Itoa(int(eid))),
} }
} }
//处理车站关联的组合信息 //处理车站关联的组合信息
refMap := make(map[string]*deviceRelateUidPriex) refMap := make(map[uint32]*deviceRelateUidPriex)
for _, s := range data.StationRelateDeviceList { for _, s := range data.StationRelateDeviceList {
for _, c := range s.Combinationtypes { for _, c := range s.Combinationtypes {
p := &deviceRelateUidPriex{deviceCode: s.Code, typeCode: c.Code} p := &deviceRelateUidPriex{deviceCode: s.Code, typeCode: c.Code}
@ -351,7 +357,7 @@ func initStationUid(data *graphicData.RtssGraphicStorage) *StationUidStructure {
} }
} }
// 站台 // 站台
platformMap := make(map[string]*graphicData.Platform) platformMap := make(map[uint32]*graphicData.Platform)
for _, platform := range data.Platforms { for _, platform := range data.Platforms {
eid := GetMapElementId(platform.Common) eid := GetMapElementId(platform.Common)
platformMap[eid] = platform platformMap[eid] = platform
@ -362,7 +368,7 @@ func initStationUid(data *graphicData.RtssGraphicStorage) *StationUidStructure {
} }
} }
// 屏蔽门 // 屏蔽门
psd_station_map := make(map[string]string) psd_station_map := make(map[uint32]string)
for _, door := range data.ScreenDoors { for _, door := range data.ScreenDoors {
station := stationMap[platformMap[door.RefPlatformId].GetRefStationId()] station := stationMap[platformMap[door.RefPlatformId].GetRefStationId()]
if station == nil { //线路数据有问题 if station == nil { //线路数据有问题
@ -388,7 +394,7 @@ func initStationUid(data *graphicData.RtssGraphicStorage) *StationUidStructure {
} }
// SPKS人员防护 // SPKS人员防护
for _, spk := range data.SpksSwitchs { for _, spk := range data.SpksSwitchs {
if spk.RefStand == "" { if spk.RefStand == 0 {
continue continue
} }
platform := platformMap[spk.RefStand] platform := platformMap[spk.RefStand]
@ -412,11 +418,10 @@ func initStationUid(data *graphicData.RtssGraphicStorage) *StationUidStructure {
// 初始化继电器柜 UID // 初始化继电器柜 UID
func initRelayCabinetUid(data *graphicData.RelayCabinetGraphicStorage) *RelayUidStructure { func initRelayCabinetUid(data *graphicData.RelayCabinetGraphicStorage) *RelayUidStructure {
rus := &RelayUidStructure{ rus := &RelayUidStructure{
RelayCabinetIds: make(map[string]*elementIdStructure, len(data.RelayCabinets)), RelayIds: make(map[uint32]*elementIdStructure, len(data.Relays)),
RelayIds: make(map[string]*elementIdStructure, len(data.Relays)),
} }
// 继电器所属设备 // 继电器所属设备
refMap := make(map[string]*deviceRelateUidPriex, len(data.Relays)) refMap := make(map[uint32]*deviceRelateUidPriex, len(data.Relays))
for _, r := range data.DeviceRelateRelayList { for _, r := range data.DeviceRelateRelayList {
isStation := r.DeviceType == graphicData.RelatedRef_station isStation := r.DeviceType == graphicData.RelatedRef_station
isPsd := r.DeviceType == graphicData.RelatedRef_ScreenDoor isPsd := r.DeviceType == graphicData.RelatedRef_ScreenDoor
@ -429,14 +434,6 @@ func initRelayCabinetUid(data *graphicData.RelayCabinetGraphicStorage) *RelayUid
} }
// 获取公共前缀 // 获取公共前缀
city, lineId, station := getUIdPrefix(data.UniqueIdPrefix) city, lineId, station := getUIdPrefix(data.UniqueIdPrefix)
for _, r := range data.RelayCabinets {
eid := GetMapElementId(r.Common)
rus.RelayCabinetIds[eid] = &elementIdStructure{
CommonId: eid,
Code: r.Code,
Uid: GenerateElementUid(city, lineId, []string{station}, eid),
}
}
// city+line+车站+设备code+继电器组合的code+继电器的code // city+line+车站+设备code+继电器组合的code+继电器的code
for _, r := range data.Relays { for _, r := range data.Relays {
eid := GetMapElementId(r.Common) eid := GetMapElementId(r.Common)
@ -478,21 +475,21 @@ func initRelayCabinetUid(data *graphicData.RelayCabinetGraphicStorage) *RelayUid
// 初始化IBP地图UID // 初始化IBP地图UID
func initIBPUid(data *graphicData.IBPGraphicStorage) *IBPUidStructure { func initIBPUid(data *graphicData.IBPGraphicStorage) *IBPUidStructure {
rus := &IBPUidStructure{ rus := &IBPUidStructure{
IbpButtonIds: make(map[string]*elementIdStructure), IbpButtonIds: make(map[uint32]*elementIdStructure),
IbpAlarmIds: make(map[string]*elementIdStructure), IbpAlarmIds: make(map[uint32]*elementIdStructure),
IbpKeyIds: make(map[string]*elementIdStructure), IbpKeyIds: make(map[uint32]*elementIdStructure),
IbpLightIds: make(map[string]*elementIdStructure), IbpLightIds: make(map[uint32]*elementIdStructure),
} }
//处理继电器关联信息 //处理继电器关联信息
refMap := make(map[string]string) refMap := make(map[uint32]string)
for _, s := range data.IbpRelatedDevices { for _, s := range data.IbpRelatedDevices {
for _, c := range s.Combinationtypes { for _, c := range s.Combinationtypes {
for _, i := range c.RefDevices { for _, i := range c.RefDevices {
refMap[i] = c.Code refMap[uint32(i)] = c.Code
} }
} }
} }
codeFun := func(id, code string) string { codeFun := func(id uint32, code string) string {
if refMap[id] != "" { if refMap[id] != "" {
return refMap[id] + "_" + code return refMap[id] + "_" + code
} else { } else {
@ -544,7 +541,7 @@ func buildRepositoryAllUidsMap(mapIds []int32, repo *repository.Repository) map[
len(repo.TurnoutList()) + len(repo.ResponderList()) + len(repo.SlopeList()) + len(repo.TurnoutList()) + len(repo.ResponderList()) + len(repo.SlopeList()) +
len(repo.SectionalCurvatureList()) len(repo.SectionalCurvatureList())
allUidMap := make(map[string]*elementIdStructure, mapLen) allUidMap := make(map[string]*elementIdStructure, mapLen)
saveToAllUidMap := func(es map[string]*elementIdStructure) { saveToAllUidMap := func(es map[uint32]*elementIdStructure) {
for _, e := range es { for _, e := range es {
allUidMap[e.Uid] = e allUidMap[e.Uid] = e
} }
@ -581,7 +578,7 @@ func QueryUidStructure[T *StationUidStructure | *RelayUidStructure | *IBPUidStru
} }
// 获取设备类型获取对应字段 // 获取设备类型获取对应字段
func getUidMapByType(uidData any, m interface{}) map[string]*elementIdStructure { func getUidMapByType(uidData any, m interface{}) map[uint32]*elementIdStructure {
switch m.(type) { switch m.(type) {
case *graphicData.AxleCounting: case *graphicData.AxleCounting:
return (uidData.(*StationUidStructure)).AxlePointIds return (uidData.(*StationUidStructure)).AxlePointIds
@ -597,8 +594,6 @@ func getUidMapByType(uidData any, m interface{}) map[string]*elementIdStructure
return (uidData.(*StationUidStructure)).SlopeIds return (uidData.(*StationUidStructure)).SlopeIds
case *graphicData.Curvature: case *graphicData.Curvature:
return (uidData.(*StationUidStructure)).CurvatureIds return (uidData.(*StationUidStructure)).CurvatureIds
case *graphicData.RelayCabinet:
return (uidData.(*RelayUidStructure)).RelayCabinetIds
case *graphicData.Relay: case *graphicData.Relay:
return (uidData.(*RelayUidStructure)).RelayIds return (uidData.(*RelayUidStructure)).RelayIds
case *graphicData.EsbButton: case *graphicData.EsbButton:
@ -615,7 +610,7 @@ func getUidMapByType(uidData any, m interface{}) map[string]*elementIdStructure
} }
// 根据地图ID跟设备类型获取UID集合 // 根据地图ID跟设备类型获取UID集合
func QueryMapUidMapByType(mapId int32, m interface{}) map[string]*elementIdStructure { func QueryMapUidMapByType(mapId int32, m interface{}) map[uint32]*elementIdStructure {
uidData, ok := giUidMap.Load(mapId) uidData, ok := giUidMap.Load(mapId)
if !ok { if !ok {
panic(&dto.ErrorDto{Code: dto.DataNotExist, Message: fmt.Sprintf("地图【id:%d】不存在uid缓存", mapId)}) panic(&dto.ErrorDto{Code: dto.DataNotExist, Message: fmt.Sprintf("地图【id:%d】不存在uid缓存", mapId)})
@ -624,10 +619,10 @@ func QueryMapUidMapByType(mapId int32, m interface{}) map[string]*elementIdStruc
} }
// 根据地图的comId获取UID // 根据地图的comId获取UID
func QueryUidByMidAndComId(mapId int32, comId string, m interface{}) string { func QueryUidByMidAndComId(mapId int32, comId uint32, m interface{}) string {
uidMap := QueryMapUidMapByType(mapId, m) uidMap := QueryMapUidMapByType(mapId, m)
if uidMap[comId] != nil { if uidMap[comId] != nil {
return uidMap[comId].Uid return uidMap[comId].Uid
} }
panic(&dto.ErrorDto{Code: dto.DataNotExist, Message: fmt.Sprintf("地图【id:%d】不存在【comId:%s】缓存", mapId, comId)}) panic(&dto.ErrorDto{Code: dto.DataNotExist, Message: fmt.Sprintf("地图【id:%d】不存在【comId:%d】缓存", mapId, comId)})
} }

View File

@ -5,7 +5,7 @@ import (
) )
// 操作PSL按钮 // 操作PSL按钮
func ChangePSLButtonState(sim *VerifySimulation, mapId int32, gateBoxId, btnCode string, pressDown bool) { func ChangePSLButtonState(sim *VerifySimulation, mapId int32, gateBoxId uint32, btnCode string, pressDown bool) {
uid := QueryUidStructure[*StationUidStructure](mapId) uid := QueryUidStructure[*StationUidStructure](mapId)
gateBoxUid := uid.GateBoxIds[gateBoxId].Uid gateBoxUid := uid.GateBoxIds[gateBoxId].Uid
if pressDown { if pressDown {

View File

@ -6,7 +6,7 @@ import (
) )
// 继电器操作方法 // 继电器操作方法
func ChangeRelayState(sim *VerifySimulation, mapId int32, id string, td bool) error { func ChangeRelayState(sim *VerifySimulation, mapId int32, id uint32, td bool) error {
uid := QueryUidByMidAndComId(mapId, id, &graphicData.Relay{}) uid := QueryUidByMidAndComId(mapId, id, &graphicData.Relay{})
if td { if td {
return fi.DriveRelayUp(sim.World, uid) return fi.DriveRelayUp(sim.World, uid)

View File

@ -1,15 +1,15 @@
package memory package memory
import ( import (
"log/slog"
"joylink.club/bj-rtsts-server/dto" "joylink.club/bj-rtsts-server/dto"
"joylink.club/bj-rtsts-server/dto/request_proto" "joylink.club/bj-rtsts-server/dto/request_proto"
"joylink.club/bj-rtsts-server/ts/protos/graphicData" "joylink.club/bj-rtsts-server/ts/protos/graphicData"
"joylink.club/rtsssimulation/fi" "joylink.club/rtsssimulation/fi"
"log/slog"
) )
func ChangeAxleSectionState(simulation *VerifySimulation, req *dto.AxleSectionOperationReqDto) error { func ChangeAxleSectionState(simulation *VerifySimulation, req *dto.AxleSectionOperationReqDto) error {
sectionUid := QueryUidByMidAndComId(req.MapId, req.DeviceId, &graphicData.Section{}) sectionUid := QueryUidByMidAndComId(req.MapId, req.DeviceId, &graphicData.Section{})
slog.Debug("操作计轴区段", "axleSectionUid", sectionUid) slog.Debug("操作计轴区段", "axleSectionUid", sectionUid)
if req.TrainIn { if req.TrainIn {
@ -18,7 +18,6 @@ func ChangeAxleSectionState(simulation *VerifySimulation, req *dto.AxleSectionOp
if req.TrainOut { if req.TrainOut {
return fi.AxleSectionTrainDrive(simulation.World, sectionUid, false) return fi.AxleSectionTrainDrive(simulation.World, sectionUid, false)
} }
//
switch req.Operation { switch req.Operation {
case request_proto.Section_CancelDrst: case request_proto.Section_CancelDrst:
return fi.AxleSectionDrstDrive(simulation.World, sectionUid, false) return fi.AxleSectionDrstDrive(simulation.World, sectionUid, false)

View File

@ -6,7 +6,7 @@ import (
) )
// 操作esb按钮 // 操作esb按钮
func ChangeEsbButtonState(sim *VerifySimulation, mapId int32, btnId string, pressDown bool) error { func ChangeEsbButtonState(sim *VerifySimulation, mapId int32, btnId uint32, pressDown bool) error {
uid := QueryUidByMidAndComId(mapId, btnId, &graphicData.EsbButton{}) uid := QueryUidByMidAndComId(mapId, btnId, &graphicData.EsbButton{})
if pressDown { if pressDown {
return fi.PressDownButton(sim.World, uid) return fi.PressDownButton(sim.World, uid)

View File

@ -137,7 +137,7 @@ func (s *VerifySimulation) GetRunState() state.SimulationStatus_SimulationState
} }
// 获取仿真世界信息 // 获取仿真世界信息
func (s *VerifySimulation) GetComIdByUid(uid string) string { func (s *VerifySimulation) GetComIdByUid(uid string) uint32 {
es := s.uidMap es := s.uidMap
if es == nil { if es == nil {
panic(&dto.ErrorDto{Code: dto.DataNotExist, Message: "无映射信息"}) panic(&dto.ErrorDto{Code: dto.DataNotExist, Message: "无映射信息"})
@ -226,15 +226,11 @@ func (s *VerifySimulation) CollectDynamicsTurnoutInfo() []*message.DynamicsTurno
if sta == nil { if sta == nil {
continue continue
} }
code64, err := strconv.ParseUint(sta.CommonId, 10, 16)
if err != nil {
slog.Error("id转uint16报错", err)
}
s := handlerDynamicsTurnoutState(s.World, o.Id()) s := handlerDynamicsTurnoutState(s.World, o.Id())
if s == nil { if s == nil {
continue continue
} }
s.Code = uint16(code64) s.Code = uint16(sta.CommonId)
turnoutStates = append(turnoutStates, s) turnoutStates = append(turnoutStates, s)
} }
return turnoutStates return turnoutStates
@ -324,7 +320,7 @@ func (s *VerifySimulation) GetDynamicsRunRepository() *message.LineBaseInfo {
} }
info.LinkList = append(info.LinkList, link) info.LinkList = append(info.LinkList, link)
if model.ARelation() != nil { if model.ARelation() != nil {
turnoutId, _ := strconv.Atoi(s.GetComIdByUid(model.ARelation().Device().Id())) turnoutId := s.GetComIdByUid(model.ARelation().Device().Id())
link.ARelTurnoutId = int32(turnoutId) link.ARelTurnoutId = int32(turnoutId)
switch model.ARelation().Port() { switch model.ARelation().Port() {
case proto.Port_A: case proto.Port_A:
@ -336,7 +332,7 @@ func (s *VerifySimulation) GetDynamicsRunRepository() *message.LineBaseInfo {
} }
} }
if model.BRelation() != nil { if model.BRelation() != nil {
turnoutId, _ := strconv.Atoi(s.GetComIdByUid(model.BRelation().Device().Id())) turnoutId := s.GetComIdByUid(model.BRelation().Device().Id())
link.BRelTurnoutId = int32(turnoutId) link.BRelTurnoutId = int32(turnoutId)
switch model.BRelation().Port() { switch model.BRelation().Port() {
case proto.Port_A: case proto.Port_A:
@ -349,7 +345,7 @@ func (s *VerifySimulation) GetDynamicsRunRepository() *message.LineBaseInfo {
} }
} }
for _, model := range s.Repo.SlopeList() { for _, model := range s.Repo.SlopeList() {
id, _ := strconv.Atoi(s.GetComIdByUid(model.Id())) id := s.GetComIdByUid(model.Id())
slope := &message.Slope{ slope := &message.Slope{
ID: int32(id), ID: int32(id),
StartLinkOffset: int32(model.StartLinkPosition().Offset()), StartLinkOffset: int32(model.StartLinkPosition().Offset()),
@ -363,7 +359,7 @@ func (s *VerifySimulation) GetDynamicsRunRepository() *message.LineBaseInfo {
slope.EndLinkId = int32(endLinkId) slope.EndLinkId = int32(endLinkId)
} }
for _, model := range s.Repo.SectionalCurvatureList() { for _, model := range s.Repo.SectionalCurvatureList() {
id, _ := strconv.Atoi(s.GetComIdByUid(model.Id())) id := s.GetComIdByUid(model.Id())
curve := &message.Curve{ curve := &message.Curve{
ID: int32(id), ID: int32(id),
StartLinkOffset: int32(model.StartLinkPosition().Offset()), StartLinkOffset: int32(model.StartLinkPosition().Offset()),
@ -573,18 +569,17 @@ func buildProtoRepository(mapIds []int32) (*proto.Repository, error) {
buildSectionCodePoint(repo, stationGi, mapId) buildSectionCodePoint(repo, stationGi, mapId)
} }
} }
//
return repo, nil return repo, nil
} }
func buildSectionCodePoint(repo *proto.Repository, storage *graphicData.RtssGraphicStorage, mapId int32) { func buildSectionCodePoint(repo *proto.Repository, storage *graphicData.RtssGraphicStorage, mapId int32) {
city := storage.UniqueIdPrefix.City // city := storage.UniqueIdPrefix.City
lineId := storage.UniqueIdPrefix.LineId // lineId := storage.UniqueIdPrefix.LineId
uidsMap := QueryUidStructure[*StationUidStructure](mapId)
for _, sscp := range storage.SectionCodePointList { for _, sscp := range storage.SectionCodePointList {
centralizedStation := sscp.CentralizedStation centralizedStation := sscp.CentralizedStation
sectionGIds := sscp.SectionIds sectionGIds := sscp.SectionIds
centralizedStationId := GenerateElementUid(city, lineId, nil, centralizedStation) centralizedStationId := uidsMap.StationIds[centralizedStation].Uid // GenerateElementUid(city, lineId, nil, centralizedStation)
ref := queryCentralizedStationRef(centralizedStationId, repo) ref := queryCentralizedStationRef(centralizedStationId, repo)
var ccs []*proto.CiSectionCodePoint var ccs []*proto.CiSectionCodePoint
for sectionPoint, sectionGId := range sectionGIds { for sectionPoint, sectionGId := range sectionGIds {
@ -881,7 +876,7 @@ func handlerRelayGiCj(uidsMap *RelayUidStructure, stationId string, ciCj *graphi
for _, j := range row.RefRelays { for _, j := range row.RefRelays {
u := uidsMap.RelayIds[j.RelayId] u := uidsMap.RelayIds[j.RelayId]
if u == nil { if u == nil {
panic(sys_error.New(fmt.Sprintf("集中站【id:%s】不存在继电器的【comId:%s】UID映射关系", stationId, j.RelayId))) panic(sys_error.New(fmt.Sprintf("集中站【id:%s】不存在继电器的【comId:%d】UID映射关系", stationId, j.RelayId)))
} }
d := &proto.CjDataItem{RelayId: u.Uid} d := &proto.CjDataItem{RelayId: u.Uid}
if j.Position == graphicData.CjDataItem_H { if j.Position == graphicData.CjDataItem_H {
@ -918,7 +913,7 @@ func handlerRelayGiQd(uidsMap *RelayUidStructure, stationId string, ciQd *graphi
for _, j := range row.RefRelays { for _, j := range row.RefRelays {
u := uidsMap.RelayIds[j] u := uidsMap.RelayIds[j]
if u == nil { if u == nil {
panic(sys_error.New(fmt.Sprintf("集中站【id:%s】不存在继电器的【comId:%s】UID映射关系", stationId, j))) panic(sys_error.New(fmt.Sprintf("集中站【id:%s】不存在继电器的【comId:%d】UID映射关系", stationId, j)))
} }
r.RefRelays = append(r.RefRelays, u.Uid) r.RefRelays = append(r.RefRelays, u.Uid)
} }
@ -957,7 +952,7 @@ func convertRelayModel(modelType graphicData.Relay_ModelType) proto.Relay_Model
func fillProtoRepository(repo *proto.Repository, storage *graphicData.RtssGraphicStorage, mapId int32) { func fillProtoRepository(repo *proto.Repository, storage *graphicData.RtssGraphicStorage, mapId int32) {
repo.MainCoordinateSystem = storage.UniqueIdPrefix.MainCoordinateSystem repo.MainCoordinateSystem = storage.UniqueIdPrefix.MainCoordinateSystem
axleCountingMap := make(map[string]*graphicData.AxleCounting) axleCountingMap := make(map[uint32]*graphicData.AxleCounting)
uidsMap := QueryUidStructure[*StationUidStructure](mapId) uidsMap := QueryUidStructure[*StationUidStructure](mapId)
for _, data := range storage.AxleCountings { for _, data := range storage.AxleCountings {
id := GetMapElementId(data.Common) id := GetMapElementId(data.Common)
@ -967,35 +962,38 @@ func fillProtoRepository(repo *proto.Repository, storage *graphicData.RtssGraphi
cpType = proto.CheckPointType_Boundary cpType = proto.CheckPointType_Boundary
} }
cp := &proto.CheckPoint{ cp := &proto.CheckPoint{
Id: id, Id: uidsMap.AxlePointIds[id].Uid,
Km: convertKm(data.KilometerSystem), Km: convertKm(data.KilometerSystem),
Type: cpType, Type: cpType,
DevicePorts: convertDevicePorts(data.AxleCountingRef),
} }
repo.CheckPoints = append(repo.CheckPoints, converCheckPointUid(cp, uidsMap)) for _, ref := range data.AxleCountingRef {
cp.DevicePorts = append(cp.DevicePorts, convertDevicePort(ref, uidsMap))
}
repo.CheckPoints = append(repo.CheckPoints, cp)
} }
for _, data := range storage.Section { for _, data := range storage.Section {
var turnoutIds []string var turnoutUids []string
if data.SectionType == graphicData.Section_TurnoutPhysical { if data.SectionType == graphicData.Section_TurnoutPhysical {
turnoutIds = findTurnoutIds(axleCountingMap, data.AxleCountings) turnoutIds := findTurnoutIds(axleCountingMap, data.AxleCountings)
for _, tid := range turnoutIds {
turnoutUids = append(turnoutUids, uidsMap.TurnoutIds[tid].Uid)
}
} }
centralizedStation := "" var centralizedStation string
if len(data.CentralizedStations) > 0 { if len(data.CentralizedStations) > 0 {
s := uidsMap.StationIds[data.CentralizedStations[0]] s := uidsMap.StationIds[data.CentralizedStations[0]]
if s != nil { if s != nil {
centralizedStation = s.Code centralizedStation = s.Code
} else {
centralizedStation = data.CentralizedStations[0]
} }
} }
physicalSection := &proto.PhysicalSection{ physicalSection := &proto.PhysicalSection{
Id: GetMapElementId(data.Common), Id: uidsMap.PhysicalSectionIds[GetMapElementId(data.Common)].Uid,
ADevicePort: convertDevicePort(data.PaRef), ADevicePort: convertDevicePort(data.PaRef, uidsMap),
BDevicePort: convertDevicePort(data.PbRef), BDevicePort: convertDevicePort(data.PbRef, uidsMap),
TurnoutIds: turnoutIds, TurnoutIds: turnoutUids,
CentralizedStation: centralizedStation, CentralizedStation: centralizedStation,
} }
repo.PhysicalSections = append(repo.PhysicalSections, converSectionUid(physicalSection, uidsMap)) repo.PhysicalSections = append(repo.PhysicalSections, physicalSection)
} }
for _, data := range storage.Turnouts { for _, data := range storage.Turnouts {
var km *proto.Kilometer var km *proto.Kilometer
@ -1005,94 +1003,77 @@ func fillProtoRepository(repo *proto.Repository, storage *graphicData.RtssGraphi
break break
} }
} }
var switchMachineType proto.Turnout_SwitchMachineType turnout := &proto.Turnout{
Id: uidsMap.TurnoutIds[GetMapElementId(data.Common)].Uid,
Km: km,
ADevicePort: convertDevicePort(data.PaRef, uidsMap),
BDevicePort: convertDevicePort(data.PbRef, uidsMap),
CDevicePort: convertDevicePort(data.PcRef, uidsMap),
}
switch data.SwitchMachineType { switch data.SwitchMachineType {
case graphicData.Turnout_ZDJ9_Single: case graphicData.Turnout_ZDJ9_Single:
switchMachineType = proto.Turnout_ZDJ9_Single turnout.SwitchMachineType = proto.Turnout_ZDJ9_Single
case graphicData.Turnout_ZDJ9_Double: case graphicData.Turnout_ZDJ9_Double:
switchMachineType = proto.Turnout_ZDJ9_Double turnout.SwitchMachineType = proto.Turnout_ZDJ9_Double
} }
turnout := &proto.Turnout{ repo.Turnouts = append(repo.Turnouts, turnout)
Id: GetMapElementId(data.Common),
Km: km,
ADevicePort: convertDevicePort(data.PaRef),
BDevicePort: convertDevicePort(data.PbRef),
CDevicePort: convertDevicePort(data.PcRef),
SwitchMachineType: switchMachineType,
}
repo.Turnouts = append(repo.Turnouts, converTurnoutUid(turnout, uidsMap))
} }
for _, data := range storage.Signals { for _, data := range storage.Signals {
var sectionId string signal := &proto.Signal{
var turnoutPort *proto.DevicePort Id: uidsMap.SignalIds[GetMapElementId(data.Common)].Uid,
Km: convertKm(data.KilometerSystem),
Model: convertToProtoSignalModel(data.Mt),
}
switch data.RefDev.DeviceType { switch data.RefDev.DeviceType {
case graphicData.RelatedRef_Section: case graphicData.RelatedRef_Section:
sectionId = data.RefDev.Id signal.SectionId = uidsMap.PhysicalSectionIds[data.RefDev.Id].Uid
case graphicData.RelatedRef_Turnout: case graphicData.RelatedRef_Turnout:
turnoutPort = convertDevicePort(data.RefDev) signal.TurnoutPort = convertDevicePort(data.RefDev, uidsMap)
} }
signal := &proto.Signal{ repo.Signals = append(repo.Signals, signal)
Id: GetMapElementId(data.Common),
Km: convertKm(data.KilometerSystem),
SectionId: sectionId,
TurnoutPort: turnoutPort,
Model: convertToProtoSignalModel(data.Mt),
}
repo.Signals = append(repo.Signals, converSignalUid(signal, uidsMap))
} }
stm := make(map[string][]string) stm := make(map[string][]string)
for _, data := range storage.Transponders { for _, data := range storage.Transponders {
var sectionId string
var turnoutPort *proto.DevicePort
switch data.TransponderRef.DeviceType {
case graphicData.RelatedRef_Section:
sectionId = data.TransponderRef.Id
case graphicData.RelatedRef_Turnout:
turnoutPort = convertDevicePort(data.TransponderRef)
}
responder := &proto.Transponder{ responder := &proto.Transponder{
Id: GetMapElementId(data.Common), Id: uidsMap.TransponderIds[GetMapElementId(data.Common)].Uid,
Km: convertKm(data.KilometerSystem), Km: convertKm(data.KilometerSystem),
SectionId: sectionId,
TurnoutPort: turnoutPort,
FixedTelegram: data.FixedTelegram, FixedTelegram: data.FixedTelegram,
Type: convertToProtoBaliseType(data.Type), Type: convertToProtoBaliseType(data.Type),
} }
repo.Transponders = append(repo.Transponders, converTransponderUid(responder, uidsMap)) switch data.TransponderRef.DeviceType {
case graphicData.RelatedRef_Section:
responder.SectionId = uidsMap.PhysicalSectionIds[data.TransponderRef.Id].Uid
case graphicData.RelatedRef_Turnout:
responder.TurnoutPort = convertDevicePort(data.TransponderRef, uidsMap)
}
for _, stationId := range data.CentralizedStations { for _, stationId := range data.CentralizedStations {
var stationName string var stationName string
if uidsMap.StationIds[stationId] == nil { if uidsMap.StationIds[stationId] == nil {
stationName = stationId
} else {
stationName = uidsMap.StationIds[stationId].Code stationName = uidsMap.StationIds[stationId].Code
} }
stm[stationName] = append(stm[stationName], responder.Id)
if stm[stationName] == nil {
stm[stationName] = []string{responder.Id}
} else {
stm[stationName] = append(stm[stationName], responder.Id)
}
} }
repo.Transponders = append(repo.Transponders, responder)
} }
slopeKsMap := make(map[string]*graphicData.SlopeKiloMarker) slopeKsMap := make(map[uint32]*graphicData.SlopeKiloMarker)
for _, data := range storage.SlopeKiloMarker { for _, data := range storage.SlopeKiloMarker {
slopeKsMap[GetMapElementId(data.Common)] = data slopeKsMap[GetMapElementId(data.Common)] = data
} }
curveKsMap := make(map[string]*graphicData.CurvatureKiloMarker)
for _, data := range storage.CurvatureKiloMarker {
curveKsMap[GetMapElementId(data.Common)] = data
}
for _, data := range storage.Slopes { for _, data := range storage.Slopes {
var kms []*proto.Kilometer var kms []*proto.Kilometer
for _, id := range data.RefDeviceId { for _, id := range data.RefDeviceId {
kms = append(kms, convertKm(slopeKsMap[id].KilometerSystem[0])) kms = append(kms, convertKm(slopeKsMap[id].KilometerSystem[0]))
} }
slope := &proto.Slope{ slope := &proto.Slope{
Id: GetMapElementId(data.Common), Id: uidsMap.SlopeIds[GetMapElementId(data.Common)].Uid,
Kms: kms, Kms: kms,
Degree: data.SlopeNumber, Degree: data.SlopeNumber,
} }
repo.Slopes = append(repo.Slopes, converSlopeUid(slope, uidsMap)) repo.Slopes = append(repo.Slopes, slope)
}
curveKsMap := make(map[uint32]*graphicData.CurvatureKiloMarker)
for _, data := range storage.CurvatureKiloMarker {
curveKsMap[GetMapElementId(data.Common)] = data
} }
for _, data := range storage.Curvatures { for _, data := range storage.Curvatures {
var kms []*proto.Kilometer var kms []*proto.Kilometer
@ -1100,11 +1081,11 @@ func fillProtoRepository(repo *proto.Repository, storage *graphicData.RtssGraphi
kms = append(kms, convertKm(curveKsMap[id].KilometerSystem[0])) kms = append(kms, convertKm(curveKsMap[id].KilometerSystem[0]))
} }
slope := &proto.SectionalCurvature{ slope := &proto.SectionalCurvature{
Id: GetMapElementId(data.Common), Id: uidsMap.CurvatureIds[GetMapElementId(data.Common)].Uid,
Kms: kms, Kms: kms,
Radius: data.CurvatureNumber, Radius: data.CurvatureNumber,
} }
repo.SectionalCurvatures = append(repo.SectionalCurvatures, converCurvatureUid(slope, uidsMap)) repo.SectionalCurvatures = append(repo.SectionalCurvatures, slope)
} }
for _, data := range storage.KilometerConvertList { for _, data := range storage.KilometerConvertList {
repo.KilometerConverts = append(repo.KilometerConverts, &proto.KilometerConvert{ repo.KilometerConverts = append(repo.KilometerConverts, &proto.KilometerConvert{
@ -1190,7 +1171,7 @@ func fillProtoRepository(repo *proto.Repository, storage *graphicData.RtssGraphi
} }
} }
//站台 //站台
platformMap := make(map[string]*graphicData.Platform) platformMap := make(map[uint32]*graphicData.Platform)
for _, data := range storage.Platforms { for _, data := range storage.Platforms {
platformId := GetMapElementId(data.Common) platformId := GetMapElementId(data.Common)
platformMap[platformId] = data platformMap[platformId] = data
@ -1229,7 +1210,7 @@ func handlerIBPDeviceToStation(station *proto.Station, repo *proto.Repository, i
return return
} }
uidMap := QueryUidStructure[*IBPUidStructure](mapId) uidMap := QueryUidStructure[*IBPUidStructure](mapId)
deviceMap := make(map[string]*proto.ElectronicComponent) // 对应的设备类型 deviceMap := make(map[uint32]*proto.ElectronicComponent) // 对应的设备类型
for _, data := range storage.IbpButtons { // 处理按钮 for _, data := range storage.IbpButtons { // 处理按钮
id := GetMapElementId(data.Common) id := GetMapElementId(data.Common)
b := &proto.Button{ b := &proto.Button{
@ -1300,102 +1281,6 @@ func handlerIBPDeviceToStation(station *proto.Station, repo *proto.Repository, i
} }
} }
func converCheckPointUid(data *proto.CheckPoint, uidsMap *StationUidStructure) *proto.CheckPoint {
data.Id = uidsMap.AxlePointIds[data.Id].Uid
for _, c := range data.DevicePorts {
c.DeviceId = converRefUid(c.DeviceId, c.DeviceType, uidsMap)
}
return data
}
func converSectionUid(data *proto.PhysicalSection, uidsMap *StationUidStructure) *proto.PhysicalSection {
data.Id = uidsMap.PhysicalSectionIds[data.Id].Uid
if data.ADevicePort != nil {
data.ADevicePort.DeviceId = converRefUid(data.ADevicePort.DeviceId, data.ADevicePort.DeviceType, uidsMap)
}
if data.BDevicePort != nil {
data.BDevicePort.DeviceId = converRefUid(data.BDevicePort.DeviceId, data.BDevicePort.DeviceType, uidsMap)
}
tids := make([]string, len(data.TurnoutIds))
for i, tid := range data.TurnoutIds {
tids[i] = converRefUid(tid, proto.DeviceType_DeviceType_Turnout, uidsMap)
}
data.TurnoutIds = tids
return data
}
func converTurnoutUid(data *proto.Turnout, uidsMap *StationUidStructure) *proto.Turnout {
data.Id = uidsMap.TurnoutIds[data.Id].Uid
if data.ADevicePort != nil {
data.ADevicePort.DeviceId = converRefUid(data.ADevicePort.DeviceId, data.ADevicePort.DeviceType, uidsMap)
}
if data.BDevicePort != nil {
data.BDevicePort.DeviceId = converRefUid(data.BDevicePort.DeviceId, data.BDevicePort.DeviceType, uidsMap)
}
if data.CDevicePort != nil {
data.CDevicePort.DeviceId = converRefUid(data.CDevicePort.DeviceId, data.CDevicePort.DeviceType, uidsMap)
}
return data
}
func converSignalUid(data *proto.Signal, uidsMap *StationUidStructure) *proto.Signal {
data.Id = uidsMap.SignalIds[data.Id].Uid
if data.SectionId != "" {
data.SectionId = converRefUid(data.SectionId, proto.DeviceType_DeviceType_PhysicalSection, uidsMap)
}
if data.TurnoutPort != nil {
data.TurnoutPort.DeviceId = converRefUid(data.TurnoutPort.DeviceId, data.TurnoutPort.DeviceType, uidsMap)
}
return data
}
func converTransponderUid(data *proto.Transponder, uidsMap *StationUidStructure) *proto.Transponder {
data.Id = uidsMap.TransponderIds[data.Id].Uid
if data.SectionId != "" {
data.SectionId = converRefUid(data.SectionId, proto.DeviceType_DeviceType_PhysicalSection, uidsMap)
}
if data.TurnoutPort != nil {
data.TurnoutPort.DeviceId = converRefUid(data.TurnoutPort.DeviceId, data.TurnoutPort.DeviceType, uidsMap)
}
return data
}
func converSlopeUid(data *proto.Slope, uidsMap *StationUidStructure) *proto.Slope {
data.Id = uidsMap.SlopeIds[data.Id].Uid
return data
}
func converCurvatureUid(data *proto.SectionalCurvature, uidsMap *StationUidStructure) *proto.SectionalCurvature {
data.Id = uidsMap.CurvatureIds[data.Id].Uid
return data
}
func converRefUid(id string, d proto.DeviceType, uidsMap *StationUidStructure) string {
var elementId *elementIdStructure
switch d {
case proto.DeviceType_DeviceType_CheckPoint:
elementId = uidsMap.AxlePointIds[id]
case proto.DeviceType_DeviceType_PhysicalSection:
elementId = uidsMap.PhysicalSectionIds[id]
case proto.DeviceType_DeviceType_SectionalCurvature:
elementId = uidsMap.CurvatureIds[id]
case proto.DeviceType_DeviceType_Signal:
elementId = uidsMap.SignalIds[id]
case proto.DeviceType_DeviceType_Slope:
elementId = uidsMap.SlopeIds[id]
case proto.DeviceType_DeviceType_Transponder:
elementId = uidsMap.TransponderIds[id]
case proto.DeviceType_DeviceType_Turnout:
elementId = uidsMap.TurnoutIds[id]
default:
panic(&dto.ErrorDto{Code: dto.ArgumentParseError, Message: "异常的设备类型-" + d.String()})
}
if elementId == nil {
return ""
}
return elementId.Uid
}
func convertKm(ks *graphicData.KilometerSystem) *proto.Kilometer { func convertKm(ks *graphicData.KilometerSystem) *proto.Kilometer {
var dir proto.Direction var dir proto.Direction
switch ks.Direction { switch ks.Direction {
@ -1411,11 +1296,10 @@ func convertKm(ks *graphicData.KilometerSystem) *proto.Kilometer {
} }
} }
func convertDevicePort(ref *graphicData.RelatedRef) *proto.DevicePort { func convertDevicePort(ref *graphicData.RelatedRef, uidsMap *StationUidStructure) *proto.DevicePort {
if ref == nil { if ref == nil {
return nil return nil
} }
var deviceType proto.DeviceType
var port proto.Port var port proto.Port
switch ref.DevicePort { switch ref.DevicePort {
case graphicData.RelatedRef_A: case graphicData.RelatedRef_A:
@ -1425,34 +1309,30 @@ func convertDevicePort(ref *graphicData.RelatedRef) *proto.DevicePort {
case graphicData.RelatedRef_C: case graphicData.RelatedRef_C:
port = proto.Port_C port = proto.Port_C
} }
var elementId string
var deviceType proto.DeviceType
switch ref.DeviceType { switch ref.DeviceType {
case graphicData.RelatedRef_Section: case graphicData.RelatedRef_Section:
deviceType = proto.DeviceType_DeviceType_PhysicalSection deviceType = proto.DeviceType_DeviceType_PhysicalSection
elementId = uidsMap.PhysicalSectionIds[ref.Id].Uid
case graphicData.RelatedRef_Turnout: case graphicData.RelatedRef_Turnout:
deviceType = proto.DeviceType_DeviceType_Turnout deviceType = proto.DeviceType_DeviceType_Turnout
elementId = uidsMap.TurnoutIds[ref.Id].Uid
default: default:
panic(fmt.Sprintf("异常的设备类型-%s", ref.DeviceType)) panic(fmt.Sprintf("异常的设备类型-%s", ref.DeviceType))
} }
return &proto.DevicePort{ return &proto.DevicePort{
DeviceId: ref.Id, DeviceId: elementId,
DeviceType: deviceType, DeviceType: deviceType,
Port: port, Port: port,
} }
} }
func convertDevicePorts(refList []*graphicData.RelatedRef) []*proto.DevicePort { func findTurnoutIds(axleCountingMap map[uint32]*graphicData.AxleCounting, axleIds []uint32) []uint32 {
var dps []*proto.DevicePort
for _, ref := range refList {
dps = append(dps, convertDevicePort(ref))
}
return dps
}
func findTurnoutIds(axleCountingMap map[string]*graphicData.AxleCounting, axleIds []string) []string {
if len(axleIds) <= 2 { if len(axleIds) <= 2 {
return nil return nil
} }
turnoutMap := make(map[string]int) turnoutMap := make(map[uint32]int)
for _, axleId := range axleIds { for _, axleId := range axleIds {
axle := axleCountingMap[axleId] axle := axleCountingMap[axleId]
for _, ref := range axle.AxleCountingRef { for _, ref := range axle.AxleCountingRef {
@ -1461,7 +1341,7 @@ func findTurnoutIds(axleCountingMap map[string]*graphicData.AxleCounting, axleId
} }
} }
} }
var turnoutIds []string var turnoutIds []uint32
for id, num := range turnoutMap { for id, num := range turnoutMap {
if num > 1 { if num > 1 {
turnoutIds = append(turnoutIds, id) turnoutIds = append(turnoutIds, id)