浏览代码

添加间隔端子编号设置功能
添加端子检查时端子编号规则逻辑

liling 1 年之前
父节点
当前提交
64e14d8117

+ 36 - 0
service/controllers/busAdminController.go

@@ -679,6 +679,42 @@ func (c *BusAdminController) SaveCheckAreaIedByAreaID() {
 	c.ServeJSON()
 }
 
+// @Summary 设置间隔下指定装置的端子编号
+//	@Description  设置间隔下指定装置的端子编号。该编号只有在端子匹配表达式中存在{no}标识时才会使用
+// 	@Tags         业务管理服务
+// 	@Accept       x-www-form-urlencoded
+// 	@Produce      json
+//	@Param 	area_id 	formData   int  	true 	"间隔ID"
+//	@Param 	ied_name 	formData   string  	true 	"IED装置名称"
+//	@Param  ied_no     	formData   string 	true	"IED装置在特定间隔内,端子间使用的编号"
+// 	@Success     200    {object} ResultOK 成功
+// 	@Failure 	 500 	{object} ResultError  失败
+// @router /admin/update/check_area/iedno [post]
+func (c *BusAdminController) SaveCheckAreaIedNoByAreaID() {
+	area_id, _ := c.GetInt("area_id")
+	ied_name := c.GetString("ied_name")
+	if area_id == 0 {
+		c.Data["json"] = c.ResultError("间隔ID不能为空!")
+		c.ServeJSON()
+		return
+	}
+	if ied_name == "" {
+		c.Data["json"] = c.ResultError("装置名称不能为空!")
+		c.ServeJSON()
+		return
+	}
+	obj := new(bo.CheckAreaMgr)
+	obj.SetUserInfo(c.GetCurrentUserInfo())
+	err := obj.SetIedNo(area_id, ied_name, c.GetString("ied_no"))
+	if err != nil {
+		c.Data["json"] = c.ResultError(err.Error())
+		c.ServeJSON()
+		return
+	}
+	c.Data["json"] = c.ResultOK("", 0)
+	c.ServeJSON()
+}
+
 // @Summary 获取指定模型和装置类型的功能列表
 //	@Description  获取指定模型和装置类型的功能列表
 // 	@Tags         业务管理服务

+ 22 - 2
service/models/bo/checktools_area.go

@@ -52,6 +52,7 @@ type t_data_check_area_ied struct {
 	IedType string
 	ScdId   int64
 	PType   string
+	IedNo   string //所属间隔下支路(线路)在SCD中端子实际编号,如在母线间隔下支路9
 	Cr      int    // '创建人' ,
 	Ct      string `orm:"-"` // '创建时间' ,
 	Ur      int    // '更新人' ,
@@ -265,6 +266,13 @@ func (c *CheckAreaMgr) UpdateIeds(scdid int64, areaid int, ieds string) error {
 	return err
 }
 
+//设置间隔下指定装置的端子编号,该编号只有在端子匹配表达式中存在{no}标识时才会使用
+func (c *CheckAreaMgr) SetIedNo(areaid int, iedname, no string) error {
+	db := orm.NewOrm()
+	_, err := db.Raw("update t_data_check_area_ied set ied_no=? where area_id=? and ied_name=?", no, areaid, iedname).Exec()
+	return err
+}
+
 //获取指定SCD的IED类型列表
 func (c *CheckAreaMgr) GetIedTypeList(scdid int64) ([]orm.Params, error) {
 	db := orm.NewOrm()
@@ -638,7 +646,7 @@ func (c *CheckAreaMgr) CheckIedFcda() error {
 		}
 		//获取该间隔下该类型的装置
 		s1 := []orm.Params{}
-		_, err = db.Raw("select ied_name from t_data_check_area_ied where area_id=?", area_id).Values(&s1)
+		_, err = db.Raw("select ied_name,ied_no from t_data_check_area_ied where area_id=?", area_id).Values(&s1)
 		typeMappingMgr := new(SysCheckModelIedtypeMappingMgr)
 		pmCode := c.getIedTypeCode(modelid, "PM")
 		//循环处理关联关系
@@ -702,7 +710,7 @@ func (c *CheckAreaMgr) CheckIedFcda() error {
 				if extreflist == nil {
 					extreflist = getIedExtRefs(iedname)
 				}
-				for outiedname, _ := range outiedlist {
+				for outiedname, outied := range outiedlist {
 					if iedname == outiedname {
 						continue
 					}
@@ -718,12 +726,24 @@ func (c *CheckAreaMgr) CheckIedFcda() error {
 						continue
 					}
 					outiedFcdaList := getIedFcdas(outiedname) //输入装置的信号输出端子
+					//是否设置的端子编号
+					noText := tools.IsEmpty(ied["ied_no"])
+					if noText == "" {
+						noText = tools.IsEmpty(outied["ied_no"])
+					}
 					//检查是否有错误和缺失的端子
 					for _, r := range refrow {
 						extref_name := tools.IsEmpty(r["to_fcda_name"])
 						fcda_name := tools.IsEmpty(r["from_fcda_name"])
 						extref_name_exp := tools.IsEmpty(r["to_fcda_match_exp"])
 						fcda_name_exp := tools.IsEmpty(r["from_fcda_match_exp"])
+						//端子编号处理
+						if strings.Index(extref_name_exp, "{no}") > -1 {
+							extref_name_exp = strings.ReplaceAll(extref_name_exp, "{no}", noText)
+						}
+						if strings.Index(fcda_name_exp, "{no}") > -1 {
+							fcda_name_exp = strings.ReplaceAll(fcda_name_exp, "{no}", noText)
+						}
 						funcExist := false //判断接收端设计的端子是否存在
 						extrefObj := new(node_attr.NExtRef)
 						fcda2Exist := false

+ 9 - 0
service/routers/commentsRouter_controllers.go

@@ -745,6 +745,15 @@ func init() {
             Filters: nil,
             Params: nil})
 
+    beego.GlobalControllerRouter["scd_check_tools/controllers:BusAdminController"] = append(beego.GlobalControllerRouter["scd_check_tools/controllers:BusAdminController"],
+        beego.ControllerComments{
+            Method: "SaveCheckAreaIedNoByAreaID",
+            Router: "/admin/update/check_area/iedno",
+            AllowHTTPMethods: []string{"post"},
+            MethodParams: param.Make(),
+            Filters: nil,
+            Params: nil})
+
     beego.GlobalControllerRouter["scd_check_tools/controllers:ExcelController"] = append(beego.GlobalControllerRouter["scd_check_tools/controllers:ExcelController"],
         beego.ControllerComments{
             Method: "ExpTableData",

+ 44 - 0
service/static/swagger/swagger.json

@@ -1169,6 +1169,50 @@
                 }
             }
         },
+        "/admin/update/check_area/iedno": {
+            "post": {
+                "tags": [
+                    "scd_check_tools/controllersBusAdminController"
+                ],
+                "summary": "设置间隔下指定装置的端子编号",
+                "description": "设置间隔下指定装置的端子编号。该编号只有在端子匹配表达式中存在{no}标识时才会使用",
+                "parameters": [
+                    {
+                        "in": "formData",
+                        "name": "area_id",
+                        "description": "间隔ID",
+                        "required": true,
+                        "type": "integer",
+                        "format": "int64"
+                    },
+                    {
+                        "in": "formData",
+                        "name": "ied_name",
+                        "description": "IED装置名称",
+                        "required": true,
+                        "type": "string"
+                    },
+                    {
+                        "in": "formData",
+                        "name": "ied_no",
+                        "description": "IED装置在特定间隔内,端子间使用的编号",
+                        "required": true,
+                        "type": "string"
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "成功",
+                        "schema": {
+                            "$ref": "#/definitions/ResultOK"
+                        }
+                    },
+                    "500": {
+                        "description": "{object} ResultError  失败"
+                    }
+                }
+            }
+        },
         "/area/children/list": {
             "get": {
                 "tags": [

+ 30 - 0
service/static/swagger/swagger.yml

@@ -802,6 +802,36 @@ paths:
             $ref: '#/definitions/ResultOK'
         "500":
           description: '{object} ResultError  失败'
+  /admin/update/check_area/iedno:
+    post:
+      tags:
+      - scd_check_tools/controllersBusAdminController
+      summary: 设置间隔下指定装置的端子编号
+      description: 设置间隔下指定装置的端子编号。该编号只有在端子匹配表达式中存在{no}标识时才会使用
+      parameters:
+      - in: formData
+        name: area_id
+        description: 间隔ID
+        required: true
+        type: integer
+        format: int64
+      - in: formData
+        name: ied_name
+        description: IED装置名称
+        required: true
+        type: string
+      - in: formData
+        name: ied_no
+        description: IED装置在特定间隔内,端子间使用的编号
+        required: true
+        type: string
+      responses:
+        "200":
+          description: 成功
+          schema:
+            $ref: '#/definitions/ResultOK'
+        "500":
+          description: '{object} ResultError  失败'
   /area/children/list:
     get:
       tags:

+ 44 - 0
service/swagger/swagger.json

@@ -1169,6 +1169,50 @@
                 }
             }
         },
+        "/admin/update/check_area/iedno": {
+            "post": {
+                "tags": [
+                    "scd_check_tools/controllersBusAdminController"
+                ],
+                "summary": "设置间隔下指定装置的端子编号",
+                "description": "设置间隔下指定装置的端子编号。该编号只有在端子匹配表达式中存在{no}标识时才会使用",
+                "parameters": [
+                    {
+                        "in": "formData",
+                        "name": "area_id",
+                        "description": "间隔ID",
+                        "required": true,
+                        "type": "integer",
+                        "format": "int64"
+                    },
+                    {
+                        "in": "formData",
+                        "name": "ied_name",
+                        "description": "IED装置名称",
+                        "required": true,
+                        "type": "string"
+                    },
+                    {
+                        "in": "formData",
+                        "name": "ied_no",
+                        "description": "IED装置在特定间隔内,端子间使用的编号",
+                        "required": true,
+                        "type": "string"
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "成功",
+                        "schema": {
+                            "$ref": "#/definitions/ResultOK"
+                        }
+                    },
+                    "500": {
+                        "description": "{object} ResultError  失败"
+                    }
+                }
+            }
+        },
         "/area/children/list": {
             "get": {
                 "tags": [

+ 30 - 0
service/swagger/swagger.yml

@@ -802,6 +802,36 @@ paths:
             $ref: '#/definitions/ResultOK'
         "500":
           description: '{object} ResultError  失败'
+  /admin/update/check_area/iedno:
+    post:
+      tags:
+      - scd_check_tools/controllersBusAdminController
+      summary: 设置间隔下指定装置的端子编号
+      description: 设置间隔下指定装置的端子编号。该编号只有在端子匹配表达式中存在{no}标识时才会使用
+      parameters:
+      - in: formData
+        name: area_id
+        description: 间隔ID
+        required: true
+        type: integer
+        format: int64
+      - in: formData
+        name: ied_name
+        description: IED装置名称
+        required: true
+        type: string
+      - in: formData
+        name: ied_no
+        description: IED装置在特定间隔内,端子间使用的编号
+        required: true
+        type: string
+      responses:
+        "200":
+          description: 成功
+          schema:
+            $ref: '#/definitions/ResultOK'
+        "500":
+          description: '{object} ResultError  失败'
   /area/children/list:
     get:
       tags: