Skip to main content
Solved

Add Location ID to Existing Selector (LotSerialNbr) in Sales Order Line Detail

  • 21 June 2024
  • 3 replies
  • 65 views

I require a clarification on my process of adding a field (Location) in the Lot/Serial Nbr field in the Sales Order line details. I have appended to the original selector as shown below.

This item has the same lot number in different locations under the same warehouse.

For clarity follow the navigation below,

My requirement is to see the on hand quantity information with different location without a cumulative amount.

The expected result should be as follows: the system should not accumulate the values and should display all the same lot number information for different locations. The screenshot depicting 21 on hand qty should be split like the result below.

How can I modify the selector by overriding the query used in the standard selector of the Lot/Serial Nbr field of the Line Details pop-up panel. Standard behaviour of the selector attribute aggregates the result to show total by warehouse (siteID).

 

Thank you!

This was solved by modifying the selector logic as below.

[PXCustomizeSelectorColumns(
typeof(INLotSerialStatus.lotSerialNbr),
typeof(INLotSerialStatus.siteID),
typeof(INLotSerialStatus.locationID),
typeof(INLotSerialStatus.qtyOnHand),
typeof(INLotSerialStatus.qtyAvail),
typeof(INLotSerialStatus.expireDate))]
[PXSelector(typeof(Search2<INLotSerialStatus.lotSerialNbr,
InnerJoin<INLocation, On<INLotSerialStatus.locationID, Equal<INLocation.locationID>>,
InnerJoin<INSiteLotSerial, On<INLotSerialStatus.inventoryID, Equal<INSiteLotSerial.inventoryID>,
And<INLotSerialStatus.siteID, Equal<INSiteLotSerial.siteID>,
And<INLotSerialStatus.lotSerialNbr, Equal<INSiteLotSerial.lotSerialNbr>>>>>>,
Where<INLotSerialStatus.inventoryID, Equal<Current<SOLineSplit.inventoryID>>,
And<INLotSerialStatus.siteID, Equal<Current<SOLineSplit.siteID>>,
And<INLotSerialStatus.qtyOnHand, Greater<decimal0>>>>,
OrderBy<Asc<INLotSerialStatus.locationID>>>),
typeof(INLotSerialStatus.lotSerialNbr),
typeof(INLotSerialStatus.siteID),
typeof(INLotSerialStatus.locationID),
typeof(INLotSerialStatus.qtyOnHand),
typeof(INLotSerialStatus.qtyAvail),
typeof(INLotSerialStatus.expireDate))]

Hope this helps!


The selector is working but when I try to prepare the invoice I get an error like this

An error occurred during processing of the field Lot/Serial Nbr. value 1000001002 Error: Lot/Serial Nbr. '1000001002' cannot be found in the system.

but my selector works fine

this is my code any help would be much appreciated:


 

using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using PX.Common;
using PX.Data;
using PX.Objects.AP;
using PX.Objects.AR;
using PX.Objects.CA;
using PX.Objects.CM;
using PX.Objects.CR;
using PX.Objects.CS;
using PX.Objects.DR;
using PX.Objects.EP;
using PX.Objects.GL;
using PX.Objects.IN;
using PX.Objects.PM;
using PX.Objects.PO;
using PX.Objects.TX;
using POLine = PX.Objects.PO.POLine;
using POOrder = PX.Objects.PO.POOrder;
using PX.CarrierService;
using PX.Concurrency;
using CRLocation = PX.Objects.CR.Standalone.Location;
using PX.Objects.AR.CCPaymentProcessing;
using PX.Objects.AR.CCPaymentProcessing.Common;
using PX.Objects.AR.CCPaymentProcessing.Helpers;
using PX.Objects.AR.CCPaymentProcessing.Interfaces;
using ARRegisterAlias = PX.Objects.AR.Standalone.ARRegisterAlias;
using PX.Objects.AR.MigrationMode;
using PX.Objects.Common;
using PX.Objects.Common.Discount;
using PX.Objects.Common.Extensions;
using PX.Objects.IN.Overrides.INDocumentRelease;
using PX.CS.Contracts.Interfaces;
using Message = PX.CarrierService.Message;
using PX.TaxProvider;
using PX.Data.DependencyInjection;
using PX.Data.WorkflowAPI;
using PX.LicensePolicy;
using PX.Objects.Extensions.PaymentTransaction;
using PX.Objects.SO.GraphExtensions.CarrierRates;
using PX.Objects.SO.GraphExtensions.SOOrderEntryExt;
using PX.Objects.SO.Attributes;
using PX.Objects.Common.Attributes;
using PX.Objects.Common.Bql;
using OrderActions = PX.Objects.SO.SOOrderEntryActionsAttribute;
using PX.Objects.SO.DAC.Projections;
using PX.Data.BQL.Fluent;
using PX.Data.Localization;
using PX.Data.Reports;
using PX.Objects.IN.DAC.Accumulators;
using PX.Data.BQL;
using PX.Objects.SO.Standalone;
using PX.Objects;
using PX.Objects.SO;

namespace PX.Objects.SO
{
  public class SOOrderEntry_Extension : PXGraphExtension<PX.Objects.SO.SOOrderEntry>
  {
    #region Event Handlers
     bPXMergeAttributes(Method = MergeMethod.Append)]
        tPXCustomizeSelectorColumns(
            typeof(INLotSerialStatus.lotSerialNbr),
            typeof(INLotSerialStatus.siteID),
            typeof(INLotSerialStatus.locationID),
            typeof(INLotSerialStatus.qtyOnHand),
            typeof(INLotSerialStatus.qtyAvail),
            typeof(INLotSerialStatus.expireDate))]
          PXSelector(typeof(Search2<INLotSerialStatus.lotSerialNbr,
                    InnerJoin<INLocation, On<INLotSerialStatus.locationID, Equal<INLocation.locationID>>,
                    InnerJoin<INSiteLotSerial, On<INLotSerialStatus.inventoryID, Equal<INSiteLotSerial.inventoryID>,
                        And<INLotSerialStatus.siteID, Equal<INSiteLotSerial.siteID>,
                        And<INLotSerialStatus.lotSerialNbr, Equal<INSiteLotSerial.lotSerialNbr>>>>>>,
                    Where<INLotSerialStatus.inventoryID, Equal<Current<SOLineSplit.inventoryID>>,
                        And<INLotSerialStatus.siteID, Equal<Current<SOLineSplit.siteID>>,
                        And<INLotSerialStatus.qtyOnHand, Greater<decimal0>>>>,
                    OrderBy<Asc<INLotSerialStatus.locationID, Asc<INLotSerialStatus.lotSerialNbr>>>>),
                    typeof(INLotSerialStatus.lotSerialNbr),
                    typeof(INLotSerialStatus.siteID),
                    typeof(INLotSerialStatus.locationID),
                    typeof(INLotSerialStatus.qtyOnHand),
                    typeof(INLotSerialStatus.qtyAvail),
                    typeof(INLotSerialStatus.expireDate))]
        protected virtual void SOLineSplit_LotSerialNbr_CacheAttached(PXCache sender)
        {
            // No implementation needed, just attach the attributes.
        }

    #endregion
  }
}


Did the change below and it reflected the correct output. 

>PXCustomizeSelectorColumns(
typeof(INLotSerialStatus.lotSerialNbr),
typeof(INLotSerialStatus.siteID),
typeof(INLotSerialStatus.locationID),
typeof(INLotSerialStatus.qtyOnHand),
typeof(INLotSerialStatus.qtyAvail),
typeof(INLotSerialStatus.expireDate))]
>PXSelector(
typeof(Search2<INLotSerialStatus.lotSerialNbr,
LeftJoin<INLocation,
On<INLotSerialStatus.locationID, Equal<INLocation.locationID>>,
LeftJoin<INSiteLotSerial,
On<INLotSerialStatus.inventoryID, Equal<INSiteLotSerial.inventoryID>,
And<INLotSerialStatus.siteID, Equal<INSiteLotSerial.siteID>,
And<INLotSerialStatus.lotSerialNbr, Equal<INSiteLotSerial.lotSerialNbr>>>>>>,
Where<INLotSerialStatus.inventoryID, Equal<Current<SOLineSplit.inventoryID>>,
And<INLotSerialStatus.siteID, Equal<Current<SOLineSplit.siteID>>,
And<INLotSerialStatus.qtyOnHand, Greater<decimal0>>>>,
OrderBy<Asc<INLotSerialStatus.lotSerialNbr,
Asc<INLotSerialStatus.siteID,
Asc<INLotSerialStatus.locationID>>>>>),
typeof(INLotSerialStatus.lotSerialNbr),
typeof(INLotSerialStatus.siteID),
typeof(INLotSerialStatus.locationID),
typeof(INLotSerialStatus.qtyOnHand),
typeof(INLotSerialStatus.qtyAvail),
typeof(INLotSerialStatus.expireDate))]

 


Reply