| | |
| | | import type { VbenFormApi, VbenFormSchema } from '#/adapter/form'; |
| | | import type { VxeTableGridOptions } from '#/adapter/vxe-table'; |
| | | import type { MesProTaskApi } from '#/api/mes/pro/task'; |
| | | import type { MesWmMaterialStockApi } from '#/api/mes/wm/materialstock'; |
| | | import type { MesWmProductIssueApi } from '#/api/mes/wm/productissue'; |
| | | import type { MesWmProductIssueDetailApi } from '#/api/mes/wm/productissue/detail'; |
| | |
| | | import { getRangePickerDefaultProps } from '#/utils'; |
| | | import { MdItemSelect } from '#/views/mes/md/item/components'; |
| | | import { MdWorkstationSelect } from '#/views/mes/md/workstation/components'; |
| | | import { ProTaskSelect } from '#/views/mes/pro/task/components'; |
| | | import { ProWorkOrderSelect } from '#/views/mes/pro/workorder/components'; |
| | | import { WmMaterialStockSelect } from '#/views/wls/materialstock/components'; |
| | | import { |
| | |
| | | label: '生产订单', |
| | | component: markRaw(ProWorkOrderSelect), |
| | | componentProps: { |
| | | placeholder: '请选择生产订单', |
| | | status: MesProWorkOrderStatusEnum.CONFIRMED, |
| | | // 订单变更:清空已选生产任务,避免任务与订单不一致 |
| | | onChange: async () => { |
| | | await formApi?.setFieldValue('taskId', undefined); |
| | | }, |
| | | }, |
| | | rules: 'selectRequired', |
| | | }, |
| | | { |
| | | fieldName: 'taskId', |
| | | label: '生产任务', |
| | | component: markRaw(ProTaskSelect), |
| | | componentProps: { |
| | | placeholder: '请选择生产任务', |
| | | // 选中任务后自动带出其工作站 |
| | | onChange: async (task?: MesProTaskApi.Task) => { |
| | | await formApi?.setFieldValue('workstationId', task?.workstationId); |
| | | }, |
| | | }, |
| | | dependencies: { |
| | | triggerFields: ['workOrderId'], |
| | | componentProps: (values) => ({ |
| | | disabled: !values.workOrderId, |
| | | placeholder: values.workOrderId ? '请选择生产任务' : '请先选择生产订单', |
| | | workOrderId: values.workOrderId, |
| | | }), |
| | | }, |
| | | rules: 'selectRequired', |
| | | }, |
| | |
| | | { |
| | | field: 'workOrderCode', |
| | | title: '生产订单', |
| | | minWidth: 140, |
| | | }, |
| | | { |
| | | field: 'taskCode', |
| | | title: '生产任务', |
| | | minWidth: 140, |
| | | }, |
| | | { |
| | |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'batchId', |
| | | component: 'Input', |
| | | dependencies: { |
| | | triggerFields: [''], |
| | | show: () => false, |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'itemId', |
| | | label: '物料', |
| | | component: markRaw(MdItemSelect), |
| | |
| | | label: '库存记录', |
| | | component: markRaw(WmMaterialStockSelect), |
| | | componentProps: { |
| | | // 选择库存记录后,自动回填仓库/库区/库位/批次/数量 |
| | | // 选择库存记录后,自动回填物料/仓库/库区/库位/批次/数量,全部以库存记录为准 |
| | | onChange: async (stock?: MesWmMaterialStockApi.MaterialStock) => { |
| | | await formApi?.setValues({ |
| | | areaId: stock?.areaId, |
| | | batchCode: stock?.batchCode, |
| | | batchId: stock?.batchId, |
| | | itemId: stock?.itemId, |
| | | locationId: stock?.locationId, |
| | | quantity: stock?.quantity, |
| | | quantityMax: stock?.quantity, |
| | |
| | | dependencies: { |
| | | triggerFields: ['itemId'], |
| | | componentProps: (values) => ({ |
| | | // 库存选择弹窗只识别 mdmItemId 入参,并用它作为 itemId 过滤条件 |
| | | mdmItemId: values.itemId, |
| | | }), |
| | | }, |