import type { PageParam, PageResult } from '@vben/request';
|
|
import { requestClient } from '#/api/request';
|
|
export namespace MesProBagCodeApi {
|
/** 袋码(一袋一码) */
|
export interface BagCode {
|
id?: number; // 编号
|
uuid?: string; // 生成组 UUID
|
code?: string; // 袋码(二维码内容)
|
bagNo?: number; // 批次内袋序号
|
batchId?: number; // 生产批次编号
|
batchCode?: string; // 批次号
|
lineCode?: string; // 产线编码
|
lineName?: string; // 产线名称
|
palletId?: number; // 绑定托盘编号
|
palletCode?: string; // 托盘码
|
status?: number; // 状态(字典 mes_pro_bag_code_status)
|
printTime?: string; // 导出(交付印刷)时间
|
remark?: string; // 备注
|
createTime?: string; // 创建时间
|
}
|
|
/** 袋码分页查询参数 */
|
export interface PageParams extends PageParam {
|
code?: string;
|
batchId?: number;
|
batchCode?: string;
|
uuid?: string;
|
palletId?: number;
|
status?: number;
|
createTime?: string[];
|
}
|
|
/** 生成数据包请求 */
|
export interface GenerateParams {
|
batchId: number; // 生产批次编号
|
count: number; // 生成袋数
|
remark?: string; // 备注
|
}
|
|
/** 绑定/解绑托盘请求 */
|
export interface BindParams {
|
palletId: number; // 托盘编号
|
ids: number[]; // 袋码编号列表
|
}
|
|
/** 扫码追溯信息 */
|
export interface BagCodeTrace {
|
id?: number; // 袋码编号
|
code?: string; // 袋码(二维码内容)
|
bagNo?: number; // 袋序号
|
status?: number; // 袋码状态
|
printTime?: string; // 导出印刷时间
|
batchId?: number; // 批次编号
|
batchCode?: string; // 批次号
|
batchStatus?: number; // 批次状态
|
produceDate?: string; // 生产日期
|
lineCode?: string; // 产线编码
|
lineName?: string; // 产线名称
|
ownerUserId?: number; // 责任人编号
|
ownerUserName?: string; // 责任人昵称
|
palletId?: number; // 托盘编号
|
palletCode?: string; // 托盘码
|
itemId?: number; // 品种(物料)编号
|
itemCode?: string; // 品种编码
|
itemName?: string; // 品种名称
|
itemSpecification?: string; // 品种规格
|
}
|
}
|
|
/** 生成袋码数据包(返回生成组 UUID) */
|
export function generateBagCodes(data: MesProBagCodeApi.GenerateParams) {
|
return requestClient.post<string>('/mes/pro/bag-code/generate', data);
|
}
|
|
/** 删除袋码生成组 */
|
export function deleteBagCodesByUuid(uuid: string) {
|
return requestClient.delete(`/mes/pro/bag-code/delete-by-uuid?uuid=${uuid}`);
|
}
|
|
/** 袋码绑定托盘 */
|
export function bindBagCodePallet(data: MesProBagCodeApi.BindParams) {
|
return requestClient.put('/mes/pro/bag-code/bind-pallet', data);
|
}
|
|
/** 袋码解绑托盘 */
|
export function unbindBagCodePallet(data: MesProBagCodeApi.BindParams) {
|
return requestClient.put('/mes/pro/bag-code/unbind-pallet', data);
|
}
|
|
/** 查询袋码详情 */
|
export function getBagCode(id: number) {
|
return requestClient.get<MesProBagCodeApi.BagCode>(
|
`/mes/pro/bag-code/get?id=${id}`,
|
);
|
}
|
|
/** 扫码追溯:根据袋码反查批次、产线、责任人等信息 */
|
export function getBagCodeByCode(code: string) {
|
return requestClient.get<MesProBagCodeApi.BagCodeTrace>(
|
`/mes/pro/bag-code/get-by-code?code=${encodeURIComponent(code)}`,
|
);
|
}
|
|
/** 查询袋码分页 */
|
export function getBagCodePage(params: MesProBagCodeApi.PageParams) {
|
return requestClient.get<PageResult<MesProBagCodeApi.BagCode>>(
|
'/mes/pro/bag-code/page',
|
{ params },
|
);
|
}
|
|
/** 查询生成组的袋码列表 */
|
export function getBagCodeListByUuid(uuid: string) {
|
return requestClient.get<MesProBagCodeApi.BagCode[]>(
|
`/mes/pro/bag-code/list-by-uuid?uuid=${uuid}`,
|
);
|
}
|
|
/** 批量导出袋码 Excel(交付印刷) */
|
export function exportBagCodeExcel(params: MesProBagCodeApi.PageParams) {
|
return requestClient.download('/mes/pro/bag-code/export-excel', { params });
|
}
|
|
/** 批量导出袋码二维码图片 ZIP(uuid 优先,否则按 batchId) */
|
export function exportBagQr(params: { uuid?: string; batchId?: number }) {
|
return requestClient.download('/mes/pro/bag-code/export-qr', { params });
|
}
|