| | |
| | | import type { VbenFormApi, VbenFormSchema } from '#/adapter/form'; |
| | | import type { VxeTableGridOptions } from '#/adapter/vxe-table'; |
| | | import type { MesMdItemApi } from '#/api/mes/md/item'; |
| | | import type { MesWmMaterialStockApi } from '#/api/mes/wm/materialstock'; |
| | | import type { MesWmProductSalesApi } from '#/api/mes/wm/productsales'; |
| | | import type { MesWmProductSalesDetailApi } from '#/api/mes/wm/productsales/detail'; |
| | |
| | | import { getRangePickerDefaultProps } from '#/utils'; |
| | | import { MdItemSelect } from '#/views/mes/md/item/components'; |
| | | import { WmMaterialStockSelect } from '#/views/wls/materialstock/components'; |
| | | import { |
| | | buildItemUnitSchema, |
| | | useLineUnitHandlers, |
| | | } from '#/views/wls/utils/item-unit-convert'; |
| | | import { |
| | | WmSalesNoticeLineSelect, |
| | | WmSalesNoticeSelect, |
| | |
| | | minWidth: 120, |
| | | }, |
| | | { |
| | | field: 'itemModel', |
| | | title: '物料型号', |
| | | minWidth: 120, |
| | | }, |
| | | { |
| | | field: 'unitMeasureName', |
| | | title: '单位', |
| | | width: 80, |
| | | title: '主计量单位', |
| | | width: 100, |
| | | }, |
| | | { |
| | | field: 'enterUnitMeasureName', |
| | | title: '录入单位', |
| | | width: 90, |
| | | }, |
| | | { |
| | | field: 'enterQuantity', |
| | | title: '录入数量', |
| | | width: 100, |
| | | }, |
| | | { |
| | | field: 'quantity', |
| | |
| | | hasNotice: boolean, |
| | | formApi?: VbenFormApi, |
| | | ): VbenFormSchema[] { |
| | | const unitHandlers = useLineUnitHandlers(formApi); |
| | | return [ |
| | | { |
| | | fieldName: 'noticeId', |
| | |
| | | componentProps: { |
| | | // 选择发货通知单行后,自动回填物料、数量、批次、是否检验 |
| | | onChange: async (line?: MesWmSalesNoticeLineApi.SalesNoticeLine) => { |
| | | // 切换通知行等于切换产品,先重置型号与单位口径(会清空数量),再按通知行回填 |
| | | await unitHandlers.handleItemChange(line?.itemId); |
| | | await formApi?.setValues({ |
| | | batchCode: line?.batchCode, |
| | | itemId: line?.itemId, |
| | |
| | | component: markRaw(MdItemSelect), |
| | | componentProps: { |
| | | placeholder: '请选择产品', |
| | | // 切换产品后,重新记录物料主单位并清空型号、录入单位口径 |
| | | onChange: async (item?: MesMdItemApi.Item) => { |
| | | await unitHandlers.handleItemChange(item?.id); |
| | | }, |
| | | }, |
| | | rules: 'selectRequired', |
| | | dependencies: { |
| | |
| | | }), |
| | | }, |
| | | }, |
| | | // 物料型号 / 录入单位 / 录入数量 / 出库数量(物料主单位口径) |
| | | ...buildItemUnitSchema(formApi), |
| | | { |
| | | fieldName: 'batchCode', |
| | | label: '批次号', |
| | |
| | | componentProps: { |
| | | placeholder: '请输入批次号', |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'quantity', |
| | | label: '出库数量', |
| | | component: 'InputNumber', |
| | | componentProps: { |
| | | class: '!w-full', |
| | | min: 0, |
| | | placeholder: '请输入出库数量', |
| | | precision: 2, |
| | | }, |
| | | rules: 'required', |
| | | }, |
| | | { |
| | | fieldName: 'oqcCheckFlag', |