[Bug]: Warehouse Journal Line.CalcReservEntryQuantity uses uninitialized global WhseJnlLine instead of Rec for tracking filter (regression since BC18)
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 64/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Ambito
- backend
Direzione di ricerca
Leggi src/Layers/W1/BaseApp/Warehouse/Journal/WarehouseJournalLine.Table.al ed esamina CalcReservEntryQuantity, in particolare la chiamata al filtro di tracciamento. Conferma che il record corrente fornisce il filtro di tracciamento, quindi controlla i test pertinenti delle righe del giornale di magazzino oppure aggiungi un controllo di regressione per una prenotazione con un lotto diverso. Il lavoro è completato quando la ricerca della prenotazione usa il tracciamento della riga corrente e lo scenario di spedizione del trasferimento segnalato funziona.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Describe the issue
Table 7311 "Warehouse Journal Line", procedure CalcReservEntryQuantity(), filters the Reservation Entry on an uninitialized global variable instead of the current record:
ReservEntry.SetTrackingFilterFromWhseJnlLine(WhseJnlLine);
WhseJnlLine is the table's protected global variable, not Rec. It is not initialized when CalcReservEntryQuantity is called from codeunit 7302 "WMS Management".CheckWhseJnlLineTracking, so the Reservation Entry is always filtered on Serial No. = '' and Lot No. = '' instead of the journal line's tracking.
This is a regression from the BC18 refactoring that moved the procedure from codeunit 7302 to table 7311.
BC17 – codeunit 7302 "WMS Management" (correct): the line is passed as a parameter named WhseJnlLine.
local procedure CalcReservEntryQuantity(WhseJnlLine: Record "Warehouse Journal Line"): Decimal
var
ReservEntry: Record "Reservation Entry";
begin
with WhseJnlLine do begin
if "Source Type" = DATABASE::"Prod. Order Component" then begin
ReservEntry.SetSourceFilter("Source Type", "Source Subtype", "Journal Template Name", "Source Subline No.", true);
ReservEntry.SetSourceFilter("Journal Batch Name", "Source Line No.");
end else begin
ReservEntry.SetSourceFilter("Source Type", "Source Subtype", "Journal Template Name", "Source Line No.", true);
ReservEntry.SetSourceFilter("Journal Batch Name", 0);
end;
ReservEntry.SetTrackingFilterFromWhseJnlLine(WhseJnlLine); // <- WhseJnlLine = the parameter (the actual line)
if ReservEntry.FindFirst then
exit(ReservEntry."Quantity (Base)");
exit("Qty. (Base)");
end;
end;
Called as:
CheckLotNo(
"Item No.", "Variant Code", "Location Code", "From Bin Code",
"Unit of Measure Code", "Lot No.", CalcReservEntryQuantity(WhseJnlLine));
BC18 to current main – table 7311 "Warehouse Journal Line" (wrong): the parameter was removed, but the reference was not changed to Rec. The name now resolves to the table's global variable WhseJnlLine.
procedure CalcReservEntryQuantity(): Decimal
var
ReservEntry: Record "Reservation Entry";
begin
if "Source Type" = ProdOrderComponentSourceID() then begin
ReservEntry.SetSourceFilter("Source Type", "Source Subtype", "Journal Template Name", "Source Subline No.", true);
ReservEntry.SetSourceFilter("Journal Batch Name", "Source Line No.");
end else begin
ReservEntry.SetSourceFilter("Source Type", "Source Subtype", "Journal Template Name", "Source Line No.", true);
ReservEntry.SetSourceFilter("Journal Batch Name", 0);
end;
ReservEntry.SetTrackingFilterFromWhseJnlLine(WhseJnlLine); // <- WhseJnlLine = uninitialized global, NOT Rec
if ReservEntry.FindFirst() then
exit(ReservEntry."Quantity (Base)");
exit("Qty. (Base)");
end;
protected var
Item: Record Item;
WhseJnlLine: Record "Warehouse Journal Line"; // global used above
PhysInvtEntered: Boolean;
Called from codeunit 7302 "WMS Management".CheckWhseJnlLineTracking:
CheckLotNo(
WarehouseJournalLine."Item No.", WarehouseJournalLine."Variant Code", WarehouseJournalLine."Location Code", WarehouseJournalLine."From Bin Code",
WarehouseJournalLine."Unit of Measure Code", WarehouseJournalLine."Lot No.", WarehouseJournalLine.CalcReservEntryQuantity());
Impact: CheckLotNo / CheckSerialNo can receive the quantity of an unrelated, untracked reservation entry instead of the line's quantity, and posting fails with a false error such as:
Quantity (Base) must not be -2 in Bin Content Location Code='MK-MF',Bin Code='SCHEIA',Item No.='5615522',Variant Code='',Unit of Measure Code='BUC'.
even though the bin holds enough of the lot for the line being posted.
We hit this when posting / previewing a transfer order shipment on BC W1 29.0 (Platform 29.0.56814.0 + Application 29.0.54011.56829). In the debugger:
- Effective Reservation Entry filters: Source Type = 5741, Source Subtype = 0, Source ID = '', Source Batch Name = '', Source Prod. Order Line = 0, Source Ref. No. = 40000, Serial No. = '', Lot No. = '', Package No. = ''
ReservEntry.FindFirst()= true,ReservEntry."Quantity (Base)"= -3 (an unrelated entry for another location)Rec."Lot No."= the actual lot,Rec."Qty. (Base)"= 1- Bin content for the lot = 1, so the check computes 1 - 3 = -2 and raises the error.
Expected behavior
CalcReservEntryQuantity should filter the Reservation Entry on the tracking of the current record:
ReservEntry.SetTrackingFilterFromWhseJnlLine(Rec);
With this, the bin content check in CheckLotNo / CheckSerialNo uses the quantity of the line's own lot / serial number, and the transfer shipment in the scenario above posts successfully.
Steps to reproduce
- Create a location with Bin Mandatory = Yes and a bin B.
- Create an item with an item tracking code that has Lot Specific Tracking = Yes.
- Post 1 unit of lot L1 into bin B.
- Make sure a Reservation Entry exists with Source Type = 5741 (Transfer Line), Source Subtype = 0, Source ID = '', Source Batch Name = '', Source Ref. No. = 10000, Lot No. = '', Quantity (Base) = -3 (any item / location). In our case these were old orphaned entries; in a test it can be inserted directly.
- Create a transfer order from the location with one line (Line No. = 10000), Quantity = 1, lot L1, bin B.
- Post the transfer order (or Preview Posting) with option Ship.
Actual result: error "Quantity (Base) must not be -2 in Bin Content ...".
Expected result: the shipment posts. With Rec used in SetTrackingFilterFromWhseJnlLine, the filter includes Lot No. = L1, the unrelated entry does not match, and the procedure falls back to Rec."Qty. (Base)" (= 1), which the bin covers.
Additional context
Proposed fix (src/Layers/W1/BaseApp/Warehouse/Journal/WarehouseJournalLine.Table.al):
- ReservEntry.SetTrackingFilterFromWhseJnlLine(WhseJnlLine);
+ ReservEntry.SetTrackingFilterFromWhseJnlLine(Rec);
Related observation (not part of the proposed fix): the source filter uses "Journal Template Name" / "Journal Batch Name" as Source ID / Source Batch Name:
ReservEntry.SetSourceFilter("Source Type", "Source Subtype", "Journal Template Name", "Source Line No.", true);
ReservEntry.SetSourceFilter("Journal Batch Name", 0);
This is correct for journal sources, but for document sources such as Transfer Line (set via WMSMgmt.SetTransferLine) both fields are blank. The filter then becomes Source ID = '' instead of the document number, and there is no Item No. / Location Code filter. This is why an unrelated entry could match at all. Changing it affects behavior more broadly, so we'd appreciate Microsoft's view on whether it should be handled separately.
Affected versions: BC18 through current main (verified in BC 23-29 and main).
I will provide a fix for a bug
- I will provide a fix for a bug
- Lingua principale
- AL
- Stelle
- 720
- Fork
- 488
- Merge medio
- 2g 17h
- PR unite (30g)
- 568
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di microsoft/BCApps
-
Team: Integrations
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
microsoft/BCApps#13777 · 1 commento · 1 reazione ·
I maintainer di solito rispondono entro 1 giorno
-
Team: SCM
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
microsoft/BCApps#13723 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Team: SCM
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
microsoft/BCApps#13708 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Approved ext-requester-pr request-for-external Team: Finance
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
microsoft/BCApps#13691 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Team: Finance
Difficoltà 2/5 1-3 ore Idoneità per principianti 77/100
microsoft/BCApps#13621 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di microsoft/BCApps
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
-
[Bug] vllm-sr config migrate drops providers.models[].deploymentForse già presa @Bevisy l’ha presa oggi. Apertaneeds-acceptance wg/developer-experience-ecosystem
Difficoltà 2/5 1-3 ore Idoneità per principianti 86/100
vllm-project/semantic-router#5996 ·
I maintainer di solito rispondono entro 2 giorni
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
bytedance/flowgram.ai#1235 ·
I maintainer di solito rispondono entro 1 giorno
-
bugfix low-priority plugin:abstract plugin:leyline small-effort source:discussion
Difficoltà 2/5 1-3 ore Idoneità per principianti 66/100
athola/claude-night-market#1132 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
Niko1221/Strata#5560 · 2 commenti ·
I maintainer di solito rispondono entro 4 giorni