📋 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.
- 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
🔧 Dependencies
Imports Microsoft.Office.Interop
Imports OfficeOpenXml
Technologies Used:
- Runtime.InteropServices: COM Interop
- Office.Interop: Office Integration
- EPPlus: Excel file operations (read/write .xlsx)
- Graphics: 2D drawing (generating loading images)
🎯 Key Features
1. Pallet Loading Calculation
- Automatic calculation of 4 loading patterns (P1, P2, P1&P2, P2&P1)
- Calculation of planar fill rate for each pattern
- Automatic selection of the optimal pattern
- Calculation of tiers and total loaded cases
2. Loading Patterns
- P1 Pattern: Cases arranged with long side parallel to pallet width
- P2 Pattern: Cases arranged with short side parallel to pallet width
- P1&P2 Pattern: Combination of P1 and P2 (alternating arrangement)
- P2&P1 Pattern: Combination of P2 and P1 (alternating arrangement)
3. Storage Pallet Count Calculation
- Calculation of required pallets based on total case count
- Calculation of average fill rate
- Support for storage space planning
4. Visualization Features
- 2D drawing of loading patterns
- Display of pallet effective area
- Visual confirmation of case arrangements
- Color-coded display of fill rates
📦 Details of Loading Patterns
P1 Pattern (Longitudinal)
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)
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)
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)
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
Initialization Process:
- Display expiration date and copyright
- Check existence of required files
- Set Excel file paths
MyExcel1 = DatSavePath & "\PLLoadingCalc\PLLoadingCalc.xlsx"
MyE1_Sheet1 = "PLSpecsAndPackaging"
MyE1_Sheet2 = "CaseCountAndDimensions" - Read PL information
- Write items to ComboBox
- Read case information
- Execute PL loading calculation
2. Execute PL Loading Calculation
Processing Flow:
- Initialize case calculated flags
- Execute PL loading calculation
- Display settings for Loading Calc Results Gv
- Set odd row background colors to GreenYellow
- Set even rows to Aquamarine
- Provides visual feedback
- Execute all PL aggregation
3. PL Loading Calculation
Calculation Steps:
- P1 Pattern Calculation
- Calculate loadable count in width and depth directions
- Calculate planar count and tiers
- Calculate total loaded cases
- P2 Pattern Calculation
- Similar to P1, but orientation is reversed
- P1&P2 Pattern Calculation
- Calculate remaining space after P1 arrangement
- Arrange P2 in the remaining space
- Calculate total planar count
- P2&P1 Pattern Calculation
- Calculate remaining space after P2 arrangement
- Arrange P1 in the remaining space
- Calculate total planar count
- Selection of Optimal Pattern
- Compare fill rates of each pattern
- Recommend the pattern with the highest fill rate
4. Read PL Information
Loaded Data:
- PLID (Pallet Identifier)
- PL Name
- PL Width (mm)
- PL Depth (mm)
- PL Height (mm)
- Effective Width (mm)
- Effective Depth (mm)
- Effective Height (mm)
- Maximum Load Weight (kg)
5. Read Case Information
Loaded Data:
- Case No
- Case Name
- Case Width (mm)
- Case Length (mm)
- Case Height (mm)
- Case Weight (kg)
- Number of cases required for storage
6. PLID Selection
Processing Details:
- Retrieve pallet info corresponding to the selected PLID
- Store PL dimensions into variables
- Set effective dimensions
- Set maximum load weight
- Prepare for recalculation
📊 Details of Calculation Formulas
Planar Count Calculation
Tiers Calculation
Total Loaded Count Calculation
Fill Rate Calculation
Required PL Count Calculation
* Uses the CEILING function to round up (to prevent shortages).
Average Fill Rate Calculation
🖼️ 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
- Create Bitmap Object
Dim img As New Bitmap(W + 10, H + 10)
Dim g As Graphics = Graphics.FromImage(img) - Draw Pallet Frame
g.FillRectangle(Brushes.Bisque, x1, y1, x2, y2) ' Fill with Bisque
g.DrawRectangle(Pens.Black, x1, y1, x2, y2) ' Black outline - Draw Effective Area
g.DrawRectangle(Pens.Black, x1, y1, x2, y2) ' Black outline
- Draw Case Arrangement
g.FillRectangle(Brushes.Azure, x1, y1, x2, y2) ' Fill with Azure
g.DrawRectangle(Pens.Black, x1, y1, x2, y2) ' Black outline - Draw Surplus Space
g.FillRectangle(Brushes.Thistle, x1, y1, x2, y2) ' Fill with Thistle
- 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
Aggregation Details:
- Total count aggregation of all cases
- Average fill rate for each pattern
- Selection of recommended pattern
- Calculation of total required pallet count
Optimal Pattern Display Dgv
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
- PLInfoGv: Pallet spec master data
- CaseInfoGv: Case dimension and quantity data
- LoadingCalcResultGv: Calculation results for each pattern
- OptimalPLLoadingCalcDataGridView: List of optimal patterns
Display TextBoxes
| Control | Display Content |
|---|---|
| RequiredPLsForStorageTb | Total required pallet count |
Buttons
- ExecutePLLoadingCalcBt: Execute calculation processing
- ChangePLDimensionsBt: Navigate to PL Info Maintenance Screen
- ExitProgram: Close the form
RadioButtons (Sorting Feature)
- EstimatedTrialSerialNoAscRb: Sort by serial number
- RequiredPLCountAscRb: Sort by required PL count
- EstimatedAvgFillRateDescRb: Sort by highest fill rate
PictureBox
- LoadingImagePb: 2D graphic display of loading patterns
TabControl
- LoadingConditionCalcDetailsTp: Main calculation screen
- PLInfoMaintenanceScreenTp: Pallet info editing screen
Labels
- OperationExplanationL: Displays operational guidance
- Colors: Blue (waiting for operation), Green (ready for calculation)
- Dynamically guides operation steps
🎯 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
- Blue: Operation required
"Click the 3rd cell to display the planar loading image."
- Green: Ready for calculation
"Click 'PL Loading Calc (Re)' to start recalculation."
🔄 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
- Checking pallet loading efficiency for new case sizes
- Determining optimal case dimensions
- Selecting pallet sizes
2. Warehouse Space Planning
- Calculating the required number of pallets
- Estimating storage space
- Determining the number of rack tiers
3. Improving Transportation Efficiency
- Improving truck loading efficiency
- Standardizing pallet loading
- Improving operational efficiency
4. Cost Reduction
- Minimizing dead space
- Reducing the required number of pallets
- Optimizing transportation costs
5. Simulation
- Comparing multiple pallet sizes
- Impact analysis of case dimension changes
- Exploring optimal solutions
📊 DataGridView Settings
Common Settings
- RowHeadersVisible = False: Hide row headers
- ColumnHeadersVisible = True: Show column headers
- AllowUserToAddRows = False: Disable user row addition
- ReadOnly = True: Read-only mode
- MultiSelect = False: Disable multi-select
- SelectionMode = FullRowSelect: Select by row
Special Settings (LoadingCalcResultGv)
' 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:
- T3_2 Packaging Volume Calc: Source of case count data
- T3_4 Shipping Space: Utilizing required pallet counts
- Storage Space Calc: Warehouse layout design
💾 File & Data Structure
Excel Files
Sheet 1: PLSpecsAndPackaging
- Pallet spec master data
Sheet 2: CaseCountAndDimensions
- Case dimensions and quantity data
Data Connection
Data source=[File Path]
Extended properties="Excel 8.0;HDR=YES;IMEX=1"
🎓 Basics of Loading
How to Choose a Loading Pattern
- P1 Pattern: Effective when cases are rectangular and the long side is about twice the short side.
- P2 Pattern: Alternative when P1 yields a low fill rate.
- P1&P2 Pattern: When aiming to minimize dead space.
- 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
- Review case dimensions (adapt to pallet size).
- Consider different pallet sizes.
- Utilize combination patterns (P1&P2, P2&P1).
- Consider mixed loading of multiple SKUs.
📚 Summary
T3_Uty3_PL_LoadingAndStorageScale.vb is an advanced calculation tool that supports pallet loading optimization and storage planning.
Key Features
- ✅ Automatic calculation of 4 loading patterns (P1, P2, P1&P2, P2&P1)
- ✅ Automatic selection of optimal patterns considering fill rates
- ✅ Visualization of loading images using 2D graphics
- ✅ Precise calculation of pallet counts required for storage
- ✅ Support for multiple pallet sizes
- ✅ Flexible data management through Excel integration
- ✅ Multi-faceted analysis via sorting features
Application Areas
- Logistics design during new product development
- Warehouse space planning and layout design
- Improvement of transport efficiency and cost reduction
- Promotion of pallet standardization
- Improvement of logistics KPIs
Points for Improving Calculation Accuracy
- Accurate measurement of case dimensions (distinguishing inner vs. outer dimensions)
- Accurate setting of effective dimensions (accounting for deck board thickness, etc.)
- Adherence to maximum load weights
- Verification and feedback in actual operations
📞 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