Skip to content

[master] Bin Capacity Policy "Prohibit More Than Max. Cap." fails and allows more than the maximum Capacity, when you split lines on Inventory Movement#9264

Open
neeleshsinghal wants to merge 3 commits into
microsoft:mainfrom
neeleshsinghal:bugs/Bug-641780-Bin-Capacity-Policy-fails-and-allows-more-than-max-Capacity
Open

[master] Bin Capacity Policy "Prohibit More Than Max. Cap." fails and allows more than the maximum Capacity, when you split lines on Inventory Movement#9264
neeleshsinghal wants to merge 3 commits into
microsoft:mainfrom
neeleshsinghal:bugs/Bug-641780-Bin-Capacity-Policy-fails-and-allows-more-than-max-Capacity

Conversation

@neeleshsinghal

@neeleshsinghal neeleshsinghal commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Workitem: Bug 641780: [master] [ALL-E] Bin Capacity Policy "Prohibit More Than Max. Cap." fails and allows more than the maximum Capacity, when you split lines on Inventory Movement

Fixes AB#641780

Issue: In non-directed (basic) warehouses with Bin Capacity Policy "Prohibit More Than Max. Cap.", registering partial Inventory Movements does not enforce the destination bin's Maximum Cubage/Weight, allowing the bin to be overfilled.

Cause: RegisterWhseJnlLine in WhseActivityRegister Codeunit only computed Cubage/Weight for directed locations, so basic-warehouse movement entries were written with zero cubage, hiding previously moved quantities from the capacity check.

Solution: Calculate Cubage/Weight via WMSMgt.CalcCubageAndWeight (base UoM) in the non-directed branch so movement Warehouse Entries carry cubage and the "Prohibit More Than Max. Cap." check correctly blocks over-capacity registrations.

@github-actions github-actions Bot added From Fork Pull request is coming from a fork Linked Issue is linked to a Azure Boards work item labels Jul 8, 2026
@github-actions github-actions Bot added this to the Version 29.0 milestone Jul 8, 2026
@neeleshsinghal neeleshsinghal added the SCM GitHub request for SCM area label Jul 8, 2026
@neeleshsinghal neeleshsinghal marked this pull request as ready for review July 9, 2026 04:48
@neeleshsinghal neeleshsinghal requested a review from a team July 9, 2026 04:48
@github-actions

github-actions Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Copilot PR Review

Iteration 2 · Outcome: completed

Knowledge source: https://github.com/microsoft/BCQuality@822cae1b2771ac25f665f73369f69093bd4fd630

Findings by domain

Findings split into Knowledge-backed (cite a BCQuality article) and Agent (the agent's own judgement, no matching BCQuality rule).

Domain Findings Knowledge-backed Agent Inline Fallback
Style 1 1 0 1 0

Totals: 1 knowledge-backed · 0 agent findings.

Orchestrator pre-filter (13 file(s) excluded)

  • layer-disabled (knowledge) : 13 file(s)

Findings produced by the Copilot CLI agent against BCQuality at 822cae1b2771ac25f665f73369f69093bd4fd630. Reply 👎 on any inline comment to flag false positives.

@alexei-dobriansky

Copy link
Copy Markdown
Contributor

Agentic PR Review - Round 1

Recommendation: Accept with Suggestions

What this PR does

This PR makes non-directed warehouse activity registration calculate Cubage and Weight on the warehouse journal line before WhseJnlRegisterLine.Run. That means movement warehouse entries now store the moved cubage, so the next partial registration sees the cubage already posted in the destination bin.

The fix matches the root cause in the work item. Bin.CalcPostedCubageAndWeight can now include the first partial movement, and the second movement is blocked when it would exceed Maximum Cubage. The added test verifies that the first movement writes cubage to Warehouse Entry and that the next movement is rejected.

Suggestions

S1 - Split Line path is not exercised
Please add or adjust the regression test so it uses WarehouseActivityLine.SplitLine or the Inventory Movement page action before registering partial quantities. The current test proves the posted cubage root cause, but it does not exercise the Split Line path from the bug report.

Risk assessment and necessity

Risk: Warehouse bin-capacity validation is sensitive because an incorrect fix can allow overfilled bins or block valid movements. The code change is narrow, uses existing WMSMgt.CalcCubageAndWeight, and does not change public APIs or event signatures.

Necessity: The linked bug is clear and valid. Without this fix, users can bypass Prohibit More Than Max. Cap. by registering partial inventory movements, so the change is needed.


[AI-PR-REVIEW] version=1 system=github pr=9264 round=1 by=alexei-dobriansky sha=f071949b76bb5e22cfdd791acccbf0769130849e

…Bug-641780-Bin-Capacity-Policy-fails-and-allows-more-than-max-Capacity
[HandlerFunctions('ConfirmHandler,MessageHandler')]
procedure InvtMovementProhibitsExceedingBinMaxCubageOnSplitLineMovements()
var
CubagePerUnit: Decimal;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$\textbf{🟡\ Medium\ Severity\ —\ Style} \quad \color{gray}{\texttt{\small Iteration\ 2}}$

The var block in the new test procedure InvtMovementProhibitsExceedingBinMaxCubageOnSplitLineMovements interleaves primitive Decimal variables (CubagePerUnit, FirstQty, MaxCubage, SecondQty) with Record variables (FromBin, Item, Location, ToBin, WarehouseActivityHeader, etc.) in alphabetical order across types.

CodeCop AA0021 requires all Record (and other complex-type) declarations to precede primitive types such as Decimal within the same var block.

Suggested fix (apply manually — could not be anchored as a one-click suggestion):

        FromBin: Record Bin;
        Item: Record Item;
        Location: Record Location;
        ToBin: Record Bin;
        WarehouseActivityHeader: Record "Warehouse Activity Header";
        WarehouseActivityLine: Record "Warehouse Activity Line";
        WarehouseEmployee: Record "Warehouse Employee";
        WarehouseEntry: Record "Warehouse Entry";
        CubagePerUnit: Decimal;
        FirstQty: Decimal;
        MaxCubage: Decimal;
        SecondQty: Decimal;

Knowledge:

👍 useful · ❤️ especially valuable · 👎 wrong - reply with why

@alexei-dobriansky

Copy link
Copy Markdown
Contributor

Agentic PR Review - Round 2

Recommendation: Accept

What this PR does

The new commit updates the regression test so it creates one Inventory Movement, splits both Take and Place lines with WarehouseActivityLine.SplitLine, registers only the first split part, then tries to register the remaining split part. This now covers the split-line path from the ADO repro, while still proving that the first registration writes Cubage to Warehouse Entry and the second registration is blocked by bin capacity.

The production fix is unchanged since round 1. It still fills Cubage and Weight for non-directed movement warehouse journal lines before WhseJnlRegisterLine.Run, which is the right point because the registered Warehouse Entries need those values for the next capacity calculation.

Status of previous suggestions
ID Title Status Author response
S1 Split Line path is not exercised Addressed Added a split-line regression test in 12040a828e.
New observations (commits since round 1)

None - changes only addressed the previous suggestion.

Risk assessment and necessity

Risk: Warehouse bin-capacity validation is sensitive because a wrong cubage or weight value can allow overfilled bins or block valid movements. The round-2 change is test-only and uses the existing SplitLine flow. The production change remains narrow and does not change public APIs or event signatures.

Necessity: The linked Bug 641780 is clear and valid. Without this fix, users can bypass Prohibit More Than Max. Cap. by registering split Inventory Movement quantities, so the change is needed.


[AI-PR-REVIEW] version=1 system=github pr=9264 round=2 by=alexei-dobriansky sha=12040a828e30253b54f0b92846b2f8fda4d5c806

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

From Fork Pull request is coming from a fork Linked Issue is linked to a Azure Boards work item SCM GitHub request for SCM area

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants