Kaynağa Gözat

前后:取消也可以暂停;年审和增项添加资质判断分类别

wd 4 yıl önce
ebeveyn
işleme
0ac5ed2504

+ 9 - 93
src/dashoo.cn/backend/api/controllers/oilsupplier/annualaudit.go

@@ -1700,10 +1700,18 @@ func (this *AnnualAuditController) AddQualChange() {
 	var jsonblob = this.Ctx.Input.RequestBody
 	json.Unmarshal(jsonblob, &model)
 
+	if strings.ReplaceAll(model.FileUrl, " ", "") == "" {
+		errinfo.Message = "资质文件地址错误,请重新上传!"
+		errinfo.Code = -1
+		this.Data["json"] = &errinfo
+		this.ServeJSON()
+		return
+	}
+
 	svc := qualchange.GetQualChangeService(utils.DBE)
 
 	var supplierfile supplierfile.OilSupplierFile
-	where := "SupplierId = '" + strconv.Itoa(model.SupplierId) + "' and NeedFileType='" + model.NeedFileType + "'  and a.SupplierTypeCode in ( '000', '" + model.SupplierTypeCode + "')"
+	where := "SupplierId = '" + strconv.Itoa(model.SupplierId) + "' and NeedFileType='" + model.NeedFileType + "'  and SupplierTypeCode in ( '000', '" + model.SupplierTypeCode + "')"
 	has := svc.GetEntity(&supplierfile, where)
 
 	var tableHeader tableheader.BaseTableheader
@@ -1938,98 +1946,6 @@ func (this *AnnualAuditController) DeleteAddFile() {
 	}
 }
 
-// @Title 添加资质
-// @Description 添加资质
-// @Success	200	{object}
-// @router /addqualchange/:id [post]
-func (this *AnnualAuditController) AddAppChange() {
-	id := this.Ctx.Input.Param(":id")
-	var errinfo ErrorInfo
-	if id == "" {
-		errinfo.Message = "操作失败!请求信息不完整"
-		errinfo.Code = -2
-		this.Data["json"] = &errinfo
-		this.ServeJSON()
-		return
-	}
-	var model annualaudit.OilAnnualChangeDetail
-	var jsonblob = this.Ctx.Input.RequestBody
-	json.Unmarshal(jsonblob, &model)
-
-	if strings.ReplaceAll(model.FileUrl, " ", "") == "" {
-		errinfo.Message = "资质文件地址错误,请重新上传!"
-		errinfo.Code = -1
-		this.Data["json"] = &errinfo
-		this.ServeJSON()
-		return
-	}
-
-	svc := qualchange.GetQualChangeService(utils.DBE)
-
-	var file supplierfile.OilSupplierFile
-	where := "SupplierId = '" + strconv.Itoa(model.SupplierId) + "' and NeedFileType='" + model.NeedFileType + "'"
-	has := svc.GetEntity(&file, where)
-
-	var tableHeader tableheader.BaseTableheader
-	where1 := "Name = '" + model.NeedFileType + "'"
-	svc.GetEntityByWhere(BaseTableHeader, where1, &tableHeader)
-
-	if has {
-		errinfo.Message = "操作失败!该资质已添加"
-		errinfo.Code = -1
-		this.Data["json"] = &errinfo
-		this.ServeJSON()
-		return
-	}
-
-	file.SupplierId = model.SupplierId
-	file.SupplierTypeCode = model.SupplierTypeCode
-	file.IsManuf = tableHeader.IsManuf
-	file.NeedFileType = model.NeedFileType
-	file.FileType = 0
-	file.SupType = 2
-	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)
-
-	model.ParentId, _ = strconv.Atoi(id)
-	model.FileId = file.Id
-	model.FileUrl = strings.Trim(model.FileUrl, "$")
-	model.FileName = strings.Trim(model.FileName, "$")
-
-	var err error
-	var qualdetaimodel []annualaudit.OilAnnualChangeDetail
-
-	qdwhere := " SupplierId = " + utils.ToStr(model.SupplierId) + " and FileId = " + utils.ToStr(file.Id) + " and ParentId=" + id
-	svc.GetEntitysByWhere(OilAnnualChangeDetailName, qdwhere, &qualdetaimodel)
-	if len(qualdetaimodel) == 0 {
-		model.CreateOn = time.Now()
-		model.CreateBy = this.User.Realname
-		model.CreateUserId, _ = utils.StrTo(this.User.Id).Int()
-		_, err = svc.InsertEntityBytbl(OilAnnualChangeDetailName, &model)
-	} else {
-		err = svc.UpdateEntityBywheretbl(OilAnnualChangeDetailName, &model, []string{"OldEffectDate", "FileUrl", "FileName", "OtherRemark"}, qdwhere)
-	}
-
-	if err == nil {
-		errinfo.Message = "操作成功!"
-		errinfo.Code = 0
-		this.Data["json"] = &errinfo
-		this.ServeJSON()
-	} else {
-		errinfo.Message = "操作失败!" + utils.AlertProcess(err.Error())
-		errinfo.Code = -1
-		this.Data["json"] = &errinfo
-		this.ServeJSON()
-	}
-}
-
 // @Title 交费用户确认交费
 // @Description 交费用户确认交费
 // @Success 200 {object} controllers.Request

+ 20 - 2
src/dashoo.cn/backend/api/controllers/oilsupplier/supplier.go

@@ -3280,7 +3280,16 @@ func (this *OilSupplierController) CheckSupplierFileNew() {
 
 	// 查询出已有哪些资质
 	var tableheaderList []qualchange.OilQualChangeDetail1
-	fileSql := "SELECT * from OilSupplierFile WHERE SupplierId = " + strconv.Itoa(file.SupplierId)
+	where := ""
+	if file.CertId != "0" {
+		// 物资服务基建的资质分开判断 2021.06.07
+		var certInfo suppliercert.OilSupplierCert
+		supplierService.GetEntityByWhere("OilSupplierCert", "Id = "+file.CertId, &certInfo)
+		if certInfo.Id > 0 {
+			where = " and SupplierTypeCode in ( '000', '" + certInfo.SupplierTypeCode + "')"
+		}
+	}
+	fileSql := "SELECT * from OilSupplierFile WHERE IsDelete = 0 and SupplierId = " + strconv.Itoa(file.SupplierId) + where
 	svcHeader := tableheader.GetTableHeaderService(utils.DBE)
 	svcHeader.DBE.SQL(fileSql).Find(&tableheaderList)
 	var companyHasHeaders string
@@ -3642,7 +3651,16 @@ func (this *OilSupplierController) CheckSupplierFileList() {
 	//} else {
 	//	whereInfoFile = " and SupType in (0,1,2,3,5)"
 	//}
-	fileSql := "SELECT * from OilSupplierFile WHERE SupplierId = " + strconv.Itoa(file.SupplierId)
+	where := ""
+	if file.CertId != "0" {
+		// 物资服务基建的资质分开判断 2021.06.07
+		var certInfo suppliercert.OilSupplierCert
+		supplierService.GetEntityByWhere("OilSupplierCert", "Id = "+file.CertId, &certInfo)
+		if certInfo.Id > 0 {
+			where = " and SupplierTypeCode in ( '000', '" + certInfo.SupplierTypeCode + "')"
+		}
+	}
+	fileSql := "SELECT * from OilSupplierFile WHERE IsDelete = 0 and SupplierId = " + strconv.Itoa(file.SupplierId) + where
 	svcHeader := tableheader.GetTableHeaderService(utils.DBE)
 	svcHeader.DBE.SQL(fileSql).Find(&tableheaderList)
 	var companyHasHeaders string

+ 11 - 3
src/dashoo.cn/backend/api/controllers/oilsupplier/suppliercertappend.go

@@ -1784,8 +1784,8 @@ func (this *OilSupplierCertAppendController) updatesupplier(supname string, supp
 	return err
 }
 
-// @Title 添加资金
-// @Description 添加资金
+// @Title 增项添加资质
+// @Description 增项添加资质
 // @Success	200	{object}
 // @router /addqualchange/:id [post]
 func (this *OilSupplierCertAppendController) AddAppChange() {
@@ -1802,10 +1802,18 @@ func (this *OilSupplierCertAppendController) AddAppChange() {
 	var jsonblob = this.Ctx.Input.RequestBody
 	json.Unmarshal(jsonblob, &model)
 
+	if strings.ReplaceAll(model.FileUrl, " ", "") == "" {
+		errinfo.Message = "资质文件地址错误,请重新上传!"
+		errinfo.Code = -1
+		this.Data["json"] = &errinfo
+		this.ServeJSON()
+		return
+	}
+
 	svc := qualchange.GetQualChangeService(utils.DBE)
 
 	var supplierfile supplierfile.OilSupplierFile
-	where := "SupplierId = '" + strconv.Itoa(model.SupplierId) + "' and NeedFileType='" + model.NeedFileType + "'"
+	where := "SupplierId = '" + strconv.Itoa(model.SupplierId) + "' and NeedFileType='" + model.NeedFileType + "' and SupplierTypeCode in ( '000', '" + model.SupplierTypeCode + "')"
 	has := svc.GetEntity(&supplierfile, where)
 
 	var tableHeader tableheader.BaseTableheader

+ 3 - 2
src/dashoo.cn/frontend_web/src/pages/oilsupplier/annualaudit/_opera/bassicoperation.vue

@@ -3093,16 +3093,17 @@ import Viewer from 'v-viewer'
                 api.checkSupplierFileNew(fileType, this.$axios).then(res => {
                   if (res.data.code === 1) {
                     this.addInfoChangeItemCh(val)
-                    resolve(true)
+                    this.saveLoading = false
+                    return resolve(true)
                   } else {
                     this.$message({
                       duration: 10000,
                       type: 'warning',
                       message: res.data.message
                     })
+                    this.saveLoading = false
                     return resolve(false)
                   }
-                  this.saveLoading = false
                 })
               }
             }).catch(err => {

+ 1 - 2
src/dashoo.cn/frontend_web/src/pages/oilsupplier/annualaudit/_opera/goodsoperation.vue

@@ -3086,7 +3086,7 @@
                   if (res.data.code === 1) {
                     this.addInfoChangeItemCh(val)
                     this.saveLoading = false
-                    resolve(true)
+                    return resolve(true)
                   } else {
                     this.$message({
                       duration: 10000,
@@ -3101,7 +3101,6 @@
             }).catch(err => {
               this.saveLoading = false
               return resolve(false)
-              console.error(err)
             })
           } else {
             this.saveLoading = false

+ 7 - 6
src/dashoo.cn/frontend_web/src/pages/oilsupplier/annualaudit/_opera/operation.vue

@@ -3064,16 +3064,17 @@ import Viewer from 'v-viewer'
                 api.checkSupplierFileNew(fileType, this.$axios).then(res => {
                   if (res.data.code === 1) {
                     this.addInfoChangeItemCh(val)
-                    resolve(true)
+                    this.saveLoading = false
+                    return resolve(true)
                   } else {
                     this.$message({
-                duration: 10000,
-                type: 'warning',
-                message: res.data.message
-              })
+                      duration: 10000,
+                      type: 'warning',
+                      message: res.data.message
+                    })
+                    this.saveLoading = false
                     return resolve(false)
                   }
-                  this.saveLoading = false
                 })
               }
             }).catch(err => {

+ 1 - 1
src/dashoo.cn/frontend_web/src/pages/oilsupplier/supplierstore/_opera/basisedit.vue

@@ -15,7 +15,7 @@
           <el-button type="primary" size="mini" style="margin-right: 5px" @click="editIsRestrict('1')" v-if="formData.IsRestrict == '0' && showBtn">增项限制已关闭</el-button>
           <el-button type="primary" size="mini" style="margin-right: 5px" @click="showApplyTime" v-if="formData.InFlag != '3' && showBtn ">延长有效期</el-button>
           <el-button type="primary" size="mini" style="margin-right: 5px" @click="reInput" v-if="formData.InFlag == '3'">确认重新准入</el-button>
-          <el-button type="primary" size="mini" style="margin-right: 5px" @click="updateInFlag" v-if="formData.InFlag == '1' || formData.InFlag == '2'">修改准入标识</el-button>
+          <el-button type="primary" size="mini" style="margin-right: 5px" @click="updateInFlag">修改准入标识</el-button>
           <el-button type="primary" size="mini" style="margin-right: 5px" @click="checkFileList">检查资质</el-button>
           <el-button plain icon="el-icon-right" size="mini" style="margin-right: 5px" @click="nextTab">下一步</el-button>
           <el-popover>

+ 1 - 1
src/dashoo.cn/frontend_web/src/pages/oilsupplier/supplierstore/_opera/goodsedit.vue

@@ -15,7 +15,7 @@
           <el-button type="primary" size="mini" style="margin-right: 5px" @click="editIsRestrict('1')" v-if="formData.IsRestrict == '0' && showBtn">增项限制已关闭</el-button>
           <el-button type="primary" size="mini" style="margin-right: 5px" @click="showApplyTime" v-if="formData.InFlag != '3' && showBtn ">延长有效期</el-button>
           <el-button type="primary" size="mini" style="margin-right: 5px" @click="reInput" v-if="formData.InFlag == '3'">确认重新准入</el-button>
-          <el-button type="primary" size="mini" style="margin-right: 5px" @click="updateInFlag" v-if="formData.InFlag == '1' || formData.InFlag == '2'">修改准入标识</el-button>
+          <el-button type="primary" size="mini" style="margin-right: 5px" @click="updateInFlag">修改准入标识</el-button>
           <el-button type="primary" size="mini" style="margin-right: 5px" @click="checkFileList">检查资质</el-button>
           <el-button plain icon="el-icon-right" size="mini" style="margin-right: 5px" @click="nextTab">下一步</el-button>
           <router-link :to="'/oilsupplier/supplierstore/goodslist'">

+ 1 - 1
src/dashoo.cn/frontend_web/src/pages/oilsupplier/supplierstore/_opera/techedit.vue

@@ -15,7 +15,7 @@
           <el-button type="primary" size="mini" style="margin-right: 5px" @click="editIsRestrict('1')" v-if="formData.IsRestrict == '0' && showBtn">增项限制已关闭</el-button>
           <el-button type="primary" size="mini" style="margin-right: 5px" @click="showApplyTime" v-if="formData.InFlag != '3' && showBtn ">延长有效期</el-button>
           <el-button type="primary" size="mini" style="margin-right: 5px" @click="reInput" v-if="formData.InFlag == '3'">确认重新准入</el-button>
-          <el-button type="primary" size="mini" style="margin-right: 5px" @click="updateInFlag" v-if="formData.InFlag == '1' || formData.InFlag == '2'">修改准入标识</el-button>
+          <el-button type="primary" size="mini" style="margin-right: 5px" @click="updateInFlag">修改准入标识</el-button>
           <el-button type="primary" size="mini" style="margin-right: 5px" @click="checkFileList">检查资质</el-button>
           <el-button plain icon="el-icon-right"  size="mini" style="margin-right: 5px" @click="nextTab">下一步</el-button>
           <el-button type="primary" size="mini" style="margin-right: 5px" v-if="this,formData.Status == '7'" @click="confirm">确认入库</el-button>