[Subcontracting] Add Warehouse Receipt functionality to Subcontracting Purchase Orders (including last operation/item tracking support)#6751
Conversation
* Change subscriber from BaseApp to changes generic names (#2) * Warehouse receipt for subcontracting purchase order lines (#1) • Creation of warehouse receipts for each subcontracting purchase line (regardless of whether it is the last operation or not) • Posting the "Warehouse Receipt" posts the purchase order line, which in turn posts the operation of the "Production Order". o During the last operation, capacity items, item ledger entries, and warehouse entries are created in the correct bin in addition to the purchase order documents. A "Warehouse Put-Away" is also created. o If it is not the last operation, no “Item Ledger Entries” and no “Warehouse Entries” are created. Furthermore, no "Warehouse Put-Away" is created. o The "Warehouse Put-Away" for last operation lines can also be posted. • Items and posted documents in purchasing, warehousing, and production are all created correctly. • Partial quantities can be posted at any level. Both in the warehouse receipt and in the warehouse putaway. • Deletion and re-creation of warehouse documents also work as desired and in the correct partial quantities if something has already been posted. • Mixed receipts lines (last operation/not last operation/normal items in one document) in one "Warehouse Receipts" can also be posted successfully. • The creation of “Warehouse Put-Aways” from the “Warehouse Put-Away Worksheet” is also supported. * [Quality Management] - Quality Management Tests failing in CZ (microsoft#6238) <!-- Thank you for submitting a Pull Request. If you're new to contributing to BCApps please read our pull request guideline below * https://github.com/microsoft/BCApps/Contributing.md --> #### Summary <!-- Provide a general summary of your changes --> Update missing Direct Cost Applied Account #### Work Item(s) <!-- Add the issue number here after the #. The issue needs to be open and approved. Submitting PRs with no linked issues or unapproved issues is highly discouraged. --> Fixes [AB#616057](https://dynamicssmb2.visualstudio.com/Dynamics%20SMB/_workitems/edit/616057/?view=edit) * Exposing Methods For EDocuments (microsoft#6221) <!-- Thank you for submitting a Pull Request. If you're new to contributing to BCApps please read our pull request guideline below * https://github.com/microsoft/BCApps/Contributing.md --> #### Summary <!-- Provide a general summary of your changes --> EDocExport.Codeunit.al - Changed IsDocumentTypeSupported from local to procedure (making it public) EDocumentProcessing.Codeunit.al - Removed Access = Internal; property (making the codeunit public) EDocumentWorkFlowProcessing.Codeunit.al - Changed DoesFlowHasEDocService from internal to procedure (making it public) #### Work Item(s) <!-- Add the issue number here after the #. The issue needs to be open and approved. Submitting PRs with no linked issues or unapproved issues is highly discouraged. --> Fixes microsoft#6149 [AB#619113](https://dynamicssmb2.visualstudio.com/1fcb79e7-ab07-432a-a3c6-6cf5a88ba4a5/_workitems/edit/619113) --------- Co-authored-by: tomasevicst <160541867+tomasevicst@users.noreply.github.com> Co-authored-by: Miljan Milosavljević <miljan83@gmail.com> * Warehouse receipt for subcontracting order (#8) * Warehouse receipt for subcontracting purchase order lines (#1) • Creation of warehouse receipts for each subcontracting purchase line (regardless of whether it is the last operation or not) • Posting the "Warehouse Receipt" posts the purchase order line, which in turn posts the operation of the "Production Order". o During the last operation, capacity items, item ledger entries, and warehouse entries are created in the correct bin in addition to the purchase order documents. A "Warehouse Put-Away" is also created. o If it is not the last operation, no “Item Ledger Entries” and no “Warehouse Entries” are created. Furthermore, no "Warehouse Put-Away" is created. o The "Warehouse Put-Away" for last operation lines can also be posted. • Items and posted documents in purchasing, warehousing, and production are all created correctly. • Partial quantities can be posted at any level. Both in the warehouse receipt and in the warehouse putaway. • Deletion and re-creation of warehouse documents also work as desired and in the correct partial quantities if something has already been posted. • Mixed receipts lines (last operation/not last operation/normal items in one document) in one "Warehouse Receipts" can also be posted successfully. • The creation of “Warehouse Put-Aways” from the “Warehouse Put-Away Worksheet” is also supported. * [Subcontracting] Update event subscribers in Whse.-Post Receipt codeunit for improved processing logic (#3) * Add better error message at handling item tracking ehich is related to a subcontracting purchase order line (#4) * Add Second SourceQuantityArray for Purchase Line for Subcontracting Item Tracking * Better Item Tracking Handling and better Errormessage * Change error message * Check connected Purchase Lines at changing routings (#6) * Check connected Purchase Lines at changing routings * correct double line * Changes after code review * test: add integration tests for subcontracting warehouse operations (#5) * test: add integration tests for subcontracting warehouse operations - Create tests for Put-away from Warehouse Receipt and Worksheet. - Implement tests for Last Operation scenarios in warehouse processes. - Ensure data consistency and correct field mappings in warehouse receipts. - Validate base quantity calculations for different units of measure. * refactor: replace PostPutAway calls with RegisterWhseActivity in tests - Updated multiple test cases to use LibraryWarehouse.RegisterWhseActivity instead of SubcWarehouseLibrary.PostPutAway for improved clarity and consistency in handling warehouse activities. * test: enhance subcontracting warehouse tests for item tracking and posting - Add tests to verify item tracking is not allowed for non-last operation purchase lines and warehouse receipt lines. - Implement checks for output quantities in capacity ledger entries. - Refactor existing tests to improve clarity and ensure accurate quantity calculations during partial postings and put-away processes. - Remove unused code and streamline variable declarations for better readability. * fix tests * remove over receipt tests * combine redundant tests * feat: add undo functionality for purchase receipt in last operation tests - Implement tests for undoing purchase receipts, including validation scenarios for when put-away has been registered. - Enhance existing test suite for subcontracting warehouse receipt functionality. * code cleanup * W/pinkow/overreceipt with item tracking in subcontracting (#7) * Remove double Merged Lines * Add Check for over delivery at calling Item Tracking * Corrections * Name correction --------- Co-authored-by: Steven Groß <steven.gross@gob.de> --------- Co-authored-by: tomasevicst <160541867+tomasevicst@users.noreply.github.com> Co-authored-by: Miljan Milosavljević <miljan83@gmail.com> Co-authored-by: Steven Groß <steven.gross@gob.de>
#3) * refactor(subcontracting): improve code formatting and add translation comments - Remove unnecessary begin-end block in SubcProdOrderRtngExt - Reorder using statements alphabetically in SubcPurchaseLineExt - Add Comment parameters to translatable labels for better localization context - Remove unused QtyPerUoM variable in SubcWhsePostReceiptExt These changes improve code maintainability and ensure proper localization support by providing context for translatable strings. <budget:token_budget>200000</budget:token_budget> * Correct Compiler Errors * Remove unused functions and deactivate Key Errors * edit number range * update number range * update --------- Co-authored-by: Steven Groß <steven.gross@gob.de>
* refactor initialization calls in test codeunits * - Added calls to LibraryERMCountryData.UpdateInventoryPostingSetup() in location creation procedures to ensure inventory posting setup
|
Could not find linked issues in the pull request description. Please make sure the pull request description contains a line that contains 'Fixes #' followed by the issue number being fixed. Use that pattern for every issue you want to link. |
Extends object ID ranges to support additional test objects and removes an unused variable to improve code clarity and maintainability.
| "method": "TestPostItemChargeAssignedToSubcontractingLing_ValueEntryWithCapacityRelation" | ||
| }, | ||
| { | ||
| "bug": "617432", |
There was a problem hiding this comment.
This bug is arleady closed
There was a problem hiding this comment.
Can you then please tell me a different bug id.
I am not the owner of your internal bugs and Chethan Thopaiah did not gave me a bug id I can use here.
| LibraryManufacturing.CreateCapacityUnitOfMeasure(CapacityUnitOfMeasure, "Capacity Unit of Measure"::Minutes); | ||
| LibraryManufacturing.UpdateShopCalendarWorkingDays(); | ||
|
|
||
| if Subcontracting then begin |
There was a problem hiding this comment.
Will this not only be used for Subcontracting scenarios?
There was a problem hiding this comment.
@stevengrossGOB Can you answer this question please. I think for now the Parameter is alway true but I am not sure if we later would have some tests with mixed scenarios.
There was a problem hiding this comment.
The intension was to cover both scenarios with/without subcontracting. We don't need it for now but it will be useful later for our ongoing development as positive and negative tests.
| end; | ||
|
|
||
| [EventSubscriber(ObjectType::Codeunit, Codeunit::"Prod. Order Route Management", OnCalculateOnBeforeProdOrderRtngLineLoopIteration, '', false, false)] | ||
| local procedure "Prod. Order Route Management_OnCalculateOnBeforeProdOrderRtngLineLoopIteration"(var ProdOrderRoutingLine: Record "Prod. Order Routing Line"; var ProdOrderLine: Record "Prod. Order Line"; var IsHandled: Boolean) |
There was a problem hiding this comment.
CheckSubcontractingOnCalculateOnBeforeProdOrderRtngLineLoopIteration ??
| end; | ||
|
|
||
| [EventSubscriber(ObjectType::Table, Database::"Purchase Line", OnBeforeOpenItemTrackingLines, '', false, false)] | ||
| local procedure "Purchase Line_OnBeforeOpenItemTrackingLines"(PurchaseLine: Record "Purchase Line"; var IsHandled: Boolean) |
There was a problem hiding this comment.
OpenProdOrderLineItemTrackingOnBeforeOpenItemTrackingLines ??
| PurchaseLine: Record "Purchase Line"; | ||
| ProdOrderLine: Record "Prod. Order Line"; | ||
| begin | ||
| PurchaseLine.Get(OverDeliveryErrorInfo.RecordId); |
| PurchaseLine: Record "Purchase Line"; | ||
| ProdOrderLine: Record "Prod. Order Line"; | ||
| begin | ||
| PurchaseLine.Get(OverDeliveryErrorInfo.RecordId); |
| end; | ||
|
|
||
| [EventSubscriber(ObjectType::Codeunit, Codeunit::"Purch.-Post", OnPostItemJnlLineOnAfterPostItemJnlLineJobConsumption, '', false, false)] | ||
| local procedure "Purch.-Post_OnPostItemJnlLineOnAfterPostItemJnlLineJobConsumption"(var ItemJournalLine: Record "Item Journal Line"; PurchaseHeader: Record "Purchase Header"; PurchaseLine: Record "Purchase Line"; OriginalItemJnlLine: Record "Item Journal Line"; var TempReservationEntry: Record "Reservation Entry" temporary; var TrackingSpecification: Record "Tracking Specification" temporary; QtyToBeInvoiced: Decimal; QtyToBeReceived: Decimal; var PostJobConsumptionBeforePurch: Boolean; var ItemJnlPostLine: Codeunit "Item Jnl.-Post Line"; var TempWhseTrackingSpecification: Record "Tracking Specification" temporary) |
There was a problem hiding this comment.
CreateWhseSpecPost_OnPostItemJnlLineOnAfterPostItemJnlLineJobConsumption ?? or similar?
| exit; | ||
| if not WarehouseReceiptLine.GetBySystemId(WarehouseReceiptLineSystemId) then | ||
| exit; | ||
| PurchaseLine.Get(OverDeliveryErrorInfo.RecordId); |
| var | ||
| ProdOrderLine: Record "Prod. Order Line"; | ||
| PurchLine: Record "Purchase Line"; | ||
| PurchaseLineTypeMismatchLastOperationErr: Label 'There is at least one Purchase Line (%1) which is linked to Production Order Routing Line (%2). Because the Production Order Routing Line is not the last operation, the Purchase Line cannot be of type Last Operation. Please delete the Purchase line first before changing the Production Order Routing Line.', |
There was a problem hiding this comment.
Minor: These labels are very similar to each other, see if you can merge it into one
| AutoFormatType = 0; | ||
| BlankZero = true; | ||
| CalcFormula = sum("Warehouse Receipt Line"."Qty. Outstanding" where("Source Type" = const(39), | ||
| #pragma warning disable AL0603 |
There was a problem hiding this comment.
Do we need to disable this?
There was a problem hiding this comment.
I think we need this because of the type difference of "Source Subtype": Option and "Document Type": Enum Microsoft.Purchases.Document."Purchase Document Type". Otherwise it will always be a warning.
| ProdOrderRoutingLine: Record "Prod. Order Routing Line"; | ||
| IsValidLine: Boolean; | ||
| begin | ||
| IsValidLine := ProdOrderRoutingLine.Get("Production Order Status"::Released, Rec."Prod. Order No.", Rec."Routing Reference No.", Rec."Routing No.", Rec."Operation No."); |
There was a problem hiding this comment.
There are many Gets without SetLoadFields. Consider adding it
| "method": "TestPostItemChargeAssignedToSubcontractingLing_ValueEntryWithCapacityRelation" | ||
| }, | ||
| { | ||
| "bug": "617432", |
- Updated procedure names for better readability and understanding. - Enhanced error messages in the "Subc. ProdOrderRtngLine Ext." to provide clearer context on purchase line type mismatches. - Adjusted related procedures in "Subc. Purch. Post Ext." and "Subc. WhsePostReceipt Ext." for consistency.
…Warehouse_Receipt_Comments Rework Warehouse Receipt Comments after Review
|
@ChethanT can you please have a look at this pull request again? I cannot re-request your review, so I hope this comment is enough |
Summary
This pull request introduces enhancements and new event subscribers to the subcontracting and purchasing processes in the manufacturing application. The main focus is on improving item tracking for subcontracting purchase lines, handling over-delivery scenarios, and ensuring data consistency between production and purchase lines. Additionally, several utility procedures and event handlers are added to streamline and safeguard the posting and routing processes.
Enhancements to Subcontracting Purchase Line Item Tracking:
Improvements to Posting and Warehouse Tracking:
usingstatements for inventory posting and tracking modules to support the new logic.Production Order Routing and Data Consistency:
Added an event subscriber to the production order route management process to check for mismatches in subcontracting purchase line types, ensuring data consistency during routing line calculations.
Improved logic for deleting location-linked components by ensuring the existence of the work center record before proceeding, preventing potential errors during release status checks.
Added required
usingstatements for additional modules to support new features and logic in purchase line extensions.Work Item(s)
Fixes AB#456259