Explorar o código

fix:5279【销售订单-发货单】发货单列表返回销售订单的订单类型;新增发货单也显示订单类型,5278【入库管理】新增操作,填写信息后点击入库操作,提示入库来源收货单号不能为空,手动入库的不需要此限制

mlchen hai 3 días
pai
achega
df249a58a6

+ 45 - 4
src/BIZComponents/inventoryTableDetails.vue

@@ -149,6 +149,11 @@
         type: Boolean,
         default: false
       },
+      // 是否同时显示库存数量和可用数量
+      showStockCount: {
+        type: Boolean,
+        default: false
+      },
       //是否显示订单编码
       isOrderNo: {
         type: Boolean,
@@ -378,12 +383,20 @@
             isNone: this.quoteType === 2,
           },
           {
-            width: 160,
-            prop: 'availableCountBase',
+            width: 120,
+            prop: 'stockCountBase',
             label: '库存数量',
             showOverflowTooltip: true,
             align: 'center',
-            isNone: this.quoteType === 2,
+            isNone: this.quoteType === 2 || !this.showStockCount
+          },
+          {
+            width: 120,
+            prop: 'availableCountBase',
+            label: this.showStockCount ? '可用数量' : '库存数量',
+            showOverflowTooltip: true,
+            align: 'center',
+            isNone: this.quoteType === 2
           },
           {
             width: 200,
@@ -923,6 +936,25 @@
           .add(addDay, dateType)
           .format('YYYY-MM-DD');
       },
+      // 兼容未返回 stockCountBase 的旧库存接口
+      getStockCount(item) {
+        if (item.stockCountBase !== undefined && item.stockCountBase !== null) {
+          return Number(item.stockCountBase);
+        }
+        if (
+          item.measureQuantity !== undefined &&
+          item.measureQuantity !== null
+        ) {
+          return Number(item.measureQuantity);
+        }
+        return Number(item.availableCountBase || 0);
+      },
+      // 可用数量统一按库存余额扣减锁库数量计算
+      getAvailableStockCount(item) {
+        const availableCount =
+          this.getStockCount(item) - Number(item.lockQuantity || 0);
+        return Number(availableCount.toFixed(4));
+      },
       //修改回显
       async putTableValue(data) {
         let productList =
@@ -956,10 +988,19 @@
                                     (key) => (key.code + ',' + key.batchNo == item.productCode+','+item.batchNo)
                                   ) || {};
                 this.form.datasource;
+                if (this.showStockCount) {
+                  this.$set(
+                    this.form.datasource[index],
+                    'stockCountBase',
+                    this.getStockCount(find)
+                  );
+                }
                 this.$set(
                   this.form.datasource[index],
                   'availableCountBase',
-                  find.availableCountBase
+                  this.showStockCount
+                    ? this.getAvailableStockCount(find)
+                    : find.availableCountBase
                 );
               });
           }

+ 5 - 2
src/api/afterSales/index.js

@@ -30,7 +30,10 @@ export async function getWarehouseOutStock(params) {
     params
   });
   if (res.data.code == 0) {
-    return res.data.data;
+    const data = res.data.data;
+    return data && typeof data === 'object'
+      ? data.availableCountBase || 0
+      : data;
   }
   return Promise.reject(new Error(res.data.message));
 }
@@ -62,4 +65,4 @@ export async function contactDetail(id) {
     return res.data.data;
   }
   return Promise.reject(new Error(res.data.message));
-}
+}

+ 5 - 2
src/api/bpm/components/saleManage/saleorder.js

@@ -30,7 +30,10 @@ export async function getWarehouseOutStock(params) {
     params
   });
   if (res.data.code == 0) {
-    return res.data.data;
+    const data = res.data.data;
+    return data && typeof data === 'object'
+      ? data.availableCountBase || 0
+      : data;
   }
   return Promise.reject(new Error(res.data.message));
 }
@@ -456,4 +459,4 @@ export async function getPunchSlipOrderInfo(id) {
     return res.data.data;
   }
   return Promise.reject(new Error(res.data.message));
-}
+}

+ 1 - 0
src/views/bpm/handleTask/components/saleOrder/detailDialog.vue

@@ -248,6 +248,7 @@
         :isProductionRequirements="true"
         :isIncreaseTotalWeight="true"
         :isWms="true"
+        :showStockCount="true"
       ></inventoryTabledetail>
       <headerTitle title="类型清单" v-if="form.needProduce == 4"></headerTitle>