소스 검색

fix:5334【出库管理】商品的计量数量对不上,新数据有新数据问题;

mlchen 1 일 전
부모
커밋
4a83d99cdb
2개의 변경된 파일71개의 추가작업 그리고 19개의 파일을 삭제
  1. 13 8
      src/views/warehouseManagement/components/AssetsDialog.vue
  2. 58 11
      src/views/warehouseManagement/stocktaking/plan/components/selectType.vue

+ 13 - 8
src/views/warehouseManagement/components/AssetsDialog.vue

@@ -532,7 +532,9 @@
             prop: 'measureQuantity',
             label: '计量数量',
             align: 'center',
-            showOverflowTooltip: true
+            showOverflowTooltip: true,
+            formatter: (row) =>
+              this.dimension == 2 ? row.stockCountBase : row.measureQuantity
           },
           {
             prop: 'measureUnit',
@@ -687,11 +689,13 @@
           // 批次维度
           const data = await storageApi.getBatchList(this.searchForm);
           for (let i = 0; i < data.list.length; i++) {
-            const measure = Number(item.measureQuantity) || 0;
+            const item = data.list[i];
+            // 入库计量数量不会随出库变化,可用数量必须使用当前批次库存余额计算
+            const inventoryBalance = Number(item.availableCountBase) || 0;
             const lock = Number(item.lockQuantity) || 0;
-            const result = (measure * 100 - lock * 100) / 100;
-            data.list[i].availableQuantity = Math.round(result * 100) / 100;
-            data.list[i].outboundNum = data.list[i].availableQuantity;
+            const result = (inventoryBalance * 100 - lock * 100) / 100;
+            item.availableQuantity = Math.round(result * 100) / 100;
+            item.outboundNum = item.availableQuantity;
           }
           this.tableData = data.list;
           this.total = data.count;
@@ -944,10 +948,11 @@
             size: limit
           });
           data.list.forEach((item) => {
-            const measure = Number(item.measureQuantity) || 0;
+            // 入库计量数量不会随出库变化,可用数量必须使用当前批次库存余额计算
+            const inventoryBalance = Number(item.availableCountBase) || 0;
             const lock = Number(item.lockQuantity) || 0;
-            const result = (measure * 100 - lock * 100) / 100;
-            
+            const result = (inventoryBalance * 100 - lock * 100) / 100;
+
             item.availableQuantity = Math.round(result * 100) / 100;
             item.outboundNum = item.availableQuantity;
           });

+ 58 - 11
src/views/warehouseManagement/stocktaking/plan/components/selectType.vue

@@ -29,17 +29,13 @@
               </el-form-item>
             </el-form>
           </el-col> -->
-          <el-col :span="8">
-            <el-input v-model="value" placeholder="搜索物品编码、名称、规格等">
-              <el-button
-                slot="append"
-                type="primary"
-                icon="el-icon-search"
-                size="small"
-                @click="handleSearch"
-                >搜索</el-button
-              >
-            </el-input>
+          <el-col :span="dimension == 2 ? 4 : 8">
+            <el-input
+              v-model="value"
+              clearable
+              placeholder="搜索物品编码、名称、规格等"
+              @keyup.enter.native="handleSearch"
+            ></el-input>
           </el-col>
           <el-col v-if="dimension == 2" :span="4">
             <el-input
@@ -73,6 +69,23 @@
               @keyup.enter.native="handleSearch"
             ></el-input>
           </el-col>
+          <el-col :span="4">
+            <div class="search-actions">
+              <el-button
+                type="primary"
+                icon="el-icon-search"
+                size="small"
+                @click="handleSearch"
+                >搜索</el-button
+              >
+              <el-button
+                icon="el-icon-refresh-left"
+                size="small"
+                @click="handleReset"
+                >重置</el-button
+              >
+            </div>
+          </el-col>
         </el-row>
       </div>
       <div class="flex_info">
@@ -147,9 +160,21 @@
               :prop="item.prop"
               :show-overflow-tooltip="item.showOverflowTooltip"
             ></el-table-column>
+            <el-table-column
+              prop="lockQuantity"
+              label="锁库数量"
+              :show-overflow-tooltip="true"
+            ></el-table-column>
+            <el-table-column
+              prop="availableQuantity"
+              label="可用数量"
+              :formatter="formatAvailableQuantity"
+              :show-overflow-tooltip="true"
+            ></el-table-column>
             <el-table-column
               prop="measureQuantity"
               label="计量数量"
+              :formatter="formatMeasureQuantity"
               :show-overflow-tooltip="true"
             ></el-table-column>
             <el-table-column
@@ -294,6 +319,16 @@
       this.getFieldModel();
     },
     methods: {
+      formatAvailableQuantity(row) {
+        // 入库计量数量不会随出库变化,可用数量必须使用当前批次库存余额计算
+        const inventoryBalance = Number(row.availableCountBase) || 0;
+        const lock = Number(row.lockQuantity) || 0;
+        const result = (inventoryBalance * 100 - lock * 100) / 100;
+        return Math.round(result * 100) / 100;
+      },
+      formatMeasureQuantity(row) {
+        return row.stockCountBase;
+      },
       selectable(row) {
         return !this.selectionIds.includes(row.categoryId);
       },
@@ -321,7 +356,13 @@
         this.pages.pageNum = 1;
         this.initData();
       },
+      handleReset() {
+        this.resetSearchFields();
+        this.pages.pageNum = 1;
+        this.initData();
+      },
       resetSearchFields() {
+        this.value = '';
         this.batchNo = '';
         this.colorKey = '';
         this.modelKey = '';
@@ -421,6 +462,12 @@
   .search_box {
     overflow: hidden;
   }
+  .search-actions {
+    display: flex;
+    min-height: 40px;
+    align-items: center;
+    justify-content: flex-end;
+  }
   .select-btn {
     text-align: right;
   }