Here My requirement is to accept over delivery/under delivery percentage for new loads for purchase order line.
Example : I have purchase order line with Item A0001 and the quantity is 10.
I have over delivery and under delivery fields in Item level purchase tab. The values are 50%
and 50%.
now 50% of 10 is 5. I need to throw error if quanity is below 5 and above 15.
standard is throwing error for above 10 ,based on quantity of purchline.
Path :Product
Information Management >Products> Release products
Path: Warehouse management/Setup / Load / Load template
path : All purchase order > Warehouse tab> load planning workbench> to new load.
Class 1:
[ExtensionOf(classStr(whsLoadTemplateAssignmentForm))]
internal final class DaxWHSLoadTemplateAssignmentClass_Extension
{
public static WHSLoadTemplateId wHSLoadTemplateId;
public WHSLoadTemplateId parmWHSLoadTemplateId(WHSLoadTemplateId _WHSLoadTemplateId = wHSLoadTemplateId)
{
wHSLoadTemplateId = _WHSLoadTemplateId;
return wHSLoadTemplateId;
}
boolean whsLoadLineQty_validate(WHSLoadLine _whsLoadLine)
{
real Underquantity,Overquantity;
WHSLoadTemplate wHSLoadTemplate;
WHSLoadTable wHSLoadTable;
boolean ret;
ret=next whsLoadLineQty_validate(_whsLoadLine);
select wHSLoadTemplate
where wHSLoadTemplate.LoadTemplateId == wHSLoadTemplateId;
Underquantity = (_whsLoadLine.QtyLeftToStructure *_whsLoadLine.UnderDeliveryPct)/100;
if(wHSLoadTemplate.DaxAcceptUnderDelivery == NoYes::Yes)
{
if(_whsLoadLine.Qty < Underquantity)
{
ret = checkFailed("The load quantity is under the deliver quantity");
}
return ret;
}
else
{
return ret;
}
}
}
Class 2 :
[ExtensionOf(formStr(WHSLoadTemplateAssignment))]
internal final class DaxWHSLoadTemplateAssignment_Extension
{
void loadFieldData()
{
whsLoadTemplateAssignmentForm whsLoadTemplateAssignmentForm = new whsLoadTemplateAssignmentForm();
next loadFieldData();
whsLoadTemplateAssignmentForm.parmWHSLoadTemplateId(wHSLoadTable.loadTemplateId);
}
}
Class 3:
[ExtensionOf(tableStr(WHSLoadLine))]
internal final class DaxWHSLoadLine_Extension
{
public WHSQtyLeftToLoad qtyLeftToLoad()
{
whsLoadTemplateAssignmentForm whs = new whsLoadTemplateAssignmentForm();
WHSLoadTemplateId loadTemplateId;
WHSLoadLine wHSLoadLine = this;
WHSLoadTemplate wHSLoadTemplate;
InventHandlingQty qtyLeftToLoad;
real qty,Overquantity;
select wHSLoadTemplate
where wHSLoadTemplate.LoadTemplateId == whs.parmWHSLoadTemplateId();
qty = next qtyLeftToLoad();
if(wHSLoadTemplate.DaxAcceptOverDelivery == NoYes::Yes)
{
Overquantity = (wHSLoadLine.QtyLeftToStructure * wHSLoadLine.OverDeliveryPct)/100;
qtyLeftToLoad = qty + Overquantity;
return qtyLeftToLoad;
}
else
{
return qty;
}
}
}
No comments:
Post a Comment