2023-10-23 18:01:48 +08:00
|
|
|
package memory
|
|
|
|
|
|
|
|
import (
|
2023-10-24 10:19:51 +08:00
|
|
|
"joylink.club/bj-rtsts-server/dto"
|
2023-11-01 11:08:26 +08:00
|
|
|
"joylink.club/bj-rtsts-server/dto/request_proto"
|
|
|
|
"joylink.club/bj-rtsts-server/ts/protos/graphicData"
|
|
|
|
"joylink.club/rtsssimulation/fi"
|
|
|
|
"log/slog"
|
2023-10-23 18:01:48 +08:00
|
|
|
)
|
|
|
|
|
2023-11-01 11:08:26 +08:00
|
|
|
func ChangeAxleSectionState(simulation *VerifySimulation, req *dto.AxleSectionOperationReqDto) error {
|
2023-10-31 16:00:28 +08:00
|
|
|
|
2023-11-01 11:08:26 +08:00
|
|
|
sectionUid := QueryUidByMidAndComId(req.MapId, req.DeviceId, &graphicData.Section{})
|
|
|
|
slog.Debug("操作计轴区段", "axleSectionUid", sectionUid)
|
|
|
|
if req.TrainIn {
|
|
|
|
return fi.AxleSectionTrainDrive(simulation.World, sectionUid, true)
|
|
|
|
}
|
|
|
|
if req.TrainOut {
|
|
|
|
return fi.AxleSectionTrainDrive(simulation.World, sectionUid, false)
|
|
|
|
}
|
|
|
|
//
|
|
|
|
switch req.Operation {
|
|
|
|
case request_proto.Section_CancelDrst:
|
|
|
|
return fi.AxleSectionDrstDrive(simulation.World, sectionUid, false)
|
|
|
|
case request_proto.Section_SetDrst:
|
|
|
|
return fi.AxleSectionDrstDrive(simulation.World, sectionUid, true)
|
|
|
|
case request_proto.Section_CancelPdrst:
|
|
|
|
return fi.AxleSectionPdrstDrive(simulation.World, sectionUid, false)
|
|
|
|
case request_proto.Section_SetPdrst:
|
|
|
|
return fi.AxleSectionPdrstDrive(simulation.World, sectionUid, true)
|
|
|
|
case request_proto.Section_CancelFaultOcc:
|
|
|
|
return fi.AxleSectionFaultOccDrive(simulation.World, sectionUid, false)
|
|
|
|
case request_proto.Section_SetFaultOcc:
|
|
|
|
return fi.AxleSectionFaultOccDrive(simulation.World, sectionUid, true)
|
|
|
|
}
|
|
|
|
return nil
|
2023-10-24 10:19:51 +08:00
|
|
|
}
|