2 天以前 1c1af9b0fc10778ae5ac13cc68fd4030affbcfe1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
import type { PageParam, PageResult } from '@vben/request';
 
import { requestClient } from '#/api/request';
 
export namespace MesWmBarcodeApi {
  /** MES 条码清单 */
  export interface Barcode {
    id?: number; // 条码编号
    configId?: number; // 条码配置编号
    format?: number; // 条码格式
    bizType?: number; // 业务类型
    content?: string; // 条码内容
    bizId?: number; // 业务对象编号
    bizCode?: string; // 业务对象编码
    bizName?: string; // 业务对象名称
    status?: number; // 状态
    remark?: string; // 备注
    createTime?: Date; // 创建时间
  }
}
 
/** 查询条码分页 */
export function getBarcodePage(params: PageParam) {
  return requestClient.get<PageResult<MesWmBarcodeApi.Barcode>>(
    '/mes/wm/barcode/page',
    { params },
  );
}
 
/** 查询条码详情 */
export function getBarcode(id: number) {
  return requestClient.get<MesWmBarcodeApi.Barcode>(
    `/mes/wm/barcode/get?id=${id}`,
  );
}
 
/** 根据业务对象获取条码 */
export function getBarcodeByBusiness(bizType: number, bizId: number) {
  return requestClient.get<MesWmBarcodeApi.Barcode>(
    '/mes/wm/barcode/get-by-business',
    { params: { bizId, bizType } },
  );
}
 
/** 新增条码 */
export function createBarcode(data: MesWmBarcodeApi.Barcode) {
  return requestClient.post('/mes/wm/barcode/create', data);
}
 
/** 修改条码 */
export function updateBarcode(data: MesWmBarcodeApi.Barcode) {
  return requestClient.put('/mes/wm/barcode/update', data);
}
 
/** 删除条码 */
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,
  bizName?: string,
) {
  return requestClient.get<string>('/mes/wm/barcode/generate-content', {
    params: { bizCode, bizName, bizType },
  });
}
 
/** 生成条码/二维码图片(服务端 zxing 成图,返回 PNG Base64,不落库) */
export function renderBarcodeImage(
  content: string,
  format?: number,
  width?: number,
  height?: number,
) {
  return requestClient.post<string>('/mes/wm/barcode/render', null, {
    params: { content, format, height, width },
  });
}
 
/** 解析条码内容(优先精确命中,其次按启用配置模板反解,返回业务字段) */
export function parseBarcodeContent(content: string) {
  return requestClient.post<Record<string, any>>('/mes/wm/barcode/parse', null, {
    params: { content },
  });
}