signal 故障

This commit is contained in:
xzb 2023-10-19 15:27:35 +08:00
parent afa8ce8a89
commit 1d450bc1e1
2 changed files with 65 additions and 3 deletions

View File

@ -263,7 +263,7 @@ func switchOperation(c *gin.Context) {
// @Accept json // @Accept json
// @Produce json // @Produce json
// @Param Authorization header string true "JWT Token" // @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 // @Success 200 {object} string
// @Failure 500 {object} dto.ErrorDto // @Failure 500 {object} dto.ErrorDto

View File

@ -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) e := fi.UpdateSignalLightFault(simulation.World, signalUid, component_proto.Light_H, component_proto.Signal_DS, true)
if e != nil { 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]})
} }
} }
} }
} }