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