Преглед на файлове

快捷出库不准确问题

lxf преди 1 година
родител
ревизия
6c11f065a3
променени са 1 файла, в които са добавени 7 реда и са изтрити 15 реда
  1. 7 15
      src/components/shengde/quickDelivery/material.vue

+ 7 - 15
src/components/shengde/quickDelivery/material.vue

@@ -99,30 +99,22 @@ export default {
                 let businessIdTwoList = []
                 for (let i = 0; i < this.form.details.length; i++) {
                   let data = resInventory.data.data.filter((item) => item.businessId === this.form.details[i].businessId)
-                  if (data && data.length > 0) {
-                    if (data[0].quantity) {
-                      this.form.details[i].warehouseId = data[0].warehouseId
-                      this.form.details[i].residueNum = Number(data[0].quantity)
-                    } else {
-                      businessIdTwoList.push(this.form.details[i].businessId)
-                    }
+                  if (data && data.length > 0 && data[0].quantity && Number(data[0].quantity) > 0) {
+                    this.form.details[i].warehouseId = data[0].warehouseId
+                    this.form.details[i].residueNum = Number(data[0].quantity)
                   } else {
                     businessIdTwoList.push(this.form.details[i].businessId)
                   }
                 }
                 if (businessIdTwoList && businessIdTwoList.length > 0) {
-                  inventoryDetails({ businessIdList: businessIdList, subsidiaryId: this.form.subsidiaryId, warehouseId: this.warehouseList[1].id }).then(
+                  inventoryDetails({ businessIdList: businessIdTwoList, subsidiaryId: this.form.subsidiaryId, warehouseId: this.warehouseList[1].id }).then(
                     (inventoryTwo) => {
                       if (inventoryTwo.data.data && inventoryTwo.data.data.length > 0) {
                         for (let j = 0; j < this.form.details.length; j++) {
                           let dataTwo = inventoryTwo.data.data.filter((item) => item.businessId === this.form.details[j].businessId)
-                          if (dataTwo && dataTwo.length > 0) {
-                            if (dataTwo[0].quantity) {
-                              this.form.details[j].warehouseId = dataTwo[0].warehouseId
-                              this.form.details[j].residueNum = Number(dataTwo[0].quantity)
-                            } else {
-                              this.form.details[j].residueNum = 0
-                            }
+                          if (dataTwo && dataTwo.length > 0 && dataTwo[0].quantity && Number(dataTwo[0].quantity) > 0) {
+                            this.form.details[j].warehouseId = dataTwo[0].warehouseId
+                            this.form.details[j].residueNum = Number(dataTwo[0].quantity)
                           }
                         }
                       }