1
heshaofeng
2025-11-09 f747c5151051c12a1c44eaf5ef49f0a3805702b0
ÏîÄ¿´úÂë/WIDESEA_WMSClient/src/extension/inbound/extend/Pallet.vue
@@ -49,7 +49,7 @@
                 class="custom-input"
            >
              <template slot="prepend">
                <span> æ–™ç®±æ¡ç </span>
                <span> æ–™ç®±ç </span>
              </template>
              <template slot="append">
                <el-button 
@@ -126,6 +126,8 @@
            <span><i class="el-icon-tickets"></i> ç»„盘数据</span>
            <span class="list-actions">
              <el-tag type="primary">共 {{ materials.length }} æ¡è®°å½•</el-tag>
              <el-tag type="primary">已组盘 {{ totalStockCount }}</el-tag>
              <el-tag type="primary">库存数量 {{ totalStockSum }}<span>{{ uniqueUnit }}</span></el-tag>
              <el-tag v-if="trayBarcode" type="success">托盘: {{ trayBarcode }}</el-tag>
    <!--           <el-button 
                v-if="materials.length > 0"
@@ -197,6 +199,7 @@
import VolTable from '@/components/basic/VolTable.vue';
import { ElLoading, ElMessage,ElMessageBox  } from 'element-plus';
import { ref, onMounted, onUnmounted } from 'vue'
import InboundOrder from '../../../views/inbound/inboundOrder.vue';
export default {
  name: 'BarcodeScanner',
@@ -225,6 +228,13 @@
          scanTimer: null,
          manualInputTimer: null,
          scanTarget: 'tray', // å½“前扫码目标: tray æˆ– material
          // åº“存统计相关变量
          totalStockSum: 0,
          totalStockCount: 0,
          uniqueUnit: '',
          sumLoading: false,
          sumError: ''
    }
  },
  computed: {
@@ -245,6 +255,7 @@
      this.$nextTick(() => {
        setTimeout(() => {
          this.focusTrayInput();
          this.fetchStockStatistics(); // åŠ è½½ç»Ÿè®¡æ•°æ®
        }, 300);
      });
    }
@@ -263,6 +274,7 @@
        this.palletForm = { palletCode: '', barcode: '' };
        this.backData = [];
        this.$refs.palletForm?.reset();
        this.fetchStockStatistics(); // å•据号变了,刷新统计
      }
    }
  },
@@ -283,6 +295,37 @@
         this.clearAllTimers();
      },
      methods: {
        // æ–°å¢žï¼šæŸ¥è¯¢åŽç«¯åº“存统计数据(调用之前的 SumQuantity æŽ¥å£ï¼‰
    async fetchStockStatistics() {
      // å•据号为空时不查询
      if (!this.docNo) {
        this.sumError = '单据号为空,无法统计';
        return;
      }
      this.sumLoading = true;
      this.sumError = '';
      try {
        // è°ƒç”¨åŽç«¯ç»Ÿè®¡æŽ¥å£ï¼ˆæ›¿æ¢ä¸ºä½ çš„实际接口路径)
        const response = await http.post('/api/InboundOrder/UnPalletQuantity?orderNo='+this.docNo, {
        });
        // ç»‘定数据(匹配 PalletSumQuantityDTO ç»“构)
        if (response.data) {
          this.totalStockSum = response.data.stockSumQuantity || 0; // æ€»åº“存数量
          this.totalStockCount = response.data.stockCount || 0;     // æ€»åº“存记录数
          this.uniqueUnit = response.data.uniqueUnit || '';               // è®¡é‡å•位
        }
      } catch (err) {
        this.sumError = '统计加载失败';
        this.totalStockSum = 0;
        this.totalStockCount = 0;
        console.error('库存统计查询异常:', err);
      } finally {
        this.sumLoading = false;
      }
    },
         // é‡ç½®æ‰€æœ‰æ•°æ®
    resetData() {
      console.log('重置弹框数据');
@@ -298,6 +341,10 @@
      this.currentFocus = 'tray';
      this.scanTarget = 'tray';
      this.clearAllTimers();
      this.totalStockSum = 0;
      this.totalStockCount = 0;
      this.sumLoading = false;
      this.sumError = '';
    },
    
    // æ¸…除所有计时器