计轴区段操作
This commit is contained in:
parent
20a0f2f829
commit
840a2baa6a
@ -35,6 +35,7 @@ func InitSimulationRouter(api *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddle
|
||||
authed.GET("/getDataChannelName", getDataChannelName)
|
||||
authed.POST("/relay/operation", relayOperation)
|
||||
authed.POST("/signal/operation", signalOperation)
|
||||
authed.POST("/axleSection/operation", axleSectionOperation)
|
||||
authed.POST("/esbBtn/operation", esbBtnOperation)
|
||||
authed.POST("/ibp/btn/operation", ibpBtnOperation)
|
||||
authed.POST("/ibp/key/operation", ibpKeyOperation)
|
||||
@ -277,7 +278,7 @@ func switchOperation(c *gin.Context) {
|
||||
func signalOperation(c *gin.Context) {
|
||||
req := &dto.SignalOperationReqDto{}
|
||||
if err := c.ShouldBind(&req); err != nil {
|
||||
panic(dto.ErrorDto{Code: dto.ArgumentParseError, Message: err.Error()})
|
||||
panic(sys_error.New("输入参数格式错误", err))
|
||||
}
|
||||
simulation := checkDeviceDataAndReturn(req.SimulationId)
|
||||
slog.Info("传入状态参数", req)
|
||||
@ -285,6 +286,33 @@ func signalOperation(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 AxleSectionOperationReqDto body dto.AxleSectionOperationReqDto true "ATS测试仿真-操作计轴区段"
|
||||
//
|
||||
// @Success 200 {object} string
|
||||
// @Failure 500 {object} dto.ErrorDto
|
||||
// @Router /api/v1/simulation/axleSection/operation [post]
|
||||
func axleSectionOperation(c *gin.Context) {
|
||||
req := &dto.AxleSectionOperationReqDto{}
|
||||
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按钮操作
|
||||
|
@ -3,9 +3,12 @@ package memory
|
||||
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/entity"
|
||||
"joylink.club/rtsssimulation/fi"
|
||||
)
|
||||
|
||||
func GetMapAllSectionState(sim *VerifySimulation, mapId int32) []*state.SectionState {
|
||||
@ -36,3 +39,16 @@ func handlerSectionState(w ecs.World, uid string) *state.SectionState {
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func ChangeAxleSectionState(simulation *VerifySimulation, req *dto.AxleSectionOperationReqDto) {
|
||||
sectionUid := QueryUidByMidAndComId(req.MapId, req.DeviceId, &graphicData.Section{})
|
||||
switch req.Operation {
|
||||
case request_proto.Section_Drst:
|
||||
fi.DriveAxleSectionDrst(simulation.World, sectionUid, req.Reset)
|
||||
case request_proto.Section_Pdrst:
|
||||
fi.DriveAxleSectionPdrst(simulation.World, sectionUid, req.Reset)
|
||||
case request_proto.Section_TrainIn:
|
||||
fi.DriveAxleSectionTrainIn(simulation.World, sectionUid)
|
||||
case request_proto.Section_TrainOut:
|
||||
fi.DriveAxleSectionTrainOut(simulation.World, sectionUid)
|
||||
}
|
||||
}
|
||||
|
@ -85,6 +85,7 @@ type AxleSectionOperationReqDto struct {
|
||||
MapId int32 `json:"mapId" from:"mapId" binding:"required"`
|
||||
DeviceId string `form:"id" json:"id" binding:"required"`
|
||||
Operation request_proto.Section_AxleOperation `form:"operation" json:"operation"`
|
||||
Reset bool `form:"reset" json:"reset"` //当操作为直接复位或预复位时有效,true-复位,false-取消或结束复位
|
||||
}
|
||||
|
||||
type EsbButtonOperationReqDto struct {
|
||||
|
Loading…
Reference in New Issue
Block a user