Skip to main content
Answer

Add all relevant operation lines to Move screen AM302000 after updating Production Order Nbr

  • March 25, 2024
  • 4 replies
  • 56 views

Forum|alt.badge.img

Hi,

A client is wanting to be able to add all the BOM operation lines related to the production order they have added into the grid on the Move screen (AM302000). For example, if they were to add a new line and select Production Order PO1234, they would like all the relevant lines to appear, rather than manually adding in a row for each record they want to process.

The code below is how I have tried setting it up, but all it does is make the screen load for ages and I am not sure why that is happening.

This is the process I am trying to enable using the code below:

  1. Add a new row to the grid and select a Production Nbr.
  2. Once this has been selected, all BOM operations associated with this order are added underneath.
  3. If there are any records that are not needed, remove them from the grid.
  4. Repeat these steps for any other Production Orders.

 

Here is the code I have so far. What would be the best way to structure this?

protected void AMMTran_ProdOrdID_FieldUpdated(PXCache cache, PXFieldUpdatedEventArgs e)
{

var row = (AMMTran)e.Row;

if (row == null || string.IsNullOrEmpty(row.ProdOrdID))
{
return; // Exit if the ProdOrdID is null or empty
}

var selectOperations = new PXSelectJoin<AMBomOper,
InnerJoin<AMProdItem, On<AMBomOper.bOMID, Equal<AMProdItem.bOMID>>>,
Where<AMProdItem.prodOrdID, Equal<Required<AMProdItem.prodOrdID>>>>(this.Base);

List<AMMTran> transactionsToAdd = new List<AMMTran>();
foreach (AMBomOper bomOper in selectOperations.Select(row.ProdOrdID))
{
AMMTran newLine = (AMMTran)cache.CreateInstance();
newLine.ProdOrdID = row.ProdOrdID;
newLine.InventoryID = row.InventoryID;
newLine.OperationID = bomOper.OperationID;

cache.Insert(newLine);
}

 

Let me know if I can clarify anything about the information above.

 

Kind regards,

Andrew

Best answer by angierowley75

Reporting the quantity complete on the last operation will assume all prior operations have completed the same quantity - what is the business case for creating a move line for each operation?

4 replies

angierowley75
Acumatica Moderator
Forum|alt.badge.img+3
  • Acumatica Moderator
  • Answer
  • March 25, 2024

Reporting the quantity complete on the last operation will assume all prior operations have completed the same quantity - what is the business case for creating a move line for each operation?


Forum|alt.badge.img
  • Author
  • Varsity I
  • March 25, 2024

Hi Angie,

Thanks for your response. I just did the below in a test environment to see what happens. The operation included here is the last one from the Production Order.

Is there a way to check that the previous lines have been processed, or has this been handled behind the scenes and we can assume it has been processed correctly?

The reason the client wanted to have each line was because they wanted to process each step that was completed. But if this isn't required and they can just add the last step, it would make their lives much easier.

Kind regards,

Andrew

 


angierowley75
Acumatica Moderator
Forum|alt.badge.img+3
  • Acumatica Moderator
  • March 25, 2024

On the Events tab of the Production order, they can look at the relate cost and inventory transaction which were triggered by the final move of the production item on the last operation.


Forum|alt.badge.img
  • Author
  • Varsity I
  • March 25, 2024

Angie, you are a gem, thanks so much for your help on this! This process is exactly what they need, and so much more efficient than what I was trying to make the system do.