|
@@ -679,7 +679,7 @@ func (c *EdbInfoController) SaveRelationEdbRefreshStatus() {
|
|
|
}
|
|
|
edbType := 1 //基础指标
|
|
|
switch req.Source {
|
|
|
- case utils.DATA_SOURCE_MYSTEEL_CHEMICAL, utils.DATA_SOURCE_WIND: // wind
|
|
|
+ case utils.DATA_SOURCE_MYSTEEL_CHEMICAL, utils.DATA_SOURCE_WIND, utils.DATA_SOURCE_THS, utils.DATA_SOURCE_PB_FINANCE, utils.DATA_SOURCE_PB: // wind
|
|
|
case -1:
|
|
|
req.Source = 0
|
|
|
edbType = 2
|
|
@@ -712,12 +712,32 @@ func (c *EdbInfoController) SaveRelationEdbRefreshStatus() {
|
|
|
if ok {
|
|
|
continue
|
|
|
}
|
|
|
-
|
|
|
+ if v.RelationNum > 0 && v.IsSupplierStop == 0 {
|
|
|
+ br.Msg = "保存失败,停用指标已被引用,指标ID:" + v.EdbCode + "指标名称:" + v.EdbName
|
|
|
+ br.ErrMsg = "保存失败,停用指标已被引用,指标ID:" + v.EdbCode + "指标名称:" + v.EdbName
|
|
|
+ return
|
|
|
+ }
|
|
|
// 加入到待配置的指标列表id
|
|
|
edbIdList = append(edbIdList, v.EdbInfoId)
|
|
|
}
|
|
|
} else {
|
|
|
edbIdList = req.EdbSelectIdList
|
|
|
+ _, edbRelationList, err := data.GetEdbRelationListByIds(edbIdList, req.Source)
|
|
|
+ if err != nil && !utils.IsErrNoRow(err) {
|
|
|
+ br.Msg = "获取失败"
|
|
|
+ br.ErrMsg = "获取数据失败,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ for _, v := range edbRelationList {
|
|
|
+ if v.RelationNum > 0 && v.IsSupplierStop == 0 {
|
|
|
+ br.Msg = "保存失败,停用指标已被引用,指标ID:" + v.EdbCode + "指标名称:" + v.EdbName
|
|
|
+ br.ErrMsg = "保存失败,停用指标已被引用,指标ID:" + v.EdbCode + "指标名称:" + v.EdbName
|
|
|
+ return
|
|
|
+ }
|
|
|
+ // 加入到待配置的指标列表id
|
|
|
+ // 加入到待配置的指标列表id
|
|
|
+ edbIdList = append(edbIdList, v.EdbInfoId)
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
if len(edbIdList) <= 0 {
|
|
@@ -725,14 +745,8 @@ func (c *EdbInfoController) SaveRelationEdbRefreshStatus() {
|
|
|
br.IsSendEmail = false
|
|
|
return
|
|
|
}
|
|
|
- //查询指标信息
|
|
|
- edbList, e := data_manage.GetEdbInfoByIdList(edbIdList)
|
|
|
- if e != nil && !utils.IsErrNoRow(e) {
|
|
|
- br.Msg = "获取失败"
|
|
|
- br.ErrMsg = "获取数据失败,Err:" + e.Error()
|
|
|
- return
|
|
|
- }
|
|
|
|
|
|
+ var edbList []*data_manage.EdbInfo
|
|
|
// 如果是钢联化工,那么需要过滤供应商暂停的指标
|
|
|
if req.Source == utils.DATA_SOURCE_MYSTEEL_CHEMICAL {
|
|
|
// 获取未被供应商暂停的指标
|
|
@@ -760,13 +774,21 @@ func (c *EdbInfoController) SaveRelationEdbRefreshStatus() {
|
|
|
br.ErrMsg = "获取数据失败,Err:" + err.Error()
|
|
|
return
|
|
|
}
|
|
|
-
|
|
|
if len(edbList) <= 0 {
|
|
|
br.Ret = 200
|
|
|
br.Success = true
|
|
|
br.Msg = "保存成功"
|
|
|
return
|
|
|
}
|
|
|
+ } else {
|
|
|
+ //查询指标信息
|
|
|
+ edbList, err = data_manage.GetEdbInfoByIdList(edbIdList)
|
|
|
+ if err != nil && !utils.IsErrNoRow(err) {
|
|
|
+ br.Msg = "获取失败"
|
|
|
+ br.ErrMsg = "获取数据失败,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
|
|
|
fromEdbIdList := make([]int, 0)
|