Parcourir la source

新加端子数据项

liling il y a 1 an
Parent
commit
3b2a26f0f7

+ 32 - 3
service/controllers/busAdminController.go

@@ -15,6 +15,8 @@ import (
 	"scd_check_tools/tools"
 	"strconv"
 	"strings"
+
+	"github.com/astaxie/beego/orm"
 )
 
 //业务管理服务
@@ -408,11 +410,22 @@ func (c *BusAdminController) GetSysModelList() {
 	//如果是获取指定模型信息时,附加模型的标准装置类型信息
 	if obj.Model.Id > 0 {
 		//间隔类型id
-		codeinfo := new(bo.Global).GetCodeInfoByID(tools.IsEmpty(lst[0]["area_type"]))
+		syscode := new(bo.Global)
+		codeinfo := syscode.GetCodeInfoByID(tools.IsEmpty(lst[0]["area_type"]))
 		if codeinfo != nil {
 			code := "area_type_" + tools.IsEmpty(codeinfo["code"])
-			codeinfo = new(bo.Global).GetCodeInfoByCode("area_ied_type", code)
-			lst[0]["ied_type"] = codeinfo["name"]
+			codeinfo = syscode.GetCodeInfoByCode("area_ied_type", code)
+			codes := strings.Split(tools.IsEmpty(codeinfo["name"]), ",")
+			ccrows := []orm.Params{}
+			for _, item := range codes {
+				tmp := syscode.GetCodeInfoByCode("ied_type", item)
+				if tmp == nil {
+					ccrows = append(ccrows, orm.Params{"code": item, "name": item})
+				} else {
+					ccrows = append(ccrows, tmp)
+				}
+			}
+			lst[0]["ied_type"] = ccrows
 		}
 	}
 	c.Data["json"] = c.ResultOK(lst, cnt)
@@ -663,6 +676,8 @@ func (c *BusAdminController) GetFuncFcdaList() {
 //	@Param 	fcda_id 	formData   int  	false 	"端子ID。编辑时必传。"
 //	@Param 	fcda_name 	formData   string  	true 	"端子名称。必传。"
 //	@Param 	fcda_match_exp 	formData   string  	true 	"端子匹配表达式。必传。"
+//	@Param 	sv_or_goose 	formData   string  	true 	"端子信号类型。必传。仅支持SV或GOOSE"
+//	@Param 	in_or_out 	formData   string  	true 	"端子信号输入输出方向。必传。仅支持中文的'接收'或'输出'"
 // 	@Success     200    {object} ResultOK 成功
 // 	@Failure 	 500 	{object} ResultError  失败
 // @router /admin/model/function/fcda/save [post]
@@ -679,6 +694,8 @@ func (c *BusAdminController) SaveFuncFcda() {
 	fcda_match_exp := c.GetString("fcda_match_exp")
 	func_id, _ := c.GetInt("func_id")
 	fcda_id, _ := c.GetInt("fcda_id")
+	svorgoose := c.GetString("sv_or_goose")
+	inorout := c.GetString("in_or_out")
 	if func_name == "" {
 		c.Data["json"] = c.ResultError("功能名称不能为空!")
 		c.ServeJSON()
@@ -694,6 +711,16 @@ func (c *BusAdminController) SaveFuncFcda() {
 		c.ServeJSON()
 		return
 	}
+	if svorgoose == "" {
+		c.Data["json"] = c.ResultError("端子信号类型不能为空!")
+		c.ServeJSON()
+		return
+	}
+	if inorout == "" {
+		c.Data["json"] = c.ResultError("端子信号方向不能为空!")
+		c.ServeJSON()
+		return
+	}
 	mod := bo.T_data_model_func_def{}
 	mod.Id = func_id
 	mod.ModelId = modelid
@@ -702,6 +729,8 @@ func (c *BusAdminController) SaveFuncFcda() {
 	mod.FuncName = func_name
 	mod.FcdaName = fcda_name
 	mod.FcdaMatchExp = fcda_match_exp
+	mod.Svorgoose = svorgoose
+	mod.Inorout = inorout
 	mgr := new(bo.SysCheckModelIedFuncMgr)
 	mgr.SetUserInfo(c.GetCurrentUserInfo())
 	mgr.Model = mod

+ 20 - 1
service/models/bo/check_sysmodel_ied_func.go

@@ -20,6 +20,8 @@ type T_data_model_func_def struct {
 	FuncFcdaId   int    `orm:"-"`
 	FcdaName     string `orm:"-"` // 端子设计名称
 	FcdaMatchExp string `orm:"-"` // 端子匹配表达式
+	Svorgoose    string `orm:"-"`
+	Inorout      string `orm:"-"`
 	Cr           int    // '创建人' ,
 	Ct           string `orm:"-"` // '创建时间' ,
 	Ur           int    // '更新人' ,
@@ -51,7 +53,12 @@ func (c *SysCheckModelIedFuncMgr) Save() (err error) {
 	if err != nil {
 		return err
 	}
-
+	if c.Model.Svorgoose != "SV" || c.Model.Svorgoose != "GOOSE" {
+		return errors.New("端子信号类型值无效,仅支持SV或GOOSE")
+	}
+	if c.Model.Inorout != "接收" || c.Model.Inorout != "输出" {
+		return errors.New("端子信号方向值无效,仅支持'接收'或'输出'")
+	}
 	db.Begin()
 	if c.Model.Id > 0 {
 		//编辑
@@ -82,6 +89,8 @@ func (c *SysCheckModelIedFuncMgr) Save() (err error) {
 		fcdaMgr.Model.FcdaMatchExp = c.Model.FcdaMatchExp
 		fcdaMgr.Model.FcdaName = c.Model.FcdaName
 		fcdaMgr.Model.FuncId = c.Model.Id
+		fcdaMgr.Model.Svorgoose = c.Model.Svorgoose
+		fcdaMgr.Model.Inorout = c.Model.Inorout
 		err = fcdaMgr.Save()
 		if err != nil {
 			db.Rollback()
@@ -252,6 +261,14 @@ func (c *SysCheckModelIedFuncMgr) Imp(param map[string]interface{}) (bool, error
 		if fcda_match_exp == "" {
 			return false, errors.New(fmt.Sprintf("第%d行:端子关键词不能为空", i))
 		}
+		svorgoose := tools.IsEmpty(row[6])
+		if svorgoose == "" {
+			return false, errors.New(fmt.Sprintf("第%d行:信号类型不能为空", i))
+		}
+		inorout := tools.IsEmpty(row[7])
+		if inorout == "" {
+			return false, errors.New(fmt.Sprintf("第%d行:信号方向不能为空", i))
+		}
 		func_id = funcMap[func_name]
 		if func_id == 0 {
 			//获取功能id
@@ -276,6 +293,8 @@ func (c *SysCheckModelIedFuncMgr) Imp(param map[string]interface{}) (bool, error
 		mod.FuncName = func_name
 		mod.FcdaName = fcda_name
 		mod.FcdaMatchExp = fcda_match_exp
+		mod.Svorgoose = svorgoose
+		mod.Inorout = inorout
 		c.Model = mod
 		err := c.Save()
 		if err != nil {

+ 4 - 0
service/models/bo/check_sysmodel_ied_func_fcda.go

@@ -18,6 +18,8 @@ type T_data_model_func_fcda struct {
 	FuncId       int    // '功能ID',
 	FcdaName     string // 端子设计名称
 	FcdaMatchExp string // 端子匹配表达式
+	Svorgoose    string
+	Inorout      string
 	Cr           int    // '创建人' ,
 	Ct           string `orm:"-"` // '创建时间' ,
 	Ur           int    // '更新人' ,
@@ -101,6 +103,8 @@ func (c *SysCheckModelIedFuncFcdaMgr) Copy(oldFuncId, newModelId, newFuncId int)
 			FuncId:       newFuncId,
 			FcdaName:     tools.IsEmpty(row["fcda_name"]),
 			FcdaMatchExp: tools.IsEmpty(row["fcda_match_exp"]),
+			Svorgoose:    tools.IsEmpty(row["svorgoose"]),
+			Inorout:      tools.IsEmpty(row["inorout"]),
 		}
 		newid, err := db.Insert(&newFcda)
 		if err != nil {

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

@@ -613,6 +613,20 @@
                         "description": "端子匹配表达式。必传。",
                         "required": true,
                         "type": "string"
+                    },
+                    {
+                        "in": "formData",
+                        "name": "sv_or_goose",
+                        "description": "端子信号类型。必传。仅支持SV或GOOSE",
+                        "required": true,
+                        "type": "string"
+                    },
+                    {
+                        "in": "formData",
+                        "name": "in_or_out",
+                        "description": "端子信号输入输出方向。必传。仅支持中文的'接收'或'输出'",
+                        "required": true,
+                        "type": "string"
                     }
                 ],
                 "responses": {

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

@@ -425,6 +425,16 @@ paths:
         description: 端子匹配表达式。必传。
         required: true
         type: string
+      - in: formData
+        name: sv_or_goose
+        description: 端子信号类型。必传。仅支持SV或GOOSE
+        required: true
+        type: string
+      - in: formData
+        name: in_or_out
+        description: 端子信号输入输出方向。必传。仅支持中文的'接收'或'输出'
+        required: true
+        type: string
       responses:
         "200":
           description: 成功

+ 14 - 0
service/swagger/swagger.json

@@ -613,6 +613,20 @@
                         "description": "端子匹配表达式。必传。",
                         "required": true,
                         "type": "string"
+                    },
+                    {
+                        "in": "formData",
+                        "name": "sv_or_goose",
+                        "description": "端子信号类型。必传。仅支持SV或GOOSE",
+                        "required": true,
+                        "type": "string"
+                    },
+                    {
+                        "in": "formData",
+                        "name": "in_or_out",
+                        "description": "端子信号输入输出方向。必传。仅支持中文的'接收'或'输出'",
+                        "required": true,
+                        "type": "string"
                     }
                 ],
                 "responses": {

+ 10 - 0
service/swagger/swagger.yml

@@ -425,6 +425,16 @@ paths:
         description: 端子匹配表达式。必传。
         required: true
         type: string
+      - in: formData
+        name: sv_or_goose
+        description: 端子信号类型。必传。仅支持SV或GOOSE
+        required: true
+        type: string
+      - in: formData
+        name: in_or_out
+        description: 端子信号输入输出方向。必传。仅支持中文的'接收'或'输出'
+        required: true
+        type: string
       responses:
         "200":
           description: 成功