1
647556386
2025-11-30 8639f19c82f6e263654db44286256bb8d028d2c2
ÏîÄ¿´úÂë/WIDESEA_WMSClient/src/views/outbound/PickingConfirm.vue
@@ -28,7 +28,7 @@
          <el-button type="success" @click="confirmPicking">确认拣选</el-button>
     <!--      <el-button type="warning" @click="openSplitDialog">拆包</el-button>
          <el-button type="info" @click="openRevertSplitDialog">撤销拆包</el-button> -->
           <el-button type="info" @click="handleEmptyPallet">取空箱</el-button>
          <el-button type="primary" @click="openBatchReturnDialog">回库</el-button>
          <!-- <el-button type="danger" @click="handleDirectOutbound">直接出库</el-button>  -->
@@ -250,6 +250,49 @@
        </div>
      </div>
    </div>
    <!-- å–走空箱-->
 <div v-if="showEmptyPalletDialog" class="custom-dialog-overlay">
      <div class="custom-dialog-wrapper">
        <div class="custom-dialog">
          <div class="custom-dialog-header">
            <h3>取走空箱</h3>
            <el-button
              type="text"
              @click="closeEmptyPalletDialog"
              class="close-button">
              Ã—
            </el-button>
          </div>
          <div class="custom-dialog-body">
            <el-form
              :model="emptypalletOutForm"
              :rules="emptypalletOutFormRules"
              ref="emptypalletOutFormRef"
              label-width="100px">
              <el-form-item label="订单编号">
                <el-input v-model="emptypalletOutForm.orderNo" disabled></el-input>
              </el-form-item>
              <el-form-item label="托盘编号" prop="palletCode">
                <el-input
                  v-model="emptypalletOutForm.palletCode"
                  placeholder="扫描托盘码"
                  @keyup.enter.native="onEmptyPalletScan"
                  @change="onEmptyPalletScan"
                  clearable>
                </el-input>
              </el-form-item>
            </el-form>
          </div>
          <div class="custom-dialog-footer">
            <el-button @click="closeEmptyPalletDialog">取消</el-button>
            <el-button type="primary" @click="handleEmptyPalletConfirm" :loading="emptypalletOutLoading">确认取走空箱</el-button>
          </div>
        </div>
      </div>
    </div>
  </div>
    <!-- ç›´æŽ¥å‡ºåº“弹窗 -->
    <div v-if="showDirectOutDialog" class="custom-dialog-overlay">
      <div class="custom-dialog-wrapper">
@@ -290,7 +333,7 @@
        </div>
      </div>
    </div>
  </div>
  <print-view ref="childs" @parentcall="parentcall"></print-view>
</template>
@@ -431,6 +474,20 @@
          { required: true, validator: validateDirectOutPalletCode, trigger: 'blur' }
        ]
      },
      showEmptyPalletDialog: false, // å–走空箱弹窗显示状态
      emptypalletOutLoading: false, // å–走空箱加载状态
      emptypalletOutForm: {
        orderNo: '',
        palletCode: ''
      },
      emptypalletOutFormRules: {
        palletCode: [
          { required: true, validator: validateDirectOutPalletCode, trigger: 'blur' }
        ]
      },
      returnForm: {
        orderNo: '',
        palletCode: '',
@@ -598,7 +655,7 @@
        });
        
        if (res.status) {
          this.$message.success('回库成功');
          this.$message.success(res.message);
          this.showBatchReturnDialog = false;
          this.loadData();
        } else {
@@ -708,6 +765,109 @@
    handleDirectOutbound() {
      this.openDirectOutDialog();
    },
   // æ‰“开取走空箱弹窗
    openEmptyPalletDialog() {
      console.log('打开取走空箱弹窗');
      this.showEmptyPalletDialog = true;
      // é‡ç½®è¡¨å•
      this.resetEmptyPalletForm();
      // è®¾ç½®è®¢å•信息
      this.emptypalletOutForm.orderNo = this.scanData.orderNo;
      // æ¸…除表单验证
      this.$nextTick(() => {
        if (this.$refs.emptyPalletFormRef) {
          this.$refs.emptyPalletFormRef.clearValidate();
        }
      });
    },
    // å…³é—­å–走空箱弹窗
    closeEmptyPalletDialog() {
      this.showEmptyPalletDialog = false;
      this.resetEmptyPalletForm();
      // æ¸…除表单验证
      if (this.$refs.emptyPalletFormRef) {
        this.$refs.emptyPalletFormRef.clearValidate();
      }
    },
    // å–走空箱托盘码扫码
    onEmptyPalletScan() {
      if (!this.emptypalletOutForm.palletCode) return;
      this.emptypalletOutForm.palletCode = this.emptypalletOutForm.palletCode.replace(/\n/g, '').trim();
      // æ¸…除验证状态
      if (this.$refs.emptyPalletFormRef) {
        this.$refs.emptyPalletFormRef.clearValidate(['palletCode']);
      }
    },
    // å–走空箱确认
    async handleEmptyPalletConfirm() {
      // è¡¨å•验证
      if (this.$refs.emptyPalletFormRef) {
        this.$refs.emptyPalletFormRef.validate((valid) => {
          if (valid) {
            this.submitEmptyPallet();
          } else {
            this.$message.warning('请扫描托盘码');
            return false;
          }
        });
      } else {
        // å¦‚果没有表单引用,使用原有的验证
        if (!this.emptypalletOutForm.palletCode) {
          this.$message.warning('请扫描托盘码');
          return;
        }
        this.submitEmptyPallet();
      }
    },
    // æäº¤å–走空箱请求
    async submitEmptyPallet() {
      this.emptypalletOutLoading = true;
      try {
        const res = await this.http.post('/api/OutboundPicking/remove-empty-pallet', {
          orderNo: this.emptypalletOutForm.orderNo,
          palletCode: this.emptypalletOutForm.palletCode
        });
        debugger;
        if (res.status) {
          this.$message.success('取走空箱成功');
          this.showEmptyPalletDialog = false;
          this.loadData();
        } else {
          this.$message.error(res.message || '取走空箱失败');
        }
      } catch (error) {
        this.$message.error('取走空箱失败');
      } finally {
        this.emptypalletOutLoading = false;
      }
    },
    // é‡ç½®å–走空箱表单
    resetEmptyPalletForm() {
      this.emptypalletOutForm.palletCode = '';
    },
    // ä¿®æ”¹åŽŸæœ‰çš„å–èµ°ç©ºç®±æŒ‰é’®ç‚¹å‡»äº‹ä»¶
    handleEmptyPallet() {
      this.openEmptyPalletDialog();
    },
    async loadData() {
      if (!this.scanData.orderNo || !this.scanData.palletCode) {
        return;
@@ -775,21 +935,16 @@
              
              if (res.status) {
                successCount++;
                 this.$message.success(`成功取消`);
              } else {
                errorCount++;
                console.error(`取消拣选失败: ${row.Barcode}`, res.message);
                 this.$message.warning(`取消拣选失败: ${row.currentBarcode} - ${res.message}`);
              }
            } catch (error) {
              errorCount++;
              console.error(`取消拣选失败: ${row.Barcode}`, error);
              this.$message.warning(`取消拣选失败: ${row.currentBarcode} - ${error.message}` );
            }
          }
          if (errorCount === 0) {
            this.$message.success(`成功取消 ${successCount} é¡¹`);
          } else {
            this.$message.warning(`成功取消 ${successCount} é¡¹ï¼Œå¤±è´¥ ${errorCount} é¡¹`);
          }
          }
          
          this.loadData();
          this.selectedPickedRows = [];