zxz hace 2 años
padre
commit
62054331b6
Se han modificado 1 ficheros con 41 adiciones y 37 borrados
  1. 41 37
      src/views/houseSelfCollect/newWeighingManagement.vue

+ 41 - 37
src/views/houseSelfCollect/newWeighingManagement.vue

@@ -1776,12 +1776,19 @@ export default {
                   })
               } else { //收购入库
                 //毛检保存前进行校验
-                // if (this.purchasePriceList) {
-                for (let i = 0; i < this.purchasePriceList.length; i++) {
-                  if (
-                    this.weighingList.goodsName ==
-                    this.purchasePriceList[i].goodsName
-                  ) {
+                var arr = {}
+                // if (this.purchasePriceList.length != 0) {
+                  for (let i = 0; i < this.purchasePriceList.length; i++) {
+                    if (
+                      this.weighingList.goodsName ==
+                      this.purchasePriceList[i].goodsName
+                    ) {
+                      arr = JSON.parse(JSON.stringify(this.purchasePriceList[i]))
+                      arr.saleLimit = this.purchasePriceList[i].saleLimit
+                    }
+                  }
+                  // console.log('1111111',arr)
+                  if (Object.keys(arr).length != 0) {
                     getamount({
                       compId: localStorage.getItem('ws-pf_compId'),
                       customerNumberCard: this.weighingList.customerNumberCard,
@@ -1791,7 +1798,7 @@ export default {
                       .then((response) => {
                         //累计售粮超上限不能完成毛检保存
                         let count = (
-                          this.purchasePriceList[i].saleLimit -
+                          arr.saleLimit -
                           response / 1000
                         ).toFixed(2)
                         if (count - this.weighingList.grossWeight / 1000 < 0) {
@@ -1827,20 +1834,18 @@ export default {
                             })
                         }
                       })
-                    break
+                    return
                   }
                   else {
-                    // this.$message({
-                    //   message: this.weighingList.goodsName + '的收购价格正在审核中,请审核通过后进行操作',
-                    //   type: 'warning',
-                    // })
-                    // return
                     this.$alert(this.weighingList.goodsName + '的收购价格正在审核中,请审核通过后进行操作', {
                       confirmButtonText: '确定',
                     })
-
                   }
-                }
+                // }
+                // else {
+                //   this.$message.error('该仓库未设置收购价格或收购价格正在审核中,请审核通过后进行操作')
+                //   return
+                // }
                 //累计售粮没有超上限完成毛检保存
                 // this.weighingList.relationId = this.relationId;
                 // grossWeight(this.weighingList)
@@ -1905,34 +1910,33 @@ export default {
                   })
               } else { //收购入库
                 for (let i = 0; i < this.purchasePriceList.length; i++) {
+                  var arr1 = {}
                   if (
                     this.weighingList.goodsName ==
                     this.purchasePriceList[i].goodsName
                   ) {
-                    grossWeight(this.weighingList)
-                      .toPromise()
-                      .then((response) => {
-                        if (this.reader) {
-                          this.reader.cancel()
-                        }
-                        this.$notify.success({
-                          title: '成功',
-                          message: '保存成功',
-                        })
-                        this.getList()
-                      })
-                    break
+                    arr1 = JSON.parse(JSON.stringify(this.purchasePriceList[i]))
                   }
-                  else {
-                    // this.$message({
-                    //   message: this.weighingList.goodsName + '的收购价格正在审核中,请审核通过后进行操作',
-                    //   type: 'warning',
-                    // })
-                    // return
-                    this.$alert(this.weighingList.goodsName + '的收购价格正在审核中,请审核通过后进行操作', {
-                      confirmButtonText: '确定',
+                }
+                if (Object.keys(arr1).length != 0) {
+                  grossWeight(this.weighingList)
+                    .toPromise()
+                    .then((response) => {
+                      if (this.reader) {
+                        this.reader.cancel()
+                      }
+                      this.$notify.success({
+                        title: '成功',
+                        message: '保存成功',
+                      })
+                      this.getList()
                     })
-                  }
+                  return
+                }
+                else {
+                  this.$alert(this.weighingList.goodsName + '的收购价格正在审核中,请审核通过后进行操作', {
+                    confirmButtonText: '确定',
+                  })
                 }
               }
               // grossWeight(this.weighingList)