-
Notifications
You must be signed in to change notification settings - Fork 375
Bug 634953: Fix factbox drilldowns for finished production orders #8293
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -15,12 +15,13 @@ using System.Reflection; | |||||||||||||
| codeunit 99001559 "Subc. ProdO. Factbox Mgmt." | ||||||||||||||
| { | ||||||||||||||
| /// <summary> | ||||||||||||||
| /// Opens the Released Production Order page for the production order linked to the given variant record. | ||||||||||||||
| /// Opens the appropriate Production Order page (Released or Finished) for the production order linked to the given variant record. | ||||||||||||||
| /// </summary> | ||||||||||||||
| /// <param name="RecRelatedVariant">A record variant of a purchase or transfer document line.</param> | ||||||||||||||
| procedure ShowProductionOrder(RecRelatedVariant: Variant) | ||||||||||||||
| var | ||||||||||||||
| ProductionOrder: Record "Production Order"; | ||||||||||||||
| FinishedProductionOrder: Page "Finished Production Order"; | ||||||||||||||
| ReleasedProductionOrder: Page "Released Production Order"; | ||||||||||||||
| OperationNo: Code[10]; | ||||||||||||||
| ProdOrderNo: Code[20]; | ||||||||||||||
|
|
@@ -29,11 +30,26 @@ codeunit 99001559 "Subc. ProdO. Factbox Mgmt." | |||||||||||||
| begin | ||||||||||||||
| if not SetProdOrderInformationByVariant(RecRelatedVariant, ProdOrderNo, ProdOrderLineNo, RoutingNo, OperationNo) then | ||||||||||||||
| exit; | ||||||||||||||
| ProductionOrder.SetRange(Status, ProductionOrder.Status::Released); | ||||||||||||||
| ProductionOrder.SetFilter(Status, '>=%1', ProductionOrder.Status::Released); | ||||||||||||||
| ProductionOrder.SetRange("No.", ProdOrderNo); | ||||||||||||||
| ReleasedProductionOrder.SetTableView(ProductionOrder); | ||||||||||||||
| ReleasedProductionOrder.Editable := false; | ||||||||||||||
| ReleasedProductionOrder.Run(); | ||||||||||||||
| if not ProductionOrder.FindFirst() then | ||||||||||||||
| exit; | ||||||||||||||
| case ProductionOrder.Status of | ||||||||||||||
| ProductionOrder.Status::Released: | ||||||||||||||
| begin | ||||||||||||||
| ProductionOrder.SetRange(Status, ProductionOrder.Status::Released); | ||||||||||||||
| ReleasedProductionOrder.SetTableView(ProductionOrder); | ||||||||||||||
| ReleasedProductionOrder.Editable := false; | ||||||||||||||
| ReleasedProductionOrder.Run(); | ||||||||||||||
| end; | ||||||||||||||
| ProductionOrder.Status::Finished: | ||||||||||||||
| begin | ||||||||||||||
| ProductionOrder.SetRange(Status, ProductionOrder.Status::Finished); | ||||||||||||||
| FinishedProductionOrder.SetTableView(ProductionOrder); | ||||||||||||||
| FinishedProductionOrder.Editable := false; | ||||||||||||||
| FinishedProductionOrder.Run(); | ||||||||||||||
| end; | ||||||||||||||
| end; | ||||||||||||||
| end; | ||||||||||||||
|
|
||||||||||||||
| /// <summary> | ||||||||||||||
|
|
@@ -77,9 +93,9 @@ codeunit 99001559 "Subc. ProdO. Factbox Mgmt." | |||||||||||||
| exit(ProdOrderRoutingLine.Count()); | ||||||||||||||
| end; | ||||||||||||||
|
|
||||||||||||||
| local procedure SetFilterProductionOrderRouting(var ProdOrderRoutingLine: Record "Prod. Order Routing Line"; ProdOrderNo: Code[20]; ProdOrderLineNo: Integer; RoutingNo: Code[20]; OperationNo: Code[10]) | ||||||||||||||
| local procedure SetFilterProductionOrderRouting(var ProdOrderRoutingLine: Record "Prod. Order Routing Line"; ProdOrderNo: Code[20]; ProdOrderLineNo: Integer; RoutingNo: Code[20]; OperationNo: Code[10]) | ||||||||||||||
| begin | ||||||||||||||
| ProdOrderRoutingLine.SetRange(Status, ProdOrderRoutingLine.Status::Released); | ||||||||||||||
| ProdOrderRoutingLine.SetFilter(Status, '>=%1', ProdOrderRoutingLine.Status::Released); | ||||||||||||||
| ProdOrderRoutingLine.SetRange("Prod. Order No.", ProdOrderNo); | ||||||||||||||
| ProdOrderRoutingLine.SetRange("Routing Reference No.", ProdOrderLineNo); | ||||||||||||||
| ProdOrderRoutingLine.SetRange("Routing No.", RoutingNo); | ||||||||||||||
|
|
@@ -130,15 +146,15 @@ local procedure SetFilterProductionOrderRouting(var ProdOrderRoutingLine: Record | |||||||||||||
| ProdOrderRoutingLine: Record "Prod. Order Routing Line"; | ||||||||||||||
| begin | ||||||||||||||
| ProdOrderRoutingLine.SetLoadFields("Routing Link Code"); | ||||||||||||||
| ProdOrderRoutingLine.SetRange(Status, ProdOrderRoutingLine.Status::Released); | ||||||||||||||
| ProdOrderRoutingLine.SetFilter(Status, '>=%1', ProdOrderRoutingLine.Status::Released); | ||||||||||||||
| ProdOrderRoutingLine.SetRange("Prod. Order No.", ProdOrderNo); | ||||||||||||||
| ProdOrderRoutingLine.SetRange("Routing Reference No.", ProdOrderLineNo); | ||||||||||||||
| ProdOrderRoutingLine.SetRange("Routing No.", RoutingNo); | ||||||||||||||
| ProdOrderRoutingLine.SetRange("Operation No.", OperationNo); | ||||||||||||||
| if ProdOrderRoutingLine.FindFirst() then | ||||||||||||||
| ProdOrderComponent.SetRange("Routing Link Code", ProdOrderRoutingLine."Routing Link Code"); | ||||||||||||||
|
|
||||||||||||||
| ProdOrderComponent.SetRange(Status, ProdOrderComponent.Status::Released); | ||||||||||||||
| ProdOrderComponent.SetRange(Status, ProdOrderRoutingLine.Status); | ||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Stale routing-line status used after failed FindFirstWhen Recommendation:
Suggested change
👍 useful · ❤️ especially valuable · 👎 wrong - reply with why |
||||||||||||||
| ProdOrderComponent.SetRange("Prod. Order No.", ProdOrderNo); | ||||||||||||||
| ProdOrderComponent.SetRange("Prod. Order Line No.", ProdOrderLineNo); | ||||||||||||||
| end; | ||||||||||||||
|
|
||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Case statement silently ignores unexpected status
The
case ProductionOrder.Status ofblock handles onlyReleasedandFinished. Although the precedingSetFilter('>=%1', Released)makes other statuses theoretically unreachable today, any future enum addition or unexpected data would causeShowProductionOrderto silently exit without opening any page, giving the user no feedback.Recommendation:
elsebranch that either opens a generic fallback page or raises an informative error.👍 useful · ❤️ especially valuable · 👎 wrong - reply with why