Pārlūkot izejas kodu

完成模型关联关系检查

liling 1 gadu atpakaļ
vecāks
revīzija
33817a8439

+ 4 - 4
service/controllers/ruleController.go

@@ -38,7 +38,7 @@ func init() {
 // @Param        apply_standard query  	string   false  "规则标准"
 // @Success      200    {object} ResultOK   成功
 // @Failure 	 500 	status  失败
-// @router /scd_check_tools/rule/list [get]
+// @router /scd/rule/list [get]
 func (c *RuleController) GetRuleDefList() {
 	rule_type := c.GetString("rule_type")
 	enable := c.GetString("enable")
@@ -93,7 +93,7 @@ func (c *RuleController) GetRuleDefList() {
 // @Param        apply_standard formData  	string   false  "规则标准"
 // @Success      200    {object} ResultOK   成功
 // @Failure 	 500 	status  失败
-// @router /scd_check_tools/rule/save [post]
+// @router /scd/rule/save [post]
 func (c *RuleController) SaveScdRuleDef() {
 	//变电站ID
 	//station_id := c.GetString("station_id")
@@ -134,7 +134,7 @@ func (c *RuleController) SaveScdRuleDef() {
 // @Param        id 			formData   int   true  "规则ID"
 // @Success      200    {object} ResultOK   成功
 // @Failure 	 500 	status  失败
-// @router /scd_check_tools/rule/remove [post]
+// @router /scd/rule/remove [post]
 func (c *RuleController) DeleteScdRuleDef() {
 	id := c.GetString("id")
 	if id == "" {
@@ -168,7 +168,7 @@ func (c *RuleController) DeleteScdRuleDef() {
 // @Param        scd_id formData   int   true  "SCD文件ID"
 // @Success      200    {object} ResultOK   成功
 // @Failure 	 500 	status  失败
-// @router /scd_check_tools/rule/reset [post]
+// @router /scd/rule/reset [post]
 func (c *RuleController) ResetRule() {
 	id := c.GetString("scd_id")
 	if id == "" {

+ 6 - 6
service/controllers/scdCompController.go

@@ -33,7 +33,7 @@ func init() {
 // @Param        pid  	query     int   false  "上级对象ID"
 // @Success      200    {object} ResultOK   成功
 // @Failure 	 500 	status  失败
-// @router /scd_check_tools/comp/tree [get]
+// @router /scd/comp/tree [get]
 func (c *ScdCompController) GetCheckToolsTreeRoot() {
 	scdnode := new(bo.ScdCompare)
 	scdnode.Userinfo = c.GetCurrentUserInfo()
@@ -66,7 +66,7 @@ func (c *ScdCompController) GetCheckToolsTreeRoot() {
 // @Param        station_id query     int   true  "变电站ID"
 // @Success      200    {object} ResultOK   成功
 // @Failure 	 500 	status  失败
-// @router /scd_check_tools/comp/list [get]
+// @router /scd/comp/list [get]
 func (c *ScdCompController) GetCompList() {
 	stationid, _ := c.GetInt("station_id")
 	flowObj := new(bo.ScdCompare)
@@ -92,7 +92,7 @@ func (c *ScdCompController) GetCompList() {
 // @Param        itemcode query     string   false  "差异对象类型代码"
 // @Success      200    {object} ResultOK   成功
 // @Failure 	 500 	status  失败
-// @router /scd_check_tools/comp/result [get]
+// @router /scd/comp/result [get]
 func (c *ScdCompController) GetResult() {
 	compid, _ := c.GetInt("comp_id")
 	iedname := c.GetString("ied_name")
@@ -125,7 +125,7 @@ func (c *ScdCompController) GetResult() {
 // @Param        comptype query     string   false  "差异类别。值为:i|d|u之一"
 // @Success      200    {object} ResultOK   成功
 // @Failure 	 500 	status  失败
-// @router /scd_check_tools/comp/iedstat/type [get]
+// @router /scd/comp/iedstat/type [get]
 func (c *ScdCompController) GetCompIedStatTypeResult() {
 	comp := new(bo.ScdCompare)
 	comp.Userinfo = c.GetCurrentUserInfo()
@@ -161,7 +161,7 @@ func (c *ScdCompController) GetCompIedStatTypeResult() {
 // @Param        comp_id query     int   true  "差异比对记录ID"
 // @Success      200    {object} ResultOK   成功
 // @Failure 	 500 	status  失败
-// @router /scd_check_tools/comp/stat/result [get]
+// @router /scd/comp/stat/result [get]
 func (c *ScdCompController) GetCompStatResult() {
 	comp := new(bo.ScdCompare)
 	comp.Userinfo = c.GetCurrentUserInfo()
@@ -189,7 +189,7 @@ func (c *ScdCompController) GetCompStatResult() {
 // @Param        ids 			query  	string   false  "如果是2个非SCD对比文件时,需要对比的文件ID列表,使用逗号分隔。仅当type为ccd\cid\ccd_cid_scd\icd_scd时有效"
 // @Success      200    {object} ResultOK   成功
 // @Failure 	 500 	status  失败
-// @router /scd_check_tools/comp/start [post]
+// @router /scd/comp/start [post]
 func (c *ScdCompController) Compare() {
 	comp := new(bo.ScdCompare)
 	comp.Userinfo = c.GetCurrentUserInfo()

+ 1 - 1
service/controllers/statController.go

@@ -33,7 +33,7 @@ func init() {
 // @Success      200    {object} ResultOK   成功
 // @Success      200    {object} ResultError   错误
 // @Failure 	 500 	status  失败
-// @router /scd_check_tools/stat/right [get]
+// @router /scd/stat/right [get]
 func (c *StatController) ScdRightStat() {
 	stationidLst := []string{}
 	stationid := c.GetString("station_id")

+ 441 - 0
service/models/bo/checktools_area.go

@@ -5,6 +5,7 @@ import (
 	"fmt"
 	"scd_check_tools/logger"
 	"scd_check_tools/models/enum"
+	"scd_check_tools/models/node_attr"
 	"scd_check_tools/tools"
 	"strconv"
 	"strings"
@@ -307,6 +308,139 @@ func (c *CheckAreaMgr) Reset() error {
 	return nil
 }
 
+//检测间隔装置关系正确性
+func (c *CheckAreaMgr) CheckAreaIedRelation() error {
+	// 获取当前scd中需要检查的间隔
+	arealist := []orm.Params{}
+	db := orm.NewOrm()
+	_, err := db.Raw("select id,area_name,area_type,model_id from t_data_check_area where scd_id=?", c.ScdId).Values(&arealist)
+	if err != nil {
+		logger.Logger.Error(err)
+		return err
+	}
+	scdNodeRule := new(ScdNodeRule)
+	area_ruleid := ""
+	area_ruleList, _, _ := scdNodeRule.GetDefList(map[string]interface{}{"check_name": "间隔装置与检查模型不符"}, 1, 1)
+	if len(area_ruleList) > 0 {
+		area_ruleid = tools.IsEmpty(area_ruleList[0]["id"])
+	}
+	if area_ruleid == "" {
+		return errors.New(fmt.Sprintf("未定义间隔装置的检查规则“间隔装置与检查模型不符”"))
+	}
+	scdParseMgr := new(ScdParse)
+	scdXmlObj, serr := scdParseMgr.GetScdXmlObjectBySCDID(tools.IsEmpty(c.ScdId))
+	if serr != nil {
+		return serr
+	}
+	if scdXmlObj == nil {
+		return errors.New("无效的SCD")
+	}
+	scdNode := new(ScdNode)
+	model_refs := map[string][]orm.Params{} //模型定义的装置关系定义
+	area_ieds := map[string][]orm.Params{}  //间隔下的装置列表
+	for _, row := range arealist {
+		//获取间隔标准装置及关系
+		modelid := tools.IsEmpty(row["model_id"])
+		//area_name := tools.IsEmpty(row["area_name"])
+		//area_type := tools.IsEmpty(row["area_type"]) //间隔模型类型
+		area_id := tools.IsEmpty(row["id"])
+		s := []orm.Params{}
+		_, err = db.Raw("select from_ied_code,to_ied_code,in_type from t_data_model_relation_def where model_id=?", modelid).Values(&s)
+		if err != nil {
+			logger.Logger.Error(err)
+			return err
+		}
+		if len(s) == 0 {
+			return errors.New(fmt.Sprintf("模型%d还未配置装置关系", modelid))
+		}
+		model_refs[modelid] = s
+		/*
+			hasIeds := map[string]bool{}
+			for _, row1 := range s {
+				iedname := tools.IsEmpty(row1["from_ied_code"])
+				if !hasIeds[iedname] {
+					hasIeds[iedname] = true
+				}
+				iedname = tools.IsEmpty(row1["to_ied_code"])
+				if !hasIeds[iedname] {
+					hasIeds[iedname] = true
+				}
+			}
+		*/
+		s1 := []orm.Params{}
+		_, err = db.Raw("select ied_name from t_data_check_area_ied where area_id=?", area_id).Values(&s1)
+		if err != nil {
+			logger.Logger.Error(err)
+			return err
+		}
+		if len(s) == 0 {
+			return errors.New(fmt.Sprintf("间隔%s未发现任何装置", tools.IsEmpty(row["area_name"])))
+		}
+		area_ieds[area_id] = s1
+		/*
+			curIeds := map[string]string{}
+			for _, row1 := range s1 {
+				iedname := strings.Trim(tools.IsEmpty(row1["ied_name"]), " ")
+				iedParts := scdParseMgr.ParseIedName(iedname)
+				iedtype := iedParts[0] + iedParts[1] + iedParts[2]
+				curIeds[iedtype] = iedname
+			}
+			for k, _ := range hasIeds {
+				iedname := curIeds[k]
+				if iedname == "" {
+					parse_result := fmt.Sprintf("间隔%s缺失类型为%s的装置", area_name, k)
+					r := map[string]interface{}{"scdid": c.ScdId, "lineno": 0, "ruleid": area_ruleid, "nodeid": 0, "parse_result": parse_result}
+					//检查未通过
+					scdNodeRule.AppendPaseResult(r)
+				} else {
+					//判断装置是否存在
+					if scdNode.GetIed(scdXmlObj, "", iedname) == nil {
+						parse_result := fmt.Sprintf("间隔%s内装置%s未定义", area_name, iedname)
+						r := map[string]interface{}{"scdid": c.ScdId, "lineno": 0, "ruleid": area_ruleid, "nodeid": 0, "parse_result": parse_result}
+						//检查未通过
+						scdNodeRule.AppendPaseResult(r)
+					}
+				}
+			}*/
+	}
+	//装置关联关系分析
+	//先分析母联间隔,如果没有选择母联间隔时,主变间隔中不包含母联终端装置
+	HasAreaJ := false
+	for _, row := range arealist {
+		area_name := tools.IsEmpty(row["area_name"])
+		areaCode := tools.IsEmpty(row["area_type"]) //间隔模型类型
+		area_id := tools.IsEmpty(row["id"])
+		if areaCode == "J" {
+			HasAreaJ = true
+			modelid := tools.IsEmpty(row["model_id"])
+			c.cJ(scdXmlObj, scdNode, scdNodeRule, area_name, model_refs[modelid], area_ieds[area_id], "PE", area_ruleid)
+			c.cJ(scdXmlObj, scdNode, scdNodeRule, area_name, model_refs[modelid], area_ieds[area_id], "PJ", area_ruleid)
+			c.cJ(scdXmlObj, scdNode, scdNodeRule, area_name, model_refs[modelid], area_ieds[area_id], "PK", area_ruleid)
+			c.cJ(scdXmlObj, scdNode, scdNodeRule, area_name, model_refs[modelid], area_ieds[area_id], "PF", area_ruleid)
+		}
+	}
+	for _, row := range arealist {
+		area_name := tools.IsEmpty(row["area_name"])
+		areaCode := tools.IsEmpty(row["area_type"]) //间隔模型类型
+		area_id := tools.IsEmpty(row["id"])
+		modelid := tools.IsEmpty(row["model_id"])
+		if areaCode == "J" {
+			continue
+		}
+		if areaCode == "L" {
+			//线路间隔
+			c.cL(scdXmlObj, scdNode, scdNodeRule, area_name, model_refs[modelid], area_ieds[area_id], area_ruleid)
+		}
+		if areaCode == "T" {
+			//变压器齐间隔
+			c.cT(scdXmlObj, scdNode, scdNodeRule, area_name, model_refs[modelid], area_ieds[area_id], area_ruleid, HasAreaJ)
+		}
+	}
+	scdNodeRule.CheckFinish()
+	scdNodeRule.Flush()
+	return nil
+}
+
 //解析模型间隔
 func (c *CheckAreaMgr) ParseModelArea() {
 	c.Init(c.ScdId)
@@ -743,6 +877,313 @@ func (c *CheckAreaMgr) pJ(modelid int, vol, iedtypes string, ieds map[string]orm
 
 }
 
+//母联间隔装置关系检查
+func (c *CheckAreaMgr) cJ(scdXmlObj *node_attr.SCL, scdNodeMgr *ScdNode, scdNodeRule *ScdNodeRule, area_name string, ied_refs []orm.Params, area_ieds []orm.Params, pjIed, area_ruleid string) {
+
+	masterIed := new(node_attr.NIED)
+	findIedName := ""
+	for _, row2 := range area_ieds {
+		findIedName = tools.IsEmpty(row2["ied_name"])
+		if strings.HasPrefix(findIedName, pjIed) {
+			masterIed = scdNodeMgr.GetIed(scdXmlObj, "", findIedName)
+			break
+		}
+	}
+	if masterIed == nil {
+		return
+	}
+	dealFromIed := map[string]int{}
+	for _, row := range ied_refs {
+		fromiedtype := tools.IsEmpty(row["from_ied_code"])
+		toiedtype := tools.IsEmpty(row["to_ied_code"])
+		reftype := tools.IsEmpty(row["in_type"])
+		tmpFromAreaIeds := []orm.Params{}
+		tmpToAreaIeds := []orm.Params{}
+		for _, row2 := range area_ieds {
+			findIedName = tools.IsEmpty(row2["ied_name"])
+			if strings.HasPrefix(findIedName, fromiedtype) {
+				masterIed = scdNodeMgr.GetIed(scdXmlObj, "", findIedName)
+				if masterIed != nil {
+					tmpFromAreaIeds = append(tmpFromAreaIeds, row2)
+				} else {
+					if dealFromIed[findIedName] == 0 {
+						parse_result := fmt.Sprintf("间隔%s的装置%s缺失", area_name, findIedName)
+						r := map[string]interface{}{"scdid": c.ScdId, "lineno": 0, "ruleid": area_ruleid, "nodeid": 0, "parse_result": parse_result}
+						//检查未通过
+						scdNodeRule.AppendPaseResult(r)
+					}
+					dealFromIed[findIedName] = 1
+				}
+			}
+			if strings.HasPrefix(findIedName, toiedtype) {
+				tmpToAreaIeds = append(tmpToAreaIeds, row2)
+			}
+		}
+		if len(tmpFromAreaIeds) == 0 {
+			continue
+		}
+		if len(tmpToAreaIeds) == 0 {
+			parse_result := fmt.Sprintf("间隔%s缺失类型为%s的装置", area_name, toiedtype)
+			r := map[string]interface{}{"scdid": c.ScdId, "lineno": 0, "ruleid": area_ruleid, "nodeid": 0, "parse_result": parse_result}
+			//检查未通过
+			scdNodeRule.AppendPaseResult(r, masterIed)
+			continue
+		}
+		toIedname := ""
+		for _, row2 := range tmpFromAreaIeds {
+			findIedName = tools.IsEmpty(row2["ied_name"])
+			hasToIedRef := false
+			hasToIed := false
+			for _, row3 := range tmpToAreaIeds {
+				toIedname = tools.IsEmpty(row3["ied_name"])
+				masterIed = scdNodeMgr.GetIed(scdXmlObj, "", toIedname)
+				if masterIed != nil {
+					hasToIed = true
+					// 获取该ied的输出(ref_type为0)装置,并从中检测是否存在toiedtype类型的装置
+					inout, _ := scdNodeMgr.GetIedRelations(map[string]interface{}{"scd_id": c.ScdId, "ied_name": findIedName})
+					logger.Logger.Debug(fmt.Sprintf("ied:%s refs:%+v", findIedName, inout))
+					if inout != nil {
+						outiedlist := inout[findIedName].(orm.Params)["list"].([]orm.Params)
+						for _, ieditem := range outiedlist {
+							outiedname := ieditem["ref_ied_name"].(string)
+							if outiedname == toIedname && ieditem["ref_type"].(string) == "0" {
+								hasToIedRef = true
+								break
+							}
+						}
+					}
+					if !hasToIedRef {
+						parse_result := fmt.Sprintf("间隔%s的装置%s缺失与装置%s的%s信号关联", area_name, findIedName, toIedname, reftype)
+						r := map[string]interface{}{"scdid": c.ScdId, "lineno": 0, "ruleid": area_ruleid, "nodeid": 0, "parse_result": parse_result}
+						//检查未通过
+						scdNodeRule.AppendPaseResult(r, masterIed)
+					}
+				}
+			}
+			if !hasToIed {
+				parse_result := fmt.Sprintf("间隔%s的装置%s缺失关联装置%s", area_name, findIedName, toIedname)
+				r := map[string]interface{}{"scdid": c.ScdId, "lineno": 0, "ruleid": area_ruleid, "nodeid": 0, "parse_result": parse_result}
+				//检查未通过
+				scdNodeRule.AppendPaseResult(r, masterIed)
+			}
+		}
+	}
+
+}
+
+//线路间隔装置关系检查
+func (c *CheckAreaMgr) cL(scdXmlObj *node_attr.SCL, scdNodeMgr *ScdNode, scdNodeRule *ScdNodeRule, area_name string, ied_refs []orm.Params, area_ieds []orm.Params, area_ruleid string) {
+	masterIed := new(node_attr.NIED)
+	findIedName := ""
+	for _, row2 := range area_ieds {
+		findIedName = tools.IsEmpty(row2["ied_name"])
+		if strings.HasPrefix(findIedName, "PL") {
+			masterIed = scdNodeMgr.GetIed(scdXmlObj, "", findIedName)
+			break
+		}
+	}
+	if masterIed == nil {
+		return
+	}
+	dealFromIed := map[string]int{}
+	for _, row := range ied_refs {
+		fromiedtype := tools.IsEmpty(row["from_ied_code"])
+		toiedtype := tools.IsEmpty(row["to_ied_code"])
+		reftype := tools.IsEmpty(row["in_type"])
+		tmpFromAreaIeds := []orm.Params{}
+		tmpToAreaIeds := []orm.Params{}
+		for _, row2 := range area_ieds {
+			findIedName = tools.IsEmpty(row2["ied_name"])
+			if strings.HasPrefix(findIedName, fromiedtype) {
+				masterIed = scdNodeMgr.GetIed(scdXmlObj, "", findIedName)
+				if masterIed != nil {
+					tmpFromAreaIeds = append(tmpFromAreaIeds, row2)
+				} else {
+					if dealFromIed[findIedName] == 0 {
+						parse_result := fmt.Sprintf("间隔%s的装置%s缺失", area_name, findIedName)
+						r := map[string]interface{}{"scdid": c.ScdId, "lineno": 0, "ruleid": area_ruleid, "nodeid": 0, "parse_result": parse_result}
+						//检查未通过
+						scdNodeRule.AppendPaseResult(r)
+					}
+					dealFromIed[findIedName] = 1
+				}
+			}
+			if strings.HasPrefix(findIedName, toiedtype) {
+				tmpToAreaIeds = append(tmpToAreaIeds, row2)
+			}
+		}
+		if len(tmpFromAreaIeds) == 0 {
+			continue
+		}
+		if len(tmpToAreaIeds) == 0 {
+			parse_result := fmt.Sprintf("间隔%s缺失类型为%s的装置", area_name, toiedtype)
+			r := map[string]interface{}{"scdid": c.ScdId, "lineno": 0, "ruleid": area_ruleid, "nodeid": 0, "parse_result": parse_result}
+			//检查未通过
+			scdNodeRule.AppendPaseResult(r, masterIed)
+			continue
+		}
+		toIedname := ""
+		for _, row2 := range tmpFromAreaIeds {
+			findIedName = tools.IsEmpty(row2["ied_name"])
+			hasToIedRef := false
+			hasToIed := false
+			for _, row3 := range tmpToAreaIeds {
+				toIedname = tools.IsEmpty(row3["ied_name"])
+				masterIed = scdNodeMgr.GetIed(scdXmlObj, "", toIedname)
+				if masterIed != nil {
+					hasToIed = true
+					// 获取该ied的输出(ref_type为0)装置,并从中检测是否存在toiedtype类型的装置
+					inout, _ := scdNodeMgr.GetIedRelations(map[string]interface{}{"scd_id": c.ScdId, "ied_name": findIedName})
+					logger.Logger.Debug(fmt.Sprintf("ied:%s refs:%+v", findIedName, inout))
+					if inout != nil {
+						outiedlist := inout[findIedName].(orm.Params)["list"].([]orm.Params)
+						for _, ieditem := range outiedlist {
+							outiedname := ieditem["ref_ied_name"].(string)
+							if outiedname == toIedname && ieditem["ref_type"].(string) == "0" {
+								hasToIedRef = true
+								break
+							}
+						}
+					}
+					if !hasToIedRef {
+						parse_result := fmt.Sprintf("间隔%s的装置%s缺失与装置%s的%s信号关联", area_name, findIedName, toIedname, reftype)
+						r := map[string]interface{}{"scdid": c.ScdId, "lineno": 0, "ruleid": area_ruleid, "nodeid": 0, "parse_result": parse_result}
+						//检查未通过
+						scdNodeRule.AppendPaseResult(r, masterIed)
+					}
+				}
+			}
+			if !hasToIed {
+				parse_result := fmt.Sprintf("间隔%s的装置%s缺失关联装置%s", area_name, findIedName, toIedname)
+				r := map[string]interface{}{"scdid": c.ScdId, "lineno": 0, "ruleid": area_ruleid, "nodeid": 0, "parse_result": parse_result}
+				//检查未通过
+				scdNodeRule.AppendPaseResult(r, masterIed)
+			}
+		}
+	}
+
+}
+
+//变压器间隔装置关系检查
+func (c *CheckAreaMgr) cT(scdXmlObj *node_attr.SCL, scdNodeMgr *ScdNode, scdNodeRule *ScdNodeRule, area_name string, ied_refs []orm.Params, area_ieds []orm.Params, area_ruleid string, HasAreaJ bool) {
+	masterIed := new(node_attr.NIED)
+	findIedName := ""
+	for _, row2 := range area_ieds {
+		findIedName = tools.IsEmpty(row2["ied_name"])
+		if strings.HasPrefix(findIedName, "PT") {
+			masterIed = scdNodeMgr.GetIed(scdXmlObj, "", findIedName)
+			break
+		}
+	}
+	if masterIed == nil {
+		return
+	}
+	scdParseMgr := new(ScdParse)
+	dealFromIed := map[string]int{}
+	for _, row := range ied_refs {
+		fromiedtype := tools.IsEmpty(row["from_ied_code"])
+		toiedtype := tools.IsEmpty(row["to_ied_code"])
+		reftype := tools.IsEmpty(row["in_type"])
+		tmpFromAreaIeds := []orm.Params{}
+		tmpToAreaIeds := []orm.Params{}
+		for _, row2 := range area_ieds {
+			findIedName = tools.IsEmpty(row2["ied_name"])
+			if strings.HasPrefix(findIedName, fromiedtype) {
+				masterIed = scdNodeMgr.GetIed(scdXmlObj, "", findIedName)
+				if masterIed != nil {
+					tmpFromAreaIeds = append(tmpFromAreaIeds, row2)
+				} else {
+					if dealFromIed[findIedName] == 0 {
+						parse_result := fmt.Sprintf("间隔%s的装置%s缺失", area_name, findIedName)
+						r := map[string]interface{}{"scdid": c.ScdId, "lineno": 0, "ruleid": area_ruleid, "nodeid": 0, "parse_result": parse_result}
+						//检查未通过
+						scdNodeRule.AppendPaseResult(r)
+					}
+					dealFromIed[findIedName] = 1
+				}
+			}
+			if strings.HasPrefix(findIedName, toiedtype) {
+				tmpToAreaIeds = append(tmpToAreaIeds, row2)
+			}
+		}
+		if len(tmpFromAreaIeds) == 0 {
+			continue
+		}
+		if len(tmpToAreaIeds) == 0 {
+			logger.Logger.Debug(fmt.Sprintf("缺失类型关联装置 :%+v", row))
+			parse_result := fmt.Sprintf("间隔%s缺失类型为%s的装置", area_name, toiedtype)
+			r := map[string]interface{}{"scdid": c.ScdId, "lineno": 0, "ruleid": area_ruleid, "nodeid": 0, "parse_result": parse_result}
+			//检查未通过
+			scdNodeRule.AppendPaseResult(r, masterIed)
+			continue
+		}
+		toIedname := ""
+		for _, row2 := range tmpFromAreaIeds {
+			findIedName = tools.IsEmpty(row2["ied_name"])
+			hasToIedRef := false
+			hasToIed := false
+			t1 := fromiedtype + "->" + toiedtype
+			volLevel := "" //电压等级
+			if t1 == "CT->IT" || t1 == "IT->CT" || t1 == "CT->IB" || t1 == "IB->CT" || t1 == "MM->MT" || t1 == "PM->IB" || t1 == "IB->PM" || t1 == "PM->IT" || t1 == "IT->PM" {
+				ps := scdParseMgr.ParseIedName(findIedName)
+				volLevel = ps[3] + ps[4]
+			}
+			hasSameVolIed := false
+			for _, row3 := range tmpToAreaIeds {
+				toIedname = tools.IsEmpty(row3["ied_name"])
+				if volLevel != "" {
+					ps := scdParseMgr.ParseIedName(toIedname)
+					if volLevel != ps[3]+ps[4] {
+						//排除不是同一电压等级的装置
+						continue
+					}
+					hasSameVolIed = true
+				}
+				if scdNodeMgr.GetIed(scdXmlObj, "", toIedname) != nil {
+					hasToIed = true
+					// 获取该ied的输出(ref_type为0)装置,并从中检测是否存在toiedtype类型的装置
+					inout, _ := scdNodeMgr.GetIedRelations(map[string]interface{}{"scd_id": c.ScdId, "ied_name": findIedName})
+					logger.Logger.Debug(fmt.Sprintf("ied:%s refs:%+v", findIedName, inout))
+					if inout != nil {
+						outiedlist := inout[findIedName].(orm.Params)["list"].([]orm.Params)
+						for _, ieditem := range outiedlist {
+							outiedname := ieditem["ref_ied_name"].(string)
+							if outiedname == toIedname && ieditem["ref_type"].(string) == "0" {
+								hasToIedRef = true
+								break
+							}
+						}
+					}
+					if !hasToIedRef {
+						parse_result := fmt.Sprintf("间隔%s的装置%s缺失与装置%s的%s信号关联", area_name, findIedName, toIedname, reftype)
+						r := map[string]interface{}{"scdid": c.ScdId, "lineno": 0, "ruleid": area_ruleid, "nodeid": 0, "parse_result": parse_result}
+						//检查未通过
+						scdNodeRule.AppendPaseResult(r, masterIed)
+					}
+				}
+				if hasSameVolIed {
+					break
+				}
+			}
+			if toiedtype != "PT" {
+				if volLevel != "" && !hasSameVolIed {
+					parse_result := fmt.Sprintf("间隔%s的装置%s缺失同电压等级的关联类型%s装置", area_name, findIedName, toiedtype)
+					r := map[string]interface{}{"scdid": c.ScdId, "lineno": 0, "ruleid": area_ruleid, "nodeid": 0, "parse_result": parse_result}
+					//检查未通过
+					scdNodeRule.AppendPaseResult(r, masterIed)
+				} else if !hasToIed {
+					parse_result := fmt.Sprintf("间隔%s的装置%s缺失关联装置%s", area_name, findIedName, toIedname)
+					r := map[string]interface{}{"scdid": c.ScdId, "lineno": 0, "ruleid": area_ruleid, "nodeid": 0, "parse_result": parse_result}
+					//检查未通过
+					scdNodeRule.AppendPaseResult(r, masterIed)
+				}
+			}
+		}
+
+	}
+
+}
+
 //根据参考ied name找出应该关联PM装置
 func (c *CheckAreaMgr) getPMName(iednameParts []string, ieds map[string]orm.Params) string {
 	tmpIedName := "PM" + iednameParts[3] + iednameParts[4] + iednameParts[5] + "1" + iednameParts[7]

+ 4 - 2
service/models/bo/scd_file_parse.go

@@ -1933,6 +1933,8 @@ func (c *ScdParse) XmlIEDParse(stationid, scdPath, scdName string) (scdid string
 	}
 	scdmgr.RootID = newscdid
 	//间隔解析.如果间隔解析是Bay方式,需要根据节点数据进行解析
+	db.Raw("delete from t_area_ied_relation where scd_id=? ", scdmgr.RootID).Exec()
+	db.Raw("delete from t_substation_area where scd_id=? ", scdmgr.RootID).Exec()
 	if isBay {
 		logger.Logger.Debug(fmt.Sprintf("当前采集Bay间隔模式"))
 		scdmgr.AreaMgr.ParseBay(stationidint, bayList)
@@ -1959,7 +1961,7 @@ func (c *ScdParse) XmlIEDParse(stationid, scdPath, scdName string) (scdid string
 					return
 				}
 			}
-		}(stationid, scdid, scdName, len(iedlist))
+		}(stationid, tools.IsEmpty(scdmgr.RootID), scdName, len(iedlist))
 		for _, ieditem := range iedlist {
 			scdmgr.AreaMgr.AppendIedNode(scdmgr.RootID, ieditem.BaseNode.NodeId, ieditem.Name, ieditem.Desc)
 		}
@@ -1975,7 +1977,7 @@ func (c *ScdParse) XmlIEDParse(stationid, scdPath, scdName string) (scdid string
 	if err != nil {
 		logger.Logger.Error(err, fmt.Sprintf("SQL:%s", fmt.Sprintf("%s%s", node_ins, strings.Join(iedList, ","))))
 	}
-	new(TaskMgr).SetStep(scdid, enum.TaskStep_SCD_Parse.Code(), 2)
+	new(TaskMgr).SetStep(tools.IsEmpty(scdmgr.RootID), enum.TaskStep_SCD_Parse.Code(), 2)
 	return fmt.Sprintf("%d", scdmgr.RootID), nil
 }
 

+ 24 - 0
service/models/bo/scd_mgr.go

@@ -703,6 +703,10 @@ func (c *ScdMgr) CrcCheck(scdid string) (bool, error) {
 			global.CachedScdCrc.Store(fmt.Sprintf("crc_%s", scdid), crcmap)
 			//crc提取完成
 			global.IedCrcMakeState.Store(fmt.Sprintf("crc_%s", scdid), "2")
+			new(TaskMgr).SetStep(scdid, enum.TaskStep_SCD_crc_extract.Code(), 2)
+			new(TaskMgr).SetStep(scdid, enum.TaskStep_SCD_ccd_extract.Code(), 2)
+			new(TaskMgr).SetStep(scdid, enum.TaskStep_SCD_cid_extract.Code(), 2)
+			new(TaskMgr).SetStep(scdid, enum.TaskStep_SCD_icd_extract.Code(), 2)
 			return true, nil
 		}
 	}
@@ -710,11 +714,19 @@ func (c *ScdMgr) CrcCheck(scdid string) (bool, error) {
 	if err != nil {
 		//crc提取失败
 		global.IedCrcMakeState.Store(fmt.Sprintf("crc_%s", scdid), "0")
+		new(TaskMgr).SetStep(scdid, enum.TaskStep_SCD_crc_extract.Code(), 3, err.Error())
+		new(TaskMgr).SetStep(scdid, enum.TaskStep_SCD_ccd_extract.Code(), 3, err.Error())
+		new(TaskMgr).SetStep(scdid, enum.TaskStep_SCD_cid_extract.Code(), 3, err.Error())
+		new(TaskMgr).SetStep(scdid, enum.TaskStep_SCD_icd_extract.Code(), 3, err.Error())
 		return false, err
 	}
 	if scdInfo == nil {
 		//crc提取失败
 		global.IedCrcMakeState.Store(fmt.Sprintf("crc_%s", scdid), "0")
+		new(TaskMgr).SetStep(scdid, enum.TaskStep_SCD_crc_extract.Code(), 3, "无效的scd名称和路径")
+		new(TaskMgr).SetStep(scdid, enum.TaskStep_SCD_ccd_extract.Code(), 3, "无效的scd名称和路径")
+		new(TaskMgr).SetStep(scdid, enum.TaskStep_SCD_cid_extract.Code(), 3, "无效的scd名称和路径")
+		new(TaskMgr).SetStep(scdid, enum.TaskStep_SCD_icd_extract.Code(), 3, "无效的scd名称和路径")
 		return false, errors.New("无效的scd名称和路径")
 	}
 	scdpath := scdInfo["path"].(string)
@@ -739,6 +751,10 @@ func (c *ScdMgr) CrcCheck(scdid string) (bool, error) {
 		logger.Logger.Error(err)
 		//crc提取失败
 		global.IedCrcMakeState.Store(fmt.Sprintf("crc_%s", scdid), "0")
+		new(TaskMgr).SetStep(scdid, enum.TaskStep_SCD_crc_extract.Code(), 3, err.Error())
+		new(TaskMgr).SetStep(scdid, enum.TaskStep_SCD_ccd_extract.Code(), 3, err.Error())
+		new(TaskMgr).SetStep(scdid, enum.TaskStep_SCD_cid_extract.Code(), 3, err.Error())
+		new(TaskMgr).SetStep(scdid, enum.TaskStep_SCD_icd_extract.Code(), 3, err.Error())
 		return false, err
 	}
 	defer stdin.Close()
@@ -750,6 +766,10 @@ func (c *ScdMgr) CrcCheck(scdid string) (bool, error) {
 		logger.Logger.Error(err)
 		//crc提取失败
 		global.IedCrcMakeState.Store(fmt.Sprintf("crc_%s", scdid), "0")
+		new(TaskMgr).SetStep(scdid, enum.TaskStep_SCD_crc_extract.Code(), 3, err.Error())
+		new(TaskMgr).SetStep(scdid, enum.TaskStep_SCD_ccd_extract.Code(), 3, err.Error())
+		new(TaskMgr).SetStep(scdid, enum.TaskStep_SCD_cid_extract.Code(), 3, err.Error())
+		new(TaskMgr).SetStep(scdid, enum.TaskStep_SCD_icd_extract.Code(), 3, err.Error())
 		return false, err
 	}
 
@@ -767,6 +787,10 @@ func (c *ScdMgr) CrcCheck(scdid string) (bool, error) {
 		logger.Logger.Error(err)
 		//crc提取失败
 		global.IedCrcMakeState.Store(fmt.Sprintf("crc_%s", scdid), "0")
+		new(TaskMgr).SetStep(scdid, enum.TaskStep_SCD_crc_extract.Code(), 3, err.Error())
+		new(TaskMgr).SetStep(scdid, enum.TaskStep_SCD_ccd_extract.Code(), 3, err.Error())
+		new(TaskMgr).SetStep(scdid, enum.TaskStep_SCD_cid_extract.Code(), 3, err.Error())
+		new(TaskMgr).SetStep(scdid, enum.TaskStep_SCD_icd_extract.Code(), 3, err.Error())
 		return false, err
 	}
 	txt = make([]byte, 1024)

+ 5 - 1
service/models/bo/scd_node_rule.go

@@ -2572,7 +2572,7 @@ func (c *ScdNodeRule) getDoICdc(lntype, doiname, daname string) string {
 
 func (c *ScdNodeRule) AppendPaseResult(r map[string]interface{}, ied ...*node_attr.NIED) {
 	var iedobj *node_attr.NIED
-	if len(ied) > 0 {
+	if len(ied) > 0 && ied[0] != nil {
 		iedobj = ied[0]
 		r["ied_name"] = iedobj.Name
 		r["ied_desc"] = iedobj.Desc
@@ -2586,6 +2586,10 @@ func (c *ScdNodeRule) AppendPaseResult(r map[string]interface{}, ied ...*node_at
 	//go mqtt.PublishMessage("/jujutong/scd_check_tools/ruleparse/"+fmt.Sprintf("%d", c.ScdID), r["parse_result"].(string))
 }
 
+func (c *ScdNodeRule) CheckFinish() {
+	c.isRun = 2
+}
+
 //节点规则验证完成
 func (c *ScdNodeRule) Flush() {
 	//判断等待验证队列中的数据是否已处理完,没有处理完则一直等待

+ 7 - 2
service/models/bo/task.go

@@ -120,6 +120,7 @@ func (c *TaskMgr) start(task T_data_task) error {
 	db := orm.NewOrm()
 	//清除原步骤及状态
 	db.Raw("delete from t_data_task_check_step where task_id=?", task.Id).Exec()
+	db.Raw("delete from t_scd_node_rule_parse where scd_id=?", task.ScdId).Exec()
 	//生成新的步骤
 	db.Raw("insert into t_data_task_check_step(task_id,task_step_id,state) select ?,id,0 from global_const_code where parentcode='CHECK_STEP' order by id", task.Id).Exec()
 	go func() {
@@ -130,8 +131,12 @@ func (c *TaskMgr) start(task T_data_task) error {
 			c.SetStep(tools.IsEmpty(task.ScdId), enum.TaskStep_SCD_model_parse.Code(), 1)
 			checkAreaMgr := new(CheckAreaMgr)
 			checkAreaMgr.ScdId = task.ScdId
-			//checkAreaMgr.ParseModelArea()
-			c.SetStep(tools.IsEmpty(task.ScdId), enum.TaskStep_SCD_model_parse.Code(), 2)
+			err = checkAreaMgr.CheckAreaIedRelation()
+			if err != nil {
+				c.SetStep(tools.IsEmpty(task.ScdId), enum.TaskStep_SCD_model_parse.Code(), 3, err.Error())
+			} else {
+				c.SetStep(tools.IsEmpty(task.ScdId), enum.TaskStep_SCD_model_parse.Code(), 2)
+			}
 		}
 	}()
 	return err

+ 11 - 11
service/routers/commentsRouter_____________ME_GoProject_src_scd_check_tools_controllers.go

@@ -802,7 +802,7 @@ func init() {
     beego.GlobalControllerRouter["scd_check_tools/controllers:RuleController"] = append(beego.GlobalControllerRouter["scd_check_tools/controllers:RuleController"],
         beego.ControllerComments{
             Method: "GetRuleDefList",
-            Router: "/scd_check_tools/rule/list",
+            Router: "/scd/rule/list",
             AllowHTTPMethods: []string{"get"},
             MethodParams: param.Make(),
             Filters: nil,
@@ -811,7 +811,7 @@ func init() {
     beego.GlobalControllerRouter["scd_check_tools/controllers:RuleController"] = append(beego.GlobalControllerRouter["scd_check_tools/controllers:RuleController"],
         beego.ControllerComments{
             Method: "DeleteScdRuleDef",
-            Router: "/scd_check_tools/rule/remove",
+            Router: "/scd/rule/remove",
             AllowHTTPMethods: []string{"post"},
             MethodParams: param.Make(),
             Filters: nil,
@@ -820,7 +820,7 @@ func init() {
     beego.GlobalControllerRouter["scd_check_tools/controllers:RuleController"] = append(beego.GlobalControllerRouter["scd_check_tools/controllers:RuleController"],
         beego.ControllerComments{
             Method: "ResetRule",
-            Router: "/scd_check_tools/rule/reset",
+            Router: "/scd/rule/reset",
             AllowHTTPMethods: []string{"post"},
             MethodParams: param.Make(),
             Filters: nil,
@@ -829,7 +829,7 @@ func init() {
     beego.GlobalControllerRouter["scd_check_tools/controllers:RuleController"] = append(beego.GlobalControllerRouter["scd_check_tools/controllers:RuleController"],
         beego.ControllerComments{
             Method: "SaveScdRuleDef",
-            Router: "/scd_check_tools/rule/save",
+            Router: "/scd/rule/save",
             AllowHTTPMethods: []string{"post"},
             MethodParams: param.Make(),
             Filters: nil,
@@ -838,7 +838,7 @@ func init() {
     beego.GlobalControllerRouter["scd_check_tools/controllers:ScdCompController"] = append(beego.GlobalControllerRouter["scd_check_tools/controllers:ScdCompController"],
         beego.ControllerComments{
             Method: "GetCompIedStatTypeResult",
-            Router: "/scd_check_tools/comp/iedstat/type",
+            Router: "/scd/comp/iedstat/type",
             AllowHTTPMethods: []string{"get"},
             MethodParams: param.Make(),
             Filters: nil,
@@ -847,7 +847,7 @@ func init() {
     beego.GlobalControllerRouter["scd_check_tools/controllers:ScdCompController"] = append(beego.GlobalControllerRouter["scd_check_tools/controllers:ScdCompController"],
         beego.ControllerComments{
             Method: "GetCompList",
-            Router: "/scd_check_tools/comp/list",
+            Router: "/scd/comp/list",
             AllowHTTPMethods: []string{"get"},
             MethodParams: param.Make(),
             Filters: nil,
@@ -856,7 +856,7 @@ func init() {
     beego.GlobalControllerRouter["scd_check_tools/controllers:ScdCompController"] = append(beego.GlobalControllerRouter["scd_check_tools/controllers:ScdCompController"],
         beego.ControllerComments{
             Method: "GetResult",
-            Router: "/scd_check_tools/comp/result",
+            Router: "/scd/comp/result",
             AllowHTTPMethods: []string{"get"},
             MethodParams: param.Make(),
             Filters: nil,
@@ -865,7 +865,7 @@ func init() {
     beego.GlobalControllerRouter["scd_check_tools/controllers:ScdCompController"] = append(beego.GlobalControllerRouter["scd_check_tools/controllers:ScdCompController"],
         beego.ControllerComments{
             Method: "Compare",
-            Router: "/scd_check_tools/comp/start",
+            Router: "/scd/comp/start",
             AllowHTTPMethods: []string{"post"},
             MethodParams: param.Make(),
             Filters: nil,
@@ -874,7 +874,7 @@ func init() {
     beego.GlobalControllerRouter["scd_check_tools/controllers:ScdCompController"] = append(beego.GlobalControllerRouter["scd_check_tools/controllers:ScdCompController"],
         beego.ControllerComments{
             Method: "GetCompStatResult",
-            Router: "/scd_check_tools/comp/stat/result",
+            Router: "/scd/comp/stat/result",
             AllowHTTPMethods: []string{"get"},
             MethodParams: param.Make(),
             Filters: nil,
@@ -883,7 +883,7 @@ func init() {
     beego.GlobalControllerRouter["scd_check_tools/controllers:ScdCompController"] = append(beego.GlobalControllerRouter["scd_check_tools/controllers:ScdCompController"],
         beego.ControllerComments{
             Method: "GetCheckToolsTreeRoot",
-            Router: "/scd_check_tools/comp/tree",
+            Router: "/scd/comp/tree",
             AllowHTTPMethods: []string{"get"},
             MethodParams: param.Make(),
             Filters: nil,
@@ -1261,7 +1261,7 @@ func init() {
     beego.GlobalControllerRouter["scd_check_tools/controllers:StatController"] = append(beego.GlobalControllerRouter["scd_check_tools/controllers:StatController"],
         beego.ControllerComments{
             Method: "ScdRightStat",
-            Router: "/scd_check_tools/stat/right",
+            Router: "/scd/stat/right",
             AllowHTTPMethods: []string{"get"},
             MethodParams: param.Make(),
             Filters: nil,

+ 111 - 111
service/static/swagger/swagger.json

@@ -3763,107 +3763,7 @@
                 ]
             }
         },
-        "/scd/ied/editarea": {
-            "post": {
-                "tags": [
-                    "scd_check_tools/controllersScreenController"
-                ],
-                "summary": "修改指定装置的所属间隔",
-                "description": "修改指定装置的所属间隔",
-                "parameters": [
-                    {
-                        "in": "query",
-                        "name": "scd_id",
-                        "description": "SCD文件ID",
-                        "required": true,
-                        "type": "integer",
-                        "format": "int64"
-                    },
-                    {
-                        "in": "query",
-                        "name": "ied_name",
-                        "description": "装置名称",
-                        "required": true,
-                        "type": "string"
-                    },
-                    {
-                        "in": "query",
-                        "name": "area_id",
-                        "description": "间隔ID",
-                        "required": true,
-                        "type": "integer",
-                        "format": "int64"
-                    }
-                ]
-            }
-        },
-        "/scd/ied/typelist": {
-            "get": {
-                "tags": [
-                    "scd_check_tools/controllersScreenController"
-                ],
-                "summary": "获取指定SCD下的IED类型信息",
-                "description": "获取指定SCD下的IED类型信息",
-                "parameters": [
-                    {
-                        "in": "query",
-                        "name": "scd_id",
-                        "description": "SCD文件ID",
-                        "required": true,
-                        "type": "integer",
-                        "format": "int64"
-                    }
-                ]
-            }
-        },
-        "/scd_check_tools/checkin/detail": {
-            "get": {
-                "tags": [
-                    "scd_check_tools/controllersFlowController"
-                ],
-                "summary": "获取指定站的指定scd的签入详情",
-                "description": "获取指定站的指定scd的签入详情",
-                "parameters": [
-                    {
-                        "in": "query",
-                        "name": "station_id",
-                        "description": "变电站ID",
-                        "required": true,
-                        "type": "string"
-                    },
-                    {
-                        "in": "query",
-                        "name": "scd_name",
-                        "description": "SCD名称",
-                        "type": "string"
-                    },
-                    {
-                        "in": "query",
-                        "name": "scd_path",
-                        "description": "SCD文件路径",
-                        "type": "string"
-                    },
-                    {
-                        "in": "query",
-                        "name": "scd_id",
-                        "description": "SCD文件ID。为空时scd_name和scd_path必填",
-                        "type": "string"
-                    }
-                ],
-                "responses": {
-                    "200": {
-                        "description": "成功",
-                        "schema": {
-                            "$ref": "#/definitions/ResultOK"
-                        }
-                    },
-                    "500": {
-                        "description": "{object} ResultError  失败"
-                    }
-                }
-            }
-        },
-        "/scd_check_tools/comp/iedstat/type": {
+        "/scd/comp/iedstat/type": {
             "get": {
                 "tags": [
                     "scd_check_tools/controllersScdCompController"
@@ -3905,7 +3805,7 @@
                 }
             }
         },
-        "/scd_check_tools/comp/list": {
+        "/scd/comp/list": {
             "get": {
                 "tags": [
                     "scd_check_tools/controllersScdCompController"
@@ -3935,7 +3835,7 @@
                 }
             }
         },
-        "/scd_check_tools/comp/result": {
+        "/scd/comp/result": {
             "get": {
                 "tags": [
                     "scd_check_tools/controllersScdCompController"
@@ -3977,7 +3877,7 @@
                 }
             }
         },
-        "/scd_check_tools/comp/start": {
+        "/scd/comp/start": {
             "post": {
                 "tags": [
                     "scd_check_tools/controllersScdCompController"
@@ -4041,7 +3941,7 @@
                 }
             }
         },
-        "/scd_check_tools/comp/stat/result": {
+        "/scd/comp/stat/result": {
             "get": {
                 "tags": [
                     "scd_check_tools/controllersScdCompController"
@@ -4071,7 +3971,7 @@
                 }
             }
         },
-        "/scd_check_tools/comp/tree": {
+        "/scd/comp/tree": {
             "get": {
                 "tags": [
                     "scd_check_tools/controllersScdCompController"
@@ -4115,7 +4015,60 @@
                 }
             }
         },
-        "/scd_check_tools/rule/list": {
+        "/scd/ied/editarea": {
+            "post": {
+                "tags": [
+                    "scd_check_tools/controllersScreenController"
+                ],
+                "summary": "修改指定装置的所属间隔",
+                "description": "修改指定装置的所属间隔",
+                "parameters": [
+                    {
+                        "in": "query",
+                        "name": "scd_id",
+                        "description": "SCD文件ID",
+                        "required": true,
+                        "type": "integer",
+                        "format": "int64"
+                    },
+                    {
+                        "in": "query",
+                        "name": "ied_name",
+                        "description": "装置名称",
+                        "required": true,
+                        "type": "string"
+                    },
+                    {
+                        "in": "query",
+                        "name": "area_id",
+                        "description": "间隔ID",
+                        "required": true,
+                        "type": "integer",
+                        "format": "int64"
+                    }
+                ]
+            }
+        },
+        "/scd/ied/typelist": {
+            "get": {
+                "tags": [
+                    "scd_check_tools/controllersScreenController"
+                ],
+                "summary": "获取指定SCD下的IED类型信息",
+                "description": "获取指定SCD下的IED类型信息",
+                "parameters": [
+                    {
+                        "in": "query",
+                        "name": "scd_id",
+                        "description": "SCD文件ID",
+                        "required": true,
+                        "type": "integer",
+                        "format": "int64"
+                    }
+                ]
+            }
+        },
+        "/scd/rule/list": {
             "get": {
                 "tags": [
                     "scd_check_tools/controllersRuleController"
@@ -4190,7 +4143,7 @@
                 }
             }
         },
-        "/scd_check_tools/rule/remove": {
+        "/scd/rule/remove": {
             "post": {
                 "tags": [
                     "scd_check_tools/controllersRuleController"
@@ -4220,7 +4173,7 @@
                 }
             }
         },
-        "/scd_check_tools/rule/reset": {
+        "/scd/rule/reset": {
             "post": {
                 "tags": [
                     "scd_check_tools/controllersRuleController"
@@ -4250,7 +4203,7 @@
                 }
             }
         },
-        "/scd_check_tools/rule/save": {
+        "/scd/rule/save": {
             "post": {
                 "tags": [
                     "scd_check_tools/controllersRuleController"
@@ -4311,7 +4264,7 @@
                 }
             }
         },
-        "/scd_check_tools/stat/right": {
+        "/scd/stat/right": {
             "get": {
                 "tags": [
                     "scd_check_tools/controllersStatController"
@@ -4341,6 +4294,53 @@
                 }
             }
         },
+        "/scd_check_tools/checkin/detail": {
+            "get": {
+                "tags": [
+                    "scd_check_tools/controllersFlowController"
+                ],
+                "summary": "获取指定站的指定scd的签入详情",
+                "description": "获取指定站的指定scd的签入详情",
+                "parameters": [
+                    {
+                        "in": "query",
+                        "name": "station_id",
+                        "description": "变电站ID",
+                        "required": true,
+                        "type": "string"
+                    },
+                    {
+                        "in": "query",
+                        "name": "scd_name",
+                        "description": "SCD名称",
+                        "type": "string"
+                    },
+                    {
+                        "in": "query",
+                        "name": "scd_path",
+                        "description": "SCD文件路径",
+                        "type": "string"
+                    },
+                    {
+                        "in": "query",
+                        "name": "scd_id",
+                        "description": "SCD文件ID。为空时scd_name和scd_path必填",
+                        "type": "string"
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "成功",
+                        "schema": {
+                            "$ref": "#/definitions/ResultOK"
+                        }
+                    },
+                    "500": {
+                        "description": "{object} ResultError  失败"
+                    }
+                }
+            }
+        },
         "/screen/scd/agin_parse": {
             "post": {
                 "tags": [

+ 79 - 79
service/static/swagger/swagger.yml

@@ -2543,75 +2543,7 @@ paths:
         required: true
         type: integer
         format: int64
-  /scd/ied/editarea:
-    post:
-      tags:
-      - scd_check_tools/controllersScreenController
-      summary: 修改指定装置的所属间隔
-      description: 修改指定装置的所属间隔
-      parameters:
-      - in: query
-        name: scd_id
-        description: SCD文件ID
-        required: true
-        type: integer
-        format: int64
-      - in: query
-        name: ied_name
-        description: 装置名称
-        required: true
-        type: string
-      - in: query
-        name: area_id
-        description: 间隔ID
-        required: true
-        type: integer
-        format: int64
-  /scd/ied/typelist:
-    get:
-      tags:
-      - scd_check_tools/controllersScreenController
-      summary: 获取指定SCD下的IED类型信息
-      description: 获取指定SCD下的IED类型信息
-      parameters:
-      - in: query
-        name: scd_id
-        description: SCD文件ID
-        required: true
-        type: integer
-        format: int64
-  /scd_check_tools/checkin/detail:
-    get:
-      tags:
-      - scd_check_tools/controllersFlowController
-      summary: 获取指定站的指定scd的签入详情
-      description: 获取指定站的指定scd的签入详情
-      parameters:
-      - in: query
-        name: station_id
-        description: 变电站ID
-        required: true
-        type: string
-      - in: query
-        name: scd_name
-        description: SCD名称
-        type: string
-      - in: query
-        name: scd_path
-        description: SCD文件路径
-        type: string
-      - in: query
-        name: scd_id
-        description: SCD文件ID。为空时scd_name和scd_path必填
-        type: string
-      responses:
-        "200":
-          description: 成功
-          schema:
-            $ref: '#/definitions/ResultOK'
-        "500":
-          description: '{object} ResultError  失败'
-  /scd_check_tools/comp/iedstat/type:
+  /scd/comp/iedstat/type:
     get:
       tags:
       - scd_check_tools/controllersScdCompController
@@ -2639,7 +2571,7 @@ paths:
             $ref: '#/definitions/ResultOK'
         "500":
           description: status  失败
-  /scd_check_tools/comp/list:
+  /scd/comp/list:
     get:
       tags:
       - scd_check_tools/controllersScdCompController
@@ -2659,7 +2591,7 @@ paths:
             $ref: '#/definitions/ResultOK'
         "500":
           description: status  失败
-  /scd_check_tools/comp/result:
+  /scd/comp/result:
     get:
       tags:
       - scd_check_tools/controllersScdCompController
@@ -2687,7 +2619,7 @@ paths:
             $ref: '#/definitions/ResultOK'
         "500":
           description: status  失败
-  /scd_check_tools/comp/start:
+  /scd/comp/start:
     post:
       tags:
       - scd_check_tools/controllersScdCompController
@@ -2731,7 +2663,7 @@ paths:
             $ref: '#/definitions/ResultOK'
         "500":
           description: status  失败
-  /scd_check_tools/comp/stat/result:
+  /scd/comp/stat/result:
     get:
       tags:
       - scd_check_tools/controllersScdCompController
@@ -2751,7 +2683,7 @@ paths:
             $ref: '#/definitions/ResultOK'
         "500":
           description: status  失败
-  /scd_check_tools/comp/tree:
+  /scd/comp/tree:
     get:
       tags:
       - scd_check_tools/controllersScdCompController
@@ -2781,7 +2713,44 @@ paths:
             $ref: '#/definitions/ResultOK'
         "500":
           description: status  失败
-  /scd_check_tools/rule/list:
+  /scd/ied/editarea:
+    post:
+      tags:
+      - scd_check_tools/controllersScreenController
+      summary: 修改指定装置的所属间隔
+      description: 修改指定装置的所属间隔
+      parameters:
+      - in: query
+        name: scd_id
+        description: SCD文件ID
+        required: true
+        type: integer
+        format: int64
+      - in: query
+        name: ied_name
+        description: 装置名称
+        required: true
+        type: string
+      - in: query
+        name: area_id
+        description: 间隔ID
+        required: true
+        type: integer
+        format: int64
+  /scd/ied/typelist:
+    get:
+      tags:
+      - scd_check_tools/controllersScreenController
+      summary: 获取指定SCD下的IED类型信息
+      description: 获取指定SCD下的IED类型信息
+      parameters:
+      - in: query
+        name: scd_id
+        description: SCD文件ID
+        required: true
+        type: integer
+        format: int64
+  /scd/rule/list:
     get:
       tags:
       - scd_check_tools/controllersRuleController
@@ -2832,7 +2801,7 @@ paths:
             $ref: '#/definitions/ResultOK'
         "500":
           description: status  失败
-  /scd_check_tools/rule/remove:
+  /scd/rule/remove:
     post:
       tags:
       - scd_check_tools/controllersRuleController
@@ -2852,7 +2821,7 @@ paths:
             $ref: '#/definitions/ResultOK'
         "500":
           description: status  失败
-  /scd_check_tools/rule/reset:
+  /scd/rule/reset:
     post:
       tags:
       - scd_check_tools/controllersRuleController
@@ -2872,7 +2841,7 @@ paths:
             $ref: '#/definitions/ResultOK'
         "500":
           description: status  失败
-  /scd_check_tools/rule/save:
+  /scd/rule/save:
     post:
       tags:
       - scd_check_tools/controllersRuleController
@@ -2913,7 +2882,7 @@ paths:
             $ref: '#/definitions/ResultOK'
         "500":
           description: status  失败
-  /scd_check_tools/stat/right:
+  /scd/stat/right:
     get:
       tags:
       - scd_check_tools/controllersStatController
@@ -2933,6 +2902,37 @@ paths:
             $ref: '#/definitions/ResultError'
         "500":
           description: status  失败
+  /scd_check_tools/checkin/detail:
+    get:
+      tags:
+      - scd_check_tools/controllersFlowController
+      summary: 获取指定站的指定scd的签入详情
+      description: 获取指定站的指定scd的签入详情
+      parameters:
+      - in: query
+        name: station_id
+        description: 变电站ID
+        required: true
+        type: string
+      - in: query
+        name: scd_name
+        description: SCD名称
+        type: string
+      - in: query
+        name: scd_path
+        description: SCD文件路径
+        type: string
+      - in: query
+        name: scd_id
+        description: SCD文件ID。为空时scd_name和scd_path必填
+        type: string
+      responses:
+        "200":
+          description: 成功
+          schema:
+            $ref: '#/definitions/ResultOK'
+        "500":
+          description: '{object} ResultError  失败'
   /screen/scd/agin_parse:
     post:
       tags:

+ 111 - 111
service/swagger/swagger.json

@@ -3763,107 +3763,7 @@
                 ]
             }
         },
-        "/scd/ied/editarea": {
-            "post": {
-                "tags": [
-                    "scd_check_tools/controllersScreenController"
-                ],
-                "summary": "修改指定装置的所属间隔",
-                "description": "修改指定装置的所属间隔",
-                "parameters": [
-                    {
-                        "in": "query",
-                        "name": "scd_id",
-                        "description": "SCD文件ID",
-                        "required": true,
-                        "type": "integer",
-                        "format": "int64"
-                    },
-                    {
-                        "in": "query",
-                        "name": "ied_name",
-                        "description": "装置名称",
-                        "required": true,
-                        "type": "string"
-                    },
-                    {
-                        "in": "query",
-                        "name": "area_id",
-                        "description": "间隔ID",
-                        "required": true,
-                        "type": "integer",
-                        "format": "int64"
-                    }
-                ]
-            }
-        },
-        "/scd/ied/typelist": {
-            "get": {
-                "tags": [
-                    "scd_check_tools/controllersScreenController"
-                ],
-                "summary": "获取指定SCD下的IED类型信息",
-                "description": "获取指定SCD下的IED类型信息",
-                "parameters": [
-                    {
-                        "in": "query",
-                        "name": "scd_id",
-                        "description": "SCD文件ID",
-                        "required": true,
-                        "type": "integer",
-                        "format": "int64"
-                    }
-                ]
-            }
-        },
-        "/scd_check_tools/checkin/detail": {
-            "get": {
-                "tags": [
-                    "scd_check_tools/controllersFlowController"
-                ],
-                "summary": "获取指定站的指定scd的签入详情",
-                "description": "获取指定站的指定scd的签入详情",
-                "parameters": [
-                    {
-                        "in": "query",
-                        "name": "station_id",
-                        "description": "变电站ID",
-                        "required": true,
-                        "type": "string"
-                    },
-                    {
-                        "in": "query",
-                        "name": "scd_name",
-                        "description": "SCD名称",
-                        "type": "string"
-                    },
-                    {
-                        "in": "query",
-                        "name": "scd_path",
-                        "description": "SCD文件路径",
-                        "type": "string"
-                    },
-                    {
-                        "in": "query",
-                        "name": "scd_id",
-                        "description": "SCD文件ID。为空时scd_name和scd_path必填",
-                        "type": "string"
-                    }
-                ],
-                "responses": {
-                    "200": {
-                        "description": "成功",
-                        "schema": {
-                            "$ref": "#/definitions/ResultOK"
-                        }
-                    },
-                    "500": {
-                        "description": "{object} ResultError  失败"
-                    }
-                }
-            }
-        },
-        "/scd_check_tools/comp/iedstat/type": {
+        "/scd/comp/iedstat/type": {
             "get": {
                 "tags": [
                     "scd_check_tools/controllersScdCompController"
@@ -3905,7 +3805,7 @@
                 }
             }
         },
-        "/scd_check_tools/comp/list": {
+        "/scd/comp/list": {
             "get": {
                 "tags": [
                     "scd_check_tools/controllersScdCompController"
@@ -3935,7 +3835,7 @@
                 }
             }
         },
-        "/scd_check_tools/comp/result": {
+        "/scd/comp/result": {
             "get": {
                 "tags": [
                     "scd_check_tools/controllersScdCompController"
@@ -3977,7 +3877,7 @@
                 }
             }
         },
-        "/scd_check_tools/comp/start": {
+        "/scd/comp/start": {
             "post": {
                 "tags": [
                     "scd_check_tools/controllersScdCompController"
@@ -4041,7 +3941,7 @@
                 }
             }
         },
-        "/scd_check_tools/comp/stat/result": {
+        "/scd/comp/stat/result": {
             "get": {
                 "tags": [
                     "scd_check_tools/controllersScdCompController"
@@ -4071,7 +3971,7 @@
                 }
             }
         },
-        "/scd_check_tools/comp/tree": {
+        "/scd/comp/tree": {
             "get": {
                 "tags": [
                     "scd_check_tools/controllersScdCompController"
@@ -4115,7 +4015,60 @@
                 }
             }
         },
-        "/scd_check_tools/rule/list": {
+        "/scd/ied/editarea": {
+            "post": {
+                "tags": [
+                    "scd_check_tools/controllersScreenController"
+                ],
+                "summary": "修改指定装置的所属间隔",
+                "description": "修改指定装置的所属间隔",
+                "parameters": [
+                    {
+                        "in": "query",
+                        "name": "scd_id",
+                        "description": "SCD文件ID",
+                        "required": true,
+                        "type": "integer",
+                        "format": "int64"
+                    },
+                    {
+                        "in": "query",
+                        "name": "ied_name",
+                        "description": "装置名称",
+                        "required": true,
+                        "type": "string"
+                    },
+                    {
+                        "in": "query",
+                        "name": "area_id",
+                        "description": "间隔ID",
+                        "required": true,
+                        "type": "integer",
+                        "format": "int64"
+                    }
+                ]
+            }
+        },
+        "/scd/ied/typelist": {
+            "get": {
+                "tags": [
+                    "scd_check_tools/controllersScreenController"
+                ],
+                "summary": "获取指定SCD下的IED类型信息",
+                "description": "获取指定SCD下的IED类型信息",
+                "parameters": [
+                    {
+                        "in": "query",
+                        "name": "scd_id",
+                        "description": "SCD文件ID",
+                        "required": true,
+                        "type": "integer",
+                        "format": "int64"
+                    }
+                ]
+            }
+        },
+        "/scd/rule/list": {
             "get": {
                 "tags": [
                     "scd_check_tools/controllersRuleController"
@@ -4190,7 +4143,7 @@
                 }
             }
         },
-        "/scd_check_tools/rule/remove": {
+        "/scd/rule/remove": {
             "post": {
                 "tags": [
                     "scd_check_tools/controllersRuleController"
@@ -4220,7 +4173,7 @@
                 }
             }
         },
-        "/scd_check_tools/rule/reset": {
+        "/scd/rule/reset": {
             "post": {
                 "tags": [
                     "scd_check_tools/controllersRuleController"
@@ -4250,7 +4203,7 @@
                 }
             }
         },
-        "/scd_check_tools/rule/save": {
+        "/scd/rule/save": {
             "post": {
                 "tags": [
                     "scd_check_tools/controllersRuleController"
@@ -4311,7 +4264,7 @@
                 }
             }
         },
-        "/scd_check_tools/stat/right": {
+        "/scd/stat/right": {
             "get": {
                 "tags": [
                     "scd_check_tools/controllersStatController"
@@ -4341,6 +4294,53 @@
                 }
             }
         },
+        "/scd_check_tools/checkin/detail": {
+            "get": {
+                "tags": [
+                    "scd_check_tools/controllersFlowController"
+                ],
+                "summary": "获取指定站的指定scd的签入详情",
+                "description": "获取指定站的指定scd的签入详情",
+                "parameters": [
+                    {
+                        "in": "query",
+                        "name": "station_id",
+                        "description": "变电站ID",
+                        "required": true,
+                        "type": "string"
+                    },
+                    {
+                        "in": "query",
+                        "name": "scd_name",
+                        "description": "SCD名称",
+                        "type": "string"
+                    },
+                    {
+                        "in": "query",
+                        "name": "scd_path",
+                        "description": "SCD文件路径",
+                        "type": "string"
+                    },
+                    {
+                        "in": "query",
+                        "name": "scd_id",
+                        "description": "SCD文件ID。为空时scd_name和scd_path必填",
+                        "type": "string"
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "成功",
+                        "schema": {
+                            "$ref": "#/definitions/ResultOK"
+                        }
+                    },
+                    "500": {
+                        "description": "{object} ResultError  失败"
+                    }
+                }
+            }
+        },
         "/screen/scd/agin_parse": {
             "post": {
                 "tags": [

+ 79 - 79
service/swagger/swagger.yml

@@ -2543,75 +2543,7 @@ paths:
         required: true
         type: integer
         format: int64
-  /scd/ied/editarea:
-    post:
-      tags:
-      - scd_check_tools/controllersScreenController
-      summary: 修改指定装置的所属间隔
-      description: 修改指定装置的所属间隔
-      parameters:
-      - in: query
-        name: scd_id
-        description: SCD文件ID
-        required: true
-        type: integer
-        format: int64
-      - in: query
-        name: ied_name
-        description: 装置名称
-        required: true
-        type: string
-      - in: query
-        name: area_id
-        description: 间隔ID
-        required: true
-        type: integer
-        format: int64
-  /scd/ied/typelist:
-    get:
-      tags:
-      - scd_check_tools/controllersScreenController
-      summary: 获取指定SCD下的IED类型信息
-      description: 获取指定SCD下的IED类型信息
-      parameters:
-      - in: query
-        name: scd_id
-        description: SCD文件ID
-        required: true
-        type: integer
-        format: int64
-  /scd_check_tools/checkin/detail:
-    get:
-      tags:
-      - scd_check_tools/controllersFlowController
-      summary: 获取指定站的指定scd的签入详情
-      description: 获取指定站的指定scd的签入详情
-      parameters:
-      - in: query
-        name: station_id
-        description: 变电站ID
-        required: true
-        type: string
-      - in: query
-        name: scd_name
-        description: SCD名称
-        type: string
-      - in: query
-        name: scd_path
-        description: SCD文件路径
-        type: string
-      - in: query
-        name: scd_id
-        description: SCD文件ID。为空时scd_name和scd_path必填
-        type: string
-      responses:
-        "200":
-          description: 成功
-          schema:
-            $ref: '#/definitions/ResultOK'
-        "500":
-          description: '{object} ResultError  失败'
-  /scd_check_tools/comp/iedstat/type:
+  /scd/comp/iedstat/type:
     get:
       tags:
       - scd_check_tools/controllersScdCompController
@@ -2639,7 +2571,7 @@ paths:
             $ref: '#/definitions/ResultOK'
         "500":
           description: status  失败
-  /scd_check_tools/comp/list:
+  /scd/comp/list:
     get:
       tags:
       - scd_check_tools/controllersScdCompController
@@ -2659,7 +2591,7 @@ paths:
             $ref: '#/definitions/ResultOK'
         "500":
           description: status  失败
-  /scd_check_tools/comp/result:
+  /scd/comp/result:
     get:
       tags:
       - scd_check_tools/controllersScdCompController
@@ -2687,7 +2619,7 @@ paths:
             $ref: '#/definitions/ResultOK'
         "500":
           description: status  失败
-  /scd_check_tools/comp/start:
+  /scd/comp/start:
     post:
       tags:
       - scd_check_tools/controllersScdCompController
@@ -2731,7 +2663,7 @@ paths:
             $ref: '#/definitions/ResultOK'
         "500":
           description: status  失败
-  /scd_check_tools/comp/stat/result:
+  /scd/comp/stat/result:
     get:
       tags:
       - scd_check_tools/controllersScdCompController
@@ -2751,7 +2683,7 @@ paths:
             $ref: '#/definitions/ResultOK'
         "500":
           description: status  失败
-  /scd_check_tools/comp/tree:
+  /scd/comp/tree:
     get:
       tags:
       - scd_check_tools/controllersScdCompController
@@ -2781,7 +2713,44 @@ paths:
             $ref: '#/definitions/ResultOK'
         "500":
           description: status  失败
-  /scd_check_tools/rule/list:
+  /scd/ied/editarea:
+    post:
+      tags:
+      - scd_check_tools/controllersScreenController
+      summary: 修改指定装置的所属间隔
+      description: 修改指定装置的所属间隔
+      parameters:
+      - in: query
+        name: scd_id
+        description: SCD文件ID
+        required: true
+        type: integer
+        format: int64
+      - in: query
+        name: ied_name
+        description: 装置名称
+        required: true
+        type: string
+      - in: query
+        name: area_id
+        description: 间隔ID
+        required: true
+        type: integer
+        format: int64
+  /scd/ied/typelist:
+    get:
+      tags:
+      - scd_check_tools/controllersScreenController
+      summary: 获取指定SCD下的IED类型信息
+      description: 获取指定SCD下的IED类型信息
+      parameters:
+      - in: query
+        name: scd_id
+        description: SCD文件ID
+        required: true
+        type: integer
+        format: int64
+  /scd/rule/list:
     get:
       tags:
       - scd_check_tools/controllersRuleController
@@ -2832,7 +2801,7 @@ paths:
             $ref: '#/definitions/ResultOK'
         "500":
           description: status  失败
-  /scd_check_tools/rule/remove:
+  /scd/rule/remove:
     post:
       tags:
       - scd_check_tools/controllersRuleController
@@ -2852,7 +2821,7 @@ paths:
             $ref: '#/definitions/ResultOK'
         "500":
           description: status  失败
-  /scd_check_tools/rule/reset:
+  /scd/rule/reset:
     post:
       tags:
       - scd_check_tools/controllersRuleController
@@ -2872,7 +2841,7 @@ paths:
             $ref: '#/definitions/ResultOK'
         "500":
           description: status  失败
-  /scd_check_tools/rule/save:
+  /scd/rule/save:
     post:
       tags:
       - scd_check_tools/controllersRuleController
@@ -2913,7 +2882,7 @@ paths:
             $ref: '#/definitions/ResultOK'
         "500":
           description: status  失败
-  /scd_check_tools/stat/right:
+  /scd/stat/right:
     get:
       tags:
       - scd_check_tools/controllersStatController
@@ -2933,6 +2902,37 @@ paths:
             $ref: '#/definitions/ResultError'
         "500":
           description: status  失败
+  /scd_check_tools/checkin/detail:
+    get:
+      tags:
+      - scd_check_tools/controllersFlowController
+      summary: 获取指定站的指定scd的签入详情
+      description: 获取指定站的指定scd的签入详情
+      parameters:
+      - in: query
+        name: station_id
+        description: 变电站ID
+        required: true
+        type: string
+      - in: query
+        name: scd_name
+        description: SCD名称
+        type: string
+      - in: query
+        name: scd_path
+        description: SCD文件路径
+        type: string
+      - in: query
+        name: scd_id
+        description: SCD文件ID。为空时scd_name和scd_path必填
+        type: string
+      responses:
+        "200":
+          description: 成功
+          schema:
+            $ref: '#/definitions/ResultOK'
+        "500":
+          description: '{object} ResultError  失败'
   /screen/scd/agin_parse:
     post:
       tags: