| | |
| | | DICT_TYPE, |
| | | MesAutoCodeRuleCode, |
| | | MesWmSalesNoticeStatusEnum, |
| | | MesWmWarehouseTypeEnum, |
| | | } from '@vben/constants'; |
| | | import { getDictOptions } from '@vben/hooks'; |
| | | |
| | |
| | | import { z } from '#/adapter/form'; |
| | | import CrmCustomerSelect from '#/components/crm-customer-select.vue'; |
| | | import { generateAutoCode } from '#/api/mes/md/autocode/record'; |
| | | import { ErpSaleOrderSelect } from '#/views/erp/sale/order/components'; |
| | | import { getRangePickerDefaultProps } from '#/utils'; |
| | | import { MdItemSelect } from '#/views/mes/md/item/components'; |
| | | import { WmMaterialStockSelect } from '#/views/wls/materialstock/components'; |
| | |
| | | component: markRaw(WmSalesNoticeSelect), |
| | | componentProps: { |
| | | disabled: isHeaderReadonly(formType), |
| | | // 选择发货通知单后,自动回填销售订单号、客户、收货人信息 |
| | | // 选择发货通知单后,自动回填客户、收货人信息 |
| | | onChange: async (notice?: MesWmSalesNoticeApi.SalesNotice) => { |
| | | await formApi?.setValues({ |
| | | clientId: notice?.clientId, |
| | | contactAddress: notice?.recipientAddress, |
| | | contactName: notice?.recipientName, |
| | | contactTelephone: notice?.recipientTelephone, |
| | | salesOrderCode: notice?.salesOrderCode, |
| | | }); |
| | | }, |
| | | status: MesWmSalesNoticeStatusEnum.APPROVED, |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'saleOrderId', |
| | | label: '销售订单编号', |
| | | component: markRaw(ErpSaleOrderSelect), |
| | | componentProps: { |
| | | disabled: isHeaderReadonly(formType), |
| | | placeholder: '请选择销售订单', |
| | | onChange: (item: any) => { |
| | | if (formApi) { |
| | | formApi.setFieldValue('salesOrderCode', item?.no ?? ''); |
| | | if (item?.customerId) { |
| | | formApi.setFieldValue('clientId', item.customerId); |
| | | } |
| | | } |
| | | }, |
| | | }, |
| | | rules: 'selectRequired', |
| | | dependencies: { |
| | | triggerFields: ['salesOrderCode'], |
| | | if: () => formType === 'create', |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'salesOrderCode', |
| | | label: '销售订单编号', |
| | | component: 'Input', |
| | | componentProps: { |
| | | disabled: true, |
| | | placeholder: '销售订单编号', |
| | | }, |
| | | dependencies: { |
| | | triggerFields: [''], |
| | | if: () => formType !== 'create', |
| | | }, |
| | | }, |
| | | { |
| | |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'salesOrderCode', |
| | | label: '销售订单编号', |
| | | component: 'Input', |
| | | componentProps: { |
| | | allowClear: true, |
| | | placeholder: '请输入销售订单编号', |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'clientId', |
| | | label: '客户', |
| | | component: markRaw(CrmCustomerSelect), |
| | |
| | | { |
| | | field: 'noticeCode', |
| | | title: '发货通知单号', |
| | | minWidth: 160, |
| | | }, |
| | | { |
| | | field: 'salesOrderCode', |
| | | title: '销售订单编号', |
| | | minWidth: 160, |
| | | }, |
| | | { |
| | |
| | | label: '选择库存', |
| | | component: markRaw(WmMaterialStockSelect), |
| | | componentProps: { |
| | | // 只从合格仓库(type=20)选择可拣货库存 |
| | | warehouseType: MesWmWarehouseTypeEnum.QUALIFIED, |
| | | // 选择库存记录后,自动回填仓库/库区/库位/批次/数量 |
| | | onChange: async (stock?: MesWmMaterialStockApi.MaterialStock) => { |
| | | await formApi?.setValues({ |