How to add custom field to Base LotserialNbr Selector ??
I am able to add custom field in Lot Serial Nbr Selector.But Display names are showing Tablename_FieldName or fieldnames instead of DAC display names...How to get DAC displaynames in this scenario??
In my custom screen I defind LotSerialNbr selector by Inheriting from INLotSerialNbrAttribute as
LotSerialNbr Selector in My custom screen:
--------------------------------------------------------------
/TSLotSerialNbrAttribute.TSAllocationLotSerialNbr(typeof(TSProdMTranSplit.inventoryID),
typeof(TSProdMTranSplit.subItemID), typeof(TSProdMTranSplit.siteID),
typeof(TSProdMTranSplit.locationID), typeof(TSProdMTranSplit.lotSerialNbr), FieldClass = "LotSerial")]
Inheriting from Base INLotSerialNbrAttribute
---------------------------------------------------------------
public class TSLotSerialNbrAttribute : INLotSerialNbrAttribute
{
private TSLotSerialNbrAttribute() { }
public TSLotSerialNbrAttribute(Type InventoryType, Type SubItemType, Type LocationType)
{
var itemType = BqlCommand.GetItemType(InventoryType);
if (!typeof(ILSMaster).IsAssignableFrom(itemType))
{
throw new PXArgumentException(PX.Objects.IN.Messages.TypeMustImplementInterface, itemType.GetLongName(), typeof(ILSMaster).GetLongName());
}
_InventoryType = InventoryType;
_SubItemType = SubItemType;
_LocationType = LocationType;
Type SearchType;
PXSelectorAttribute attr;
SearchType = BqlTemplate.OfCommand <Search2<INLotSerialStatus.lotSerialNbr,
LeftJoin<TSNewQCOrderSpecializedTest,
On<TSNewQCOrderSpecializedTest.inventoryID, Equal<INLotSerialStatus.inventoryID>,
And<TSNewQCOrderSpecializedTest.locationID, Equal<INLotSerialStatus.locationID>,
And<TSNewQCOrderSpecializedTest.lotNo, Equal<INLotSerialStatus.lotSerialNbr>>>>>,
Where<INLotSerialStatus.inventoryID, Equal<Current<TSProdMTranSplit.inventoryID>>,
And<INLotSerialStatus.siteID, Equal<Current<TSProdMTranSplit.siteID>>,
And<INLotSerialStatus.locationID, Equal<Current<TSProdMTranSplit.locationID>>>>>>>
.Replace<BqlPlaceholder.A>(InventoryType)
.Replace<BqlPlaceholder.B>(SubItemType)
.Replace<BqlPlaceholder.C>(LocationType).ToType();
attr = new PXSelectorAttribute(SearchType,
typeof(INLotSerialStatus.lotSerialNbr),
typeof(INLotSerialStatus.siteID),
typeof(INLotSerialStatus.qtyOnHand),
typeof(INSiteLotSerial.qtyAvail),
typeof(INLotSerialStatus.expireDate),
typeof(TSNewQCOrderSpecializedTest.qCOrderNbr),
typeof(TSNewQCOrderSpecializedTest.result));
_Attributes.Add(attr);
_SelAttrIndex = _Attributes.Count - 1;
}
public TSLotSerialNbrAttribute(Type InventoryType, Type SubItemType, Type LocationType, Type ParentLotSerialNbrType)
: this(InventoryType, SubItemType, LocationType)
{
_Attributes _DefAttrIndex] = new PXDefaultAttribute(ParentLotSerialNbrType) { PersistingCheck = PXPersistingCheck.NullOrBlank };
}
public override void GetSubscriber<ISubscriber>(List<ISubscriber> subscribers)
{
if (typeof(ISubscriber) == typeof(IPXFieldVerifyingSubscriber) || typeof(ISubscriber) == typeof(IPXFieldDefaultingSubscriber) || typeof(ISubscriber) == typeof(IPXRowPersistingSubscriber))
{
subscribers.Add(this as ISubscriber);
}
else if (typeof(ISubscriber) == typeof(IPXFieldSelectingSubscriber))
{
base.GetSubscriber<ISubscriber>(subscribers);
subscribers.Remove(this as ISubscriber);
subscribers.Add(this as ISubscriber);
subscribers.Reverse();
}
else
{
base.GetSubscriber<ISubscriber>(subscribers);
}
}
public class TSAllocationLotSerialNbrAttribute : TSLotSerialNbrAttribute
{
public TSAllocationLotSerialNbrAttribute(Type InventoryType, Type SubItemType, Type SiteType, Type LocationType)
{
var itemType = BqlCommand.GetItemType(InventoryType);
if (!typeof(ILSMaster).IsAssignableFrom(itemType))
{
throw new PXArgumentException(nameof(itemType), PX.Objects.IN.Messages.TypeMustImplementInterface, itemType.GetLongName(), typeof(ILSMaster).GetLongName());
}
_InventoryType = InventoryType;
_SubItemType = SubItemType;
_LocationType = LocationType;
Type SearchType;
PXSelectorAttribute attr;
SearchType = BqlTemplate.OfCommand < Search2 < INLotSerialStatus.lotSerialNbr,
LeftJoin<TSNewQCOrderSpecializedTest,
On<TSNewQCOrderSpecializedTest.inventoryID, Equal<INLotSerialStatus.inventoryID>,
And<TSNewQCOrderSpecializedTest.locationID, Equal<INLotSerialStatus.locationID>,
And<TSNewQCOrderSpecializedTest.lotNo, Equal<INLotSerialStatus.lotSerialNbr>>>>>,
Where<INLotSerialStatus.inventoryID, Equal<Current<TSProdMTranSplit.inventoryID>>,
And<INLotSerialStatus.siteID, Equal<Current<TSProdMTranSplit.siteID>>,
And<INLotSerialStatus.locationID, Equal<Current<TSProdMTranSplit.locationID>>>>>>>
.Replace<BqlPlaceholder.A>(InventoryType)
.Replace<BqlPlaceholder.B>(SubItemType)
.Replace<BqlPlaceholder.C>(LocationType).ToType();
attr = new PXSelectorAttribute(SearchType,
typeof(INLotSerialStatus.lotSerialNbr),
typeof(INLotSerialStatus.siteID),
typeof(INLotSerialStatus.qtyOnHand),
typeof(INSiteLotSerial.qtyAvail),
typeof(INLotSerialStatus.expireDate),
typeof(TSNewQCOrderSpecializedTest.qCOrderNbr),
typeof(TSNewQCOrderSpecializedTest.result));
_Attributes.Add(attr);
_SelAttrIndex = _Attributes.Count - 1;
}
public TSAllocationLotSerialNbrAttribute(Type InventoryType, Type SubItemType, Type SiteType, Type LocationType, Type ParentLotSerialNbrType)
: this(InventoryType, SubItemType, SiteType, LocationType)
{
_Attributes,_DefAttrIndex] = new PXDefaultAttribute(ParentLotSerialNbrType) { PersistingCheck = PXPersistingCheck.NullOrBlank };
}
}
}