feat: 装箱区点位表

This commit is contained in:
2026-08-10 16:38:17 +08:00
parent df24f4c88b
commit 2e1214fbff
17 changed files with 1396 additions and 1 deletions

View File

@@ -0,0 +1,72 @@
import type { PageParam, PageResult } from '@vben/request';
import { requestClient } from '#/api/request';
export namespace LmsPackagePointApi {
/** 装箱区点位库存信息 */
export interface PackagePoint {
pointId: number; // 库存记录标识
pointCode?: string; // 点位编码
pointName: string; // 点位名称
pointType: string; // 点位类型
containerName: string; // 子卷号
pointStatus: string; // 库存状态
vehicleCode: string; // 载具号
block: string; // 区块
pointLocation: string; // 位置
sortSeq?: number; // 顺序号
isUsed?: boolean; // 是否启用
remark: string; // 备注
plan: string; // 规划
rowNum: string; // 排
colNum: string; // 列
depth: string; // 深浅位0浅位1深位
waitPointType: string; // 所属等待点类型
updaterName?: string; // 更新者名称
updateTime?: string; // 更新时间
}
}
/** 查询装箱区点位库存分页 */
export function getPackagePointPage(params: PageParam) {
return requestClient.get<PageResult<LmsPackagePointApi.PackagePoint>>(
'/lms/package-point/page',
{ params },
);
}
/** 查询装箱区点位库存详情 */
export function getPackagePoint(id: number) {
return requestClient.get<LmsPackagePointApi.PackagePoint>(
`/lms/package-point/get?id=${id}`,
);
}
/** 新增装箱区点位库存 */
export function createPackagePoint(data: LmsPackagePointApi.PackagePoint) {
return requestClient.post('/lms/package-point/create', data);
}
/** 修改装箱区点位库存 */
export function updatePackagePoint(data: LmsPackagePointApi.PackagePoint) {
return requestClient.put('/lms/package-point/update', data);
}
/** 删除装箱区点位库存 */
export function deletePackagePoint(id: number) {
return requestClient.delete(`/lms/package-point/delete?id=${id}`);
}
/** 批量删除装箱区点位库存 */
export function deletePackagePointList(ids: number[]) {
return requestClient.delete(
`/lms/package-point/delete-list?ids=${ids.join(',')}`,
);
}
/** 导出装箱区点位库存 */
export function exportPackagePoint(params: any) {
return requestClient.download('/lms/package-point/export-excel', { params });
}

View File

@@ -0,0 +1,355 @@
import type {VbenFormSchema} from '#/adapter/form';
import type {VxeTableGridOptions} from '#/adapter/vxe-table';
import type {LmsPackagePointApi} from '#/api/lms/packagepoint';
import {DICT_TYPE} from "@vben/constants";
import {getDictOptions} from "@vben/hooks";
import {getRangePickerDefaultProps} from '#/utils';
/** 新增/修改的表单 */
export function useFormSchema(): VbenFormSchema[] {
return [
{
fieldName: 'point_id',
component: 'Input',
dependencies: {
triggerFields: [''],
show: () => false,
},
},
{
fieldName: 'pointCode',
label: '点位编码',
rules: 'required',
component: 'Input',
componentProps: {
placeholder: '请输入点位编码',
},
},
{
fieldName: 'pointName',
label: '点位名称',
component: 'Input',
componentProps: {
placeholder: '请输入点位名称',
},
},
{
fieldName: 'pointType',
label: '点位类型',
component: 'Select',
componentProps: {
options: getDictOptions(DICT_TYPE.BOX_POINT_TYPE),
placeholder: '请选择点位类型',
},
},
{
fieldName: 'containerName',
label: '子卷号',
component: 'Input',
componentProps: {
placeholder: '请输入子卷号',
},
},
{
fieldName: 'pointStatus',
label: '点位状态',
component: 'RadioGroup',
componentProps: {
options: getDictOptions(DICT_TYPE.BOX_POINT_STATUS),
buttonStyle: 'solid',
optionType: 'button',
defaultValue: "1"
},
},
{
fieldName: 'vehicleCode',
label: '载具号',
component: 'Input',
componentProps: {
placeholder: '请输入载具号',
},
},
{
fieldName: 'pointLocation',
label: '位置',
component: 'Input',
componentProps: {
placeholder: '请输入位置',
},
},
{
fieldName: 'sortSeq',
label: '顺序号',
rules: 'required',
component: 'Input',
componentProps: {
placeholder: '请输入顺序号',
},
},
{
fieldName: 'isUsed',
label: '是否启用',
rules: 'required',
component: 'RadioGroup',
componentProps: {
options: getDictOptions(DICT_TYPE.COMMON_TRUE_FALSE, "boolean"),
buttonStyle: 'solid',
optionType: 'button',
defaultValue: true,
},
},
{
fieldName: 'remark',
label: '备注',
component: 'Input',
componentProps: {
placeholder: '请输入备注',
},
},
{
fieldName: 'plan',
label: '规划',
component: 'Input',
componentProps: {
placeholder: '请输入规划',
},
},
{
fieldName: 'block',
label: '区块',
component: 'Input',
componentProps: {
placeholder: '请输入区块',
},
},
{
fieldName: 'rowNum',
label: '排',
component: 'Input',
componentProps: {
placeholder: '请输入排',
},
},
{
fieldName: 'colNum',
label: '列',
component: 'Input',
componentProps: {
placeholder: '请输入列',
},
},
{
fieldName: 'depth',
label: '深浅位',
component: 'Select',
componentProps: {
options: getDictOptions(DICT_TYPE.BOX_POINT_DEPTH),
placeholder: '请选择深浅位',
},
}
];
}
/** 列表的搜索表单 */
export function useGridFormSchema(): VbenFormSchema[] {
return [
{
fieldName: 'pointName',
label: '点位名称',
component: 'Input',
componentProps: {
allowClear: true,
placeholder: '请输入点位名称',
},
},
{
fieldName: 'pointType',
label: '点位类型',
component: 'Select',
componentProps: {
allowClear: true,
options: getDictOptions(DICT_TYPE.BOX_POINT_TYPE),
placeholder: '请选择点位类型',
},
},
{
fieldName: 'containerName',
label: '子卷号',
component: 'Input',
componentProps: {
allowClear: true,
placeholder: '请输入子卷号',
},
},
{
fieldName: 'pointStatus',
label: '点位状态',
component: 'Select',
componentProps: {
allowClear: true,
options: getDictOptions(DICT_TYPE.BOX_POINT_STATUS),
placeholder: '请选择库存状态',
},
},
{
fieldName: 'vehicleCode',
label: '载具号',
component: 'Input',
componentProps: {
allowClear: true,
placeholder: '请输入载具号',
},
},
{
fieldName: 'pointLocation',
label: '位置',
component: 'Input',
componentProps: {
allowClear: true,
placeholder: '请输入位置',
},
},
{
fieldName: 'sortSeq',
label: '顺序号',
component: 'Input',
componentProps: {
allowClear: true,
placeholder: '请输入顺序号',
},
},
{
fieldName: 'isUsed',
label: '是否启用',
component: 'Select',
componentProps: {
allowClear: true,
options: getDictOptions(DICT_TYPE.COMMON_TRUE_FALSE, "boolean"),
placeholder: '请选择是否启用',
},
},
{
fieldName: 'updateTime',
label: '更新时间',
component: 'RangePicker',
componentProps: {
...getRangePickerDefaultProps(),
allowClear: true,
},
},
];
}
/** 列表的字段 */
export function useGridColumns(): VxeTableGridOptions<LmsPackagePointApi.PackagePoint>['columns'] {
return [
{type: 'checkbox', width: 40},
{
field: 'pointCode',
title: '点位编码',
minWidth: 120,
},
{
field: 'pointName',
title: '点位名称',
minWidth: 120,
},
{
field: 'pointType',
title: '点位类型',
minWidth: 120,
cellRender: {
name: 'CellDict',
props: {
type: DICT_TYPE.BOX_POINT_TYPE
}
},
},
{
field: 'containerName',
title: '子卷号',
minWidth: 120,
},
{
field: 'pointStatus',
title: '点位状态',
minWidth: 120,
cellRender: {
name: 'CellDict',
props: {
type: DICT_TYPE.BOX_POINT_STATUS
}
},
},
{
field: 'vehicleCode',
title: '载具号',
minWidth: 120,
},
{
field: 'block',
title: '区块',
minWidth: 120,
},
{
field: 'pointLocation',
title: '位置',
minWidth: 120,
},
{
field: 'sortSeq',
title: '顺序号',
minWidth: 120,
},
{
field: 'isUsed',
title: '是否启用',
minWidth: 120,
},
{
field: 'remark',
title: '备注',
minWidth: 120,
},
{
field: 'plan',
title: '规划',
minWidth: 120,
},
{
field: 'rowNum',
title: '排',
minWidth: 120,
},
{
field: 'colNum',
title: '列',
minWidth: 120,
},
{
field: 'depth',
title: '深浅位',
minWidth: 120,
},
{
field: 'updaterName',
title: '更新人',
minWidth: 120,
},
{
field: 'updateTime',
title: '更新时间',
minWidth: 120,
formatter: 'formatDateTime',
},
{
title: '操作',
width: 200,
fixed: 'right',
slots: {default: 'actions'},
},
];
}

View File

@@ -0,0 +1,186 @@
<script lang="ts" setup>
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
import type { LmsPackagePointApi } from '#/api/lms/packagepoint';
import { ref } from 'vue';
import { confirm, Page, useVbenModal } from '@vben/common-ui';
import { downloadFileFromBlobPart, isEmpty } from '@vben/utils';
import { message } from 'antdv-next';
import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
import {
deletePackagePoint,
deletePackagePointList,
exportPackagePoint,
getPackagePointPage,
} from '#/api/lms/packagepoint';
import { $t } from '#/locales';
import { useGridColumns, useGridFormSchema } from './data';
import Form from './modules/form.vue';
const [FormModal, formModalApi] = useVbenModal({
connectedComponent: Form,
destroyOnClose: true,
});
/** 刷新表格 */
function handleRefresh() {
gridApi.query();
}
/** 创建装箱区点位库存 */
function handleCreate() {
formModalApi.setData(null).open();
}
/** 编辑装箱区点位库存 */
function handleEdit(row: LmsPackagePointApi.PackagePoint) {
formModalApi.setData(row).open();
}
/** 删除装箱区点位库存 */
async function handleDelete(row: LmsPackagePointApi.PackagePoint) {
const hideLoading = message.loading({
content: $t('ui.actionMessage.deleting', [row.pointId]),
duration: 0,
});
try {
await deletePackagePoint(row.pointId!);
message.success($t('ui.actionMessage.deleteSuccess', [row.pointId]));
handleRefresh();
} finally {
hideLoading();
}
}
/** 批量删除装箱区点位库存 */
async function handleDeleteBatch() {
await confirm($t('ui.actionMessage.deleteBatchConfirm'));
const hideLoading = message.loading({
content: $t('ui.actionMessage.deletingBatch'),
duration: 0,
});
try {
await deletePackagePointList(checkedIds.value);
checkedIds.value = [];
message.success($t('ui.actionMessage.deleteSuccess'));
handleRefresh();
} finally {
hideLoading();
}
}
const checkedIds = ref<number[]>([]);
function handleRowCheckboxChange({
records,
}: {
records: LmsPackagePointApi.PackagePoint[];
}) {
checkedIds.value = records.map((item) => item.pointId!);
}
/** 导出表格 */
async function handleExport() {
const data = await exportPackagePoint(await gridApi.formApi.getValues());
downloadFileFromBlobPart({ fileName: '装箱区点位库存.xls', source: data });
}
const [Grid, gridApi] = useVbenVxeGrid({
formOptions: {
schema: useGridFormSchema(),
},
gridOptions: {
columns: useGridColumns(),
height: 'auto',
keepSource: true,
proxyConfig: {
ajax: {
query: async ({ page }, formValues) => {
return await getPackagePointPage({
pageNo: page.currentPage,
pageSize: page.pageSize,
...formValues,
});
},
},
},
rowConfig: {
keyField: 'pointId',
isHover: true,
},
toolbarConfig: {
refresh: true,
search: true,
},
} as VxeTableGridOptions<LmsPackagePointApi.PackagePoint>,
gridEvents: {
checkboxAll: handleRowCheckboxChange,
checkboxChange: handleRowCheckboxChange,
},
});
</script>
<template>
<Page auto-content-height>
<FormModal @success="handleRefresh" />
<Grid table-title="装箱区点位列表">
<template #toolbar-tools>
<TableAction
:actions="[
{
label: $t('ui.actionTitle.create', ['装箱区点位']),
type: 'primary',
icon: ACTION_ICON.ADD,
auth: ['lms:package-point:create'],
onClick: handleCreate,
},
{
label: $t('ui.actionTitle.export'),
type: 'primary',
icon: ACTION_ICON.DOWNLOAD,
auth: ['lms:package-point:export'],
onClick: handleExport,
},
{
label: $t('ui.actionTitle.deleteBatch'),
type: 'primary',
danger: true,
icon: ACTION_ICON.DELETE,
auth: ['lms:package-point:delete'],
disabled: isEmpty(checkedIds),
onClick: handleDeleteBatch,
},
]"
/>
</template>
<template #actions="{ row }">
<TableAction
:actions="[
{
label: $t('common.edit'),
type: 'link',
icon: ACTION_ICON.EDIT,
auth: ['lms:package-point:update'],
onClick: handleEdit.bind(null, row),
},
{
label: $t('common.delete'),
type: 'link',
danger: true,
icon: ACTION_ICON.DELETE,
auth: ['lms:package-point:delete'],
popConfirm: {
title: $t('ui.actionMessage.deleteConfirm', [row.pointId]),
confirm: handleDelete.bind(null, row),
},
},
]"
/>
</template>
</Grid>
</Page>
</template>

View File

@@ -0,0 +1,82 @@
<script lang="ts" setup>
import type { LmsPackagePointApi } from '#/api/lms/packagepoint';
import { computed, ref } from 'vue';
import { useVbenModal } from '@vben/common-ui';
import { message } from 'antdv-next';
import { useVbenForm } from '#/adapter/form';
import { createPackagePoint, getPackagePoint, updatePackagePoint } from '#/api/lms/packagepoint';
import { $t } from '#/locales';
import { useFormSchema } from '../data';
const emit = defineEmits(['success']);
const formData = ref<LmsPackagePointApi.PackagePoint>();
const getTitle = computed(() => {
return formData.value?.id
? $t('ui.actionTitle.edit', ['装箱区点位库存'])
: $t('ui.actionTitle.create', ['装箱区点位库存']);
});
const [Form, formApi] = useVbenForm({
commonConfig: {
componentProps: {
class: 'w-full',
},
formItemClass: 'col-span-2',
labelWidth: 80,
},
layout: 'horizontal',
schema: useFormSchema(),
showDefaultActions: false,
});
const [Modal, modalApi] = useVbenModal({
async onConfirm() {
const { valid } = await formApi.validate();
if (!valid) {
return;
}
modalApi.lock();
// 提交表单
const data = (await formApi.getValues()) as LmsPackagePointApi.PackagePoint;
try {
await (formData.value?.id ? updatePackagePoint(data) : createPackagePoint(data));
// 关闭并提示
await modalApi.close();
emit('success');
message.success($t('ui.actionMessage.operationSuccess'));
} finally {
modalApi.unlock();
}
},
async onOpenChange(isOpen: boolean) {
if (!isOpen) {
formData.value = undefined;
return;
}
// 加载数据
const data = modalApi.getData<LmsPackagePointApi.PackagePoint>();
if (!data || !data.id) {
return;
}
modalApi.lock();
try {
formData.value = await getPackagePoint(data.id);
// 设置到 values
await formApi.setValues(formData.value);
} finally {
modalApi.unlock();
}
},
});
</script>
<template>
<Modal :title="getTitle">
<Form class="mx-4" />
</Modal>
</template>

View File

@@ -308,6 +308,13 @@ const RawFoil_DICT = {
RAWFOIL_WORKORDER_STATUS: 'rawfoil_workorder_status', // 生箔工序工单状态
} as const;
/** ========== LMS - 管理模块 ========== */
const LMS_DICT = {
BOX_POINT_TYPE: 'box_point_type', // 装箱点位类型
BOX_POINT_STATUS: 'box_point_status', // 装箱点位状态
BOX_POINT_DEPTH: 'box_point_depth', // 装箱点位深浅
} as const;
/** 字典类型枚举 - 统一导出 */
const DICT_TYPE = {
...AI_DICT,
@@ -327,6 +334,7 @@ const DICT_TYPE = {
...COMMON_DICT,
...TASK_DICT,
...RawFoil_DICT,
...LMS_DICT,
} as const;
export { DICT_TYPE };