Merge remote-tracking branch 'origin/dev_南通_苏珩' into dev_南通_苏珩
| | |
| | | areaId: number; // 库位ID |
| | | batchId?: number; // 批次ID(选择已有批次时传入) |
| | | batchCode?: string; // 批次号(新建批次时传入) |
| | | reelNo?: string; // 新批次盘号 |
| | | produceDate?: string; // 生产日期(新建批次时传入) |
| | | expireDate?: string; // 有效期(新建批次时传入) |
| | | receiptDate?: string; // 入库日期 |
| | |
| | | |
| | | const filterTip = computed(() => { |
| | | const parts: string[] = []; |
| | | if (externalClientId.value !== null) { |
| | | if (externalItemId.value != null) { |
| | | parts.push('物料'); |
| | | } |
| | | if (externalClientId.value != null) { |
| | | parts.push('客户'); |
| | | } |
| | | if (externalVendorId.value !== null) { |
| | | if (externalVendorId.value != null) { |
| | | parts.push('供应商'); |
| | | } |
| | | if (externalSalesOrderCode.value !== null) { |
| | | if (externalSalesOrderCode.value != null) { |
| | | parts.push('销售订单'); |
| | | } |
| | | return parts.length > 0 ? `已按${parts.join('/')}预过滤` : ''; |
| | |
| | | trigger: 'row', |
| | | }, |
| | | proxyConfig: { |
| | | // 等外部物料条件写入表单后再查询,避免初始空条件请求覆盖结果。 |
| | | autoLoad: false, |
| | | ajax: { |
| | | query: async ({ page }, formValues) => { |
| | | const values = await gridApi.formApi.getValues(); |
| | | return await getBatchPage({ |
| | | pageNo: page.currentPage, |
| | | pageSize: page.pageSize, |
| | | ...formValues, |
| | | ...values, |
| | | itemId: externalItemId.value ?? values.itemId, |
| | | }); |
| | | }, |
| | | }, |
| | |
| | | props.allowClear && |
| | | !props.disabled && |
| | | hovering.value && |
| | | props.modelValue !== null, |
| | | props.modelValue != null, |
| | | ); |
| | | |
| | | /** 根据编号单条查询批次信息(用于编辑回显) */ |
| | |
| | | clearSelected(); |
| | | return; |
| | | } |
| | | const selectedIds = ( |
| | | props.modelValue === null ? [] : [props.modelValue] |
| | | ) as number[]; |
| | | const selectedIds = props.modelValue == null ? [] : [props.modelValue]; |
| | | dialogRef.value?.open(selectedIds, { |
| | | clientId: props.clientId, |
| | | itemId: props.itemId, |
| | |
| | | |
| | | import { DictTag } from '#/components/dict-tag'; |
| | | import { getRangePickerDefaultProps } from '#/utils'; |
| | | import { MdClientSelect } from '#/views/mes/md/client/components'; |
| | | import { MdItemSelect } from '#/views/mes/md/item/components'; |
| | | import { MdVendorSelect } from '#/views/mes/md/vendor/components'; |
| | | import CrmCustomerSelect from '#/components/crm-customer-select.vue'; |
| | | import { MdmItemSelect } from '#/views/basicData/mdm/components'; |
| | | import { SrmSupplierSelect } from '#/views/srm/supplier/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'; |
| | |
| | | { |
| | | fieldName: 'itemId', |
| | | label: '产品物料', |
| | | component: markRaw(MdItemSelect), |
| | | component: markRaw(MdmItemSelect), |
| | | componentProps: { |
| | | placeholder: '请选择产品物料', |
| | | }, |
| | |
| | | { |
| | | fieldName: 'vendorId', |
| | | label: '供应商', |
| | | component: markRaw(MdVendorSelect), |
| | | component: markRaw(SrmSupplierSelect), |
| | | componentProps: { |
| | | placeholder: '请选择供应商', |
| | | }, |
| | |
| | | { |
| | | fieldName: 'clientId', |
| | | label: '客户', |
| | | component: markRaw(MdClientSelect), |
| | | component: markRaw(CrmCustomerSelect), |
| | | componentProps: { |
| | | placeholder: '请选择客户', |
| | | }, |
| | |
| | | /** 当前 props 是否带预过滤 */ |
| | | const showAlert = computed( |
| | | () => |
| | | props.batchId !== null || |
| | | props.warehouseId !== null || |
| | | props.batchId != null || |
| | | props.warehouseId != null || |
| | | props.virtualFilter === 'only', |
| | | ); |
| | | |
| | | /** 预过滤提示文字 */ |
| | | const alertTitle = computed(() => { |
| | | const parts: string[] = []; |
| | | if (props.batchId !== null) { |
| | | if (props.batchId != null) { |
| | | parts.push('批次'); |
| | | } |
| | | if (props.warehouseId !== null) { |
| | | if (props.warehouseId != null) { |
| | | parts.push('仓库'); |
| | | } |
| | | if (props.virtualFilter === 'only') { |
| | |
| | | // 默认查未冻结 |
| | | frozen: false, |
| | | itemTypeId: searchItemTypeId.value, |
| | | itemId: props.mdmItemId, |
| | | itemId: props.itemId, |
| | | mdmItemId: props.mdmItemId, |
| | | warehouseId: formValues.warehouseId ?? props.warehouseId, |
| | | virtualFilter: |
| | | props.virtualFilter === 'all' ? undefined : props.virtualFilter, |
| | |
| | | } |
| | | // 清空批次相关值 |
| | | await formApi.setFieldValue('batchCode', undefined); |
| | | await formApi.setFieldValue('reelNo', undefined); |
| | | await formApi.setFieldValue('batchId', undefined); |
| | | await formApi.setFieldValue('produceDate', undefined); |
| | | await formApi.setFieldValue('expireDate', undefined); |
| | |
| | | }, |
| | | // 根据配置决定是否必填 |
| | | rules: z.string().optional(), |
| | | }, |
| | | { |
| | | fieldName: 'reelNo', |
| | | label: '盘号', |
| | | component: 'Input', |
| | | componentProps: { placeholder: '手工填写新批次盘号,留空表示无盘号', maxlength: 128 }, |
| | | dependencies: { |
| | | triggerFields: ['operateType', 'batchId'], |
| | | show: () => operateType.value === 1 && !hasExistingBatch.value, |
| | | }, |
| | | }, |
| | | // 生产日期(根据批次配置显示,仅入库) |
| | | { |
| | |
| | | areaId: values.areaId, |
| | | batchId: values.batchId, |
| | | batchCode: values.batchCode, |
| | | reelNo: values.batchId ? undefined : values.reelNo?.trim() || undefined, |
| | | produceDate: values.produceDate, |
| | | expireDate: values.expireDate, |
| | | receiptDate: values.receiptDate, |
| | |
| | | export function useLineFormSchema( |
| | | hasNotice: boolean, |
| | | formApi?: VbenFormApi, |
| | | orderItems: import('#/api/erp/sale/order').ErpSaleOrderApi.SaleOrderItem[] = [], |
| | | ): VbenFormSchema[] { |
| | | return [ |
| | | { |
| | | fieldName: 'saleOrderItemId', |
| | | label: '销售订单明细', |
| | | component: 'Select', |
| | | componentProps: { |
| | | placeholder: '请选择销售订单明细及盘号', |
| | | options: orderItems.map((item) => ({ |
| | | label: `${item.productName || ''}(盘号:${item.reelNo || '未填写'})`, |
| | | value: item.id, |
| | | })), |
| | | onChange: async (id?: number) => { |
| | | const item = orderItems.find((entry) => entry.id === id); |
| | | await formApi?.setFieldValue('itemId', item?.productId); |
| | | }, |
| | | }, |
| | | dependencies: { triggerFields: ['noticeId'], if: () => !hasNotice }, |
| | | rules: 'selectRequired', |
| | | }, |
| | | { |
| | | fieldName: 'noticeId', |
| | | component: 'Input', |
| | |
| | | }, |
| | | rules: 'selectRequired', |
| | | dependencies: { |
| | | triggerFields: ['noticeLineId'], |
| | | triggerFields: ['noticeLineId', 'saleOrderItemId'], |
| | | componentProps: (values) => ({ |
| | | disabled: !!values.noticeLineId, |
| | | disabled: !!values.noticeLineId || !!values.saleOrderItemId, |
| | | placeholder: '请选择产品', |
| | | }), |
| | | }, |
| | |
| | | triggerFields: ['itemId', 'batchId'], |
| | | componentProps: (values) => ({ |
| | | batchId: values.batchId, |
| | | itemId: values.itemId, |
| | | mdmItemId: values.itemId, |
| | | }), |
| | | }, |
| | | }, |
| | |
| | | import { message } from 'ant-design-vue'; |
| | | |
| | | import { useVbenForm } from '#/adapter/form'; |
| | | import { getProductSales } from '#/api/mes/wm/productsales'; |
| | | import { getSaleOrder } from '#/api/erp/sale/order'; |
| | | import { |
| | | createProductSalesLine, |
| | | getProductSalesLine, |
| | |
| | | }>(); |
| | | salesId.value = data.salesId; |
| | | noticeId.value = data.noticeId; |
| | | formApi.setState({ schema: useLineFormSchema(!!data.noticeId, formApi) }); |
| | | const sales = await getProductSales(data.salesId); |
| | | const order = sales.saleOrderId ? await getSaleOrder(sales.saleOrderId) : undefined; |
| | | formApi.setState({ schema: useLineFormSchema(!!data.noticeId, formApi, order?.items || []) }); |
| | | if (data.noticeId) { |
| | | await formApi.setFieldValue('noticeId', data.noticeId); |
| | | } |
| | |
| | | |
| | | /** 退货单行新增/修改的表单 */ |
| | | export function useLineFormSchema( |
| | | clientId?: number, |
| | | salesOrderCode?: string, |
| | | items?: ErpSaleOrderApi.SaleOrderItem[], |
| | | onItemChange?: (item: ErpSaleOrderApi.SaleOrderItem | undefined) => void, |
| | | ): VbenFormSchema[] { |
| | |
| | | return z |
| | | .number({ message: '请输入退货数量' }) |
| | | .min(0) |
| | | .max(max, `可退货数量不能超过 ${max}`); |
| | | .max(max, `退货数量不能超过订单数量 ${max}`); |
| | | } |
| | | return z.number({ message: '请输入退货数量' }).min(0); |
| | | }, |
| | |
| | | label: '批次', |
| | | component: markRaw(WmBatchSelect), |
| | | componentProps: { |
| | | clientId, |
| | | disabled: false, |
| | | placeholder: '请选择批次', |
| | | salesOrderCode, |
| | | }, |
| | | dependencies: { |
| | | triggerFields: ['itemId'], |
| | | componentProps: (values) => ({ |
| | | clientId, |
| | | disabled: !values.itemId, |
| | | itemId: values.itemId, |
| | | placeholder: '请选择批次', |
| | | salesOrderCode, |
| | | }), |
| | | }, |
| | | }, |
| | |
| | | maxQuantity.value = undefined; |
| | | formApi.setState({ |
| | | schema: useLineFormSchema( |
| | | data.clientId, |
| | | data.salesOrderCode, |
| | | data.items || [], |
| | | async (item) => { |
| | | maxQuantity.value = item?.count; |
| | |
| | | v-if="maxQuantity !== undefined" |
| | | class="mx-4 mt-2 text-sm text-blue-600" |
| | | > |
| | | 当前物料可退货数量:<span class="font-bold">{{ maxQuantity }}</span> |
| | | 当前物料订单数量:<span class="font-bold">{{ maxQuantity }}</span> |
| | | </div> |
| | | </Modal> |
| | | </template> |