| | |
| | | import type { VbenFormApi, VbenFormSchema } from '#/adapter/form'; |
| | | import type { VxeTableGridOptions } from '#/adapter/vxe-table'; |
| | | import type { MesWmMaterialStockApi } from '#/api/mes/wm/materialstock'; |
| | | import type { MesWmProductReceiptApi } from '#/api/mes/wm/productreceipt'; |
| | | import type { MesWmProductReceiptDetailApi } from '#/api/mes/wm/productreceipt/detail'; |
| | | import type { MesWmProductReceiptLineApi } from '#/api/mes/wm/productreceipt/line'; |
| | |
| | | |
| | | import { generateAutoCode } from '#/api/mes/md/autocode/record'; |
| | | import { getRangePickerDefaultProps } from '#/utils'; |
| | | import { MdItemSelect } from '#/views/mes/md/item/components'; |
| | | import { MdmItemSelect } from '#/views/basicData/mdm/components'; |
| | | import { ProWorkOrderSelect } from '#/views/mes/pro/workorder/components'; |
| | | import { WmMaterialStockSelect } from '#/views/wls/materialstock/components'; |
| | | import { |
| | | WmWarehouseAreaSelect, |
| | | WmWarehouseLocationSelect, |
| | |
| | | } |
| | | |
| | | /** 入库单行新增/修改的表单 */ |
| | | export function useLineFormSchema(formApi?: VbenFormApi): VbenFormSchema[] { |
| | | export function useLineFormSchema(): VbenFormSchema[] { |
| | | return [ |
| | | { |
| | | fieldName: 'materialStockId', |
| | | label: '库存记录', |
| | | component: markRaw(WmMaterialStockSelect), |
| | | fieldName: 'itemId', |
| | | label: '物料', |
| | | component: markRaw(MdmItemSelect), |
| | | componentProps: { |
| | | // 选择库存记录后,自动回填物料/批次/数量 |
| | | onChange: async (stock?: MesWmMaterialStockApi.MaterialStock) => { |
| | | await formApi?.setValues({ |
| | | batchCode: stock?.batchCode, |
| | | batchId: stock?.batchId, |
| | | itemId: stock?.itemId, |
| | | quantity: stock?.quantity, |
| | | quantityMax: stock?.quantity, |
| | | }); |
| | | }, |
| | | virtualFilter: 'only', |
| | | placeholder: '请选择物料', |
| | | }, |
| | | rules: 'selectRequired', |
| | | }, |
| | | { |
| | | fieldName: 'quantityMax', |
| | | component: 'Input', |
| | | dependencies: { |
| | | triggerFields: [''], |
| | | show: () => false, |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'quantity', |
| | |
| | | precision: 2, |
| | | }, |
| | | rules: 'required', |
| | | dependencies: { |
| | | triggerFields: ['quantityMax'], |
| | | componentProps: (values) => ({ |
| | | class: '!w-full', |
| | | max: values.quantityMax, |
| | | min: 0, |
| | | placeholder: '请输入入库数量', |
| | | precision: 2, |
| | | }), |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'batchCode', |
| | | label: '批次号', |
| | | component: 'Input', |
| | | componentProps: { |
| | | disabled: true, |
| | | placeholder: '选择库存后自动带出', |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'itemId', |
| | | label: '物料', |
| | | component: markRaw(MdItemSelect), |
| | | componentProps: { |
| | | disabled: true, |
| | | placeholder: '请输入批次号(可选)', |
| | | }, |
| | | }, |
| | | { |
| | |
| | | { |
| | | fieldName: 'itemId', |
| | | label: '物料', |
| | | component: markRaw(MdItemSelect), |
| | | component: markRaw(MdmItemSelect), |
| | | componentProps: { |
| | | disabled: true, |
| | | }, |