gaoluyang
6 天以前 6797c356a987656940505759d1d9846692e85544
银川
1.到货通知与采购入库流程联调
已修改6个文件
121 ■■■■ 文件已修改
src/views/erp/purchase/order/data.ts 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/mes/qc/template/data.ts 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/wls/arrivalnotice/data.ts 16 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/wls/arrivalnotice/index.vue 25 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/wls/itemreceipt/data.ts 19 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/wls/itemreceipt/modules/form.vue 54 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/erp/purchase/order/data.ts
@@ -448,7 +448,7 @@
    },
    {
      title: '操作',
      width: 260,
      width: 340,
      fixed: 'right',
      slots: { default: 'actions' },
    },
src/views/mes/qc/template/data.ts
@@ -17,7 +17,7 @@
import { z } from '#/adapter/form';
import { generateAutoCode } from '#/api/mes/md/autocode/record';
import { getItemList } from '#/api/mdm/item';
import { getItemPage } from '#/api/mdm/item';
import { MdUnitMeasureSelect } from '#/views/mes/md/unitmeasure/components';
import { QcIndicatorSelect } from '#/views/mes/qc/indicator/components';
@@ -426,7 +426,8 @@
        placeholder: '请选择产品物料',
        allowClear: true,
        showSearch: true,
        api: getItemList,
        api: getItemPage,
        resultField: 'list',
        labelField: 'name',
        valueField: 'id',
        optionRender: (option: any) => {
src/views/wls/arrivalnotice/data.ts
@@ -11,8 +11,8 @@
import { z } from '#/adapter/form';
import { generateAutoCode } from '#/api/mes/md/autocode/record';
import { getItemPage } from '#/api/mdm/item';
import { getRangePickerDefaultProps } from '#/utils';
import { MdItemSelect } from '#/views/mes/md/item/components';
import { MdVendorSelect } from '#/views/mes/md/vendor/components';
import { ErpPurchaseOrderSelect } from '#/views/erp/purchase/order/components';
@@ -347,11 +347,21 @@
    {
      fieldName: 'itemId',
      label: '物料',
      component: markRaw(MdItemSelect),
      component: 'ApiSelect',
      componentProps: {
        placeholder: '请选择物料',
        allowClear: true,
        showSearch: true,
        api: getItemPage,
        resultField: 'list',
        labelField: 'name',
        valueField: 'id',
        optionRender: (option: any) => {
          const item = option.data;
          return `${item.code} - ${item.name}`;
        },
      },
      rules: 'selectRequired',
      rules: 'required',
    },
    {
      fieldName: 'arrivalQuantity',
src/views/wls/arrivalnotice/index.vue
@@ -15,6 +15,7 @@
  generateArrivalNoticeFromPurchaseOrder,
  getArrivalNoticePage,
} from '#/api/mes/wm/arrivalnotice';
import { generateItemReceiptFromArrivalNotice } from '#/api/mes/wm/itemreceipt';
import { $t } from '#/locales';
import { useGridColumns, useGridFormSchema } from './data';
@@ -68,12 +69,22 @@
/** 提示前往质检模块 */
function handleQc() {
  message.info('请前往【质量管理 - 待检任务】中进行来料检验操作');
  message.info('请前往【质量管理 - IQC检验】中进行来料检验操作');
}
/** 提示前往采购入库模块 */
function handleReceipt() {
  message.info('请前往【仓库管理 - 采购入库】中进行入库操作');
/** 执行入库:根据到货通知单生成采购入库单 */
async function handleReceipt(row: MesWmArrivalNoticeApi.ArrivalNotice) {
  const hideLoading = message.loading({
    content: '正在生成采购入库单...',
    duration: 0,
  });
  try {
    await generateItemReceiptFromArrivalNotice(row.id!);
    message.success('入库成功');
    handleRefresh();
  } finally {
    hideLoading();
  }
}
/** 从采购订单生成到货通知单 */
@@ -205,9 +216,13 @@
            {
              label: '执行入库',
              type: 'link',
              auth: ['mes:wm-item-receipt:create'],
              ifShow:
                row.status === MesWmArrivalNoticeStatusEnum.PENDING_RECEIPT,
              onClick: handleReceipt,
              popConfirm: {
                title: `确认根据到货通知单 ${row.code} 生成采购入库单?`,
                confirm: handleReceipt.bind(null, row),
              },
            },
          ]"
        />
src/views/wls/itemreceipt/data.ts
@@ -115,9 +115,18 @@
          await formApi?.setValues({
            purchaseOrderCode: notice?.purchaseOrderCode,
            vendorId: notice?.vendorId,
            vendorName: notice?.vendorName,
          });
        },
        status: MesWmArrivalNoticeStatusEnum.PENDING_RECEIPT,
      },
    },
    {
      fieldName: 'vendorName',
      component: 'Input',
      dependencies: {
        triggerFields: [''],
        show: () => false,
      },
    },
    {
@@ -126,8 +135,18 @@
      component: markRaw(ErpSupplierSelect),
      componentProps: {
        placeholder: '请选择供应商',
        onChange: async (supplier?: any) => {
          await formApi?.setFieldValue('vendorName', supplier?.name);
        },
      },
      rules: 'selectRequired',
      dependencies: {
        triggerFields: ['vendorName'],
        componentProps: (values) => ({
          placeholder: '请选择供应商',
          supplierName: values.vendorName as string,
        }),
      },
    },
    {
      fieldName: 'purchaseOrderCode',
src/views/wls/itemreceipt/modules/form.vue
@@ -17,7 +17,6 @@
  getItemReceipt,
  stockItemReceipt,
  submitItemReceipt,
  submitItemReceiptApproval,
  updateItemReceipt,
} from '#/api/mes/wm/itemreceipt';
import { $t } from '#/locales';
@@ -28,22 +27,14 @@
const emit = defineEmits(['success']);
const formType = ref<FormType>('create');
const formData = ref<MesWmItemReceiptApi.ItemReceipt>();
const originalSnapshot = ref(''); // 表单原始数据快照,用于提交时跳过未变更的保存请求
const originalSnapshot = ref('');
const isEditable = computed(() =>
  // 是否为编辑模式(可保存)
  ['create', 'update'].includes(formType.value),
);
const isStock = computed(() => formType.value === 'stock'); // 是否为上架模式
const isFinish = computed(() => formType.value === 'finish'); // 是否为执行入库模式
const isStock = computed(() => formType.value === 'stock');
const isFinish = computed(() => formType.value === 'finish');
const canSubmit = computed(
  () =>
    // 是否可提交
    formType.value === 'update' &&
    formData.value?.status === MesWmItemReceiptStatusEnum.PREPARE,
);
const canSubmitApproval = computed(
  () =>
    // 是否可提交审批
    formType.value === 'update' &&
    formData.value?.status === MesWmItemReceiptStatusEnum.PREPARE,
);
@@ -76,7 +67,7 @@
  wrapperClass: 'grid-cols-3',
});
/** 提交入库单:表单有修改时先保存,再调用提交接口 */
/** 提交入库单 */
async function handleSubmit() {
  const { valid } = await formApi.validate();
  if (!valid || !formData.value?.id) {
@@ -102,9 +93,7 @@
/** 执行上架 */
async function handleStock() {
  if (!formData.value?.id) {
    return;
  }
  if (!formData.value?.id) return;
  modalApi.lock();
  try {
    await stockItemReceipt(formData.value.id);
@@ -118,31 +107,11 @@
/** 执行入库 */
async function handleFinish() {
  if (!formData.value?.id) {
    return;
  }
  if (!formData.value?.id) return;
  modalApi.lock();
  try {
    await finishItemReceipt(formData.value.id);
    message.success('入库成功');
    await modalApi.close();
    emit('success');
  } finally {
    modalApi.unlock();
  }
}
/** 提交审批 */
async function handleSubmitApproval() {
  if (!formData.value?.id) {
    return;
  }
  modalApi.lock();
  try {
    // 使用默认流程key,实际项目中可能需要弹窗选择
    const processDefinitionKey = 'item_receipt_approval';
    await submitItemReceiptApproval(formData.value.id, processDefinitionKey);
    message.success('提交审批成功');
    await modalApi.close();
    emit('success');
  } finally {
@@ -157,11 +126,8 @@
      return;
    }
    const { valid } = await formApi.validate();
    if (!valid) {
      return;
    }
    if (!valid) return;
    modalApi.lock();
    // 提交表单
    const data = (await formApi.getValues()) as MesWmItemReceiptApi.ItemReceipt;
    try {
      if (formData.value?.id) {
@@ -191,7 +157,6 @@
      originalSnapshot.value = '';
      return;
    }
    // 加载数据
    const data = modalApi.getData<{ formType: FormType; id?: number }>();
    formType.value = data.formType;
    formApi.setState({ schema: useFormSchema(formType.value, formApi) });
@@ -201,7 +166,6 @@
      modalApi.lock();
      try {
        formData.value = await getItemReceipt(data.id);
        // 设置到 values
        await formApi.setValues(formData.value);
      } finally {
        modalApi.unlock();
@@ -235,7 +199,6 @@
<template>
  <Modal :title="getTitle" class="w-3/5">
    <Form class="mx-4" />
    <!-- 非新建模式展示物料信息 -->
    <template v-if="formData?.id">
      <Divider>物料信息</Divider>
      <div class="mx-4">
@@ -255,9 +218,6 @@
        >
          <Button type="primary">提交</Button>
        </Popconfirm>
        <Button v-if="canSubmitApproval" type="primary" @click="handleSubmitApproval">
          提交审批
        </Button>
        <Button v-if="isStock" type="primary" @click="confirmStock">
          执行上架
        </Button>