feat(standard orders in): multi customer orders in plus ignore already started
This commit is contained in:
47
server/services/logistics/controller/dm/ordersIn/ordersIn.ts
Normal file
47
server/services/logistics/controller/dm/ordersIn/ordersIn.ts
Normal file
@@ -0,0 +1,47 @@
|
||||
import { abbottOrders } from "./customMappings/abbottTruckList.js";
|
||||
import { standardOrders } from "./customMappings/standardOrders.js";
|
||||
|
||||
export const ordersIn = async (data: any, user: any) => {
|
||||
/**
|
||||
* Bulk orders in, and custom file parsing.
|
||||
*/
|
||||
|
||||
let success = true;
|
||||
let message = "";
|
||||
let orderData: any = [];
|
||||
|
||||
// what type of order are we dealing with?
|
||||
if (data["fileType"] === "standard") {
|
||||
// run the standard orders in
|
||||
const standard = await standardOrders(data["postOrders"], user);
|
||||
success = standard.success ?? false;
|
||||
message = standard.message ?? "Error posting Abbott Orders";
|
||||
orderData = standard.data;
|
||||
}
|
||||
|
||||
if (data["fileType"] === "abbott") {
|
||||
// orders in
|
||||
const abbott = await abbottOrders(data["postOrders"], user);
|
||||
success = abbott.success ?? false;
|
||||
message = abbott.message ?? "Error posting Abbott Orders";
|
||||
orderData = abbott.data;
|
||||
}
|
||||
|
||||
if (data["fileType"] === "energizer") {
|
||||
// orders in
|
||||
}
|
||||
|
||||
if (data["fileType"] === "loreal") {
|
||||
// orders in
|
||||
}
|
||||
|
||||
if (data["fileType"] === "pg") {
|
||||
// orders in
|
||||
}
|
||||
|
||||
return {
|
||||
success,
|
||||
message,
|
||||
data: orderData,
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user