Psyduck - 可達鴨 之 鴨力山大
Current File : /home/irplbiz/public_html/icl_demo_cal/index.html |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<h1>Calculate Item Count</h1>
<form id="itemCountForm">
<label for="beltDesignation">Belt Designation:</label>
<input type="number" id="beltDesignation" name="beltDesignation" required><br><br>
<label for="topCoverThickness">Top Cover Thickness:</label>
<input type="number" step="0.1" id="topCoverThickness" name="topCoverThickness" required><br><br>
<label for="bottomCoverThickness">Bottom Cover Thickness:</label>
<input type="number" step="0.1" id="bottomCoverThickness" name="bottomCoverThickness" required><br><br>
<label for="beltWeight">Belt Weight:</label>
<input type="number" step="0.1" id="beltWeight" name="beltWeight" required><br><br>
<label for="rollLength">Roll Length:</label>
<input type="number" step="0.1" id="rollLength" name="rollLength" required><br><br>
<button type="submit">Calculate</button>
</form>
<div id="result"></div>
<script>
document.getElementById('itemCountForm').addEventListener('submit', function(e) {
e.preventDefault();
const beltDesignation = parseFloat(document.getElementById('beltDesignation').value);
const topCoverThickness = parseFloat(document.getElementById('topCoverThickness').value);
const bottomCoverThickness = parseFloat(document.getElementById('bottomCoverThickness').value);
const beltWeight = parseFloat(document.getElementById('beltWeight').value);
const rollLength = parseFloat(document.getElementById('rollLength').value);
const result = getItemCount(beltDesignation, topCoverThickness, bottomCoverThickness, beltWeight, rollLength);
document.getElementById('result').innerHTML = `
<p>No Of Rolls Possible: <strong>${result.NoOfRollsPossible}</strong></p>
<p>No of Rolls Possible in 40ft Container: <strong>${result.FinalRollsIn40FtContainer}</strong></p>
`;
});
</script>
<script>
//console.log(getItemCount(8000, 1.5, 1.5, 60, 200));
function getItemCount(Belt_Designation , TopCoverThickness, BottomCoverThickness, BeltWeight, RollLength) {
// Sample data
// This data should ideally be fetched from a database or an API
const data = [
{ "Belt_Designation": 2500, "Top_Cover_Thickness": 1, "Bottom_Cover_Thickness": 1, "Belt_Thickness": 7.5, "Belt_Weight": 9.5 },
{ "Belt_Designation": 3500, "Top_Cover_Thickness": 1, "Bottom_Cover_Thickness": 1, "Belt_Thickness": 8, "Belt_Weight": 10.5 },
{ "Belt_Designation": 4000, "Top_Cover_Thickness": 1, "Bottom_Cover_Thickness": 1, "Belt_Thickness": 8.3, "Belt_Weight": 10.9 },
{ "Belt_Designation": 4500, "Top_Cover_Thickness": 1, "Bottom_Cover_Thickness": 1, "Belt_Thickness": 8.5, "Belt_Weight": 11.2 },
{ "Belt_Designation": 5000, "Top_Cover_Thickness": 1, "Bottom_Cover_Thickness": 1, "Belt_Thickness": 8.9, "Belt_Weight": 11.5 },
{ "Belt_Designation": 6000, "Top_Cover_Thickness": 1, "Bottom_Cover_Thickness": 1, "Belt_Thickness": 9.4, "Belt_Weight": 12 },
{ "Belt_Designation": 6500, "Top_Cover_Thickness": 1, "Bottom_Cover_Thickness": 1, "Belt_Thickness": 9.5, "Belt_Weight": 12.5 },
{ "Belt_Designation": 7000, "Top_Cover_Thickness": 1, "Bottom_Cover_Thickness": 1, "Belt_Thickness": 10.5, "Belt_Weight": 14 },
{ "Belt_Designation": 8000, "Top_Cover_Thickness": 1, "Bottom_Cover_Thickness": 1, "Belt_Thickness": 11, "Belt_Weight": 15 },
{ "Belt_Designation": 9000, "Top_Cover_Thickness": 1, "Bottom_Cover_Thickness": 1, "Belt_Thickness": 12, "Belt_Weight": 15.5 },
{ "Belt_Designation": 10000, "Top_Cover_Thickness": 1, "Bottom_Cover_Thickness": 1, "Belt_Thickness": 13, "Belt_Weight": 16.5 },
{ "Belt_Designation": 11000, "Top_Cover_Thickness": 1, "Bottom_Cover_Thickness": 1, "Belt_Thickness": 13.5, "Belt_Weight": 17 },
{ "Belt_Designation": 12000, "Top_Cover_Thickness": 1, "Bottom_Cover_Thickness": 1, "Belt_Thickness": 14.5, "Belt_Weight": 18 },
{ "Belt_Designation": 14000, "Top_Cover_Thickness": 1, "Bottom_Cover_Thickness": 1, "Belt_Thickness": 15.5, "Belt_Weight": 19 },
{ "Belt_Designation": 15000, "Top_Cover_Thickness": 1, "Bottom_Cover_Thickness": 1, "Belt_Thickness": 16.5, "Belt_Weight": 20 }
];
// const Belt_Designation = 8000;
// var TopCoverThickness = 1.5;
// var BottomCoverThickness = 1.5;
// const BeltWeight = 60;
const MarginOfToleranceForBeltThickness = 0.5;
const MarginOfSafetyForWeight = 5;
// var RollLength = 200;
// let BeltWeightGross = 0;
var WeightKgs = 21000.00;
var Widthin = 92;
var Length = 228;
var Container40WeightKgs = 26000.00;
var Container40LengthIn = 475;
var Container40WidthIn = 92;
let BeltWeightGross = 0;
const result = data.find(item => item.Belt_Designation === Belt_Designation);
console.log(`Belt Thickness for (1X1 mm):`, result.Belt_Thickness);
const CarcassThickness = result.Belt_Thickness - 2;
console.log(`Carcass thickness is:`, CarcassThickness);
const BeltThicknessForTheGivenBelt =CarcassThickness + BottomCoverThickness + TopCoverThickness;
console.log(`Belt thickness for the given belt is:`, BeltThicknessForTheGivenBelt);
console.log(`Margin of tolerance for belt thickness is:`, MarginOfToleranceForBeltThickness);
const FinalThickness = BeltThicknessForTheGivenBelt + MarginOfToleranceForBeltThickness;
console.log(`Final Thickness:`, FinalThickness);
console.log(`Std Belt Weight for 1X1 kg/sq.m:`, result.Belt_Weight);
console.log(`Std Belt Weight for 1X1 lb/ft2:`, result.Belt_Weight);
console.log(`Margin Of Safety For Weight is:`, MarginOfSafetyForWeight);
const AdditionOfCoverThickness = (TopCoverThickness + BottomCoverThickness) - 2;
console.log(`Addition Of Cover Thickness is:`, AdditionOfCoverThickness);
const AdditionalWeightDueToAdditionalThickness = AdditionOfCoverThickness * 1.3;
console.log(`Additional Weight Due To Additional Thickness is:`, AdditionalWeightDueToAdditionalThickness);
var StdBeltWeightFor = result.Belt_Weight;
const BeltWeightNet = RollLength * (BeltWeight * 0.0254) * (StdBeltWeightFor + AdditionalWeightDueToAdditionalThickness) * (1 + MarginOfSafetyForWeight / 100);
console.log(`Belt Weight Net is:`, BeltWeightNet);
if (Belt_Designation <= 8000 && BeltWeight <= 48 && RollLength < 150) {
BeltWeightGross = BeltWeightNet + 70;
} else if (Belt_Designation <= 8000 && BeltWeight <= 48 && RollLength >= 150) {
BeltWeightGross = BeltWeightNet + 90;
} else if (Belt_Designation > 8000 && Belt_Designation <= 10000 && BeltWeight > 48 && BeltWeight <= 60) {
BeltWeightGross = BeltWeightNet + 120;
} else if (Belt_Designation <= 8000 && BeltWeight > 48 && RollLength > 150) {
BeltWeightGross = BeltWeightNet + 110;
} else if (BeltWeight === 72) {
BeltWeightGross = BeltWeightNet + 190;
} else {
BeltWeightGross = BeltWeightNet + 90;
}
let CoreDia;
if (RollLength <= 200) {
CoreDia = 250;
console.log(`CoreDia is:`, CoreDia);
} else {
CoreDia = 275;
console.log(`CoreDia is:`, CoreDia);
}
const BeltDiaM = Math.sqrt((RollLength * 1275 * FinalThickness) + (CoreDia * CoreDia) + 150) / 1000;
console.log(`Belt Dia is (M):`, BeltDiaM.toFixed(2));
const BeltDiaIn = Math.round(BeltDiaM * 39.37, 2);
console.log(`Belt Dia is (in):`, BeltDiaIn.toFixed(2));
const NoOfRollsAsPerWtCriteria = Math.trunc(WeightKgs / BeltWeightGross);
console.log(`No Of Rolls As Per Width is (in1):`, NoOfRollsAsPerWtCriteria);
const NoOfRollsAsPerWidth = Math.trunc(Widthin / BeltWeight);
console.log(`No Of Rolls As Per Width is:`, NoOfRollsAsPerWidth);
const NoOfRollsAsPerLength = Math.trunc(Length / BeltDiaIn);
console.log(`No Of Rolls As Per Length:`, NoOfRollsAsPerLength);
const TotalNoOfRollsWithBeltWidthAsFrontView = NoOfRollsAsPerWidth * NoOfRollsAsPerLength;
console.log(`Total No Of Rolls With Belt Width As Front View:`, TotalNoOfRollsWithBeltWidthAsFrontView);
const NoOfRollsAsPerWidthAB = Math.trunc(Widthin / BeltDiaIn);
console.log(`No Of Rolls As Per Width is (in1):`, NoOfRollsAsPerWidthAB);
const NoOfRollsAsPerLengthAC = Math.trunc(Length / BeltWeight);
console.log(`No Of Rolls As Per Length:`, NoOfRollsAsPerLengthAC);
const TotalNoOfRollsWithBeltDiaAsFrontView = NoOfRollsAsPerWidthAB * NoOfRollsAsPerLengthAC;
console.log(`Total No Of Rolls With Belt Dia As Front View:`, TotalNoOfRollsWithBeltDiaAsFrontView);
//IF(AD3>=AA3,AD3,AA3)
const FinalTotalRolls = Math.max(TotalNoOfRollsWithBeltDiaAsFrontView, TotalNoOfRollsWithBeltWidthAsFrontView);
console.log(`Final Total Rolls (greater of the two views):`, FinalTotalRolls);
//=(IF(AE3<=X3,AE3,X3))
var NoOfRollsPossible = Math.min(FinalTotalRolls, NoOfRollsAsPerWtCriteria);
console.log(`No Of Rolls Possible:`, NoOfRollsPossible);
var NoOfRollsAsPerwtCriteria = Math.trunc(Container40WeightKgs / BeltWeightGross);
console.log(`No Of Rolls As Per wt Criteria AF :`, NoOfRollsAsPerwtCriteria);
var NoOfRollsAsPerWidthAG = Math.trunc(Container40WidthIn / BeltWeight);
console.log(`No Of Rolls As Per Width AG:`, NoOfRollsAsPerWidthAG);
var NoOfRollsAsPerWidthAH = Math.ceil(Container40LengthIn / BeltWeight);
console.log(`No Of Rolls As Per Width AH:`, NoOfRollsAsPerWidthAH);
var TotalNoofRollswithBeltWidthasfrontviewAI = NoOfRollsAsPerWidthAG*NoOfRollsAsPerWidthAH;
console.log(`Total No of Rolls with Belt Width as front view AI:`, TotalNoofRollswithBeltWidthasfrontviewAI);
var NoOfRollsAsPerWidthAK = Math.trunc(Container40WidthIn / BeltDiaIn);
console.log(`No Of Rolls As Per Width is (in1):`, NoOfRollsAsPerWidthAK);
var NoOfRollsAsPerLengthAL = Math.trunc(Container40LengthIn / BeltWeight);
console.log(`No Of Rolls As Per Length:`, NoOfRollsAsPerLengthAL);
var TotalNoOfRollsWithBeltDiaAsFrontViewAM = NoOfRollsAsPerWidthAK * NoOfRollsAsPerLengthAL;
console.log(`Total No Of Rolls With Belt Dia As Front View:`, TotalNoOfRollsWithBeltDiaAsFrontViewAM);
//--------------------------
const FinalTotalRolls40Container = Math.max(TotalNoOfRollsWithBeltDiaAsFrontViewAM, TotalNoofRollswithBeltWidthasfrontviewAI);
console.log(`No of rolls as per dimension criteria:`, FinalTotalRolls40Container);
const FinalRollsIn40FtContainer = Math.min(NoOfRollsAsPerwtCriteria, FinalTotalRolls40Container);
console.log(`No of Rolls Possible:`, FinalRollsIn40FtContainer);
return {NoOfRollsPossible,FinalRollsIn40FtContainer};
}
</script>
</body>
</html>