| | |
| | | import { getBagCodeByCode, resolveTraceType } from '#/api/mes/pro/bagCode'; |
| | | import { getPalletByCode } from '#/api/mes/pro/pallet'; |
| | | import { getBatchByCode } from '#/api/mes/pro/batch'; |
| | | import { getMaterialStockPage, type MesWmMaterialStockApi } from '#/api/mes/wm/materialstock'; |
| | | import { can, extractCode } from './access'; |
| | | import type { MesProScanEventApi } from '#/api/mes/pro/scanEvent'; |
| | | export interface TraceObject { |
| | |
| | | if(trace.data.batchStatus===40)return '该对象所属批次已作废,不可执行写操作'; |
| | | return ''; |
| | | } |
| | | /** 扫码对象可带入单据的数量:袋码按 1 袋,托盘按已装袋数,批次按批次袋数。 */ |
| | | export function traceQuantity(trace: TraceResult) { |
| | | if (trace.type === 'bag') return 1; |
| | | if (trace.type === 'pallet') return trace.data.bagCount; |
| | | return trace.data.bagQuantity; |
| | | } |
| | | /** 按扫码对象的物料与批次查找库存记录,供需要选择库存记录的单据带出明细。 */ |
| | | export async function findStocks( |
| | | trace: TraceResult, |
| | | options: { stockState?: number; virtualFilter?: string } = {}, |
| | | ): Promise<MesWmMaterialStockApi.MaterialStock[]> { |
| | | if (!trace.data.itemId) return []; |
| | | const result = await getMaterialStockPage({ |
| | | pageNo: 1, |
| | | pageSize: 50, |
| | | batchCode: trace.data.batchCode, |
| | | itemId: trace.data.itemId, |
| | | ...options, |
| | | }); |
| | | return result.list; |
| | | } |
| | | export function myRecords(params: { pageNo: number; pageSize: number; status?: string; eventId?: string; receivedTime?: string[] }) { |
| | | return requestClient.get<{ list: MesProScanEventApi.ScanEvent[]; total: number }>('/mes/pro/scan-in/my-page', { params }); |
| | | } |