|
|
@@ -3,6 +3,7 @@ package oilsupplier
|
|
|
import (
|
|
|
"dashoo.cn/backend/api/business/oilsupplier/suppliercert"
|
|
|
"dashoo.cn/backend/api/business/oilsupplier/supplierdataentry"
|
|
|
+ "dashoo.cn/backend/api/business/oilsupplier/supplierpausereason"
|
|
|
"dashoo.cn/backend/api/business/oilsupplier/tableheader"
|
|
|
"dashoo.cn/backend/api/business/oilsupplier/technologyserviceclass"
|
|
|
"dashoo.cn/backend/api/business/workflow"
|
|
|
@@ -2165,6 +2166,8 @@ func (this *OilTechnologyServiceController) DeleteSuspend() {
|
|
|
|
|
|
go func() {
|
|
|
svc.GetEntitysByWhere("OilSupplierTecContrast", "Checked = '0'", &list)
|
|
|
+ paramSvc := baseparameter.GetBaseparameterService(utils.DBE)
|
|
|
+ DueTimeStr := paramSvc.GetBaseparameterMessage("GFZT", "paramset", "Suspend")
|
|
|
for _,item := range list{
|
|
|
var sub []suppliercertsub.OilSupplierCertSub
|
|
|
svc.GetEntitysByWhere("OilSupplierCertSub", "SupplierTypeCode = '03' and SupplierId = " + strconv.Itoa(item.Id), &sub)
|
|
|
@@ -2174,69 +2177,67 @@ func (this *OilTechnologyServiceController) DeleteSuspend() {
|
|
|
model, _ := svc.DBE.QueryString(sql)
|
|
|
var subDelete suppliercertsub.OilSupplierCertSub
|
|
|
if model != nil {
|
|
|
- //code := strings.Split(model[0]["Codes"], ",")
|
|
|
+ code := strings.Split(model[0]["Codes"], ",")
|
|
|
cols := []string{"Code"}
|
|
|
subDelete.Code = model[0]["Code"]
|
|
|
err = svc.UpdateEntityBywheretbl(OilSupplierCertSubName, &subDelete, cols, "Id = "+strconv.Itoa(itemSub.Id))
|
|
|
- //cols = append(cols, "DueTime")
|
|
|
- //cols = append(cols, "CertSubStatus")
|
|
|
- //subDelete.CertSubStatus = "2"
|
|
|
- //paramSvc := baseparameter.GetBaseparameterService(utils.DBE)
|
|
|
- //DueTimeStr := paramSvc.GetBaseparameterMessage("GFZT", "paramset", "Suspend")
|
|
|
- //currentTime := time.Now()
|
|
|
- //days,_ := strconv.Atoi(DueTimeStr)
|
|
|
- //subDelete.DueTime = currentTime.AddDate(0, 0, days)
|
|
|
- //i := 1
|
|
|
- ////暂停
|
|
|
- //for _, value := range code {
|
|
|
- // if i == 41 || i == 42 || i == 1 {
|
|
|
- // if (code[0] == "1" && strings.Index(item.HeaderCodes, "F01") < 0) && (code[40] == "1" && strings.Index(item.HeaderCodes, "F41") < 0) && (code[41] == "1" && strings.Index(item.HeaderCodes, "F42") < 0) {
|
|
|
- // err = svc.UpdateEntityBywheretbl(OilSupplierCertSubName, &subDelete, cols, "Id = " + strconv.Itoa(itemSub.Id))
|
|
|
- // var model1 supplierpausereason.OilSupplierPauseReason
|
|
|
- // model1.SupplierId = item.Id
|
|
|
- // model1.CertSubId = itemSub.Id
|
|
|
- // model1.CertSubStatus = "2"
|
|
|
- // model1.SupplierCertId = itemSub.SupplierCertId
|
|
|
- // model1.BackReason = "老数据导入缺资质"
|
|
|
- // model1.CreateOn = time.Now()
|
|
|
- // model1.CreateBy = this.User.Realname
|
|
|
- // model1.CreateUserId, _ = utils.StrTo(this.User.Id).Int()
|
|
|
- // svc.InsertEntityBytbl(OilSupplierPauseReasonName, &model1)
|
|
|
- // break
|
|
|
- // }
|
|
|
- // } else if i > 10 {
|
|
|
- // if value == "1" && strings.Index(item.HeaderCodes, "F"+strconv.Itoa(i)) < 0 {
|
|
|
- // err = svc.UpdateEntityBywheretbl(OilSupplierCertSubName, &subDelete, cols, "Id = " + strconv.Itoa(itemSub.Id))
|
|
|
- // var model1 supplierpausereason.OilSupplierPauseReason
|
|
|
- // model1.SupplierId = item.Id
|
|
|
- // model1.CertSubId = itemSub.Id
|
|
|
- // model1.CertSubStatus = "2"
|
|
|
- // model1.SupplierCertId = itemSub.SupplierCertId
|
|
|
- // model1.BackReason = "老数据导入缺资质"
|
|
|
- // model1.CreateOn = time.Now()
|
|
|
- // model1.CreateBy = this.User.Realname
|
|
|
- // model1.CreateUserId, _ = utils.StrTo(this.User.Id).Int()
|
|
|
- // svc.InsertEntityBytbl(OilSupplierPauseReasonName, &model1)
|
|
|
- // break
|
|
|
- // }
|
|
|
- // } else {
|
|
|
- // if value == "1" && strings.Index(item.HeaderCodes, "F0"+strconv.Itoa(i)) < 0 {
|
|
|
- // err = svc.UpdateEntityBywheretbl(OilSupplierCertSubName, &subDelete, cols, "Id = " + strconv.Itoa(itemSub.Id))
|
|
|
- // var model1 supplierpausereason.OilSupplierPauseReason
|
|
|
- // model1.SupplierId = item.Id
|
|
|
- // model1.CertSubId = itemSub.Id
|
|
|
- // model1.CertSubStatus = "2"
|
|
|
- // model1.SupplierCertId = itemSub.SupplierCertId
|
|
|
- // model1.BackReason = "老数据导入缺资质"
|
|
|
- // model1.CreateOn = time.Now()
|
|
|
- // model1.CreateBy = this.User.Realname
|
|
|
- // model1.CreateUserId, _ = utils.StrTo(this.User.Id).Int()
|
|
|
- // svc.InsertEntityBytbl(OilSupplierPauseReasonName, &model1)
|
|
|
- // break
|
|
|
- // }
|
|
|
- // }
|
|
|
- // i += 1
|
|
|
- //}
|
|
|
+ cols = append(cols, "DueTime")
|
|
|
+ cols = append(cols, "CertSubStatus")
|
|
|
+ subDelete.CertSubStatus = "2"
|
|
|
+ currentTime := time.Now()
|
|
|
+ days,_ := strconv.Atoi(DueTimeStr)
|
|
|
+ subDelete.DueTime = currentTime.AddDate(0, 0, days)
|
|
|
+ i := 1
|
|
|
+ //暂停
|
|
|
+ for _, value := range code {
|
|
|
+ if i == 41 || i == 42 || i == 1 {
|
|
|
+ if (code[0] == "1" && strings.Index(item.HeaderCodes, "F01") < 0) && (code[40] == "1" && strings.Index(item.HeaderCodes, "F41") < 0) && (code[41] == "1" && strings.Index(item.HeaderCodes, "F42") < 0) {
|
|
|
+ err = svc.UpdateEntityBywheretbl(OilSupplierCertSubName, &subDelete, cols, "Id = " + strconv.Itoa(itemSub.Id))
|
|
|
+ var model1 supplierpausereason.OilSupplierPauseReason
|
|
|
+ model1.SupplierId = item.Id
|
|
|
+ model1.CertSubId = itemSub.Id
|
|
|
+ model1.CertSubStatus = "2"
|
|
|
+ model1.SupplierCertId = itemSub.SupplierCertId
|
|
|
+ model1.BackReason = "老数据导入缺资质"
|
|
|
+ model1.CreateOn = time.Now()
|
|
|
+ model1.CreateBy = this.User.Realname
|
|
|
+ model1.CreateUserId, _ = utils.StrTo(this.User.Id).Int()
|
|
|
+ svc.InsertEntityBytbl(OilSupplierPauseReasonName, &model1)
|
|
|
+ break
|
|
|
+ }
|
|
|
+ } else if i > 10 {
|
|
|
+ if value == "1" && strings.Index(item.HeaderCodes, "F"+strconv.Itoa(i)) < 0 {
|
|
|
+ err = svc.UpdateEntityBywheretbl(OilSupplierCertSubName, &subDelete, cols, "Id = " + strconv.Itoa(itemSub.Id))
|
|
|
+ var model1 supplierpausereason.OilSupplierPauseReason
|
|
|
+ model1.SupplierId = item.Id
|
|
|
+ model1.CertSubId = itemSub.Id
|
|
|
+ model1.CertSubStatus = "2"
|
|
|
+ model1.SupplierCertId = itemSub.SupplierCertId
|
|
|
+ model1.BackReason = "老数据导入缺资质"
|
|
|
+ model1.CreateOn = time.Now()
|
|
|
+ model1.CreateBy = this.User.Realname
|
|
|
+ model1.CreateUserId, _ = utils.StrTo(this.User.Id).Int()
|
|
|
+ svc.InsertEntityBytbl(OilSupplierPauseReasonName, &model1)
|
|
|
+ break
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if value == "1" && strings.Index(item.HeaderCodes, "F0"+strconv.Itoa(i)) < 0 {
|
|
|
+ err = svc.UpdateEntityBywheretbl(OilSupplierCertSubName, &subDelete, cols, "Id = " + strconv.Itoa(itemSub.Id))
|
|
|
+ var model1 supplierpausereason.OilSupplierPauseReason
|
|
|
+ model1.SupplierId = item.Id
|
|
|
+ model1.CertSubId = itemSub.Id
|
|
|
+ model1.CertSubStatus = "2"
|
|
|
+ model1.SupplierCertId = itemSub.SupplierCertId
|
|
|
+ model1.BackReason = "老数据导入缺资质"
|
|
|
+ model1.CreateOn = time.Now()
|
|
|
+ model1.CreateBy = this.User.Realname
|
|
|
+ model1.CreateUserId, _ = utils.StrTo(this.User.Id).Int()
|
|
|
+ svc.InsertEntityBytbl(OilSupplierPauseReasonName, &model1)
|
|
|
+ break
|
|
|
+ }
|
|
|
+ }
|
|
|
+ i += 1
|
|
|
+ }
|
|
|
} else {
|
|
|
// 删除
|
|
|
//err = svc.DeleteEntityById(itemSub.Id, &subDelete)
|