fix(abbott): fix to properly remove the space in the middle of the po
This commit is contained in:
@@ -100,9 +100,9 @@ export const abbottOrders = async (data: any, user: any) => {
|
||||
.map((o: any) => ({
|
||||
date: excelDateStuff(o.date, o.time),
|
||||
po:
|
||||
o.newton8oz.replace(" ", "") !== ""
|
||||
? o.newton8oz.replace(" ", "")
|
||||
: o.newton10oz.replace(" ", ""),
|
||||
o.newton8oz.replace(/\s+/g, "") !== ""
|
||||
? o.newton8oz.replace(/\s+/g, "")
|
||||
: o.newton10oz.replace(/\s+/g, ""),
|
||||
customerArticlenumber:
|
||||
o.newton8oz != ""
|
||||
? a.filter((a: any) => a.av === 118)[0]
|
||||
@@ -129,16 +129,18 @@ export const abbottOrders = async (data: any, user: any) => {
|
||||
const filterOrders: any = correctedOrders;
|
||||
filterOrders.forEach((oo: any) => {
|
||||
const isMatch = openOrders.some(
|
||||
(o: any) =>
|
||||
String(o.CustomerOrderNumber).trim() ===
|
||||
String(oo.CustomerOrderNumber).trim()
|
||||
(o: any) => String(o.po).trim() === String(oo.po).trim()
|
||||
);
|
||||
if (!isMatch) {
|
||||
console.log(`ok to update: ${oo.CustomerOrderNumber}`);
|
||||
console.log(`ok to update: ${oo.po}`);
|
||||
|
||||
// oo = {
|
||||
// ...oo,
|
||||
// CustomerOrderNumber: oo.CustomerOrderNumber.replace(" ", ""),
|
||||
// };
|
||||
postedOrders.push(oo);
|
||||
} else {
|
||||
console.log(`Not valid order to update: ${oo.CustomerOrderNumber}`);
|
||||
console.log(`Not valid order to update: ${oo.po}`);
|
||||
//console.log(oo)
|
||||
}
|
||||
});
|
||||
@@ -169,6 +171,7 @@ export const abbottOrders = async (data: any, user: any) => {
|
||||
orders: [...predefinedObject.orders, ...orders],
|
||||
};
|
||||
|
||||
console.log(updatedPredefinedObject);
|
||||
// post the orders to the server
|
||||
const posting = await postOrders(updatedPredefinedObject, user);
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { abbottOrders } from "./mappings/abbottTruckList.js";
|
||||
import { energizerOrders } from "./mappings/energizerOrdersIn.js";
|
||||
import { macroImportOrders } from "./mappings/macroImport.js";
|
||||
import { standardOrders } from "./mappings/standardOrders.js";
|
||||
|
||||
export const ordersIn = async (data: any, user: any) => {
|
||||
@@ -44,6 +45,14 @@ export const ordersIn = async (data: any, user: any) => {
|
||||
// orders in
|
||||
}
|
||||
|
||||
if (data["fileType"] === "macro") {
|
||||
// orders in
|
||||
const macro = await macroImportOrders(data["postOrders"], user);
|
||||
success = macro.success ?? false;
|
||||
message = macro.message ?? "Error posting Macro Orders";
|
||||
orderData = macro.data;
|
||||
}
|
||||
|
||||
return {
|
||||
success,
|
||||
message,
|
||||
|
||||
Reference in New Issue
Block a user