| | |
| | | import type { VxeTableGridOptions } from '#/adapter/vxe-table'; |
| | | import type { MesWmArrivalNoticeApi } from '#/api/mes/wm/arrivalnotice'; |
| | | |
| | | import { Page, useVbenModal } from '../../../packages/effects/common-ui/src'; |
| | | import { MesWmArrivalNoticeStatusEnum } from '../../../packages/constants/src'; |
| | | import { downloadFileFromBlobPart } from '../../../packages/utils/src'; |
| | | import { Page, useVbenModal } from '@vben/common-ui'; |
| | | import { MesWmArrivalNoticeStatusEnum } from '@vben/constants'; |
| | | import { downloadFileFromBlobPart } from '@vben/utils'; |
| | | |
| | | import { Button, message } from 'ant-design-vue'; |
| | | |
| | |
| | | import { |
| | | deleteArrivalNotice, |
| | | exportArrivalNotice, |
| | | generateArrivalNoticeFromPurchaseOrder, |
| | | getArrivalNoticePage, |
| | | } from '#/api/mes/wm/arrivalnotice'; |
| | | import { generateItemReceiptFromArrivalNotice } from '#/api/mes/wm/itemreceipt'; |
| | | import { $t } from '#/locales'; |
| | | |
| | | import { useGridColumns, useGridFormSchema } from './data'; |
| | | import Form from './modules/form.vue'; |
| | | import PoSelectDialog from './modules/po-select-dialog.vue'; |
| | | |
| | | const [FormModal, formModalApi] = useVbenModal({ |
| | | connectedComponent: Form, |
| | | destroyOnClose: true, |
| | | }); |
| | | |
| | | const [PoSelectModal, poSelectModalApi] = useVbenModal({ |
| | | connectedComponent: PoSelectDialog, |
| | | destroyOnClose: true, |
| | | }); |
| | | |
| | |
| | | |
| | | /** 提示前往质检模块 */ |
| | | 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(); |
| | | } |
| | | } |
| | | |
| | | /** 从采购订单生成到货通知单 */ |
| | | async function handleGenerateFromPO() { |
| | | poSelectModalApi.open(); |
| | | } |
| | | |
| | | /** 采购订单选择回调 */ |
| | | async function handlePurchaseOrderSelected(purchaseOrderId: number) { |
| | | const hideLoading = message.loading({ |
| | | content: '正在生成到货通知单...', |
| | | duration: 0, |
| | | }); |
| | | try { |
| | | const id = await generateArrivalNoticeFromPurchaseOrder(purchaseOrderId); |
| | | message.success('到货通知单生成成功'); |
| | | // 跳转到编辑页 |
| | | formModalApi.setData({ formType: 'update', id }).open(); |
| | | handleRefresh(); |
| | | } finally { |
| | | hideLoading(); |
| | | } |
| | | } |
| | | |
| | | /** 导出表格 */ |
| | |
| | | </script> |
| | | |
| | | <template> |
| | | <Page auto-content-height><FormModal @success="handleRefresh" /> |
| | | <Page auto-content-height> |
| | | <FormModal @success="handleRefresh" /> |
| | | <PoSelectModal @selected="handlePurchaseOrderSelected" /> |
| | | |
| | | <Grid table-title="到货通知单列表"> |
| | | <template #toolbar-tools> |
| | | <TableAction |
| | | :actions="[ |
| | | // 注释:隐藏新增到货通知单按钮 |
| | | // { |
| | | // label: $t('ui.actionTitle.create', ['到货通知单']), |
| | | // type: 'primary', |
| | | // icon: ACTION_ICON.ADD, |
| | | // auth: ['mes:wm-arrival-notice:create'], |
| | | // onClick: handleCreate, |
| | | // }, |
| | | { |
| | | label: $t('ui.actionTitle.create', ['到货通知单']), |
| | | label: '从采购订单生成', |
| | | type: 'primary', |
| | | icon: ACTION_ICON.ADD, |
| | | auth: ['mes:wm-arrival-notice:create'], |
| | | onClick: handleCreate, |
| | | onClick: handleGenerateFromPO, |
| | | }, |
| | | { |
| | | label: $t('ui.actionTitle.export'), |
| | |
| | | { |
| | | 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), |
| | | }, |
| | | }, |
| | | ]" |
| | | /> |