Question

IN301020 / How to change the workflow

  • 23 March 2023
  • 0 replies
  • 46 views

Userlevel 3
Badge

Hello,

I'd like to modify slightly the snanning workflow of the IN301020 form.

The initial worklow is the following one :
1°) Scan the barcode of the warehouse,
2°) Scan the barcode of the location,
3°) Scan the bar code of the item,
4°) Scan the lot / serial number
5°) Create the corresponding receipt in the confirm state.

This work fine but let's imagine you have to scan hundred of objects of exactly the same item type. For each of theses objects, you have to scan the barcode of the item and then the serial number.
If we were able to scan once the barcode of the item at the beginning of our scan session, and then only the barcode of the serial numbers, we would save both time and effort.

I have tried to change the workflow so that, after receipt creation (step 5), we come back to step 4 : "Scan the lot / serial number" and not to step 3 : "Scan the bar code of the item".

Unfortunately, even with the informations found in the documentation, the code I have written doesn't work and lead to a stack overflow. I guess there is a smartest way to proceed. Has anyone a track ?

Here is my code :

[PXOverride]
public virtual ScanState<INScanReceive> DecorateScanState(
    ScanState<INScanReceive> original,
    Func<ScanState<INScanReceive>, ScanState<INScanReceive>> base_DecorateScanState)
{
    var state = base_DecorateScanState(original);

    PXTrace.WriteInformation($"DecorateScanState>> State is [{state.GetType().Name}]");
    if (state is ConfirmationState<INScanReceive> confirmation)                
    {
        PXTrace.WriteInformation("Setting of PerformConfirmation override...");
        confirmation.Intercept.PerformConfirmation.ByOverride(
            (basis, base_PerformConfirmation) =>
            {
                var result = base_PerformConfirmation();
                                        
                basis.Clear<INScanReceive.LotSerialState>();

                PXTrace.WriteInformation($"Current state is [{state.GetType().Name}]");
                PXTrace.WriteInformation($"Attempt to go back to [{typeof(INScanReceive.LotSerialState)}] state");
                basis.Reporter.Info("Please scan next serial number !");
                basis.SetScanState<INScanReceive.LotSerialState>();
                PXTrace.WriteInformation("Done");
                return result;
            });
        
        PXTrace.WriteInformation("PerformConfirmation override is set");
    }

    return state;
}

Here is the screen I get just after creating the first receipt. The error occurs when attemting to scan the serial number of the second item.

 

Here is the exception

System.Runtime.CompilerServices.RuntimeHelpers.EnsureSufficientExecutionStack()
   à PX.Data.PXView.Select(Object[] currents, Object[] parameters, Object[] searches, String[] sortcolumns, Boolean[] descendings, PXFilterRow[] filters, Int32& startRow, Int32 maximumRows, Int32& totalRows)
   à PX.Data.PXView.SelectMultiBound(Object[] currents, Object[] parameters)
   à PX.Data.PXRestrictorAttribute.GetItem(PXCache cache, PXRestrictorAttribute attr, Object data, Object key)
   à PX.Data.PXRestrictorAttribute.TryVerify(PXCache sender, PXFieldVerifyingEventArgs e, Boolean IsErrorValueRequired)
   à PX.Data.PXRestrictorAttribute.FieldSelecting(PXCache sender, PXFieldSelectingEventArgs e)
   à PX.Data.PXFieldSelecting.Invoke(PXCache sender, PXFieldSelectingEventArgs args)
   à PX.Data.PXCache.OnFieldSelecting(String name, Object row, Object& returnValue, Boolean forceState, Boolean externalCall)
   à PX.Data.PXCache`1.GetValueInt(Object data, String fieldName, Boolean forceState, Boolean externalCall)
   à PX.Data.PXCache`1.GetStateExt(Object data, String fieldName)
   à PX.BarcodeProcessing.BarcodeDrivenStateMachine`2.SightOf[TField]()
   à PX.Objects.IN.WMS.INScanReceive.ReceiptMode.ConfirmState.get_Prompt()
   à PX.BarcodeProcessing.ScanState`1.TakeOver()
   à PX.BarcodeProcessing.ConfirmationState`1.TakeOver()
   à PX.BarcodeProcessing.BarcodeDrivenStateMachine`2.SetScanState(String state, String message, Object[] args, Action onTransition)
   à PX.BarcodeProcessing.BarcodeDrivenStateMachine`2.DispatchNextFrom(String state, String message, Object[] args)
   à PX.BarcodeProcessing.BarcodeDrivenStateMachine`2.SetScanState(String state, String message, Object[] args, Action onTransition)
   à PX.BarcodeProcessing.BarcodeDrivenStateMachine`2.DispatchNextFrom(String state, String message, Object[] args)
   à PX.BarcodeProcessing.BarcodeDrivenStateMachine`2.SetScanState(String state, String message, Object[] args, Action onTransition)
   à PX.BarcodeProcessing.BarcodeDrivenStateMachine`2.SetScanState[TScanState](String message, Object[] args)
   à Cegid.Erp.IN.INScanRegisterExt.<>c.<DecorateScanState>b__1_0(INScanReceive basis, Func`1 base_PerformConfirmation) dans C:\sources\Cegid.Erp\Cegid.Erp\IN\INScanRegisterExt.cs:ligne 31
   à PX.BarcodeProcessing.BarcodeQtySupport`2.<>c.<DecorateScanState>b__33_1(TScanBasis basis, Func`1 base_PerformConfirmation)
   à PX.BarcodeProcessing.ConfirmationState`1.<Confirm>g__execute|14_0()
   à PX.BarcodeProcessing.ConfirmationState`1.Confirm()
   à PX.BarcodeProcessing.ConfirmationState`1.TakeOver()
   à PX.BarcodeProcessing.BarcodeDrivenStateMachine`2.SetScanState(String state, String message, Object[] args, Action onTransition)
   à PX.BarcodeProcessing.BarcodeDrivenStateMachine`2.DispatchNextFrom(String state, String message, Object[] args)
   à PX.BarcodeProcessing.BarcodeDrivenStateMachine`2.SetScanState(String state, String message, Object[] args, Action onTransition)
   à PX.BarcodeProcessing.BarcodeDrivenStateMachine`2.DispatchNextFrom(String state, String message, Object[] args)
   à PX.BarcodeProcessing.BarcodeDrivenStateMachine`2.SetScanState(String state, String message, Object[] args, Action onTransition)
   à PX.BarcodeProcessing.BarcodeDrivenStateMachine`2.SetScanState[TScanState](String message, Object[] args)
   à Cegid.Erp.IN.INScanRegisterExt.<>c.<DecorateScanState>b__1_0(INScanReceive basis, Func`1 base_PerformConfirmation) dans C:\sources\Cegid.Erp\Cegid.Erp\IN\INScanRegisterExt.cs:ligne 31


0 replies

Be the first to reply!

Reply


About Acumatica ERP system
Acumatica Cloud ERP provides the best business management solution for transforming your company to thrive in the new digital economy. Built on a future-proof platform with open architecture for rapid integrations, scalability, and ease of use, Acumatica delivers unparalleled value to small and midmarket organizations. Connected Business. Delivered.
© 2008 — 2024  Acumatica, Inc. All rights reserved