feat(ocmeserver): the server was just migrated so it can be upgraded to lstv2
This commit is contained in:
78
server/services/ocmeServer/laneUpdate/configureLanes.ts
Normal file
78
server/services/ocmeServer/laneUpdate/configureLanes.ts
Normal file
@@ -0,0 +1,78 @@
|
||||
// import {runQuery} from "../utils/sql/config/sqlConfig.js";
|
||||
// /**
|
||||
// * 1. Copy the Setup.xml to the desktop.
|
||||
// * 2. run the createJson script.
|
||||
// * 3. get the alplaprod lanes with this query select IdLagerAbteilung as id,Bezeichnung as name from [dbo].[V_LagerAbteilungen] where IdWarenLager not in (6,5) and aktiv = 1
|
||||
// * 4. convert this to a json
|
||||
// *
|
||||
// * in the ocme data we want grab the section in each section called "clsParkingRow" this is inside the RowList. thenjust copy the array into the lanes.
|
||||
// *
|
||||
// */
|
||||
// export const lanes = [];
|
||||
|
||||
// export const prodNames = [];
|
||||
// const combinedInfo = [];
|
||||
// const updatedLanesWithNames = lanes.map((l) => {
|
||||
// //filter the prodnames out
|
||||
// if (l.CustomerKey === "") {
|
||||
// return;
|
||||
// }
|
||||
// const names = prodNames.filter((v) => v.id === l.CustomerKey);
|
||||
|
||||
// if (names) {
|
||||
// //console.log({...l, laneName: names[0]?.name});
|
||||
// combinedInfo.push({...l, laneName: names[0]?.name});
|
||||
// }
|
||||
// });
|
||||
|
||||
// // get the skey from ocme
|
||||
// const matcheverything = async () => {
|
||||
// const query = `select SKEY as ocme_laneLevelID, id_row, id_park from [Agv_AlplaDayton].[dbo].[Park] where id_park in (4,3)`;
|
||||
|
||||
// const ocmeData = await runQuery(query, "lanes");
|
||||
|
||||
// //console.log(ocmeData)
|
||||
|
||||
// const ocmeToSend = [];
|
||||
// const correctOcmeData = ocmeData.map((o) => {
|
||||
// // filter out the prod lanes
|
||||
// const prodInfo = combinedInfo.filter((f) => f.Id === o.id_row && f.ParkId === o.id_park);
|
||||
|
||||
// if (prodInfo.length === 0) {
|
||||
// return;
|
||||
// }
|
||||
// if (prodInfo) {
|
||||
// ocmeToSend.push({...o, laneName: prodInfo[0].laneName, laneId: prodInfo[0].CustomerKey});
|
||||
// }
|
||||
// });
|
||||
|
||||
// function delay(ms) {
|
||||
// return new Promise((resolve) => setTimeout(resolve, ms));
|
||||
// }
|
||||
|
||||
// //console.log(ocmeToSend)
|
||||
// for (let i = 0; i < ocmeToSend.length; i++) {
|
||||
// let updateQuery = `
|
||||
// MERGE INTO [Alpla_Lst].[dbo].[lanes] AS target
|
||||
// USING (SELECT '${ocmeToSend[i].ocme_laneLevelID}' AS ocme_laneLevelID, ${ocmeToSend[i].laneId} AS alpla_laneID, '${ocmeToSend[i].laneName}' AS alpla_laneDescription, getdate() as upd_date) AS source
|
||||
// ON target.ocme_laneLevelID LIKE source.ocme_laneLevelID
|
||||
// WHEN MATCHED THEN
|
||||
// UPDATE SET target.alpla_laneID = source.alpla_laneID,
|
||||
// target.alpla_laneDescription = source.alpla_laneDescription,
|
||||
// target.upd_date = source.upd_date
|
||||
// WHEN NOT MATCHED BY TARGET THEN
|
||||
// INSERT (ocme_laneLevelID, alpla_laneID, alpla_laneDescription, upd_date)
|
||||
// VALUES (source.ocme_laneLevelID, source.alpla_laneID, source.alpla_laneDescription, source.upd_date);
|
||||
// `;
|
||||
|
||||
// const queryRan = await runQuery(updateQuery, "running");
|
||||
// console.log(
|
||||
// `${ocmeToSend[i].ocme_laneLevelID} just updated in park ${ocmeToSend[i].id_park}, remaining to update ${
|
||||
// ocmeToSend.length - i
|
||||
// }`
|
||||
// );
|
||||
// await delay(150);
|
||||
// }
|
||||
// };
|
||||
|
||||
// matcheverything();
|
||||
Reference in New Issue
Block a user