Psyduck - 可達鴨 之 鴨力山大

Current Path : home/irplbiz/public_html/icl_demo_cal/
Upload File :
Current File : /home/irplbiz/public_html/icl_demo_cal/demo.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>
    <form id="itemCountForm" class="calct-form">
        <div class="form-group fwc">
            <label for="beltDesignation">Belt Designation (lbs/in):</label>
            <!--<input type="number" id="beltDesignation" name="beltDesignation" required><br><br>-->

            <select id="beltDesignation" name="beltDesignation" id="beltDesignation" name="beltDesignation" required>
                <option value="2500">2500</option>
                <option value="3500">3500</option>
                <option value="4000">4000</option>
                <option value="4500">4500</option>
                <option value="5000">5000</option>
                <option value="6000">6000</option>
                <option value="6500">6500</option>
                <option value="7000">7000</option>
                <option value="8000">8000</option>
                <option value="9000">9000</option>
                <option value="10000">10000</option>
                <option value="11000">11000</option>
                <option value="12000">12000</option>
                <option value="14000">14000</option>
                <option value="15000">15000</option>
            </select>
        </div>
        <div class="form-group hwc">
            <label for="topCoverThickness">Top Cover Thickness (mm): </label>
            <input type="number" step="0.1" id="topCoverThickness" name="topCoverThickness" required>
        </div>
        <div class="form-group hwc">
            <label for="bottomCoverThickness">Bottom Cover Thickness (mm):</label>
            <input type="number" step="0.1" id="bottomCoverThickness" name="bottomCoverThickness" required>
        </div>
        <div class="form-group hwc">
            <label for="beltWeight">Belt Width:</label>
            <input type="number" step="0.1" id="beltWeight" name="beltWeight" required>
        </div>
        <div class="form-group hwc">
            <label for="belt_width_unit">Belt Width:</label>
            <select id="belt_width_unit" name="belt_width_unit" id="belt_width_unit" name="belt_width_unit" required>
                <option value="inch">inch</option>
                <option value="mm">mm</option>
            </select>
        </div>
        <div class="form-group hwc">
            <label for="rollLength">Roll Length:</label>
            <input type="number" step="0.1" id="rollLength" name="rollLength" required>
        </div>
        <div class="form-group hwc">
            <label for="unit">Unit:</label>
            <select id="unit" name="unit" id="unit" name="unit" required>
                <option value="meter">meter</option>
                <option value="feet">feet</option>
            </select>
        </div>

        <div class="form-group fwc">
            <button type="submit">Calculate</button>
        </div>

    </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);
            let beltWeight = parseFloat(document.getElementById('beltWeight').value);
            const belt_width_unit = document.getElementById('belt_width_unit').value;
            let rollLength = parseFloat(document.getElementById('rollLength').value);
            const unit = document.getElementById('unit').value;
            if (unit != 'meter') {
                rollLength = rollLength * 0.3048;
            }
            if (belt_width_unit != 'inch') {
                beltWeight = beltWeight / 25.4;
            }

            console.log(beltWeight);
            const result = getItemCount(beltDesignation, topCoverThickness, bottomCoverThickness, beltWeight, rollLength);
            document.getElementById('result').innerHTML = `
                <p>No Of Rolls Possible in 20ft Container: <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) {

            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 MarginOfToleranceForBeltThickness = 0.5;
            const MarginOfSafetyForWeight = 5;
            // var WeightKgs = 21000.00;
            var WeightKgs = 21200.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) H:`, result.Belt_Thickness);

            const CarcassThickness = result.Belt_Thickness - 2;
            console.log(`Carcass thickness is I:`, CarcassThickness);

            const BeltThicknessForTheGivenBelt =
                CarcassThickness + BottomCoverThickness + TopCoverThickness;

            console.log(
                `Belt thickness for the given belt is J:`,
                parseFloat(BeltThicknessForTheGivenBelt.toFixed(1))
            );


            console.log(`Margin of tolerance for belt thickness is K:`, MarginOfToleranceForBeltThickness);

            const FinalThickness = BeltThicknessForTheGivenBelt + MarginOfToleranceForBeltThickness;
            console.log(`Final Thickness L:`, parseFloat(FinalThickness.toFixed(1)));

            console.log(`Std Belt  Weight for 1X1 kg/sq.m M:`, result.Belt_Weight);

            console.log(`Std Belt  Weight for 1X1 lb/ft2 :`, result.Belt_Weight);

            console.log(`Margin Of Safety For Weight is O:`, MarginOfSafetyForWeight);

            const AdditionOfCoverThickness = (TopCoverThickness + BottomCoverThickness) - 2;
            console.log(`Addition Of Cover Thickness is P:`, parseFloat(AdditionOfCoverThickness.toFixed(1)));

            const AdditionalWeightDueToAdditionalThickness = AdditionOfCoverThickness * 1.3;
            console.log(`Additional Weight Due To Additional Thickness is Q:`, parseFloat(AdditionalWeightDueToAdditionalThickness.toFixed(2)));

            var StdBeltWeightFor = result.Belt_Weight;
            const BeltWeightNet = RollLength * (BeltWeight * 0.0254) * (StdBeltWeightFor + AdditionalWeightDueToAdditionalThickness) * (1 + MarginOfSafetyForWeight / 100);
            console.log(`Belt Weight Net is R:`, parseFloat(BeltWeightNet.toFixed(2)));

            //Belt Weight(kgs)	Gross S

            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;
            }


            //Core Dia (d) T
            let CoreDia;
            if (RollLength <= 200) {
                CoreDia = 250;
                console.log(`CoreDia is T:`, CoreDia);
            } else {
                CoreDia = 275;
                console.log(`CoreDia is T:`, CoreDia);
            }

            const BeltDiaM = Math.sqrt((RollLength * 1275 * FinalThickness) + (CoreDia * CoreDia) + 150) / 1000;
            console.log(`Belt Dia is (M) U:`, BeltDiaM.toFixed(2));

            const BeltDiaIn = Math.ceil(BeltDiaM * 39.37 * 100) / 100;
            console.log(`Belt Dia is (in) V: ${BeltDiaIn.toFixed(2)}`);



            const NoOfRollsAsPerWtCriteria = Math.trunc(WeightKgs / BeltWeightGross);
            console.log(`No Of Rolls As Per Width is (in1) W:`, NoOfRollsAsPerWtCriteria);


            const NoOfRollsAsPerWidth = Math.trunc(Widthin / BeltWeight);
            console.log(`No Of Rolls As Per Width is X:`, NoOfRollsAsPerWidth);



            const NoOfRollsAsPerLength = Math.trunc(Length / BeltDiaIn);
            console.log(`No Of Rolls As Per Length Y:`, NoOfRollsAsPerLength);

            const TotalNoOfRollsWithBeltWidthAsFrontView = NoOfRollsAsPerWidth * NoOfRollsAsPerLength;
            console.log(`Total No Of Rolls With Belt Width As Front View Z:`, TotalNoOfRollsWithBeltWidthAsFrontView);


            const NoOfRollsAsPerWidthAB = Math.trunc(Widthin / BeltDiaIn);
            console.log(`No Of Rolls As Per Width is (in1) AA:`, NoOfRollsAsPerWidthAB);

            const NoOfRollsAsPerLengthAC = Math.floor(Length / BeltWeight);
            console.log(`No Of Rolls As Per Length AB: ${NoOfRollsAsPerLengthAC}`);


            const TotalNoOfRollsWithBeltDiaAsFrontView = NoOfRollsAsPerWidthAB * NoOfRollsAsPerLengthAC;
            console.log(`Total No Of Rolls With Belt Dia As Front View AC:`, TotalNoOfRollsWithBeltDiaAsFrontView);

            //IF(AD3>=AA3,AD3,AA3)
            const FinalTotalRolls = Math.max(TotalNoOfRollsWithBeltDiaAsFrontView, TotalNoOfRollsWithBeltWidthAsFrontView);
            console.log(`No of rolls as per dimension criteria AD:`, FinalTotalRolls);

            //=(IF(AE3<=X3,AE3,X3))
            var NoOfRollsPossible = Math.min(FinalTotalRolls, NoOfRollsAsPerWtCriteria);
            console.log(`No Of Rolls Possible AE:`, 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);

            // const NoOfRollsAsPerWidthAH = Math.ceil(Container40LengthIn / BeltWeight);
            // const NoOfRollsAsPerWidthAH = Container40LengthIn / BeltWeight;
            // const NoOfRollsAsPerWidthAH = Math.trunc(Container40LengthIn / BeltWeight);
            // const NoOfRollsAsPerWidthAH = Math.round(Container40LengthIn / BeltWeight);
            // console.log(`No Of Rolls As Per Width AH: ${NoOfRollsAsPerWidthAH}`);
            const NoOfRollsAsPerWidthAH = Container40LengthIn / BeltWeight;
            let finalValueAH;

            if (NoOfRollsAsPerWidthAH >= 10) {
                finalValueAH = Math.ceil(NoOfRollsAsPerWidthAH);
            } else {
                finalValueAH = Math.floor(NoOfRollsAsPerWidthAH);
            }

            console.log(`No Of Rolls As Per Width AH: ${finalValueAH}`);



            var TotalNoofRollswithBeltWidthasfrontviewAI = Math.floor(NoOfRollsAsPerWidthAG * finalValueAH);
            console.log(`Total No of Rolls with Belt Width as front view AI:`, TotalNoofRollswithBeltWidthasfrontviewAI);

            var NoOfRollsAsPerWidthAJ = Math.trunc(Container40WidthIn / BeltDiaIn);
            console.log(`No Of Rolls As Per Width is (in1) AJ:`, NoOfRollsAsPerWidthAJ);

            console.log(`BeltWeight`, BeltWeight, `Container40LengthIn`, Container40LengthIn);
            var NoOfRollsAsPerLengthAK = Math.trunc(Container40LengthIn / BeltWeight);
            console.log(`No of Rolls as per length AK:`, NoOfRollsAsPerLengthAK);

            var NoOfRollsAsPerLengthAL = NoOfRollsAsPerWidthAJ * NoOfRollsAsPerLengthAK;
            console.log(`Total No of Rolls with Belt Dia as front view AL:`, NoOfRollsAsPerLengthAL);

            var TotalNoOfRollsWithBeltDiaAsFrontViewAM = Math.max(NoOfRollsAsPerLengthAL, TotalNoofRollswithBeltWidthasfrontviewAI);
            console.log(`No of rolls as per dimension criteria AM:`, TotalNoOfRollsWithBeltDiaAsFrontViewAM);

            //--------------------------

            const FinalRollsIn40FtContainer = Math.min(TotalNoOfRollsWithBeltDiaAsFrontViewAM, NoOfRollsAsPerwtCriteria);
            console.log(`No of Rolls Possible AN:`, FinalRollsIn40FtContainer);


            return { NoOfRollsPossible, FinalRollsIn40FtContainer };

        }
    </script>
</body>

</html>