diff --git a/api/simulation.go b/api/simulation.go index a601eac..f3a6bd1 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 SignalOperationReq body request_proto.SignalOperationReq true "ATS测试仿真-操作信号机" +// @Param SignalOperationReqDto body dto.SignalOperationReqDto true "ATS测试仿真-操作信号机" // // @Success 200 {object} string // @Failure 500 {object} dto.ErrorDto diff --git a/ats/verify/simulation/wayside/memory/wayside_memory_signal.go b/ats/verify/simulation/wayside/memory/wayside_memory_signal.go index d83a0f4..e359c16 100644 --- a/ats/verify/simulation/wayside/memory/wayside_memory_signal.go +++ b/ats/verify/simulation/wayside/memory/wayside_memory_signal.go @@ -51,10 +51,72 @@ func ChangeSignalState(simulation *VerifySimulation, req *dto.SignalOperationReq { e := fi.UpdateSignalLightFault(simulation.World, signalUid, component_proto.Light_H, component_proto.Signal_DS, true) if e != nil { - + panic(dto.ErrorDto{Code: dto.OperationOfSignalError, Message: dto.ErrorTipMap[dto.OperationOfSignalError]}) + } + } + case request_proto.Signal_LightHCancelDs: + { + e := fi.UpdateSignalLightFault(simulation.World, signalUid, component_proto.Light_H, component_proto.Signal_DS, false) + if e != nil { + panic(dto.ErrorDto{Code: dto.OperationOfSignalError, Message: dto.ErrorTipMap[dto.OperationOfSignalError]}) + } + } + case request_proto.Signal_LightLFaultDs: + { + e := fi.UpdateSignalLightFault(simulation.World, signalUid, component_proto.Light_L, component_proto.Signal_DS, true) + if e != nil { + panic(dto.ErrorDto{Code: dto.OperationOfSignalError, Message: dto.ErrorTipMap[dto.OperationOfSignalError]}) + } + } + case request_proto.Signal_LightLCancelDs: + { + e := fi.UpdateSignalLightFault(simulation.World, signalUid, component_proto.Light_L, component_proto.Signal_DS, false) + if e != nil { + panic(dto.ErrorDto{Code: dto.OperationOfSignalError, Message: dto.ErrorTipMap[dto.OperationOfSignalError]}) + } + } + case request_proto.Signal_LightUFaultDs: + { + e := fi.UpdateSignalLightFault(simulation.World, signalUid, component_proto.Light_U, component_proto.Signal_DS, true) + if e != nil { + panic(dto.ErrorDto{Code: dto.OperationOfSignalError, Message: dto.ErrorTipMap[dto.OperationOfSignalError]}) + } + } + case request_proto.Signal_LightUCancelDs: + { + e := fi.UpdateSignalLightFault(simulation.World, signalUid, component_proto.Light_U, component_proto.Signal_DS, false) + if e != nil { + panic(dto.ErrorDto{Code: dto.OperationOfSignalError, Message: dto.ErrorTipMap[dto.OperationOfSignalError]}) + } + } + case request_proto.Signal_LightAFaultDs: + { + e := fi.UpdateSignalLightFault(simulation.World, signalUid, component_proto.Light_A, component_proto.Signal_DS, true) + if e != nil { + panic(dto.ErrorDto{Code: dto.OperationOfSignalError, Message: dto.ErrorTipMap[dto.OperationOfSignalError]}) + } + } + case request_proto.Signal_LightACancelDs: + { + e := fi.UpdateSignalLightFault(simulation.World, signalUid, component_proto.Light_A, component_proto.Signal_DS, false) + if e != nil { + panic(dto.ErrorDto{Code: dto.OperationOfSignalError, Message: dto.ErrorTipMap[dto.OperationOfSignalError]}) + } + } + case request_proto.Signal_LightBFaultDs: + { + e := fi.UpdateSignalLightFault(simulation.World, signalUid, component_proto.Light_B, component_proto.Signal_DS, true) + if e != nil { + panic(dto.ErrorDto{Code: dto.OperationOfSignalError, Message: dto.ErrorTipMap[dto.OperationOfSignalError]}) + } + } + case request_proto.Signal_LightBCancelDs: + { + e := fi.UpdateSignalLightFault(simulation.World, signalUid, component_proto.Light_B, component_proto.Signal_DS, false) + if e != nil { + panic(dto.ErrorDto{Code: dto.OperationOfSignalError, Message: dto.ErrorTipMap[dto.OperationOfSignalError]}) } } - } }