microsoft / ALAppExtensions

Repository for collaboration on Microsoft AL application add-on and localization extensions for Microsoft Dynamics 365 Business Central.
MIT License
768 stars 610 forks source link

[Request for External] procedures in codeunit 900 "Assembly-Post" #26044

Open sschuh opened 6 months ago

sschuh commented 6 months ago

Describe the request

hi,

please make these functions accessable:

local procedure ValidatePostingDate(var AssemblyHeader: Record "Assembly Header")

local procedure OpenWindow(DocType: Enum "Assembly Document Type")

local procedure InitPost(var AssemblyHeader: Record "Assembly Header")

local procedure Post(var AssemblyHeader: Record "Assembly Header"; var ItemJnlPostLine: Codeunit "Item Jnl.-Post Line"; var ResJnlPostLine: Codeunit "Res. Jnl.-Post Line"; var WhseJnlRegisterLine: Codeunit "Whse. Jnl.-Register Line"; NeedUpdateUnitCost: Boolean)

local procedure FinalizePost(AssemblyHeader: Record "Assembly Header")

Additional context

We need this to do some extra stuff with Assembly Orders. Internal work item: AB#504093

ChethanT commented 4 months ago

@sschuh all these methods seem to depend on one or more global variables to be set, making those methods as public increases the risk of those methods failing or returning undesired results. Can you please explain the use cases for better understanding?

sschuh commented 4 months ago

Hi, sure.

We need some different logic on specific items. (called "Sales Display Items")

The user taps in "Quantity to Assemble" with value 10 in the Assembly header and start posting the document.

We now need to post the document 10 times with a "Quantity to Assemble" with value 1. (Serial Tracking) Th approach is, that we can match the assembled item and it's components in the item ledger entries.

If you disagree with this change, we need to search for another solution.

ChethanT commented 3 months ago

@sschuh sounds like an improvement that we should provide to the posting process. Can you give us more details about the issue you are trying to fix by us exposing those mentioned methods? This is what I have tried

  1. Create a item 'Assembled Item 1' with replenishment system as 'Assembly'
  2. Add Assembly BOM with 2 random items(ensure the items in in stock)
  3. Mark the item as an serially tracked item by setting the 'Item Tracking Code'
  4. Create 'Assembly Order' and set the Item No. to be the one from 'Assembled Item 1'. This will add the BOM items as assembly lines
  5. Set 'Quantity' as 5.....sets 'Quantity to Assemble' as 5
  6. Open 'Item Tracking Lines' and assign serial numbers
  7. Run 'Preview Posting' ...... works fine and seem to create ledger entries for all 5 output items.
  8. Post....seems to work fine whout a need to post 5 times.
sschuh commented 3 months ago

@ChethanT Your examples work fine.

But here is our scenario: Assembly Item "Sales Display" (with Serial Tracking) Components: 10x Red Wine 10x White White

The assembly order has been posted with 2 serial items.

You can see two output lines. And the cumulated consumption of 20x Red Wine and 20x White Wine. image

The cumulated consumption is our problem.

We need following result:

One Ledger Entry for the output item with serial no. SER00001280 One Ledger Entry with consumption of 10x Red wine One Ledger Entry with consumption of 10x White wine

We need this structure for tracking the components that belongs to SER00001280.

One Ledger Entry for the output item with serial no. SER00001279 One Ledger Entry with consumption of 10x Red wine One Ledger Entry with consumption of 10x White wine

We need this structure for tracking the components that belongs to SER00001279.