lilei 4 maanden geleden
bovenliggende
commit
49a5de4e06

+ 2 - 0
src/views/salesManagement/waitDispatchNew/edit.vue

@@ -111,10 +111,12 @@ export default {
     },
     // 更新轮胎库存类型
     updateStockType (val) {
+      this.spinning = true
       dispatchUpdateStockType({ stockType: val, dispatchBillSn: this.productForm.dispatchBillSn }).then(res => {
         if (res.status != 200) {
           this.$refs.partQuery.stockType = val == 'LOCK_STOCK' ? 'CURRENT_STOCK' : 'LOCK_STOCK'
         }
+        this.spinning = false
       })
     },
     // 添加产品

+ 18 - 13
src/views/salesManagement/waitDispatchNew/queryPart.vue

@@ -686,13 +686,16 @@ export default {
     },
     // 添加
     handleAdd (row) {
-      if (row && row.productEntity && row.productEntity.productBrandName == '箭冠' && row.productEntity.productTypeName3 == '轮胎') {
+      const isLt = row && row.productEntity && row.productEntity.productBrandName == '箭冠' && row.productEntity.productTypeName3 == '轮胎'
+      // 如果库存类型是锁定库存 且 轮胎产品
+      if (this.stockType && this.stockType == 'LOCK_STOCK' && isLt) {
         if (!row.lockStockQty) {
           this.$message.warning('锁定库存为0,不可添加!')
         } else {
           this.$emit('addProduct', [row.salesBillDetailSn])
         }
       } else {
+        // 库存类型可用库存或非轮胎产品
         if (row.stockQty > 0) { //  可用库存大于0才可添加
           this.$emit('addProduct', [row.salesBillDetailSn])
         } else {
@@ -746,11 +749,18 @@ export default {
         _this.$message.warning('请先选择产品!')
         return
       }
-
-      // 库存为0的产品,不包括箭冠轮胎产品
-      const noStockRow = this.dataSource.filter(item => chooseList.includes(item.id) && !item.stockQty && item.productEntity && item.productEntity.productBrandName != '箭冠' && item.productEntity.productTypeName3 != '轮胎')
-      // 锁定库存为0的产品,只判断箭冠轮胎产品
-      const noLockStockRow = this.dataSource.filter(item => chooseList.includes(item.id) && item.productEntity && item.productEntity.productBrandName == '箭冠' && item.productEntity.productTypeName3 == '轮胎' && !item.lockStockQty)
+      let noStockRow = []
+      let noLockStockRow = []
+      // 库存类型是 锁定库存
+      if (this.stockType && this.stockType == 'LOCK_STOCK') {
+        // 库存为0的产品,不包括箭冠轮胎产品
+        noStockRow = this.dataSource.filter(item => chooseList.includes(item.id) && !item.stockQty && item.productEntity && item.productEntity.productBrandName != '箭冠' && item.productEntity.productTypeName3 != '轮胎')
+        // 锁定库存为0的产品,只判断箭冠轮胎产品
+        noLockStockRow = this.dataSource.filter(item => chooseList.includes(item.id) && item.productEntity && item.productEntity.productBrandName == '箭冠' && item.productEntity.productTypeName3 == '轮胎' && !item.lockStockQty)
+      } else {
+        // 库存类型是 可用库存
+        noStockRow = this.dataSource.filter(item => chooseList.includes(item.id) && !item.stockQty)
+      }
 
       // 库存为0产品编码列表
       const noObj = []
@@ -768,14 +778,9 @@ export default {
       })
 
       // 可添加产品,不包括库存未0和箭冠轮胎锁定库存为0的产品
-      const chooseRow = this.dataSource.filter(item => {
-        return chooseList.includes(item.id) && !noObjSn.includes(item.salesBillDetailSn) && !noLockObjSn.includes(item.salesBillDetailSn)
-      })
+      const chooseRow = this.dataSource.filter(item => chooseList.includes(item.id) && !noObjSn.includes(item.salesBillDetailSn) && !noLockObjSn.includes(item.salesBillDetailSn))
       // 可添加产品sn列表
-      const obj = []
-      chooseRow && chooseRow.map(item => {
-        obj.push(item.salesBillDetailSn)
-      })
+      const obj = chooseRow.map(item => item.salesBillDetailSn)
       if (obj.length) {
         this.$confirm({
           title: '提示',