0
votes

We have currently added the Warehouse/Bin Transfer to the Acumatica Mobile to allow users to do bin transfers via the Mobile versus using Acumatica.

We have added the QtyAvailable to the From and To Bin selectors in the with the SelectorContainer statement. However is there a way to filter out only those records for the item instead of showing all bins/location. This filter would only be on the from location. The to location would still show all locations.

1

1 Answers

0
votes

To show only bin/locations with Qty. Available greater than 0, you should extend Where condition for LocationAvailAttribute decorating the INTran.LocationID field:

using PX.Data;
using System;

namespace PX.Objects.IN
{
    public class INTransferEntryExt : PXGraphExtension<INTransferEntry>
    {
        [PXRemoveBaseAttribute(typeof(LocationAvailAttribute))]
        [PXMergeAttributes(Method = MergeMethod.Append)]
        [LocationAvailCst(typeof(INTran.inventoryID), typeof(INTran.subItemID), 
            typeof(INTran.siteID), typeof(INTran.tranType), typeof(INTran.invtMult))]
        public virtual void INTran_LocationID_CacheAttached(PXCache sender)
        {
        }

        public class LocationAvailCstAttribute : LocationAvailAttribute
        {
            public LocationAvailCstAttribute(Type inventoryType, Type subItemType, 
                Type siteIDType, Type TranType, Type InvtMultType)
                : base(inventoryType, subItemType, siteIDType, TranType, InvtMultType)
            {
                var attr = _Attributes[_SelAttrIndex] as PXDimensionSelectorAttribute;
                var dimAttr = attr.GetAttribute<PXDimensionAttribute>();
                var selAttr = attr.GetAttribute<PXSelectorAttribute>();
                var select = selAttr.GetSelect();
                select = select.WhereAnd<Where<INLocationStatus.qtyAvail, Greater<Zero>>>();
                var newAttr = new PXDimensionSelectorAttribute(DimensionName,
                    select.GetType(), typeof(INLocation.locationCD),
                    new Type[]
                    {
                        typeof(INLocation.locationCD),
                        typeof(INLocationStatus.qtyOnHand),
                        typeof(INLocationStatus.qtyAvail),
                        typeof(INLocationStatus.active),
                        typeof(INLocation.primaryItemID),
                        typeof(INLocation.primaryItemClassID),
                        typeof(INLocation.receiptsValid),
                        typeof(INLocation.salesValid),
                        typeof(INLocation.transfersValid),
                        typeof(INLocation.projectID),
                        typeof(INLocation.taskID)
                    });
                _Attributes[_SelAttrIndex] = newAttr;
                newAttr.ValidComboRequired = attr.ValidComboRequired;
                newAttr.CacheGlobal = attr.CacheGlobal;
                newAttr.DirtyRead = attr.DirtyRead;
                newAttr.DescriptionField = attr.DescriptionField;
            }
        }
    }
}

With the custom LocationAvailCstAttribute added on the INTran.LocationID field, Location selector will show only bins/locations, for which current Inventory Item Qty. Available is greater than 0: enter image description here