Bin rules allow rules to be created that restrict the proximity of items held in bins or to restrict the quantity of an item that can be held in a specific area of the warehouse.

To create a new bin rule the following steps are required.

  1. Extend the "Bin Proximity Restriction WHPTMN" Enum with an entry for the new rule.
  2. Subscribe to the event OnCaseBuildBinFilter of codeunit "Bin Proximity Mgt WHPTMN". This event is called when evaluating each custom rule.

This event has the following parameters:

  • BinProximityRule: Record "Bin Proximity Rule WHPTMN";

A reference to the bin  Rule record.

  • LocationCode: Code[10];

The location code of the warehouse.

  • BinCode: Code[20];

The bin code being tested to see if it complies with the rules.

  • var Bin2: Record Bin

A set of filtered bin records where they item cannot be placed as per the bin rules.

Note: Records can also be marked which means they are unsuitable.

 

Example: Creating a new bin rule to restrict the placing of selected items in the same zone

The following example will create a new bin rule that will add an additional option to restrict the placing of selected items in the same zone.

1. Add a new bin rule:

enumextension 50000 "Bin Rule" extends "Bin Proximity Restriction WHPTMN"
{
    value(50000; "Same Zone")
    {
        Caption = ‘Same Zone’;
    }
}

2. Amend the filter to restrict selected items being placed in the same warehouse zone:

[EventSubscriber(ObjectType::Codeunit, Codeunit "Bin Proximity Mgt WHPTMN", 'OnCaseBuildBinFilter', '', false, false)]  

local procedure OnCaseBuildBinFilter(BinProximityRule: Record "Bin Proximity Rule WHPTMN"; LocationCode: Code[10]; BinCode: Code[20]; var Bin2: Record Bin)
    var
        Bin: Record Bin;
    begin
        case BinProximityRule.Restriction of
            BinProximityRule.Restriction::”Same Zone”:             
            begin
                Bin.Get(LocationCode,BinCode);
                Bin2.SetRange(“Zone Code”,Bin.”Zone Code”);
            end;
        end
    end;