fix(lottransfer): error in timing it would only allow for a 3min window
This commit is contained in:
@@ -55,7 +55,7 @@ export const consumeMaterial = async (data: Data) => {
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
});
|
||||
//console.log(results);
|
||||
|
||||
const { data: commandL, error: ce } = await tryCatch(
|
||||
db.insert(commandLog).values({
|
||||
commandUsed: "consumeMaterial",
|
||||
@@ -68,6 +68,7 @@ export const consumeMaterial = async (data: Data) => {
|
||||
status: results.status,
|
||||
};
|
||||
} catch (error: any) {
|
||||
console.log(error);
|
||||
return {
|
||||
success: false,
|
||||
status: 200,
|
||||
|
||||
@@ -88,7 +88,7 @@ export const lotMaterialTransfer = async (data: NewLotData) => {
|
||||
|
||||
// shift split
|
||||
const shiftTimeSplit = shift?.data[0]?.shiftChange.split(":");
|
||||
//console.log(shiftTimeSplit);
|
||||
console.log(parseInt(shiftTimeSplit[0]) - 1);
|
||||
// Current time
|
||||
const now = new Date();
|
||||
|
||||
@@ -97,12 +97,14 @@ export const lotMaterialTransfer = async (data: NewLotData) => {
|
||||
now.getFullYear(),
|
||||
now.getMonth(),
|
||||
1, //now.getDate(),
|
||||
shiftTimeSplit.length > 0 ? parseInt(shiftTimeSplit[0]) - 1 : 5, // this will parse the hour to remove teh zero
|
||||
shiftTimeSplit.length > 0 ? parseInt(shiftTimeSplit[1]) + 3 : 3,
|
||||
shiftTimeSplit.length > 0 ? parseInt(shiftTimeSplit[0]) : 5, // this will parse the hour to remove teh zero
|
||||
shiftTimeSplit.length > 0 ? parseInt(shiftTimeSplit[1]) : 3,
|
||||
0,
|
||||
0
|
||||
);
|
||||
|
||||
console.log("target", target.toLocaleString(), "Now", now.toLocaleString());
|
||||
|
||||
// to early time
|
||||
const early = new Date(
|
||||
now.getFullYear(),
|
||||
@@ -114,6 +116,8 @@ export const lotMaterialTransfer = async (data: NewLotData) => {
|
||||
0
|
||||
);
|
||||
|
||||
console.log("early", early.toLocaleString(), "Now", now.toLocaleString());
|
||||
|
||||
// next month just to be here
|
||||
const nextMonth = new Date(
|
||||
now.getFullYear(),
|
||||
@@ -125,6 +129,13 @@ export const lotMaterialTransfer = async (data: NewLotData) => {
|
||||
0
|
||||
);
|
||||
|
||||
console.log(
|
||||
"nextMonth",
|
||||
nextMonth.toLocaleString(),
|
||||
"Now",
|
||||
now.toLocaleString()
|
||||
);
|
||||
|
||||
// console.log(early, target);
|
||||
// if we are to early return early only if we are sending over eom
|
||||
if (data.type === "eom" && (early > now || target < now)) {
|
||||
|
||||
Reference in New Issue
Block a user