Is there a way to extend the Set Qty state logic in Scan and Transfer screen? The class is sealed and not able to do so. I would like to define my own custom logic in certain cases.
Basically we are developing a putaway mechanism inside Scan and Transfer. I am defaulting an origin location for putaway using another button and then they are able to select destination location and the entire available qty should be defaulted. They also need to be able to change the defaulted qty using Set Qty and that is where the problem comes in. The qty just keeps appending to existing one.
I have tried combination of RowInserted and RowUpdating events to force the qty in case of putaway mode and nothing worked so far.
An example of what I have tried so far:
public class CFINScanTransferExt : PXGraphExtension<INScanTransfer,
INScanTransfer.Host>
{
public static bool IsActive() => true;
public INScanTransfer Basis => Base1;
protected virtual void _(Events.RowInserted<INTran> e)
{
var row = e.Row;
//var oldRow = e.Row;
if (row == null) return;
INLocationStatusByCostCenter locationStatusByCostCenter = SelectFrom<INLocationStatusByCostCenter>
.Where<INLocationStatusByCostCenter.siteID.IsEqual<@P.AsInt>
.And<INLocationStatusByCostCenter.locationID.IsEqual<@P.AsInt>
.And<INLocationStatusByCostCenter.inventoryID.IsEqual<@P.AsInt>>>>
.View.Select(Base, Basis.SiteID, Basis.LocationID, Basis.InventoryID);
if (locationStatusByCostCenter == null)
return;
if (Basis.Get<CFINScanTransferExt>().IsPutaway == true)
{
Basis.Qty = locationStatusByCostCenter.QtyAvail;
row.GetExtension<CFINTranExt>().UsrCFLayawayDefaultComplete = true;
}
}
protected virtual void _(Events.RowUpdating<INTran> e)
{
var row = e.NewRow;
if (row == null) return;
if (Basis.Get<CFINScanTransferExt>().IsPutaway == true && row.GetExtension<CFINTranExt>().UsrCFLayawayDefaultComplete != true)
{
row.Qty = Basis.Qty + 1;
}
}
}