| | |
| | | export namespace MesProBagCodeApi { |
| | | /** 袋码(一袋一码) */ |
| | | export interface BagCode { |
| | | inboundTime?: string; |
| | | id?: number; // 编号 |
| | | uuid?: string; // 生成组 UUID |
| | | code?: string; // 袋码(二维码内容) |
| | | businessCode?: string; // 内部出入库业务码(纯码值) |
| | | bagNo?: number; // 批次内袋序号 |
| | | batchId?: number; // 生产批次编号 |
| | | batchCode?: string; // 批次号 |
| | |
| | | lineName?: string; // 产线名称 |
| | | palletId?: number; // 绑定托盘编号 |
| | | palletCode?: string; // 托盘码 |
| | | itemId?: number; // 品种(物料)编号 |
| | | itemCode?: string; // 品种编码 |
| | | itemName?: string; // 品种名称 |
| | | status?: number; // 状态(字典 mes_pro_bag_code_status) |
| | | printTime?: string; // 导出(交付印刷)时间 |
| | | cancelTime?: string; // 作废时间 |
| | | cancelReason?: string; // 作废原因 |
| | | remark?: string; // 备注 |
| | | createTime?: string; // 创建时间 |
| | | } |
| | |
| | | /** 袋码分页查询参数 */ |
| | | export interface PageParams extends PageParam { |
| | | code?: string; |
| | | businessCode?: string; |
| | | batchId?: number; |
| | | batchCode?: string; |
| | | uuid?: string; |
| | | palletId?: number; |
| | | itemId?: number; |
| | | status?: number; |
| | | createTime?: string[]; |
| | | } |
| | | |
| | | /** 生成数据包请求 */ |
| | | /** 生成数据包请求(品种主计量单位类型为 N袋 时按托盘数换算袋数;为 吨 时无托盘、直接输入袋码数) */ |
| | | export interface GenerateParams { |
| | | batchId: number; // 生产批次编号 |
| | | count: number; // 生成袋数 |
| | | itemId: number; // 品种(物料)编号 |
| | | palletCount?: number; // 托盘数(48袋/100袋 品种必填) |
| | | bagCount?: number; // 袋码数(吨品种必填) |
| | | remark?: string; // 备注 |
| | | requestId?: string; // 幂等键:网络重试复用同一个值 |
| | | } |
| | | |
| | | export interface GenerateResult { |
| | | uuid?: string; // 生成组 UUID |
| | | type?: string; // 品种主计量单位类型(48袋/100袋/吨) |
| | | perPallet?: number; // 每托袋数(吨品种为 0) |
| | | totalCount?: number; // 生成袋码总数 |
| | | palletCount?: number; // 托盘总数(原始数据为 0) |
| | | palletIds?: number[]; // 自动生成的托盘编号列表(仅同步完成返回,吨品种为空) |
| | | async?: boolean; // true=已转后台任务 |
| | | taskId?: number; // 后台任务编号(异步模式返回) |
| | | } |
| | | |
| | | /** 生成原始袋码请求(仅品种+袋码数量,不关联计量单位类型、不生成托盘) */ |
| | | export interface RawGenerateParams { |
| | | itemId: number; // 品种(物料)编号 |
| | | count: number; // 袋码数量 |
| | | remark?: string; // 备注 |
| | | requestId?: string; // 幂等键:网络重试复用同一个值 |
| | | } |
| | | |
| | | /** 袋码生成任务(大批量生成转后台后的进度) */ |
| | | export interface GenerateTask { |
| | | id: number; // 任务编号 |
| | | bizType?: string; // PACKAGE(数据包)/ RAW(原始数据) |
| | | status?: number; // 10 排队中 / 20 生成中 / 25 取消中 / 30 已完成 / 40 已取消 / 50 已失败 |
| | | statusName?: string; // 状态名称 |
| | | progress?: number; // 进度百分比 0~100 |
| | | uuid?: string; // 生成组 UUID |
| | | itemId?: number; // 品种编号 |
| | | itemCode?: string; // 品种编码 |
| | | itemName?: string; // 品种名称 |
| | | unitType?: string; // 计量单位类型 |
| | | perPallet?: number; // 每托袋数 |
| | | palletCount?: number; // 托盘数 |
| | | totalCount?: number; // 袋码总数 |
| | | finishedCount?: number; // 已生成袋码数 |
| | | errorMsg?: string; // 失败原因 |
| | | createTime?: string; // 创建时间 |
| | | finishTime?: string; // 完成/终止时间 |
| | | } |
| | | |
| | | export interface BindBatchParams { |
| | | batchId: number; |
| | | ids: number[]; |
| | | } |
| | | |
| | | /** 绑定/解绑托盘请求 */ |
| | |
| | | ids: number[]; // 袋码编号列表 |
| | | } |
| | | |
| | | /** 破损袋码替换请求 */ |
| | | export interface ReplaceParams { |
| | | batchId: number; // 生产批次编号 |
| | | oldIds: number[]; // 待替换旧袋码编号列表 |
| | | reason: string; // 替换原因 |
| | | } |
| | | |
| | | /** 破损袋码替换明细 */ |
| | | export interface ReplaceItem { |
| | | oldBagCodeId?: number; |
| | | oldCode?: string; |
| | | oldBagNo?: number; |
| | | oldStatus?: number; |
| | | oldPalletId?: number; |
| | | oldPalletCode?: string; |
| | | newBagCodeId?: number; |
| | | newCode?: string; |
| | | newBagNo?: number; |
| | | newPalletId?: number; |
| | | newPalletCode?: string; |
| | | reason?: string; |
| | | replaceTime?: string; |
| | | } |
| | | |
| | | /** 破损袋码替换结果 */ |
| | | export interface ReplaceResult { |
| | | replaceUuid?: string; |
| | | batchId?: number; |
| | | batchCode?: string; |
| | | count?: number; |
| | | items?: ReplaceItem[]; |
| | | } |
| | | |
| | | /** 扫码追溯信息 */ |
| | | export interface BagCodeTrace { |
| | | inboundTime?: string; |
| | | id?: number; // 袋码编号 |
| | | code?: string; // 袋码(二维码内容) |
| | | businessCode?: string; // 内部出入库业务码 |
| | | bagNo?: number; // 袋序号 |
| | | status?: number; // 袋码状态 |
| | | printTime?: string; // 导出印刷时间 |
| | | cancelTime?: string; // 作废时间 |
| | | cancelReason?: string; // 作废原因 |
| | | replacementUuid?: string; // 替换组 UUID |
| | | replacedByCode?: string; // 替换后的新袋码 |
| | | replacementOfCode?: string; // 被替换的旧袋码 |
| | | batchId?: number; // 批次编号 |
| | | batchCode?: string; // 批次号 |
| | | batchStatus?: number; // 批次状态 |
| | |
| | | |
| | | /** 生成袋码数据包(返回生成组 UUID) */ |
| | | export function generateBagCodes(data: MesProBagCodeApi.GenerateParams) { |
| | | return requestClient.post<string>('/mes/pro/bag-code/generate', data); |
| | | return requestClient.post<MesProBagCodeApi.GenerateResult>( |
| | | '/mes/pro/bag-code/generate', |
| | | data, |
| | | ); |
| | | } |
| | | |
| | | /** 生成原始袋码(仅选品种与袋码数量,不生成托盘;返回生成组 UUID) */ |
| | | export function generateRawBagCodes(data: MesProBagCodeApi.RawGenerateParams) { |
| | | return requestClient.post<MesProBagCodeApi.GenerateResult>( |
| | | '/mes/pro/bag-code/raw-generate', |
| | | data, |
| | | ); |
| | | } |
| | | |
| | | /** 查询袋码生成任务(大批量生成的进度轮询) */ |
| | | export function getBagCodeGenerateTask(id: number) { |
| | | return requestClient.get<MesProBagCodeApi.GenerateTask>( |
| | | '/mes/pro/bag-code/generate-task/get', |
| | | { params: { id } }, |
| | | ); |
| | | } |
| | | |
| | | /** 取消袋码生成任务(停止生成并清理半成品) */ |
| | | export function cancelBagCodeGenerateTask(id: number) { |
| | | return requestClient.post<boolean>( |
| | | `/mes/pro/bag-code/generate-task/cancel?id=${id}`, |
| | | ); |
| | | } |
| | | |
| | | /** 录入生产批次 */ |
| | | export function bindBagCodeBatch(data: MesProBagCodeApi.BindBatchParams) { |
| | | return requestClient.put('/mes/pro/bag-code/bind-batch', data); |
| | | } |
| | | |
| | | /** 删除袋码生成组 */ |
| | |
| | | return requestClient.put('/mes/pro/bag-code/unbind-pallet', data); |
| | | } |
| | | |
| | | /** 作废破损袋码并生成等量替换袋码 */ |
| | | export function replaceBagCodes(data: MesProBagCodeApi.ReplaceParams) { |
| | | return requestClient.post<MesProBagCodeApi.ReplaceResult>( |
| | | '/mes/pro/bag-code/replace', |
| | | data, |
| | | ); |
| | | } |
| | | |
| | | /** 查询袋码详情 */ |
| | | export function getBagCode(id: number) { |
| | | return requestClient.get<MesProBagCodeApi.BagCode>( |
| | |
| | | export function getBagCodeByCode(code: string) { |
| | | return requestClient.get<MesProBagCodeApi.BagCodeTrace>( |
| | | `/mes/pro/bag-code/get-by-code?code=${encodeURIComponent(code)}`, |
| | | ); |
| | | } |
| | | |
| | | /** |
| | | * 扫码追溯:根据编码解析其类型(bag / pallet / batch)。 |
| | | * 编码统一为「16 位纯数字」后无法按前缀判断类型,改由后端解析;均不匹配返回 null。 |
| | | */ |
| | | export function resolveTraceType(code: string) { |
| | | return requestClient.get<'bag' | 'batch' | 'pallet' | null>( |
| | | `/mes/pro/trace/resolve-type?code=${encodeURIComponent(code)}`, |
| | | ); |
| | | } |
| | | |
| | |
| | | ); |
| | | } |
| | | |
| | | /** 分页查询可绑定批次的吨袋(无托盘且未绑定批次,品种计量单位为吨) */ |
| | | export function getUnboundTonBagPage(params: { |
| | | keyword?: string; |
| | | pageNo: number; |
| | | pageSize: number; |
| | | }) { |
| | | return requestClient.get<PageResult<MesProBagCodeApi.BagCode>>( |
| | | '/mes/pro/bag-code/unbound-ton-bag-page', |
| | | { params }, |
| | | ); |
| | | } |
| | | |
| | | /** 批量导出袋码 Excel(交付印刷) */ |
| | | export function exportBagCodeExcel(params: MesProBagCodeApi.PageParams) { |
| | | return requestClient.download('/mes/pro/bag-code/export-excel', { params }); |
| | |
| | | export function exportBagQr(params: { uuid?: string; batchId?: number }) { |
| | | return requestClient.download('/mes/pro/bag-code/export-qr', { params }); |
| | | } |
| | | |
| | | /** 补生成已有袋码的业务码,重复操作不更换已有码值。 */ |
| | | export function generateBagBusinessCodes(ids: number[]) { |
| | | return requestClient.post<number>('/mes/pro/bag-code/generate-business-code', { ids }); |
| | | } |
| | | |
| | | /** 业务二维码仅编码存储的业务码值,不拼接追溯网址。 */ |
| | | export function exportBagBusinessQr(params: { uuid?: string; batchId?: number }) { |
| | | return requestClient.download('/mes/pro/bag-code/export-business-qr', { params }); |
| | | } |