|
@@ -972,7 +972,10 @@ func (c *CheckAreaMgr) getIedTypeCode(modelid int, iedtype string) string {
|
|
|
//变压器间隔分析
|
|
|
func (c *CheckAreaMgr) pT(modelid int, iedtypes string, ieds map[string]orm.Params, HasAreaJ bool) {
|
|
|
scdParseMgr := new(ScdParse)
|
|
|
+ scdNodeMgr := new(ScdNode)
|
|
|
db := orm.NewOrm()
|
|
|
+
|
|
|
+ scdXmlObj, _ := scdParseMgr.GetScdXmlObjectBySCDID(tools.IsEmpty(c.ScdId))
|
|
|
//获取当前站的各电压等级
|
|
|
volRows := []orm.Params{}
|
|
|
_, err := db.Raw("select t.vol, CAST(REPLACE(UPPER(g.name),'KV','') as SIGNED) volname from t_area_ied_relation t,global_const_code g where g.code=CONCAT('v_level_',t.vol) and g.parentcode='voltage_level' and t.vol!=999 and t.scd_id=? GROUP BY t.vol ORDER BY volname desc", c.ScdId).Values(&volRows)
|
|
@@ -1041,12 +1044,22 @@ func (c *CheckAreaMgr) pT(modelid int, iedtypes string, ieds map[string]orm.Para
|
|
|
//mmIedName := ""
|
|
|
pl_iedname := tools.IsEmpty(row["ied_name"])
|
|
|
iednameParts := scdParseMgr.ParseIedName(pl_iedname)
|
|
|
+ areadesc := tools.IsEmpty(row["ied_desc"])
|
|
|
+ if areadesc == "" {
|
|
|
+ iedobj := scdNodeMgr.GetIed(scdXmlObj, "", pl_iedname)
|
|
|
+ if iedobj != nil {
|
|
|
+ areadesc = iedobj.Desc
|
|
|
+ } else {
|
|
|
+ areadesc = tools.IsEmpty(row["area_name"])
|
|
|
+ }
|
|
|
+ }
|
|
|
+ areadesc = strings.ReplaceAll(areadesc, "装置", "")
|
|
|
//添加间隔数据
|
|
|
dbdata := T_data_check_area{
|
|
|
ModelId: modelid,
|
|
|
ScdId: c.ScdId,
|
|
|
AreaType: "T",
|
|
|
- AreaName: tools.IsEmpty(row["area_name"]) + iednameParts[7],
|
|
|
+ AreaName: areadesc + iednameParts[7],
|
|
|
}
|
|
|
newid, err := db.Insert(&dbdata)
|
|
|
if err != nil {
|
|
@@ -1293,13 +1306,22 @@ func (c *CheckAreaMgr) pL(modelid int, vol, iedtypes string, ieds map[string]orm
|
|
|
mmIedName := ""
|
|
|
pl_iedname := tools.IsEmpty(row["ied_name"])
|
|
|
iednameParts := scdParseMgr.ParseIedName(pl_iedname)
|
|
|
-
|
|
|
+ areadesc := tools.IsEmpty(row["ied_desc"])
|
|
|
+ if areadesc == "" {
|
|
|
+ iedobj := scdNodeMgr.GetIed(scdXmlObj, "", pl_iedname)
|
|
|
+ if iedobj != nil {
|
|
|
+ areadesc = iedobj.Desc
|
|
|
+ } else {
|
|
|
+ areadesc = tools.IsEmpty(row["area_name"])
|
|
|
+ }
|
|
|
+ }
|
|
|
+ areadesc = strings.ReplaceAll(areadesc, "装置", "")
|
|
|
//添加间隔数据
|
|
|
dbdata := T_data_check_area{
|
|
|
ModelId: modelid,
|
|
|
ScdId: c.ScdId,
|
|
|
AreaType: "L",
|
|
|
- AreaName: tools.IsEmpty(row["area_name"]) + iednameParts[7],
|
|
|
+ AreaName: areadesc + iednameParts[7],
|
|
|
}
|
|
|
newid, err := db.Insert(&dbdata)
|
|
|
if err != nil {
|
|
@@ -1337,30 +1359,8 @@ func (c *CheckAreaMgr) pL(modelid int, vol, iedtypes string, ieds map[string]orm
|
|
|
} else {
|
|
|
continue
|
|
|
}
|
|
|
- } else if tyCode == "PLC" || tyCode == "PCL" {
|
|
|
- //判断是否是保测一体的
|
|
|
- if strings.Contains(iedtypes, "PLC") || strings.Contains(iedtypes, "PCL") {
|
|
|
- no := []string{"PLC", "PCL", "PL"}
|
|
|
- for _, n := range no {
|
|
|
- plcIedName := n + iednameParts[3] + iednameParts[4] + iednameParts[5] + iednameParts[6] + iednameParts[7]
|
|
|
- if scdNodeMgr.GetIed(scdXmlObj, "", plcIedName) != nil {
|
|
|
- inAreaIedName = plcIedName
|
|
|
- break
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
} else {
|
|
|
inAreaIedName = tyCode + iednameParts[3] + iednameParts[4] + iednameParts[5] + iednameParts[6] + iednameParts[7]
|
|
|
- if tyCode == "IML" {
|
|
|
- //查找IML装置是否存在,不存在就查找MIL开头装置做中合智一体装置
|
|
|
- no := []string{"IML", "MIL"}
|
|
|
- for _, n := range no {
|
|
|
- milIedName := n + iednameParts[3] + iednameParts[4] + iednameParts[5] + iednameParts[6] + iednameParts[7]
|
|
|
- if scdNodeMgr.GetIed(scdXmlObj, "", milIedName) != nil {
|
|
|
- inAreaIedName = milIedName
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
}
|
|
|
if strings.Index("ABCDE", iednameParts[7]) > -1 {
|
|
|
//最后一位是字母则说明是AB套
|
|
@@ -1405,10 +1405,10 @@ func (c *CheckAreaMgr) pL(modelid int, vol, iedtypes string, ieds map[string]orm
|
|
|
//母联间隔分析
|
|
|
func (c *CheckAreaMgr) pJ(modelid int, vol, iedtypes string, ieds map[string]orm.Params, pjIed string) {
|
|
|
scdParseMgr := new(ScdParse)
|
|
|
- //scdNodeMgr := new(ScdNode)
|
|
|
+ scdNodeMgr := new(ScdNode)
|
|
|
db := orm.NewOrm()
|
|
|
pjIed = c.getIedTypeCode(modelid, pjIed)
|
|
|
- //scdXmlObject, _ := scdParseMgr.GetScdXmlObjectBySCDID(tools.IsEmpty(c.ScdId))
|
|
|
+ scdXmlObject, _ := scdParseMgr.GetScdXmlObjectBySCDID(tools.IsEmpty(c.ScdId))
|
|
|
for _, row := range ieds {
|
|
|
if tools.IsEmpty(row["vol"]) != vol || tools.IsEmpty(row["ied_type"]) != pjIed[0:1] || tools.IsEmpty(row["p_type"]) != pjIed[1:2] {
|
|
|
continue
|
|
@@ -1417,12 +1417,22 @@ func (c *CheckAreaMgr) pJ(modelid int, vol, iedtypes string, ieds map[string]orm
|
|
|
mmIedName := ""
|
|
|
pl_iedname := tools.IsEmpty(row["ied_name"])
|
|
|
iednameParts := scdParseMgr.ParseIedName(pl_iedname)
|
|
|
+ areadesc := tools.IsEmpty(row["ied_desc"])
|
|
|
+ if areadesc == "" {
|
|
|
+ iedobj := scdNodeMgr.GetIed(scdXmlObject, "", pl_iedname)
|
|
|
+ if iedobj != nil {
|
|
|
+ areadesc = iedobj.Desc
|
|
|
+ } else {
|
|
|
+ areadesc = tools.IsEmpty(row["area_name"])
|
|
|
+ }
|
|
|
+ }
|
|
|
+ areadesc = strings.ReplaceAll(areadesc, "装置", "")
|
|
|
//添加间隔数据
|
|
|
dbdata := T_data_check_area{
|
|
|
ModelId: modelid,
|
|
|
ScdId: c.ScdId,
|
|
|
AreaType: "J",
|
|
|
- AreaName: tools.IsEmpty(row["area_name"]) + iednameParts[7],
|
|
|
+ AreaName: areadesc + iednameParts[7],
|
|
|
}
|
|
|
newid, err := db.Insert(&dbdata)
|
|
|
if err != nil {
|