Sfoglia il codice sorgente

feat: 增加采购数量和库存式数量填写

liujt 1 mese fa
parent
commit
a1cab16c2b

+ 19 - 5
src/BIZComponents/inventoryTable.vue

@@ -509,7 +509,8 @@
           :rules="{
             required: false,
             pattern: numberReg,
-            trigger: 'change'
+            trigger: 'change',
+            message: '请输入正确的重量'
           }"
           :prop="'datasource.' + scope.$index + '.totalWeight'"
         >
@@ -999,6 +1000,7 @@
       ref="selectStockLedgerDialogRef"
       @changeParent="replaceTable"
       :isSupplier="isSupplier"
+      :showSaleCount="showSaleCount"
     ></selectStockLedgerDialog>
     <commodityPriceListDialog
       ref="commodityPriceListDialogRef"
@@ -1193,9 +1195,15 @@
         type: Boolean,
         default: false
       },
+      // 是否显示排序字段
       showSortLine: {
         type: Boolean,
         default: false
+      },
+      // 是否显示库存式订单可填订单数量
+      showSaleCount: {
+        type: Boolean,
+        default: false
       }
     },
     data() {
@@ -2478,14 +2486,15 @@
         });
         this.changeCount();
       },
-      replaceTable(obj, idx) {
-        obj.forEach(async (item, index) => {
+      async replaceTable(obj, idx) {
+        for (let index = 0; index < obj.length; index++) {
+          const item = obj[index];
           let i = idx == -1 ? index : idx;
           let row = JSON.parse(JSON.stringify(this.defaultForm));
           row.key = this.form.datasource.length + 1;
           let parasm = idx == -1 ? row : this.form.datasource[i];
           this.$set(parasm, 'customerMark', this.customerMark);
-
+          this.$set(parasm, 'saleCount', item.saleCount);
           this.$set(parasm, 'productId', item.productId);
           this.$set(parasm, 'categoryName', item.productName);
           this.$set(parasm, 'productCategoryId', item.categoryLevelId);
@@ -2583,7 +2592,11 @@
           if (idx == -1) {
             this.form.datasource.push(row);
           }
-        });
+        }
+        // console.log(this.form.datasource);
+        if(this.showSaleCount){
+          this.changeCount();
+        }
       },
       remove(index) {
         this.form.datasource.splice(index, 1);
@@ -2629,6 +2642,7 @@
       validateForm(callback) {
         this.$refs.form.validate((valid, obj) => {
           if (obj) {
+            console.log('validateForm', obj);
             let messages = Object.keys(obj).map((key) => obj[key][0]);
             if (messages.length > 0) {
               this.$message.warning(messages[0].message);

+ 27 - 2
src/BIZComponents/product-list.vue

@@ -149,6 +149,15 @@
                 <i></i>
               </el-radio>
             </template>
+            <template v-slot:saleCount="{ row }">
+              <el-input
+                v-model="row.saleCount"
+                style="width: 100%"
+                placeholder="请输入"
+                type="number"
+                :min="0"
+              ></el-input>
+            </template>
             <template v-slot:cz="{ row }">
               <el-button type="text" @click="handleDoubleClick(row)"
                 >选择PBom</el-button
@@ -246,7 +255,12 @@
       itemType: {
         type: String,
         default: '1'
-      }
+      },
+      // 是否需要显示可填采购数量的输入框
+      showSaleCount: {
+        type: Boolean,
+        default: false
+      },
     },
 
     data() {
@@ -303,7 +317,7 @@
           };
         }
 
-        return [
+        const tempData = [
           data,
           {
             columnKey: 'index',
@@ -327,6 +341,15 @@
             showOverflowTooltip: true,
             minWidth: 110
           },
+          {
+            prop: 'saleCount',
+            slot: 'saleCount',
+            label: '订单数量',
+            showOverflowTooltip: true,
+            align: 'center',
+            minWidth: 120,
+            hide: !this.showSaleCount
+          },
           {
             prop: 'imgCode',
             align: 'center',
@@ -500,6 +523,8 @@
             show: this.isShowCBom
           }
         ];
+
+        return tempData.filter((item) => !item.hide);
       }
     },
     created() {

+ 52 - 1
src/BIZComponents/selectStockLedger/selectStockLedgerDialog.vue

@@ -53,6 +53,15 @@
             :cache-key="cacheKeyUrl"
             @columns-change="handleColumnChange"
           >
+            <template v-slot:saleCount="{ row }">
+              <el-input
+                v-model="row.saleCount"
+                style="width: 100%"
+                placeholder="请输入"
+                type="number"
+                :min="0"
+              ></el-input>
+            </template>
             <template v-slot:action="{ row }">
               <el-radio class="radio" v-model="radio" :label="row.id"
                 ><i></i
@@ -94,6 +103,11 @@
       isSupplier: {
         type: Boolean,
         default: false
+      },
+      /*是否显示销售数量*/
+      showSaleCount: {
+        type: Boolean,
+        default: false
       }
     },
 
@@ -141,7 +155,8 @@
             reserveSelection: true
           };
         }
-        return [
+
+        const tempData = [
           data,
 
           {
@@ -212,6 +227,15 @@
             align: 'center',
             minWidth: 90
           },
+          {
+            prop: 'saleCount',
+            slot: 'saleCount',
+            label: '订单数量',
+            showOverflowTooltip: true,
+            align: 'center',
+            minWidth: 120,
+            hide: !this.showSaleCount
+          },
           {
             prop: 'measureQuantity',
             label: '库存',
@@ -219,6 +243,28 @@
             align: 'center',
             minWidth: 90
           },
+          {
+            prop: 'lockQuantity',
+            label: '锁库数量',
+            showOverflowTooltip: true,
+            align: 'center',
+            minWidth: 90
+          },
+          {
+            prop: 'useQuantity',
+            label: '可用数量',
+            showOverflowTooltip: true,
+            align: 'center',
+            minWidth: 90,
+            formatter: (row) => {
+              // 使用toFixed处理浮点数精度问题,保留4位小数
+              const measureQuantity = parseFloat(row.measureQuantity) || 0;
+              const lockQuantity = parseFloat(row.lockQuantity) || 0;
+              const available = measureQuantity - lockQuantity;
+              // 使用toFixed避免精度丢失,然后去除末尾多余的0
+              return available.toFixed(4).replace(/\.?0+$/, '');
+            }
+          },
           {
             prop: 'measureUnit',
             label: '单位',
@@ -247,6 +293,7 @@
             showOverflowTooltip: true
           }
         ];
+        return tempData.filter((item) => !item.hide);
       }
     },
     methods: {
@@ -255,6 +302,7 @@
         return this.dictList[code].find((item) => item.value == val)?.label;
       },
       open(item, currentIndex) {
+        console.log(item, currentIndex);
         this.currentIndex = currentIndex;
         this.visible = true;
         this.getTreeData();
@@ -377,6 +425,9 @@
           item.productCategoryName = '';
           item.productBrand = item.brandNum;
           item.provenance = item.provenance || [];
+          if(this.showSaleCount){
+            item.saleCount = item.saleCount;
+          }
           item['packageDispositionList'] = packingSpecification
             .filter(
               (ite) => item.categoryId == ite.categoryId && ite.conversionUnit

+ 1 - 0
src/views/purchasingManage/purchaseOrder/components/addDialogNew.vue

@@ -514,6 +514,7 @@
               !!form.contractId && !OutValidate.includes(form.sourceType)
             "
             :isBatchNo="isBatchNo == 1"
+            :showSaleCount="true"
             @getProductData="getSupplierData"
           >
           </inventoryTable>

+ 9 - 0
src/views/purchasingManage/purchaseOrder/components/inventoryTableNew.vue

@@ -625,6 +625,7 @@
       ref="productListRef"
       classType="1"
       :isGetInventoryTotal="true"
+      :showSaleCount="showSaleCount"
       @changeParent="changeParent"
     ></product-list>
     <head-list ref="headRef" @changeParent="changeAnswer"></head-list>
@@ -679,6 +680,10 @@
       isBatchNo: {
         type: Boolean,
         default: false
+      },
+      showSaleCount: {
+        type: Boolean,
+        default: false
       }
     },
     components: {
@@ -1553,6 +1558,9 @@
           this.$set(parasm, 'goodsLevel', item.level);
           this.$set(parasm, 'taxRate', 13);
           this.$set(parasm, 'totalCount', 0);
+          if(this.showSaleCount) {
+            this.$set(parasm, 'purchaseCount', item.saleCount);
+          }
           if (item.modelKey) {
             this.$set(parasm, 'modelKey', item.modelKey.split(','));
           }
@@ -1603,6 +1611,7 @@
         // 只有当idx == -1时才emit数据给父组件
         if (idx == -1) {
           this.$emit('getProductData', this.form.datasource);
+          this.changeCount();
         }
       },
       remove(row, index) {

+ 1 - 0
src/views/saleManage/saleOrder/components/addDialogNew.vue

@@ -552,6 +552,7 @@
         :showSummary="true"
         :defTaxRate="13"
         :showSortLine="true"
+        :showSaleCount="form.needProduce == 0"
       ></inventoryTable>
       <headerTitle
         title="类型清单"

+ 11 - 5
src/views/saleManage/saleOrder/invoice/components/detailDialog.vue

@@ -187,11 +187,7 @@
     data() {
       return {
         activeComp: 'main',
-        tabOptions: [
-          { key: 'main', name: '发货单详情' },
-          { key: 'bpm', name: '流程详情' },
-          { key: 'store', name: '出库单详情' }
-        ],
+        
         fullscreen: false,
         reviewStatusEnum,
         visible: false,
@@ -246,7 +242,17 @@
     computed: {
       clientEnvironmentId() {
         return this.$store.state.user.info.clientEnvironmentId;
+      },
+      tabOptions() {
+        return this.detailData.isSplitFlag == 1 ? [
+          { key: 'main', name: '发货单详情' },
+        ] : [
+          { key: 'main', name: '发货单详情' },
+          { key: 'bpm', name: '流程详情' },
+          { key: 'store', name: '出库单详情' }
+        ]
       }
+
     },
     methods: {
       async open(row) {