gaoluyang
2026-06-29 27cd042df9aca0383a49f3514bc21958dd890912
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
import type { PageParam, PageResult } from '../../../../packages/effects/request/src';
 
import { requestClient } from '#/api/request';
 
export namespace MesWmSnApi {
  /** MES SN 码分组 */
  export interface SnGroup {
    uuid?: string; // 批次 UUID
    count?: number; // SN 码数量
    itemId?: number; // 物料编号
    itemCode?: string; // 物料编码
    itemName?: string; // 物料名称
    specification?: string; // 规格型号
    unitName?: string; // 单位名称
    batchCode?: string; // 批次号
    workOrderId?: number; // 生产工单编号
    createTime?: Date; // 生成时间
  }
 
  /** MES SN 码明细 */
  export interface Sn {
    id?: number; // 编号
    uuid?: string; // 批次 UUID
    code?: string; // SN 码
    itemId?: number; // 物料编号
    itemCode?: string; // 物料编码
    itemName?: string; // 物料名称
    specification?: string; // 规格型号
    unitName?: string; // 单位名称
    batchCode?: string; // 批次号
    workOrderId?: number; // 生产工单编号
    createTime?: Date; // 生成时间
  }
 
  /** MES SN 码生成参数 */
  export interface SnGenerate {
    itemId?: number; // 物料编号
    batchCode?: string; // 批次号
    workOrderId?: number; // 生产工单编号
    count?: number; // 生成数量
  }
 
  /** MES SN 码分组分页查询参数 */
  export interface PageParams extends PageParam {
    uuid?: string; // 分组 UUID
    code?: string; // SN 码
    itemId?: number; // 物料编号
    batchCode?: string; // 批次号
    createTime?: string[]; // 创建时间
  }
}
 
/** 生成 SN 码 */
export function generateSnCodes(data: MesWmSnApi.SnGenerate) {
  return requestClient.post('/mes/wm/sn/generate', data);
}
 
/** 查询 SN 码分组分页 */
export function getSnGroupPage(params: MesWmSnApi.PageParams) {
  return requestClient.get<PageResult<MesWmSnApi.SnGroup>>(
    '/mes/wm/sn/group-page',
    { params },
  );
}
 
/** 查询批次 SN 码明细列表 */
export function getSnListByUuid(uuid: string) {
  return requestClient.get<MesWmSnApi.Sn[]>('/mes/wm/sn/list-by-uuid', {
    params: { uuid },
  });
}
 
/** 批量删除 SN 码(按批次 UUID) */
export function deleteSnBatch(uuid: string) {
  return requestClient.delete('/mes/wm/sn/delete-batch', {
    params: { uuid },
  });
}
 
/** 导出 SN 码分组 Excel */
export function exportSnGroupExcel(params: MesWmSnApi.PageParams) {
  return requestClient.download('/mes/wm/sn/group-export-excel', { params });
}
 
/** 导出批次 SN 码明细 Excel */
export function exportSnDetailExcel(uuid: string) {
  return requestClient.download('/mes/wm/sn/export-excel', {
    params: { uuid },
  });
}