Hi All,
I hope everyone is doing great and learning new things.
Here I am coming with a new blog to understand and guide everyone to learn the customization in Warehouse Management application. As you can see in the screenshot below, We have received by purchase order form on this form we will scan the QR string and auto populate the remaining field values.
This is the example of QR string format: "PoNum,ItemId,Quantity,date"
This is the example of QR string format: "PoNum,ItemId,Quantity,date"
In my example child class WHSWorkExecuteDisplayPOReceiving so I have created an extension class for it and added COC for displayForm() method.
[ExtensionOf(classStr(WHSWorkExecuteDisplayPOReceiving))]
final class WHSWorkExecuteDisplayPOReceiving_ModelTest_Extension
{
}
All the controls on the form and its values are assigned through the container of display form method parameter(_con). so, to assign our values we need modify the same container.
below logic will take scanned value of QR code from PONum field then convert it to the container.
// COC of display form method in extension class.
public container displayForm(container _con, str _buttonClicked)
{
if( mode == WHSWorkExecuteMode::PurchaseOrderItemReceivingAndLocate &&
step == 1)
{
container returnedCon, qrValueContainer;
PurchId purchId;
ItemId itemId;
str quantityStr;
const str fullQRValueConstText = "FullQRValue";
#WHSWorkExecuteControlElements
#WHSRF
str fullQRValue = this.getControlDataFromContainer(_con,#PONum);
qrValueContainer = str2con(fullQRValue,'@');
if(conLen(qrValueContainer) > 1)
{
pass.insert(fullQRValueConstText, fullQRValue);
purchId = conPeek(qrValueContainer,1);
quantityStr = conPeek(qrValueContainer,2);
itemId = conPeek(qrValueContainer,3);
_con = this.setControlDataFromContainer(_con, #PONum, purchId);
stepLocal = step;
}
returnedCon = next displayForm(_con, _buttonClicked);
if( mode == WHSWorkExecuteMode::PurchaseOrderItemReceivingAndLocate)
{
// you can add logic here when to replace.
if(stepLocal == 1 && pass.lookup(#PONum) != '')
{
returnedCon this.setControlDataFromContainer(returnedCon, #Qty, strRem(quantityStr,'Q'));
returnedCon = this.setControlDataFromContainer(returnedCon, #ItemId, itemId);
}
}
}
return returnedCon;
}
That's It. Happy Coding.
Please comment if you have faced any challenge to implement this.
Please comment if you have faced any challenge to implement this.
No comments:
Post a Comment