Commit b8c73315 authored by ppatro's avatar ppatro

compare the quantity for allocation as descending order


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@93353 ce508802-f39f-4f6c-b175-0d175dae99d5
parent aca4be28
package ibase.webitm.utility.wms;
import java.util.HashMap;
import java.util.Comparator;
public class CompareAllocQty implements Comparator
{
public int compare(Object o1,Object o2)
{
HashMap map1 = (HashMap)o1;
HashMap map2 = (HashMap)o2;
String allocFlag1 = (String) map1.get("allocFlag");
String allocFlag2 = (String) map2.get("allocFlag");
double dataQty1 = Double.parseDouble(String.valueOf(map1.get("allocQty")));
if(dataQty1 <= 0 && "M".equalsIgnoreCase(allocFlag1))
{
dataQty1 = Double.parseDouble(String.valueOf(map1.get("mannual_alloc_qty")));
}
double dataQty2 = Double.parseDouble(String.valueOf(map2.get("allocQty")));
if(dataQty2 <= 0 && "M".equalsIgnoreCase(allocFlag2))
{
dataQty2 = Double.parseDouble(String.valueOf(map2.get("mannual_alloc_qty")));
}
if( dataQty1 > dataQty2)
{
return -1;
}
else if(dataQty1 < dataQty2)
{
return 1;
}
else
{
return 0;
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment