Просмотр исходного кода

fix(发货单): 修复库存数量和批次号处理逻辑

liujt 7 месяцев назад
Родитель
Сommit
a60847dd3c

+ 6 - 0
src/views/saleManage/saleOrder/invoice/components/addInvoiceDialog.vue

@@ -982,6 +982,12 @@ import {
             ) {
               item['isReplace'] = 1;
             }
+
+            if(item.isSuspend == 1) {
+              item['reverseQuantity'] = item.saleCount;
+            } else {
+              item['reverseQuantity'] = 0;
+            }
           });
 
           let commitData = Object.assign({}, this.form, {

+ 28 - 5
src/views/saleManage/saleOrder/invoice/components/inventoryTable.vue

@@ -1524,7 +1524,7 @@
                 this.$set(
                   this.form.datasource[index],
                   'warehouseNum',
-                  await getWarehouseOutStock({
+                  item.stockNum ? item.stockNum : await getWarehouseOutStock({
                     warehouseId: item.warehouseId,
                     code: item.productCode
                   })
@@ -1578,7 +1578,7 @@
               this.$set(
                 this.form.datasource[index],
                 'warehouseNum',
-                await getWarehouseOutStock({
+                item.stockNum ? item.stockNum : await getWarehouseOutStock({
                   warehouseId: item.warehouseId,
                   code: item.productCode
                 })
@@ -1615,7 +1615,7 @@
               this.$set(
                 this.form.datasource[index],
                 'warehouseNum',
-                batchNoObj.measureQuantity || 0
+                item.stockNum ? item.stockNum : batchNoObj.measureQuantity || 0
               );
             } else { //不存在
               // 批次列表添加不存在的批次号对象
@@ -1633,7 +1633,7 @@
               this.$set(
                 this.form.datasource[index],
                 'warehouseNum',
-                ''
+                item.stockNum ? item.stockNum : ''
               );
             }
 
@@ -1643,6 +1643,29 @@
               'batchNoList',
               tempBatchNoList
             );
+          } else {
+            if(item.batchNo) {
+              const tempBatchNoList = [{
+                batchNo: item.batchNo,
+                id: 999,
+                measureQuantity: 0
+              }]
+              this.$set(
+                this.form.datasource[index],
+                'batchNoList',
+                tempBatchNoList
+              );
+              this.$set(
+                this.form.datasource[index],
+                'batchStockId',
+                999
+              );
+              this.$set(
+                this.form.datasource[index],
+                'warehouseNum',
+                item.stockNum ? item.stockNum : ''
+              );
+            }
           }
       },
       async setBatchAndWarehouse1(item, index) {
@@ -1966,7 +1989,7 @@
             //   });
             // }
 
-            if (this.isBatchNumberInvalid(item)) {
+            if (this.isBatchNumberInvalid(item) && item.isSuspend != 1) {
               // 获取当前批次号和正确的库存批次号信息
               const currentBatchNumber = item.batchNo || '未填写';
               // const availableBatches = item.availableBatchNumbers || item.validBatchNumbers || [];