Skip to main content
Solved

Customizing create production order screen

  • 26 July 2023
  • 4 replies
  • 104 views

I have a create production order screen , where in I need to customize and add two new column on create process.


I want to extend the below code, which is on the CreateProductionOrdersProcess acumatica code, but I am not able to achieve that.

        public static void CreateProcess(List<AMFixedDemand> list, ProductionOrdersCreateFilter filter)
{
var prodMaintGraph = CreateInstance<ProdMaint>();
var createProdOrdersGraph = CreateInstance<CreateProductionOrdersProcess>();

Numbering prodNumbering = PXSelectJoin<Numbering, LeftJoin<AMOrderType, On<AMOrderType.prodNumberingID,
Equal<Numbering.numberingID>>>, Where<AMOrderType.orderType, Equal<Required<AMOrderType.orderType>>>
>.Select(prodMaintGraph, filter.CreationOrderType);

if (prodNumbering == null)
{
throw new PXException(Messages.GetLocal(Messages.NumberingMissingExceptionProduction,
filter.CreationOrderType));
}

if (prodNumbering.UserNumbering.GetValueOrDefault())
{
throw new PXException(Messages.GetLocal(Messages.ManualNumberingNotAllowedForProcess,
filter.CreationOrderType));
}

createProdOrdersGraph.CreateProductionOrders(list, filter, prodMaintGraph);

}

I can create a delegate , modify the CreateProductionOrders function.
However, this function is utilized across several other pages.  

        public virtual void CreateProductionOrders(List<AMFixedDemand> list, ProductionOrdersCreateFilter filter, ProdMaint prodMaintGraph)
        {
....
}

Could anyone please suggest an alternative approach, to populate additional columns on create process action.

 

4 replies

Badge +12

The CreateProcessAction is a public method. Is there a reason you don’t want to extend that method?

 

public delegate void CreateProcessDelegate(List<AMFixedDemand> list, ProductionOrdersCreateFilter filter);

[PXOverride]
public void CreateProcess(List<AMFixedDemand> list, ProductionOrdersCreateFilter filter, OriginalActionDelegate baseMethod)
{
// Execute original method
baseMethod(list, filter);

// Execute additional code
// ...
}

I guess if that method is called other places, it would have the same drawbacks.

 

Could you explain what you’re hoping to achieve in a bit more detail? Where is the data coming from that you’re populating the fields with? What is the reason the code isn’t allowed to run during processes from other screens?

Userlevel 2

@darylbowman  I tried but its throwing an error and not allowing me to extend  I am trying to override create production processing method . I want to add logic to have fields created on SOLine before the production order is created. Unfortunately, the production order method is triggered and does not allow me override. 

when I try to override the CreateProcessDelegate  it says ,  unknown create CreateProcess method.

Userlevel 2

@darylbowman Thank you for the approach.

Badge +12

Did you get it to work?

Reply