"use server"; // import { serverFetchBlob } from "@/app/utils/fetchUtil"; // import { BASE_API_URL } from "@/config/api"; import { serverFetchBlob, serverFetchWithNoContent } from "../../utils/fetchUtil"; import { BASE_API_URL } from "../../../config/api"; export interface FileResponse { filename: string; blobValue: Uint8Array; } export const fetchPoQrcode = async (data: any) => { const reportBlob = await serverFetchBlob( `${BASE_API_URL}/stockInLine/download-label`, { method: "POST", body: JSON.stringify(data), headers: { "Content-Type": "application/json" }, }, ); return reportBlob; }; export interface LotLineToQrcode { inventoryLotLineId: number } export const fetchQrCodeByLotLineId = async (data: LotLineToQrcode) => { const reportBlob = await serverFetchBlob( `${BASE_API_URL}/inventoryLotLine/download-label`, { method: "POST", body: JSON.stringify(data), headers: { "Content-Type": "application/json" }, }, ); return reportBlob; } export interface PrintLabelForInventoryLotLineRequest { inventoryLotLineId: number; printerId: number; printQty?: number; } export async function printLabelForInventoryLotLine(data: PrintLabelForInventoryLotLineRequest) { const params = new URLSearchParams(); params.append("inventoryLotLineId", data.inventoryLotLineId.toString()); params.append("printerId", data.printerId.toString()); if (data.printQty != null && data.printQty !== undefined) { params.append("printQty", data.printQty.toString()); } return serverFetchWithNoContent( `${BASE_API_URL}/inventoryLotLine/print-label?${params.toString()}`, { method: "GET" } ); }