T3_5_Case_ASRS.vb Detailed Explanation

1. Overview

This file is a Windows Forms application designed for calculating the design of a Case-Type Automated Storage and Retrieval System (AS/RS for Cardboard Cases). Its primary responsibility is to automatically calculate the required overall dimensions (width, length, height), required area, and storage layout of each tier for an automated warehouse that stores a mix of multiple different case sizes, based on input parameters such as dimensions, tiers, and columns, to produce the basic data needed for layout design.

A Case AS/RS is a warehouse system that directly stores cardboard cases and is widely used in e-commerce fulfillment centers, wholesale centers, and finished goods warehouses of manufacturing plants.

Distinctive features of this system:

  • Mixed Storage Support: Designed to handle mixed storage of 4 different case sizes.
  • Case Ratio Setting: Users can specify the quantity ratio (%) for each case size.
  • Automatic Tier Arrangement: Automatically optimizes tier arrangement in order of case height.
  • Bay Capacity Management: Automatically sets the bay capacity (6, 5, 4, 3 cases) based on case width.
  • Detailed Storage Display: Displays details showing which cases and how many are stored on each tier.
  • Rack Height Calculation: Automatically calculates total height by summing the height of each tier.

Standard Case Size Classifications

Case No Case Width Range Case Length (Fixed) Bay Capacity
1 150 - 300mm 600mm 6 cases / bay
2 301 - 400mm 600mm 5 cases / bay
3 401 - 500mm 600mm 4 cases / bay
4 501 - 600mm 600mm 3 cases / bay

2. Main Classes / Modules

2.1. CaseASRSCalcF Class

Purpose

The main form class that performs design calculations for the Case AS/RS. It supports mixed storage of multiple sizes and optimizes storage layout per tier.

Key Properties

This class inherits from System.Windows.Forms.Form and holds UI controls such as DataGridViews, TextBoxes, Labels, and Buttons. The main variables and controls are as follows:

  • RequestedCaseCountDgv: DataGridView - Input and display of case specs and requested quantities.
  • StorageDetailsDgv: DataGridView - Detailed display of stored case counts per tier.
  • RackHeightDgv: DataGridView - Display of height information per tier.
  • Basic Configuration: Columns, Bays_PerColumn, Tiers, Prerequisite Case Count.
  • Case Information: Ratios, counts, required bays, and required tiers for Case Nos 1-4.
  • Calculation Results: Required Width, Required Length, Required Height, Required Area.
  • Image Path: MyJpgPath (Used for drawing display, currently commented out).

Key Methods / Functions

  • CaseASRSCalc_Load - Form initialization and startup of main processes
  • GetPathToFolderFromWhichProgramWasLaunched - Image path retrieval
  • CaseASRSCalc_InitialSettings - Initialization and default value setting for DataGridView
  • RackCountCalc - Main logic for case count, tier layout, and bay calculation
  • StorageDetails - Calculates the detailed case storage layout for each tier
  • DgvAggregation - Aggregation processing for DataGridView
  • Layout_Calc - Calculation of overall warehouse dimensions and area
  • LayoutRecalcBt_Click - Processing when the recalculation button is clicked
  • DgvFormat - Formatting settings for DataGridView

3. Details of Main Functions / Subroutines

3.1. CaseASRSCalc_Load

Function Description

Event handler executed when the form loads. It sets copyright and expiration date displays, retrieves the image path, applies initial settings, and executes calculations sequentially.

Arguments

Argument Name Type Description
sender Object The source object of the event
e EventArgs Event arguments

Return Value

Type: None (Sub)
Description: No return value as it is an event handler

Processing Flow

  1. Set text for the copyright label and expiration date label.
  2. Call GetPathToFolderFromWhichProgramWasLaunched() to set the image path.
  3. Initialize DataGridViews via CaseASRSCalc_InitialSettings().
  4. Execute case layout calculation via RackCountCalc().
  5. Calculate warehouse dimensions and area via Layout_Calc().
Special Notes:
By sequentially executing three calculation methods, it calculates everything from case specifications to overall warehouse design cohesively.

3.2. CaseASRSCalc_InitialSettings

Function Description

Initializes the Requested Case Count DataGridView and sets default case specifications and ratios. It performs adding columns, creating rows, setting cells as read-only, and inputting default values.

Arguments

None

Return Value

Type: None (Sub)
Description: Initialization of DataGridView only

Processing Flow

  1. Clear DataGridView columns.
  2. Add 11 columns:
    • Case Height Rank
    • Case No (1-4)
    • Case Width (Range display)
    • Case Length (Fixed 600mm)
    • Case Height (User editable)
    • Case Count Ratio % (User editable)
    • Requested Case Count (Auto-calculated)
    • Bay Capacity (6, 5, 4, 3)
    • Required Bays (Auto-calculated)
    • Bay Count A (Bays per column × 2)
    • Required Tiers (Auto-calculated)
  3. Add 4 rows (for Case Nos 1-4).
  4. Set fixed values (Case No, Case Width Range, Case Length, Bay Capacity).
  5. Set default case heights (300, 400, 450, 500mm).
  6. Set default case count ratios (20%, 40%, 35%, 5%).
  7. Set the background color of editable cells (Case Height, Case Count Ratio) to PeachPuff.
  8. Call RackCountCalc() to execute the initial calculation.
Special Notes:
The only items users can change are "Case Height" and "Case Count Ratio". Other items are auto-calculated or fixed values. The sum of the case count ratios must be 100%.

3.3. RackCountCalc

Function Description

This is the core calculation process for the Case AS/RS. It calculates the requested number of each case based on the prerequisite case count and case ratios, then computes the required number of bays and tiers. It then sorts by case height to determine the priority order for tier layout.

Arguments

None (gets values from controls on the form)

Return Value

Type: None (Sub)
Description: Calculation results are displayed in the DataGridView

Processing Flow

  1. Get and Calculate Basic Values:
    • Total Bays = Columns × Bays_PerColumn × Tiers
    • Get Prerequisite Case Count
    • Bay Count A = Columns × Bays_PerColumn
  2. Calculate Case Counts:
    • Sort by Case No (Ascending)
    • Get the ratio for each case
    • Case Nos 1-3: Round up using Int(Prerequisite Case Count × Ratio / 100 + 0.99999)
    • Case No 4: Remainder = Prerequisite Case Count - (Sum of Case Nos 1-3)
    • Display requested case counts in the DataGridView
  3. Calculate Required Bay Count:
    • Case No 1: Int(Requested Count / 6 + 0.9999)
    • Case No 2: Int(Requested Count / 5 + 0.9999)
    • Case No 3: Int(Requested Count / 4 + 0.9999)
    • Case No 4: Int(Requested Count / 3 + 0.9999)
    • Calculate Total Required Bays
  4. Setting Bay Count A:
    • For all cases, Bay Count A = Bays_PerColumn × 2
  5. Calculate Required Tiers:
    • Required Tiers for each case = Required Bays / Bay Count A
    • Calculate Total Required Tiers
    • If Total Required Tiers > Specified Tiers, display a warning and Exit Sub
  6. Sort by Case Height:
    • Sort in descending order by case height (tallest cases placed first)
    • Set Case Height Rank (1-4)
  7. Call Subsequent Processes:
    • DgvFormat(RequestedCaseCountDgv)
    • StorageDetails()
    • DgvAggregation()
    • Layout_Calc()
Special Notes:
Sorting by case height achieves an optimal layout where taller cases are placed on the lower tiers. The rounding up calculation (+0.9999) ensures that the required number of bays and tiers are secured so there is not a shortage of even 1 case.

3.4. StorageDetails

Function Description

Calculates in detail which cases and how many are stored on each tier, and displays it in the Storage Details DataGridView. It implements a complex logic that fills tiers in order of height and fills remaining bays with the next case.

Arguments

None

Return Value

Type: None (Sub)
Description: Results are displayed in the Storage Details DataGridView

Processing Flow

  1. Initialize DataGridView:
    • After clearing columns, add basic columns (Case Height Rank, Case No, Case Width, Case Length, Case Height, Required Bays).
    • Dynamically add columns for the number of tiers (Tier 01, Tier 02, ...).
    • Add 4 rows (for Case Nos 1-4).
  2. Placement of Case Height Rank 1 (Tallest Case):
    • Get required number of bays.
    • Calculated Tiers = Int(Required Bays / Bay Count A + 0.999).
    • Remaining Bays = (Calculated Tiers × Bay Count A) - Required Bays.
    • Place Bay Count A in each tier from start tier to end tier.
    • Place (Bay Count A - Remaining Bays) in the final tier.
    • Save remaining bays for the next case.
  3. Placement of Case Height Rank 2:
    • Consider the remaining bays from the previous case.
    • Required Bays = Requested Required Bays - Remaining Bays.
    • Calculate tier layout similarly.
    • Calculate new remaining bays.
  4. Placement of Case Height Rank 3:
    • Place using similar logic.
  5. Placement of Case Height Rank 4:
    • Place in all remaining bays.
    • Display if there are any unused bays.
Special Notes:
This function is crucial for visualizing the storage layout per tier. The "gap-filling" logic, which fills remaining bays with the next case, ensures warehouse space is utilized without waste.

3.5. Layout_Calc

Function Description

Calculates overall warehouse dimensions (width, length, height) and required area. It also outputs height information for each tier to the Rack Height DataGridView.

Arguments

None (gets values from controls on the form)

Return Value

Type: None (Sub)
Description: Calculation results are displayed in TextBoxes and DataGridView

Processing Flow

  1. Calculation of Required Width:
    • Rack Travel Width = Bay Width + Crane Aisle Width (For travel path)
    • Required Width = Rack Travel Width × Columns + Adjacent C × 2 + Inter-Column C × (Columns - 1)
  2. Calculation of Required Length:
    • Bay Pitch = Bay Length + Pillar Width + Rack C
    • Total Rack Length = Bay Pitch × Bays + Pillar Width
    • Required Length = Total Rack Length + I/O CV Length + Work Area Length + Protective Pillars + Inspection Aisle
  3. Calculation of Required Height:
    • Get height of each tier for Rack Height Dgv from Storage Details
    • Calculate (Case Height + Insertion Height C + Beam Thickness) for each tier
    • Calculate Required Height using sum of all tiers + Bottom Tier Offset + Ceiling C
  4. Calculation of Required Area:
    • Required Area = (Required Width × Required Length) / 1000² [m²]
Special Notes:
Because case heights vary per tier, the height of each tier is calculated individually and summed. This enables height design optimized for mixed storage.

3.6. LayoutRecalcBt_Click

Function Description

Event handler executed when the "Recalculate Layout" button is clicked. Checks that the sum of case count ratios is 100% and executes recalculation.

Arguments

Argument Name Type Description
sender Object The button that triggered the event
e EventArgs Event arguments

Return Value

Type: None (Sub)
Description: No return value as it is an event handler

Processing Flow

  1. Calculate the sum of case count ratios (Loop through 4 rows and add).
  2. If the sum is not 100, display an error message and Exit Sub.
  3. If the sum is 100, execute RackCountCalc().
  4. Toggle background color of Required Dimensions Tp (LightYellow ⇔ PowderBlue).
Special Notes:
An error occurs if the sum of case count ratios is not 100%. This is an important validation to ensure case allocation is performed correctly.

3.7. DgvAggregation / DgvFormat

Function Description

Utility methods for adding aggregation rows and formatting DataGridViews.

Main Features

  • DgvAggregation: Adds a total row to each DataGridView.
  • DgvFormat: Cell formatting settings (text size, alignment, colors, etc.).
Special Notes:
A group of utility functions designed to make DataGridViews easy to read and use.

4. Dependencies

  • System.Windows.Forms - For basic Windows Forms application functionality
  • System.Drawing - For UI color settings (Color type)
  • System - For basic types and string processing
  • System.ComponentModel - For DataGridView sorting functionality
  • Global Variable Module (Assumed) - To reference global variables such as company name, copyright, and trial expiration date
Note:
Variables referenced within the code (Company, Copyright, TrialExpirationDate, CalcStart_Chk2, MyJpgPath, etc.) are assumed to be defined in another module or a common configuration file.

5. Revision History

Revision Date Version Revision Details Author
2025 1.0 Initial creation of detailed explanation document -

6. Calculation Logic Summary

Case Count Allocation Calculation

  • Case Nos 1-3: Int(Prerequisite Case Count × Ratio% / 100 + 0.99999) *Rounded up
  • Case No 4: Prerequisite Case Count - (Case No1 + Case No2 + Case No3) *Remainder
  • Total = Prerequisite Case Count (Ensures match)

Required Bay Count Calculation

  • Case No 1 (Width 150-300mm): Int(Requested Case Count / 6 + 0.9999) *6 cases/bay
  • Case No 2 (Width 301-400mm): Int(Requested Case Count / 5 + 0.9999) *5 cases/bay
  • Case No 3 (Width 401-500mm): Int(Requested Case Count / 4 + 0.9999) *4 cases/bay
  • Case No 4 (Width 501-600mm): Int(Requested Case Count / 3 + 0.9999) *3 cases/bay

Required Tier Count Calculation

  • Bay Count A = Bays per Column × 2 (Since columns are configured in pairs)
  • Required Tiers = Required Bays / Bay Count A
  • Total Required Tiers = Sum of required tiers for Case Nos 1-4
  • Total Required Tiers ≦ Specified Tiers (Error if exceeded)

Tier Placement Algorithm

Placement Rule in Order of Case Height

  1. Sort Requested Case Count DataGridView descending by case height (Tallest first).
  2. Place in order from bottom tier starting with the tallest case (Rank 1).
  3. Placement for each case:
    • Calculated Tiers = Int(Required Bays / Bay Count A + 0.999)
    • Excluding final tier: Place 'Bay Count A' units in each tier
    • Final tier: Place (Bay Count A - Remaining Bays)
    • Carry over remaining bays to the next ranked case
  4. The next ranked case begins placement utilizing the remaining bays from the previous.
  5. Fill all remaining bays with the lowest ranked case.

Advantages of this algorithm:
Placing taller cases on lower tiers provides structural stability, while placing shorter cases on upper tiers reduces ceiling height. Furthermore, carrying over remaining bays ensures space is utilized without waste.

Warehouse Dimension Calculation

  • Required Width: Rack Travel Width × Columns + Adjacent C × 2 + Inter-Column C × (Columns - 1)
  • Required Length: (Bay Pitch × Bays + Pillar Width) + I/O CV Length + Work Area + Protective Pillars + Inspection Aisle
  • Required Height: Σ(Each tier's (Case Height + Insertion Height C + Beam Thickness)) + Bottom Tier Offset + Ceiling C
  • Required Area: (Required Width × Required Length) / 1000² [m²]
Note on Units:
Input values are generally handled in millimeters (mm) and are converted to square meters (m²) by dividing by 1000² during area calculations.

7. Usage Instructions and Design Guide

Input Items

  1. Basic Warehouse Configuration:
    • Columns: Number of warehouse columns (Usually 1-4)
    • Bays_PerColumn: Number of bays per column (Usually 3-5)
    • Tiers: Number of warehouse tiers (Usually 10-20)
    • Prerequisite Case Count: Total number of cases to store
  2. Case Specifications (DataGridView):
    • Case Height: Height of each case (mm)
    • Case Count Ratio: Ratio of each case (%, Total 100%)
  3. Dimension Parameters:
    • Bay Width, Bay Length, Pillar Width, Rack C, Crane Aisle Width
    • Inter-Column C, Adjacent C, I/O CV Length, Work Area, Protective Pillars, Inspection Aisle
    • Insertion Height C, Beam Thickness, Bottom Tier Offset, Ceiling C

How to Read Output Results

  • Requested Case Count DataGridView:
    • Displays the requested count, required bays, and required tiers for each case.
    • Assigns Case Height Ranks indicating the priority order for tier placement.
  • Storage Details DataGridView:
    • Displays a detailed breakdown showing how many cases are stored in each tier (Tier 01 - n).
    • Allows visual confirmation of case layout per tier.
  • Rack Height DataGridView:
    • Displays the height of each tier (Case Height + Insertion Height C + Beam Thickness).
    • Allows confirmation of the accumulated total height.
  • Required Dimensions:
    • Displays required width, required length, required height, and required area.

Design Points

  1. Setting Case Count Ratios:
    • Set ratios based on the actual inventory composition.
    • Ensure the total ratio always equals 100%.
  2. Determining Tiers:
    • Adjust so the total required tiers do not exceed the specified tiers.
    • If exceeded, increase the number of columns or tiers.
  3. Setting Case Heights:
    • Accurately input actual case sizes.
    • Taller cases are preferentially placed on lower tiers.
  4. Confirming Tier Placement:
    • Check placement for each tier using the Storage Details DataGridView.
    • Unused bays indicate wasted space.
Practical Note:
The dimensions calculated by this tool apply only to the main warehouse structure. In actual building design, separate considerations must be made for offices, equipment areas, future expansion space, fire safety equipment, etc.
Additionally, mixed storage may not be suitable for operations where case sizes change frequently. It is optimal for operations with fixed case specifications (e.g., storage of staple products).

8. Differences between Case Warehouses and Bucket Warehouses

Item Case Warehouse Bucket Warehouse
Storage Object Cardboard Cases Plastic Buckets
Size Range 150-600mm (Variable width) 300-600mm (Standardized)
Mixed Storage Can mix 4 types 4 standard types + Custom dimensions
Placement Algorithm Optimized tier layout by case height Placed with constant tier heights
Bay Capacity By size (6, 5, 4, 3 cases) By bucket type
Usage EC logistics, distribution centers Parts warehouses, medical stores

Features of Case Warehouses

  • Supports varying case heights per tier
  • Efficient placement by filling remaining bays with the next case
  • Flexible inventory composition using case count ratios
  • Visualizes tier-by-tier layout via storage details