JSFiddle - React, Tailwind, and code Playground
by schantanu
HTML
<p>
Test
</p>
JavaScript
var forecasts = GetForecasts();
var inventoryByPlant = GetInventoryByPlant();
var inventoryByPlantUncompressed = GetInventoryByPlant_Uncompressed();
function onOpen() {
var ui = SpreadsheetApp.getUi();
// Or DocumentApp, SlidesApp or FormApp.
ui.createMenu('Constrained Cabinet Automation')
.addItem('Run Allocations', 'main_priorityAllocations')
.addToUi();
}
function getUniqueMMIDByPlantList() {
var uniqueMMIDByPlantList = [];
for (var i = 0; i < inventoryByPlant.length; i++) {
var row = inventoryByPlant[i];
var mmid = row.MaterialID;
var plant = row.PlantID;
var foundCombo = false;
uniqueMMIDByPlantList.forEach(function(r) {
if (r.MMID == mmid && r.PlantID == plant) {
foundCombo = true;
}
});
if (!foundCombo) {
uniqueMMIDByPlantList.push({MMID: mmid, PlantID: plant});
}
}
return uniqueMMIDByPlantList;
}
function getUniqueCommonIDByPlantList() {
var uniqueCommonIDByPlantList = [];
for (var i = 0; i < inventoryByPlant.length; i++) {
var row = inventoryByPlant[i];
var commonID = row.CommonID;
var plant = row.PlantID;
if (commonID == 'KRK10110/21') {
console.log("!!!");
}
var foundCombo = false;
uniqueCommonIDByPlantList.forEach(function(r) {
if (r.CommonID == commonID && r.PlantID == plant) {
foundCombo = true;
}
});
if (!foundCombo) {
uniqueCommonIDByPlantList.push({CommonID: commonID, PlantID: plant});
}
}
return uniqueCommonIDByPlantList;
}
function prepAllocationsSheet() {
// unique list of common_id, materialid,dp_group_mkt
var uniqueOutputList = [];
for (var i = 0; i < forecasts.length; i++) {
var row = forecasts[i];
var mmid = row.ForecastedS4MMID;
var commonID = row.CommonID;
var market = row.Market;
var marketL3 = row.MarketL3;
var plant = row.PlantID;
var foundCombo = false;
uniqueOutputList.forEach(function(r) {
if...