| | |
| | | import type { VbenFormApi, VbenFormSchema } from '#/adapter/form'; |
| | | import type { VxeTableGridOptions } from '#/adapter/vxe-table'; |
| | | import type { MesWmMaterialStockApi } from '#/api/mes/wm/materialstock'; |
| | | import type { MesWmProductIssueLineApi } from '#/api/mes/wm/productissue/line'; |
| | | import type { MesWmReturnIssueApi } from '#/api/mes/wm/returnissue'; |
| | | import type { MesWmReturnIssueDetailApi } from '#/api/mes/wm/returnissue/detail'; |
| | | import type { MesWmReturnIssueLineApi } from '#/api/mes/wm/returnissue/line'; |
| | |
| | | import { generateAutoCode } from '#/api/mes/md/autocode/record'; |
| | | import { MdWorkstationSelect } from '#/views/mes/md/workstation/components'; |
| | | import { ProWorkOrderSelect } from '#/views/mes/pro/workorder/components'; |
| | | import { WmProductIssueLineSelect } from '#/views/wls/productissue/components'; |
| | | import { WmMaterialStockSelect } from '#/views/wls/materialstock/components'; |
| | | import { |
| | | WmWarehouseAreaSelect, |
| | |
| | | } |
| | | |
| | | /** 退料单行新增/修改的表单 */ |
| | | export function useLineFormSchema(formApi?: VbenFormApi): VbenFormSchema[] { |
| | | export function useLineFormSchema( |
| | | formApi?: VbenFormApi, |
| | | workOrderId?: number, |
| | | ): VbenFormSchema[] { |
| | | return [ |
| | | { |
| | | fieldName: 'materialStockId', |
| | | label: '库存记录', |
| | | component: markRaw(WmMaterialStockSelect), |
| | | fieldName: 'issueLineId', |
| | | label: '领料记录', |
| | | component: markRaw(WmProductIssueLineSelect), |
| | | componentProps: { |
| | | // 选择库存记录后,自动回填物料/批次/数量 |
| | | onChange: async (stock?: MesWmMaterialStockApi.MaterialStock) => { |
| | | workOrderId, |
| | | onChange: async (line?: MesWmProductIssueLineApi.ProductIssueLine) => { |
| | | await formApi?.setValues({ |
| | | batchCode: stock?.batchCode, |
| | | batchId: stock?.batchId, |
| | | itemId: stock?.itemId, |
| | | materialDisplayName: stock |
| | | ? [stock.itemName, stock.specification].filter(Boolean).join(' | ') |
| | | batchCode: line?.batchCode, |
| | | batchId: line?.batchId, |
| | | itemId: line?.itemId, |
| | | materialDisplayName: line |
| | | ? [line.itemName, line.specification].filter(Boolean).join(' | ') |
| | | : undefined, |
| | | quantity: stock?.quantity, |
| | | quantityMax: stock?.quantity, |
| | | quantity: line?.quantity, |
| | | quantityMax: line?.quantity, |
| | | }); |
| | | }, |
| | | virtualFilter: 'only', |
| | | }, |
| | | rules: 'selectRequired', |
| | | }, |
| | |
| | | component: 'Input', |
| | | componentProps: { |
| | | disabled: true, |
| | | placeholder: '选择库存后自动带出', |
| | | placeholder: '选择领料记录后自动带出', |
| | | }, |
| | | }, |
| | | { |
| | |
| | | component: 'Input', |
| | | componentProps: { |
| | | disabled: true, |
| | | placeholder: '选择库存后自动带出', |
| | | placeholder: '选择领料记录后自动带出', |
| | | }, |
| | | }, |
| | | { |