From 751ba2c7825cf70a458b933c2b39554bacb23703 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Thu, 21 May 2026 11:10:21 +0800 Subject: [PATCH] =?UTF-8?q?feat(mes):=20=E8=BF=81=E7=A7=BB=E5=B7=A5?= =?UTF-8?q?=E4=BD=9C=E7=AB=99=E7=AE=A1=E7=90=86=E5=8F=8A=E8=AE=BE=E5=A4=87?= =?UTF-8?q?=E3=80=81=E5=B7=A5=E5=85=B7=E3=80=81=E4=BA=BA=E5=91=98=E5=85=B3?= =?UTF-8?q?=E8=81=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/api/mes/dv/machinery/index.ts | 45 ++ .../src/api/mes/md/workstation/index.ts | 58 +++ .../api/mes/md/workstation/machine/index.ts | 35 ++ .../src/api/mes/md/workstation/tool/index.ts | 41 ++ .../api/mes/md/workstation/worker/index.ts | 41 ++ .../src/api/mes/tm/tool/type/index.ts | 39 ++ .../src/api/mes/wm/warehouse/area/index.ts | 50 ++ .../src/api/mes/wm/warehouse/index.ts | 40 ++ .../api/mes/wm/warehouse/location/index.ts | 40 ++ apps/web-antd/src/utils/index.ts | 1 - apps/web-antd/src/views/mes/md/client/data.ts | 479 ++++++++++++++++++ .../mes/md/workstation/components/index.ts | 3 + .../components/md-workshop-select.vue | 111 ++++ .../md-workstation-select-dialog.vue | 187 +++++++ .../components/md-workstation-select.vue | 143 ++++++ .../src/views/mes/md/workstation/data.ts | 351 +++++++++++++ .../src/views/mes/md/workstation/index.vue | 189 +++++++ .../views/mes/md/workstation/modules/form.vue | 162 ++++++ .../md/workstation/modules/machine-list.vue | 212 ++++++++ .../mes/md/workstation/modules/tool-list.vue | 226 +++++++++ .../md/workstation/modules/worker-list.vue | 222 ++++++++ .../web-antd/src/views/mes/utils/constants.ts | 1 + .../web-ele/src/api/mes/dv/machinery/index.ts | 45 ++ .../src/api/mes/md/workstation/index.ts | 58 +++ .../api/mes/md/workstation/machine/index.ts | 35 ++ .../src/api/mes/md/workstation/tool/index.ts | 41 ++ .../api/mes/md/workstation/worker/index.ts | 41 ++ .../web-ele/src/api/mes/tm/tool/type/index.ts | 39 ++ .../src/api/mes/wm/warehouse/area/index.ts | 50 ++ .../web-ele/src/api/mes/wm/warehouse/index.ts | 40 ++ .../api/mes/wm/warehouse/location/index.ts | 40 ++ .../mes/md/workstation/components/index.ts | 3 + .../components/md-workshop-select.vue | 117 +++++ .../md-workstation-select-dialog.vue | 190 +++++++ .../components/md-workstation-select.vue | 141 ++++++ .../src/views/mes/md/workstation/data.ts | 348 +++++++++++++ .../src/views/mes/md/workstation/index.vue | 190 +++++++ .../views/mes/md/workstation/modules/form.vue | 162 ++++++ .../md/workstation/modules/machine-list.vue | 213 ++++++++ .../mes/md/workstation/modules/tool-list.vue | 232 +++++++++ .../md/workstation/modules/worker-list.vue | 228 +++++++++ apps/web-ele/src/views/mes/utils/constants.ts | 1 + 42 files changed, 4889 insertions(+), 1 deletion(-) create mode 100644 apps/web-antd/src/api/mes/dv/machinery/index.ts create mode 100644 apps/web-antd/src/api/mes/md/workstation/index.ts create mode 100644 apps/web-antd/src/api/mes/md/workstation/machine/index.ts create mode 100644 apps/web-antd/src/api/mes/md/workstation/tool/index.ts create mode 100644 apps/web-antd/src/api/mes/md/workstation/worker/index.ts create mode 100644 apps/web-antd/src/api/mes/tm/tool/type/index.ts create mode 100644 apps/web-antd/src/api/mes/wm/warehouse/area/index.ts create mode 100644 apps/web-antd/src/api/mes/wm/warehouse/index.ts create mode 100644 apps/web-antd/src/api/mes/wm/warehouse/location/index.ts create mode 100644 apps/web-antd/src/views/mes/md/client/data.ts create mode 100644 apps/web-antd/src/views/mes/md/workstation/components/index.ts create mode 100644 apps/web-antd/src/views/mes/md/workstation/components/md-workshop-select.vue create mode 100644 apps/web-antd/src/views/mes/md/workstation/components/md-workstation-select-dialog.vue create mode 100644 apps/web-antd/src/views/mes/md/workstation/components/md-workstation-select.vue create mode 100644 apps/web-antd/src/views/mes/md/workstation/data.ts create mode 100644 apps/web-antd/src/views/mes/md/workstation/index.vue create mode 100644 apps/web-antd/src/views/mes/md/workstation/modules/form.vue create mode 100644 apps/web-antd/src/views/mes/md/workstation/modules/machine-list.vue create mode 100644 apps/web-antd/src/views/mes/md/workstation/modules/tool-list.vue create mode 100644 apps/web-antd/src/views/mes/md/workstation/modules/worker-list.vue create mode 100644 apps/web-ele/src/api/mes/dv/machinery/index.ts create mode 100644 apps/web-ele/src/api/mes/md/workstation/index.ts create mode 100644 apps/web-ele/src/api/mes/md/workstation/machine/index.ts create mode 100644 apps/web-ele/src/api/mes/md/workstation/tool/index.ts create mode 100644 apps/web-ele/src/api/mes/md/workstation/worker/index.ts create mode 100644 apps/web-ele/src/api/mes/tm/tool/type/index.ts create mode 100644 apps/web-ele/src/api/mes/wm/warehouse/area/index.ts create mode 100644 apps/web-ele/src/api/mes/wm/warehouse/index.ts create mode 100644 apps/web-ele/src/api/mes/wm/warehouse/location/index.ts create mode 100644 apps/web-ele/src/views/mes/md/workstation/components/index.ts create mode 100644 apps/web-ele/src/views/mes/md/workstation/components/md-workshop-select.vue create mode 100644 apps/web-ele/src/views/mes/md/workstation/components/md-workstation-select-dialog.vue create mode 100644 apps/web-ele/src/views/mes/md/workstation/components/md-workstation-select.vue create mode 100644 apps/web-ele/src/views/mes/md/workstation/data.ts create mode 100644 apps/web-ele/src/views/mes/md/workstation/index.vue create mode 100644 apps/web-ele/src/views/mes/md/workstation/modules/form.vue create mode 100644 apps/web-ele/src/views/mes/md/workstation/modules/machine-list.vue create mode 100644 apps/web-ele/src/views/mes/md/workstation/modules/tool-list.vue create mode 100644 apps/web-ele/src/views/mes/md/workstation/modules/worker-list.vue diff --git a/apps/web-antd/src/api/mes/dv/machinery/index.ts b/apps/web-antd/src/api/mes/dv/machinery/index.ts new file mode 100644 index 000000000..e4c02f1c4 --- /dev/null +++ b/apps/web-antd/src/api/mes/dv/machinery/index.ts @@ -0,0 +1,45 @@ +import type { PageParam, PageResult } from '@vben/request'; + +import { requestClient } from '#/api/request'; + +export namespace MesDvMachineryApi { + /** MES 设备台账 */ + export interface Machinery { + id?: number; // 设备编号 + code?: string; // 设备编码 + name?: string; // 设备名称 + brand?: string; // 品牌 + specification?: string; // 规格型号 + machineryTypeId?: number; // 设备类型编号 + machineryTypeName?: string; // 设备类型名称 + workshopId?: number; // 所属车间编号 + workshopName?: string; // 所属车间名称 + status?: number; // 设备状态 + lastMaintenTime?: Date; // 最近保养时间 + lastCheckTime?: Date; // 最近点检时间 + remark?: string; // 备注 + createTime?: Date; // 创建时间 + } +} + +/** 查询设备分页 */ +export function getMachineryPage(params: PageParam) { + return requestClient.get>( + '/mes/dv/machinery/page', + { params }, + ); +} + +/** 查询设备精简列表 */ +export function getMachinerySimpleList() { + return requestClient.get( + '/mes/dv/machinery/simple-list', + ); +} + +/** 查询设备详情 */ +export function getMachinery(id: number) { + return requestClient.get( + `/mes/dv/machinery/get?id=${id}`, + ); +} diff --git a/apps/web-antd/src/api/mes/md/workstation/index.ts b/apps/web-antd/src/api/mes/md/workstation/index.ts new file mode 100644 index 000000000..4880f3bbe --- /dev/null +++ b/apps/web-antd/src/api/mes/md/workstation/index.ts @@ -0,0 +1,58 @@ +import type { PageParam, PageResult } from '@vben/request'; + +import { requestClient } from '#/api/request'; + +export namespace MesMdWorkstationApi { + /** MES 工作站 */ + export interface Workstation { + id?: number; // 工作站编号 + code?: string; // 工作站编码 + name?: string; // 工作站名称 + address?: string; // 工作站地点 + workshopId?: number; // 所在车间编号 + workshopName?: string; // 所在车间名称 + processId?: number; // 工序编号 + processName?: string; // 工序名称 + warehouseId?: number; // 线边库编号 + locationId?: number; // 库区编号 + areaId?: number; // 库位编号 + status?: number; // 状态 + remark?: string; // 备注 + createTime?: Date; // 创建时间 + } +} + +/** 查询工作站分页 */ +export function getWorkstationPage(params: PageParam) { + return requestClient.get>( + '/mes/md-workstation/page', + { params }, + ); +} + +/** 查询工作站详情 */ +export function getWorkstation(id: number) { + return requestClient.get( + `/mes/md-workstation/get?id=${id}`, + ); +} + +/** 新增工作站 */ +export function createWorkstation(data: MesMdWorkstationApi.Workstation) { + return requestClient.post('/mes/md-workstation/create', data); +} + +/** 修改工作站 */ +export function updateWorkstation(data: MesMdWorkstationApi.Workstation) { + return requestClient.put('/mes/md-workstation/update', data); +} + +/** 删除工作站 */ +export function deleteWorkstation(id: number) { + return requestClient.delete(`/mes/md-workstation/delete?id=${id}`); +} + +/** 导出工作站 */ +export function exportWorkstation(params: any) { + return requestClient.download('/mes/md-workstation/export-excel', { params }); +} diff --git a/apps/web-antd/src/api/mes/md/workstation/machine/index.ts b/apps/web-antd/src/api/mes/md/workstation/machine/index.ts new file mode 100644 index 000000000..40dd8692b --- /dev/null +++ b/apps/web-antd/src/api/mes/md/workstation/machine/index.ts @@ -0,0 +1,35 @@ +import { requestClient } from '#/api/request'; + +export namespace MesMdWorkstationMachineApi { + /** MES 工作站设备资源 */ + export interface WorkstationMachine { + id?: number; // 资源编号 + workstationId?: number; // 工作站编号 + machineryId?: number; // 设备编号 + machineryCode?: string; // 设备编码 + machineryName?: string; // 设备名称 + quantity?: number; // 数量 + remark?: string; // 备注 + createTime?: Date; // 创建时间 + } +} + +/** 查询工作站设备资源列表 */ +export function getWorkstationMachineList(workstationId: number) { + return requestClient.get( + '/mes/md-workstation-machine/list-by-workstation', + { params: { workstationId } }, + ); +} + +/** 新增工作站设备资源 */ +export function createWorkstationMachine( + data: MesMdWorkstationMachineApi.WorkstationMachine, +) { + return requestClient.post('/mes/md-workstation-machine/create', data); +} + +/** 删除工作站设备资源 */ +export function deleteWorkstationMachine(id: number) { + return requestClient.delete(`/mes/md-workstation-machine/delete?id=${id}`); +} diff --git a/apps/web-antd/src/api/mes/md/workstation/tool/index.ts b/apps/web-antd/src/api/mes/md/workstation/tool/index.ts new file mode 100644 index 000000000..d98e5f122 --- /dev/null +++ b/apps/web-antd/src/api/mes/md/workstation/tool/index.ts @@ -0,0 +1,41 @@ +import { requestClient } from '#/api/request'; + +export namespace MesMdWorkstationToolApi { + /** MES 工作站工装夹具资源 */ + export interface WorkstationTool { + id?: number; // 资源编号 + workstationId?: number; // 工作站编号 + toolTypeId?: number; // 工具类型编号 + toolTypeName?: string; // 工具类型名称 + quantity?: number; // 数量 + remark?: string; // 备注 + createTime?: Date; // 创建时间 + } +} + +/** 查询工作站工装夹具资源列表 */ +export function getWorkstationToolList(workstationId: number) { + return requestClient.get( + '/mes/md-workstation-tool/list-by-workstation', + { params: { workstationId } }, + ); +} + +/** 新增工作站工装夹具资源 */ +export function createWorkstationTool( + data: MesMdWorkstationToolApi.WorkstationTool, +) { + return requestClient.post('/mes/md-workstation-tool/create', data); +} + +/** 修改工作站工装夹具资源 */ +export function updateWorkstationTool( + data: MesMdWorkstationToolApi.WorkstationTool, +) { + return requestClient.put('/mes/md-workstation-tool/update', data); +} + +/** 删除工作站工装夹具资源 */ +export function deleteWorkstationTool(id: number) { + return requestClient.delete(`/mes/md-workstation-tool/delete?id=${id}`); +} diff --git a/apps/web-antd/src/api/mes/md/workstation/worker/index.ts b/apps/web-antd/src/api/mes/md/workstation/worker/index.ts new file mode 100644 index 000000000..3bd4ab9ad --- /dev/null +++ b/apps/web-antd/src/api/mes/md/workstation/worker/index.ts @@ -0,0 +1,41 @@ +import { requestClient } from '#/api/request'; + +export namespace MesMdWorkstationWorkerApi { + /** MES 工作站人力资源 */ + export interface WorkstationWorker { + id?: number; // 资源编号 + workstationId?: number; // 工作站编号 + postId?: number; // 岗位编号 + postName?: string; // 岗位名称 + quantity?: number; // 数量 + remark?: string; // 备注 + createTime?: Date; // 创建时间 + } +} + +/** 查询工作站人力资源列表 */ +export function getWorkstationWorkerList(workstationId: number) { + return requestClient.get( + '/mes/md-workstation-worker/list-by-workstation', + { params: { workstationId } }, + ); +} + +/** 新增工作站人力资源 */ +export function createWorkstationWorker( + data: MesMdWorkstationWorkerApi.WorkstationWorker, +) { + return requestClient.post('/mes/md-workstation-worker/create', data); +} + +/** 修改工作站人力资源 */ +export function updateWorkstationWorker( + data: MesMdWorkstationWorkerApi.WorkstationWorker, +) { + return requestClient.put('/mes/md-workstation-worker/update', data); +} + +/** 删除工作站人力资源 */ +export function deleteWorkstationWorker(id: number) { + return requestClient.delete(`/mes/md-workstation-worker/delete?id=${id}`); +} diff --git a/apps/web-antd/src/api/mes/tm/tool/type/index.ts b/apps/web-antd/src/api/mes/tm/tool/type/index.ts new file mode 100644 index 000000000..cced608cc --- /dev/null +++ b/apps/web-antd/src/api/mes/tm/tool/type/index.ts @@ -0,0 +1,39 @@ +import type { PageParam, PageResult } from '@vben/request'; + +import { requestClient } from '#/api/request'; + +export namespace MesTmToolTypeApi { + /** MES 工具类型 */ + export interface ToolType { + id?: number; // 工具类型编号 + code?: string; // 类型编码 + name?: string; // 类型名称 + codeFlag?: boolean; // 是否编码管理 + maintenType?: number; // 保养维护类型 + maintenPeriod?: number; // 保养周期 + remark?: string; // 备注 + createTime?: Date; // 创建时间 + } +} + +/** 查询工具类型分页 */ +export function getToolTypePage(params: PageParam) { + return requestClient.get>( + '/mes/tm/tool-type/page', + { params }, + ); +} + +/** 查询工具类型精简列表 */ +export function getToolTypeSimpleList() { + return requestClient.get( + '/mes/tm/tool-type/simple-list', + ); +} + +/** 查询工具类型详情 */ +export function getToolType(id: number) { + return requestClient.get( + `/mes/tm/tool-type/get?id=${id}`, + ); +} diff --git a/apps/web-antd/src/api/mes/wm/warehouse/area/index.ts b/apps/web-antd/src/api/mes/wm/warehouse/area/index.ts new file mode 100644 index 000000000..cf5844ade --- /dev/null +++ b/apps/web-antd/src/api/mes/wm/warehouse/area/index.ts @@ -0,0 +1,50 @@ +import type { PageParam, PageResult } from '@vben/request'; + +import { requestClient } from '#/api/request'; + +export namespace MesWmWarehouseAreaApi { + /** MES 库位 */ + export interface WarehouseArea { + id?: number; // 库位编号 + code?: string; // 库位编码 + name?: string; // 库位名称 + warehouseId?: number; // 仓库编号 + warehouseName?: string; // 仓库名称 + locationId?: number; // 库区编号 + locationName?: string; // 库区名称 + area?: number; // 面积 + maxLoad?: number; // 最大载荷 + positionX?: number; // X 坐标 + positionY?: number; // Y 坐标 + positionZ?: number; // Z 坐标 + status?: number; // 状态 + frozen?: boolean; // 是否冻结 + allowItemMixing?: boolean; // 是否允许物料混放 + allowBatchMixing?: boolean; // 是否允许批次混放 + remark?: string; // 备注 + createTime?: Date; // 创建时间 + } +} + +/** 查询库位分页 */ +export function getWarehouseAreaPage(params: PageParam) { + return requestClient.get>( + '/mes/wm/warehouse-area/page', + { params }, + ); +} + +/** 查询库位精简列表 */ +export function getWarehouseAreaSimpleList(locationId?: number) { + return requestClient.get( + '/mes/wm/warehouse-area/simple-list', + { params: { locationId } }, + ); +} + +/** 查询库位详情 */ +export function getWarehouseArea(id: number) { + return requestClient.get( + `/mes/wm/warehouse-area/get?id=${id}`, + ); +} diff --git a/apps/web-antd/src/api/mes/wm/warehouse/index.ts b/apps/web-antd/src/api/mes/wm/warehouse/index.ts new file mode 100644 index 000000000..f68604790 --- /dev/null +++ b/apps/web-antd/src/api/mes/wm/warehouse/index.ts @@ -0,0 +1,40 @@ +import type { PageParam, PageResult } from '@vben/request'; + +import { requestClient } from '#/api/request'; + +export namespace MesWmWarehouseApi { + /** MES 仓库 */ + export interface Warehouse { + id?: number; // 仓库编号 + code?: string; // 仓库编码 + name?: string; // 仓库名称 + address?: string; // 地址 + area?: number; // 面积 + chargeUserId?: number; // 负责人 + frozen?: boolean; // 是否冻结 + remark?: string; // 备注 + createTime?: Date; // 创建时间 + } +} + +/** 查询仓库分页 */ +export function getWarehousePage(params: PageParam) { + return requestClient.get>( + '/mes/wm/warehouse/page', + { params }, + ); +} + +/** 查询仓库精简列表 */ +export function getWarehouseSimpleList() { + return requestClient.get( + '/mes/wm/warehouse/simple-list', + ); +} + +/** 查询仓库详情 */ +export function getWarehouse(id: number) { + return requestClient.get( + `/mes/wm/warehouse/get?id=${id}`, + ); +} diff --git a/apps/web-antd/src/api/mes/wm/warehouse/location/index.ts b/apps/web-antd/src/api/mes/wm/warehouse/location/index.ts new file mode 100644 index 000000000..e33fb180e --- /dev/null +++ b/apps/web-antd/src/api/mes/wm/warehouse/location/index.ts @@ -0,0 +1,40 @@ +import type { PageParam, PageResult } from '@vben/request'; + +import { requestClient } from '#/api/request'; + +export namespace MesWmWarehouseLocationApi { + /** MES 库区 */ + export interface WarehouseLocation { + id?: number; // 库区编号 + code?: string; // 库区编码 + name?: string; // 库区名称 + warehouseId?: number; // 仓库编号 + warehouseName?: string; // 仓库名称 + area?: number; // 面积 + frozen?: boolean; // 是否冻结 + remark?: string; // 备注 + createTime?: Date; // 创建时间 + } +} + +/** 查询库区分页 */ +export function getWarehouseLocationPage(params: PageParam) { + return requestClient.get< + PageResult + >('/mes/wm/warehouse-location/page', { params }); +} + +/** 查询库区精简列表 */ +export function getWarehouseLocationSimpleList(warehouseId?: number) { + return requestClient.get( + '/mes/wm/warehouse-location/simple-list', + { params: { warehouseId } }, + ); +} + +/** 查询库区详情 */ +export function getWarehouseLocation(id: number) { + return requestClient.get( + `/mes/wm/warehouse-location/get?id=${id}`, + ); +} diff --git a/apps/web-antd/src/utils/index.ts b/apps/web-antd/src/utils/index.ts index 5f3457367..0a4c03ca5 100644 --- a/apps/web-antd/src/utils/index.ts +++ b/apps/web-antd/src/utils/index.ts @@ -1,6 +1,5 @@ import type { Recordable } from '@vben/types'; -export * from './cron'; export * from './rangePickerProps'; export * from './routerHelper'; diff --git a/apps/web-antd/src/views/mes/md/client/data.ts b/apps/web-antd/src/views/mes/md/client/data.ts new file mode 100644 index 000000000..6da0f7764 --- /dev/null +++ b/apps/web-antd/src/views/mes/md/client/data.ts @@ -0,0 +1,479 @@ +import type { VbenFormSchema } from '#/adapter/form'; +import type { VxeTableGridOptions } from '#/adapter/vxe-table'; +import type { MesMdClientApi } from '#/api/mes/md/client'; + +import { h } from 'vue'; + +import { CommonStatusEnum, DICT_TYPE } from '@vben/constants'; +import { getDictOptions } from '@vben/hooks'; + +import { Button } from 'ant-design-vue'; + +import { z } from '#/adapter/form'; +import { generateAutoCode } from '#/api/mes/md/autocode/record'; +import { MesAutoCodeRuleCode } from '#/views/mes/utils/constants'; + +/** 新增/修改客户的表单 */ +export function useFormSchema(formApi?: any): VbenFormSchema[] { + return [ + { + fieldName: 'id', + component: 'Input', + dependencies: { + triggerFields: [''], + show: () => false, + }, + }, + { + fieldName: 'code', + label: '客户编码', + component: 'Input', + componentProps: { + placeholder: '请输入客户编码', + }, + dependencies: { + triggerFields: ['id'], + componentProps: (values) => ({ + disabled: !!values.id, + }), + }, + rules: 'required', + suffix: () => + h( + Button, + { + type: 'default', + onClick: async () => { + try { + const code = await generateAutoCode( + MesAutoCodeRuleCode.MD_CLIENT_CODE, + ); + await formApi?.setFieldValue('code', code); + } catch (error) { + console.error(error); + } + }, + }, + { default: () => '自动生成' }, + ), + }, + { + fieldName: 'name', + label: '客户名称', + component: 'Input', + componentProps: { + placeholder: '请输入客户名称', + }, + rules: z.string().min(1, '客户名称不能为空').max(100), + }, + { + fieldName: 'nickname', + label: '客户简称', + component: 'Input', + componentProps: { + placeholder: '请输入客户简称', + }, + }, + { + fieldName: 'englishName', + label: '客户英文名称', + component: 'Input', + componentProps: { + placeholder: '请输入客户英文名称', + }, + }, + { + fieldName: 'type', + label: '客户类型', + component: 'Select', + componentProps: { + allowClear: true, + options: getDictOptions(DICT_TYPE.MES_CLIENT_TYPE, 'number'), + placeholder: '请选择客户类型', + }, + rules: 'selectRequired', + }, + { + fieldName: 'description', + label: '客户简介', + component: 'Textarea', + formItemClass: 'col-span-3', + componentProps: { + placeholder: '请输入客户简介', + rows: 2, + }, + }, + { + fieldName: 'address', + label: '客户地址', + component: 'Textarea', + formItemClass: 'col-span-3', + componentProps: { + placeholder: '请输入客户地址', + rows: 2, + }, + }, + { + fieldName: 'website', + label: '客户官网地址', + component: 'Input', + componentProps: { + placeholder: '请输入客户官网地址', + }, + }, + { + fieldName: 'email', + label: '客户邮箱地址', + component: 'Input', + componentProps: { + placeholder: '请输入客户邮箱地址', + }, + rules: z.string().email('邮箱格式不正确').or(z.literal('')).optional(), + }, + { + fieldName: 'telephone', + label: '客户电话', + component: 'Input', + componentProps: { + placeholder: '请输入客户电话', + }, + }, + { + fieldName: 'logo', + label: '客户 LOGO', + component: 'Input', + componentProps: { + placeholder: '请输入客户 LOGO 地址', + }, + }, + { + fieldName: 'contact1Name', + label: '联系人1', + component: 'Input', + componentProps: { + placeholder: '请输入联系人1', + }, + }, + { + fieldName: 'contact1Telephone', + label: '联系人1电话', + component: 'Input', + componentProps: { + placeholder: '请输入联系人1电话', + }, + }, + { + fieldName: 'contact1Email', + label: '联系人1邮箱', + component: 'Input', + componentProps: { + placeholder: '请输入联系人1邮箱', + }, + rules: z.string().email('邮箱格式不正确').or(z.literal('')).optional(), + }, + { + fieldName: 'contact2Name', + label: '联系人2', + component: 'Input', + componentProps: { + placeholder: '请输入联系人2', + }, + }, + { + fieldName: 'contact2Telephone', + label: '联系人2电话', + component: 'Input', + componentProps: { + placeholder: '请输入联系人2电话', + }, + }, + { + fieldName: 'contact2Email', + label: '联系人2邮箱', + component: 'Input', + componentProps: { + placeholder: '请输入联系人2邮箱', + }, + rules: z.string().email('邮箱格式不正确').or(z.literal('')).optional(), + }, + { + fieldName: 'creditCode', + label: '社会信用代码', + component: 'Input', + componentProps: { + placeholder: '请输入统一社会信用代码', + }, + }, + { + fieldName: 'status', + label: '状态', + component: 'RadioGroup', + componentProps: { + buttonStyle: 'solid', + optionType: 'button', + options: getDictOptions(DICT_TYPE.COMMON_STATUS, 'number'), + }, + rules: z.number().default(CommonStatusEnum.ENABLE), + }, + { + fieldName: 'remark', + label: '备注', + component: 'Textarea', + formItemClass: 'col-span-3', + componentProps: { + placeholder: '请输入备注', + rows: 3, + }, + }, + ]; +} + +/** 导入客户的表单 */ +export function useImportFormSchema(): VbenFormSchema[] { + return [ + { + fieldName: 'file', + label: '客户数据', + component: 'Upload', + rules: 'required', + help: '仅允许导入 xls、xlsx 格式文件', + }, + { + fieldName: 'updateSupport', + label: '是否覆盖', + component: 'Switch', + componentProps: { + checkedChildren: '是', + unCheckedChildren: '否', + }, + rules: z.boolean().default(false), + help: '是否更新已经存在的客户数据', + }, + ]; +} + +/** 列表的搜索表单 */ +export function useGridFormSchema(): VbenFormSchema[] { + return [ + { + fieldName: 'code', + label: '客户编码', + component: 'Input', + componentProps: { + allowClear: true, + placeholder: '请输入客户编码', + }, + }, + { + fieldName: 'name', + label: '客户名称', + component: 'Input', + componentProps: { + allowClear: true, + placeholder: '请输入客户名称', + }, + }, + { + fieldName: 'nickname', + label: '客户简称', + component: 'Input', + componentProps: { + allowClear: true, + placeholder: '请输入客户简称', + }, + }, + { + fieldName: 'englishName', + label: '英文名称', + component: 'Input', + componentProps: { + allowClear: true, + placeholder: '请输入客户英文名称', + }, + }, + { + fieldName: 'type', + label: '客户类型', + component: 'Select', + componentProps: { + allowClear: true, + options: getDictOptions(DICT_TYPE.MES_CLIENT_TYPE, 'number'), + placeholder: '请选择客户类型', + }, + }, + { + fieldName: 'status', + label: '状态', + component: 'Select', + componentProps: { + allowClear: true, + options: getDictOptions(DICT_TYPE.COMMON_STATUS, 'number'), + placeholder: '请选择状态', + }, + }, + ]; +} + +/** 列表的字段 */ +export function useGridColumns(): VxeTableGridOptions['columns'] { + return [ + { + field: 'code', + title: '客户编码', + minWidth: 150, + slots: { default: 'code' }, + }, + { + field: 'name', + title: '客户名称', + minWidth: 160, + }, + { + field: 'nickname', + title: '客户简称', + minWidth: 130, + }, + { + field: 'type', + title: '客户类型', + width: 120, + cellRender: { + name: 'CellDict', + props: { type: DICT_TYPE.MES_CLIENT_TYPE }, + }, + }, + { + field: 'telephone', + title: '客户电话', + minWidth: 140, + }, + { + field: 'contact1Name', + title: '联系人1', + width: 120, + }, + { + field: 'contact1Telephone', + title: '联系人1电话', + minWidth: 140, + }, + { + field: 'status', + title: '状态', + width: 120, + cellRender: { + name: 'CellDict', + props: { type: DICT_TYPE.COMMON_STATUS }, + }, + }, + { + field: 'createTime', + title: '创建时间', + width: 180, + formatter: 'formatDateTime', + }, + { + title: '操作', + width: 160, + fixed: 'right', + slots: { default: 'actions' }, + }, + ]; +} + +/** 客户选择弹窗的搜索表单 */ +export function useClientSelectGridFormSchema(): VbenFormSchema[] { + return [ + { + fieldName: 'code', + label: '客户编码', + component: 'Input', + componentProps: { + allowClear: true, + placeholder: '请输入客户编码', + }, + }, + { + fieldName: 'name', + label: '客户名称', + component: 'Input', + componentProps: { + allowClear: true, + placeholder: '请输入客户名称', + }, + }, + { + fieldName: 'nickname', + label: '客户简称', + component: 'Input', + componentProps: { + allowClear: true, + placeholder: '请输入客户简称', + }, + }, + { + fieldName: 'englishName', + label: '英文名称', + component: 'Input', + componentProps: { + allowClear: true, + placeholder: '请输入客户英文名称', + }, + }, + ]; +} + +/** 客户选择弹窗的字段 */ +export function useClientSelectGridColumns(): VxeTableGridOptions['columns'] { + return [ + { type: 'checkbox', width: 50 }, + { + field: 'code', + title: '客户编码', + minWidth: 160, + }, + { + field: 'name', + title: '客户名称', + minWidth: 160, + }, + { + field: 'nickname', + title: '客户简称', + width: 120, + }, + { + field: 'type', + title: '客户类型', + width: 110, + cellRender: { + name: 'CellDict', + props: { type: DICT_TYPE.MES_CLIENT_TYPE }, + }, + }, + { + field: 'contact1Name', + title: '联系人', + width: 120, + }, + { + field: 'telephone', + title: '联系电话', + width: 140, + }, + { + field: 'contact1Telephone', + title: '联系人电话', + width: 140, + }, + { + field: 'status', + title: '状态', + width: 100, + cellRender: { + name: 'CellDict', + props: { type: DICT_TYPE.COMMON_STATUS }, + }, + }, + ]; +} diff --git a/apps/web-antd/src/views/mes/md/workstation/components/index.ts b/apps/web-antd/src/views/mes/md/workstation/components/index.ts new file mode 100644 index 000000000..b5855ec6f --- /dev/null +++ b/apps/web-antd/src/views/mes/md/workstation/components/index.ts @@ -0,0 +1,3 @@ +export { default as MdWorkshopSelect } from './md-workshop-select.vue'; +export { default as MdWorkstationSelectDialog } from './md-workstation-select-dialog.vue'; +export { default as MdWorkstationSelect } from './md-workstation-select.vue'; diff --git a/apps/web-antd/src/views/mes/md/workstation/components/md-workshop-select.vue b/apps/web-antd/src/views/mes/md/workstation/components/md-workshop-select.vue new file mode 100644 index 000000000..b76b9c92a --- /dev/null +++ b/apps/web-antd/src/views/mes/md/workstation/components/md-workshop-select.vue @@ -0,0 +1,111 @@ + + + diff --git a/apps/web-antd/src/views/mes/md/workstation/components/md-workstation-select-dialog.vue b/apps/web-antd/src/views/mes/md/workstation/components/md-workstation-select-dialog.vue new file mode 100644 index 000000000..182e47285 --- /dev/null +++ b/apps/web-antd/src/views/mes/md/workstation/components/md-workstation-select-dialog.vue @@ -0,0 +1,187 @@ + + + diff --git a/apps/web-antd/src/views/mes/md/workstation/components/md-workstation-select.vue b/apps/web-antd/src/views/mes/md/workstation/components/md-workstation-select.vue new file mode 100644 index 000000000..a7d2886ed --- /dev/null +++ b/apps/web-antd/src/views/mes/md/workstation/components/md-workstation-select.vue @@ -0,0 +1,143 @@ + + + diff --git a/apps/web-antd/src/views/mes/md/workstation/data.ts b/apps/web-antd/src/views/mes/md/workstation/data.ts new file mode 100644 index 000000000..75248e2fc --- /dev/null +++ b/apps/web-antd/src/views/mes/md/workstation/data.ts @@ -0,0 +1,351 @@ +import type { VbenFormSchema } from '#/adapter/form'; +import type { VxeTableGridOptions } from '#/adapter/vxe-table'; +import type { MesMdWorkstationApi } from '#/api/mes/md/workstation'; + +import { h, markRaw } from 'vue'; + +import { CommonStatusEnum, DICT_TYPE } from '@vben/constants'; +import { getDictOptions } from '@vben/hooks'; + +import { Button } from 'ant-design-vue'; + +import { z } from '#/adapter/form'; +import { generateAutoCode } from '#/api/mes/md/autocode/record'; +import { getWarehouseSimpleList } from '#/api/mes/wm/warehouse'; +import { getWarehouseAreaSimpleList } from '#/api/mes/wm/warehouse/area'; +import { getWarehouseLocationSimpleList } from '#/api/mes/wm/warehouse/location'; +import { ProProcessSelect } from '#/views/mes/pro/process/components'; +import { MesAutoCodeRuleCode } from '#/views/mes/utils/constants'; + +import { MdWorkshopSelect } from './components'; + +/** 新增/修改工作站的表单 */ +export function useFormSchema(formApi?: any): VbenFormSchema[] { + return [ + { + fieldName: 'id', + component: 'Input', + dependencies: { + triggerFields: [''], + show: () => false, + }, + }, + { + fieldName: 'code', + label: '工作站编码', + component: 'Input', + componentProps: { + placeholder: '请输入工作站编码', + }, + rules: 'required', + suffix: () => + h( + Button, + { + type: 'default', + onClick: async () => { + try { + const code = await generateAutoCode( + MesAutoCodeRuleCode.MD_WORKSTATION_CODE, + ); + await formApi?.setFieldValue('code', code); + } catch (error) { + console.error(error); + } + }, + }, + { default: () => '生成' }, + ), + }, + { + fieldName: 'name', + label: '工作站名称', + component: 'Input', + componentProps: { + placeholder: '请输入工作站名称', + }, + rules: 'required', + }, + { + fieldName: 'workshopId', + label: '所在车间', + component: markRaw(MdWorkshopSelect), + componentProps: { + placeholder: '请选择车间', + }, + rules: 'selectRequired', + }, + { + fieldName: 'address', + label: '工作站地点', + component: 'Input', + componentProps: { + placeholder: '请输入工作站地点', + }, + }, + { + fieldName: 'processId', + label: '所属工序', + component: markRaw(ProProcessSelect), + componentProps: { + placeholder: '请选择所属工序', + }, + rules: 'selectRequired', + }, + { + fieldName: 'warehouseId', + label: '仓库', + component: 'ApiSelect', + componentProps: { + allowClear: true, + api: getWarehouseSimpleList, + labelField: 'name', + onChange: async () => { + await formApi?.setFieldValue('locationId', undefined); + await formApi?.setFieldValue('areaId', undefined); + }, + placeholder: '请选择仓库', + valueField: 'id', + }, + }, + { + fieldName: 'locationId', + label: '库区', + component: 'Select', + dependencies: { + triggerFields: ['warehouseId'], + disabled: (values) => !values.warehouseId, + async componentProps(values) { + const list = values.warehouseId + ? await getWarehouseLocationSimpleList(values.warehouseId) + : []; + return { + allowClear: true, + onChange: async () => { + await formApi?.setFieldValue('areaId', undefined); + }, + options: list.map((item) => ({ + label: item.name, + value: item.id, + })), + placeholder: '请选择库区', + }; + }, + }, + }, + { + fieldName: 'areaId', + label: '库位', + component: 'Select', + dependencies: { + triggerFields: ['locationId'], + disabled: (values) => !values.locationId, + async componentProps(values) { + const list = values.locationId + ? await getWarehouseAreaSimpleList(values.locationId) + : []; + return { + allowClear: true, + options: list.map((item) => ({ + label: item.name, + value: item.id, + })), + placeholder: '请选择库位', + }; + }, + }, + }, + { + fieldName: 'status', + label: '状态', + component: 'RadioGroup', + componentProps: { + buttonStyle: 'solid', + optionType: 'button', + options: getDictOptions(DICT_TYPE.COMMON_STATUS, 'number'), + }, + rules: z.number().default(CommonStatusEnum.ENABLE), + }, + { + fieldName: 'remark', + label: '备注', + component: 'Textarea', + formItemClass: 'col-span-3', + componentProps: { + placeholder: '请输入备注', + rows: 3, + }, + }, + ]; +} + +/** 列表的搜索表单 */ +export function useGridFormSchema(): VbenFormSchema[] { + return [ + { + fieldName: 'code', + label: '工作站编码', + component: 'Input', + componentProps: { + allowClear: true, + placeholder: '请输入工作站编码', + }, + }, + { + fieldName: 'name', + label: '工作站名称', + component: 'Input', + componentProps: { + allowClear: true, + placeholder: '请输入工作站名称', + }, + }, + { + fieldName: 'workshopId', + label: '所在车间', + component: markRaw(MdWorkshopSelect), + componentProps: { + placeholder: '请选择车间', + }, + }, + { + fieldName: 'processId', + label: '所属工序', + component: markRaw(ProProcessSelect), + componentProps: { + placeholder: '请选择工序', + }, + }, + { + fieldName: 'status', + label: '状态', + component: 'Select', + componentProps: { + allowClear: true, + options: getDictOptions(DICT_TYPE.COMMON_STATUS, 'number'), + placeholder: '请选择状态', + }, + }, + ]; +} + +/** 列表的字段 */ +export function useGridColumns(): VxeTableGridOptions['columns'] { + return [ + { + field: 'code', + title: '工作站编码', + minWidth: 150, + slots: { default: 'code' }, + }, + { + field: 'name', + title: '工作站名称', + minWidth: 150, + }, + { + field: 'address', + title: '工作站地点', + minWidth: 150, + }, + { + field: 'workshopName', + title: '所在车间', + width: 140, + }, + { + field: 'processName', + title: '所属工序', + width: 140, + }, + { + field: 'status', + title: '状态', + width: 120, + cellRender: { + name: 'CellDict', + props: { type: DICT_TYPE.COMMON_STATUS }, + }, + }, + { + field: 'createTime', + title: '创建时间', + width: 180, + formatter: 'formatDateTime', + }, + { + title: '操作', + width: 210, + fixed: 'right', + slots: { default: 'actions' }, + }, + ]; +} + +/** 工作站选择弹窗的搜索表单 */ +export function useWorkstationSelectGridFormSchema(): VbenFormSchema[] { + return [ + { + fieldName: 'code', + label: '工作站编码', + component: 'Input', + componentProps: { + allowClear: true, + placeholder: '请输入工作站编码', + }, + }, + { + fieldName: 'processId', + label: '所属工序', + component: markRaw(ProProcessSelect), + componentProps: { + placeholder: '请选择工序', + }, + }, + { + fieldName: 'workshopId', + label: '所在车间', + component: markRaw(MdWorkshopSelect), + componentProps: { + placeholder: '请选择车间', + }, + }, + ]; +} + +/** 工作站选择弹窗的字段 */ +export function useWorkstationSelectGridColumns(): VxeTableGridOptions['columns'] { + return [ + { type: 'checkbox', width: 50 }, + { + field: 'code', + title: '工作站编码', + width: 150, + }, + { + field: 'name', + title: '工作站名称', + minWidth: 160, + }, + { + field: 'address', + title: '工作站地点', + minWidth: 140, + }, + { + field: 'workshopName', + title: '所在车间', + width: 130, + }, + { + field: 'processName', + title: '所属工序', + width: 130, + }, + { + field: 'remark', + title: '备注', + minWidth: 140, + }, + ]; +} diff --git a/apps/web-antd/src/views/mes/md/workstation/index.vue b/apps/web-antd/src/views/mes/md/workstation/index.vue new file mode 100644 index 000000000..61d70a914 --- /dev/null +++ b/apps/web-antd/src/views/mes/md/workstation/index.vue @@ -0,0 +1,189 @@ + + + diff --git a/apps/web-antd/src/views/mes/md/workstation/modules/form.vue b/apps/web-antd/src/views/mes/md/workstation/modules/form.vue new file mode 100644 index 000000000..94932caf2 --- /dev/null +++ b/apps/web-antd/src/views/mes/md/workstation/modules/form.vue @@ -0,0 +1,162 @@ + + + diff --git a/apps/web-antd/src/views/mes/md/workstation/modules/machine-list.vue b/apps/web-antd/src/views/mes/md/workstation/modules/machine-list.vue new file mode 100644 index 000000000..23b4b85f6 --- /dev/null +++ b/apps/web-antd/src/views/mes/md/workstation/modules/machine-list.vue @@ -0,0 +1,212 @@ + + + diff --git a/apps/web-antd/src/views/mes/md/workstation/modules/tool-list.vue b/apps/web-antd/src/views/mes/md/workstation/modules/tool-list.vue new file mode 100644 index 000000000..74f07d0fd --- /dev/null +++ b/apps/web-antd/src/views/mes/md/workstation/modules/tool-list.vue @@ -0,0 +1,226 @@ + + + diff --git a/apps/web-antd/src/views/mes/md/workstation/modules/worker-list.vue b/apps/web-antd/src/views/mes/md/workstation/modules/worker-list.vue new file mode 100644 index 000000000..033c4c410 --- /dev/null +++ b/apps/web-antd/src/views/mes/md/workstation/modules/worker-list.vue @@ -0,0 +1,222 @@ + + + diff --git a/apps/web-antd/src/views/mes/utils/constants.ts b/apps/web-antd/src/views/mes/utils/constants.ts index a69326c01..8bd5047f4 100644 --- a/apps/web-antd/src/views/mes/utils/constants.ts +++ b/apps/web-antd/src/views/mes/utils/constants.ts @@ -16,6 +16,7 @@ export const MesAutoCodeRuleCode = { MD_ITEM_TYPE_CODE: 'MD_ITEM_TYPE_CODE', MD_ITEM_CODE: 'MD_ITEM_CODE', MD_VENDOR_CODE: 'MD_VENDOR_CODE', + MD_WORKSTATION_CODE: 'MD_WORKSTATION_CODE', MD_WORKSHOP_CODE: 'MD_WORKSHOP_CODE', } as const; diff --git a/apps/web-ele/src/api/mes/dv/machinery/index.ts b/apps/web-ele/src/api/mes/dv/machinery/index.ts new file mode 100644 index 000000000..e4c02f1c4 --- /dev/null +++ b/apps/web-ele/src/api/mes/dv/machinery/index.ts @@ -0,0 +1,45 @@ +import type { PageParam, PageResult } from '@vben/request'; + +import { requestClient } from '#/api/request'; + +export namespace MesDvMachineryApi { + /** MES 设备台账 */ + export interface Machinery { + id?: number; // 设备编号 + code?: string; // 设备编码 + name?: string; // 设备名称 + brand?: string; // 品牌 + specification?: string; // 规格型号 + machineryTypeId?: number; // 设备类型编号 + machineryTypeName?: string; // 设备类型名称 + workshopId?: number; // 所属车间编号 + workshopName?: string; // 所属车间名称 + status?: number; // 设备状态 + lastMaintenTime?: Date; // 最近保养时间 + lastCheckTime?: Date; // 最近点检时间 + remark?: string; // 备注 + createTime?: Date; // 创建时间 + } +} + +/** 查询设备分页 */ +export function getMachineryPage(params: PageParam) { + return requestClient.get>( + '/mes/dv/machinery/page', + { params }, + ); +} + +/** 查询设备精简列表 */ +export function getMachinerySimpleList() { + return requestClient.get( + '/mes/dv/machinery/simple-list', + ); +} + +/** 查询设备详情 */ +export function getMachinery(id: number) { + return requestClient.get( + `/mes/dv/machinery/get?id=${id}`, + ); +} diff --git a/apps/web-ele/src/api/mes/md/workstation/index.ts b/apps/web-ele/src/api/mes/md/workstation/index.ts new file mode 100644 index 000000000..4880f3bbe --- /dev/null +++ b/apps/web-ele/src/api/mes/md/workstation/index.ts @@ -0,0 +1,58 @@ +import type { PageParam, PageResult } from '@vben/request'; + +import { requestClient } from '#/api/request'; + +export namespace MesMdWorkstationApi { + /** MES 工作站 */ + export interface Workstation { + id?: number; // 工作站编号 + code?: string; // 工作站编码 + name?: string; // 工作站名称 + address?: string; // 工作站地点 + workshopId?: number; // 所在车间编号 + workshopName?: string; // 所在车间名称 + processId?: number; // 工序编号 + processName?: string; // 工序名称 + warehouseId?: number; // 线边库编号 + locationId?: number; // 库区编号 + areaId?: number; // 库位编号 + status?: number; // 状态 + remark?: string; // 备注 + createTime?: Date; // 创建时间 + } +} + +/** 查询工作站分页 */ +export function getWorkstationPage(params: PageParam) { + return requestClient.get>( + '/mes/md-workstation/page', + { params }, + ); +} + +/** 查询工作站详情 */ +export function getWorkstation(id: number) { + return requestClient.get( + `/mes/md-workstation/get?id=${id}`, + ); +} + +/** 新增工作站 */ +export function createWorkstation(data: MesMdWorkstationApi.Workstation) { + return requestClient.post('/mes/md-workstation/create', data); +} + +/** 修改工作站 */ +export function updateWorkstation(data: MesMdWorkstationApi.Workstation) { + return requestClient.put('/mes/md-workstation/update', data); +} + +/** 删除工作站 */ +export function deleteWorkstation(id: number) { + return requestClient.delete(`/mes/md-workstation/delete?id=${id}`); +} + +/** 导出工作站 */ +export function exportWorkstation(params: any) { + return requestClient.download('/mes/md-workstation/export-excel', { params }); +} diff --git a/apps/web-ele/src/api/mes/md/workstation/machine/index.ts b/apps/web-ele/src/api/mes/md/workstation/machine/index.ts new file mode 100644 index 000000000..40dd8692b --- /dev/null +++ b/apps/web-ele/src/api/mes/md/workstation/machine/index.ts @@ -0,0 +1,35 @@ +import { requestClient } from '#/api/request'; + +export namespace MesMdWorkstationMachineApi { + /** MES 工作站设备资源 */ + export interface WorkstationMachine { + id?: number; // 资源编号 + workstationId?: number; // 工作站编号 + machineryId?: number; // 设备编号 + machineryCode?: string; // 设备编码 + machineryName?: string; // 设备名称 + quantity?: number; // 数量 + remark?: string; // 备注 + createTime?: Date; // 创建时间 + } +} + +/** 查询工作站设备资源列表 */ +export function getWorkstationMachineList(workstationId: number) { + return requestClient.get( + '/mes/md-workstation-machine/list-by-workstation', + { params: { workstationId } }, + ); +} + +/** 新增工作站设备资源 */ +export function createWorkstationMachine( + data: MesMdWorkstationMachineApi.WorkstationMachine, +) { + return requestClient.post('/mes/md-workstation-machine/create', data); +} + +/** 删除工作站设备资源 */ +export function deleteWorkstationMachine(id: number) { + return requestClient.delete(`/mes/md-workstation-machine/delete?id=${id}`); +} diff --git a/apps/web-ele/src/api/mes/md/workstation/tool/index.ts b/apps/web-ele/src/api/mes/md/workstation/tool/index.ts new file mode 100644 index 000000000..d98e5f122 --- /dev/null +++ b/apps/web-ele/src/api/mes/md/workstation/tool/index.ts @@ -0,0 +1,41 @@ +import { requestClient } from '#/api/request'; + +export namespace MesMdWorkstationToolApi { + /** MES 工作站工装夹具资源 */ + export interface WorkstationTool { + id?: number; // 资源编号 + workstationId?: number; // 工作站编号 + toolTypeId?: number; // 工具类型编号 + toolTypeName?: string; // 工具类型名称 + quantity?: number; // 数量 + remark?: string; // 备注 + createTime?: Date; // 创建时间 + } +} + +/** 查询工作站工装夹具资源列表 */ +export function getWorkstationToolList(workstationId: number) { + return requestClient.get( + '/mes/md-workstation-tool/list-by-workstation', + { params: { workstationId } }, + ); +} + +/** 新增工作站工装夹具资源 */ +export function createWorkstationTool( + data: MesMdWorkstationToolApi.WorkstationTool, +) { + return requestClient.post('/mes/md-workstation-tool/create', data); +} + +/** 修改工作站工装夹具资源 */ +export function updateWorkstationTool( + data: MesMdWorkstationToolApi.WorkstationTool, +) { + return requestClient.put('/mes/md-workstation-tool/update', data); +} + +/** 删除工作站工装夹具资源 */ +export function deleteWorkstationTool(id: number) { + return requestClient.delete(`/mes/md-workstation-tool/delete?id=${id}`); +} diff --git a/apps/web-ele/src/api/mes/md/workstation/worker/index.ts b/apps/web-ele/src/api/mes/md/workstation/worker/index.ts new file mode 100644 index 000000000..3bd4ab9ad --- /dev/null +++ b/apps/web-ele/src/api/mes/md/workstation/worker/index.ts @@ -0,0 +1,41 @@ +import { requestClient } from '#/api/request'; + +export namespace MesMdWorkstationWorkerApi { + /** MES 工作站人力资源 */ + export interface WorkstationWorker { + id?: number; // 资源编号 + workstationId?: number; // 工作站编号 + postId?: number; // 岗位编号 + postName?: string; // 岗位名称 + quantity?: number; // 数量 + remark?: string; // 备注 + createTime?: Date; // 创建时间 + } +} + +/** 查询工作站人力资源列表 */ +export function getWorkstationWorkerList(workstationId: number) { + return requestClient.get( + '/mes/md-workstation-worker/list-by-workstation', + { params: { workstationId } }, + ); +} + +/** 新增工作站人力资源 */ +export function createWorkstationWorker( + data: MesMdWorkstationWorkerApi.WorkstationWorker, +) { + return requestClient.post('/mes/md-workstation-worker/create', data); +} + +/** 修改工作站人力资源 */ +export function updateWorkstationWorker( + data: MesMdWorkstationWorkerApi.WorkstationWorker, +) { + return requestClient.put('/mes/md-workstation-worker/update', data); +} + +/** 删除工作站人力资源 */ +export function deleteWorkstationWorker(id: number) { + return requestClient.delete(`/mes/md-workstation-worker/delete?id=${id}`); +} diff --git a/apps/web-ele/src/api/mes/tm/tool/type/index.ts b/apps/web-ele/src/api/mes/tm/tool/type/index.ts new file mode 100644 index 000000000..cced608cc --- /dev/null +++ b/apps/web-ele/src/api/mes/tm/tool/type/index.ts @@ -0,0 +1,39 @@ +import type { PageParam, PageResult } from '@vben/request'; + +import { requestClient } from '#/api/request'; + +export namespace MesTmToolTypeApi { + /** MES 工具类型 */ + export interface ToolType { + id?: number; // 工具类型编号 + code?: string; // 类型编码 + name?: string; // 类型名称 + codeFlag?: boolean; // 是否编码管理 + maintenType?: number; // 保养维护类型 + maintenPeriod?: number; // 保养周期 + remark?: string; // 备注 + createTime?: Date; // 创建时间 + } +} + +/** 查询工具类型分页 */ +export function getToolTypePage(params: PageParam) { + return requestClient.get>( + '/mes/tm/tool-type/page', + { params }, + ); +} + +/** 查询工具类型精简列表 */ +export function getToolTypeSimpleList() { + return requestClient.get( + '/mes/tm/tool-type/simple-list', + ); +} + +/** 查询工具类型详情 */ +export function getToolType(id: number) { + return requestClient.get( + `/mes/tm/tool-type/get?id=${id}`, + ); +} diff --git a/apps/web-ele/src/api/mes/wm/warehouse/area/index.ts b/apps/web-ele/src/api/mes/wm/warehouse/area/index.ts new file mode 100644 index 000000000..cf5844ade --- /dev/null +++ b/apps/web-ele/src/api/mes/wm/warehouse/area/index.ts @@ -0,0 +1,50 @@ +import type { PageParam, PageResult } from '@vben/request'; + +import { requestClient } from '#/api/request'; + +export namespace MesWmWarehouseAreaApi { + /** MES 库位 */ + export interface WarehouseArea { + id?: number; // 库位编号 + code?: string; // 库位编码 + name?: string; // 库位名称 + warehouseId?: number; // 仓库编号 + warehouseName?: string; // 仓库名称 + locationId?: number; // 库区编号 + locationName?: string; // 库区名称 + area?: number; // 面积 + maxLoad?: number; // 最大载荷 + positionX?: number; // X 坐标 + positionY?: number; // Y 坐标 + positionZ?: number; // Z 坐标 + status?: number; // 状态 + frozen?: boolean; // 是否冻结 + allowItemMixing?: boolean; // 是否允许物料混放 + allowBatchMixing?: boolean; // 是否允许批次混放 + remark?: string; // 备注 + createTime?: Date; // 创建时间 + } +} + +/** 查询库位分页 */ +export function getWarehouseAreaPage(params: PageParam) { + return requestClient.get>( + '/mes/wm/warehouse-area/page', + { params }, + ); +} + +/** 查询库位精简列表 */ +export function getWarehouseAreaSimpleList(locationId?: number) { + return requestClient.get( + '/mes/wm/warehouse-area/simple-list', + { params: { locationId } }, + ); +} + +/** 查询库位详情 */ +export function getWarehouseArea(id: number) { + return requestClient.get( + `/mes/wm/warehouse-area/get?id=${id}`, + ); +} diff --git a/apps/web-ele/src/api/mes/wm/warehouse/index.ts b/apps/web-ele/src/api/mes/wm/warehouse/index.ts new file mode 100644 index 000000000..f68604790 --- /dev/null +++ b/apps/web-ele/src/api/mes/wm/warehouse/index.ts @@ -0,0 +1,40 @@ +import type { PageParam, PageResult } from '@vben/request'; + +import { requestClient } from '#/api/request'; + +export namespace MesWmWarehouseApi { + /** MES 仓库 */ + export interface Warehouse { + id?: number; // 仓库编号 + code?: string; // 仓库编码 + name?: string; // 仓库名称 + address?: string; // 地址 + area?: number; // 面积 + chargeUserId?: number; // 负责人 + frozen?: boolean; // 是否冻结 + remark?: string; // 备注 + createTime?: Date; // 创建时间 + } +} + +/** 查询仓库分页 */ +export function getWarehousePage(params: PageParam) { + return requestClient.get>( + '/mes/wm/warehouse/page', + { params }, + ); +} + +/** 查询仓库精简列表 */ +export function getWarehouseSimpleList() { + return requestClient.get( + '/mes/wm/warehouse/simple-list', + ); +} + +/** 查询仓库详情 */ +export function getWarehouse(id: number) { + return requestClient.get( + `/mes/wm/warehouse/get?id=${id}`, + ); +} diff --git a/apps/web-ele/src/api/mes/wm/warehouse/location/index.ts b/apps/web-ele/src/api/mes/wm/warehouse/location/index.ts new file mode 100644 index 000000000..e33fb180e --- /dev/null +++ b/apps/web-ele/src/api/mes/wm/warehouse/location/index.ts @@ -0,0 +1,40 @@ +import type { PageParam, PageResult } from '@vben/request'; + +import { requestClient } from '#/api/request'; + +export namespace MesWmWarehouseLocationApi { + /** MES 库区 */ + export interface WarehouseLocation { + id?: number; // 库区编号 + code?: string; // 库区编码 + name?: string; // 库区名称 + warehouseId?: number; // 仓库编号 + warehouseName?: string; // 仓库名称 + area?: number; // 面积 + frozen?: boolean; // 是否冻结 + remark?: string; // 备注 + createTime?: Date; // 创建时间 + } +} + +/** 查询库区分页 */ +export function getWarehouseLocationPage(params: PageParam) { + return requestClient.get< + PageResult + >('/mes/wm/warehouse-location/page', { params }); +} + +/** 查询库区精简列表 */ +export function getWarehouseLocationSimpleList(warehouseId?: number) { + return requestClient.get( + '/mes/wm/warehouse-location/simple-list', + { params: { warehouseId } }, + ); +} + +/** 查询库区详情 */ +export function getWarehouseLocation(id: number) { + return requestClient.get( + `/mes/wm/warehouse-location/get?id=${id}`, + ); +} diff --git a/apps/web-ele/src/views/mes/md/workstation/components/index.ts b/apps/web-ele/src/views/mes/md/workstation/components/index.ts new file mode 100644 index 000000000..b5855ec6f --- /dev/null +++ b/apps/web-ele/src/views/mes/md/workstation/components/index.ts @@ -0,0 +1,3 @@ +export { default as MdWorkshopSelect } from './md-workshop-select.vue'; +export { default as MdWorkstationSelectDialog } from './md-workstation-select-dialog.vue'; +export { default as MdWorkstationSelect } from './md-workstation-select.vue'; diff --git a/apps/web-ele/src/views/mes/md/workstation/components/md-workshop-select.vue b/apps/web-ele/src/views/mes/md/workstation/components/md-workshop-select.vue new file mode 100644 index 000000000..ecad19182 --- /dev/null +++ b/apps/web-ele/src/views/mes/md/workstation/components/md-workshop-select.vue @@ -0,0 +1,117 @@ + + + diff --git a/apps/web-ele/src/views/mes/md/workstation/components/md-workstation-select-dialog.vue b/apps/web-ele/src/views/mes/md/workstation/components/md-workstation-select-dialog.vue new file mode 100644 index 000000000..2c66e5928 --- /dev/null +++ b/apps/web-ele/src/views/mes/md/workstation/components/md-workstation-select-dialog.vue @@ -0,0 +1,190 @@ + + + diff --git a/apps/web-ele/src/views/mes/md/workstation/components/md-workstation-select.vue b/apps/web-ele/src/views/mes/md/workstation/components/md-workstation-select.vue new file mode 100644 index 000000000..acb100597 --- /dev/null +++ b/apps/web-ele/src/views/mes/md/workstation/components/md-workstation-select.vue @@ -0,0 +1,141 @@ + + + diff --git a/apps/web-ele/src/views/mes/md/workstation/data.ts b/apps/web-ele/src/views/mes/md/workstation/data.ts new file mode 100644 index 000000000..11ec6b0f3 --- /dev/null +++ b/apps/web-ele/src/views/mes/md/workstation/data.ts @@ -0,0 +1,348 @@ +import type { VbenFormSchema } from '#/adapter/form'; +import type { VxeTableGridOptions } from '#/adapter/vxe-table'; +import type { MesMdWorkstationApi } from '#/api/mes/md/workstation'; + +import { h, markRaw } from 'vue'; + +import { CommonStatusEnum, DICT_TYPE } from '@vben/constants'; +import { getDictOptions } from '@vben/hooks'; + +import { ElButton } from 'element-plus'; + +import { z } from '#/adapter/form'; +import { generateAutoCode } from '#/api/mes/md/autocode/record'; +import { getWarehouseSimpleList } from '#/api/mes/wm/warehouse'; +import { getWarehouseAreaSimpleList } from '#/api/mes/wm/warehouse/area'; +import { getWarehouseLocationSimpleList } from '#/api/mes/wm/warehouse/location'; +import { ProProcessSelect } from '#/views/mes/pro/process/components'; +import { MesAutoCodeRuleCode } from '#/views/mes/utils/constants'; + +import { MdWorkshopSelect } from './components'; + +/** 新增/修改工作站的表单 */ +export function useFormSchema(formApi?: any): VbenFormSchema[] { + return [ + { + fieldName: 'id', + component: 'Input', + dependencies: { + triggerFields: [''], + show: () => false, + }, + }, + { + fieldName: 'code', + label: '工作站编码', + component: 'Input', + componentProps: { + placeholder: '请输入工作站编码', + }, + rules: 'required', + suffix: () => + h( + ElButton, + { + onClick: async () => { + try { + const code = await generateAutoCode( + MesAutoCodeRuleCode.MD_WORKSTATION_CODE, + ); + await formApi?.setFieldValue('code', code); + } catch (error) { + console.error(error); + } + }, + }, + { default: () => '生成' }, + ), + }, + { + fieldName: 'name', + label: '工作站名称', + component: 'Input', + componentProps: { + placeholder: '请输入工作站名称', + }, + rules: 'required', + }, + { + fieldName: 'workshopId', + label: '所在车间', + component: markRaw(MdWorkshopSelect), + componentProps: { + placeholder: '请选择车间', + }, + rules: 'selectRequired', + }, + { + fieldName: 'address', + label: '工作站地点', + component: 'Input', + componentProps: { + placeholder: '请输入工作站地点', + }, + }, + { + fieldName: 'processId', + label: '所属工序', + component: markRaw(ProProcessSelect), + componentProps: { + placeholder: '请选择所属工序', + }, + rules: 'selectRequired', + }, + { + fieldName: 'warehouseId', + label: '仓库', + component: 'ApiSelect', + componentProps: { + api: getWarehouseSimpleList, + clearable: true, + labelField: 'name', + onChange: async () => { + await formApi?.setFieldValue('locationId', undefined); + await formApi?.setFieldValue('areaId', undefined); + }, + placeholder: '请选择仓库', + valueField: 'id', + }, + }, + { + fieldName: 'locationId', + label: '库区', + component: 'Select', + dependencies: { + triggerFields: ['warehouseId'], + disabled: (values) => !values.warehouseId, + async componentProps(values) { + const list = values.warehouseId + ? await getWarehouseLocationSimpleList(values.warehouseId) + : []; + return { + clearable: true, + onChange: async () => { + await formApi?.setFieldValue('areaId', undefined); + }, + options: list.map((item) => ({ + label: item.name, + value: item.id, + })), + placeholder: '请选择库区', + }; + }, + }, + }, + { + fieldName: 'areaId', + label: '库位', + component: 'Select', + dependencies: { + triggerFields: ['locationId'], + disabled: (values) => !values.locationId, + async componentProps(values) { + const list = values.locationId + ? await getWarehouseAreaSimpleList(values.locationId) + : []; + return { + clearable: true, + options: list.map((item) => ({ + label: item.name, + value: item.id, + })), + placeholder: '请选择库位', + }; + }, + }, + }, + { + fieldName: 'status', + label: '状态', + component: 'RadioGroup', + componentProps: { + options: getDictOptions(DICT_TYPE.COMMON_STATUS, 'number'), + }, + rules: z.number().default(CommonStatusEnum.ENABLE), + }, + { + fieldName: 'remark', + label: '备注', + component: 'Textarea', + formItemClass: 'col-span-3', + componentProps: { + placeholder: '请输入备注', + rows: 3, + }, + }, + ]; +} + +/** 列表的搜索表单 */ +export function useGridFormSchema(): VbenFormSchema[] { + return [ + { + fieldName: 'code', + label: '工作站编码', + component: 'Input', + componentProps: { + clearable: true, + placeholder: '请输入工作站编码', + }, + }, + { + fieldName: 'name', + label: '工作站名称', + component: 'Input', + componentProps: { + clearable: true, + placeholder: '请输入工作站名称', + }, + }, + { + fieldName: 'workshopId', + label: '所在车间', + component: markRaw(MdWorkshopSelect), + componentProps: { + placeholder: '请选择车间', + }, + }, + { + fieldName: 'processId', + label: '所属工序', + component: markRaw(ProProcessSelect), + componentProps: { + placeholder: '请选择工序', + }, + }, + { + fieldName: 'status', + label: '状态', + component: 'Select', + componentProps: { + clearable: true, + options: getDictOptions(DICT_TYPE.COMMON_STATUS, 'number'), + placeholder: '请选择状态', + }, + }, + ]; +} + +/** 列表的字段 */ +export function useGridColumns(): VxeTableGridOptions['columns'] { + return [ + { + field: 'code', + title: '工作站编码', + minWidth: 150, + slots: { default: 'code' }, + }, + { + field: 'name', + title: '工作站名称', + minWidth: 150, + }, + { + field: 'address', + title: '工作站地点', + minWidth: 150, + }, + { + field: 'workshopName', + title: '所在车间', + width: 140, + }, + { + field: 'processName', + title: '所属工序', + width: 140, + }, + { + field: 'status', + title: '状态', + width: 120, + cellRender: { + name: 'CellDict', + props: { type: DICT_TYPE.COMMON_STATUS }, + }, + }, + { + field: 'createTime', + title: '创建时间', + width: 180, + formatter: 'formatDateTime', + }, + { + title: '操作', + width: 210, + fixed: 'right', + slots: { default: 'actions' }, + }, + ]; +} + +/** 工作站选择弹窗的搜索表单 */ +export function useWorkstationSelectGridFormSchema(): VbenFormSchema[] { + return [ + { + fieldName: 'code', + label: '工作站编码', + component: 'Input', + componentProps: { + clearable: true, + placeholder: '请输入工作站编码', + }, + }, + { + fieldName: 'processId', + label: '所属工序', + component: markRaw(ProProcessSelect), + componentProps: { + placeholder: '请选择工序', + }, + }, + { + fieldName: 'workshopId', + label: '所在车间', + component: markRaw(MdWorkshopSelect), + componentProps: { + placeholder: '请选择车间', + }, + }, + ]; +} + +/** 工作站选择弹窗的字段 */ +export function useWorkstationSelectGridColumns(): VxeTableGridOptions['columns'] { + return [ + { type: 'checkbox', width: 50 }, + { + field: 'code', + title: '工作站编码', + width: 150, + }, + { + field: 'name', + title: '工作站名称', + minWidth: 160, + }, + { + field: 'address', + title: '工作站地点', + minWidth: 140, + }, + { + field: 'workshopName', + title: '所在车间', + width: 130, + }, + { + field: 'processName', + title: '所属工序', + width: 130, + }, + { + field: 'remark', + title: '备注', + minWidth: 140, + }, + ]; +} diff --git a/apps/web-ele/src/views/mes/md/workstation/index.vue b/apps/web-ele/src/views/mes/md/workstation/index.vue new file mode 100644 index 000000000..ccb22173b --- /dev/null +++ b/apps/web-ele/src/views/mes/md/workstation/index.vue @@ -0,0 +1,190 @@ + + + diff --git a/apps/web-ele/src/views/mes/md/workstation/modules/form.vue b/apps/web-ele/src/views/mes/md/workstation/modules/form.vue new file mode 100644 index 000000000..91dfc18e7 --- /dev/null +++ b/apps/web-ele/src/views/mes/md/workstation/modules/form.vue @@ -0,0 +1,162 @@ + + + diff --git a/apps/web-ele/src/views/mes/md/workstation/modules/machine-list.vue b/apps/web-ele/src/views/mes/md/workstation/modules/machine-list.vue new file mode 100644 index 000000000..ec831494f --- /dev/null +++ b/apps/web-ele/src/views/mes/md/workstation/modules/machine-list.vue @@ -0,0 +1,213 @@ + + + diff --git a/apps/web-ele/src/views/mes/md/workstation/modules/tool-list.vue b/apps/web-ele/src/views/mes/md/workstation/modules/tool-list.vue new file mode 100644 index 000000000..b2eab5617 --- /dev/null +++ b/apps/web-ele/src/views/mes/md/workstation/modules/tool-list.vue @@ -0,0 +1,232 @@ + + + diff --git a/apps/web-ele/src/views/mes/md/workstation/modules/worker-list.vue b/apps/web-ele/src/views/mes/md/workstation/modules/worker-list.vue new file mode 100644 index 000000000..4b74c899b --- /dev/null +++ b/apps/web-ele/src/views/mes/md/workstation/modules/worker-list.vue @@ -0,0 +1,228 @@ + + + diff --git a/apps/web-ele/src/views/mes/utils/constants.ts b/apps/web-ele/src/views/mes/utils/constants.ts index a69326c01..8bd5047f4 100644 --- a/apps/web-ele/src/views/mes/utils/constants.ts +++ b/apps/web-ele/src/views/mes/utils/constants.ts @@ -16,6 +16,7 @@ export const MesAutoCodeRuleCode = { MD_ITEM_TYPE_CODE: 'MD_ITEM_TYPE_CODE', MD_ITEM_CODE: 'MD_ITEM_CODE', MD_VENDOR_CODE: 'MD_VENDOR_CODE', + MD_WORKSTATION_CODE: 'MD_WORKSTATION_CODE', MD_WORKSHOP_CODE: 'MD_WORKSHOP_CODE', } as const;