feat(mes): 新增 wm 等 api 迁移

pull/349/head
YunaiV 2026-05-27 06:37:33 +08:00
parent d1e2202e59
commit 2a868b809f
14 changed files with 542 additions and 2 deletions

View File

@ -0,0 +1,71 @@
import type { PageParam, PageResult } from '@vben/request';
import { requestClient } from '#/api/request';
export namespace MesProWorkRecordApi {
/** MES 工作记录流水 */
export interface WorkRecordLog {
id?: number; // 编号
userId?: number; // 用户编号
userNickname?: string; // 用户昵称
workstationId?: number; // 工作站编号
workstationCode?: string; // 工作站编码
workstationName?: string; // 工作站名称
type?: number; // 1=上工 2=下工
remark?: string; // 备注
createTime?: Date; // 创建时间
}
/** MES 当前用户工作站绑定状态 */
export interface MyWorkRecord {
userId?: number; // 用户编号
userNickname?: string; // 用户昵称
workstationId?: number; // 工作站编号
workstationCode?: string; // 工作站编码
workstationName?: string; // 工作站名称
type?: number; // 1=上工 2=下工
clockInTime?: Date; // 上工时间
clockOutTime?: Date; // 下工时间
}
}
/** 查询工作记录分页 */
export function getWorkRecordLogPage(params: PageParam) {
return requestClient.get<PageResult<MesProWorkRecordApi.WorkRecordLog>>(
'/mes/pro/workrecord/log/page',
{ params },
);
}
/** 查询工作记录详情 */
export function getWorkRecordLog(id: number) {
return requestClient.get<MesProWorkRecordApi.WorkRecordLog>(
`/mes/pro/workrecord/log/get?id=${id}`,
);
}
/** 导出工作记录 */
export function exportWorkRecordLog(params: any) {
return requestClient.download('/mes/pro/workrecord/log/export-excel', {
params,
});
}
/** 上工(绑定工作站) */
export function clockInWorkRecord(workstationId: number) {
return requestClient.put('/mes/pro/workrecord/clock-in', null, {
params: { workstationId },
});
}
/** 下工(解绑工作站) */
export function clockOutWorkRecord() {
return requestClient.put('/mes/pro/workrecord/clock-out');
}
/** 查询当前用户绑定的工作站 */
export function getMyWorkRecord() {
return requestClient.get<MesProWorkRecordApi.MyWorkRecord>(
'/mes/pro/workrecord/get-my',
);
}

View File

@ -0,0 +1,54 @@
import type { PageParam, PageResult } from '@vben/request';
import { requestClient } from '#/api/request';
export namespace MesQcDefectApi {
/** MES 缺陷类型 */
export interface Defect {
id?: number; // 编号
code?: string; // 缺陷编码
name?: string; // 缺陷描述
type?: number; // 检测项类型
level?: number; // 缺陷等级
remark?: string; // 备注
createTime?: Date; // 创建时间
}
}
/** 查询缺陷类型分页 */
export function getDefectPage(params: PageParam) {
return requestClient.get<PageResult<MesQcDefectApi.Defect>>(
'/mes/qc/defect/page',
{ params },
);
}
/** 查询缺陷类型精简列表 */
export function getDefectSimpleList() {
return requestClient.get<MesQcDefectApi.Defect[]>('/mes/qc/defect/simple-list');
}
/** 查询缺陷类型详情 */
export function getDefect(id: number) {
return requestClient.get<MesQcDefectApi.Defect>(`/mes/qc/defect/get?id=${id}`);
}
/** 新增缺陷类型 */
export function createDefect(data: MesQcDefectApi.Defect) {
return requestClient.post('/mes/qc/defect/create', data);
}
/** 修改缺陷类型 */
export function updateDefect(data: MesQcDefectApi.Defect) {
return requestClient.put('/mes/qc/defect/update', data);
}
/** 删除缺陷类型 */
export function deleteDefect(id: number) {
return requestClient.delete(`/mes/qc/defect/delete?id=${id}`);
}
/** 导出缺陷类型 */
export function exportDefect(params: any) {
return requestClient.download('/mes/qc/defect/export-excel', { params });
}

View File

@ -0,0 +1,53 @@
import type { PageParam, PageResult } from '@vben/request';
import { requestClient } from '#/api/request';
export namespace MesQcIndicatorApi {
/** MES 质检指标 */
export interface Indicator {
id?: number; // 编号
code?: string; // 检测项编码
name?: string; // 检测项名称
type?: number; // 检测项类型
tool?: string; // 检测工具
resultType?: number; // 结果值类型
resultSpecification?: string; // 结果值属性
remark?: string; // 备注
createTime?: Date; // 创建时间
}
}
/** 查询质检指标分页 */
export function getIndicatorPage(params: PageParam) {
return requestClient.get<PageResult<MesQcIndicatorApi.Indicator>>(
'/mes/qc/indicator/page',
{ params },
);
}
/** 查询质检指标详情 */
export function getIndicator(id: number) {
return requestClient.get<MesQcIndicatorApi.Indicator>(
`/mes/qc/indicator/get?id=${id}`,
);
}
/** 新增质检指标 */
export function createIndicator(data: MesQcIndicatorApi.Indicator) {
return requestClient.post('/mes/qc/indicator/create', data);
}
/** 修改质检指标 */
export function updateIndicator(data: MesQcIndicatorApi.Indicator) {
return requestClient.put('/mes/qc/indicator/update', data);
}
/** 删除质检指标 */
export function deleteIndicator(id: number) {
return requestClient.delete(`/mes/qc/indicator/delete?id=${id}`);
}
/** 导出质检指标 */
export function exportIndicator(params: any) {
return requestClient.download('/mes/qc/indicator/export-excel', { params });
}

View File

@ -0,0 +1,51 @@
import type { PageParam, PageResult } from '@vben/request';
import { requestClient } from '#/api/request';
export namespace MesQcTemplateApi {
/** MES 质检方案 */
export interface Template {
id?: number; // 编号
code?: string; // 方案编号
name?: string; // 方案名称
types?: number[]; // 检测种类
status?: number; // 状态
remark?: string; // 备注
createTime?: Date; // 创建时间
}
}
/** 查询质检方案分页 */
export function getTemplatePage(params: PageParam) {
return requestClient.get<PageResult<MesQcTemplateApi.Template>>(
'/mes/qc/template/page',
{ params },
);
}
/** 查询质检方案详情 */
export function getTemplate(id: number) {
return requestClient.get<MesQcTemplateApi.Template>(
`/mes/qc/template/get?id=${id}`,
);
}
/** 新增质检方案 */
export function createTemplate(data: MesQcTemplateApi.Template) {
return requestClient.post('/mes/qc/template/create', data);
}
/** 修改质检方案 */
export function updateTemplate(data: MesQcTemplateApi.Template) {
return requestClient.put('/mes/qc/template/update', data);
}
/** 删除质检方案 */
export function deleteTemplate(id: number) {
return requestClient.delete(`/mes/qc/template/delete?id=${id}`);
}
/** 导出质检方案 */
export function exportTemplate(params: any) {
return requestClient.download('/mes/qc/template/export-excel', { params });
}

View File

@ -0,0 +1,57 @@
import type { PageParam, PageResult } from '@vben/request';
import { requestClient } from '#/api/request';
export namespace MesQcTemplateIndicatorApi {
/** MES 质检方案-检测指标项 */
export interface TemplateIndicator {
id?: number; // 编号
templateId?: number; // 质检方案ID
indicatorId?: number; // 质检指标ID
checkMethod?: string; // 检测方法
standardValue?: number; // 标准值
unitMeasureId?: number; // 计量单位ID
thresholdMax?: number; // 误差上限
thresholdMin?: number; // 误差下限
docUrl?: string; // 说明图URL
remark?: string; // 备注
indicatorCode?: string; // 检测项编码JOIN
indicatorName?: string; // 检测项名称JOIN
indicatorType?: number; // 检测项类型JOIN
indicatorTool?: string; // 检测工具JOIN
unitMeasureName?: string; // 计量单位名称JOIN
}
}
/** 查询检测指标项分页 */
export function getTemplateIndicatorPage(params: PageParam & { templateId?: number }) {
return requestClient.get<
PageResult<MesQcTemplateIndicatorApi.TemplateIndicator>
>('/mes/qc/template/indicator/page', { params });
}
/** 查询检测指标项详情 */
export function getTemplateIndicator(id: number) {
return requestClient.get<MesQcTemplateIndicatorApi.TemplateIndicator>(
`/mes/qc/template/indicator/get?id=${id}`,
);
}
/** 新增检测指标项 */
export function createTemplateIndicator(
data: MesQcTemplateIndicatorApi.TemplateIndicator,
) {
return requestClient.post('/mes/qc/template/indicator/create', data);
}
/** 修改检测指标项 */
export function updateTemplateIndicator(
data: MesQcTemplateIndicatorApi.TemplateIndicator,
) {
return requestClient.put('/mes/qc/template/indicator/update', data);
}
/** 删除检测指标项 */
export function deleteTemplateIndicator(id: number) {
return requestClient.delete(`/mes/qc/template/indicator/delete?id=${id}`);
}

View File

@ -0,0 +1,52 @@
import type { PageParam, PageResult } from '@vben/request';
import { requestClient } from '#/api/request';
export namespace MesQcTemplateItemApi {
/** MES 质检方案-产品关联 */
export interface TemplateItem {
id?: number; // 编号
templateId?: number; // 质检方案ID
itemId?: number; // 产品物料ID
quantityCheck?: number; // 最低检测数
quantityUnqualified?: number; // 最大不合格数
criticalRate?: number; // 最大致命缺陷率(%
majorRate?: number; // 最大严重缺陷率(%
minorRate?: number; // 最大轻微缺陷率(%
remark?: string; // 备注
itemCode?: string; // 物料编码JOIN
itemName?: string; // 物料名称JOIN
specification?: string; // 规格型号JOIN
unitMeasureName?: string; // 计量单位名称JOIN
}
}
/** 查询产品关联分页 */
export function getTemplateItemPage(params: PageParam & { templateId?: number }) {
return requestClient.get<PageResult<MesQcTemplateItemApi.TemplateItem>>(
'/mes/qc/template/item/page',
{ params },
);
}
/** 查询产品关联详情 */
export function getTemplateItem(id: number) {
return requestClient.get<MesQcTemplateItemApi.TemplateItem>(
`/mes/qc/template/item/get?id=${id}`,
);
}
/** 新增产品关联 */
export function createTemplateItem(data: MesQcTemplateItemApi.TemplateItem) {
return requestClient.post('/mes/qc/template/item/create', data);
}
/** 修改产品关联 */
export function updateTemplateItem(data: MesQcTemplateItemApi.TemplateItem) {
return requestClient.put('/mes/qc/template/item/update', data);
}
/** 删除产品关联 */
export function deleteTemplateItem(id: number) {
return requestClient.delete(`/mes/qc/template/item/delete?id=${id}`);
}

View File

@ -0,0 +1,49 @@
import type { PageParam, PageResult } from '@vben/request';
import { requestClient } from '#/api/request';
export namespace MesWmBarcodeConfigApi {
/** MES 条码配置 */
export interface BarcodeConfig {
id?: number; // 编号
format?: number; // 条码格式
bizType?: number; // 业务类型
contentFormat?: string; // 内容格式模板
contentExample?: string; // 内容样例
autoGenerateFlag?: boolean; // 是否自动生成
defaultTemplate?: string; // 默认打印模板
status?: number; // 状态
remark?: string; // 备注
createTime?: Date; // 创建时间
}
}
/** 查询条码配置分页 */
export function getBarcodeConfigPage(params: PageParam) {
return requestClient.get<PageResult<MesWmBarcodeConfigApi.BarcodeConfig>>(
'/mes/wm/barcode-config/page',
{ params },
);
}
/** 查询条码配置详情 */
export function getBarcodeConfig(id: number) {
return requestClient.get<MesWmBarcodeConfigApi.BarcodeConfig>(
`/mes/wm/barcode-config/get?id=${id}`,
);
}
/** 新增条码配置 */
export function createBarcodeConfig(data: MesWmBarcodeConfigApi.BarcodeConfig) {
return requestClient.post('/mes/wm/barcode-config/create', data);
}
/** 修改条码配置 */
export function updateBarcodeConfig(data: MesWmBarcodeConfigApi.BarcodeConfig) {
return requestClient.put('/mes/wm/barcode-config/update', data);
}
/** 删除条码配置 */
export function deleteBarcodeConfig(id: number) {
return requestClient.delete(`/mes/wm/barcode-config/delete?id=${id}`);
}

View File

@ -38,7 +38,7 @@ export function getBarcode(id: number) {
export function getBarcodeByBusiness(bizType: number, bizId: number) {
return requestClient.get<MesWmBarcodeApi.Barcode>(
'/mes/wm/barcode/get-by-business',
{ params: { bizType, bizId } },
{ params: { bizId, bizType } },
);
}
@ -57,9 +57,14 @@ export function deleteBarcode(id: number) {
return requestClient.delete(`/mes/wm/barcode/delete?id=${id}`);
}
/** 导出条码 */
export function exportBarcode(params: any) {
return requestClient.download('/mes/wm/barcode/export-excel', { params });
}
/** 生成条码内容 */
export function generateBarcodeContent(bizType: number, bizCode: string) {
return requestClient.get<string>('/mes/wm/barcode/generate-content', {
params: { bizType, bizCode },
params: { bizCode, bizType },
});
}

View File

@ -0,0 +1,61 @@
import type { PageParam, PageResult } from '@vben/request';
import { requestClient } from '#/api/request';
export namespace MesWmMaterialStockApi {
/** MES 库存台账 */
export interface MaterialStock {
id?: number; // 编号
itemTypeId?: number; // 物料分类编号
itemId?: number; // 物料编号
itemCode?: string; // 物料编码
itemName?: string; // 物料名称
specification?: string; // 规格型号
unitMeasureName?: string; // 计量单位名称
batchId?: number; // 批次编号
batchCode?: string; // 批次号
warehouseId?: number; // 仓库编号
warehouseCode?: string; // 仓库编码
warehouseName?: string; // 仓库名称
locationId?: number; // 库区编号
locationName?: string; // 库区名称
areaId?: number; // 库位编号
areaName?: string; // 库位名称
vendorId?: number; // 供应商编号
vendorName?: string; // 供应商名称
quantity?: number; // 在库数量
receiptTime?: string; // 入库日期
frozen?: boolean; // 是否冻结
createTime?: Date; // 创建时间
}
}
/** 查询库存台账分页 */
export function getMaterialStockPage(params: PageParam) {
return requestClient.get<PageResult<MesWmMaterialStockApi.MaterialStock>>(
'/mes/wm/material-stock/page',
{ params },
);
}
/** 查询库存台账详情 */
export function getMaterialStock(id: number) {
return requestClient.get<MesWmMaterialStockApi.MaterialStock>(
`/mes/wm/material-stock/get?id=${id}`,
);
}
/** 更新库存冻结状态 */
export function updateMaterialStockFrozen(data: {
frozen: boolean;
id: number;
}) {
return requestClient.put('/mes/wm/material-stock/update-frozen', data);
}
/** 导出库存台账 */
export function exportMaterialStock(params: any) {
return requestClient.download('/mes/wm/material-stock/export-excel', {
params,
});
}

View File

@ -48,3 +48,18 @@ export function getWarehouseArea(id: number) {
`/mes/wm/warehouse-area/get?id=${id}`,
);
}
/** 新增库位 */
export function createWarehouseArea(data: MesWmWarehouseAreaApi.WarehouseArea) {
return requestClient.post('/mes/wm/warehouse-area/create', data);
}
/** 修改库位 */
export function updateWarehouseArea(data: MesWmWarehouseAreaApi.WarehouseArea) {
return requestClient.put('/mes/wm/warehouse-area/update', data);
}
/** 删除库位 */
export function deleteWarehouseArea(id: number) {
return requestClient.delete(`/mes/wm/warehouse-area/delete?id=${id}`);
}

View File

@ -38,3 +38,18 @@ export function getWarehouse(id: number) {
`/mes/wm/warehouse/get?id=${id}`,
);
}
/** 新增仓库 */
export function createWarehouse(data: MesWmWarehouseApi.Warehouse) {
return requestClient.post('/mes/wm/warehouse/create', data);
}
/** 修改仓库 */
export function updateWarehouse(data: MesWmWarehouseApi.Warehouse) {
return requestClient.put('/mes/wm/warehouse/update', data);
}
/** 删除仓库 */
export function deleteWarehouse(id: number) {
return requestClient.delete(`/mes/wm/warehouse/delete?id=${id}`);
}

View File

@ -38,3 +38,35 @@ export function getWarehouseLocation(id: number) {
`/mes/wm/warehouse-location/get?id=${id}`,
);
}
/** 新增库区 */
export function createWarehouseLocation(
data: MesWmWarehouseLocationApi.WarehouseLocation,
) {
return requestClient.post('/mes/wm/warehouse-location/create', data);
}
/** 修改库区 */
export function updateWarehouseLocation(
data: MesWmWarehouseLocationApi.WarehouseLocation,
) {
return requestClient.put('/mes/wm/warehouse-location/update', data);
}
/** 删除库区 */
export function deleteWarehouseLocation(id: number) {
return requestClient.delete(`/mes/wm/warehouse-location/delete?id=${id}`);
}
/** 批量设置库区下所有库位的混放规则 */
export function updateAreaByLocationId(
locationId: number,
allowItemMixing?: boolean,
allowBatchMixing?: boolean,
) {
return requestClient.put(
'/mes/wm/warehouse-location/update-by-location-id',
null,
{ params: { allowBatchMixing, allowItemMixing, locationId } },
);
}

View File

@ -139,8 +139,14 @@ export const MesAutoCodeRuleCode = {
PRO_ROUTE_CODE: 'PRO_ROUTE_CODE',
PRO_TASK_CODE: 'PRO_TASK_CODE',
PRO_WORK_ORDER_CODE: 'PRO_WORK_ORDER_CODE',
QC_DEFECT_CODE: 'QC_DEFECT_CODE',
QC_INDICATOR_CODE: 'QC_INDICATOR_CODE',
QC_TEMPLATE_CODE: 'QC_TEMPLATE_CODE',
TM_TOOL_TYPE_CODE: 'TM_TOOL_TYPE_CODE',
TM_TOOL_CODE: 'TM_TOOL_CODE',
WM_AREA_CODE: 'WM_AREA_CODE',
WM_LOCATION_CODE: 'WM_LOCATION_CODE',
WM_WAREHOUSE_CODE: 'WM_WAREHOUSE_CODE',
} as const;
/** MES 生产工单状态枚举 */
@ -194,6 +200,21 @@ export const MesProAndonLevelEnum = {
LEVEL3: 3,
} as const;
/** MES 上下工状态类型枚举 */
export const MesProWorkRecordTypeEnum = {
CLOCK_IN: 1,
CLOCK_OUT: 2,
} as const;
/** MES 质检结果值类型枚举 */
export const MesQcResultValueType = {
FLOAT: 1,
INTEGER: 2,
TEXT: 3,
DICT: 4,
FILE: 5,
} as const;
/** MES 编码规则分段类型枚举 */
export const MesAutoCodePartTypeEnum = {
INPUT: 1,

View File

@ -213,6 +213,10 @@ const MES_DICT = {
MES_PRO_WORK_RECORD_TYPE: 'mes_pro_work_record_type', // MES 上下工状态类型
MES_TIME_UNIT_TYPE: 'mes_time_unit_type', // MES 时间单位
MES_ORDER_STATUS: 'mes_order_status', // MES 单据状态
MES_INDICATOR_TYPE: 'mes_indicator_type', // MES 检测项类型
MES_QC_RESULT_TYPE: 'mes_qc_result_type', // MES 质检结果值类型
MES_QC_TYPE: 'mes_qc_type', // MES 质检方案类型
MES_DEFECT_LEVEL: 'mes_defect_level', // MES 缺陷等级
MES_WM_BARCODE_BIZ_TYPE: 'mes_wm_barcode_biz_type', // MES 条码业务类型
MES_WM_BARCODE_FORMAT: 'mes_wm_barcode_format', // MES 条码格式
MES_WM_PRODUCT_SALES_STATUS: 'mes_wm_product_sales_status', // MES 销售出库单状态