1
huangxiaoqiang
2025-12-17 a605b6e19e1ddeae06f2f5bdc35395daece8a12c
ÏîÄ¿´úÂë/WIDESEA_WMSClient/src/extension/inbound/extend/Pallet.vue
@@ -266,7 +266,6 @@
        this.resetData();
        this.$nextTick(() => {
          setTimeout(() => {
            this.fetchStockStatistics(); // åŠ è½½ç»Ÿè®¡æ•°æ®
            this.fetchUnpalletMaterialDetails();
          }, 300);
        });
@@ -286,18 +285,12 @@
        this.palletForm = { palletCode: '', barcode: '' };
        this.backData = [];
        this.$refs.palletForm?.reset();
        this.fetchStockStatistics(); // å•据号变了,刷新统计
        this.fetchUnpalletMaterialDetails();
      }
    }
  },
  mounted() {
    document.addEventListener('keypress', this.handleKeyPress);
    setTimeout(() => {
      this.focusLocationSelect();
    }, 300);
  },
  beforeDestroy() {
    document.removeEventListener('keypress', this.handleKeyPress);
@@ -306,9 +299,9 @@
  methods: {
    open() {
      this.show = true;
      this.resetData();
      this.initLocationTypes();
      this.initwarehouseTypes();
      this.fetchStockStatistics();
      this.fetchUnpalletMaterialDetails();
    },
    validateLocationType(rule, value, callback) {
@@ -361,9 +354,9 @@
      }
    },
    async fetchStockStatistics() {
    async fetchStockStatistics(orderNo) {
      // å•据号为空时不查询
      if (!this.docNo) {
      if (!orderNo) {
        this.sumError = '单据号为空,无法统计';
        return;
      }
@@ -371,7 +364,7 @@
      this.sumLoading = true;
      this.sumError = '';
      try {
        const response = await http.post('/api/InboundOrder/UnPalletQuantity?orderNo=' + this.orderNo, {});
        const response = await http.post('/api/InboundOrder/UnPalletQuantity?orderNo=' + orderNo, {});
        if (response.data) {
          this.totalStockSum = response.data.stockSumQuantity || 0;
          this.totalStockCount = response.data.stockCount || 0;
@@ -644,7 +637,6 @@
      this.error = '';
      this.loading = true;
      console.log(currentBarcode);
      try {
        // è°ƒç”¨API查询物料信息
        const materialData = await this.fetchMaterialData(currentBarcode);
@@ -663,8 +655,7 @@
          });
        });
        this.orderNo = materialData[0].orderNo;
        this.fetchStockStatistics();
        await this.fetchStockStatistics(materialData[0].orderNo);
        // æ¸…空物料输入框并保持聚焦
        this.barcode = '';
        this.scanCode = ''; // æ¸…空扫码缓存
@@ -772,44 +763,6 @@
      }, 100);
      this.lastKeyTime = currentTime;
    },
    // åˆ é™¤ç‰©æ–™
    removeMaterial(index) {
      this.$confirm('确定要删除这条物料记录吗?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        this.materials.splice(index, 1);
        this.$message({
          type: 'success',
          message: '删除成功!'
        });
        this.fetchStockStatistics();
      }).catch(() => {
        // å–消删除
      });
    },
    // æ¸…空所有物料
    clearAllMaterials() {
      if (this.materials.length === 0) return;
      this.$confirm('确定要清空所有物料记录吗?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        this.materials = [];
        this.$message({
          type: 'success',
          message: '已清空所有记录!'
        });
      }).catch(() => {
        // å–消清空
      });
    },
    // æ ¼å¼åŒ–æ—¶é—´