Browse Source

生成编码

lining 6 years ago
parent
commit
407a0fc90c

+ 18 - 32
src/dashoo.cn/backend/api/controllers/oilsupplier/suppliercert.go

@@ -1190,48 +1190,34 @@ func (this *OilSupplierCertController) CreateAccessCardNo() {
 	certId := this.GetString(("SupplierCertId"))
 	typeCode := this.Ctx.Input.Param(":type")
 	codecSvc := codecsequence.GetCodecSequenceService(utils.DBE)
-	var model []supplier.OilSupplier
+
+	var entitycert suppliercert.OilSupplierCert
 	var entity supplier.OilSupplier
 	//where := "Id = " + Id
-	codecSvc.GetEntities(&model, "")
+	//codecSvc.GetEntities(&model, "")
 	seqStr := ""
 	cols := []string{}
 	if (typeCode == "01") {  // 物质
-		seqStr = codecSvc.GetWZAccessCardNo(this.User.AccCode)
-		if model != nil {
-			for i := 0; i < len(model); i++ {
-				if seqStr == model[i].WZAccessCardNo {
-					seqStr = codecSvc.GetWZAccessCardNo(this.User.AccCode)
-					i = 0
-				}
-			}
+		has := true
+		for has {
+			seqStr = codecSvc.GetWZAccessCardNo(this.User.AccCode)
+			where := "SupplierTypeCode='" + typeCode + "' and AccessCardNo='" + seqStr + "'"
+			has = codecSvc.GetEntity(&entitycert, where)
 		}
-		entity.WZAccessCardNo = seqStr
-		cols = []string{"WZAccessCardNo"}
 	} else if typeCode == "03" { //技术服务
-		seqStr = codecSvc.GetJFAccessCardNo(this.User.AccCode)
-		if model != nil {
-			for i := 0; i < len(model); i++ {
-				if seqStr == model[i].JFAccessCardNo {
-					seqStr = codecSvc.GetJFAccessCardNo(this.User.AccCode)
-					i = 0
-				}
-			}
+		has := true
+		for has {
+			seqStr = codecSvc.GetJFAccessCardNo(this.User.AccCode)
+			where := "SupplierTypeCode='" + typeCode + "' and AccessCardNo='" + seqStr + "'"
+			has = codecSvc.GetEntity(&entitycert, where)
 		}
-		entity.JFAccessCardNo = seqStr
-		cols = []string{"JFAccessCardNo"}
 	} else if typeCode == "02" { // 基建
-		seqStr = codecSvc.GetJSAccessCardNo(this.User.AccCode)
-		if model != nil {
-			for i := 0; i < len(model); i++ {
-				if seqStr == model[i].JSAccessCardNo {
-					seqStr = codecSvc.GetJSAccessCardNo(this.User.AccCode)
-					i = 0
-				}
-			}
+		has := true
+		for has {
+			seqStr = codecSvc.GetJSAccessCardNo(this.User.AccCode)
+			where := "SupplierTypeCode='" + typeCode + "' and AccessCardNo='" + seqStr + "'"
+			has = codecSvc.GetEntity(&entitycert, where)
 		}
-		entity.JSAccessCardNo = seqStr
-		cols = []string{"JSAccessCardNo"}
 	}
 	codecSvc.UpdateEntityByIdCols(Id, &entity, cols)
 	var cert suppliercert.OilSupplierCert

+ 1 - 1
src/dashoo.cn/frontend_web/src/components/oilsupplier/goodsinfo.vue

@@ -36,7 +36,7 @@
         <el-col :span="8" v-if="this.formData.Status == '7'||this.formData.Status == '8'||appendStatus">
           <el-form-item label="准入编码">
             <el-input v-model="formData.AccessCardNo"
-              :readonly="this.formData.Status != '7'||this.formData.Status != '8'||appendStatus" placeholder="请输入"
+              :readonly="this.formData.Status != '7'" placeholder="请输入"
               style="width: 100%">
             </el-input>
           </el-form-item>

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

@@ -482,7 +482,7 @@
     methods: {
       saveAccessCardNo () {
         console.log(this.formData, 'this.formData.WZAccessCardNo')
-        apiCert.saveAccessCardNo(this.formData.Id, this.formData.CertId, this.formData.WZAccessCardNo, '01', this.$axios).then(res => {
+        apiCert.saveAccessCardNo(this.formData.Id, this.formData.CertId, this.formData.AccessCardNo, '01', this.$axios).then(res => {
           console.log(res.data, 'res.data')
           if (res.data.code === 0) {
             this.$message({
@@ -500,6 +500,7 @@
       createWZAccessCardNo () {
         apiCert.createAccessCardNo(this.formData.Id, this.formData.CertId, '01', this.$axios).then(res => {
           this.formData.WZAccessCardNo = res.data
+          this.initDatas()
         })
       },
       confirm () {