|
|
@@ -8,6 +8,7 @@ import (
|
|
|
"dashoo.cn/backend/api/business/oilsupplier/oilcostmanage"
|
|
|
"dashoo.cn/backend/api/business/oilsupplier/qualchange"
|
|
|
"dashoo.cn/backend/api/business/oilsupplier/suppliercert"
|
|
|
+ "dashoo.cn/backend/api/business/oilsupplier/suppliercertappend"
|
|
|
"dashoo.cn/backend/api/business/oilsupplier/supplierfile"
|
|
|
"dashoo.cn/backend/api/business/oilsupplier/supplierlog"
|
|
|
"dashoo.cn/backend/api/business/oilsupplier/tableheader"
|
|
|
@@ -1693,7 +1694,7 @@ func (this *AnnualAuditController) AddQualChange() {
|
|
|
svc.GetEntityByWhere(BaseTableHeader, where1, &tableHeader)
|
|
|
|
|
|
if has {
|
|
|
- errinfo.Message = "操作失败!该资质已添加或正在参与其他流程审核"
|
|
|
+ errinfo.Message = "操作失败!该资质已添加"
|
|
|
errinfo.Code = -1
|
|
|
this.Data["json"] = &errinfo
|
|
|
this.ServeJSON()
|
|
|
@@ -1709,6 +1710,10 @@ func (this *AnnualAuditController) AddQualChange() {
|
|
|
supplierfile.CreateOn = time.Now()
|
|
|
supplierfile.CreateUserId, _ = strconv.Atoi(this.User.Id)
|
|
|
supplierfile.CreateBy = this.User.Realname
|
|
|
+ supplierfile.FileUrl = strings.Trim(model.FileUrl, "$")
|
|
|
+ supplierfile.FileName = strings.Trim(model.FileName, "$")
|
|
|
+ supplierfile.EffectDate = model.EffectDate
|
|
|
+ supplierfile.OtherRemark = model.Remark
|
|
|
|
|
|
svc.InsertEntity(&supplierfile)
|
|
|
|
|
|
@@ -1767,6 +1772,22 @@ func (this *AnnualAuditController) EditQualChange() {
|
|
|
model.FileName = strings.Trim(model.FileName, "$")
|
|
|
model.OldFileUrl = strings.Trim(model.OldFileUrl, "$")
|
|
|
model.OldFileName = strings.Trim(model.OldFileName, "$")
|
|
|
+
|
|
|
+ var supplierfile supplierfile.OilSupplierFile
|
|
|
+ svc.GetEntityByIdBytbl(OilSupplierFileName, model.Id, &supplierfile)
|
|
|
+ if supplierfile.FileUrl == "" {
|
|
|
+ //区别 更新前和更新后文件
|
|
|
+ supplierfile.FileUrl = strings.Trim(model.FileUrl, "$")
|
|
|
+ supplierfile.FileName = strings.Trim(model.FileName, "$")
|
|
|
+ supplierfile.EffectDate = model.EffectDate
|
|
|
+ }
|
|
|
+ supplierfile.ModifiedOn = time.Now()
|
|
|
+ supplierfile.ModifiedUserId, _ = strconv.Atoi(this.User.Id)
|
|
|
+ supplierfile.ModifiedBy = this.User.Realname
|
|
|
+ supplierfile.OtherRemark = model.Remark
|
|
|
+ svc.UpdateEntityBywheretbl(OilSupplierFileName, &supplierfile, []string{"EffectDate", "FileUrl", "FileName", "ModifiedOn", "ModifiedUserId", "ModifiedBy", "OtherRemark"}, "Id = " + strconv.Itoa(model.Id))
|
|
|
+
|
|
|
+
|
|
|
var err error
|
|
|
var entity annualaudit.OilAnnualChangeDetail
|
|
|
var qualdetaimodel []annualaudit.OilAnnualChangeDetail
|
|
|
@@ -1858,6 +1879,30 @@ func (this *AnnualAuditController) DeleteAddFile() {
|
|
|
|
|
|
svc := infochange.GetInfoChangeService(utils.DBE)
|
|
|
|
|
|
+ var file supplierfile.OilSupplierFile
|
|
|
+ has1 := svc.GetEntity(&file, "Id=" + Id)
|
|
|
+ if !has1 {
|
|
|
+ errinfo.Message = "删除失败"
|
|
|
+ errinfo.Code = -1
|
|
|
+ this.Data["json"] = &errinfo
|
|
|
+ this.ServeJSON()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ // 如果有正在进行中的流程,不允许删除任何资质
|
|
|
+ var certList []suppliercert.OilSupplierCert
|
|
|
+ svc.GetEntitysByWhere(OilSupplierCertName, "Status > 0 and Status < 8 and SupplierId = " + strconv.Itoa(file.SupplierId), &certList)
|
|
|
+ var appendList suppliercertappend.OilSupplierCertAppend
|
|
|
+ svc.GetEntityByWhere(OilSupplierCertAppendName, "Status > 0 and Status < 8 and SupplierId = " + strconv.Itoa(file.SupplierId), &appendList)
|
|
|
+ var infoList infochange.OilInfoChange
|
|
|
+ svc.GetEntityByWhere(OilInfoChangeName, "Status > 0 and Status < 8 and SupplierId = " + strconv.Itoa(file.SupplierId), &infoList)
|
|
|
+ if len(certList) > 0 || appendList.Id > 0 || infoList.Id > 0 {
|
|
|
+ errinfo.Message = "有正在审核中的流程,不允许删除任何资质"
|
|
|
+ errinfo.Code = -1
|
|
|
+ this.Data["json"] = &errinfo
|
|
|
+ this.ServeJSON()
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
where := "FileId=" + Id
|
|
|
err := svc.DeleteEntityBytbl(OilAnnualChangeDetailName, where)
|
|
|
|
|
|
@@ -1906,7 +1951,7 @@ func (this *AnnualAuditController) AddAppChange() {
|
|
|
svc.GetEntityByWhere(BaseTableHeader, where1, &tableHeader)
|
|
|
|
|
|
if has {
|
|
|
- errinfo.Message = "操作失败!该资质已添加或正在参与其他流程审核"
|
|
|
+ errinfo.Message = "操作失败!该资质已添加"
|
|
|
errinfo.Code = -1
|
|
|
this.Data["json"] = &errinfo
|
|
|
this.ServeJSON()
|
|
|
@@ -1922,6 +1967,10 @@ func (this *AnnualAuditController) AddAppChange() {
|
|
|
file.CreateOn = time.Now()
|
|
|
file.CreateUserId, _ = strconv.Atoi(this.User.Id)
|
|
|
file.CreateBy = this.User.Realname
|
|
|
+ file.FileUrl = strings.Trim(model.FileUrl, "$")
|
|
|
+ file.FileName = strings.Trim(model.FileName, "$")
|
|
|
+ file.EffectDate = model.EffectDate
|
|
|
+ file.OtherRemark = model.Remark
|
|
|
|
|
|
svc.InsertEntity(&file)
|
|
|
|