1
云
4 小时以前 e7ccf9dafa1dac3c5000ff85f16f8d0ca1c2a6a7
src/views/mes/pro/bagCode/index.vue
@@ -251,15 +251,6 @@
  function handleBindPallet() {
    const records = getSelectedRecords();
    if (!records) return;
    if (records.some((record) => !record.batchId)) {
      message.warning("请先录入生产批次,再绑定托盘");
      return;
    }
    const batchIds = new Set(records.map((record) => record.batchId));
    if (batchIds.size > 1) {
      message.warning("请选择同一批次下的袋码进行绑定");
      return;
    }
    if (records.some((record) => record.palletId)) {
      message.warning("所选袋码中存在已绑定托盘的记录,请先解绑");
      return;
@@ -272,11 +263,31 @@
      message.warning("已作废的袋码不允许绑定托盘");
      return;
    }
    const withBatch = records.filter((record) => record.batchId);
    // 已录批次与未录批次混选时可选托盘范围不一致,要求分开操作
    if (withBatch.length > 0 && withBatch.length < records.length) {
      message.warning("所选袋码部分已录入批次,请分开选择后再绑定托盘");
      return;
    }
    const first = records[0]!;
    if (withBatch.length > 0) {
      const batchIds = new Set(records.map((record) => record.batchId));
      if (batchIds.size > 1) {
        message.warning("请选择同一批次下的袋码进行绑定");
        return;
      }
    } else {
      const itemIds = new Set(records.map((record) => record.itemId));
      if (itemIds.size > 1) {
        message.warning("请选择同一品种下的袋码进行绑定");
        return;
      }
    }
    bindPalletFormModalApi
      .setData({
        batchId: first.batchId,
        batchCode: first.batchCode,
        itemId: first.itemId,
        ids: records.map((record) => record.id!),
      })
      .open();