| | |
| | | |
| | | import { z } from '#/adapter/form'; |
| | | import { generateAutoCode } from '#/api/mes/md/autocode/record'; |
| | | import { MdItemSelect } from '#/views/mes/md/item/components'; |
| | | import { MdWorkstationSelect } from '#/views/mes/md/workstation/components'; |
| | | import { ProWorkOrderSelect } from '#/views/mes/pro/workorder/components'; |
| | | import { WmMaterialStockSelect } from '#/views/wls/materialstock/components'; |
| | |
| | | batchCode: stock?.batchCode, |
| | | batchId: stock?.batchId, |
| | | itemId: stock?.itemId, |
| | | materialDisplayName: stock |
| | | ? [stock.itemName, stock.specification].filter(Boolean).join(' | ') |
| | | : undefined, |
| | | quantity: stock?.quantity, |
| | | quantityMax: stock?.quantity, |
| | | }); |
| | |
| | | }, |
| | | { |
| | | fieldName: 'itemId', |
| | | component: 'Input', |
| | | dependencies: { |
| | | triggerFields: [''], |
| | | show: () => false, |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'materialDisplayName', |
| | | label: '物料', |
| | | component: markRaw(MdItemSelect), |
| | | component: 'Input', |
| | | componentProps: { |
| | | disabled: true, |
| | | placeholder: '选择库存后自动带出', |
| | | }, |
| | | }, |
| | | { |
| | |
| | | }, |
| | | { |
| | | fieldName: 'itemId', |
| | | component: 'Input', |
| | | dependencies: { |
| | | triggerFields: [''], |
| | | show: () => false, |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'materialDisplayName', |
| | | label: '物料', |
| | | component: markRaw(MdItemSelect), |
| | | component: 'Input', |
| | | componentProps: { |
| | | disabled: true, |
| | | placeholder: '选择库存后自动带出', |
| | | }, |
| | | rules: 'selectRequired', |
| | | }, |
| | | { |
| | | fieldName: 'materialStockId', |
| | | label: '库存记录', |
| | | component: markRaw(WmMaterialStockSelect), |
| | | componentProps: { |
| | | // 选择库存记录后,自动回填仓库/库区/库位/批次/数量 |
| | | // 选择库存记录后,自动回填物料/批次/数量(不再带入仓库信息) |
| | | onChange: async (stock?: MesWmMaterialStockApi.MaterialStock) => { |
| | | await formApi?.setValues({ |
| | | areaId: stock?.areaId, |
| | | batchCode: stock?.batchCode, |
| | | batchId: stock?.batchId, |
| | | locationId: stock?.locationId, |
| | | itemId: stock?.itemId, |
| | | materialDisplayName: stock |
| | | ? [stock.itemName, stock.specification].filter(Boolean).join(' | ') |
| | | : undefined, |
| | | quantity: stock?.quantity, |
| | | quantityMax: stock?.quantity, |
| | | warehouseId: stock?.warehouseId, |
| | | }); |
| | | }, |
| | | virtualFilter: 'only', |
| | |
| | | }, |
| | | { |
| | | fieldName: 'warehouseId', |
| | | label: '入库仓库', |
| | | label: '上架目标仓库', |
| | | component: markRaw(WmWarehouseSelect), |
| | | componentProps: { |
| | | disabled: true, |
| | | }, |
| | | // componentProps: { |
| | | // excludeCodes: ['WIP_VIRTUAL_WAREHOUSE'], |
| | | // }, |
| | | }, |
| | | { |
| | | fieldName: 'locationId', |
| | | label: '库区', |
| | | label: '上架目标库区', |
| | | component: markRaw(WmWarehouseLocationSelect), |
| | | componentProps: { |
| | | disabled: true, |
| | | }, |
| | | dependencies: { |
| | | triggerFields: ['warehouseId'], |
| | | componentProps: (values) => ({ |
| | | disabled: true, |
| | | disabled: !values.warehouseId, |
| | | warehouseId: values.warehouseId, |
| | | }), |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'areaId', |
| | | label: '库位', |
| | | label: '上架目标库位', |
| | | component: markRaw(WmWarehouseAreaSelect), |
| | | componentProps: { |
| | | disabled: true, |
| | | }, |
| | | dependencies: { |
| | | triggerFields: ['locationId'], |
| | | componentProps: (values) => ({ |
| | | disabled: true, |
| | | disabled: !values.locationId, |
| | | locationId: values.locationId, |
| | | }), |
| | | }, |