【IBP盘错误信息打印】

This commit is contained in:
weizhihong 2023-12-07 10:54:55 +08:00
parent a7102304fd
commit ec9e136495
2 changed files with 9 additions and 7 deletions

View File

@ -170,7 +170,7 @@ func LoadEMPEntity(w ecs.World, entry *ecs.Entry, datas []*repository.Electronic
d.EMPJ = NewRelayEntity(w, r, entityMap) d.EMPJ = NewRelayEntity(w, r, entityMap)
emp.EMPJMap[r.Code()] = d emp.EMPJMap[r.Code()] = d
} else { } else {
slog.Warn("车站未实现设备[id:%s]逻辑", c.Id()) slog.Warn("未实现设备[id:%s]逻辑", c.Id())
} }
} }
} }
@ -188,20 +188,20 @@ func LoadEMPEntity(w ecs.World, entry *ecs.Entry, datas []*repository.Electronic
} else if ok && strings.HasPrefix(c.Code(), "EMP") { } else if ok && strings.HasPrefix(c.Code(), "EMP") {
d.EMP_BTNS = append(d.EMP_BTNS, NewButtonEntity(w, b, entityMap)) d.EMP_BTNS = append(d.EMP_BTNS, NewButtonEntity(w, b, entityMap))
} else { } else {
slog.Warn("车站未实现设备[id:%s]逻辑", c.Id()) slog.Warn("未实现设备[id:%s]逻辑", c.Id())
} }
} }
emp.EMPJMap[g.Code()] = d emp.EMPJMap[g.Code()] = d
} }
} }
if emp.Alarm == nil || emp.QBA == nil || emp.SDA == nil { if emp.Alarm == nil || emp.QBA == nil || emp.SDA == nil {
return fmt.Errorf("车站EMP组合初始化出错,请检查IBP地图组合数据") return fmt.Errorf("EMP组合初始化出错,请检查IBP地图组合数据")
} }
for code, e := range emp.EMPJMap { for code, e := range emp.EMPJMap {
if e.EMPFA_BTN == nil || e.EMPD == nil || len(e.EMP_BTNS) == 0 { if e.EMPFA_BTN == nil || e.EMPD == nil || len(e.EMP_BTNS) == 0 {
return fmt.Errorf("车站组合[%s]还原按钮未关联,请检查IBP地图组合数据", code) return fmt.Errorf("组合[%s]还原按钮未关联,请检查IBP地图组合数据", code)
} else if e.EMPJ == nil { } else if e.EMPJ == nil {
return fmt.Errorf("车站组合[%s]还原按钮未关联,请检查继电器地图组合数据", code) return fmt.Errorf("组合[%s]继电器未关联,请检查继电器地图组合数据", code)
} }
} }
entry.AddComponent(component.EmpElectronicType, unsafe.Pointer(emp)) entry.AddComponent(component.EmpElectronicType, unsafe.Pointer(emp))

View File

@ -1,6 +1,8 @@
package entity package entity
import ( import (
"fmt"
"joylink.club/ecs" "joylink.club/ecs"
"joylink.club/rtsssimulation/component" "joylink.club/rtsssimulation/component"
) )
@ -25,11 +27,11 @@ func LoadStations(w ecs.World) error {
entry := NewStationEntity(w, station.Id(), data) entry := NewStationEntity(w, station.Id(), data)
err = LoadSPKEntity(w, entry, station.SpksComponents(), data) // 人员防护 err = LoadSPKEntity(w, entry, station.SpksComponents(), data) // 人员防护
if err != nil { if err != nil {
return err return fmt.Errorf("车站【%s】人员防护error:%s", station.Id(), err.Error())
} }
err = LoadEMPEntity(w, entry, station.EmpGroups(), data) // 紧急停车 err = LoadEMPEntity(w, entry, station.EmpGroups(), data) // 紧急停车
if err != nil { if err != nil {
return err return fmt.Errorf("车站【%s】紧急停车error:%s", station.Id(), err.Error())
} }
} }
return nil return nil