46 lines
1.7 KiB
TypeScript
46 lines
1.7 KiB
TypeScript
// import {Router} from 'express'
|
|
// import { runQuery } from '../utils/sql/config/sqlConfig.js'
|
|
// import { ocmeInventory } from '../utils/sql/querys/getOCMEInventory.js'
|
|
|
|
// const router = Router()
|
|
|
|
// router.post('/getLaneData', async (req,res)=>{
|
|
|
|
// let filterdOCMELane
|
|
// // the body will need to have 1 lane in it. lane: 'B050'
|
|
// const data = req.body
|
|
|
|
// // add the lane in so we dont crash
|
|
// if(req.body.lane){
|
|
// if(data.laneType === "laneID"){
|
|
// get the mapped lane id
|
|
// where alpla_laneID = 30286
|
|
// filterdOCMELane = ocmeInventory.replaceAll("where alpla_laneDescription = '[lane]'", `where alpla_laneID = ${data.lane}`)
|
|
|
|
// } else {
|
|
// filterdOCMELane = ocmeInventory.replaceAll('[lane]', data.lane)
|
|
// }
|
|
// // get lanes
|
|
// const laneData = await runQuery(filterdOCMELane, 'Getting current ocme lanes linked')
|
|
// res.status(200).json({success: true,message: `All current lanes from the ocme system.`, totalpallets: laneData.length,data: laneData})
|
|
// return
|
|
// }
|
|
|
|
// // if the plant sends the id over lets change the entire where statement.
|
|
|
|
// if(req.body.laneID){
|
|
// console.log(`Getting the lane data by id`)
|
|
// filterdOCMELane = ocmeInventory.replaceAll(`alpla_laneDescription = '[lane]'`, `alpla_laneID = ${data.laneID}`)
|
|
// // get lanes
|
|
// const laneData = await runQuery(filterdOCMELane, 'Getting current ocme lanes linked')
|
|
// res.status(200).json({success: true,message: `All current lanes from the ocme system.`, totalpallets: laneData.length,data: laneData})
|
|
// return
|
|
// }
|
|
|
|
// // if everything is missing we send false
|
|
// res.status(200).json({success: false,message: `Missing either lane name or lane id.`})
|
|
|
|
// })
|
|
|
|
// export default router
|