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

feat(库存管理): 在销售订单详情中增加库存显示功能

liujt 1 месяц назад
Родитель
Сommit
f840a8eb3f

+ 53 - 1
src/BIZComponents/inventoryTableDetails.vue

@@ -97,6 +97,7 @@
   import tableColumnsMixin from '@/mixins/tableColumnsMixin.js';
   import { getSummaries } from '@/utils/util.js';
   import { getAllQuantity } from '@/BIZComponents/setProduct.js';
+  import { getInventoryTotalAPI } from '@/api/bpm/components/wms';
 
   export default {
     mixins: [dictMixins, tableColumnsMixin],
@@ -143,6 +144,11 @@
         type: Boolean,
         default: true
       },
+      //显示库存
+      isWms: {
+        type: Boolean,
+        default: false
+      },
       //是否显示订单编码
       isOrderNo: {
         type: Boolean,
@@ -251,7 +257,7 @@
               return pricingWayList.find((item) => item.id == row.pricingWay)
                 ?.name;
             }
-          }
+          },
         ];
         // 条件显示的新增字段列(仅当quoteType为2时显示)
         const additionalColumns =
@@ -355,6 +361,30 @@
               ]
             : [];
         const remainingColumns = [
+          {
+            width: 280,
+            prop: 'cuttingLength',
+            label: '裁线米段',
+            align: 'center',
+            slot: 'cuttingLength',
+            isNone: this.quoteType === 2,
+          },
+          {
+            width: 120,
+            prop: 'warehouseName',
+            label: '仓库名称',
+            slot: 'warehouseName',
+            align: 'center',
+            isNone: this.quoteType === 2,
+          },
+          {
+            width: 160,
+            prop: 'availableCountBase',
+            label: '库存数量',
+            showOverflowTooltip: true,
+            align: 'center',
+            isNone: this.quoteType === 2,
+          },
           {
             width: 200,
             prop: 'customerMark',
@@ -904,6 +934,28 @@
           }
           // this.setDeliveryDays();
 
+          if (this.isWms) {
+            let codeList = this.form.datasource
+            .filter((item) => item.productCode)
+            .map((item) => item.batchNo ? [item.productCode, item.batchNo].join(',') : item.productCode);
+            //获取仓库库存
+            let inventoryTotalList = await getInventoryTotalAPI(codeList);
+            this.form.datasource
+              .filter((item) => item.productCode)
+              .forEach((item, index) => {
+                let find =
+                  inventoryTotalList.find(
+                                    (key) => (key.code + ',' + key.batchNo == item.productCode+','+item.batchNo)
+                                  ) || {};
+                this.form.datasource;
+                this.$set(
+                  this.form.datasource[index],
+                  'availableCountBase',
+                  find.availableCountBase
+                );
+              });
+          }
+
           this.supplierObj = await this.getSupplierObj(
             productList,
             'productId'

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

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