fix(dm): abbott truck time corrections
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { addDays, addHours, isAfter, parse } from "date-fns";
|
||||
import { format } from "date-fns-tz";
|
||||
import XLSX from "xlsx";
|
||||
import { db } from "../../../../../../../database/dbclient.js";
|
||||
import { settings } from "../../../../../../../database/schema/settings.js";
|
||||
@@ -92,7 +93,7 @@ export const abbottOrders = async (data: any, user: any) => {
|
||||
orders: [],
|
||||
};
|
||||
const oOrders: any = openOrders;
|
||||
|
||||
//console.log(orderData);
|
||||
let correctedOrders: any = orderData
|
||||
.filter(
|
||||
(o: any) =>
|
||||
@@ -147,6 +148,7 @@ export const abbottOrders = async (data: any, user: any) => {
|
||||
|
||||
// Map Excel data to predefinedObject format
|
||||
const orders = filterOrders.map((o: any) => {
|
||||
//console.log(o.po, " ", o.date, format(o.date, "M/d/yyyy HH:mm"));
|
||||
return {
|
||||
customerId: customerID,
|
||||
invoiceAddressId: invoiceID,
|
||||
@@ -157,7 +159,7 @@ export const abbottOrders = async (data: any, user: any) => {
|
||||
deliveryAddressId: 8,
|
||||
customerArticleNo: o.customerArticlenumber,
|
||||
quantity: o.qty,
|
||||
deliveryDate: addHours(addDays(o.date, 1), 1), // adding this in so we can over come the constant 1 day behind thing as a work around
|
||||
deliveryDate: addHours(format(o.date, "M/d/yyyy HH:mm"), 1), //addHours(addDays(o.date, 1), 1), // adding this in so we can over come the constant 1 day behind thing as a work around
|
||||
customerLineItemNo: 1, // this is how it is currently sent over from abbott
|
||||
customerReleaseNo: 1, // same as above
|
||||
},
|
||||
@@ -165,6 +167,7 @@ export const abbottOrders = async (data: any, user: any) => {
|
||||
};
|
||||
});
|
||||
|
||||
//console.log(orders);
|
||||
// combine it all together.
|
||||
const updatedPredefinedObject = {
|
||||
...predefinedObject,
|
||||
|
||||
Reference in New Issue
Block a user