|
@@ -7,6 +7,7 @@ import (
|
|
|
"scd_check_tools/models/enum"
|
|
|
"scd_check_tools/tools"
|
|
|
"strconv"
|
|
|
+ "strings"
|
|
|
|
|
|
"github.com/astaxie/beego/orm"
|
|
|
)
|
|
@@ -53,10 +54,10 @@ func (c *SysCheckModelIedFuncMgr) Save() (err error) {
|
|
|
if err != nil {
|
|
|
return err
|
|
|
}
|
|
|
- if c.Model.Svorgoose != "SV" || c.Model.Svorgoose != "GOOSE" {
|
|
|
+ if c.Model.Svorgoose != "SV" && c.Model.Svorgoose != "GOOSE" {
|
|
|
return errors.New("端子信号类型值无效,仅支持SV或GOOSE")
|
|
|
}
|
|
|
- if c.Model.Inorout != "接收" || c.Model.Inorout != "输出" {
|
|
|
+ if c.Model.Inorout != "接收" && c.Model.Inorout != "输出" {
|
|
|
return errors.New("端子信号方向值无效,仅支持'接收'或'输出'")
|
|
|
}
|
|
|
db.Begin()
|
|
@@ -237,6 +238,14 @@ func (c *SysCheckModelIedFuncMgr) Imp(param map[string]interface{}) (bool, error
|
|
|
logObj.Eventlevel = enum.OptEventLevel_Hight
|
|
|
logObj.Logtype = enum.LogType_imp
|
|
|
logObj.Description = "装置功能及端子导入"
|
|
|
+ //模型信息
|
|
|
+ modelObj := new(SysCheckModelMgr)
|
|
|
+ modelObj.Model.Id = modelId
|
|
|
+ modelInfo, dberr := modelObj.One()
|
|
|
+ if modelInfo.Id == 0 || dberr != nil {
|
|
|
+ return false, errors.New(fmt.Sprintf("无效的模型编号:%d", modelId))
|
|
|
+ }
|
|
|
+ modelInfoIedTypes := "," + tools.IsEmpty(modelInfo.IedTypes) + ","
|
|
|
i := 2
|
|
|
func_id := 0
|
|
|
fcda_id := 0
|
|
@@ -249,15 +258,19 @@ func (c *SysCheckModelIedFuncMgr) Imp(param map[string]interface{}) (bool, error
|
|
|
if ied_type == "" {
|
|
|
return false, errors.New(fmt.Sprintf("第%d行:装置类型编码不能为空", i))
|
|
|
}
|
|
|
+ if !strings.Contains(modelInfoIedTypes, ","+ied_type+",") {
|
|
|
+ //模型中未发现该装置类型
|
|
|
+ continue
|
|
|
+ }
|
|
|
func_name := tools.IsEmpty(row[3])
|
|
|
if func_name == "" {
|
|
|
return false, errors.New(fmt.Sprintf("第%d行:功能名称不能为空", i))
|
|
|
}
|
|
|
- fcda_name := tools.IsEmpty(row[4])
|
|
|
+ fcda_name := strings.ReplaceAll(strings.ReplaceAll(tools.IsEmpty(row[4]), "(", "("), ")", ")")
|
|
|
if fcda_name == "" {
|
|
|
return false, errors.New(fmt.Sprintf("第%d行:端子设计名称不能为空", i))
|
|
|
}
|
|
|
- fcda_match_exp := tools.IsEmpty(row[5])
|
|
|
+ fcda_match_exp := strings.ReplaceAll(strings.ReplaceAll(tools.IsEmpty(row[5]), "(", "("), ")", ")")
|
|
|
if fcda_match_exp == "" {
|
|
|
return false, errors.New(fmt.Sprintf("第%d行:端子关键词不能为空", i))
|
|
|
}
|