feat(bulk orders): standard template created
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
import * as XLSX from "xlsx";
|
||||
|
||||
export const standardTemplate = async () => {
|
||||
/**
|
||||
* Creates the standard Template for bulk orders in
|
||||
*/
|
||||
|
||||
const headers = [
|
||||
[
|
||||
"CustomerArticleNumber",
|
||||
"CustomerOrderNumber",
|
||||
"CustomerLineNumber",
|
||||
"CustomerRealeaseNumber",
|
||||
"Quantity",
|
||||
"DeliveryDate",
|
||||
"CustomerID",
|
||||
// "InvoiceID",
|
||||
],
|
||||
];
|
||||
|
||||
// create a new workbook
|
||||
const wb = XLSX.utils.book_new();
|
||||
const ws = XLSX.utils.aoa_to_sheet(headers);
|
||||
//const ws2 = XLSX.utils.aoa_to_sheet(headers2);
|
||||
|
||||
const columnWidths = headers[0].map((header) => ({
|
||||
width: header.length + 2,
|
||||
}));
|
||||
|
||||
ws["!cols"] = columnWidths;
|
||||
|
||||
// append the worksheet to the workbook
|
||||
XLSX.utils.book_append_sheet(wb, ws, `Sheet1`);
|
||||
//XLSX.utils.book_append_sheet(wb, ws2, `Sheet2`);
|
||||
|
||||
// Write the excel file and trigger the download'
|
||||
XLSX.writeFile(wb, "BulkOrdersTemplate");
|
||||
|
||||
// Write the workbook to a buffer and return it
|
||||
const excelBuffer = XLSX.write(wb, { bookType: "xlsx", type: "buffer" });
|
||||
|
||||
return excelBuffer;
|
||||
};
|
||||
@@ -11,6 +11,8 @@ import { getLanesToCycleCount } from "./controller/warehouse/cycleCountChecks/cy
|
||||
import getCycleCountCheck from "./route/getCycleCountChecks.js";
|
||||
import getPPOO from "./route/getPPOO.js";
|
||||
import getcyclecount from "./route/getCycleCountLanes.js";
|
||||
import postBulkOrders from "./route/dm/bulkOrdersIn.js";
|
||||
import standardTemplate from "./route/dm/getStandardTemplate.js";
|
||||
|
||||
const app = new OpenAPIHono();
|
||||
|
||||
@@ -28,6 +30,9 @@ const routes = [
|
||||
//warehouse
|
||||
getPPOO,
|
||||
getcyclecount,
|
||||
//DM
|
||||
postBulkOrders,
|
||||
standardTemplate,
|
||||
] as const;
|
||||
|
||||
// app.route("/server", modules);
|
||||
|
||||
Reference in New Issue
Block a user