What is the new button name for Base.Actions["LSPOReceiptLine_binLotSerial"].Press()?

Viewed 21

I have inherited an older customization to the Purchase Receipts / PO302000 screen that I'm trying to upgrade, and it had customization code to import Lot/Serial nbrs from an Excel spreadsheet. It all seems to work alright, except that at the end, it errors out when pressing a button as follows:

Base.Actions["LSPOReceiptLine_binLotSerial"].Press();

Here's the entire code:

public virtual void importAllocations()
    {
        try
        {
            if (Base.transactions.Current != null)
            {

                var siteid = Base.transactions.Current.SiteID;

                if (Base.splits.Select().Count == 0)
                {
                    if (this.NewRevisionPanel.AskExt() == WebDialogResult.OK)
                    {
                        const string PanelSessionKey = "ImportStatementProtoFile";
                        PX.SM.FileInfo info = PX.Common.PXContext.SessionTyped<PXSessionStatePXData>().FileInfo[PanelSessionKey] as PX.SM.FileInfo;
                        System.Web.HttpContext.Current.Session.Remove(PanelSessionKey);

                        if (info != null)
                        {
                            byte[] filedata = info.BinData;
                            using (NVExcelReader reader = new NVExcelReader())
                            {
                                Dictionary<UInt32, string[]> data = reader.loadWorksheet(filedata);
                                foreach (string[] textArray in data.Values)
                                {
                                    if (textArray[0] != GetInventoryCD(Base.transactions.Current.InventoryID))
                                    {
                                        throw (new Exception("InventoryID in file does not match row Inventory ID"));
                                    }
                                    else
                                    {
                                        //Find the location ID based on the location CD provided by the Excel sheet...
                                        INLocation inloc = PXSelect<INLocation,
                                                           Where<INLocation.locationCD, Equal<Required<INLocation.locationCD>>,
                                                           And<INLocation.siteID, Equal<Required<INLocation.siteID>>>>>.Select(Base
                                                                                                                              , textArray[1]
                                                                                                                              , Base.transactions.Current.SiteID);
                                        Base.splits.Insert(new POReceiptLineSplit()
                                        {
                                            InventoryID = Base.transactions.Current.InventoryID,

                                            LocationID = inloc.LocationID,  //Convert.ToInt32(textArray[1]), //Base.transactions.Current.LocationID,
                                            LotSerialNbr = textArray[2],
                                            Qty = Decimal.Parse(textArray[3])
                                        });
                                    }
                                }
                            }
                        }
                    }
                }
            }
            Base.Actions["LSPOReceiptLine_binLotSerial"].Press();
        }
        catch (FileFormatException fileFormat)
        {
            // Acuminator disable once PX1053 ConcatenationPriorLocalization [Justification]
            throw new PXException(String.Format("Incorrect file format. File must be of type .xlsx", fileFormat.Message));
        }
        catch (Exception ex)
        {
            throw ex;
        }
    }

Now, there seems to be no such button - and I have no idea what it would be called now, or if it even still exists. I don't even really know what this action did.

Any ideas?

Thanks much...

1 Answers

That logic has been moved into the PX.Objects.PO.GraphExtensions.POReceiptEntryExt.POReceiptLineSplittingExtension. That action was doing the following in the PX.Objects.PO.LSPOReceiptLine

// PX.Objects.PO.LSPOReceiptLine
// Token: 0x0600446F RID: 17519 RVA: 0x000EE86C File Offset: 0x000ECA6C
public override IEnumerable BinLotSerial(PXAdapter adapter)
{
    if (base.MasterCache.Current != null)
    {
        if (!this.IsLSEntryEnabled((POReceiptLine)base.MasterCache.Current))
        {
            throw new PXSetPropertyException("The Line Details dialog box cannot be opened because changing line details is not allowed for the selected item.");
        }
        this.View.AskExt(true);
    }
    return adapter.Get();
}

Now it is called ShowSplits and is part of the POReceiptLineSplittingExtension extension.

// PX.Objects.PO.GraphExtensions.POReceiptEntryExt.POReceiptLineSplittingExtension
// Token: 0x06005359 RID: 21337 RVA: 0x00138621 File Offset: 0x00136821
public override IEnumerable ShowSplits(PXAdapter adapter)
{
    if (base.LineCurrent == null)
    {
        return adapter.Get();
    }
    if (!this.IsLSEntryEnabled(base.LineCurrent))
    {
        throw new PXSetPropertyException("The Line Details dialog box cannot be opened because changing line details is not allowed for the selected item.");
    }
    return base.ShowSplits(adapter);
}

Given the fact that ShowSplits is defined in the LineSplittingExtension originally it may be referred to as "LineSplittingExteions_ShowSplits" or "POReceiptLineSplittingExtension_ShowSplits". I would suggest including that POReceiptLineSplittingExtension as part of your extension and simply call the Base1.ShowSplits

Related