Question

Need to change the behavior of the selector field.


Hi,

I have added a selector field (Location) in the Lot/Serial Nbr field in the Sales Order line details form as per the screenshots.

 

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

 

 

Follow the navigation below.

The system cumulatively shows information based on the lot number. I need to see on-hand information with different locations as per the screenshot.

 

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 above screen 21 onhand qty should be split.

------------------------------------------------------------------------------------------------------------------------

I found the following configuration steps. I am not sure exactly how to apply them.

Can someone help me resolve this?

 

Detailed Implementation


1. Modify the Data Retrieval Query
Ensure the query fetches lot numbers with their respective locations and quantities.

sql
Copy code
SELECT
    LotNumber,
    Location,
    Quantity
FROM
    Inventory
WHERE
    WarehouseID = @WarehouseID
ORDER BY
    LotNumber, Location
2. Customize the Selector Logic
Adjust the selector field logic to display the lot numbers by location. This can typically be done in the backend code where the selector is populated.

Example in C#:
csharp
Copy code
public List<LotDetails> GetLotDetailsByWarehouse(string warehouseId)
{
    // Fetch data from the database
    var lotDetails = new List<LotDetails>();
    // Populate lotDetails with data from the database query
    return lotDetails;
}

public void PopulateLotNumberSelector(string warehouseId)
{
    var lotDetails = GetLotDetailsByWarehouse(warehouseId);
    lotNumberSelector.DataSource = lotDetails;
    lotNumberSelector.DataTextField = "LotNumber";  // Display field
    lotNumberSelector.DataValueField = "LotNumber"; // Value field
    lotNumberSelector.DataBind();
}
3. Update the User Interface
Ensure the UI correctly displays the lot numbers with their locations and quantities.

Example in ASP.NET:
Define the grid in your ASP.NET page:

html
Copy code
<asp:GridView ID="lotDetailsGrid" runat="server" AutoGenerateColumns="False">
    <Columns>
        <asp:BoundField DataField="LotNumber" HeaderText="Lot Number" />
        <asp:BoundField DataField="Location" HeaderText="Location" />
        <asp:BoundField DataField="Quantity" HeaderText="Quantity" />
    </Columns>
</asp:GridView>
Bind the data in the code-behind:

csharp
Copy code
protected void Page_Load(object sender, EventArgs e)
{
    if (!IsPostBack)
    {
        PopulateLotNumberSelector("WarehouseID");
    }
}

private void PopulateLotNumberSelector(string warehouseId)
{
    var lotDetails = GetLotDetailsByWarehouse(warehouseId);
    lotDetailsGrid.DataSource = lotDetails;
    lotDetailsGrid.DataBind();
}
By following these steps, you can adjust the selector behavior to display lot numbers separately based on their locations within the same warehouse, ensuring accurate and detailed visibility of the lot quantities.

 

 

 

 


15 replies

Userlevel 7
Badge +7

@Naveen Boga Hi Naveen, is this something you could help with? 

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

Review the SOLotSerialNbrAttribute used by the Lot/Serial Nbr field. If you replace the aggregate and group by warehouse (siteID) and use locationID instead, you will get your expected result.

Hope this helps!

 
Thank you very much for your Prompt response,
 
I tried to find the exact place that needs modification in the source code, but I couldn't locate the area highlighted in the screenshot. I am not sure if it is the exact place where the changes need to be made.
 
I followed the steps below.

 

 

 

I expanded the region and tried to find out the exact area as per your screen.

 

 

 

Really, appreciated your prompt response and could you mention the exact navigation steps to this Location.  I think I missed something.

Badge +12

The source code is much more difficult to search in Acumatica itself. I would suggest attaching Visual Studio to the site and searching through App_Data\CodeRepository. The SOLineSplit.cs file at \App_Data\CodeRepository\PX.Objects\SO\DAC\SOLineSplit.cs will contain the DAC definition for the data row, and Attribute.cs at \App_Data\CodeRepository\PX.Objects\SO\Descriptor\Attribute.cs will contain the SOLotSerialNbrAttribute class. You’re looking for the BQL statement starting at line 782.

 

Badge +12

Attribute.cs at \App_Data\CodeRepository\PX.Objects\SO\Descriptor\Attribute.cs will contain the SOLotSerialNbrAttribute class.

You want SOAllocationLotSerialNbrAttribute, not SOLotSerialNbrAttribute, but the line number was correct.

Dear @FrancisPervera92 and @darylbowman ,

 

I found the exact location as per the given instructions, and thank you for that.

I followed the instructions provided by @FrancisPervera92 and made the following modifications, but the result is the same.

Scenario-01

01). Remove the Site id and insert LocationID as per the below.

Publish the customization and review the result. It does not split the lot quantity based on the location.

 

Scenario-02

 

I have added the LocationID to the query without removing the SiteID as per the below.

 



Publish the Customization and review the result.
 

My expected result should be that this quantity of 21 should be segregated based on the location.

 

 

 

I have attached the Attribute.cs file saved as a Notepad document.

 

The GroupBy<> clause is not the only line that you need to update. You need to study the entire search query and apply the necessary changes.

Upon further checking, the joined table (INSiteLotSerial) in the search query shows only the item quantities per warehouse, not per location. You may need to replace this with another table that stores quantities up to the warehouse location level. A good candidate is the ‘INLotSerialStatus’. Please check this in the database using management studio to confirm.

I tried to use it and this is the result.

Also verify the values of the ‘qty on hand’ and ‘qty available’ to know the conditions when they are updated because this is a different table than the original. Apply the necessary adjustments as needed in the DAC of INLotSerialStatus. Add a new property that tracks the real-time movement of item quantities, maybe call it QtyAvailOnLocation--similar to the QtyAvailOnSite of the original code.

Cheers!

Hi,

 

I assume I missed something basic here.

When I tried to find the Attribute.cs file through Visual Studio, I could not find the App_Data folder in Visual Studio. I do not understand if I missed any installation steps.

 

 

However, I can find that in my Local location and I can open it through Visual studio.

 

 

After modifying the code, how can I transfer those changes to the server?

Badge +12

After modifying the code, how can I transfer those changes to the server?

It needs to be part of a Customization Project. From the depth of your question, I’m assuming you’ve worked with them. You can’t modify the Attribute.cs file directly. You’d need to recreate a new selector attribute based on the original. Then replace the selector attribute on LotSerialNbr, either in a graph extension via CacheAttached or in a DAC extension by redefining the LotSerialNbr field.

Hi,

I opened the App_Data folder and opened it with Visual Studio. Now, I can see the App_Data folder in Visual Studio. I am currently working on modifying the Attribute.cs file.

 

Hi,

I have completed the following steps.

01). I navigated to the following folder and copied the Attribute.cs file.

C:\Program Files\MYOB Advanced\MYOB2023117V1\App_Data\CodeRepository\PX.Objects\SO\Descriptor

 

02).Then, I copied the org Attribute file to this folder.

C:\Program Files\MYOB Advanced\MYOB2023117V1\App_Code\Caches

 

 I can see the attribute file in the Caches folder.

 

 

Then, I created a UDF as QtyAvailOnLocation in the DAC of INLotSerialStatus.

 

 

 I opened the website through Visual Studio.

 

 

 

 

 

The I navigate to the Caches folder. And,select the attribute.cs file and find the exact SOAllocationLotSerialNbrAttribute  area.


I replace INSiteLotSerial to INLotSerialStatus in this area.

And, added created UDF to this code. INLotSerialStatusExt.usrQtyAvailOnLocation


 


I have attached the attribute.cs file with this changes. And, build the solution. There is no errors.

I navigated to the customization project and updated the modified file.

Then, there is an another error for License issue. I know this is a different issue.
 

I am not sure if the steps I followed are correct. Can someone advise on this?
For further review, I have attached the customization project.

 

Hi,

I further investigated and resolved the following License issue

Error        C:\Program Files\MYOB Advanced\MYOB2023117V1\licenses.licx: Could not transform licenses file into a binary resource.  Object reference not set to an instance of an object.    MYOB2023117V1    C:\Program Files\MYOB Advanced\MYOB2023117V1\licenses.licx

 

However, after building the solution, I still cannot achieve the expected outcome.

 

The expected result should be as shown in the screenshot below. I have attached customization package herewith.

 

 

 

Userlevel 3
Badge +1

Hi @nethupul to achieve this we need to append the original selector with the below business logic. 

[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))]

Hope this helps, thank you!

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