瀏覽代碼

前后:履行金额问题

dubch 4 年之前
父節點
當前提交
59f9d9a7e3

+ 14 - 0
src/dashoo.cn/backend/api/controllers/oilcontract/contract.go

@@ -1528,6 +1528,7 @@ func (this *OilContractController) UpdateEntity() {
 	var model contract.OilContract
 	var model1 contract.OilContractMoney
 	var model2 contract.OilContractMoney
+	var model3 contract.OilContractMoney
 	svc := contract.GetOilContractService(utils.DBE)
 
 	var jsonBlob = this.Ctx.Input.RequestBody
@@ -1691,6 +1692,19 @@ func (this *OilContractController) UpdateEntity() {
 		this.ServeJSON()
 		return
 	}
+
+	svc.GetSum1(&model3, "ContractId = "+id+" and Year != '"+model2.Year+"'")
+	amount,_ := strconv.ParseFloat(model.Amount,64)
+	yearMoney,_ := strconv.ParseFloat(model.IsYearMoney,64)
+	money,_ := strconv.ParseFloat(model3.Money,64)
+	if model.IsYear == 1 && yearMoney > amount - money {
+		errinfo.Message = "总结算金额不能大于合同总金额!"
+		errinfo.Code = -1
+		this.Data["json"] = &errinfo
+		this.ServeJSON()
+		return
+	}
+
 	date := time.Now().Format("2006-01-02")
 	date1 := model.EndDate.Format("2006-01-02")
 	if date >= date1 && model.IsYear == 1 {

+ 16 - 16
src/dashoo.cn/frontend_web/src/pages/oilcontract/contract-import/_opera/operation.vue

@@ -874,7 +874,7 @@ export default {
     let myDate = new Date()
     if (this.serviceId != 'add' && this.serviceId > 0) {
       this.formData.Id = this.serviceId
-      this.countMoney(this.formData.Id)
+      // this.countMoney(this.formData.Id)
       this.yearList(this.formData.Id)
       this.initDatas()
       this.successBoolean = true
@@ -895,14 +895,14 @@ export default {
         this.yearTable = res.data
       })
     },
-    countMoney (id) {
-      api.countMoney(id, this.$axios).then(res => {
-        if (res.data.Money !== '') {
-          this.Money = parseFloat(res.data.Money)
-        }
-        console.log(this.Money, 'this.Money')
-      })
-    },
+    // countMoney (id) {
+    //   api.countMoney(id, this.$axios).then(res => {
+    //     if (res.data.Money !== '') {
+    //       this.Money = parseFloat(res.data.Money)
+    //     }
+    //     console.log(this.Money, 'this.Money')
+    //   })
+    // },
     dateChange () {
       if (this.formData.StartDate && this.formData.ContractPeriod) {
         var d = new Date(this.formData.StartDate)
@@ -1082,13 +1082,13 @@ export default {
             })
             return false
           }
-          if (parseFloat(this.formData.IsYearMoney) > (parseFloat(this.formData.Amount) - this.Money)) {
-            this.$message({
-              type: 'warning',
-              message: '总结算金额不能大于合同总金额'
-            })
-            return false
-          }
+          // if (parseFloat(this.formData.IsYearMoney) > (parseFloat(this.formData.Amount) - this.Money)) {
+          //   this.$message({
+          //     type: 'warning',
+          //     message: '总结算金额不能大于合同总金额'
+          //   })
+          //   return false
+          // }
           if (parseFloat(this.formData.PerformAmount) > parseFloat(this.formData.Amount)) {
             this.$message({
               type: 'warning',