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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
import type { PageParam, PageResult } from '@vben/request';
 
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; // 生产订单编号
    status?: number; // 状态(1-在库 2-已出库)
    warehouseId?: number; // 在库仓库 ID
    locationId?: number; // 在库库区 ID
    areaId?: number; // 在库库位 ID
    createTime?: Date; // 生成时间
  }
 
  /** MES SN 码单件详情 */
  export interface SnDetail {
    id?: number; // 编号
    code?: string; // SN 码
    itemId?: number; // 物料编号
    itemCode?: string; // 物料编码
    itemName?: string; // 物料名称
    batchCode?: string; // 批次号
    status?: number; // 状态(1-在库 2-已出库)
    warehouseId?: number; // 在库仓库 ID
    locationId?: number; // 在库库区 ID
    areaId?: number; // 在库库位 ID
    lastTransactionType?: number; // 最近事务类型(1-入库 2-出库)
    lastTransactionTypeName?: string; // 最近事务类型名称
    lastTransactionQuantity?: number; // 最近事务变动数量
    lastTransactionBizType?: number; // 最近事务业务类型
    lastTransactionBizCode?: string; // 最近事务业务单号
    lastTransactionTime?: string; // 最近事务发生时间
  }
 
  /** SN 码入库登记参数 */
  export interface SnInStock {
    code?: string; // SN 码
    itemId?: number; // 物料编号
    warehouseId?: number; // 仓库 ID
    locationId?: number; // 库区 ID
    areaId?: number; // 库位 ID
    batchCode?: string; // 批次号
    remark?: string; // 备注
  }
 
  /** SN 码出库核销参数 */
  export interface SnOutStock {
    code?: string; // SN 码
    itemId?: number; // 物料编号
    remark?: string; // 备注
  }
 
  /** SN 码在库/状态分页查询参数 */
  export interface SnInStockPageParams extends PageParam {
    code?: string; // SN 码
    itemId?: number; // 物料编号
    batchCode?: string; // 批次号
    warehouseId?: number; // 仓库 ID
    locationId?: number; // 库区 ID
    areaId?: number; // 库位 ID
    status?: number; // 状态(1-在库 2-已出库)
  }
 
  /** 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 码入库登记 */
export function registerSnInStock(data: MesWmSnApi.SnInStock) {
  return requestClient.post<boolean>('/mes/wm/sn/in-stock', data);
}
 
/** SN 码出库核销 */
export function outboundSn(data: MesWmSnApi.SnOutStock) {
  return requestClient.post<boolean>('/mes/wm/sn/out-stock', data);
}
 
/** 查询 SN 码单件详情 */
export function getSnDetail(code: string) {
  return requestClient.get<MesWmSnApi.SnDetail>('/mes/wm/sn/detail', {
    params: { code },
  });
}
 
/** 查询 SN 码在库/状态分页 */
export function getSnInStockPage(params: MesWmSnApi.SnInStockPageParams) {
  return requestClient.get<PageResult<MesWmSnApi.Sn>>(
    '/mes/wm/sn/in-stock-page',
    { params },
  );
}
 
/** 导出 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 },
  });
}