区段复位/预复位接口逻辑修改

This commit is contained in:
walker 2024-01-23 09:35:26 +08:00
parent d94a8335dc
commit fa7211d7bd
2 changed files with 15 additions and 14 deletions

View File

@ -2,10 +2,11 @@ package fi
import ( import (
"fmt" "fmt"
"strings"
"joylink.club/ecs" "joylink.club/ecs"
"joylink.club/rtsssimulation/component" "joylink.club/rtsssimulation/component"
"joylink.club/rtsssimulation/entity" "joylink.club/rtsssimulation/entity"
"strings"
) )
// AxleSectionDrstDrive 计轴直接复位操作 // AxleSectionDrstDrive 计轴直接复位操作
@ -19,12 +20,12 @@ func AxleSectionDrstDrive(w ecs.World, sectionId string, set bool) error {
if sectionModel == nil { if sectionModel == nil {
return ecs.NewErrResult(fmt.Errorf("区段模型[%s]不存实体", sectionId)) return ecs.NewErrResult(fmt.Errorf("区段模型[%s]不存实体", sectionId))
} }
if set { // if set {
axleSectionEntry := wd.EntityMap[sectionId] // axleSectionEntry := wd.EntityMap[sectionId]
if !axleSectionEntry.HasComponent(component.AxleSectionFaultTag) { // if !axleSectionEntry.HasComponent(component.AxleSectionFaultTag) {
return ecs.NewErrResult(fmt.Errorf("区段[%s]非故障占用,无法进行复位操作", sectionId)) // return ecs.NewErrResult(fmt.Errorf("区段[%s]非故障占用,无法进行复位操作", sectionId))
} // }
} // }
// //
faDcAxleDeviceEntry := entity.FindAxleManageDevice(wd, sectionModel.CentralizedStation()) faDcAxleDeviceEntry := entity.FindAxleManageDevice(wd, sectionModel.CentralizedStation())
@ -53,12 +54,12 @@ func AxleSectionPdrstDrive(w ecs.World, sectionId string, set bool) error {
if sectionModel == nil { if sectionModel == nil {
return ecs.NewErrResult(fmt.Errorf("区段模型[%s]不存实体", sectionId)) return ecs.NewErrResult(fmt.Errorf("区段模型[%s]不存实体", sectionId))
} }
if set { // if set {
axleSectionEntry := wd.EntityMap[sectionId] // axleSectionEntry := wd.EntityMap[sectionId]
if !axleSectionEntry.HasComponent(component.AxleSectionFaultTag) { // if !axleSectionEntry.HasComponent(component.AxleSectionFaultTag) {
return ecs.NewErrResult(fmt.Errorf("区段[%s]非故障占用,无法进行复位操作", sectionId)) // return ecs.NewErrResult(fmt.Errorf("区段[%s]非故障占用,无法进行复位操作", sectionId))
} // }
} // }
// //
faDcAxleDeviceEntry := entity.FindAxleManageDevice(wd, sectionModel.CentralizedStation()) faDcAxleDeviceEntry := entity.FindAxleManageDevice(wd, sectionModel.CentralizedStation())

@ -1 +1 @@
Subproject commit 5d4e5c51fd43fa25d3ef7a8bd2cbc3d277b94a8d Subproject commit 8a028e6405150dada3caa4c90f34ebf93aef6163