axle section request

This commit is contained in:
xzb 2023-10-31 15:55:17 +08:00
parent 6730a45c46
commit 234d40bc98
2 changed files with 39 additions and 2 deletions

View File

@ -33,6 +33,7 @@ func InitSimulationRouter(api *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddle
authed.POST("/relay/operation", relayOperation)
authed.POST("/signal/operation", signalOperation)
authed.POST("/axleSection/operation", axleSectionOperation)
authed.POST("/axle/operation", axleCounterOperation)
authed.POST("/esbBtn/operation", esbBtnOperation)
authed.POST("/ibp/btn/operation", ibpBtnOperation)
authed.POST("/ibp/key/operation", ibpKeyOperation)
@ -302,7 +303,7 @@ func signalOperation(c *gin.Context) {
// @Success 200 {object} string
// @Failure 500 {object} dto.ErrorDto
// @Router /api/v1/simulation/axleSection/operation [post]
func axleSectionOperation(c *gin.Context) { //操作:设置故障占用、取消故障占用、计轴直接复位、计轴预复位
func axleSectionOperation(c *gin.Context) { //操作:设置故障占用、取消故障占用
req := &dto.AxleSectionOperationReqDto{}
if err := c.ShouldBind(&req); err != nil {
panic(sys_error.New("输入参数格式错误", err))
@ -313,6 +314,33 @@ func axleSectionOperation(c *gin.Context) { //操作:设置故障占用、取
c.JSON(http.StatusOK, "ok")
}
// ATS测试-计轴操作
//
// @Summary ATS测试-计轴操作
//
// @Security JwtAuth
//
// @Description ATS测试-计轴操作
// @Tags ATS测试仿真Api
// @Accept json
// @Produce json
// @Param Authorization header string true "JWT Token"
// @Param AxleOperationReqDto body dto.AxleOperationReqDto true "ATS测试仿真-操作计轴"
//
// @Success 200 {object} string
// @Failure 500 {object} dto.ErrorDto
// @Router /api/v1/simulation/axle/operation [post]
func axleCounterOperation(c *gin.Context) { //操作:设置故障占用、取消故障占用
req := &dto.AxleOperationReqDto{}
if err := c.ShouldBind(&req); err != nil {
panic(sys_error.New("输入参数格式错误", err))
}
//simulation := checkDeviceDataAndReturn(req.SimulationId)
slog.Info("传入状态参数", req)
//memory.ChangeAxleSectionState(simulation, req)
c.JSON(http.StatusOK, "ok")
}
// ATS测试-ESB按钮操作
//
// @Summary ATS测试-ESB按钮操作

View File

@ -84,7 +84,9 @@ type SignalOperationReqDto struct {
Operation request_proto.Signal_Operation `form:"operation" json:"operation" binding:"required"` //信号机操作类型
Aspect state.Signal_Aspect `form:"aspect" json:"aspect" binding:"required"` // 当操作为Operation.Display时有效表示显示的信号
}
type AxleSectionOperationReqDto struct {
// AxleOperationReqDto 计轴操作
type AxleOperationReqDto 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"`
@ -92,6 +94,13 @@ type AxleSectionOperationReqDto struct {
Reset bool `form:"reset" json:"reset"` //当操作为直接复位或预复位时有效true-复位false-取消或结束复位
}
// AxleSectionOperationReqDto 计轴区段操作
type AxleSectionOperationReqDto 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"`
Operation request_proto.Section_SectionOperation `form:"operation" json:"operation"`
}
type EsbButtonOperationReqDto struct {
SimulationId string `form:"simulationId" json:"simulationId" binding:"required"`
MapId int32 `json:"mapId" from:"mapId" binding:"required"`