Skip to main content
Solved

Request for inputs to Skip the scan of the Original location from the “Scan and Transfer“ screen


vidyakeerthik
Freshman II
Forum|alt.badge.img

 

Hi Team,

We don’t want to scan the Original location. Directly scan the destination location, and then scan the item.  When we scan the Item, it should take the default location from the item as the Original location.

We are trying to override the ScanMode related methods, which doesn’t help.

Any inputs or references on this are much appreciated !!

 

 

Thanks & Regards,
Vidyakeerthi K

 

 

Best answer by VidhyaHari

@vidyakeerthik I recommend you to use the community KB articles to override/extend the new WMS BarcodeDrivenStateMachine architecture (https://community.acumatica.com/customization-tools-and-framework-245/how-to-customize-an-existing-screen-with-the-new-automated-warehouse-operations-engine-in-acumatica-erp-2021-r1-and-later-8029)

And use the below approach:

  1. Create a new ScanExtension for INScanTransfer like public class INScanTransfer_Extension : PX.Objects.IN.WMS.INScanTransfer.ScanExtension { }
  2. Override the DecorateScanMode to have TransferMode intercepted, and override the CreateTransitions method and remove the transition to SourceLocationState – which handles the source Location scan. This way it eliminates the transition to scan the Source Location.
  3. Now, after removing the transition to SourceLocationState, we need to set the value for SiteID so that the Transfer happens without any errors. In order to do this, override the DecorateScanState – intercept the HandleAbsence of AmbiguousLocationState since both SourceLocationState and TargetLocationState are extended from that and set the Basis.SiteID, Basis.TransferToSiteID and Basis.LocationID which would handling the setting of the source Location.
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using PX.Common;
using PX.Data;
using PX.Data.BQL;
using PX.Data.BQL.Fluent;
using PX.BarcodeProcessing;
using PX.Objects.IN;
using PX.Objects;
using PX.Objects.IN.WMS;
using WMSBase = PX.Objects.IN.WMS.INScanRegisterBase<PX.Objects.IN.WMS.INScanTransfer, PX.Objects.IN.WMS.INScanTransfer.Host, PX.Objects.IN.INDocType.transfer>;
namespace PX.Objects.IN.WMS
{
    public class INScanTransfer_Extension : PX.Objects.IN.WMS.INScanTransfer.ScanExtension
    {
        [PXOverride]
        public virtual ScanState<INScanTransfer> DecorateScanState(ScanState<INScanTransfer> original, Func<ScanState<INScanTransfer>, ScanState<INScanTransfer>> base_DecorateScanState)
        {
            var state = base_DecorateScanState(original);

            if (state is INScanTransfer.TransferMode.AmbiguousLocationState sourceLocState)
            {
                sourceLocState.Intercept.HandleAbsence.ByOverride((basis, barcode, base_HandleAbsence) =>
                {
                    if (Basis.Document == null)
                    {
                        Basis.SiteID = 154;
                        Basis.TransferToSiteID = 154;
                    }
                    Basis.LocationID = 155;
                    Basis.TransferToLocationID = null;
                    return base_HandleAbsence(barcode);
                });

            }
            return state;
        }

        [PXOverride]
        public virtual ScanMode<INScanTransfer> DecorateScanMode(ScanMode<INScanTransfer> original, Func<ScanMode<INScanTransfer>, ScanMode<INScanTransfer>> base_DecorateScanMode)
        {
            var mode = base_DecorateScanMode(original);
            if (mode is INScanTransfer.TransferMode transferMode)
            {
                transferMode.Intercept.CreateTransitions.ByReplace(basis =>
                {
                    if (Basis.PromptLocationForEveryLine)
                    {
                        return basis.StateFlow(flow => flow
                          .From<WMSBase.WarehouseState>()
                          //.NextTo<INScanTransfer.TransferMode.SourceLocationState>()
                          .NextTo<INScanTransfer.InventoryItemState>()
                          .NextTo<WMSBase.LotSerialState>()
                          .NextTo<INScanTransfer.TransferMode.TargetLocationState>()
                          .NextTo<WMSBase.ReasonCodeState>());
                    }
                    else
                    {
                        return basis.StateFlow(flow => flow
                          .From<WMSBase.WarehouseState>()
                          //.NextTo<INScanTransfer.TransferMode.SourceLocationState>()
                          .NextTo<INScanTransfer.TransferMode.TargetLocationState>()
                          .NextTo<WMSBase.ReasonCodeState>()
                          .NextTo<INScanTransfer.InventoryItemState>()
                          .NextTo<WMSBase.LotSerialState>());
                    }
                });
            }
            return mode;
        }
    }
}

 

View original
Did this topic help you find an answer to your question?

3 replies

darylbowman
Captain II
Forum|alt.badge.img+13

Could you post what you've tried?


vidyakeerthik
Freshman II
Forum|alt.badge.img
  • Author
  • Freshman II
  • 12 replies
  • August 7, 2024

Sure @darylbowman 

Please find below screenshot which we tried.

 


Forum|alt.badge.img+1
  • Acumatica Moderator
  • 14 replies
  • Answer
  • August 7, 2024

@vidyakeerthik I recommend you to use the community KB articles to override/extend the new WMS BarcodeDrivenStateMachine architecture (https://community.acumatica.com/customization-tools-and-framework-245/how-to-customize-an-existing-screen-with-the-new-automated-warehouse-operations-engine-in-acumatica-erp-2021-r1-and-later-8029)

And use the below approach:

  1. Create a new ScanExtension for INScanTransfer like public class INScanTransfer_Extension : PX.Objects.IN.WMS.INScanTransfer.ScanExtension { }
  2. Override the DecorateScanMode to have TransferMode intercepted, and override the CreateTransitions method and remove the transition to SourceLocationState – which handles the source Location scan. This way it eliminates the transition to scan the Source Location.
  3. Now, after removing the transition to SourceLocationState, we need to set the value for SiteID so that the Transfer happens without any errors. In order to do this, override the DecorateScanState – intercept the HandleAbsence of AmbiguousLocationState since both SourceLocationState and TargetLocationState are extended from that and set the Basis.SiteID, Basis.TransferToSiteID and Basis.LocationID which would handling the setting of the source Location.
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using PX.Common;
using PX.Data;
using PX.Data.BQL;
using PX.Data.BQL.Fluent;
using PX.BarcodeProcessing;
using PX.Objects.IN;
using PX.Objects;
using PX.Objects.IN.WMS;
using WMSBase = PX.Objects.IN.WMS.INScanRegisterBase<PX.Objects.IN.WMS.INScanTransfer, PX.Objects.IN.WMS.INScanTransfer.Host, PX.Objects.IN.INDocType.transfer>;
namespace PX.Objects.IN.WMS
{
    public class INScanTransfer_Extension : PX.Objects.IN.WMS.INScanTransfer.ScanExtension
    {
        [PXOverride]
        public virtual ScanState<INScanTransfer> DecorateScanState(ScanState<INScanTransfer> original, Func<ScanState<INScanTransfer>, ScanState<INScanTransfer>> base_DecorateScanState)
        {
            var state = base_DecorateScanState(original);

            if (state is INScanTransfer.TransferMode.AmbiguousLocationState sourceLocState)
            {
                sourceLocState.Intercept.HandleAbsence.ByOverride((basis, barcode, base_HandleAbsence) =>
                {
                    if (Basis.Document == null)
                    {
                        Basis.SiteID = 154;
                        Basis.TransferToSiteID = 154;
                    }
                    Basis.LocationID = 155;
                    Basis.TransferToLocationID = null;
                    return base_HandleAbsence(barcode);
                });

            }
            return state;
        }

        [PXOverride]
        public virtual ScanMode<INScanTransfer> DecorateScanMode(ScanMode<INScanTransfer> original, Func<ScanMode<INScanTransfer>, ScanMode<INScanTransfer>> base_DecorateScanMode)
        {
            var mode = base_DecorateScanMode(original);
            if (mode is INScanTransfer.TransferMode transferMode)
            {
                transferMode.Intercept.CreateTransitions.ByReplace(basis =>
                {
                    if (Basis.PromptLocationForEveryLine)
                    {
                        return basis.StateFlow(flow => flow
                          .From<WMSBase.WarehouseState>()
                          //.NextTo<INScanTransfer.TransferMode.SourceLocationState>()
                          .NextTo<INScanTransfer.InventoryItemState>()
                          .NextTo<WMSBase.LotSerialState>()
                          .NextTo<INScanTransfer.TransferMode.TargetLocationState>()
                          .NextTo<WMSBase.ReasonCodeState>());
                    }
                    else
                    {
                        return basis.StateFlow(flow => flow
                          .From<WMSBase.WarehouseState>()
                          //.NextTo<INScanTransfer.TransferMode.SourceLocationState>()
                          .NextTo<INScanTransfer.TransferMode.TargetLocationState>()
                          .NextTo<WMSBase.ReasonCodeState>()
                          .NextTo<INScanTransfer.InventoryItemState>()
                          .NextTo<WMSBase.LotSerialState>());
                    }
                });
            }
            return mode;
        }
    }
}

 


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings