|
|
@@ -9,6 +9,7 @@ import (
|
|
|
"dashoo.cn/business2/parameter"
|
|
|
"encoding/json"
|
|
|
"fmt"
|
|
|
+ "log"
|
|
|
"reflect"
|
|
|
"strconv"
|
|
|
"strings"
|
|
|
@@ -61,11 +62,11 @@ func (this *OilSupplierCertAppendSubController) GetList() {
|
|
|
//}
|
|
|
SupplierCertId := this.GetString("SupCertId")
|
|
|
SupplierTypeCode := this.GetString("SupTypeCode")
|
|
|
- suwhere := " SupplierCertId = "+ SupplierCertId+ " and SupplierTypeCode = "+ SupplierTypeCode
|
|
|
+ suwhere := " SupplierCertId = " + SupplierCertId + " and SupplierTypeCode = " + SupplierTypeCode
|
|
|
svc := suppliercertappendsub.GetOilSupplierCertAppendSubService(utils.DBE)
|
|
|
var list []suppliercertsub.OilSupplierCertSub
|
|
|
//svc.GetEntitysByWhere(OilSupplierCertAppendSubName, where, &list)
|
|
|
- svc.GetEntitysByOrderbyWhere(OilSupplierCertSubName, suwhere,"CreateOn asc", &list)
|
|
|
+ svc.GetEntitysByOrderbyWhere(OilSupplierCertSubName, suwhere, "CreateOn asc", &list)
|
|
|
var datainfo ErrorDataInfo
|
|
|
datainfo.Item = list
|
|
|
this.Data["json"] = &datainfo
|
|
|
@@ -101,11 +102,11 @@ func (this *OilSupplierCertAppendSubController) GetListInAndApp() {
|
|
|
SupplierCertAppendId := this.GetString("SupplierCertAppendId")
|
|
|
suwhere := `((SupplierCertId = ` + SupplierCertId + ` AND SupplierTypeCode = '` + SupplierTypeCode + `' AND TYPE IN ('1', '3'))
|
|
|
OR (SupplierCertId = ` + SupplierCertId + ` AND SupplierTypeCode = '` + SupplierTypeCode + `' AND SupplierCertAppendId = ` + SupplierCertAppendId + `)) `
|
|
|
- //" SupplierCertId = "+ SupplierCertId+ " and SupplierTypeCode = "+ SupplierTypeCode
|
|
|
+ //" SupplierCertId = "+ SupplierCertId+ " and SupplierTypeCode = "+ SupplierTypeCode
|
|
|
svc := suppliercertappendsub.GetOilSupplierCertAppendSubService(utils.DBE)
|
|
|
var list []suppliercertsub.OilSupplierCertSub
|
|
|
//svc.GetEntitysByWhere(OilSupplierCertAppendSubName, where, &list)
|
|
|
- svc.GetEntitysByOrderbyWhere(OilSupplierCertSubName, suwhere,"CreateOn asc", &list)
|
|
|
+ svc.GetEntitysByOrderbyWhere(OilSupplierCertSubName, suwhere, "CreateOn asc", &list)
|
|
|
var datainfo ErrorDataInfo
|
|
|
datainfo.Item = list
|
|
|
this.Data["json"] = &datainfo
|
|
|
@@ -120,10 +121,10 @@ func (this *OilSupplierCertAppendSubController) GetMyList() {
|
|
|
SupplierCertId := this.GetString("SupCertId")
|
|
|
SupplierTypeCode := this.GetString("SupTypeCode")
|
|
|
SuppAppendId := this.GetString("SupplierCertAppendId")
|
|
|
- suwhere := " SupplierCertId = "+ SupplierCertId+ " and SupplierTypeCode = '"+ SupplierTypeCode +"' and SupplierCertAppendId = "+ SuppAppendId
|
|
|
+ suwhere := " SupplierCertId = " + SupplierCertId + " and SupplierTypeCode = '" + SupplierTypeCode + "' and SupplierCertAppendId = " + SuppAppendId
|
|
|
svc := suppliercertappendsub.GetOilSupplierCertAppendSubService(utils.DBE)
|
|
|
var list []suppliercertsub.OilSupplierCertSub
|
|
|
- svc.GetEntitysByOrderbyWhere(OilSupplierCertSubName, suwhere,"CreateOn asc", &list)
|
|
|
+ svc.GetEntitysByOrderbyWhere(OilSupplierCertSubName, suwhere, "CreateOn asc", &list)
|
|
|
var datainfo ErrorDataInfo
|
|
|
datainfo.Item = list
|
|
|
this.Data["json"] = &datainfo
|
|
|
@@ -157,11 +158,11 @@ func (this *OilSupplierCertAppendSubController) GetListAppend() {
|
|
|
SupplierCertAppendId := this.GetString("SupplierCertAppendId")
|
|
|
SupplierCertId := this.GetString("SupCertId")
|
|
|
SupplierTypeCode := this.GetString("SupTypeCode")
|
|
|
- suwhere := " SupplierCertId = "+ SupplierCertId+ " and SupplierCertAppendId= "+ SupplierCertAppendId +" and SupplierTypeCode = '"+ SupplierTypeCode +"' and Type in(2,3) "
|
|
|
+ suwhere := " SupplierCertId = " + SupplierCertId + " and SupplierCertAppendId= " + SupplierCertAppendId + " and SupplierTypeCode = '" + SupplierTypeCode + "' and Type in(2,3) "
|
|
|
svc := suppliercertappendsub.GetOilSupplierCertAppendSubService(utils.DBE)
|
|
|
var list []suppliercertsub.OilSupplierCertSub
|
|
|
//svc.GetEntitysByWhere(OilSupplierCertAppendSubName, where, &list)
|
|
|
- svc.GetEntitysByOrderbyWhere(OilSupplierCertSubName, suwhere,"CreateOn asc", &list)
|
|
|
+ svc.GetEntitysByOrderbyWhere(OilSupplierCertSubName, suwhere, "CreateOn asc", &list)
|
|
|
var datainfo ErrorDataInfo
|
|
|
datainfo.Item = list
|
|
|
this.Data["json"] = &datainfo
|
|
|
@@ -182,10 +183,10 @@ func (this *OilSupplierCertAppendSubController) AddAppendSub() {
|
|
|
model.CertSubStatus = "-1"
|
|
|
svc := suppliercertsub.GetOilSupplierCertSubService(utils.DBE)
|
|
|
var submodel suppliercertsub.OilSupplierCertSub
|
|
|
- where_certsub := " SupplierCertId = "+ utils.ToStr(model.SupplierCertId) + " and SupplierTypeCode = 02"
|
|
|
+ where_certsub := " SupplierCertId = " + utils.ToStr(model.SupplierCertId) + " and SupplierTypeCode = 02"
|
|
|
where_certsub += " and SubClassId = '" + utils.ToStr(model.SubClassId) + "'"
|
|
|
has := svc.GetEntityByWhere(OilSupplierCertSubName, where_certsub, &submodel)
|
|
|
- if !has{
|
|
|
+ if !has {
|
|
|
//添加到准入分类表中
|
|
|
_, err = svc.InsertEntityBytbl(OilSupplierCertSubName, &model)
|
|
|
|
|
|
@@ -262,6 +263,7 @@ func (this *OilSupplierCertAppendSubController) AddAppendSub() {
|
|
|
this.ServeJSON()
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
// @Title 批量添加增项准入范围--技术服务类
|
|
|
// @Description 批量添加准入范围
|
|
|
// @Success 200 {object} business.device.DeviceChannels
|
|
|
@@ -376,7 +378,7 @@ func (this *OilSupplierCertAppendSubController) AddGoodsBus() {
|
|
|
svcGoods := goodsaptitude.GetOilGoodsAptitudeService(utils.DBE)
|
|
|
|
|
|
for n := 0; n < len(dataother.CheckList); n++ {
|
|
|
- svcGoods.GetEntityJoin2(OilGoodsAptitudeName, OilGoodsAptitudeClassName, &goods, "Code = '" + dataother.CheckList[n].Code + "'")
|
|
|
+ svcGoods.GetEntityJoin2(OilGoodsAptitudeName, OilGoodsAptitudeClassName, &goods, "Code = '"+dataother.CheckList[n].Code+"'")
|
|
|
where_sub := "SupplierTypeCode = 01 and SupplierId = '" + strconv.Itoa(dataother.SupplierId) + "'"
|
|
|
where_sub += " and SupplierCertId = '" + strconv.Itoa(dataother.SupplierCertId) + "'"
|
|
|
where_sub += " and SubClassId = '" + strconv.Itoa(goods.Id) + "'"
|
|
|
@@ -396,7 +398,9 @@ func (this *OilSupplierCertAppendSubController) AddGoodsBus() {
|
|
|
datamain.CreateBy = this.User.Realname
|
|
|
datamain.CreateUserId, _ = utils.StrTo(this.User.Id).Int()
|
|
|
datamain.Id = 0
|
|
|
+ log.Print("增项【可】添加不存在的准入范围,SupplierId: " + strconv.Itoa(datamain.SupplierId) + "AppendId: " + strconv.Itoa(datamain.SupplierCertAppendId) + "Code: " + datamain.Code)
|
|
|
svc.InsertEntityBytbl(OilSupplierCertSubName, &datamain)
|
|
|
+ log.Println("添加成功")
|
|
|
|
|
|
// TODO: 删除准入范围和资质对应关系表
|
|
|
/*paramSvc := baseparameter.GetBaseparameterService(utils.DBE)
|
|
|
@@ -439,6 +443,8 @@ func (this *OilSupplierCertAppendSubController) AddGoodsBus() {
|
|
|
svc.InsertEntityBytbl(OilSupplierCert2FileName, &cert2File)
|
|
|
}*/
|
|
|
|
|
|
+ } else {
|
|
|
+ log.Print("增项【不可】添加不存在的准入范围,SupplierId: " + strconv.Itoa(datamain.SupplierId) + "AppendId: " + strconv.Itoa(datamain.SupplierCertAppendId) + "Code: " + datamain.Code)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -553,7 +559,7 @@ func (this *OilSupplierCertAppendSubController) UpdateManufacturerAppend() {
|
|
|
|
|
|
svc := suppliercertsub.GetOilSupplierCertSubService(utils.DBE)
|
|
|
var CertSublList []suppliercertsub.OilSupplierCertSub
|
|
|
- where := "SupplierId=" + SupplierId + " and Id not in (" + Id + ") and SupplierTypeCode ='"+ SupplierTypeCode+"'"// 没有删除的准入范围
|
|
|
+ where := "SupplierId=" + SupplierId + " and Id not in (" + Id + ") and SupplierTypeCode ='" + SupplierTypeCode + "'" // 没有删除的准入范围
|
|
|
svc.GetEntities(&CertSublList, where)
|
|
|
var SupplierCertId int
|
|
|
for _, CertSub := range CertSublList {
|
|
|
@@ -576,7 +582,6 @@ func (this *OilSupplierCertAppendSubController) UpdateManufacturerAppend() {
|
|
|
filesvc := supplierfile.GetSupplierfileService(utils.DBE)
|
|
|
paramSvc := baseparameter.GetBaseparameterService(utils.DBE)
|
|
|
|
|
|
-
|
|
|
SubClassIds := ""
|
|
|
for _, CertSub := range CertSublList {
|
|
|
SubClassIds += strconv.Itoa(CertSub.SubClassId) + ","
|
|
|
@@ -586,7 +591,7 @@ func (this *OilSupplierCertAppendSubController) UpdateManufacturerAppend() {
|
|
|
if SubClassIds != "" {
|
|
|
if SupplierTypeCode == "01" {
|
|
|
var CertSublList2 []suppliercertsub.OilSupplierCertSub
|
|
|
- wheregood := "SupplierId=" + SupplierId + " and Id not in (" + Id + ") and SupplierTypeCode ="+ SupplierTypeCode+" and IsManufacturer ="+IsManufacturer// 没有删除的准入范围
|
|
|
+ wheregood := "SupplierId=" + SupplierId + " and Id not in (" + Id + ") and SupplierTypeCode =" + SupplierTypeCode + " and IsManufacturer =" + IsManufacturer // 没有删除的准入范围
|
|
|
svc.GetEntities(&CertSublList2, wheregood)
|
|
|
SubClassIds2 := ""
|
|
|
for _, CertSub := range CertSublList2 {
|
|
|
@@ -617,8 +622,8 @@ func (this *OilSupplierCertAppendSubController) UpdateManufacturerAppend() {
|
|
|
}
|
|
|
subClassId := datamain.SubClassId //4.拿到结构体中的准入范围SubClassId
|
|
|
//根据SubClassId查出此准入范围所拥有的资质名称
|
|
|
- var needList []supplierfile.FileList //定义存储所拥有资质名称的数组
|
|
|
- needList = filesvc.GetGoodsNeedFileList(strconv.Itoa(subClassId),IsManufacturer) //通过准入范围Id获得资质名称并填充数组
|
|
|
+ var needList []supplierfile.FileList //定义存储所拥有资质名称的数组
|
|
|
+ needList = filesvc.GetGoodsNeedFileList(strconv.Itoa(subClassId), IsManufacturer) //通过准入范围Id获得资质名称并填充数组
|
|
|
|
|
|
var mustField string
|
|
|
mustField = paramSvc.GetBaseparameterMessage("GFGL", "paramset", "MustFieldName") //必需的资质
|
|
|
@@ -632,8 +637,8 @@ func (this *OilSupplierCertAppendSubController) UpdateManufacturerAppend() {
|
|
|
if flag == 0 && strings.Contains(fileNames, needList[j].FileName+",") {
|
|
|
continue
|
|
|
}
|
|
|
- where := " SupplierId= '" + strconv.Itoa(datamain.SupplierId) + "' and SupplierTypeCode ="+ SupplierTypeCode +" and IsManuf='"+IsManufacturer+ "' and NeedFileType='" + needList[j].FileName + "'" //拼接删除sql
|
|
|
- err := svc.DeleteEntityBytbl(OilSupplierFileName, where) //删除第j条资质数据
|
|
|
+ where := " SupplierId= '" + strconv.Itoa(datamain.SupplierId) + "' and SupplierTypeCode =" + SupplierTypeCode + " and IsManuf='" + IsManufacturer + "' and NeedFileType='" + needList[j].FileName + "'" //拼接删除sql
|
|
|
+ err := svc.DeleteEntityBytbl(OilSupplierFileName, where) //删除第j条资质数据
|
|
|
if err == nil {
|
|
|
errinfo.Message = "删除成功"
|
|
|
errinfo.Code = 0
|
|
|
@@ -646,7 +651,7 @@ func (this *OilSupplierCertAppendSubController) UpdateManufacturerAppend() {
|
|
|
this.ServeJSON()
|
|
|
}
|
|
|
}
|
|
|
- needList = filesvc.GetGoodsNeedFileList(strconv.Itoa(subClassId),"1")
|
|
|
+ needList = filesvc.GetGoodsNeedFileList(strconv.Itoa(subClassId), "1")
|
|
|
if supplierCertModel.InStyle == "4" {
|
|
|
var needFile supplierfile.FileList
|
|
|
//战略合作协议扫描件
|
|
|
@@ -698,13 +703,12 @@ func (this *OilSupplierCertAppendSubController) UpdateManufacturerAppend() {
|
|
|
svc.InsertEntityBytbl(OilSupplierFileName, &entity)
|
|
|
}
|
|
|
_, error = svc.DBE.Exec("update " + OilSupplierCertSubName + " set IsManufacturer =1 where Id=" + Id + "")
|
|
|
- } else if IsManufacturer == "1"{
|
|
|
+ } else if IsManufacturer == "1" {
|
|
|
var errinfo ErrorInfo
|
|
|
//根据Id查出OilSupplierCertSub的SubClassId
|
|
|
filesvc := supplierfile.GetSupplierfileService(utils.DBE)
|
|
|
paramSvc := baseparameter.GetBaseparameterService(utils.DBE)
|
|
|
|
|
|
-
|
|
|
SubClassIds := ""
|
|
|
for _, CertSub := range CertSublList {
|
|
|
SubClassIds += strconv.Itoa(CertSub.SubClassId) + ","
|
|
|
@@ -714,7 +718,7 @@ func (this *OilSupplierCertAppendSubController) UpdateManufacturerAppend() {
|
|
|
if SubClassIds != "" {
|
|
|
if SupplierTypeCode == "01" {
|
|
|
var CertSublList2 []suppliercertsub.OilSupplierCertSub
|
|
|
- wheregood := "SupplierId=" + SupplierId + " and Id not in (" + Id + ") and SupplierTypeCode ="+ SupplierTypeCode+" and IsManufacturer ="+IsManufacturer// 没有删除的准入范围
|
|
|
+ wheregood := "SupplierId=" + SupplierId + " and Id not in (" + Id + ") and SupplierTypeCode =" + SupplierTypeCode + " and IsManufacturer =" + IsManufacturer // 没有删除的准入范围
|
|
|
svc.GetEntities(&CertSublList2, wheregood)
|
|
|
SubClassIds2 := ""
|
|
|
for _, CertSub := range CertSublList2 {
|
|
|
@@ -745,8 +749,8 @@ func (this *OilSupplierCertAppendSubController) UpdateManufacturerAppend() {
|
|
|
}
|
|
|
subClassId := datamain.SubClassId //4.拿到结构体中的准入范围SubClassId
|
|
|
//根据SubClassId查出此准入范围所拥有的资质名称
|
|
|
- var needList []supplierfile.FileList //定义存储所拥有资质名称的数组
|
|
|
- needList = filesvc.GetGoodsNeedFileList(strconv.Itoa(subClassId),IsManufacturer) //通过准入范围Id获得资质名称并填充数组
|
|
|
+ var needList []supplierfile.FileList //定义存储所拥有资质名称的数组
|
|
|
+ needList = filesvc.GetGoodsNeedFileList(strconv.Itoa(subClassId), IsManufacturer) //通过准入范围Id获得资质名称并填充数组
|
|
|
|
|
|
var mustField string
|
|
|
mustField = paramSvc.GetBaseparameterMessage("GFGL", "paramset", "MustFieldName") //必需的资质
|
|
|
@@ -760,8 +764,8 @@ func (this *OilSupplierCertAppendSubController) UpdateManufacturerAppend() {
|
|
|
if flag == 0 && strings.Contains(fileNames, needList[j].FileName+",") {
|
|
|
continue
|
|
|
}
|
|
|
- where := " SupplierId= '" + strconv.Itoa(datamain.SupplierId) + "' and SupplierTypeCode ="+ SupplierTypeCode +" and IsManuf='"+IsManufacturer+ "' and NeedFileType='" + needList[j].FileName + "'" //拼接删除sql
|
|
|
- err := svc.DeleteEntityBytbl(OilSupplierFileName, where) //删除第j条资质数据
|
|
|
+ where := " SupplierId= '" + strconv.Itoa(datamain.SupplierId) + "' and SupplierTypeCode =" + SupplierTypeCode + " and IsManuf='" + IsManufacturer + "' and NeedFileType='" + needList[j].FileName + "'" //拼接删除sql
|
|
|
+ err := svc.DeleteEntityBytbl(OilSupplierFileName, where) //删除第j条资质数据
|
|
|
if err == nil {
|
|
|
errinfo.Message = "删除成功"
|
|
|
errinfo.Code = 0
|
|
|
@@ -774,7 +778,7 @@ func (this *OilSupplierCertAppendSubController) UpdateManufacturerAppend() {
|
|
|
this.ServeJSON()
|
|
|
}
|
|
|
}
|
|
|
- needList = filesvc.GetGoodsNeedFileList(strconv.Itoa(subClassId),"2")
|
|
|
+ needList = filesvc.GetGoodsNeedFileList(strconv.Itoa(subClassId), "2")
|
|
|
if supplierCertModel.InStyle == "4" {
|
|
|
var needFile supplierfile.FileList
|
|
|
//战略合作协议扫描件
|
|
|
@@ -857,7 +861,7 @@ func (this *OilSupplierCertAppendSubController) GetChangeEntity() {
|
|
|
models[0] = model
|
|
|
|
|
|
var infoitems []suppliercertappendsub.OilAppendChangeItem
|
|
|
- where := " SupplierId = " + Id +" and InfoId ="+InfoId
|
|
|
+ where := " SupplierId = " + Id + " and InfoId =" + InfoId
|
|
|
where = where + " and ChangeStatus = 0"
|
|
|
svc.GetEntitysByWhere(OilAppendChangeItemName, where, &infoitems)
|
|
|
tmpModel := &model
|
|
|
@@ -880,7 +884,7 @@ func (this *OilSupplierCertAppendSubController) GetChangeEntity() {
|
|
|
floatchangeinfo, _ := strconv.ParseFloat(info.ChangeInfo, 64)
|
|
|
elem.FieldByName(info.SelectItem).SetFloat(floatchangeinfo)
|
|
|
} else if elem.FieldByName(info.SelectItem).Type().String() == "time.Time" {
|
|
|
- t, _ := time.Parse("2006-01-02", info.ChangeInfo[0 : 10])
|
|
|
+ t, _ := time.Parse("2006-01-02", info.ChangeInfo[0:10])
|
|
|
elem.FieldByName(info.SelectItem).Set(reflect.ValueOf(t))
|
|
|
} else {
|
|
|
elem.FieldByName(info.SelectItem).SetString(info.ChangeInfo)
|
|
|
@@ -1022,7 +1026,6 @@ func (this *OilSupplierCertAppendSubController) EditQualChange() {
|
|
|
var entity suppliercertappendsub.OilAppendChangeDetail
|
|
|
var qualdetaimodel []suppliercertappendsub.OilAppendChangeDetail
|
|
|
|
|
|
-
|
|
|
qdwhere := " SupplierId = " + utils.ToStr(model.SupplierId) + " and FileId = " + utils.ToStr(model.Id) + " and ParentId=" + id
|
|
|
svc.GetEntitysByWhere(OilAppendChangeDetailName, qdwhere, &qualdetaimodel)
|
|
|
entity = model
|
|
|
@@ -1084,4 +1087,4 @@ func (this *OilSupplierCertAppendSubController) DeleteNewFile() {
|
|
|
this.Data["json"] = &errinfo
|
|
|
this.ServeJSON()
|
|
|
}
|
|
|
-}
|
|
|
+}
|