From afa8ce8a89be2c0ccde26e8b4b301589affbe2d8 Mon Sep 17 00:00:00 2001 From: xzb <223@qq.com> Date: Thu, 19 Oct 2023 15:08:43 +0800 Subject: [PATCH] =?UTF-8?q?signal=20=E6=95=85=E9=9A=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/simulation.go | 4 +- .../wayside/memory/wayside_memory_signal.go | 54 +++-- dto/error.go | 2 + dto/request_proto/request.pb.go | 200 ++++-------------- dto/simulation.go | 14 +- 5 files changed, 92 insertions(+), 182 deletions(-) diff --git a/api/simulation.go b/api/simulation.go index a226b62..a601eac 100644 --- a/api/simulation.go +++ b/api/simulation.go @@ -263,7 +263,7 @@ func switchOperation(c *gin.Context) { // @Accept json // @Produce json // @Param Authorization header string true "JWT Token" -// @Param SignalOperationReqDto body dto.SignalOperationReqDto true "ATS测试仿真-操作信号机" +// @Param SignalOperationReq body request_proto.SignalOperationReq true "ATS测试仿真-操作信号机" // // @Success 200 {object} string // @Failure 500 {object} dto.ErrorDto @@ -275,7 +275,7 @@ func signalOperation(c *gin.Context) { } simulation := checkDeviceDataAndReturn(req.SimulationId) slog.Info("传入状态参数", req) - memory.ChangeSignalState(simulation, req.MapId, req.DeviceId, req.Aspect) + memory.ChangeSignalState(simulation, req) c.JSON(http.StatusOK, "ok") } diff --git a/ats/verify/simulation/wayside/memory/wayside_memory_signal.go b/ats/verify/simulation/wayside/memory/wayside_memory_signal.go index 7fbca57..d83a0f4 100644 --- a/ats/verify/simulation/wayside/memory/wayside_memory_signal.go +++ b/ats/verify/simulation/wayside/memory/wayside_memory_signal.go @@ -5,8 +5,10 @@ import ( "joylink.club/bj-rtsts-server/ats/verify/protos/graphicData" "joylink.club/bj-rtsts-server/ats/verify/protos/state" "joylink.club/bj-rtsts-server/dto" + "joylink.club/bj-rtsts-server/dto/request_proto" "joylink.club/ecs" "joylink.club/rtsssimulation/component" + "joylink.club/rtsssimulation/component/component_proto" "joylink.club/rtsssimulation/consts" "joylink.club/rtsssimulation/entity" "joylink.club/rtsssimulation/fi" @@ -15,32 +17,46 @@ import ( "log/slog" ) -func ChangeSignalState(simulation *VerifySimulation, mapId int32, signalDeviceId string, toAspect state.Signal_Aspect) { - signalUid := QueryUidByMidAndComId(mapId, signalDeviceId, &graphicData.Signal{}) +func ChangeSignalState(simulation *VerifySimulation, req *dto.SignalOperationReqDto) { + signalUid := QueryUidByMidAndComId(req.MapId, req.DeviceId, &graphicData.Signal{}) signalModel, err := simulation.Repo.FindModel(signalUid, proto.DeviceType_DeviceType_Signal) if err != nil { panic(fmt.Sprintf("信号机[%s]模型不存在", signalUid)) } signalGroupCode := signalModel.(*repository.Signal).Code() slog.Info("信号机操作", "uid", signalUid, "组合类型码", signalGroupCode) - switch signalGroupCode { - case consts.SIGNAL_2XH1: - changeSignal2XH1State(simulation.World, signalUid, toAspect) - case consts.SIGNAL_3XH1: - changeSignal3XH1State(simulation.World, signalUid, toAspect) - case consts.SIGNAL_3XH2: - changeSignal3XH2State(simulation.World, signalUid, toAspect) - case consts.SIGNAL_3XH3: - changeSignal3XH3State(simulation.World, signalUid, toAspect) - case consts.SIGNAL_3XH4: - changeSignal3XH4State(simulation.World, signalUid, toAspect) - case consts.SIGNAL_DCXH: - changeSignalDCXHState(simulation.World, signalUid, toAspect) - case consts.SIGNAL_JCKXH: - changeSignalJCKXHState(simulation.World, signalUid, toAspect) - default: - panic(dto.ErrorDto{Code: dto.OperationOfSignalNotSupported, Message: fmt.Sprintf("操作[%s]的信号机,无法识别组合类型[%s]", signalUid, signalGroupCode)}) + switch req.Operation { + case request_proto.Signal_Display: //信号机显示信号设置 + { + switch signalGroupCode { + case consts.SIGNAL_2XH1: + changeSignal2XH1State(simulation.World, signalUid, req.Aspect) + case consts.SIGNAL_3XH1: + changeSignal3XH1State(simulation.World, signalUid, req.Aspect) + case consts.SIGNAL_3XH2: + changeSignal3XH2State(simulation.World, signalUid, req.Aspect) + case consts.SIGNAL_3XH3: + changeSignal3XH3State(simulation.World, signalUid, req.Aspect) + case consts.SIGNAL_3XH4: + changeSignal3XH4State(simulation.World, signalUid, req.Aspect) + case consts.SIGNAL_DCXH: + changeSignalDCXHState(simulation.World, signalUid, req.Aspect) + case consts.SIGNAL_JCKXH: + changeSignalJCKXHState(simulation.World, signalUid, req.Aspect) + default: + panic(dto.ErrorDto{Code: dto.OperationOfSignalNotSupported, Message: fmt.Sprintf("操作[%s]的信号机,无法识别组合类型[%s]", signalUid, signalGroupCode)}) + } + } + case request_proto.Signal_LightHFaultDs: + { + e := fi.UpdateSignalLightFault(simulation.World, signalUid, component_proto.Light_H, component_proto.Signal_DS, true) + if e != nil { + + } + } + } + } func changeSignalJCKXHState(w ecs.World, signalUid string, toAspect state.Signal_Aspect) { switch toAspect { diff --git a/dto/error.go b/dto/error.go index 3a164f0..9e8674e 100644 --- a/dto/error.go +++ b/dto/error.go @@ -19,6 +19,7 @@ const ( QueryDBError = 5000 OperationOfSignalNotSupported = 6000 + OperationOfSignalError = 6001 ) var ErrorTipMap = map[int]string{ @@ -31,4 +32,5 @@ var ErrorTipMap = map[int]string{ NoAuthOperationError: "无权限操作", QueryDBError: "数据库操作错误", OperationOfSignalNotSupported: "信号机不支持该操作", + OperationOfSignalError: "信号机操作异常", } diff --git a/dto/request_proto/request.pb.go b/dto/request_proto/request.pb.go index b99cf61..528411a 100644 --- a/dto/request_proto/request.pb.go +++ b/dto/request_proto/request.pb.go @@ -7,7 +7,6 @@ package request_proto import ( - state "./ats/verify/protos/state" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" @@ -316,142 +315,47 @@ func (*Signal) Descriptor() ([]byte, []int) { return file_request_proto_rawDescGZIP(), []int{2} } -// 信号机操作请求 -type SignalOperationReq struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - 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 - DeviceId string `protobuf:"bytes,3,opt,name=deviceId,proto3" json:"deviceId,omitempty"` // 设备id - Operation Signal_Operation `protobuf:"varint,4,opt,name=operation,proto3,enum=request.Signal_Operation" json:"operation,omitempty"` // 信号机操作 - Aspect state.Signal_Aspect `protobuf:"varint,5,opt,name=aspect,proto3,enum=state.Signal_Aspect" json:"aspect,omitempty"` // 当操作为Operation.Display时有效,表示显示的信号 -} - -func (x *SignalOperationReq) Reset() { - *x = SignalOperationReq{} - if protoimpl.UnsafeEnabled { - mi := &file_request_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *SignalOperationReq) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*SignalOperationReq) ProtoMessage() {} - -func (x *SignalOperationReq) ProtoReflect() protoreflect.Message { - mi := &file_request_proto_msgTypes[3] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use SignalOperationReq.ProtoReflect.Descriptor instead. -func (*SignalOperationReq) Descriptor() ([]byte, []int) { - return file_request_proto_rawDescGZIP(), []int{3} -} - -func (x *SignalOperationReq) GetSimulationId() string { - if x != nil { - return x.SimulationId - } - return "" -} - -func (x *SignalOperationReq) GetMapId() int32 { - if x != nil { - return x.MapId - } - return 0 -} - -func (x *SignalOperationReq) GetDeviceId() string { - if x != nil { - return x.DeviceId - } - return "" -} - -func (x *SignalOperationReq) GetOperation() Signal_Operation { - if x != nil { - return x.Operation - } - return Signal_Undefined -} - -func (x *SignalOperationReq) GetAspect() state.Signal_Aspect { - if x != nil { - return x.Aspect - } - return state.Signal_Aspect(0) -} - var File_request_proto protoreflect.FileDescriptor var file_request_proto_rawDesc = []byte{ 0x0a, 0x0d, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, - 0x07, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x12, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, - 0x5f, 0x73, 0x74, 0x61, 0x74, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x83, 0x01, 0x0a, - 0x07, 0x54, 0x75, 0x72, 0x6e, 0x6f, 0x75, 0x74, 0x22, 0x78, 0x0a, 0x09, 0x4f, 0x70, 0x65, 0x72, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x0d, 0x0a, 0x09, 0x55, 0x6e, 0x64, 0x65, 0x66, 0x69, 0x6e, - 0x65, 0x64, 0x10, 0x00, 0x12, 0x06, 0x0a, 0x02, 0x44, 0x43, 0x10, 0x01, 0x12, 0x0c, 0x0a, 0x08, - 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x44, 0x43, 0x10, 0x02, 0x12, 0x06, 0x0a, 0x02, 0x46, 0x43, - 0x10, 0x03, 0x12, 0x0c, 0x0a, 0x08, 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x46, 0x43, 0x10, 0x04, - 0x12, 0x09, 0x0a, 0x05, 0x53, 0x65, 0x74, 0x53, 0x42, 0x10, 0x05, 0x12, 0x0c, 0x0a, 0x08, 0x43, - 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x53, 0x42, 0x10, 0x06, 0x12, 0x09, 0x0a, 0x05, 0x53, 0x65, 0x74, - 0x4a, 0x43, 0x10, 0x07, 0x12, 0x0c, 0x0a, 0x08, 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x4a, 0x43, - 0x10, 0x08, 0x22, 0xa5, 0x01, 0x0a, 0x13, 0x54, 0x75, 0x72, 0x6e, 0x6f, 0x75, 0x74, 0x4f, 0x70, - 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x12, 0x22, 0x0a, 0x0c, 0x73, 0x69, - 0x6d, 0x75, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 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, 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, - 0x12, 0x38, 0x0a, 0x09, 0x6f, 0x70, 0x65, 0x72, 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, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, - 0x09, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0xf5, 0x01, 0x0a, 0x06, 0x53, - 0x69, 0x67, 0x6e, 0x61, 0x6c, 0x22, 0xea, 0x01, 0x0a, 0x09, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x12, 0x0d, 0x0a, 0x09, 0x55, 0x6e, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x65, 0x64, - 0x10, 0x00, 0x12, 0x0b, 0x0a, 0x07, 0x44, 0x69, 0x73, 0x70, 0x6c, 0x61, 0x79, 0x10, 0x01, 0x12, - 0x11, 0x0a, 0x0d, 0x4c, 0x69, 0x67, 0x68, 0x74, 0x48, 0x46, 0x61, 0x75, 0x6c, 0x74, 0x44, 0x73, - 0x10, 0x02, 0x12, 0x11, 0x0a, 0x0d, 0x4c, 0x69, 0x67, 0x68, 0x74, 0x55, 0x46, 0x61, 0x75, 0x6c, - 0x74, 0x44, 0x73, 0x10, 0x03, 0x12, 0x11, 0x0a, 0x0d, 0x4c, 0x69, 0x67, 0x68, 0x74, 0x4c, 0x46, - 0x61, 0x75, 0x6c, 0x74, 0x44, 0x73, 0x10, 0x04, 0x12, 0x11, 0x0a, 0x0d, 0x4c, 0x69, 0x67, 0x68, - 0x74, 0x41, 0x46, 0x61, 0x75, 0x6c, 0x74, 0x44, 0x73, 0x10, 0x05, 0x12, 0x11, 0x0a, 0x0d, 0x4c, - 0x69, 0x67, 0x68, 0x74, 0x42, 0x46, 0x61, 0x75, 0x6c, 0x74, 0x44, 0x73, 0x10, 0x06, 0x12, 0x12, - 0x0a, 0x0e, 0x4c, 0x69, 0x67, 0x68, 0x74, 0x48, 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x44, 0x73, - 0x10, 0x07, 0x12, 0x12, 0x0a, 0x0e, 0x4c, 0x69, 0x67, 0x68, 0x74, 0x55, 0x43, 0x61, 0x6e, 0x63, - 0x65, 0x6c, 0x44, 0x73, 0x10, 0x08, 0x12, 0x12, 0x0a, 0x0e, 0x4c, 0x69, 0x67, 0x68, 0x74, 0x4c, - 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x44, 0x73, 0x10, 0x09, 0x12, 0x12, 0x0a, 0x0e, 0x4c, 0x69, - 0x67, 0x68, 0x74, 0x41, 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x44, 0x73, 0x10, 0x0a, 0x12, 0x12, - 0x0a, 0x0e, 0x4c, 0x69, 0x67, 0x68, 0x74, 0x42, 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x44, 0x73, - 0x10, 0x0b, 0x22, 0xd1, 0x01, 0x0a, 0x12, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x6c, 0x4f, 0x70, 0x65, - 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x12, 0x22, 0x0a, 0x0c, 0x73, 0x69, 0x6d, - 0x75, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 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, 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, 0x12, - 0x37, 0x0a, 0x09, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, - 0x28, 0x0e, 0x32, 0x19, 0x2e, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x53, 0x69, 0x67, - 0x6e, 0x61, 0x6c, 0x2e, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x09, 0x6f, - 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x2c, 0x0a, 0x06, 0x61, 0x73, 0x70, 0x65, - 0x63, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x14, 0x2e, 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, 0x42, 0x15, 0x5a, 0x13, 0x2e, 0x2f, 0x64, 0x74, 0x6f, 0x2f, - 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x06, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x07, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x83, 0x01, 0x0a, 0x07, 0x54, 0x75, 0x72, + 0x6e, 0x6f, 0x75, 0x74, 0x22, 0x78, 0x0a, 0x09, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x12, 0x0d, 0x0a, 0x09, 0x55, 0x6e, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x65, 0x64, 0x10, 0x00, + 0x12, 0x06, 0x0a, 0x02, 0x44, 0x43, 0x10, 0x01, 0x12, 0x0c, 0x0a, 0x08, 0x43, 0x61, 0x6e, 0x63, + 0x65, 0x6c, 0x44, 0x43, 0x10, 0x02, 0x12, 0x06, 0x0a, 0x02, 0x46, 0x43, 0x10, 0x03, 0x12, 0x0c, + 0x0a, 0x08, 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x46, 0x43, 0x10, 0x04, 0x12, 0x09, 0x0a, 0x05, + 0x53, 0x65, 0x74, 0x53, 0x42, 0x10, 0x05, 0x12, 0x0c, 0x0a, 0x08, 0x43, 0x61, 0x6e, 0x63, 0x65, + 0x6c, 0x53, 0x42, 0x10, 0x06, 0x12, 0x09, 0x0a, 0x05, 0x53, 0x65, 0x74, 0x4a, 0x43, 0x10, 0x07, + 0x12, 0x0c, 0x0a, 0x08, 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x4a, 0x43, 0x10, 0x08, 0x22, 0xa5, + 0x01, 0x0a, 0x13, 0x54, 0x75, 0x72, 0x6e, 0x6f, 0x75, 0x74, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x12, 0x22, 0x0a, 0x0c, 0x73, 0x69, 0x6d, 0x75, 0x6c, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 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, 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, 0x12, 0x38, 0x0a, 0x09, + 0x6f, 0x70, 0x65, 0x72, 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, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x09, 0x6f, 0x70, 0x65, + 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0xf5, 0x01, 0x0a, 0x06, 0x53, 0x69, 0x67, 0x6e, 0x61, + 0x6c, 0x22, 0xea, 0x01, 0x0a, 0x09, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, + 0x0d, 0x0a, 0x09, 0x55, 0x6e, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x65, 0x64, 0x10, 0x00, 0x12, 0x0b, + 0x0a, 0x07, 0x44, 0x69, 0x73, 0x70, 0x6c, 0x61, 0x79, 0x10, 0x01, 0x12, 0x11, 0x0a, 0x0d, 0x4c, + 0x69, 0x67, 0x68, 0x74, 0x48, 0x46, 0x61, 0x75, 0x6c, 0x74, 0x44, 0x73, 0x10, 0x02, 0x12, 0x11, + 0x0a, 0x0d, 0x4c, 0x69, 0x67, 0x68, 0x74, 0x55, 0x46, 0x61, 0x75, 0x6c, 0x74, 0x44, 0x73, 0x10, + 0x03, 0x12, 0x11, 0x0a, 0x0d, 0x4c, 0x69, 0x67, 0x68, 0x74, 0x4c, 0x46, 0x61, 0x75, 0x6c, 0x74, + 0x44, 0x73, 0x10, 0x04, 0x12, 0x11, 0x0a, 0x0d, 0x4c, 0x69, 0x67, 0x68, 0x74, 0x41, 0x46, 0x61, + 0x75, 0x6c, 0x74, 0x44, 0x73, 0x10, 0x05, 0x12, 0x11, 0x0a, 0x0d, 0x4c, 0x69, 0x67, 0x68, 0x74, + 0x42, 0x46, 0x61, 0x75, 0x6c, 0x74, 0x44, 0x73, 0x10, 0x06, 0x12, 0x12, 0x0a, 0x0e, 0x4c, 0x69, + 0x67, 0x68, 0x74, 0x48, 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x44, 0x73, 0x10, 0x07, 0x12, 0x12, + 0x0a, 0x0e, 0x4c, 0x69, 0x67, 0x68, 0x74, 0x55, 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x44, 0x73, + 0x10, 0x08, 0x12, 0x12, 0x0a, 0x0e, 0x4c, 0x69, 0x67, 0x68, 0x74, 0x4c, 0x43, 0x61, 0x6e, 0x63, + 0x65, 0x6c, 0x44, 0x73, 0x10, 0x09, 0x12, 0x12, 0x0a, 0x0e, 0x4c, 0x69, 0x67, 0x68, 0x74, 0x41, + 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x44, 0x73, 0x10, 0x0a, 0x12, 0x12, 0x0a, 0x0e, 0x4c, 0x69, + 0x67, 0x68, 0x74, 0x42, 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x44, 0x73, 0x10, 0x0b, 0x42, 0x15, + 0x5a, 0x13, 0x2e, 0x2f, 0x64, 0x74, 0x6f, 0x2f, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x5f, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -467,25 +371,21 @@ func file_request_proto_rawDescGZIP() []byte { } var file_request_proto_enumTypes = make([]protoimpl.EnumInfo, 2) -var file_request_proto_msgTypes = make([]protoimpl.MessageInfo, 4) +var file_request_proto_msgTypes = make([]protoimpl.MessageInfo, 3) var file_request_proto_goTypes = []interface{}{ (Turnout_Operation)(0), // 0: request.Turnout.Operation (Signal_Operation)(0), // 1: request.Signal.Operation (*Turnout)(nil), // 2: request.Turnout (*TurnoutOperationReq)(nil), // 3: request.TurnoutOperationReq (*Signal)(nil), // 4: request.Signal - (*SignalOperationReq)(nil), // 5: request.SignalOperationReq - (state.Signal_Aspect)(0), // 6: state.Signal.Aspect } var file_request_proto_depIdxs = []int32{ 0, // 0: request.TurnoutOperationReq.operation:type_name -> request.Turnout.Operation - 1, // 1: request.SignalOperationReq.operation:type_name -> request.Signal.Operation - 6, // 2: request.SignalOperationReq.aspect:type_name -> state.Signal.Aspect - 3, // [3:3] is the sub-list for method output_type - 3, // [3:3] is the sub-list for method input_type - 3, // [3:3] is the sub-list for extension type_name - 3, // [3:3] is the sub-list for extension extendee - 0, // [0:3] is the sub-list for field type_name + 1, // [1:1] is the sub-list for method output_type + 1, // [1:1] is the sub-list for method input_type + 1, // [1:1] is the sub-list for extension type_name + 1, // [1:1] is the sub-list for extension extendee + 0, // [0:1] is the sub-list for field type_name } func init() { file_request_proto_init() } @@ -530,18 +430,6 @@ func file_request_proto_init() { return nil } } - file_request_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SignalOperationReq); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } } type x struct{} out := protoimpl.TypeBuilder{ @@ -549,7 +437,7 @@ func file_request_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_request_proto_rawDesc, NumEnums: 2, - NumMessages: 4, + NumMessages: 3, NumExtensions: 0, NumServices: 0, }, diff --git a/dto/simulation.go b/dto/simulation.go index 152a917..55fdbc1 100644 --- a/dto/simulation.go +++ b/dto/simulation.go @@ -1,6 +1,9 @@ package dto -import "joylink.club/bj-rtsts-server/ats/verify/protos/state" +import ( + "joylink.club/bj-rtsts-server/ats/verify/protos/state" + "joylink.club/bj-rtsts-server/dto/request_proto" +) // 创建仿真请求 type SimulationCreateReqDto struct { @@ -71,10 +74,11 @@ type SwitchOperationReqDto struct { TurnReverse bool `form:"turnReverse" json:"turnReverse"` } type SignalOperationReqDto struct { - SimulationId string `form:"simulationId" json:"simulationId" binding:"required"` - MapId int32 `json:"mapId" from:"mapId" binding:"required"` - DeviceId string `form:"id" json:"id" binding:"required"` - Aspect state.Signal_Aspect `form:"aspect" json:"aspect" binding:"required"` + SimulationId string `form:"simulationId" json:"simulationId" binding:"required"` + MapId int32 `json:"mapId" from:"mapId" binding:"required"` + DeviceId string `form:"id" json:"id" 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时有效,表示显示的信号 } type ButtonOperationReqDto struct {