1
heshaofeng
2025-11-09 f747c5151051c12a1c44eaf5ef49f0a3805702b0
ÏîÄ¿´úÂë/WIDESEA_WMSClient/src/extension/inbound/inboundOrder.js
@@ -40,10 +40,55 @@
          const targetRow = selectedRows[0];
     
          this.$emit('openPalletDialog', targetRow.inboundOrderNo);
        }
      },
      {
  name: '分批入库',
  type: 'primary',
  value: '分批入库',
  onClick: async function () {
    console.log('分批入库按钮被点击,开始校验');
    const selectedRows = this.$refs.table.getSelected();
    // æ ¡éªŒ1:是否选中行(至少选择一条)
    if (selectedRows.length === 0) {
      console.log('校验不通过:未选中任何单据');
      ElMessage.warning('请选择至少一条单据');
      return;
    }
    // æ”¶é›†æ‰€æœ‰é€‰ä¸­å•据的编号(过滤无单据号的异常行)
    const inboundOrderNos = selectedRows
      .filter(row => row.inboundOrderNo)
      .map(row => row.inboundOrderNo);
    // æ ¡éªŒ2:是否有有效单据号
    if (inboundOrderNos.length === 0) {
      console.log('校验不通过:选中单据无有效编号');
      ElMessage.warning('选中的单据中无有效编号,请重新选择');
      return;
    }
    try {
      console.log('发起分批入库请求,参数:', { inboundOrderNos});
      const response = await http.post('/api/InboundOrder/BatchInbound', {
        inboundOrderNos: inboundOrderNos,
      });
      const { status, message, data } = response;
      if (status) {
        console.log('分批入库成功,后端返回:', data);
        ElMessage.success(`分批入库成功!共处理${inboundOrderNos.length}条单据`);
        this.refresh(); // å…¥åº“成功后刷新列表(复用原有逻辑)
      } else {
        console.log('分批入库失败,后端提示:', message);
        ElMessage.error(message || data?.message || '分批入库失败');
      }
    } catch (error) {
      console.error('分批入库请求异常:', error);
      ElMessage.error('网络异常或接口错误,请稍后重试');
    }
        }
      },
     {
@@ -76,16 +121,16 @@
        rules: {
          // æ–™ç®±ç æ ¡éªŒï¼šä»…保留字符串类型,移除必填要求(空值可通过)
          boxCode: [
            { required: true, message: '请输入料箱码', trigger: 'blur' },
            { type: 'string', message: '料箱码必须为字符串', trigger: 'blur' }
          ]
        },
        ref: 'batchInForm'
      }, [
        // æ–™ç®±ç è¾“入项(可选填)
        h(ElFormItem, { label: '料箱码', prop: 'boxCode' }, [
        h(ElFormItem, { label: '料箱码', prop: 'boxCode',required:true }, [
          h(ElInput, {
            type: 'text',
            placeholder: '可选输入料箱码,不填则默认入库', // æç¤ºå¯ç©ºè§„则
            modelValue: formData.boxCode,
            'onUpdate:modelValue': (val) => {
              formData.boxCode = val;
@@ -113,8 +158,8 @@
              }
              // å…¥åº“接口提交:料箱码为空时传递空字符串,后端需支持该字段可选
              http.post('/api/wmsTask/BatchInboundTask', {
                boxCode: formData.boxCode // å¯ç©ºï¼šç”¨æˆ·è¾“入或空字符串
              http.post('/api/InboundOrder/EmptyMaterielGroup', {
                palletCode: formData.boxCode // å¯ç©ºï¼šç”¨æˆ·è¾“入或空字符串
              }).then(({ data, status, message }) => {
                if (status) {
                  ElMessage.success(`入库成功${formData.boxCode ? ',料箱码:' + formData.boxCode : ''}`);