Browse Source

制造类--证书

lining 5 years ago
parent
commit
8e0eae9fdc

+ 47 - 10
src/dashoo.cn/backend/api/controllers/oilsupplier/suppliercertsub.go

@@ -363,6 +363,7 @@ func (this *OilSupplierCertSubController) AddGoodsBus() {
 	svcSupplier := supplier.GetOilSupplierService(utils.DBE)
 	svcSupplier.GetEntityById(datamain.SupplierId, &supplierModel)
 
+	LABEL1:
 	for n := 0; n < len(dataother.CheckList); n++ {
 		where_sub := "SupplierTypeCode = 01 and SupplierId = '" + strconv.Itoa(dataother.SupplierId) + "'"
 		where_sub += " and SupplierCertId = '" + strconv.Itoa(dataother.SupplierCertId) + "'"
@@ -372,6 +373,11 @@ func (this *OilSupplierCertSubController) AddGoodsBus() {
 		has := svc.GetEntityByWhere(OilSupplierCertSubName, where_sub, &model)
 
 		if !has {
+			if supplierModel.OperType == "制造商" {
+				datamain.IsManufacturer = 1
+			} else {
+				datamain.IsManufacturer = 2
+			}
 			datamain.SubClassId, _ = utils.StrTo(dataother.CheckList[n].Id).Int()
 			datamain.Code = dataother.CheckList[n].Code
 			datamain.Name = dataother.CheckList[n].Name
@@ -382,14 +388,32 @@ func (this *OilSupplierCertSubController) AddGoodsBus() {
 			datamain.CreateUserId, _ = utils.StrTo(this.User.Id).Int()
 			unitsvc := organize.GetOrganizeService(utils.DBE)
 			unitid := unitsvc.GetMyUnitDepartmentId(this.User.DepartmentId)
-			if unitid == "100000095" {
+			if unitid == "100000095" { // 100000095 企管法规处(内控与风险管理处)
 				datamain.CertSubStatus = "1"
 			}
-			svc.InsertEntityBytbl(OilSupplierCertSubName, &datamain)
 
-			paramSvc := baseparameter.GetBaseparameterService(utils.DBE)
 			filesvc := supplierfile.GetSupplierfileService(utils.DBE)
-			needList := filesvc.GetGoodsNeedFileList(dataother.CheckList[n].Id, "2")
+			needList := filesvc.GetGoodsNeedFileList(dataother.CheckList[n].Id, strconv.Itoa(datamain.IsManufacturer)) // 需要的资质
+			paramSvc := baseparameter.GetBaseparameterService(utils.DBE)
+
+			//isContinue := false
+			if datamain.IsManufacturer == 2 {
+				needList1 := filesvc.GetGoodsNeedFileList(dataother.CheckList[n].Id, "1") // 需要的资质--制造类
+				// 中油集团公司产品质量认可证书
+				CNPCrenkezhengshu := paramSvc.GetBaseparameterMessage("GFGL", "paramset", "CNPCrenkezhengshu")
+				for _, item := range needList1 {
+					if item.FileName == CNPCrenkezhengshu {
+						continue LABEL1
+						//isContinue = true
+						//break
+					}
+				}
+			}
+			//if isContinue {
+			//	break
+			//}
+			svc.InsertEntityBytbl(OilSupplierCertSubName, &datamain)
+
 			if supplierCertModel.InStyle == "4" {
 				var needFile supplierfile.FileList
 				//战略合作协议扫描件
@@ -397,15 +421,16 @@ func (this *OilSupplierCertSubController) AddGoodsBus() {
 				needList = append(needList, needFile)
 			}
 
-			var list []supplierfile.OilSupplierFile
+			var Havelist []supplierfile.OilSupplierFile // 已经有的资质
 			where := "SupplierTypeCode in (01,000) and IsManuf in ('0','2', '') and SupplierId = '" + strconv.Itoa(dataother.SupplierId) + "'"
-			svc.GetEntitysByWhere(OilSupplierFileName, where, &list)
+			svc.GetEntitysByWhere(OilSupplierFileName, where, &Havelist)
 
 			//三证合一或五证合一不需要的字段
 			mergerCertSkipField := paramSvc.GetBaseparameterMessage("GFGL", "paramset", "MergerCertSkipFieldName")
 			//"营业执照,组织代码,组织机构代码证,税务登记证,税务登记,开户许可,银行开户许可证,承诺书,诚信合规承诺书,企业信息系统截图,战略合作协议扫描件,"
 			mustField := paramSvc.GetBaseparameterMessage("GFGL", "paramset", "MustFieldName")
 
+
 			for i := 0; i < len(needList); i++ {
 				var entity supplierfile.OilSupplierFile
 				entity.SupplierId = dataother.SupplierId
@@ -418,7 +443,7 @@ func (this *OilSupplierCertSubController) AddGoodsBus() {
 				cert2File.SupplierId = dataother.SupplierId
 				cert2File.SupplierCertId = dataother.SupplierCertId
 				cert2File.SupplierTypeCode = dataother.SupplierTypeCode
-				cert2File.IsManuf = "2"
+				cert2File.IsManuf = strconv.Itoa(datamain.IsManufacturer)
 				cert2File.SubClassId, _ = utils.StrTo(dataother.CheckList[n].Id).Int()
 				cert2File.Code = dataother.CheckList[n].Code
 				cert2File.Name = dataother.CheckList[n].Name
@@ -430,7 +455,7 @@ func (this *OilSupplierCertSubController) AddGoodsBus() {
 					entity.IsManuf = "0"
 				} else {
 					entity.SupplierTypeCode = dataother.SupplierTypeCode
-					entity.IsManuf = "2"
+					entity.IsManuf = strconv.Itoa(datamain.IsManufacturer)
 				}
 				entity.NeedFileType = needList[i].FileName
 				entity.FileType = 1
@@ -440,8 +465,8 @@ func (this *OilSupplierCertSubController) AddGoodsBus() {
 				entity.SupType = 1
 
 				isRepeat := false
-				for j := 0; j < len(list); j++ {
-					if list[j].NeedFileType == needList[i].FileName {
+				for j := 0; j < len(Havelist); j++ {
+					if Havelist[j].NeedFileType == needList[i].FileName {
 						isRepeat = true
 						break
 					}
@@ -1125,6 +1150,7 @@ func (this *OilSupplierCertSubController) UpdateManufacturer() {
 		_, error = svc.DBE.Exec("update " + OilSupplierCertSubName + " set IsManufacturer =1 where Id=" + Id + "")
 	} else if IsManufacturer == "1" {
 		var errinfo ErrorInfo
+
 		//根据Id查出OilSupplierCertSub的SubClassId
 		filesvc := supplierfile.GetSupplierfileService(utils.DBE)
 		paramSvc := baseparameter.GetBaseparameterService(utils.DBE)
@@ -1172,6 +1198,17 @@ func (this *OilSupplierCertSubController) UpdateManufacturer() {
 		var needList []supplierfile.FileList                                              //定义存储所拥有资质名称的数组
 		needList = filesvc.GetGoodsNeedFileList(strconv.Itoa(subClassId), IsManufacturer) //通过准入范围Id获得资质名称并填充数组
 
+		CNPCrenkezhengshu := paramSvc.GetBaseparameterMessage("GFGL", "paramset", "CNPCrenkezhengshu")
+		for _, item := range needList {
+			if CNPCrenkezhengshu == item.FileName {
+				errinfo.Message = "该准入项不能修改为非制造类!"
+				errinfo.Code = -2
+				this.Data["json"] = &errinfo
+				this.ServeJSON()
+				return
+			}
+		}
+
 		var mustField string
 		mustField = paramSvc.GetBaseparameterMessage("GFGL", "paramset", "MustFieldName") //必需的资质
 

+ 2 - 2
src/dashoo.cn/frontend_web/nuxt.config.ignore.js

@@ -165,10 +165,10 @@ module.exports = {
     'pages/oilsupplier/badrecord/*.*',
     // 'pages/oilsupplier/basisbuild/*.*',
     'pages/oilsupplier/compayaudit/*.*',
-    'pages/oilsupplier/goodsaptitude/*.*',
+    // 'pages/oilsupplier/goodsaptitude/*.*',
     'pages/oilsupplier/infochange/*.*',
     'pages/oilsupplier/infochangech/*.*',
-    'pages/oilsupplier/supplier/*.*',
+    // 'pages/oilsupplier/supplier/*.*',
     'pages/oilsupplier/supplierappend/*.*',
     'pages/oilsupplier/supplieraudit/*.*',
     'pages/oilsupplier/suppliercert/*.*',

+ 23 - 9
src/dashoo.cn/frontend_web/src/components/oilsupplier/goodslist.vue

@@ -40,7 +40,7 @@
             <span v-if="scope.row.GoodsLevel=='2'">二级</span>
           </template>
         </el-table-column>
-        <el-table-column label="是否为制造商" width="100">
+        <el-table-column label="是否为制造商" width="105">
           <template slot-scope="scope">
             <el-button type="primary" plain size="mini" v-if="scope.row.IsManufacturer == 2" @click="type_change(scope.row,canadd,newcanadd)" :disabled="isDisabledBtn()">非制造商</el-button>
             <el-button type="primary" plain size="mini" v-if="scope.row.IsManufacturer == 1" @click="type_change(scope.row,canadd,newcanadd)" :disabled="isDisabledBtn()">制造商</el-button>
@@ -222,13 +222,13 @@
                    size="mini"
                    @click="getChecklist()">确 定</el-button>
       </div>
-       <div slot="footer"
-           class="dialog-footer"
-           v-if="tabIdx==2">
-        <el-button type="primary"
-                   size="mini"
-                   @click="addBusiness1()">确 定</el-button>
-      </div>
+       <!--<div slot="footer"-->
+           <!--class="dialog-footer"-->
+           <!--v-if="tabIdx==2">-->
+        <!--<el-button type="primary"-->
+                   <!--size="mini"-->
+                   <!--@click="addBusiness1()">确 定</el-button>-->
+      <!--</div>-->
     </el-dialog>
   </div>
 </template>
@@ -373,12 +373,19 @@ export default {
               })
               this.initData()
               this.tableloading = false
+            } else if (res.data.code === -2) {
+              this.$message({
+                type: 'warning',
+                message: res.data.message
+              })
+              this.initData()
+              this.tableloading = false
             }
           })
             .catch(err => {
               console.error(err)
             })
-        }else if (val.IsManufacturer == 1){//---------------转换供应商与非供应商
+        } else if (val.IsManufacturer == 1){ // ---------------转换供应商与非供应商
           this.tableloading = true
           let IsManufacturer = 1
           this.$axios.get('suppliercertsub/updatemanufacturer/' + parseInt(val.Id) +'/'+parseInt(val.SupplierId) + '/' + IsManufacturer + '', {}).then(res => {
@@ -389,6 +396,13 @@ export default {
               })
               this.initData()
               this.tableloading = false
+            } else if (res.data.code === -2) {
+              this.$message({
+                type: 'warning',
+                message: res.data.message
+              })
+              this.initData()
+              this.tableloading = false
             }
           })
             .catch(err => {