📐 T3_Uty3_PL_LoadingAndStorageScale.vb - Detailed Explanation

📋 Overview

This file is an advanced utility software designed to calculate the optimal loading pattern for cases onto pallets (PL) and determine the number of pallets required for storage. It automatically calculates the optimal loading method based on case dimensions and the effective space of the pallet.

Main Uses:
  • Optimization calculation for case-to-pallet loading patterns
  • Comparison of multiple loading patterns (P1, P2, P1&P2, P2&P1)
  • Automatic selection of the optimal pattern considering fill rates
  • Calculation of the number of pallets required for storage
  • Visualization of loading images (2D graphic drawing)
  • Support for multiple pallet sizes
What is Pallet Loading? In logistics, it is the process of efficiently arranging goods (cases) on a pallet. Transport and storage efficiency vary greatly depending on the loading pattern.

🔧 Dependencies

Imports System.Runtime.InteropServices
Imports Microsoft.Office.Interop
Imports OfficeOpenXml

Technologies Used:

🎯 Key Features

1. Pallet Loading Calculation

2. Loading Patterns

3. Storage Pallet Count Calculation

4. Visualization Features

📦 Details of Loading Patterns

P1 Pattern (Longitudinal)

Arrangement Method:
The long side (length) of the case is along the pallet width, and the short side (width) is along the pallet depth.

Calculation Formula:
Count in Width Direction = INT(Effective Width / Case Length)
Count in Depth Direction = INT(Effective Depth / Case Width)
Planar Count = Width Count × Depth Count

P2 Pattern (Transverse)

Arrangement Method:
The short side (width) of the case is along the pallet width, and the long side (length) is along the pallet depth.

Calculation Formula:
Count in Width Direction = INT(Effective Width / Case Width)
Count in Depth Direction = INT(Effective Depth / Case Length)
Planar Count = Width Count × Depth Count

P1&P2 Pattern (Combination 1)

Arrangement Method:
Alternates P1 and P2 patterns.
Fills the remaining space with P2 using P1 as the base.

Features:
Minimizes dead space and improves fill rate.

P2&P1 Pattern (Combination 2)

Arrangement Method:
Alternates P2 and P1 patterns.
Fills the remaining space with P1 using P2 as the base.

Features:
The reverse arrangement of P1&P2, achieving a different optimization.

🔍 Main Methods Details

1. Form Load Processing

Private Sub PalletLoadingCalcFrom_Load(sender As Object, e As EventArgs)

Initialization Process:

  1. Display expiration date and copyright
  2. Check existence of required files
  3. Set Excel file paths
    MyExcel1 = DatSavePath & "\PLLoadingCalc\PLLoadingCalc.xlsx"
    MyE1_Sheet1 = "PLSpecsAndPackaging"
    MyE1_Sheet2 = "CaseCountAndDimensions"
  4. Read PL information
  5. Write items to ComboBox
  6. Read case information
  7. Execute PL loading calculation

2. Execute PL Loading Calculation

Private Sub ExecutePLLoadingCalc()

Processing Flow:

  1. Initialize case calculated flags
  2. Execute PL loading calculation
  3. Display settings for Loading Calc Results Gv
    • Set odd row background colors to GreenYellow
    • Set even rows to Aquamarine
    • Provides visual feedback
  4. Execute all PL aggregation
Alternating Background Colors: The background color changes every time a calculation is executed, allowing visual confirmation of recalculation.

3. PL Loading Calculation

Private Sub PLLoadingCalc()

Calculation Steps:

  1. P1 Pattern Calculation
    • Calculate loadable count in width and depth directions
    • Calculate planar count and tiers
    • Calculate total loaded cases
  2. P2 Pattern Calculation
    • Similar to P1, but orientation is reversed
  3. P1&P2 Pattern Calculation
    • Calculate remaining space after P1 arrangement
    • Arrange P2 in the remaining space
    • Calculate total planar count
  4. P2&P1 Pattern Calculation
    • Calculate remaining space after P2 arrangement
    • Arrange P1 in the remaining space
    • Calculate total planar count
  5. Selection of Optimal Pattern
    • Compare fill rates of each pattern
    • Recommend the pattern with the highest fill rate

4. Read PL Information

Private Sub ReadPLInfo()

Loaded Data:

What are Effective Dimensions? Dimensions derived by subtracting deck board thickness or protruding frames from the physical pallet dimensions, representing the actual loadable area for cases.

5. Read Case Information

Private Sub ReadCaseInfo()

Loaded Data:

6. PLID Selection

Private Sub SelectPLID()

Processing Details:

📊 Details of Calculation Formulas

Planar Count Calculation

Planar Count = Width Count × Depth Count

Tiers Calculation

Tiers = INT(Effective Height / Case Height)

Total Loaded Count Calculation

Total Loaded Count = Planar Count × Tiers

Fill Rate Calculation

Planar Fill Rate (%) = (Planar Count × Case Area) / (Effective Width × Effective Depth) × 100

Required PL Count Calculation

Required PL Count = CEILING(Total Case Count / Total Loaded Count)

* Uses the CEILING function to round up (to prevent shortages).

Average Fill Rate Calculation

Average Fill Rate (%) = (Total Case Count / (Required PL Count × Planar Count)) × 100

🖼️ Loading Image Drawing Feature

Drawing Methods List

Method Name Description
LoadingImageP1() Draws the loading diagram for the P1 pattern
LoadingImageP2() Draws the loading diagram for the P2 pattern
LoadingImageP1P2() Draws the loading diagram for the P1&P2 pattern
LoadingImageP2P1() Draws the loading diagram for the P2&P1 pattern

Basic Structure of Drawing

  1. Create Bitmap Object
    Dim img As New Bitmap(W + 10, H + 10)
    Dim g As Graphics = Graphics.FromImage(img)
  2. Draw Pallet Frame
    g.FillRectangle(Brushes.Bisque, x1, y1, x2, y2) ' Fill with Bisque
    g.DrawRectangle(Pens.Black, x1, y1, x2, y2) ' Black outline
  3. Draw Effective Area
    g.DrawRectangle(Pens.Black, x1, y1, x2, y2) ' Black outline
  4. Draw Case Arrangement
    g.FillRectangle(Brushes.Azure, x1, y1, x2, y2) ' Fill with Azure
    g.DrawRectangle(Pens.Black, x1, y1, x2, y2) ' Black outline
  5. Draw Surplus Space
    g.FillRectangle(Brushes.Thistle, x1, y1, x2, y2) ' Fill with Thistle
  6. Display Image
    LoadingImagePb.SizeMode = PictureBoxSizeMode.Zoom
    LoadingImagePb.Image = img

Color Usage

Color Use Meaning
Bisque Pallet body Physical range of the pallet
Black Outline / Effective area Boundaries
Azure Loaded cases Effectively utilized space
Thistle Surplus space Dead space
White Background Space outside the pallet

📈 All PL Aggregation Feature

All PL Aggregation

Private Sub AggregateAllPL()

Aggregation Details:

Optimal Pattern Display Dgv

Private Sub OptimalPLLoadingCalcDataGridViewDisplay()

Display Items:

Column Content
Estimated Trial Serial No Identifier for the calculated pattern
PLID Identifier for the pallet used
Case No Identifier for the case
Loading Pattern P1, P2, P1&P2, P2&P1
Planar Count Number of cases per tier
Tiers Stackable number of tiers
Total Loaded Count Total number of cases per pallet
Required PL Count Number of pallets required to store all cases
Estimated Average Fill Rate Effective fill rate

🎨 UI Components

Input Controls

Control Description
PLIDSelectCb ComboBox to select Pallet ID
SavePathTb Displays Excel file path

DataGridView List

Display TextBoxes

Control Display Content
RequiredPLsForStorageTb Total required pallet count

Buttons

RadioButtons (Sorting Feature)

PictureBox

TabControl

Labels

🎯 Visual Feedback

Background Color Changes

When executing a calculation, the background colors of multiple controls change simultaneously:

State Background Color Target Controls
Initial Calc GreenYellow - LoadingCalcResultGv (Odd rows)
- RequiredPLsForStorageTb
- LoadingImagePb
Recalculation Aquamarine - LoadingCalcResultGv (Odd rows)
- RequiredPLsForStorageTb
- LoadingImagePb

Operation Explanation Label Color Changes

🔄 Overall Processing Flowchart

┌─────────────────────────────────────┐
│   Form Load                         │
└──────────┬──────────────────────────┘
           │
           ├→ Expiration / Copyright Display
           ├→ File Verification
           ├→ Excel Path Setting
           ├→ Read PL Info
           │   └→ Retrieve Pallet Spec Master Data
           ├→ Write Items to ComboBox
           ├→ Read Case Info
           │   └→ Retrieve Case Dimensions / Quantity Data
           └→ Execute PL Loading Calc
           │
           ▼
┌─────────────────────────────────────┐
│   PLID Selection                      │
└──────────┬──────────────────────────┘
           │
           └→ Retrieve info for the selected PL
           │
           ▼
┌─────────────────────────────────────┐
│   Execute PL Loading Calc Button Click│
└──────────┬──────────────────────────┘
           │
           ▼
┌─────────────────────────────────────┐
│   PL Loading Calc                     │
└──────────┬──────────────────────────┘
           │
           ├─ P1 Pattern Calc
           │   ├→ Calc width-direction count
           │   ├→ Calc depth-direction count
           │   ├→ Planar Count = Width × Depth
           │   ├→ Calc Tiers
           │   └→ Total Loaded = Planar Count × Tiers
           │
           ├─ P2 Pattern Calc
           │   └→ (Same as P1, but orientation reversed)
           │
           ├─ P1&P2 Pattern Calc
           │   ├→ P1 Arrangement
           │   ├→ Calc Remaining Space
           │   └→ P2 Arrangement in remainder
           │
           ├─ P2&P1 Pattern Calc
           │   ├→ P2 Arrangement
           │   ├→ Calc Remaining Space
           │   └→ P1 Arrangement in remainder
           │
           ├─ Calc fill rates for all patterns
           └─ Optimal Pattern Selection
           │
           ▼
┌─────────────────────────────────────┐
│   Draw Loading Image                  │
└──────────┬──────────────────────────┘
           │
           ├─ Draw Pallet Frame
           ├─ Draw Effective Area
           ├─ Draw Case Arrangement
           └─ Draw Surplus Space
           │
           ▼
┌─────────────────────────────────────┐
│   Aggregate All PLs                   │
└──────────┬──────────────────────────┘
           │
           ├─ Calc Required PL Count
           ├─ Calc Average Fill Rate
           └─ Display Results / Visual Feedback

💡 Use Cases

1. Logistics Design for New Products

2. Warehouse Space Planning

3. Improving Transportation Efficiency

4. Cost Reduction

5. Simulation

📊 DataGridView Settings

Common Settings

Special Settings (LoadingCalcResultGv)

.AlternatingRowsDefaultCellStyle.BackColor = Color.GreenYellow
' Or
.AlternatingRowsDefaultCellStyle.BackColor = Color.Aquamarine

Sets the background color for odd rows, switching every time a calculation is executed.

⚠️ Important Notes and Constraints

Calculation Constraints

  • Integer Arithmetic: Fractions are truncated (dead space occurs).
  • Weight Limits: Ensure maximum load weights are not exceeded.
  • Height Limits: Tier calculation must remain within the effective height.
  • Stability: Stability must be considered during actual loading.

Practical Notes

  • Securing Margins: Calculated values are theoretical. Actual operations require about a 10% margin.
  • Preventing Load Collapse: Consider using fasteners if tiers are high.
  • Weight Balance: Place heavier cases on the bottom tiers.
  • Aisle Clearance: Consider forklift operational space.

Data Input Notes

  • Units must be standardized in mm (millimeters).
  • Weight must be entered in kg (kilograms).
  • Ensure Effective Dimensions ≤ PL Dimensions.
  • Measure case dimensions accurately.

🔗 Related Modules

This utility integrates with the following Tera Calculation Systems:

💾 File & Data Structure

Excel Files

File Path: DatSavePath & "\PLLoadingCalc\PLLoadingCalc.xlsx"

Sheet 1: PLSpecsAndPackaging
- Pallet spec master data

Sheet 2: CaseCountAndDimensions
- Case dimensions and quantity data

Data Connection

Provider=Microsoft.ACE.OLEDB.12.0
Data source=[File Path]
Extended properties="Excel 8.0;HDR=YES;IMEX=1"

🎓 Basics of Loading

How to Choose a Loading Pattern

  1. P1 Pattern: Effective when cases are rectangular and the long side is about twice the short side.
  2. P2 Pattern: Alternative when P1 yields a low fill rate.
  3. P1&P2 Pattern: When aiming to minimize dead space.
  4. P2&P1 Pattern: Alternative when P1&P2 yields a low fill rate.

Fill Rate Guidelines

Fill Rate Evaluation
90% or higher Excellent
80~90% Good
70~80% Standard
60~70% Somewhat low (Consider improvements)
Below 60% Low (Needs improvement)

Points for Improvement

📚 Summary

T3_Uty3_PL_LoadingAndStorageScale.vb is an advanced calculation tool that supports pallet loading optimization and storage planning.

Key Features

Application Areas

Points for Improving Calculation Accuracy

Practical Importance: Calculation results are theoretical values. In actual operations, planning with about a 10% margin is recommended, taking safety, stability, and workability into account.

📞 Support Information

Document Date: Auto-generated

Target File: T3_Uty3_PL_LoadingAndStorageScale.vb

Language: Visual Basic .NET (VB.NET)

Total Lines: 2609 lines

Core Technologies: Windows Forms, EPPlus, Graphics Drawing, Optimization Calc