Commit 37c59a5b authored by manohar's avatar manohar

Potency compensation in case after adjustment stock become sufficient


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@102118 ce508802-f39f-4f6c-b175-0d175dae99d5
parent a65bf027
......@@ -143,7 +143,7 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi
String database = commonConstantsObj.DB_NAME;
String campgnNoGlb = "",chgUser,termId = "",xtraParamsG = "";
DistCommon disCommon = new DistCommon();
DecimalFormat df = new DecimalFormat("#.###");
DecimalFormat df = new DecimalFormat("########0.000");
boolean isError = false,isReallocation = false;
......@@ -699,6 +699,7 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi
tempWorderObj.setSufficient("Y");
workOrderBeanList.set(count, tempWorderObj);
worderExpLevSufficient.put(tempWorderObj.getWorkOrder()+":"+tempWorderObj.getExpLev(), isSufficient);
updateWoBeanSufficient(tempWorderObj.getWorkOrder(), tempWorderObj.getExpLev(), "Y");
continue;
}
}
......@@ -937,6 +938,15 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi
worderExpLevSufficient.put(tempWorderObj.getWorkOrder()+":"+tempWorderObj.getExpLev(), isSufficient);
if (isSufficient)
{
updateWoBeanSufficient(tempWorderObj.getWorkOrder(), tempWorderObj.getExpLev(), "Y");
}
else
{
updateWoBeanSufficient(tempWorderObj.getWorkOrder(), tempWorderObj.getExpLev(), "N");
}
System.out.println("123worderExpLevSufficient@@--------------"+worderExpLevSufficient);
//set is Sufficient
......@@ -2166,7 +2176,7 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi
//tempWorderBeanList = workOrderBeanList;
//tempWorderStkBeanList = worderStkBeanList;
//int count = -1,indexAdjust = -1;
int foundIndex = -1;
int foundIndex = -1, tempIndex = -1;
boolean isSufficient = false;
double deallocQty = 0,allocatedQty = 0, extraQty = 0, potencyAdjLot = 0, quantityReqLot = 0;
Map<String,String> stockAllocMap = new HashMap<String,String>();
......@@ -2342,19 +2352,23 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi
potencyAdj = ( balance /stkPotencyPerc * ItemStdPotency) - balance;
potencyAdj = Double.parseDouble(df.format(potencyAdj));
System.out.println("After calculating potencyAdj SUFFICIENT----->>["+potencyAdj+"]");
System.out.println("After calculating potencyAdj SUFFICIENT before ----->>["+potencyAdj+"]");
worderStkBeanObj.setQtyAdj(Double.parseDouble(df.format(potencyAdj)));
System.out.println("After calculating potencyAdj SUFFICIENT after ----->>["+potencyAdj+"]");
//updQty = worderStkBeanObj.getAllocQty() + potencyAdj; // 03-jun-16 manoharan commented
updQty = balance + potencyAdj; // 03-jun-16 manoharan added
updQty = Double.parseDouble(df.format(updQty));
System.out.println("manohar before .setQuantity 4["+worderStkBeanObj.getQuantity()+"] .setPotencyAdj[" + worderStkBeanObj.getPotencyAdj() + "] .setQtyAdj[" + worderStkBeanObj.getQtyAdj() + "]" );
System.out.println("manohar before potencyAdj [" + potencyAdj + "] updQty [" + updQty + "] .setQuantity 4["+worderStkBeanObj.getQuantity()+"] .getAllocQty [" + worderStkBeanObj.getAllocQty()+ "].setPotencyAdj[" + worderStkBeanObj.getPotencyAdj() + "] .setQtyAdj[" + worderStkBeanObj.getQtyAdj() + "]" );
worderStkBeanObj.setQuantity(balance);
worderStkBeanObj.setQtyAdj(potencyAdj);
worderStkBeanObj.setPotencyAdj(potencyAdj);
if (availableStock >= updQty) // 03-jun-16 manoharan stock available in same lot
{
System.out.println("updQty - getAllocQty [" + Double.parseDouble(df.format((updQty - worderStkBeanObj.getAllocQty()))) + "]");
//stockAllocMap.put("ALLOC_QTY",""+potencyAdj); // 03-jun-16 manoharan commented
stockAllocMap.put("ALLOC_QTY",""+ (updQty - worderStkBeanObj.getAllocQty())); // 03-jun-16 manoharan added
stockAllocMap.put("ALLOC_QTY",""+ Double.parseDouble(df.format((updQty - worderStkBeanObj.getAllocQty())))); // 03-jun-16 manoharan added
stockAllocMap.put("LOC_CODE", worderStkBeanObj.getLocCode());
stockAllocMap.put("ITEM_CODE",worderStkBeanObj.getItemCode());
stockAllocMap.put("SITE_CODE",worderStkBeanObj.getSiteCode());
......@@ -2365,9 +2379,9 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi
worderStkBeanObj.setAllocQty(updQty); // 2 + 0.244 = 2.244
worderStkBeanObj.setUpdQty(updQty);
worderStkBeanObj.setStockSufficient("Y");
worderStkBeanObj.setQtyAdj(potencyAdj);//wasim on 13-04-2016
worderStkBeanObj.setPotencyAdj(potencyAdj);//wasim on 13-04-2016
System.out.println("manohar after .setQuantity 4["+worderStkBeanObj.getQuantity()+"] .setPotencyAdj[" + worderStkBeanObj.getPotencyAdj() + "] .setQtyAdj[" + worderStkBeanObj.getQtyAdj() + "]" );
worderExpLevSufficient.put(worderStkBeanObj.getWorkOrder()+":"+worderStkBeanObj.getExpLevel(), true);
updateWoBeanSufficient(worderStkBeanObj.getWorkOrder(), worderStkBeanObj.getExpLevel(), "Y");
System.out.println("manohar after potencyAdj [" + potencyAdj + "] updQty [" + updQty + "] .setQuantity 4["+worderStkBeanObj.getQuantity()+"] .getAllocQty [" + worderStkBeanObj.getAllocQty()+ "].setPotencyAdj[" + worderStkBeanObj.getPotencyAdj() + "] .setQtyAdj[" + worderStkBeanObj.getQtyAdj() + "]" );
worderStkBeanList.set(innerCtr, worderStkBeanObj);
if(potencyAdjMapY.containsKey(adjPotency) )
......@@ -2401,6 +2415,8 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi
worderStkBeanObj.setAllocQty(updQty);
worderStkBeanObj.setUpdQty(updQty);
worderStkBeanObj.setStockSufficient("N");
worderExpLevSufficient.put(worderStkBeanObj.getWorkOrder()+":"+worderStkBeanObj.getExpLevel(), false);
updateWoBeanSufficient(worderStkBeanObj.getWorkOrder(), worderStkBeanObj.getExpLevel(), "N");
worderStkBeanObj.setQtyAdj(potencyAdj);//wasim on 13-04-2016
worderStkBeanObj.setPotencyAdj(potencyAdj);//wasim on 13-04-2016
System.out.println("manohar after .setQuantity 4["+worderStkBeanObj.getQuantity()+"] .setPotencyAdj[" + worderStkBeanObj.getPotencyAdj() + "] .setQtyAdj[" + worderStkBeanObj.getQtyAdj() + "]" );
......@@ -2470,6 +2486,18 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi
balanceQty = Double.parseDouble(detailStkMap.get("BALANCE_QTY"));
errorCodeRet = detailStkMap.get("ERROR_CODE");
isSufficient = Boolean.parseBoolean(detailStkMap.get("IS_SUFFICIENT"));
if (isSufficient)
{
worderStkBeanObj.setStockSufficient("Y");
worderExpLevSufficient.put(worderStkBeanObj.getWorkOrder()+":"+worderStkBeanObj.getExpLevel(), true);
updateWoBeanSufficient(worderStkBeanObj.getWorkOrder(), worderStkBeanObj.getExpLevel(), "Y");
}
else
{
worderStkBeanObj.setStockSufficient("N");
worderExpLevSufficient.put(worderStkBeanObj.getWorkOrder()+":"+worderStkBeanObj.getExpLevel(), false);
updateWoBeanSufficient(worderStkBeanObj.getWorkOrder(), worderStkBeanObj.getExpLevel(), "N");
}
for(WorderStkBean tempStkObj : tempWorderExpStkBeanList)
{
......@@ -2641,12 +2669,34 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi
System.out.println("quantityReqExpLev---before ["+quantityReqExpLev+"]");
//AdjPotencyExplevQtyMap.put(adjPotencyChkN+":"+expLevelNew, quantityReqExpLev ); // 06-jun-16 manoharan reassign value as per actual allocation
//adjPotencyExpLevel.setValue(quantityReqExpLev); // 06-jun-16 manoharan reassign value as per actual allocation
// 23-jun-16 manoharan if critical item and stock allocated is not sufficient not to deduct
if (potencyAdjExpLev < 0)
{
// Extra allocation done to be deallocated
// 1. deallocate the extra quantity then proportionally recalculate potencyAdj and update
isSufficient = worderExpLevSufficient.get(workOrderPotency+":"+expLevelNew);
System.out.println("23-jun-16 manoharan check sufficient to deallocate workOrderPotency ["+workOrderPotency+"] expLevelNew [" + expLevelNew + "] isSufficient [" + isSufficient + "]");
//int tempIndex = indexOfWorkorderBeanList(workOrderPotency, expLevelNew);
//worderDetailBeanObj = (WorkOrderDetailBean) workOrderBeanList.get(tempIndex);
if (isSufficient)
{
extraQty = adjPotencyExpLevel.getValue() - quantityReqExpLev;
extraQty = Double.parseDouble(df.format(extraQty));
}
else
{
allocatedQty = getAllocatedForExplev(workOrderPotency, expLevelNew);
if (quantityReqExpLev <= allocatedQty)
{
extraQty = allocatedQty - quantityReqExpLev;
extraQty = Double.parseDouble(df.format(extraQty));
}
}
System.out.println("allocated stock check sufficient after potency adjustment [" + workOrderPotency+ "] expLevelNew [" + expLevelNew+"] extraQty [" + extraQty+ "]");
if (extraQty > 0)
{
// Extra allocation done to be deallocated
// 1. deallocate the extra quantity then proportionally recalculate potencyAdj and update
int stockListSize = worderStkBeanList.size() -1;
......@@ -2735,6 +2785,14 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi
}
}
else
{
System.out.println("allocated stock is sufficient after potency adjustment [" + workOrderPotency+ "] expLevelNew [" + expLevelNew+"]");
worderExpLevSufficient.put(workOrderPotency+":"+expLevelNew, true);
updateWoBeanSufficient(workOrderPotency, expLevelNew, "Y");
}
}
else
{
// additional stock to be allocated
// 1. Allocate additional stock to the extend of potencyAdj
......@@ -2789,7 +2847,18 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi
balanceQty = Double.parseDouble(detailStkMap.get("BALANCE_QTY"));
errorCodeRet = detailStkMap.get("ERROR_CODE");
isSufficient = Boolean.parseBoolean(detailStkMap.get("IS_SUFFICIENT"));
if(isSufficient)
{
//worderStkBeanObj.setStockSufficient("N");
worderExpLevSufficient.put(worderDetailBeanObj.getWorkOrder()+":"+worderDetailBeanObj.getExpLev(), true);
updateWoBeanSufficient(worderDetailBeanObj.getWorkOrder(), worderDetailBeanObj.getExpLev(), "Y");
}
else
{
//worderStkBeanObj.setStockSufficient("N");
worderExpLevSufficient.put(worderDetailBeanObj.getWorkOrder()+":"+worderDetailBeanObj.getExpLev(), false);
updateWoBeanSufficient(worderDetailBeanObj.getWorkOrder(), worderDetailBeanObj.getExpLev(), "N");
}
for(WorderStkBean tempStkObj : tempWorderExpStkBeanList)
{
worderStkBeanListTemp.add(tempStkObj);
......@@ -2876,7 +2945,24 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi
return "";
}
private double getAllocatedForExplev(String workOrderPotency, String expLevelNew) throws ITMException, Exception
{
WorderStkBean worderStkBeanObj = null;
double allocatedQtyExpLev = 0,allocatedQty = 0;
for(int counter=0 ; counter < worderStkBeanList.size(); counter++)
{
worderStkBeanObj = (WorderStkBean) worderStkBeanList.get(counter);
if(workOrderPotency.trim().equalsIgnoreCase(worderStkBeanObj.getWorkOrder().trim()) && expLevelNew.trim().equalsIgnoreCase(worderStkBeanObj.getExpLevel().trim()))
{
allocatedQty = worderStkBeanObj.getAllocQty();
allocatedQtyExpLev += allocatedQty;
}
}
return allocatedQtyExpLev;
}
private String getSqlInString(String suppCodeMfg) throws ITMException, Exception
{
String inSql = "";
......@@ -6526,11 +6612,10 @@ public String populateWorkOrderBill(Connection conn) throws Exception
firmPlanXMl.append( "<adjusted_qty><![CDATA[" ).append(Double.parseDouble(df.format(tempDetailObj.getAdjustedQty())) ).append( "]]></adjusted_qty>\r\n" );
firmPlanXMl.append( "<is_sufficient><![CDATA[" ).append( tempDetailObj.getSufficient() ).append( "]]></is_sufficient>\r\n" );
//firmPlanXMl.append( "</exp_level>\r\n");
stockAllocated = false;
for(WorderStkBean tempObj : worderStkBeanList)
{
isReserve = false;isStkDetail = false; // 07-jun-16 manoharan initialise for each stock item
stockAllocated = false;
if(workOrder.equalsIgnoreCase(tempObj.getWorkOrder()) && expLev.equalsIgnoreCase(tempObj.getExpLevel()) )
{
stockAllocated = true;
......@@ -6695,6 +6780,17 @@ public String populateWorkOrderBill(Connection conn) throws Exception
}
}
//if( isReserve)
//{
//reserveStockXMl.append("</reserve_stock> \r\n");
//}
//if( isStkDetail)
//{
// stockDetailXml.append("</stock_detail> \r\n");
//}
//if(!isReserve)
//if(! isStkDetail)
} /// for(WorderStkBean tempObj : worderStkBeanList)
if (!stockAllocated)
{
reserveStockXMl.append("<reserve_stock> \r\n");
......@@ -6742,17 +6838,6 @@ public String populateWorkOrderBill(Connection conn) throws Exception
stockDetailXml.append("</detail>");
stockDetailXml.append("</stock_detail> \r\n");
}
//if( isReserve)
//{
//reserveStockXMl.append("</reserve_stock> \r\n");
//}
//if( isStkDetail)
//{
// stockDetailXml.append("</stock_detail> \r\n");
//}
//if(!isReserve)
//if(! isStkDetail)
} /// for(WorderStkBean tempObj : worderStkBeanList)
firmPlanXMl.append(reserveStockXMl.append(stockDetailXml));
firmPlanXMl.append( "</exp_level>\r\n");
}
......
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