Commit 88130e4b authored by manohar's avatar manohar

Potency calculation changes and inv_alloc_det, workorder_bill update changes


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@101766 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 5bb49b08
...@@ -80,6 +80,8 @@ import java.util.HashMap; ...@@ -80,6 +80,8 @@ import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
import java.util.Iterator; import java.util.Iterator;
import java.util.ListIterator; import java.util.ListIterator;
import java.util.Collections;
import java.util.Comparator;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
import java.util.logging.FileHandler; import java.util.logging.FileHandler;
...@@ -143,6 +145,12 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi ...@@ -143,6 +145,12 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi
DistCommon disCommon = new DistCommon(); DistCommon disCommon = new DistCommon();
DecimalFormat df = new DecimalFormat("#.###"); DecimalFormat df = new DecimalFormat("#.###");
boolean isError = false,isReallocation = false; boolean isError = false,isReallocation = false;
Map<String,Double>potencyAdjMapY = null;
Map<String,Double>potencyAdjMapN = null;
Map<String,Double> AdjPotencyExplevQtyMap = null;
public String process() throws RemoteException,ITMException public String process() throws RemoteException,ITMException
{ {
return ""; return "";
...@@ -323,7 +331,15 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi ...@@ -323,7 +331,15 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi
{*/ {*/
//stock sufficient //stock sufficient
System.out.println("worderStkBeanList size 3="+worderStkBeanList.size()); System.out.println("worderStkBeanList size 3="+worderStkBeanList.size());
// 31-may-16 manoharan sort on work_order,exp_lev,exp_date
Collections.sort(worderStkBeanList, WorderStkBean.WoStkBeanComparator);
// end 31-may-16 manoharan sort on work_order,exp_lev,exp_date
potencyRetStr = checkStockPotencyNew(conn); potencyRetStr = checkStockPotencyNew(conn);
// 31-may-16 manoharan sort on work_order,exp_lev,exp_date
Collections.sort(worderStkBeanList, WorderStkBean.WoStkBeanComparator);
// end 31-may-16 manoharan sort on work_order,exp_lev,exp_date
System.out.println("After checkStockPotency :["+potencyRetStr+"]"); System.out.println("After checkStockPotency :["+potencyRetStr+"]");
System.out.println("worderStkBeanList size 4="+worderStkBeanList.size()); System.out.println("worderStkBeanList size 4="+worderStkBeanList.size());
//displayStkBean(workOrderBeanList, "H"); //displayStkBean(workOrderBeanList, "H");
...@@ -348,18 +364,12 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi ...@@ -348,18 +364,12 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi
errString = createDistSaleOrder(conn); errString = createDistSaleOrder(conn);
//CreateDistSorderAllocation //CreateDistSorderAllocation
//according to transType create dist. or sale order //according to transType create dist. or sale order
errString = generateXml(conn); errString = generateXml(conn);
} }
/*if(errString !=null && errString.indexOf("Error") > -1) /*if(errString !=null && errString.indexOf("Error") > -1)
{ {
return errString; return errString;
}*/ }*/
/*} /*}
else else
{ {
...@@ -582,6 +592,7 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi ...@@ -582,6 +592,7 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi
tempWorderObj.setSufficient("Y"); tempWorderObj.setSufficient("Y");
workOrderBeanList.set(count, tempWorderObj); workOrderBeanList.set(count, tempWorderObj);
worderExpLevSufficient.put(tempWorderObj.getWorkOrder()+":"+tempWorderObj.getExpLev(), isSufficient); worderExpLevSufficient.put(tempWorderObj.getWorkOrder()+":"+tempWorderObj.getExpLev(), isSufficient);
updateWoBeanSufficient(tempWorderObj.getWorkOrder(), tempWorderObj.getExpLev(), "Y");
continue; continue;
} }
detailMap.put("BALANCE_QTY", String.valueOf(balanceQty) ); detailMap.put("BALANCE_QTY", String.valueOf(balanceQty) );
...@@ -650,6 +661,7 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi ...@@ -650,6 +661,7 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi
tempWorderObj.setSufficient("Y"); tempWorderObj.setSufficient("Y");
workOrderBeanList.set(count, tempWorderObj); workOrderBeanList.set(count, tempWorderObj);
worderExpLevSufficient.put(tempWorderObj.getWorkOrder()+":"+tempWorderObj.getExpLev(), isSufficient); worderExpLevSufficient.put(tempWorderObj.getWorkOrder()+":"+tempWorderObj.getExpLev(), isSufficient);
updateWoBeanSufficient(tempWorderObj.getWorkOrder(), tempWorderObj.getExpLev(), "Y");
continue; continue;
} }
...@@ -1049,6 +1061,17 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi ...@@ -1049,6 +1061,17 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi
worderDetailBeanObj.setExpLev(expLev); worderDetailBeanObj.setExpLev(expLev);
worderDetailBeanObj.setOperation(operationInt); worderDetailBeanObj.setOperation(operationInt);
worderDetailBeanObj.setCritItem(critItem); worderDetailBeanObj.setCritItem(critItem);
// 06-jun-16 manoharan add sufficient flag in list
if ("Y".equals(critItem))
{
isSufficient = false;
}
else
{
isSufficient = true;
}
worderExpLevSufficient.put(worderDetailBeanObj.getWorkOrder()+":"+worderDetailBeanObj.getExpLev(), isSufficient);
// end 06-jun-16 manoharan add sufficient flag in list
worderDetailBeanObj.setSuppCodeMfg(suppCodeMfg); worderDetailBeanObj.setSuppCodeMfg(suppCodeMfg);
worderDetailBeanObj.setUseInvStatus(useInvStatus); worderDetailBeanObj.setUseInvStatus(useInvStatus);
...@@ -1139,10 +1162,10 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi ...@@ -1139,10 +1162,10 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi
int count = 0; int count = 0;
boolean isMatchPotency = false,isCompareDimension = false,isSufficient = false; boolean isMatchPotency = false,isCompareDimension = false,isSufficient = false;
double trimWidth = 0,requiredQty = 0,softAllocQty = 0,balanceQty = 0,shortageQty = 0; double trimWidth = 0,requiredQty = 0,softAllocQty = 0,balanceQty = 0,shortageQty = 0, currntEqualQty = 0;
String locCode = "",lotNo = "",lotSl = "",unit = "",siteCodeMfg = "",itemSer = "",packCode = "",expDate = "",alternateItem = "", String locCode = "",lotNo = "",lotSl = "",unit = "",siteCodeMfg = "",itemSer = "",packCode = "",expDate = "",alternateItem = "",
mfgDate= "",stkKey = "",otherSite = "",errorCode = "",issCriteria = "",controlledYn = "",matchPotency = ""; mfgDate= "",stkKey = "",otherSite = "",errorCode = "",issCriteria = "",controlledYn = "",matchPotency = "",adjPotency = "";
double stkQuantity = 0,stkPotencyPerc = 0,allocQty = 0,minPotencyPerc = 0; double stkQuantity = 0,stkPotencyPerc = 0,allocQty = 0,minPotencyPerc = 0, qtyPotencyUnit = 0, potencyAdj = 0, updQty = 0;
double minQtyReq = 0; //Changed by wasim on 29-02-2016 double minQtyReq = 0; //Changed by wasim on 29-02-2016
java.sql.Timestamp expDateT = null,mfgDateT= null; java.sql.Timestamp expDateT = null,mfgDateT= null;
Map<String,String> returnMapDetails = new HashMap<String,String>(); Map<String,String> returnMapDetails = new HashMap<String,String>();
...@@ -1151,13 +1174,12 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi ...@@ -1151,13 +1174,12 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi
WorderStkBean worderStkBeanObj = null; WorderStkBean worderStkBeanObj = null;
int count1 = 0; int count1 = 0;
int stkindex = -1; int stkindex = -1;
double finalAllocatedQty = 0; double finalAllocatedQty = 0, ItemStdPotency = 100, qtyPerArt = 0,finalAllocQty = 0;;
try try
{ {
Calendar currentDate = Calendar.getInstance(); Calendar currentDate = Calendar.getInstance();
SimpleDateFormat sdf = new SimpleDateFormat(genericUtility.getApplDateFormat()); SimpleDateFormat sdf = new SimpleDateFormat(genericUtility.getApplDateFormat());
String currDate = sdf.format(currentDate.getTime()); String currDate = sdf.format(currentDate.getTime());
System.out.println("isReallocationFlag="+isReallocation); System.out.println("isReallocationFlag="+isReallocation);
otherSite = detailMap.get("OTHER_SITE"); otherSite = detailMap.get("OTHER_SITE");
if("Y".equals(otherSite)) if("Y".equals(otherSite))
...@@ -1177,6 +1199,8 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi ...@@ -1177,6 +1199,8 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi
controlledYn = detailMap.get("CONTROLLED_YN"); controlledYn = detailMap.get("CONTROLLED_YN");
minPotencyPerc = Double.parseDouble(detailMap.get("MIN_POTENCY_PERC")); minPotencyPerc = Double.parseDouble(detailMap.get("MIN_POTENCY_PERC"));
matchPotency = detailMap.get("MATCH_POTENCY"); matchPotency = detailMap.get("MATCH_POTENCY");
adjPotency = detailMap.get("ADJ_POTENCY");
alternateItem = detailMap.get("IS_ALTERNATE"); alternateItem = detailMap.get("IS_ALTERNATE");
System.out.println("IS_ALTERNATE : "+alternateItem); System.out.println("IS_ALTERNATE : "+alternateItem);
System.out.println("CONSIDER_PARTIAL_ALT : "+considerPartialAlt); System.out.println("CONSIDER_PARTIAL_ALT : "+considerPartialAlt);
...@@ -1198,6 +1222,8 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi ...@@ -1198,6 +1222,8 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
// 31-may-16 manoharan
ItemStdPotency = getItemStandardPotency(detailMap.get("ITEM_CODE"), conn);
dimension = checkNull(detailMap.get("DIMENSION")); dimension = checkNull(detailMap.get("DIMENSION"));
detailMap.put("QC_REQD", qcReqd); detailMap.put("QC_REQD", qcReqd);
...@@ -1242,7 +1268,7 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi ...@@ -1242,7 +1268,7 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
System.out.println("Balance Quantity="+detailMap.get("BALANCE_QTY")); System.out.println("in checkCurrentSiteStock detailMap["+detailMap +"]");
shortageQty = Double.parseDouble(detailMap.get("BALANCE_QTY")); shortageQty = Double.parseDouble(detailMap.get("BALANCE_QTY"));
System.out.println("shortageQty......................"+shortageQty); System.out.println("shortageQty......................"+shortageQty);
...@@ -1254,17 +1280,29 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi ...@@ -1254,17 +1280,29 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi
{ {
requiredQty = Double.parseDouble(detailMap.get("QUANTITY")); requiredQty = Double.parseDouble(detailMap.get("QUANTITY"));
} }
//if(isReallocation)
//{
balanceQty = requiredQty;
//}
//Excecute stock sql and set in WorderStkBean object //Excecute stock sql and set in WorderStkBean object
//for detailsum S = check sum of stock, I - used for check same manufactured,D - //for detailsum S = check sum of stock, I - used for check same manufactured,D -
sqlString = getBuildedWoIssueSql(detailMap, conn); sqlString = getBuildedWoIssueSql(detailMap, conn);
pstmt = conn.prepareStatement(sqlString); pstmt = conn.prepareStatement(sqlString);
System.out.println("in checkCurrentSiteStock getBuildedWoIssueSql balanceQty [" + balanceQty + "] For item code ["+detailMap.get("ITEM_CODE") + "] sqlString ["+sqlString+"]");
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
while(rs.next()) while(rs.next())
{ {
updQty = 0;
count1++; count1++;
System.out.println("getBuildedWoIssueSql cnt-------->>"+count1+"For item code+"+detailMap.get("ITEM_CODE")); System.out.println("in checkCurrentSiteStock inside while loop count1 ["+count1+"] balanceQty [" + balanceQty + "] For item code ["+detailMap.get("ITEM_CODE") + "]");
//if(isReallocation && balanceQty <= 0)
if(balanceQty <= 0)
{
break;
}
locCode = checkNull(rs.getString("LOC_CODE")); locCode = checkNull(rs.getString("LOC_CODE"));
lotNo = checkNull(rs.getString("LOT_NO")); lotNo = checkNull(rs.getString("LOT_NO"));
lotSl = checkNull(rs.getString("LOT_SL")); lotSl = checkNull(rs.getString("LOT_SL"));
...@@ -1375,8 +1413,6 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi ...@@ -1375,8 +1413,6 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi
System.out.println("stkPotencyPerc------>>["+stkPotencyPerc+"]"); System.out.println("stkPotencyPerc------>>["+stkPotencyPerc+"]");
System.out.println("minPotencyPerc------>>["+minPotencyPerc+"]"); System.out.println("minPotencyPerc------>>["+minPotencyPerc+"]");
stkindex = -1; stkindex = -1;
if(stkPotencyPerc >= minPotencyPerc)
{
if(!isReallocation) if(!isReallocation)
{ {
stkindex = indexOfWorkorderStkList(detailMap.get("WORK_ORDER"),detailMap.get("EXP_LEV"),detailMap.get("ITEM_CODE"), stkindex = indexOfWorkorderStkList(detailMap.get("WORK_ORDER"),detailMap.get("EXP_LEV"),detailMap.get("ITEM_CODE"),
...@@ -1418,14 +1454,256 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi ...@@ -1418,14 +1454,256 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi
worderStkBeanObj.setIsStockDetail("Y"); worderStkBeanObj.setIsStockDetail("Y");
worderStkBeanObj.setMinQtyReq(minQtyReq); worderStkBeanObj.setMinQtyReq(minQtyReq);
} }
if(isReallocation)
{
if(("Y".equals(matchPotency) && stkPotencyPerc >= minPotencyPerc) || "N".equals(matchPotency))
{
// 31-may-16 manoharan if matchpotency = Y calculate the same
/////////////////////////////////////////////////////////////////////////////////////
if("Y".equals(matchPotency))
{
if(stkQuantity < balanceQty)
{
System.out.println("@@Not Sufficient-->currentLotQty ["+stkQuantity+"] stkPotencyPerc ["+stkPotencyPerc+"] ItemStdPotency ["+ItemStdPotency+"]");
potencyAdj = stkQuantity - (stkQuantity * stkPotencyPerc / ItemStdPotency);
potencyAdj = Double.parseDouble(df.format(potencyAdj));//0.200
System.out.println("In recalculation After calculating potencyAdj NOT SUFFICIENT----->>["+potencyAdj+"]");
currntEqualQty = Double.parseDouble(df.format(stkQuantity - potencyAdj)) ; //4-0.2 = 3.8
balanceQty = Double.parseDouble(df.format(balanceQty - currntEqualQty)); //6-3.8 = 2.2
balanceQty = Double.parseDouble(df.format(balanceQty));
updQty = stkQuantity;
System.out.println("manohar@@NotSufficient--> before .getExpLevel [" + worderStkBeanObj.getExpLevel() +"] .setQuantity ["+worderStkBeanObj.getQuantity()+"] .setAllocQty [" + worderStkBeanObj.getAllocQty() + "] .setUpdQty [" + worderStkBeanObj.getUpdQty() + "] .setPotencyAdj( [" +worderStkBeanObj.getPotencyAdj() + "] .setQtyAdj(" + worderStkBeanObj.getQtyAdj() + "]" );
worderStkBeanObj.setPotencyAdj(Double.parseDouble(df.format(potencyAdj)));
worderStkBeanObj.setQtyAdj(Double.parseDouble(df.format(potencyAdj)));
worderStkBeanObj.setQuantity(currntEqualQty);
worderStkBeanObj.setAllocQty(stkQuantity); // 09-mar-16 manoharan added if stock not sufficient full stock of the lot is allocated
worderStkBeanObj.setUpdQty(stkQuantity);
System.out.println("manohar@@NotSufficient--> after .getExpLevel [" + worderStkBeanObj.getExpLevel() +"] .setQuantity ["+worderStkBeanObj.getQuantity()+"] .setAllocQty [" + worderStkBeanObj.getAllocQty() + "] .setUpdQty [" + worderStkBeanObj.getUpdQty() + "] .setPotencyAdj( [" +worderStkBeanObj.getPotencyAdj() + "] .setQtyAdj(" + worderStkBeanObj.getQtyAdj() + "]" );
double qtyPerArt = 0,finalAllocQty = 0; if(potencyAdjMapY.containsKey(adjPotency) )
{
potencyAdjMapY.put(adjPotency, (potencyAdjMapY.get(adjPotency) + potencyAdj ));
}
else
{
potencyAdjMapY.put(adjPotency, potencyAdj );
}
isSufficient = false;
}
else // if stock sufficient
{
System.out.println("@@Sufficient--> balanceQty["+balanceQty+"] stkQuantity [" + stkQuantity + "] stkPotencyPerc ["+stkPotencyPerc+"] ItemStdPotency ["+ItemStdPotency+"]");
potencyAdj = ( balanceQty /stkPotencyPerc * ItemStdPotency) - balanceQty;
potencyAdj = Double.parseDouble(df.format(potencyAdj));
System.out.println("After re-calculating potencyAdj SUFFICIENT----->>["+potencyAdj+"]");//0.244
System.out.println("manohar before .setQuantity 110["+worderStkBeanObj.getQuantity()+"] .getPotencyAdj[" + worderStkBeanObj.getPotencyAdj() + "] .getAllocQty[" + worderStkBeanObj.getAllocQty() + "] .getUpdQty[" + worderStkBeanObj.getUpdQty() +"]");
worderStkBeanObj.setQtyAdj(Double.parseDouble(df.format(potencyAdj)));
worderStkBeanObj.setAllocQty(balanceQty);
updQty = Double.parseDouble(df.format(balanceQty));
System.out.println("manohar@@Sufficient--> before .getExpLevel [" + worderStkBeanObj.getExpLevel() +"] .setQuantity ["+worderStkBeanObj.getQuantity()+"] .setAllocQty [" + worderStkBeanObj.getAllocQty() + "] .setUpdQty [" + worderStkBeanObj.getUpdQty() + "] .setPotencyAdj( [" +worderStkBeanObj.getPotencyAdj() + "] .setQtyAdj(" + worderStkBeanObj.getQtyAdj() + "]" );
worderStkBeanObj.setQuantity(Double.parseDouble(df.format(balanceQty - potencyAdj)) );
System.out.println("manohar after .setQuantity 7["+worderStkBeanObj.getQuantity()+"]");
worderStkBeanObj.setAllocQty(updQty);
worderStkBeanObj.setUpdQty(updQty);
worderStkBeanObj.setStockSufficient("Y");
worderStkBeanObj.setQtyAdj(potencyAdj);
worderStkBeanObj.setPotencyAdj(potencyAdj);
System.out.println("manohar after .setQuantity 110["+worderStkBeanObj.getQuantity()+"] .getPotencyAdj[" + worderStkBeanObj.getPotencyAdj() + "] .getAllocQty[" + worderStkBeanObj.getAllocQty() + "] .getUpdQty[" + worderStkBeanObj.getUpdQty() +"]");
System.out.println("manohar@@Sufficient--> after .getExpLevel [" + worderStkBeanObj.getExpLevel() +"] .setQuantity ["+worderStkBeanObj.getQuantity()+"] .setAllocQty [" + worderStkBeanObj.getAllocQty() + "] .setUpdQty [" + worderStkBeanObj.getUpdQty() + "] .setPotencyAdj( [" +worderStkBeanObj.getPotencyAdj() + "] .setQtyAdj(" + worderStkBeanObj.getQtyAdj() + "]" );
if(potencyAdjMapY.containsKey(adjPotency) )
{
potencyAdjMapY.put(adjPotency, Double.parseDouble(df.format((potencyAdjMapY.get(adjPotency) + potencyAdj ))) );
}
else
{
potencyAdjMapY.put(adjPotency, potencyAdj );
}
balanceQty = 0;
isSufficient = true;
// 02-jun-16 manoharan
worderExpLevSufficient.put(worderStkBeanObj.getWorkOrder()+":"+worderStkBeanObj.getExpLevel(), isSufficient);
updateWoBeanSufficient(worderStkBeanObj.getWorkOrder(), worderStkBeanObj.getExpLevel(), "Y");
}
}
else if(adjPotency != null && adjPotency.trim().length() > 0)
{
System.out.println("Potency to be adjusted x [" + adjPotency + "]");
//unitPotency = getColumnDescr(conn, "unit__potency", "bom", "bom_code", worderDetailBeanObj.getBomCode());
qtyPotencyUnit = 0;
if(stkQuantity < balanceQty)
{
updQty = stkQuantity;
balanceQty = Double.parseDouble(df.format( balanceQty - stkQuantity)) ;
isSufficient = false;
}
else
{
updQty = balanceQty;
balanceQty = 0;
isSufficient = true;
// 02-jun-16 manoharan
worderExpLevSufficient.put(worderStkBeanObj.getWorkOrder()+":"+worderStkBeanObj.getExpLevel(), isSufficient);
updateWoBeanSufficient(worderStkBeanObj.getWorkOrder(), worderStkBeanObj.getExpLevel(), "Y");
}
System.out.println("manohar before .setQuantity 111["+worderStkBeanObj.getQuantity()+"] .getPotencyAdj[" + worderStkBeanObj.getPotencyAdj() + "] .getAllocQty[" + worderStkBeanObj.getAllocQty() + "] .getUpdQty[" + worderStkBeanObj.getUpdQty() +"]");
worderStkBeanObj.setQuantity(updQty);
worderStkBeanObj.setAllocQty(updQty);
worderStkBeanObj.setUpdQty(updQty);
System.out.println("manohar after .setQuantity 111["+worderStkBeanObj.getQuantity()+"] .getPotencyAdj[" + worderStkBeanObj.getPotencyAdj() + "] .getAllocQty[" + worderStkBeanObj.getAllocQty() + "] .getUpdQty[" + worderStkBeanObj.getUpdQty() +"]");
//if (!worderStkBeanObj.getUnit().trim().equals(unitPotency.trim())) // 09-mar-16 manoharan check unit are same, if so no conversion required
//{
// qtyPotencyUnit = disCommon.convQtyFactor(worderStkBeanObj.getUnit(), unitPotency, worderStkBeanObj.getItemCode(), requiredStock, conn);
//}
//else
//{
qtyPotencyUnit = balanceQty;
//}
qtyPotencyUnit = Double.parseDouble(df.format(qtyPotencyUnit));
System.out.println("manohar qtyPotencyUnit before[" + qtyPotencyUnit + "] .getAllocQty() [" + worderStkBeanObj.getAllocQty() + "]");
System.out.println("Stk qty After--->>["+worderStkBeanObj.getStkQuantity()+"]");
// 19-May-16 manoharan if there are multiple for same exp_lev then add
//AdjPotencyExplevQtyMap.put(adjPotency+":"+expLevel, requiredStock);
System.out.println("AdjPotencyExplevQtyMap before ["+AdjPotencyExplevQtyMap + "]");
System.out.println("manohar qtyPotencyUnit after[" + qtyPotencyUnit + "] potencyAdjMapN before [" + potencyAdjMapN + "]");
if(!AdjPotencyExplevQtyMap.containsKey(adjPotency+":"+expLevel))
{
AdjPotencyExplevQtyMap.put(adjPotency+":"+expLevel, qtyPotencyUnit );
if(potencyAdjMapN.containsKey(adjPotency))
{
potencyAdjMapN.put(adjPotency, Double.parseDouble(df.format((potencyAdjMapN.get(adjPotency) + qtyPotencyUnit ))));
}
else
{
potencyAdjMapN.put(adjPotency, qtyPotencyUnit );
}
}
System.out.println("AdjPotencyExplevQtyMap after [ "+AdjPotencyExplevQtyMap + "]");
System.out.println("manohar qtyPotencyUnit after[" + qtyPotencyUnit + "] potencyAdjMapN after [" + potencyAdjMapN + "]");
// end 19-May-16 manoharan if there are multiple for same exp_lev then add
//qtyPotencyUnit = qtyPotencyUnit + worderStkBeanObj.getAllocQty();
}
else
{
if(stkQuantity < balanceQty)
{
updQty = stkQuantity;
balanceQty = Double.parseDouble(df.format( balanceQty - stkQuantity));
isSufficient = false;
}
else
{
updQty = balanceQty;
balanceQty = 0;
isSufficient = true;
// 02-jun-16 manoharan
worderExpLevSufficient.put(worderStkBeanObj.getWorkOrder()+":"+worderStkBeanObj.getExpLevel(), isSufficient);
updateWoBeanSufficient(worderStkBeanObj.getWorkOrder(), worderStkBeanObj.getExpLevel(), "Y");
}
System.out.println("manohar before .setQuantity 114["+worderStkBeanObj.getQuantity()+"] .getPotencyAdj[" + worderStkBeanObj.getPotencyAdj() + "] .getAllocQty[" + worderStkBeanObj.getAllocQty() + "] .getUpdQty[" + worderStkBeanObj.getUpdQty() +"]");
worderStkBeanObj.setQuantity(updQty);
worderStkBeanObj.setAllocQty(updQty);
worderStkBeanObj.setUpdQty(updQty);
System.out.println("manohar after .setQuantity 114["+worderStkBeanObj.getQuantity()+"] .getPotencyAdj[" + worderStkBeanObj.getPotencyAdj() + "] .getAllocQty[" + worderStkBeanObj.getAllocQty() + "] .getUpdQty[" + worderStkBeanObj.getUpdQty() +"]");
}
/////////////////////////////////////////////////////////////////////////////////////
}
else
{
System.out.println("stkPotencyPerc is less than minimum potency please check........");
}
}
else
{
if(stkQuantity < balanceQty)
{
updQty = stkQuantity;
balanceQty = Double.parseDouble(df.format(balanceQty - stkQuantity));
isSufficient = false;
}
else
{
updQty = balanceQty;
balanceQty = 0;
isSufficient = true;
worderExpLevSufficient.put(worderStkBeanObj.getWorkOrder()+":"+worderStkBeanObj.getExpLevel(), isSufficient);
updateWoBeanSufficient(worderStkBeanObj.getWorkOrder(), worderStkBeanObj.getExpLevel(), "Y");
}
if(stkindex != -1)
{
System.out.println("manohar before .setQuantity 112["+worderStkBeanObj.getQuantity()+"] .getPotencyAdj[" + worderStkBeanObj.getPotencyAdj() + "] .getAllocQty[" + worderStkBeanObj.getAllocQty() + "] .getUpdQty[" + worderStkBeanObj.getUpdQty() +"]");
worderStkBeanObj.setAllocQty(worderStkBeanObj.getAllocQty() + updQty);
worderStkBeanObj.setQuantity(worderStkBeanObj.getQuantity() + updQty);
worderStkBeanObj.setUpdQty(worderStkBeanObj.getAllocQty());
System.out.println("manohar after .setQuantity 112["+worderStkBeanObj.getQuantity()+"] .getPotencyAdj[" + worderStkBeanObj.getPotencyAdj() + "] .getAllocQty[" + worderStkBeanObj.getAllocQty() + "] .getUpdQty[" + worderStkBeanObj.getUpdQty() +"]");
}
else
{
System.out.println("manohar before .setQuantity 113["+worderStkBeanObj.getQuantity()+"] .getPotencyAdj[" + worderStkBeanObj.getPotencyAdj() + "] .getAllocQty[" + worderStkBeanObj.getAllocQty() + "] .getUpdQty[" + worderStkBeanObj.getUpdQty() +"]");
worderStkBeanObj.setAllocQty(updQty);
worderStkBeanObj.setQuantity(updQty);
worderStkBeanObj.setUpdQty(updQty);
System.out.println("manohar after .setQuantity 113["+worderStkBeanObj.getQuantity()+"] .getPotencyAdj[" + worderStkBeanObj.getPotencyAdj() + "] .getAllocQty[" + worderStkBeanObj.getAllocQty() + "] .getUpdQty[" + worderStkBeanObj.getUpdQty() +"]");
}
}
// 06-jun-16 manoharan do round off as per iss_criteria of item
if (!"Y".equals(matchPotency) && (adjPotency == null || adjPotency.trim().length() == 0 ))
{
if("F".equalsIgnoreCase(issCriteria))
{
qtyPerArt = getQtyPerArt(stkKey,conn); qtyPerArt = getQtyPerArt(stkKey,conn);
if(qtyPerArt > updQty)
{
updQty = qtyPerArt;
}
else
{
System.out.println("allocated quantity will be 2 shippersize");
double noArtQuot = 0,noArtRem = 0,noArt = 0;
noArtQuot= updQty / qtyPerArt ;
noArtRem = updQty % qtyPerArt ;
if(noArtRem > 0)
{
noArtRem = 1;
}
noArtQuot = (int) noArtQuot;
noArt = noArtQuot + noArtRem;
System.out.println("NO Art in current site="+noArt);
updQty = qtyPerArt * noArt;
}
}
else if("W".equalsIgnoreCase(issCriteria))
{
updQty = stkQuantity;
}
}
/* 31-may-16 manoharan not the right place
qtyPerArt = getQtyPerArt(stkKey,conn);
//Changed by wasim on 08-03-2016 to consider issue criteria [START] //Changed by wasim on 08-03-2016 to consider issue criteria [START]
if(!"Y".equalsIgnoreCase(otherSite)) if(!"Y".equalsIgnoreCase(otherSite))
{ {
issCriteria = getColumnDescr(conn,"ISS_CRITERIA","ITEM","ITEM_CODE",detailMap.get("ITEM_CODE"));
System.out.println("Issue Criteria found="+issCriteria); System.out.println("Issue Criteria found="+issCriteria);
if("F".equalsIgnoreCase(issCriteria)) if("F".equalsIgnoreCase(issCriteria))
...@@ -1464,7 +1742,7 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi ...@@ -1464,7 +1742,7 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi
System.out.println("Final Allocated quantity in current site="+requiredQty); System.out.println("Final Allocated quantity in current site="+requiredQty);
} }
//Changed by wasim on 08-03-2016 to consider issue criteria [END] //Changed by wasim on 08-03-2016 to consider issue criteria [END]
*/
//If other site Y then set quantity according to site code and //If other site Y then set quantity according to site code and
//item code wise in siteItemReqQtyList. (For creating distribution issue / sale order ) //item code wise in siteItemReqQtyList. (For creating distribution issue / sale order )
if("Y".equalsIgnoreCase(otherSite)) if("Y".equalsIgnoreCase(otherSite))
...@@ -1478,7 +1756,7 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi ...@@ -1478,7 +1756,7 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi
siteItemMap.put("LOT_NO", lotNo); siteItemMap.put("LOT_NO", lotNo);
siteItemMap.put("LOT_SL", lotSl); siteItemMap.put("LOT_SL", lotSl);
siteItemMap.put("SITE_CODE", detailMap.get("SITE_CODE")); siteItemMap.put("SITE_CODE", detailMap.get("SITE_CODE"));
siteItemMap.put("QUANTITY", requiredQty); siteItemMap.put("QUANTITY", updQty);
siteItemMap.put("UNIT", unit); siteItemMap.put("UNIT", unit);
siteItemMap.put("SITE_CODE__MFG", siteCodeMfg); siteItemMap.put("SITE_CODE__MFG", siteCodeMfg);
siteItemMap.put("MFG_DATE", mfgDateT); siteItemMap.put("MFG_DATE", mfgDateT);
...@@ -1498,7 +1776,7 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi ...@@ -1498,7 +1776,7 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi
siteItemSumBeanObj = new SiteItemSummaryBean(); siteItemSumBeanObj = new SiteItemSummaryBean();
//Changed by wasim on 01-04-2016 to allocate quantity as per qty per art for other site //Changed by wasim on 01-04-2016 to allocate quantity as per qty per art for other site
siteItemSumBeanObj.setOtherSiteQty(Double.valueOf(requiredQty)); siteItemSumBeanObj.setOtherSiteQty(Double.valueOf(updQty));
siteItemSumBeanObj.setStockValues(siteItemMap); siteItemSumBeanObj.setStockValues(siteItemMap);
//System.out.println("Allocating quantity for other site="+qtyPerArt); //System.out.println("Allocating quantity for other site="+qtyPerArt);
//siteItemSumBeanObj.setOtherSiteQty(Double.valueOf(qtyPerArt)); //siteItemSumBeanObj.setOtherSiteQty(Double.valueOf(qtyPerArt));
...@@ -1520,17 +1798,17 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi ...@@ -1520,17 +1798,17 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi
//worderStkBeanList.add(worderStkBeanObj); //worderStkBeanList.add(worderStkBeanObj);
System.out.println("doneStockDetailsMap : "+doneStockDetailsMap); //System.out.println("doneStockDetailsMap : "+doneStockDetailsMap);
//in doneStockDetailsMap put key as stock primary key. If in both work order contains same item code //in doneStockDetailsMap put key as stock primary key. If in both work order contains same item code
//then item1 already stock allocate then for item2 same stock allocated . //then item1 already stock allocate then for item2 same stock allocated .
//so we check in map,if stock key already allocated or not. //so we check in map,if stock key already allocated or not.
System.out.println("requiredQty@@ : ["+requiredQty+"] "); System.out.println("updQty@@ : ["+updQty+"] ");
System.out.println("stkQuantity@@ : ["+stkQuantity+"] "); System.out.println("stkQuantity@@ : ["+stkQuantity+"] ");
System.out.println("softAllocQty@@ : ["+softAllocQty+"] "); System.out.println("softAllocQty@@ : ["+softAllocQty+"] ");
System.out.println("Min quantity required="+minQtyReq); System.out.println("Min quantity required="+minQtyReq);
requiredQty = Double.parseDouble(df.format(requiredQty)); requiredQty = Double.parseDouble(df.format(updQty));
//Changed by wasim on 16-03-2016 to consider and allocate minimum qty req [START] //Changed by wasim on 16-03-2016 to consider and allocate minimum qty req [START]
/*double minReqQty = worderStkBeanObj.getMinQtyReq(); /*double minReqQty = worderStkBeanObj.getMinQtyReq();
...@@ -1549,32 +1827,7 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi ...@@ -1549,32 +1827,7 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi
System.out.println("Finally required quantity ="+requiredQty); System.out.println("Finally required quantity ="+requiredQty);
//Changed by wasim on 16-03-2016 to consider and allocate minimum qty req [END] //Changed by wasim on 16-03-2016 to consider and allocate minimum qty req [END]
if(requiredQty <= (stkQuantity + softAllocQty)) stockAllocMap.put("ALLOC_QTY",""+updQty);
{
balanceQty = 0;
isSufficient = true;
stockAllocMap.put("ALLOC_QTY",""+requiredQty);
stockAllocMap.put("LOC_CODE", locCode);
stockAllocMap.put("ITEM_CODE",detailMap.get("ITEM_CODE"));
stockAllocMap.put("SITE_CODE",detailMap.get("SITE_CODE"));
stockAllocMap.put("LOT_NO",lotNo);
stockAllocMap.put("LOT_SL",lotSl);
allocRetStr = updateStockAllocQty(stockAllocMap,conn);
System.out.println("allocRetStr :"+allocRetStr);
/*worderStkBeanObj.setAllocQty(requiredQty);
worderStkBeanObj.setQuantity(requiredQty);*/
finalAllocatedQty = requiredQty;
}
else
{
System.out.println("else...........");
isSufficient = false;
balanceQty = requiredQty - (stkQuantity + softAllocQty);
stockAllocMap.put("ALLOC_QTY",""+stkQuantity);
stockAllocMap.put("LOC_CODE", locCode); stockAllocMap.put("LOC_CODE", locCode);
stockAllocMap.put("ITEM_CODE",detailMap.get("ITEM_CODE")); stockAllocMap.put("ITEM_CODE",detailMap.get("ITEM_CODE"));
stockAllocMap.put("SITE_CODE",detailMap.get("SITE_CODE")); stockAllocMap.put("SITE_CODE",detailMap.get("SITE_CODE"));
...@@ -1583,20 +1836,10 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi ...@@ -1583,20 +1836,10 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi
allocRetStr = updateStockAllocQty(stockAllocMap,conn); allocRetStr = updateStockAllocQty(stockAllocMap,conn);
System.out.println("allocRetStr :"+allocRetStr); System.out.println("allocRetStr :"+allocRetStr);
balanceQty = Double.parseDouble(df.format(balanceQty)); finalAllocatedQty = updQty;
System.out.println("balanceQty@@ : ["+balanceQty+"] ");
System.out.println("softAllocQty@@ : ["+softAllocQty+"] ");
requiredQty = balanceQty;
worderStkBeanObj.setStockSufficient("N");
/*worderStkBeanObj.setAllocQty(stkQuantity);
worderStkBeanObj.setQuantity(stkQuantity);*/
finalAllocatedQty = stkQuantity;
}
System.out.println("Adding stk..........."+worderStkBeanObj.getStockSufficient()); System.out.println("Adding stk..........."+worderStkBeanObj.getStockSufficient());
System.out.println("isReallocation Flag in check site["+isReallocation+"] [" + stkindex + "]"); System.out.println("isReallocation Flag in check site["+isReallocation+"] [" + stkindex + "]");
if (!isReallocation) /*if (!isReallocation)
{ {
if(stkindex != -1) if(stkindex != -1)
{ {
...@@ -1609,12 +1852,17 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi ...@@ -1609,12 +1852,17 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi
{ {
worderStkBeanObj.setAllocQty(finalAllocatedQty); worderStkBeanObj.setAllocQty(finalAllocatedQty);
System.out.println("manohar before .setQuantity 2["+worderStkBeanObj.getQuantity()+"]"); System.out.println("manohar before .setQuantity 2["+worderStkBeanObj.getQuantity()+"]");
worderStkBeanObj.setQuantity(finalAllocatedQty); //worderStkBeanObj.setQuantity(finalAllocatedQty);
System.out.println("manohar after .setQuantity 2["+worderStkBeanObj.getQuantity()+"]"); System.out.println("manohar after .setQuantity 2["+worderStkBeanObj.getQuantity()+"]");
} }
}*/
if(isSufficient)
{
worderStkBeanObj.setStockSufficient("Y");
} }
if(isReallocation) if(isReallocation)
{ {
// 31-may-16 manoharan potency to be calculated if necessary
tempWorderExpStkBeanList.add(worderStkBeanObj); tempWorderExpStkBeanList.add(worderStkBeanObj);
} }
else else
...@@ -1639,19 +1887,13 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi ...@@ -1639,19 +1887,13 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi
{ {
break; break;
} }
}
else
{
System.out.println("stkPotencyPerc is less than minimum potency please check........");
}
} //end while } //end while
rs.close(); rs.close();
rs= null; rs= null;
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
System.out.println("manohar in checkCurrentSiteStock after allocation balanceQty ["+balanceQty+"] isSufficient[" + isSufficient + "]");
if(isSufficient) if(isSufficient)
{ {
returnMapDetails.put("ERROR_CODE",""); returnMapDetails.put("ERROR_CODE","");
...@@ -1672,6 +1914,7 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi ...@@ -1672,6 +1914,7 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi
returnMapDetails.put("BALANCE_QTY",String.valueOf(balanceQty)); returnMapDetails.put("BALANCE_QTY",String.valueOf(balanceQty));
returnMapDetails.put("IS_SUFFICIENT","false"); returnMapDetails.put("IS_SUFFICIENT","false");
} }
System.out.println("manohar in checkCurrentSiteStock after allocation balanceQty ["+balanceQty+"] isSufficient[" + isSufficient + "] returnMapDetails [" + returnMapDetails + "]");
} }
catch(Exception e) catch(Exception e)
{ {
...@@ -1691,7 +1934,7 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi ...@@ -1691,7 +1934,7 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
} }
}
System.out.println("Consider Partial Alternative in last current site["+considerPartialAlt+"]"); System.out.println("Consider Partial Alternative in last current site["+considerPartialAlt+"]");
if("N".equalsIgnoreCase(considerPartialAlt)) if("N".equalsIgnoreCase(considerPartialAlt))
...@@ -1710,8 +1953,9 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi ...@@ -1710,8 +1953,9 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi
conn.rollback(); conn.rollback();
} }
} }
return returnMapDetails;
} }
return returnMapDetails;
}
//Get item standard potency //Get item standard potency
//if in item master POTENCY_PERC is null or 0 then return 100. //if in item master POTENCY_PERC is null or 0 then return 100.
private double getItemStandardPotency(String itemCode,Connection conn) throws ITMException, Exception private double getItemStandardPotency(String itemCode,Connection conn) throws ITMException, Exception
...@@ -1779,13 +2023,13 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi ...@@ -1779,13 +2023,13 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi
double proQty=0, qtyPotencyUnit = 0,ItemStdPotency = 0,potencyAdjNew = 0, potencyAdjExpLev = 0,quantityReqExpLev = 0; double proQty=0, qtyPotencyUnit = 0,ItemStdPotency = 0,potencyAdjNew = 0, potencyAdjExpLev = 0,quantityReqExpLev = 0;
double requiredStock = 0,availableStock = 0,potencyAdj = 0,stkPotencyPerc = 0,balanceQty = 0, double requiredStock = 0,availableStock = 0,potencyAdj = 0,stkPotencyPerc = 0,balanceQty = 0,
tempStock = 0,matchQty = 0,totalPro = 0,stockAllocAddN = 0,updQty = 0,preExpShortQty = 0,balance = 0,currentLotQty = 0,currntEqualQty = 0; tempStock = 0,matchQty = 0,totalPro = 0,stockAllocAddN = 0,updQty = 0,preExpShortQty = 0,balance = 0,currentLotQty = 0,currntEqualQty = 0;
Map<String,Double>potencyAdjMapY = null; //Map<String,Double>potencyAdjMapY = null;
//Map<String,Double>potencyAdjMapYTemp = null; // 09-mar-16 manoharan not used //Map<String,Double>potencyAdjMapYTemp = null; // 09-mar-16 manoharan not used
Map<String,Double>potencyAdjMapN = null; //Map<String,Double>potencyAdjMapN = null;
//Map<String,Double>requiredQtyAddMap = new HashMap<String,Double>(); // 09-mar-16 manoharan not used //Map<String,Double>requiredQtyAddMap = new HashMap<String,Double>(); // 09-mar-16 manoharan not used
//Map<String,Double>stockAllocAddNMap = new HashMap<String,Double>(); // 09-mar-16 manoharan not used //Map<String,Double>stockAllocAddNMap = new HashMap<String,Double>(); // 09-mar-16 manoharan not used
Map<String,Double> AdjPotencyExplevQtyMap = null; //Map<String,Double> AdjPotencyExplevQtyMap = null;
//Map<String,Double>deAllocQtyMap = null; // 09-mar-16 manoharan //Map<String,Double>deAllocQtyMap = null; // 09-mar-16 manoharan
//ArrayList<WorkOrderDetailBean> tempWorderBeanList = new ArrayList<WorkOrderDetailBean>(); // 09-mar-16 manoharan not used //ArrayList<WorkOrderDetailBean> tempWorderBeanList = new ArrayList<WorkOrderDetailBean>(); // 09-mar-16 manoharan not used
...@@ -1797,13 +2041,18 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi ...@@ -1797,13 +2041,18 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi
int foundIndex = -1; int foundIndex = -1;
boolean isSufficient = false; boolean isSufficient = false;
double deallocQty = 0,allocatedQty = 0, extraQty = 0, potencyAdjLot = 0, quantityReqLot = 0; double deallocQty = 0,allocatedQty = 0, extraQty = 0, potencyAdjLot = 0, quantityReqLot = 0;
Map<String,String> stockAllocMap = new HashMap<String,String>();
boolean removeElement = false; boolean removeElement = false;
try try
{ {
for(String workOrderPotency : workOrderList) for(String workOrderPotency : workOrderList)
{ {
potencyAdjMapY = null;
potencyAdjMapN = null;
AdjPotencyExplevQtyMap = null;
potencyAdjMapY = new HashMap<String,Double>(); potencyAdjMapY = new HashMap<String,Double>();
potencyAdjMapN = new HashMap<String,Double>(); potencyAdjMapN = new HashMap<String,Double>();
//deAllocQtyMap = new HashMap<String,Double>();// 09-mar-16 manoharan //deAllocQtyMap = new HashMap<String,Double>();// 09-mar-16 manoharan
...@@ -1871,7 +2120,7 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi ...@@ -1871,7 +2120,7 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi
if(workOrder.equalsIgnoreCase(worderStkBeanObj.getWorkOrder().trim()) && expLevel.equalsIgnoreCase(worderStkBeanObj.getExpLevel().trim())) if(workOrder.equalsIgnoreCase(worderStkBeanObj.getWorkOrder().trim()) && expLevel.equalsIgnoreCase(worderStkBeanObj.getExpLevel().trim()))
{ {
System.out.println("Same wo/expLev worderStkBeanObj->workOrder["+worderStkBeanObj.getWorkOrder()+"] expLevel ["+worderStkBeanObj.getExpLevel()+"]ItemCode["+worderStkBeanObj.getItemCode()+"]LotNo["+worderStkBeanObj.getLotNo()+"]LotSl["+worderStkBeanObj.getLotSl()+"]LocCode["+worderStkBeanObj.getLocCode()+"]SiteCode["+worderStkBeanObj.getSiteCode()+"]AllocQty["+worderStkBeanObj.getAllocQty()+"]Stock Quantity["+worderStkBeanObj.getStkQuantity()+"]getQuantity["+worderStkBeanObj.getQuantity()+"]PotencyAdj["+worderStkBeanObj.getPotencyAdj()+"] Qty Adj["+worderStkBeanObj.getQtyAdj()+"]UpdQty["+worderStkBeanObj.getUpdQty()+"] Stock Sufficient["+worderStkBeanObj.getStockSufficient()+"]getCritItem["+worderStkBeanObj.getCritItem()+"]MinReqQty["+worderStkBeanObj.getMinQtyReq()+"]StockPotencyPerc["+worderStkBeanObj.getStkPotencyPerc()+"]OtherSiteYN["+worderStkBeanObj.getOtherSiteYN()+"]getAlternate["+worderStkBeanObj.getAlternate()+"] MfgDate["+worderStkBeanObj.getMfgDate()+"]ExpDate["+worderStkBeanObj.getExpDate()+"SiteCodeMfg["+worderStkBeanObj.getSiteCodeMfg()+"]ReserveLineNo["+worderStkBeanObj.getReserveLineNo()+"]ReserveStkTranId["+worderStkBeanObj.getReserveStkTranId()+"]Unit["+worderStkBeanObj.getUnit()+"]"); System.out.println("Same wo/expLev worderStkBeanObj->workOrder["+worderStkBeanObj.getWorkOrder()+"] expLevel ["+worderStkBeanObj.getExpLevel()+"]ItemCode["+worderStkBeanObj.getItemCode()+"]LotNo["+worderStkBeanObj.getLotNo()+"]LotSl["+worderStkBeanObj.getLotSl()+"]LocCode["+worderStkBeanObj.getLocCode()+"]SiteCode["+worderStkBeanObj.getSiteCode()+"]AllocQty["+worderStkBeanObj.getAllocQty()+"]Stock Quantity["+worderStkBeanObj.getStkQuantity()+"]getQuantity["+worderStkBeanObj.getQuantity()+"]PotencyAdj["+worderStkBeanObj.getPotencyAdj()+"] Qty Adj["+worderStkBeanObj.getQtyAdj()+"]UpdQty["+worderStkBeanObj.getUpdQty()+"] Stock Sufficient["+worderStkBeanObj.getStockSufficient()+"]getCritItem["+worderStkBeanObj.getCritItem()+"]MinReqQty["+worderStkBeanObj.getMinQtyReq()+"]StockPotencyPerc["+worderStkBeanObj.getStkPotencyPerc()+"]OtherSiteYN["+worderStkBeanObj.getOtherSiteYN()+"]getAlternate["+worderStkBeanObj.getAlternate()+"] MfgDate["+worderStkBeanObj.getMfgDate()+"]ExpDate["+worderStkBeanObj.getExpDate()+"] SiteCodeMfg["+worderStkBeanObj.getSiteCodeMfg()+"]ReserveLineNo["+worderStkBeanObj.getReserveLineNo()+"]ReserveStkTranId["+worderStkBeanObj.getReserveStkTranId()+"]Unit["+worderStkBeanObj.getUnit()+"]");
availableStock = worderStkBeanObj.getStkQuantity();//available availableStock = worderStkBeanObj.getStkQuantity();//available
stkPotencyPerc = worderStkBeanObj.getStkPotencyPerc(); stkPotencyPerc = worderStkBeanObj.getStkPotencyPerc();
itemCode = worderStkBeanObj.getItemCode(); itemCode = worderStkBeanObj.getItemCode();
...@@ -1946,83 +2195,82 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi ...@@ -1946,83 +2195,82 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi
potencyAdj = ( balance /stkPotencyPerc * ItemStdPotency) - balance; potencyAdj = ( balance /stkPotencyPerc * ItemStdPotency) - balance;
potencyAdj = Double.parseDouble(df.format(potencyAdj)); potencyAdj = Double.parseDouble(df.format(potencyAdj));
System.out.println("After calculating potencyAdj SUFFICIENT----->>["+potencyAdj+"]");//0.244 System.out.println("After calculating potencyAdj SUFFICIENT----->>["+potencyAdj+"]");
worderStkBeanObj.setQtyAdj(Double.parseDouble(df.format(potencyAdj))); worderStkBeanObj.setQtyAdj(Double.parseDouble(df.format(potencyAdj)));
updQty = worderStkBeanObj.getAllocQty() + potencyAdj; //2 + 0.244 = 2.244 //updQty = worderStkBeanObj.getAllocQty() + potencyAdj; // 03-jun-16 manoharan commented
updQty = balance + potencyAdj; // 03-jun-16 manoharan added
updQty = Double.parseDouble(df.format(updQty)); updQty = Double.parseDouble(df.format(updQty));
//updQty = balance + potencyAdj; //2.2+0.244 = 2.444 System.out.println("manohar before .setQuantity 4["+worderStkBeanObj.getQuantity()+"] .setPotencyAdj[" + worderStkBeanObj.getPotencyAdj() + "] .setQtyAdj[" + worderStkBeanObj.getQtyAdj() + "]" );
System.out.println("manohar before .setQuantity 4["+worderStkBeanObj.getQuantity()+"]"); worderStkBeanObj.setQuantity(balance);
worderStkBeanObj.setQuantity(worderStkBeanObj.getAllocQty() ); // 2.2 - 0.2444 = /// 23-may-16 manoharan
System.out.println("manohar after .setQuantity 3["+worderStkBeanObj.getQuantity()+"]"); if (availableStock >= updQty) // 03-jun-16 manoharan stock available in same lot
{
//stockAllocMap.put("ALLOC_QTY",""+potencyAdj); // 03-jun-16 manoharan commented
stockAllocMap.put("ALLOC_QTY",""+ (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());
stockAllocMap.put("LOT_NO",worderStkBeanObj.getLotNo());
stockAllocMap.put("LOT_SL",worderStkBeanObj.getLotSl());
allocRetStr = updateStockAllocQty(stockAllocMap,conn);
System.out.println("allocRetStr :"+allocRetStr);
worderStkBeanObj.setAllocQty(updQty); // 2 + 0.244 = 2.244 worderStkBeanObj.setAllocQty(updQty); // 2 + 0.244 = 2.244
//////////////////////////////*********worderStkBeanObj.setQuantity(updQty); // 2.2 - 0.2444 =
worderStkBeanObj.setUpdQty(updQty); worderStkBeanObj.setUpdQty(updQty);
worderStkBeanObj.setStockSufficient("Y"); worderStkBeanObj.setStockSufficient("Y");
worderStkBeanObj.setQtyAdj(potencyAdj);//wasim on 13-04-2016 worderStkBeanObj.setQtyAdj(potencyAdj);//wasim on 13-04-2016
worderStkBeanObj.setPotencyAdj(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() + "]" );
worderStkBeanList.set(innerCtr, worderStkBeanObj); worderStkBeanList.set(innerCtr, worderStkBeanObj);
if(potencyAdjMapY.containsKey(adjPotency) ) if(potencyAdjMapY.containsKey(adjPotency) )
{ {
potencyAdjMapY.put(adjPotency, Double.parseDouble(df.format((potencyAdjMapY.get(adjPotency) + potencyAdj ))) ); potencyAdjMapY.put(adjPotency, Double.parseDouble(df.format((potencyAdjMapY.get(adjPotency) + potencyAdj ))) );
} }
else else
{ {
potencyAdjMapY.put(adjPotency, potencyAdj ); potencyAdjMapY.put(adjPotency, potencyAdj );
} }
balance = 0;
worderExpLevSufficient.put(worderStkBeanObj.getWorkOrder()+":"+worderStkBeanObj.getExpLevel(), true);
updateWoBeanSufficient(worderStkBeanObj.getWorkOrder(), worderStkBeanObj.getExpLevel(), "Y");
}
else
{
HashMap<String,String> detailMap = new HashMap<String,String>(); potencyAdj = Double.parseDouble(df.format((potencyAdj - (updQty - availableStock)))) ;
detailMap.put("USE_INV_STATUS", worderDetailBeanObj.getUseInvStatus()); stockAllocMap.put("ALLOC_QTY",""+potencyAdj);
detailMap.put("SUPP_CODE_MFG", worderDetailBeanObj.getSuppCodeMfg()); stockAllocMap.put("LOC_CODE", worderStkBeanObj.getLocCode());
detailMap.put("DIMENSION", worderDetailBeanObj.getDimension()); stockAllocMap.put("ITEM_CODE",worderStkBeanObj.getItemCode());
detailMap.put("MIN_POTENCY_PERC", String.valueOf(worderDetailBeanObj.getMinPotencyPerc()) ); stockAllocMap.put("SITE_CODE",worderStkBeanObj.getSiteCode());
detailMap.put("EXP_LEV", worderDetailBeanObj.getExpLev()); stockAllocMap.put("LOT_NO",worderStkBeanObj.getLotNo());
detailMap.put("OPERATION", ""+worderDetailBeanObj.getOperation()); stockAllocMap.put("LOT_SL",worderStkBeanObj.getLotSl());
detailMap.put("CRIT_ITEM", worderDetailBeanObj.getCritItem()); allocRetStr = updateStockAllocQty(stockAllocMap,conn);
detailMap.put("ITEM_REF", worderDetailBeanObj.getItemRef());
detailMap.put("BOM_CODE", worderDetailBeanObj.getBomCode()); System.out.println("allocRetStr :"+allocRetStr);
detailMap.put("ITEM_CODE", worderDetailBeanObj.getItemCode()); updQty = worderStkBeanObj.getAllocQty() + potencyAdj; //2 + 0.244 = 2.244
detailMap.put("QUANTITY", String.valueOf(worderDetailBeanObj.getQuantity())); updQty = Double.parseDouble(df.format(updQty));
detailMap.put("SITE_CODE", worderStkBeanObj.getSiteCode());//wasim worderStkBeanObj.setAllocQty(updQty); // 2 + 0.244 = 2.244
detailMap.put("UNIT", worderDetailBeanObj.getUnit()); worderStkBeanObj.setUpdQty(updQty);
detailMap.put("MATCH_POTENCY", worderDetailBeanObj.getMatchPotency()); worderStkBeanObj.setStockSufficient("N");
detailMap.put("ADJ_POTENCY", worderDetailBeanObj.getAdjPotency()); worderStkBeanObj.setQtyAdj(potencyAdj);//wasim on 13-04-2016
detailMap.put("USAGE_TYPE", worderDetailBeanObj.getUsageType()); worderStkBeanObj.setPotencyAdj(potencyAdj);//wasim on 13-04-2016
detailMap.put("CONSIDER_LOTNO_ISSUE", worderDetailBeanObj.getConsiderLotNoIssue()); System.out.println("manohar after .setQuantity 4["+worderStkBeanObj.getQuantity()+"] .setPotencyAdj[" + worderStkBeanObj.getPotencyAdj() + "] .setQtyAdj[" + worderStkBeanObj.getQtyAdj() + "]" );
detailMap.put("LOC_USAGE_TYPE", worderDetailBeanObj.getLocUsageType()); worderStkBeanList.set(innerCtr, worderStkBeanObj);
detailMap.put("WORK_ORDER", worderDetailBeanObj.getWorkOrder());
detailMap.put("ITEM_ACTIVE", worderDetailBeanObj.getItemActive()); if(potencyAdjMapY.containsKey(adjPotency) )
detailMap.put("ALLOCATE_TYPE", worderDetailBeanObj.getAllocateType());
detailMap.put("ITEM_CATEGORY", worderDetailBeanObj.getItemCategory());
detailMap.put("IS_ALTERNATE", "N");
if("Y".equalsIgnoreCase(worderStkBeanObj.getOtherSiteYN()))
{ {
detailMap.put("OTHER_SITE", "Y"); potencyAdjMapY.put(adjPotency, Double.parseDouble(df.format((potencyAdjMapY.get(adjPotency) + potencyAdj ))) );
} }
else else
{ {
detailMap.put("OTHER_SITE", "N"); potencyAdjMapY.put(adjPotency, potencyAdj );
} }
detailMap.put("STOCK_DETAIL", "Y");
detailMap.put("MIN_QTY_REQ", String.valueOf(worderDetailBeanObj.getMinReqQty()));
detailMap.put("BALANCE_QTY",potencyAdj+"");
// 26-may-16 the following part added
isReallocation = true;
Map<String,String>detailStkMap = checkCurrentSiteStock(detailMap, conn);
for(WorderStkBean tempStkObj : tempWorderExpStkBeanList)
{
worderStkBeanListTemp.add(tempStkObj);
}
tempWorderExpStkBeanList.clear();
isReallocation = false;
// end 26-may-16 the following part added
System.out.println("detailStkMap C.Potency-------->>["+detailStkMap+"]");
balance = 0; balance = Double.parseDouble(df.format(updQty - availableStock)) ;
}
}//End }//End
...@@ -2089,7 +2337,7 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi ...@@ -2089,7 +2337,7 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi
else else
{ {
System.out.println(" N adjPotency----->>["+adjPotency+"] ["+availableStock+"]"); System.out.println(" N adjPotency----->>["+adjPotency+"] ["+availableStock+"]");
System.out.println("Same wo/expLev(N) worderStkBeanObj->workOrder["+worderStkBeanObj.getWorkOrder()+"] expLevel ["+worderStkBeanObj.getExpLevel()+"]ItemCode["+worderStkBeanObj.getItemCode()+"]LotNo["+worderStkBeanObj.getLotNo()+"]LotSl["+worderStkBeanObj.getLotSl()+"]LocCode["+worderStkBeanObj.getLocCode()+"]SiteCode["+worderStkBeanObj.getSiteCode()+"]AllocQty["+worderStkBeanObj.getAllocQty()+"]Stock Quantity["+worderStkBeanObj.getStkQuantity()+"]getQuantity["+worderStkBeanObj.getQuantity()+"]PotencyAdj["+worderStkBeanObj.getPotencyAdj()+"] Qty Adj["+worderStkBeanObj.getQtyAdj()+"]UpdQty["+worderStkBeanObj.getUpdQty()+"] Stock Sufficient["+worderStkBeanObj.getStockSufficient()+"]getCritItem["+worderStkBeanObj.getCritItem()+"]MinReqQty["+worderStkBeanObj.getMinQtyReq()+"]StockPotencyPerc["+worderStkBeanObj.getStkPotencyPerc()+"]OtherSiteYN["+worderStkBeanObj.getOtherSiteYN()+"]getAlternate["+worderStkBeanObj.getAlternate()+"] MfgDate["+worderStkBeanObj.getMfgDate()+"]ExpDate["+worderStkBeanObj.getExpDate()+"SiteCodeMfg["+worderStkBeanObj.getSiteCodeMfg()+"]ReserveLineNo["+worderStkBeanObj.getReserveLineNo()+"]ReserveStkTranId["+worderStkBeanObj.getReserveStkTranId()+"]Unit["+worderStkBeanObj.getUnit()+"]"); System.out.println("Same wo/expLev(N) worderStkBeanObj->workOrder["+worderStkBeanObj.getWorkOrder()+"] expLevel ["+worderStkBeanObj.getExpLevel()+"]ItemCode["+worderStkBeanObj.getItemCode()+"]LotNo["+worderStkBeanObj.getLotNo()+"]LotSl["+worderStkBeanObj.getLotSl()+"]LocCode["+worderStkBeanObj.getLocCode()+"]SiteCode["+worderStkBeanObj.getSiteCode()+"]AllocQty["+worderStkBeanObj.getAllocQty()+"]Stock Quantity["+worderStkBeanObj.getStkQuantity()+"]getQuantity["+worderStkBeanObj.getQuantity()+"]PotencyAdj["+worderStkBeanObj.getPotencyAdj()+"] Qty Adj["+worderStkBeanObj.getQtyAdj()+"]UpdQty["+worderStkBeanObj.getUpdQty()+"] Stock Sufficient["+worderStkBeanObj.getStockSufficient()+"]getCritItem["+worderStkBeanObj.getCritItem()+"]MinReqQty["+worderStkBeanObj.getMinQtyReq()+"]StockPotencyPerc["+worderStkBeanObj.getStkPotencyPerc()+"]OtherSiteYN["+worderStkBeanObj.getOtherSiteYN()+"]getAlternate["+worderStkBeanObj.getAlternate()+"] MfgDate["+worderStkBeanObj.getMfgDate()+"]ExpDate["+worderStkBeanObj.getExpDate()+"] SiteCodeMfg["+worderStkBeanObj.getSiteCodeMfg()+"]ReserveLineNo["+worderStkBeanObj.getReserveLineNo()+"]ReserveStkTranId["+worderStkBeanObj.getReserveStkTranId()+"]Unit["+worderStkBeanObj.getUnit()+"]");
if(adjPotency != null && adjPotency.trim().length() > 0) if(adjPotency != null && adjPotency.trim().length() > 0)
{ {
System.out.println("Potency to be adjusted [" + adjPotency + "]"); System.out.println("Potency to be adjusted [" + adjPotency + "]");
...@@ -2183,11 +2431,13 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi ...@@ -2183,11 +2431,13 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi
{ {
System.out.println("manohar before templist merge " ); System.out.println("manohar before templist merge " );
worderStkBeanObj = (WorderStkBean) worderStkBeanList.get(foundIndex); worderStkBeanObj = (WorderStkBean) worderStkBeanList.get(foundIndex);
System.out.println("manohar before templist merge getAllocQty [" + worderStkBeanObj.getAllocQty()+ "] potencyadj [" + worderStkBeanObj.getPotencyAdj() + "]" ); System.out.println("manohar before templist merge .getExpLevel [" + worderStkBeanObj.getExpLevel() +"] .setQuantity ["+worderStkBeanObj.getQuantity()+"] .setAllocQty [" + worderStkBeanObj.getAllocQty() + "] .setUpdQty [" + worderStkBeanObj.getUpdQty() + "] .setPotencyAdj( [" +worderStkBeanObj.getPotencyAdj() + "] .setQtyAdj(" + worderStkBeanObj.getQtyAdj() + "]" );
worderStkBeanObj.setAllocQty(worderStkBeanObj.getAllocQty() + tempStkObj.getAllocQty()); worderStkBeanObj.setAllocQty(Double.parseDouble(df.format(worderStkBeanObj.getAllocQty() + tempStkObj.getAllocQty())));
worderStkBeanObj.setPotencyAdj(worderStkBeanObj.getPotencyAdj() + tempStkObj.getPotencyAdj()); worderStkBeanObj.setPotencyAdj(Double.parseDouble(df.format(worderStkBeanObj.getPotencyAdj() + tempStkObj.getPotencyAdj())));
worderStkBeanObj.setQtyAdj(Double.parseDouble(df.format(worderStkBeanObj.getQtyAdj() + tempStkObj.getQtyAdj())));
worderStkBeanObj.setUpdQty(Double.parseDouble(df.format(worderStkBeanObj.getUpdQty() + tempStkObj.getUpdQty())));
worderStkBeanList.set(foundIndex,worderStkBeanObj); worderStkBeanList.set(foundIndex,worderStkBeanObj);
System.out.println("manohar after templist merge getAllocQty [" + worderStkBeanObj.getAllocQty()+ "] potencyadj [" + worderStkBeanObj.getPotencyAdj() + "]" ); System.out.println("manohar after templist merge .getExpLevel [" + worderStkBeanObj.getExpLevel() +"] .setQuantity ["+worderStkBeanObj.getQuantity()+"] .setAllocQty [" + worderStkBeanObj.getAllocQty() + "] .setUpdQty [" + worderStkBeanObj.getUpdQty() + "] .setPotencyAdj( [" +worderStkBeanObj.getPotencyAdj() + "] .setQtyAdj(" + worderStkBeanObj.getQtyAdj() + "]" );
} }
else else
...@@ -2237,7 +2487,10 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi ...@@ -2237,7 +2487,10 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi
System.out.println("potencyAdjExpLev---------->>["+potencyAdjExpLev+"]");//-93.733 System.out.println("potencyAdjExpLev---------->>["+potencyAdjExpLev+"]");//-93.733
quantityReqExpLev = adjPotencyExpLevel.getValue() + potencyAdjExpLev;//56.366 quantityReqExpLev = adjPotencyExpLevel.getValue() + potencyAdjExpLev;//56.366
quantityReqExpLev = Double.parseDouble(df.format(quantityReqExpLev));//38.477 quantityReqExpLev = Double.parseDouble(df.format(quantityReqExpLev));//38.477
System.out.println("quantityReqExpLev---------->>["+quantityReqExpLev+"]");
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
if (potencyAdjExpLev < 0) if (potencyAdjExpLev < 0)
{ {
// Extra allocation done to be deallocated // Extra allocation done to be deallocated
...@@ -2245,6 +2498,8 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi ...@@ -2245,6 +2498,8 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi
extraQty = adjPotencyExpLevel.getValue() - quantityReqExpLev; extraQty = adjPotencyExpLevel.getValue() - quantityReqExpLev;
extraQty = Double.parseDouble(df.format(extraQty)); extraQty = Double.parseDouble(df.format(extraQty));
int stockListSize = worderStkBeanList.size() -1; int stockListSize = worderStkBeanList.size() -1;
System.out.println("Deallocate stockListSize [" + stockListSize + "] ExpLev [" + expLevelNew+"] quantity["+ adjPotencyExpLevel.getValue() + "] quantityReqExpLev ["+quantityReqExpLev+"] extraQty [" + extraQty + "]"); System.out.println("Deallocate stockListSize [" + stockListSize + "] ExpLev [" + expLevelNew+"] quantity["+ adjPotencyExpLevel.getValue() + "] quantityReqExpLev ["+quantityReqExpLev+"] extraQty [" + extraQty + "]");
for(int potencyCtr = stockListSize; potencyCtr > 0 ; potencyCtr--) for(int potencyCtr = stockListSize; potencyCtr > 0 ; potencyCtr--)
{ {
...@@ -2255,11 +2510,13 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi ...@@ -2255,11 +2510,13 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi
{ {
if (extraQty <= 0) if (extraQty <= 0)
{ {
worderExpLevSufficient.put(worderStkBeanObj.getWorkOrder()+":"+worderStkBeanObj.getExpLevel(), true);
updateWoBeanSufficient(worderStkBeanObj.getWorkOrder(), worderStkBeanObj.getExpLevel(), "Y");
break; break;
} }
removeElement = false; removeElement = false;
allocatedQty = worderStkBeanObj.getAllocQty(); allocatedQty = worderStkBeanObj.getAllocQty();
System.out.println("Same wo/expLev(N) deallocate worderStkBeanObj->workOrder["+worderStkBeanObj.getWorkOrder()+"] expLevel ["+worderStkBeanObj.getExpLevel()+"]ItemCode["+worderStkBeanObj.getItemCode()+"]LotNo["+worderStkBeanObj.getLotNo()+"]LotSl["+worderStkBeanObj.getLotSl()+"]LocCode["+worderStkBeanObj.getLocCode()+"]SiteCode["+worderStkBeanObj.getSiteCode()+"]AllocQty["+worderStkBeanObj.getAllocQty()+"]Stock Quantity["+worderStkBeanObj.getStkQuantity()+"]getQuantity["+worderStkBeanObj.getQuantity()+"]PotencyAdj["+worderStkBeanObj.getPotencyAdj()+"] Qty Adj["+worderStkBeanObj.getQtyAdj()+"]UpdQty["+worderStkBeanObj.getUpdQty()+"] Stock Sufficient["+worderStkBeanObj.getStockSufficient()+"]getCritItem["+worderStkBeanObj.getCritItem()+"]MinReqQty["+worderStkBeanObj.getMinQtyReq()+"]StockPotencyPerc["+worderStkBeanObj.getStkPotencyPerc()+"]OtherSiteYN["+worderStkBeanObj.getOtherSiteYN()+"]getAlternate["+worderStkBeanObj.getAlternate()+"] MfgDate["+worderStkBeanObj.getMfgDate()+"]ExpDate["+worderStkBeanObj.getExpDate()+"SiteCodeMfg["+worderStkBeanObj.getSiteCodeMfg()+"]ReserveLineNo["+worderStkBeanObj.getReserveLineNo()+"]ReserveStkTranId["+worderStkBeanObj.getReserveStkTranId()+"]Unit["+worderStkBeanObj.getUnit()+"]"); System.out.println("Same wo/expLev(N) deallocate worderStkBeanObj->workOrder["+worderStkBeanObj.getWorkOrder()+"] expLevel ["+worderStkBeanObj.getExpLevel()+"]ItemCode["+worderStkBeanObj.getItemCode()+"]LotNo["+worderStkBeanObj.getLotNo()+"]LotSl["+worderStkBeanObj.getLotSl()+"]LocCode["+worderStkBeanObj.getLocCode()+"]SiteCode["+worderStkBeanObj.getSiteCode()+"]AllocQty["+worderStkBeanObj.getAllocQty()+"]Stock Quantity["+worderStkBeanObj.getStkQuantity()+"]getQuantity["+worderStkBeanObj.getQuantity()+"]PotencyAdj["+worderStkBeanObj.getPotencyAdj()+"] Qty Adj["+worderStkBeanObj.getQtyAdj()+"]UpdQty["+worderStkBeanObj.getUpdQty()+"] Stock Sufficient["+worderStkBeanObj.getStockSufficient()+"]getCritItem["+worderStkBeanObj.getCritItem()+"]MinReqQty["+worderStkBeanObj.getMinQtyReq()+"]StockPotencyPerc["+worderStkBeanObj.getStkPotencyPerc()+"]OtherSiteYN["+worderStkBeanObj.getOtherSiteYN()+"]getAlternate["+worderStkBeanObj.getAlternate()+"] MfgDate["+worderStkBeanObj.getMfgDate()+"]ExpDate["+worderStkBeanObj.getExpDate()+"] SiteCodeMfg["+worderStkBeanObj.getSiteCodeMfg()+"]ReserveLineNo["+worderStkBeanObj.getReserveLineNo()+"]ReserveStkTranId["+worderStkBeanObj.getReserveStkTranId()+"]Unit["+worderStkBeanObj.getUnit()+"]");
// check allocated quantity >= extra quantity and deallocate accordingly // check allocated quantity >= extra quantity and deallocate accordingly
if (allocatedQty <= extraQty ) if (allocatedQty <= extraQty )
{ {
...@@ -2272,7 +2529,7 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi ...@@ -2272,7 +2529,7 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi
deallocQty = extraQty; deallocQty = extraQty;
extraQty = 0; extraQty = 0;
} }
Map<String,String> stockAllocMap = new HashMap<String,String>();
stockAllocMap.put("ALLOC_QTY",""+ (deallocQty * -1)); stockAllocMap.put("ALLOC_QTY",""+ (deallocQty * -1));
stockAllocMap.put("LOC_CODE", worderStkBeanObj.getLocCode()); stockAllocMap.put("LOC_CODE", worderStkBeanObj.getLocCode());
stockAllocMap.put("ITEM_CODE",worderStkBeanObj.getItemCode()); stockAllocMap.put("ITEM_CODE",worderStkBeanObj.getItemCode());
...@@ -2288,11 +2545,15 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi ...@@ -2288,11 +2545,15 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi
} }
else else
{ {
worderStkBeanObj.setUpdQty(worderStkBeanObj.getAllocQty() - deallocQty); worderStkBeanObj.setUpdQty(Double.parseDouble(df.format(worderStkBeanObj.getAllocQty() - deallocQty)));
worderStkBeanObj.setAllocQty(worderStkBeanObj.getAllocQty() - deallocQty); worderStkBeanObj.setAllocQty(Double.parseDouble(df.format(worderStkBeanObj.getAllocQty() - deallocQty)));
worderStkBeanList.set(potencyCtr, worderStkBeanObj); worderStkBeanList.set(potencyCtr, worderStkBeanObj);
System.out.println("Same wo/expLev(N) after deallocate worderStkBeanObj->workOrder["+worderStkBeanObj.getWorkOrder()+"] expLevel ["+worderStkBeanObj.getExpLevel()+"]ItemCode["+worderStkBeanObj.getItemCode()+"]LotNo["+worderStkBeanObj.getLotNo()+"]LotSl["+worderStkBeanObj.getLotSl()+"]LocCode["+worderStkBeanObj.getLocCode()+"]SiteCode["+worderStkBeanObj.getSiteCode()+"]AllocQty["+worderStkBeanObj.getAllocQty()+"]Stock Quantity["+worderStkBeanObj.getStkQuantity()+"]getQuantity["+worderStkBeanObj.getQuantity()+"]PotencyAdj["+worderStkBeanObj.getPotencyAdj()+"] Qty Adj["+worderStkBeanObj.getQtyAdj()+"]UpdQty["+worderStkBeanObj.getUpdQty()+"] Stock Sufficient["+worderStkBeanObj.getStockSufficient()+"]getCritItem["+worderStkBeanObj.getCritItem()+"]MinReqQty["+worderStkBeanObj.getMinQtyReq()+"]StockPotencyPerc["+worderStkBeanObj.getStkPotencyPerc()+"]OtherSiteYN["+worderStkBeanObj.getOtherSiteYN()+"]getAlternate["+worderStkBeanObj.getAlternate()+"] MfgDate["+worderStkBeanObj.getMfgDate()+"]ExpDate["+worderStkBeanObj.getExpDate()+"SiteCodeMfg["+worderStkBeanObj.getSiteCodeMfg()+"]ReserveLineNo["+worderStkBeanObj.getReserveLineNo()+"]ReserveStkTranId["+worderStkBeanObj.getReserveStkTranId()+"]Unit["+worderStkBeanObj.getUnit()+"]"); System.out.println("Same wo/expLev(N) after deallocate worderStkBeanObj->workOrder["+worderStkBeanObj.getWorkOrder()+"] expLevel ["+worderStkBeanObj.getExpLevel()+"]ItemCode["+worderStkBeanObj.getItemCode()+"]LotNo["+worderStkBeanObj.getLotNo()+"]LotSl["+worderStkBeanObj.getLotSl()+"]LocCode["+worderStkBeanObj.getLocCode()+"]SiteCode["+worderStkBeanObj.getSiteCode()+"]AllocQty["+worderStkBeanObj.getAllocQty()+"]Stock Quantity["+worderStkBeanObj.getStkQuantity()+"]getQuantity["+worderStkBeanObj.getQuantity()+"]PotencyAdj["+worderStkBeanObj.getPotencyAdj()+"] Qty Adj["+worderStkBeanObj.getQtyAdj()+"]UpdQty["+worderStkBeanObj.getUpdQty()+"] Stock Sufficient["+worderStkBeanObj.getStockSufficient()+"]getCritItem["+worderStkBeanObj.getCritItem()+"]MinReqQty["+worderStkBeanObj.getMinQtyReq()+"]StockPotencyPerc["+worderStkBeanObj.getStkPotencyPerc()+"]OtherSiteYN["+worderStkBeanObj.getOtherSiteYN()+"]getAlternate["+worderStkBeanObj.getAlternate()+"] MfgDate["+worderStkBeanObj.getMfgDate()+"]ExpDate["+worderStkBeanObj.getExpDate()+"] SiteCodeMfg["+worderStkBeanObj.getSiteCodeMfg()+"]ReserveLineNo["+worderStkBeanObj.getReserveLineNo()+"]ReserveStkTranId["+worderStkBeanObj.getReserveStkTranId()+"]Unit["+worderStkBeanObj.getUnit()+"]");
} }
// 02-jun-16 manoharan
worderExpLevSufficient.put(worderStkBeanObj.getWorkOrder()+":"+worderStkBeanObj.getExpLevel(), true);
updateWoBeanSufficient(worderStkBeanObj.getWorkOrder(), worderStkBeanObj.getExpLevel(), "Y");
} }
} }
...@@ -2303,19 +2564,22 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi ...@@ -2303,19 +2564,22 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi
worderStkBeanObj = (WorderStkBean) worderStkBeanList.get(potencyCtr); worderStkBeanObj = (WorderStkBean) worderStkBeanList.get(potencyCtr);
if(workOrderPotency.trim().equalsIgnoreCase(worderStkBeanObj.getWorkOrder().trim()) && expLevelNew.trim().equalsIgnoreCase(worderStkBeanObj.getExpLevel().trim())) if(workOrderPotency.trim().equalsIgnoreCase(worderStkBeanObj.getWorkOrder().trim()) && expLevelNew.trim().equalsIgnoreCase(worderStkBeanObj.getExpLevel().trim()))
{ {
allocatedQty = worderStkBeanObj.getQuantity(); allocatedQty = worderStkBeanObj.getAllocQty();
// -13.015 34.988 34.988 // -13.015 34.988 34.988
potencyAdjLot = potencyAdjExpLev / adjPotencyExpLevel.getValue() * allocatedQty; System.out.println("Adjustment expLevel ["+worderStkBeanObj.getExpLevel()+"] AllocQty["+worderStkBeanObj.getAllocQty()+"] potencyAdjExpLev [" + potencyAdjExpLev+ "] .getValue() [" + adjPotencyExpLevel.getValue() + "] quantityReqExpLev[" + quantityReqExpLev + "]" );
//potencyAdjLot = potencyAdjExpLev / adjPotencyExpLevel.getValue() * allocatedQty;
potencyAdjLot = potencyAdjExpLev / quantityReqExpLev * allocatedQty;
potencyAdjLot = Double.parseDouble(df.format(potencyAdjLot)); potencyAdjLot = Double.parseDouble(df.format(potencyAdjLot));
quantityReqLot = allocatedQty + potencyAdjLot; quantityReqLot = allocatedQty - potencyAdjLot;
quantityReqLot = Double.parseDouble(df.format(quantityReqLot)); quantityReqLot = Double.parseDouble(df.format(quantityReqLot));
System.out.println("Same wo/expLev(N) before recalculate worderStkBeanObj->workOrder["+worderStkBeanObj.getWorkOrder()+"] expLevel ["+worderStkBeanObj.getExpLevel()+"]ItemCode["+worderStkBeanObj.getItemCode()+"]LotNo["+worderStkBeanObj.getLotNo()+"]LotSl["+worderStkBeanObj.getLotSl()+"]LocCode["+worderStkBeanObj.getLocCode()+"]SiteCode["+worderStkBeanObj.getSiteCode()+"]AllocQty["+worderStkBeanObj.getAllocQty()+"]Stock Quantity["+worderStkBeanObj.getStkQuantity()+"]getQuantity["+worderStkBeanObj.getQuantity()+"]PotencyAdj["+worderStkBeanObj.getPotencyAdj()+"] Qty Adj["+worderStkBeanObj.getQtyAdj()+"]UpdQty["+worderStkBeanObj.getUpdQty()+"] Stock Sufficient["+worderStkBeanObj.getStockSufficient()+"]getCritItem["+worderStkBeanObj.getCritItem()+"]MinReqQty["+worderStkBeanObj.getMinQtyReq()+"]StockPotencyPerc["+worderStkBeanObj.getStkPotencyPerc()+"]OtherSiteYN["+worderStkBeanObj.getOtherSiteYN()+"]getAlternate["+worderStkBeanObj.getAlternate()+"] MfgDate["+worderStkBeanObj.getMfgDate()+"]ExpDate["+worderStkBeanObj.getExpDate()+"SiteCodeMfg["+worderStkBeanObj.getSiteCodeMfg()+"]ReserveLineNo["+worderStkBeanObj.getReserveLineNo()+"]ReserveStkTranId["+worderStkBeanObj.getReserveStkTranId()+"]Unit["+worderStkBeanObj.getUnit()+"]"); System.out.println("Same wo/expLev(N) before recalculate worderStkBeanObj->workOrder["+worderStkBeanObj.getWorkOrder()+"] expLevel ["+worderStkBeanObj.getExpLevel()+"]ItemCode["+worderStkBeanObj.getItemCode()+"]LotNo["+worderStkBeanObj.getLotNo()+"]LotSl["+worderStkBeanObj.getLotSl()+"]LocCode["+worderStkBeanObj.getLocCode()+"]SiteCode["+worderStkBeanObj.getSiteCode()+"]AllocQty["+worderStkBeanObj.getAllocQty()+"]Stock Quantity["+worderStkBeanObj.getStkQuantity()+"]getQuantity["+worderStkBeanObj.getQuantity()+"]PotencyAdj["+worderStkBeanObj.getPotencyAdj()+"] Qty Adj["+worderStkBeanObj.getQtyAdj()+"]UpdQty["+worderStkBeanObj.getUpdQty()+"] Stock Sufficient["+worderStkBeanObj.getStockSufficient()+"]getCritItem["+worderStkBeanObj.getCritItem()+"]MinReqQty["+worderStkBeanObj.getMinQtyReq()+"]StockPotencyPerc["+worderStkBeanObj.getStkPotencyPerc()+"]OtherSiteYN["+worderStkBeanObj.getOtherSiteYN()+"]getAlternate["+worderStkBeanObj.getAlternate()+"] MfgDate["+worderStkBeanObj.getMfgDate()+"]ExpDate["+worderStkBeanObj.getExpDate()+"] SiteCodeMfg["+worderStkBeanObj.getSiteCodeMfg()+"]ReserveLineNo["+worderStkBeanObj.getReserveLineNo()+"]ReserveStkTranId["+worderStkBeanObj.getReserveStkTranId()+"]Unit["+worderStkBeanObj.getUnit()+"]");
worderStkBeanObj.setQtyAdj(potencyAdjLot); worderStkBeanObj.setQtyAdj(potencyAdjLot);
worderStkBeanObj.setPotencyAdj(potencyAdjLot); worderStkBeanObj.setPotencyAdj(potencyAdjLot);
//worderStkBeanObj.setQuantity(quantityReqLot); worderStkBeanObj.setQuantity(quantityReqLot);
worderStkBeanObj.setUpdQty(quantityReqLot); //worderStkBeanObj.setUpdQty(quantityReqLot);
worderStkBeanObj.setAllocQty(quantityReqLot); //worderStkBeanObj.setAllocQty(quantityReqLot);
System.out.println("Same wo/expLev(N) after recalculate worderStkBeanObj->workOrder["+worderStkBeanObj.getWorkOrder()+"] expLevel ["+worderStkBeanObj.getExpLevel()+"]ItemCode["+worderStkBeanObj.getItemCode()+"]LotNo["+worderStkBeanObj.getLotNo()+"]LotSl["+worderStkBeanObj.getLotSl()+"]LocCode["+worderStkBeanObj.getLocCode()+"]SiteCode["+worderStkBeanObj.getSiteCode()+"]AllocQty["+worderStkBeanObj.getAllocQty()+"]Stock Quantity["+worderStkBeanObj.getStkQuantity()+"]getQuantity["+worderStkBeanObj.getQuantity()+"]PotencyAdj["+worderStkBeanObj.getPotencyAdj()+"] Qty Adj["+worderStkBeanObj.getQtyAdj()+"]UpdQty["+worderStkBeanObj.getUpdQty()+"] Stock Sufficient["+worderStkBeanObj.getStockSufficient()+"]getCritItem["+worderStkBeanObj.getCritItem()+"]MinReqQty["+worderStkBeanObj.getMinQtyReq()+"]StockPotencyPerc["+worderStkBeanObj.getStkPotencyPerc()+"]OtherSiteYN["+worderStkBeanObj.getOtherSiteYN()+"]getAlternate["+worderStkBeanObj.getAlternate()+"] MfgDate["+worderStkBeanObj.getMfgDate()+"]ExpDate["+worderStkBeanObj.getExpDate()+"SiteCodeMfg["+worderStkBeanObj.getSiteCodeMfg()+"]ReserveLineNo["+worderStkBeanObj.getReserveLineNo()+"]ReserveStkTranId["+worderStkBeanObj.getReserveStkTranId()+"]Unit["+worderStkBeanObj.getUnit()+"]"); System.out.println("Same wo/expLev(N) after recalculate worderStkBeanObj->workOrder["+worderStkBeanObj.getWorkOrder()+"] expLevel ["+worderStkBeanObj.getExpLevel()+"]ItemCode["+worderStkBeanObj.getItemCode()+"]LotNo["+worderStkBeanObj.getLotNo()+"]LotSl["+worderStkBeanObj.getLotSl()+"]LocCode["+worderStkBeanObj.getLocCode()+"]SiteCode["+worderStkBeanObj.getSiteCode()+"]AllocQty["+worderStkBeanObj.getAllocQty()+"]Stock Quantity["+worderStkBeanObj.getStkQuantity()+"]getQuantity["+worderStkBeanObj.getQuantity()+"]PotencyAdj["+worderStkBeanObj.getPotencyAdj()+"] Qty Adj["+worderStkBeanObj.getQtyAdj()+"]UpdQty["+worderStkBeanObj.getUpdQty()+"] Stock Sufficient["+worderStkBeanObj.getStockSufficient()+"]getCritItem["+worderStkBeanObj.getCritItem()+"]MinReqQty["+worderStkBeanObj.getMinQtyReq()+"]StockPotencyPerc["+worderStkBeanObj.getStkPotencyPerc()+"]OtherSiteYN["+worderStkBeanObj.getOtherSiteYN()+"]getAlternate["+worderStkBeanObj.getAlternate()+"] MfgDate["+worderStkBeanObj.getMfgDate()+"]ExpDate["+worderStkBeanObj.getExpDate()+"] SiteCodeMfg["+worderStkBeanObj.getSiteCodeMfg()+"]ReserveLineNo["+worderStkBeanObj.getReserveLineNo()+"]ReserveStkTranId["+worderStkBeanObj.getReserveStkTranId()+"]Unit["+worderStkBeanObj.getUnit()+"]");
worderStkBeanList.set(potencyCtr, worderStkBeanObj);// 09-mar-16 manoharan added for index based worderStkBeanList.set(potencyCtr, worderStkBeanObj);// 09-mar-16 manoharan added for index based
} }
} }
...@@ -2392,7 +2656,7 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi ...@@ -2392,7 +2656,7 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi
potencyAdjLot = Double.parseDouble(df.format(potencyAdjLot)); potencyAdjLot = Double.parseDouble(df.format(potencyAdjLot));
quantityReqLot = allocatedQty - potencyAdjLot; quantityReqLot = allocatedQty - potencyAdjLot;
quantityReqLot = Double.parseDouble(df.format(quantityReqLot)); quantityReqLot = Double.parseDouble(df.format(quantityReqLot));
System.out.println("Same wo/expLev(N) before recalculate worderStkBeanObj->workOrder["+worderStkBeanObj.getWorkOrder()+"] expLevel ["+worderStkBeanObj.getExpLevel()+"]ItemCode["+worderStkBeanObj.getItemCode()+"]LotNo["+worderStkBeanObj.getLotNo()+"]LotSl["+worderStkBeanObj.getLotSl()+"]LocCode["+worderStkBeanObj.getLocCode()+"]SiteCode["+worderStkBeanObj.getSiteCode()+"]AllocQty["+worderStkBeanObj.getAllocQty()+"]Stock Quantity["+worderStkBeanObj.getStkQuantity()+"]getQuantity["+worderStkBeanObj.getQuantity()+"]PotencyAdj["+worderStkBeanObj.getPotencyAdj()+"] Qty Adj["+worderStkBeanObj.getQtyAdj()+"]UpdQty["+worderStkBeanObj.getUpdQty()+"] Stock Sufficient["+worderStkBeanObj.getStockSufficient()+"]getCritItem["+worderStkBeanObj.getCritItem()+"]MinReqQty["+worderStkBeanObj.getMinQtyReq()+"]StockPotencyPerc["+worderStkBeanObj.getStkPotencyPerc()+"]OtherSiteYN["+worderStkBeanObj.getOtherSiteYN()+"]getAlternate["+worderStkBeanObj.getAlternate()+"] MfgDate["+worderStkBeanObj.getMfgDate()+"]ExpDate["+worderStkBeanObj.getExpDate()+"SiteCodeMfg["+worderStkBeanObj.getSiteCodeMfg()+"]ReserveLineNo["+worderStkBeanObj.getReserveLineNo()+"]ReserveStkTranId["+worderStkBeanObj.getReserveStkTranId()+"]Unit["+worderStkBeanObj.getUnit()+"]"); System.out.println("Same wo/expLev(N) before recalculate worderStkBeanObj->workOrder["+worderStkBeanObj.getWorkOrder()+"] expLevel ["+worderStkBeanObj.getExpLevel()+"]ItemCode["+worderStkBeanObj.getItemCode()+"]LotNo["+worderStkBeanObj.getLotNo()+"]LotSl["+worderStkBeanObj.getLotSl()+"]LocCode["+worderStkBeanObj.getLocCode()+"]SiteCode["+worderStkBeanObj.getSiteCode()+"]AllocQty["+worderStkBeanObj.getAllocQty()+"]Stock Quantity["+worderStkBeanObj.getStkQuantity()+"]getQuantity["+worderStkBeanObj.getQuantity()+"]PotencyAdj["+worderStkBeanObj.getPotencyAdj()+"] Qty Adj["+worderStkBeanObj.getQtyAdj()+"]UpdQty["+worderStkBeanObj.getUpdQty()+"] Stock Sufficient["+worderStkBeanObj.getStockSufficient()+"]getCritItem["+worderStkBeanObj.getCritItem()+"]MinReqQty["+worderStkBeanObj.getMinQtyReq()+"]StockPotencyPerc["+worderStkBeanObj.getStkPotencyPerc()+"]OtherSiteYN["+worderStkBeanObj.getOtherSiteYN()+"]getAlternate["+worderStkBeanObj.getAlternate()+"] MfgDate["+worderStkBeanObj.getMfgDate()+"]ExpDate["+worderStkBeanObj.getExpDate()+"] SiteCodeMfg["+worderStkBeanObj.getSiteCodeMfg()+"]ReserveLineNo["+worderStkBeanObj.getReserveLineNo()+"]ReserveStkTranId["+worderStkBeanObj.getReserveStkTranId()+"]Unit["+worderStkBeanObj.getUnit()+"]");
worderStkBeanObj.setQtyAdj(potencyAdjLot); worderStkBeanObj.setQtyAdj(potencyAdjLot);
worderStkBeanObj.setPotencyAdj(potencyAdjLot); worderStkBeanObj.setPotencyAdj(potencyAdjLot);
System.out.println("manohar before .setQuantity 5["+worderStkBeanObj.getQuantity()+"]"); System.out.println("manohar before .setQuantity 5["+worderStkBeanObj.getQuantity()+"]");
...@@ -2400,7 +2664,7 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi ...@@ -2400,7 +2664,7 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi
System.out.println("manohar after .setQuantity 5["+worderStkBeanObj.getQuantity()+"]"); System.out.println("manohar after .setQuantity 5["+worderStkBeanObj.getQuantity()+"]");
worderStkBeanObj.setUpdQty(allocatedQty); worderStkBeanObj.setUpdQty(allocatedQty);
worderStkBeanObj.setAllocQty(allocatedQty); worderStkBeanObj.setAllocQty(allocatedQty);
System.out.println("Same wo/expLev(N) after recalculate worderStkBeanObj->workOrder["+worderStkBeanObj.getWorkOrder()+"] expLevel ["+worderStkBeanObj.getExpLevel()+"]ItemCode["+worderStkBeanObj.getItemCode()+"]LotNo["+worderStkBeanObj.getLotNo()+"]LotSl["+worderStkBeanObj.getLotSl()+"]LocCode["+worderStkBeanObj.getLocCode()+"]SiteCode["+worderStkBeanObj.getSiteCode()+"]AllocQty["+worderStkBeanObj.getAllocQty()+"]Stock Quantity["+worderStkBeanObj.getStkQuantity()+"]getQuantity["+worderStkBeanObj.getQuantity()+"]PotencyAdj["+worderStkBeanObj.getPotencyAdj()+"] Qty Adj["+worderStkBeanObj.getQtyAdj()+"]UpdQty["+worderStkBeanObj.getUpdQty()+"] Stock Sufficient["+worderStkBeanObj.getStockSufficient()+"]getCritItem["+worderStkBeanObj.getCritItem()+"]MinReqQty["+worderStkBeanObj.getMinQtyReq()+"]StockPotencyPerc["+worderStkBeanObj.getStkPotencyPerc()+"]OtherSiteYN["+worderStkBeanObj.getOtherSiteYN()+"]getAlternate["+worderStkBeanObj.getAlternate()+"] MfgDate["+worderStkBeanObj.getMfgDate()+"]ExpDate["+worderStkBeanObj.getExpDate()+"SiteCodeMfg["+worderStkBeanObj.getSiteCodeMfg()+"]ReserveLineNo["+worderStkBeanObj.getReserveLineNo()+"]ReserveStkTranId["+worderStkBeanObj.getReserveStkTranId()+"]Unit["+worderStkBeanObj.getUnit()+"]"); System.out.println("Same wo/expLev(N) after recalculate worderStkBeanObj->workOrder["+worderStkBeanObj.getWorkOrder()+"] expLevel ["+worderStkBeanObj.getExpLevel()+"]ItemCode["+worderStkBeanObj.getItemCode()+"]LotNo["+worderStkBeanObj.getLotNo()+"]LotSl["+worderStkBeanObj.getLotSl()+"]LocCode["+worderStkBeanObj.getLocCode()+"]SiteCode["+worderStkBeanObj.getSiteCode()+"]AllocQty["+worderStkBeanObj.getAllocQty()+"]Stock Quantity["+worderStkBeanObj.getStkQuantity()+"]getQuantity["+worderStkBeanObj.getQuantity()+"]PotencyAdj["+worderStkBeanObj.getPotencyAdj()+"] Qty Adj["+worderStkBeanObj.getQtyAdj()+"]UpdQty["+worderStkBeanObj.getUpdQty()+"] Stock Sufficient["+worderStkBeanObj.getStockSufficient()+"]getCritItem["+worderStkBeanObj.getCritItem()+"]MinReqQty["+worderStkBeanObj.getMinQtyReq()+"]StockPotencyPerc["+worderStkBeanObj.getStkPotencyPerc()+"]OtherSiteYN["+worderStkBeanObj.getOtherSiteYN()+"]getAlternate["+worderStkBeanObj.getAlternate()+"] MfgDate["+worderStkBeanObj.getMfgDate()+"]ExpDate["+worderStkBeanObj.getExpDate()+"] SiteCodeMfg["+worderStkBeanObj.getSiteCodeMfg()+"]ReserveLineNo["+worderStkBeanObj.getReserveLineNo()+"]ReserveStkTranId["+worderStkBeanObj.getReserveStkTranId()+"]Unit["+worderStkBeanObj.getUnit()+"]");
worderStkBeanList.set(potencyCtr, worderStkBeanObj); worderStkBeanList.set(potencyCtr, worderStkBeanObj);
} }
...@@ -2424,8 +2688,13 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi ...@@ -2424,8 +2688,13 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi
if (foundIndex > -1) // already exists add alloc_qty and petencyadj to existing if (foundIndex > -1) // already exists add alloc_qty and petencyadj to existing
{ {
worderStkBeanObj = (WorderStkBean) worderStkBeanList.get(foundIndex); worderStkBeanObj = (WorderStkBean) worderStkBeanList.get(foundIndex);
worderStkBeanObj.setAllocQty(worderStkBeanObj.getAllocQty() + tempStkObj.getAllocQty()); System.out.println("manohar before templist merge 1 .getExpLevel [" + worderStkBeanObj.getExpLevel() +"] .setQuantity ["+worderStkBeanObj.getQuantity()+"] .setAllocQty [" + worderStkBeanObj.getAllocQty() + "] .setUpdQty [" + worderStkBeanObj.getUpdQty() + "] .setPotencyAdj( [" +worderStkBeanObj.getPotencyAdj() + "] .setQtyAdj(" + worderStkBeanObj.getQtyAdj() + "]" );
worderStkBeanObj.setPotencyAdj(worderStkBeanObj.getPotencyAdj() + tempStkObj.getPotencyAdj()); worderStkBeanObj.setAllocQty(Double.parseDouble(df.format(worderStkBeanObj.getAllocQty() + tempStkObj.getAllocQty())));
worderStkBeanObj.setPotencyAdj(Double.parseDouble(df.format(worderStkBeanObj.getPotencyAdj() + tempStkObj.getPotencyAdj())));
worderStkBeanObj.setQtyAdj(Double.parseDouble(df.format(worderStkBeanObj.getQtyAdj() + tempStkObj.getQtyAdj())));
worderStkBeanObj.setUpdQty(Double.parseDouble(df.format(worderStkBeanObj.getUpdQty() + tempStkObj.getUpdQty())));
System.out.println("manohar after templist merge 1 .getExpLevel [" + worderStkBeanObj.getExpLevel() +"] .setQuantity ["+worderStkBeanObj.getQuantity()+"] .setAllocQty [" + worderStkBeanObj.getAllocQty() + "] .setUpdQty [" + worderStkBeanObj.getUpdQty() + "] .setPotencyAdj( [" +worderStkBeanObj.getPotencyAdj() + "] .setQtyAdj(" + worderStkBeanObj.getQtyAdj() + "]" );
worderStkBeanList.set(foundIndex,worderStkBeanObj);//wasim worderStkBeanList.set(foundIndex,worderStkBeanObj);//wasim
} }
else else
...@@ -2440,8 +2709,10 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi ...@@ -2440,8 +2709,10 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi
for(int potencyCtr = 0; potencyCtr < worderStkBeanList.size(); potencyCtr++) for(int potencyCtr = 0; potencyCtr < worderStkBeanList.size(); potencyCtr++)
{ {
worderStkBeanObj = (WorderStkBean) worderStkBeanList.get(potencyCtr); worderStkBeanObj = (WorderStkBean) worderStkBeanList.get(potencyCtr);
System.out.println("After potency calculation worderStkBeanObj->workOrder["+worderStkBeanObj.getWorkOrder()+"] expLevel ["+worderStkBeanObj.getExpLevel()+"]ItemCode["+worderStkBeanObj.getItemCode()+"]LotNo["+worderStkBeanObj.getLotNo()+"]LotSl["+worderStkBeanObj.getLotSl()+"]LocCode["+worderStkBeanObj.getLocCode()+"]SiteCode["+worderStkBeanObj.getSiteCode()+"]AllocQty["+worderStkBeanObj.getAllocQty()+"]Stock Quantity["+worderStkBeanObj.getStkQuantity()+"]getQuantity["+worderStkBeanObj.getQuantity()+"]PotencyAdj["+worderStkBeanObj.getPotencyAdj()+"] Qty Adj["+worderStkBeanObj.getQtyAdj()+"]UpdQty["+worderStkBeanObj.getUpdQty()+"] Stock Sufficient["+worderStkBeanObj.getStockSufficient()+"]getCritItem["+worderStkBeanObj.getCritItem()+"]MinReqQty["+worderStkBeanObj.getMinQtyReq()+"]StockPotencyPerc["+worderStkBeanObj.getStkPotencyPerc()+"]OtherSiteYN["+worderStkBeanObj.getOtherSiteYN()+"]getAlternate["+worderStkBeanObj.getAlternate()+"] MfgDate["+worderStkBeanObj.getMfgDate()+"]ExpDate["+worderStkBeanObj.getExpDate()+"SiteCodeMfg["+worderStkBeanObj.getSiteCodeMfg()+"]ReserveLineNo["+worderStkBeanObj.getReserveLineNo()+"]ReserveStkTranId["+worderStkBeanObj.getReserveStkTranId()+"]Unit["+worderStkBeanObj.getUnit()+"]"); System.out.println("After potency calculation worderStkBeanObj->workOrder["+worderStkBeanObj.getWorkOrder()+"] expLevel ["+worderStkBeanObj.getExpLevel()+"]ItemCode["+worderStkBeanObj.getItemCode()+"]LotNo["+worderStkBeanObj.getLotNo()+"]LotSl["+worderStkBeanObj.getLotSl()+"]LocCode["+worderStkBeanObj.getLocCode()+"]SiteCode["+worderStkBeanObj.getSiteCode()+"]AllocQty["+worderStkBeanObj.getAllocQty()+"]Stock Quantity["+worderStkBeanObj.getStkQuantity()+"]getQuantity["+worderStkBeanObj.getQuantity()+"]PotencyAdj["+worderStkBeanObj.getPotencyAdj()+"] Qty Adj["+worderStkBeanObj.getQtyAdj()+"]UpdQty["+worderStkBeanObj.getUpdQty()+"] Stock Sufficient["+worderStkBeanObj.getStockSufficient()+"]getCritItem["+worderStkBeanObj.getCritItem()+"]MinReqQty["+worderStkBeanObj.getMinQtyReq()+"]StockPotencyPerc["+worderStkBeanObj.getStkPotencyPerc()+"]OtherSiteYN["+worderStkBeanObj.getOtherSiteYN()+"]getAlternate["+worderStkBeanObj.getAlternate()+"] MfgDate["+worderStkBeanObj.getMfgDate()+"]ExpDate["+worderStkBeanObj.getExpDate()+"] SiteCodeMfg["+worderStkBeanObj.getSiteCodeMfg()+"]ReserveLineNo["+worderStkBeanObj.getReserveLineNo()+"]ReserveStkTranId["+worderStkBeanObj.getReserveStkTranId()+"]Unit["+worderStkBeanObj.getUnit()+"]");
} }
System.out.println("After potency calculation worderExpLevSufficient["+worderExpLevSufficient+"]");
} }
catch( Exception e) catch( Exception e)
...@@ -2476,7 +2747,7 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi ...@@ -2476,7 +2747,7 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi
private Map<String,String> checkReserveStock(Map<String,String> worderDetailMap,Connection conn) throws ITMException, Exception private Map<String,String> checkReserveStock(Map<String,String> worderDetailMap,Connection conn) throws ITMException, Exception
{ {
ResultSet rs = null,rs1 = null; ResultSet rs = null,rs1 = null;
PreparedStatement pstmt = null,pstmt1 = null; PreparedStatement pstmt = null,pstmt1 = null, pstmtUpd = null;
StringBuffer reserveStkSql = new StringBuffer(); StringBuffer reserveStkSql = new StringBuffer();
MfgCommon mfgCommon = new MfgCommon(); MfgCommon mfgCommon = new MfgCommon();
Map<String,String> returnMapDetails = new HashMap<String,String>(); Map<String,String> returnMapDetails = new HashMap<String,String>();
...@@ -2492,6 +2763,7 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi ...@@ -2492,6 +2763,7 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi
ArrayList<String> altItemCodeList = new ArrayList<String>(); ArrayList<String> altItemCodeList = new ArrayList<String>();
ArrayList<String> invAllocateTranIDList = new ArrayList<String>(); ArrayList<String> invAllocateTranIDList = new ArrayList<String>();
WorderStkBean worderStkBeanObj = null; WorderStkBean worderStkBeanObj = null;
java.sql.Timestamp expDate = null, mfgDate = null;
try try
{ {
Calendar currentDate = Calendar.getInstance(); Calendar currentDate = Calendar.getInstance();
...@@ -2545,6 +2817,12 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi ...@@ -2545,6 +2817,12 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi
System.out.println("Min Quantity Required="+minQtyReq); System.out.println("Min Quantity Required="+minQtyReq);
//Changed by wasim on 29-02-2016 to get min quantity required [END] //Changed by wasim on 29-02-2016 to get min quantity required [END]
// 03-jun-16 manoharan
sql = "update inv_alloc_det set dealloc_qty = (case when dealloc_qty is null then 0 else dealloc_qty end) + ?, deallocated = case when quantity = ? then 'Y' else 'N' end where tran_id = ? and line_no = ?";
pstmtUpd = conn.prepareStatement(sql);
// end 03-jun-16 manoharan
System.out.println("isSufficient------>>["+isSufficient+"]"); System.out.println("isSufficient------>>["+isSufficient+"]");
if(invAllocateTranIDList.size() > 0) if(invAllocateTranIDList.size() > 0)
{ {
...@@ -2611,7 +2889,7 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi ...@@ -2611,7 +2889,7 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi
reserveStkSql.append("select inv_alloc_det.line_no,inv_alloc_det.loc_code,inv_alloc_det.lot_no,inv_alloc_det.lot_sl," ); reserveStkSql.append("select inv_alloc_det.line_no,inv_alloc_det.loc_code,inv_alloc_det.lot_no,inv_alloc_det.lot_sl," );
//reserveStkSql.append(" (CASE WHEN inv_alloc_det.quantity IS NULL THEN 0 ELSE inv_alloc_det.quantity END - CASE WHEN inv_alloc_det.dealloc_qty IS NULL THEN 0 ELSE inv_alloc_det.dealloc_qty END )as inv_qty from inv_alloc_det,stock,location,invstat " ); //reserveStkSql.append(" (CASE WHEN inv_alloc_det.quantity IS NULL THEN 0 ELSE inv_alloc_det.quantity END - CASE WHEN inv_alloc_det.dealloc_qty IS NULL THEN 0 ELSE inv_alloc_det.dealloc_qty END )as inv_qty from inv_alloc_det,stock,location,invstat " );
reserveStkSql.append(" (CASE WHEN inv_alloc_det.quantity IS NULL THEN 0 ELSE inv_alloc_det.quantity END - CASE WHEN inv_alloc_det.dealloc_qty IS NULL THEN 0 ELSE inv_alloc_det.dealloc_qty END )as inv_qty, " ); reserveStkSql.append(" (CASE WHEN inv_alloc_det.quantity IS NULL THEN 0 ELSE inv_alloc_det.quantity END - CASE WHEN inv_alloc_det.dealloc_qty IS NULL THEN 0 ELSE inv_alloc_det.dealloc_qty END )as inv_qty, " );
reserveStkSql.append(" stock.potency_perc, inv_alloc_det.exp_lev,stock.quantity - case when stock.alloc_qty is null then 0 else stock.alloc_qty end as stk_qty from inv_alloc_det,stock,location,invstat " ); reserveStkSql.append(" stock.potency_perc, inv_alloc_det.exp_lev,stock.quantity - case when stock.alloc_qty is null then 0 else stock.alloc_qty end as stk_qty,stock.exp_date,stock.mfg_date from inv_alloc_det,stock,location,invstat " );
reserveStkSql.append( "where inv_alloc_det.tran_id ='" + tranID + "' and inv_alloc_det.item_code ='"+ itemCode + "'" ); reserveStkSql.append( "where inv_alloc_det.tran_id ='" + tranID + "' and inv_alloc_det.item_code ='"+ itemCode + "'" );
reserveStkSql.append(" and (length(rtrim(ltrim(inv_alloc_det.exp_lev))) = 0 or inv_alloc_det.exp_lev is null) " ); reserveStkSql.append(" and (length(rtrim(ltrim(inv_alloc_det.exp_lev))) = 0 or inv_alloc_det.exp_lev is null) " );
...@@ -2696,6 +2974,8 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi ...@@ -2696,6 +2974,8 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi
reserveStkQty = rs.getDouble("inv_qty"); reserveStkQty = rs.getDouble("inv_qty");
stkPotencyPerc = rs.getDouble("potency_perc"); stkPotencyPerc = rs.getDouble("potency_perc");
stkAvailQuantity = rs.getDouble("stk_qty"); stkAvailQuantity = rs.getDouble("stk_qty");
expDate = rs.getTimestamp("exp_date");
mfgDate = rs.getTimestamp("mfg_date");
//Changed by wasim on 29-01-2016 to continue if min_req_qty greater than stock qty [START] //Changed by wasim on 29-01-2016 to continue if min_req_qty greater than stock qty [START]
if(reserveStkQty < minQtyReq) if(reserveStkQty < minQtyReq)
...@@ -2719,13 +2999,15 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi ...@@ -2719,13 +2999,15 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi
worderStkBeanObj.setSiteCode(siteCode); worderStkBeanObj.setSiteCode(siteCode);
worderStkBeanObj.setItemCode(itemCode); worderStkBeanObj.setItemCode(itemCode);
worderStkBeanObj.setStkQuantity(stkAvailQuantity); worderStkBeanObj.setStkQuantity(stkAvailQuantity + reserveStkQty);
worderStkBeanObj.setReserveStkQty(reserveStkQty); worderStkBeanObj.setReserveStkQty(reserveStkQty);
worderStkBeanObj.setItemDescr(itemDescr); worderStkBeanObj.setItemDescr(itemDescr);
worderStkBeanObj.setStkPotencyPerc(stkPotencyPerc); worderStkBeanObj.setStkPotencyPerc(stkPotencyPerc);
worderStkBeanObj.setWorkOrder(worder); worderStkBeanObj.setWorkOrder(worder);
worderStkBeanObj.setExpLevel(expLevel); worderStkBeanObj.setExpLevel(expLevel);
worderStkBeanObj.setMfgDate(mfgDate);
worderStkBeanObj.setExpDate(expDate);
worderStkBeanObj.setItemRef(itemRef); worderStkBeanObj.setItemRef(itemRef);
worderStkBeanObj.setCritItem(critItem); worderStkBeanObj.setCritItem(critItem);
worderStkBeanObj.setUnit(unit); worderStkBeanObj.setUnit(unit);
...@@ -2744,6 +3026,12 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi ...@@ -2744,6 +3026,12 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi
worderStkBeanObj.setQuantity(reserveStkQty); worderStkBeanObj.setQuantity(reserveStkQty);
System.out.println("manohar after .setQuantity 6["+worderStkBeanObj.getQuantity()+"]"); System.out.println("manohar after .setQuantity 6["+worderStkBeanObj.getQuantity()+"]");
pstmtUpd.setDouble(1, worderStkBeanObj.getReserveStkQty());
pstmtUpd.setDouble(2, worderStkBeanObj.getReserveStkQty());
pstmtUpd.setString(3,worderStkBeanObj.getReserveStkTranId());
pstmtUpd.setInt(4,worderStkBeanObj.getReserveLineNo());
pstmtUpd.addBatch();
pstmtUpd.clearParameters();
stkKey = invLocCode+":"+invLotNo+":"+invLotSl+":"+siteCode+":"+itemCode; stkKey = invLocCode+":"+invLotNo+":"+invLotSl+":"+siteCode+":"+itemCode;
//System.out.println("requiredQty------>>["+requiredQty+"]"); //System.out.println("requiredQty------>>["+requiredQty+"]");
...@@ -2839,6 +3127,12 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi ...@@ -2839,6 +3127,12 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi
returnMapDetails.put("IS_SUFFICIENT", "false"); returnMapDetails.put("IS_SUFFICIENT", "false");
} }
// 20-may-16 manoharan update dealloc_qty in inv_alloc_det // 20-may-16 manoharan update dealloc_qty in inv_alloc_det
pstmtUpd.executeBatch();
if(pstmtUpd !=null)
{
pstmtUpd.close();pstmtUpd = null;
}
/*
if (worderStkBeanList.size() > 0) if (worderStkBeanList.size() > 0)
{ {
sql = "update inv_alloc_det set dealloc_qty = (case when dealloc_qty is null then 0 else dealloc_qty end) + ?, deallocated = case when quantity = ? then 'Y' else 'N' end where tran_id = ? and line_no = ?"; sql = "update inv_alloc_det set dealloc_qty = (case when dealloc_qty is null then 0 else dealloc_qty end) + ?, deallocated = case when quantity = ? then 'Y' else 'N' end where tran_id = ? and line_no = ?";
...@@ -2848,8 +3142,8 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi ...@@ -2848,8 +3142,8 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi
{ {
worderStkBeanObj = (WorderStkBean) worderStkBeanList.get(potencyCtr); worderStkBeanObj = (WorderStkBean) worderStkBeanList.get(potencyCtr);
pstmt.setDouble(1, worderStkBeanObj.getAllocQty()); pstmt.setDouble(1, worderStkBeanObj.getReserveStkQty());
pstmt.setDouble(2, worderStkBeanObj.getAllocQty()); pstmt.setDouble(2, worderStkBeanObj.getReserveStkQty());
pstmt.setString(3,worderStkBeanObj.getReserveStkTranId()); pstmt.setString(3,worderStkBeanObj.getReserveStkTranId());
pstmt.setInt(4,worderStkBeanObj.getReserveLineNo()); pstmt.setInt(4,worderStkBeanObj.getReserveLineNo());
pstmt.addBatch(); pstmt.addBatch();
...@@ -2861,7 +3155,7 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi ...@@ -2861,7 +3155,7 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi
{ {
pstmt.close();pstmt = null; pstmt.close();pstmt = null;
} }
} }*/
} }
...@@ -3225,6 +3519,26 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi ...@@ -3225,6 +3519,26 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi
} }
return retVal; return retVal;
} }
// 02-jun-16 manoharan to update the sufficient flag
private void updateWoBeanSufficient(String worder, String expLvl, String isSufficient) throws ITMException, Exception
{
int retVal = -1;
WorkOrderDetailBean tempObj = null;
for (int ctr = 0; ctr < workOrderBeanList.size(); ctr++)
{
tempObj = (WorkOrderDetailBean) workOrderBeanList.get(ctr);
if ((tempObj.getWorkOrder().trim().equals(worder.trim())) && (tempObj.getExpLev().trim().equals(expLvl.trim())))
{
retVal = ctr;
tempObj.setSufficient(isSufficient);
workOrderBeanList.set(ctr, tempObj);
break;
}
}
}
private int indexOfWorkorderBeanList(String worder, String expLvl) throws ITMException, Exception private int indexOfWorkorderBeanList(String worder, String expLvl) throws ITMException, Exception
{ {
int retVal = -1; int retVal = -1;
...@@ -3792,17 +4106,17 @@ public String populateWorkOrderBill(Connection conn) throws Exception ...@@ -3792,17 +4106,17 @@ public String populateWorkOrderBill(Connection conn) throws Exception
System.out.println("workOrder------>>["+workOrder+"] workOrderDetail : ["+tempObj.getWorkOrder()+"]") ; System.out.println("workOrder------>>["+workOrder+"] workOrderDetail : ["+tempObj.getWorkOrder()+"]") ;
System.out.println("expLevel------>>["+expLevel+"] expLevelDetail : ["+tempObj.getExpLevel()+"]") ; System.out.println("expLevel------>>["+expLevel+"] expLevelDetail : ["+tempObj.getExpLevel()+"]") ;
System.out.println("UpdQty------>>["+tempObj.getUpdQty()+"] AllocQty : ["+tempObj.getAllocQty()+"]") ; System.out.println("UpdQty------>>["+tempObj.getUpdQty()+"] AllocQty : ["+tempObj.getAllocQty()+"]") ;
System.out.println("QtyAdj------>>["+tempObj.getQtyAdj()+"] AllocQty : ["+tempObj.getAllocQty()+"]") ; System.out.println("QtyAdj------>>["+tempObj.getQtyAdj()+"] PotencyAdj: ["+tempObj.getPotencyAdj()+"]") ;
if(workOrder.equalsIgnoreCase(tempObj.getWorkOrder()) && expLevel.equalsIgnoreCase(tempObj.getExpLevel())) if(workOrder.equalsIgnoreCase(tempObj.getWorkOrder()) && expLevel.equalsIgnoreCase(tempObj.getExpLevel()))
{ {
System.out.println("worderExpMap------>>["+worderExpMap+"]"); System.out.println("worderExpMap------>>["+worderExpMap+"]");
if(worderExpMap.containsKey(workOrder+":"+expLevel)) if(worderExpMap.containsKey(workOrder+":"+expLevel))
{ {
sql = " update workorder_bill set alloc_qty = (case when alloc_qty is null then 0 else alloc_qty end) + ?, " sql = " update workorder_bill set alloc_qty = (case when alloc_qty is null then 0 else alloc_qty end) + ?, "
+ " potency_adj = ? " + " potency_adj = (case when potency_adj is null then 0 else potency_adj end) + ? "
+ " where work_order = ? and operation = ? and exp_lev = ?"; + " where work_order = ? and operation = ? and exp_lev = ?";
pstmt1 = conn.prepareStatement(sql); pstmt1 = conn.prepareStatement(sql);
pstmt1.setDouble(1, tempObj.getUpdQty()); pstmt1.setDouble(1, tempObj.getAllocQty());
pstmt1.setDouble(2, tempObj.getPotencyAdj()); pstmt1.setDouble(2, tempObj.getPotencyAdj());
pstmt1.setString(3, workOrder); pstmt1.setString(3, workOrder);
pstmt1.setInt(4, wOrderBillObj.getOperation()); pstmt1.setInt(4, wOrderBillObj.getOperation());
...@@ -3834,7 +4148,7 @@ public String populateWorkOrderBill(Connection conn) throws Exception ...@@ -3834,7 +4148,7 @@ public String populateWorkOrderBill(Connection conn) throws Exception
} }
else else
{ {
pstmt1.setDouble(10, tempObj.getUpdQty()); //alloc_qty pstmt1.setDouble(10, tempObj.getAllocQty()); //alloc_qty
} }
pstmt1.setTimestamp(11, getCurrtDate()); //alloc_date pstmt1.setTimestamp(11, getCurrtDate()); //alloc_date
pstmt1.setString(12, wOrderBillObj.getSiteCode());//site_code pstmt1.setString(12, wOrderBillObj.getSiteCode());//site_code
...@@ -3865,7 +4179,7 @@ public String populateWorkOrderBill(Connection conn) throws Exception ...@@ -3865,7 +4179,7 @@ public String populateWorkOrderBill(Connection conn) throws Exception
pstmt1.setDouble(31, wOrderBillObj.getQuantity()); //quantity__std pstmt1.setDouble(31, wOrderBillObj.getQuantity()); //quantity__std
int i = pstmt1.executeUpdate(); int i = pstmt1.executeUpdate();
worderExpMap.put(workOrder+":"+expLevel, tempObj.getUpdQty()); worderExpMap.put(workOrder+":"+expLevel, tempObj.getAllocQty());
System.out.println("pstmt1 is null....................."+i); System.out.println("pstmt1 is null....................."+i);
if(pstmt !=null) if(pstmt !=null)
{ {
...@@ -3944,9 +4258,9 @@ public String populateWorkOrderBill(Connection conn) throws Exception ...@@ -3944,9 +4258,9 @@ public String populateWorkOrderBill(Connection conn) throws Exception
for(WorderStkBean WorderStkBeanObj : worderStkBeanList) for(WorderStkBean WorderStkBeanObj : worderStkBeanList)
{ {
System.out.println("Going for item code["+WorderStkBeanObj.getItemCode()+"] and alloc quantity ["+WorderStkBeanObj.getAllocQty()+"]"); System.out.println("Going for item code["+WorderStkBeanObj.getItemCode()+"] and alloc quantity ["+WorderStkBeanObj.getAllocQty()+"]");
// 31-may-16 manoharan in case of partial reserve and additional allocation from same lot to be taken care off
if("Y".equalsIgnoreCase(WorderStkBeanObj.getReserveStk())) //if("Y".equalsIgnoreCase(WorderStkBeanObj.getReserveStk()))
{ //{
//line no set in checkReser..Stk method for unique update. //line no set in checkReser..Stk method for unique update.
/* 20-may-16 manoharan commented this has to be done at the time of taking reserve stock /* 20-may-16 manoharan commented this has to be done at the time of taking reserve stock
sql = "update inv_alloc_det set dealloc_qty = (case when dealloc_qty is null then 0 else dealloc_qty end) + ? where tran_id = ? and " sql = "update inv_alloc_det set dealloc_qty = (case when dealloc_qty is null then 0 else dealloc_qty end) + ? where tran_id = ? and "
...@@ -3966,9 +4280,9 @@ public String populateWorkOrderBill(Connection conn) throws Exception ...@@ -3966,9 +4280,9 @@ public String populateWorkOrderBill(Connection conn) throws Exception
{ {
pstmt.close();pstmt = null; pstmt.close();pstmt = null;
} */ } */
} //}
else //else
{ //{
sql = "SELECT ALLOC_QTY FROM STOCK where item_code = ? and site_code = ? and loc_code = ? " sql = "SELECT ALLOC_QTY FROM STOCK where item_code = ? and site_code = ? and loc_code = ? "
+" and lot_no = ? and lot_sl = ? "; +" and lot_no = ? and lot_sl = ? ";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
...@@ -4009,12 +4323,18 @@ public String populateWorkOrderBill(Connection conn) throws Exception ...@@ -4009,12 +4323,18 @@ public String populateWorkOrderBill(Connection conn) throws Exception
+" and lot_no = ? and lot_sl = ? "; +" and lot_no = ? and lot_sl = ? ";
//deAllocQty = WorderStkBeanObj.getActualAllocQty() ;//wasim //deAllocQty = WorderStkBeanObj.getActualAllocQty() ;//wasim
deAllocQty = WorderStkBeanObj.getAllocQty(); // 31-may-16 manoharan reserve is already allocated
//deAllocQty = WorderStkBeanObj.getAllocQty();
deAllocQty = Double.parseDouble(df.format(WorderStkBeanObj.getAllocQty() - WorderStkBeanObj.getReserveStkQty()));
System.out.println("deAllocQty :["+deAllocQty+"]"); System.out.println("deAllocQty :["+deAllocQty+"]");
deAllocQty = Double.parseDouble(df.format(deAllocQty)) * -1; // 03-jun-16 manoharan not to multiply with -1
//deAllocQty = Double.parseDouble(df.format(deAllocQty)) * -1;
deAllocQty = Double.parseDouble(df.format(deAllocQty));
System.out.println("After deAllocQty :["+deAllocQty+"]"); System.out.println("After deAllocQty :["+deAllocQty+"]");
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setDouble(1,deAllocQty); // 03-jun-16 manoharan during update multiply with -1 so that allocation will be proper
//pstmt.setDouble(1,deAllocQty);
pstmt.setDouble(1,(deAllocQty * -1));
pstmt.setString(2,WorderStkBeanObj.getItemCode()); pstmt.setString(2,WorderStkBeanObj.getItemCode());
pstmt.setString(3,WorderStkBeanObj.getSiteCode()); pstmt.setString(3,WorderStkBeanObj.getSiteCode());
...@@ -4031,7 +4351,7 @@ public String populateWorkOrderBill(Connection conn) throws Exception ...@@ -4031,7 +4351,7 @@ public String populateWorkOrderBill(Connection conn) throws Exception
invAllocateMap = new HashMap(); invAllocateMap = new HashMap();
invAllocTrace = new InvAllocTraceBean(); invAllocTrace = new InvAllocTraceBean();
invAllocateMap.put("tran_date",getCurrtDate()); invAllocateMap.put("tran_date",getCurrtDate());
invAllocateMap.put("ref_ser","I-INV");// Discuss invAllocateMap.put("ref_ser","W-ORD");// Discuss
invAllocateMap.put("ref_id",WorderStkBeanObj.getWorkOrder()); invAllocateMap.put("ref_id",WorderStkBeanObj.getWorkOrder());
invAllocateMap.put("ref_line", "" + lineNo); invAllocateMap.put("ref_line", "" + lineNo);
invAllocateMap.put("site_code",WorderStkBeanObj.getSiteCode()); invAllocateMap.put("site_code",WorderStkBeanObj.getSiteCode());
...@@ -4042,7 +4362,9 @@ public String populateWorkOrderBill(Connection conn) throws Exception ...@@ -4042,7 +4362,9 @@ public String populateWorkOrderBill(Connection conn) throws Exception
invAllocateMap.put("lot_no",WorderStkBeanObj.getLotNo()); invAllocateMap.put("lot_no",WorderStkBeanObj.getLotNo());
invAllocateMap.put("lot_sl",WorderStkBeanObj.getLotSl()); invAllocateMap.put("lot_sl",WorderStkBeanObj.getLotSl());
//invAllocateMap.put("alloc_qty", WorderStkBeanObj.getActualAllocQty());//wasim //invAllocateMap.put("alloc_qty", WorderStkBeanObj.getActualAllocQty());//wasim
invAllocateMap.put("alloc_qty", WorderStkBeanObj.getAllocQty()); // 31-may-16 manoharan reserve is already allocated
//invAllocateMap.put("alloc_qty", WorderStkBeanObj.getAllocQty());
invAllocateMap.put("alloc_qty", deAllocQty);
invAllocateMap.put("chg_user",chgUser); invAllocateMap.put("chg_user",chgUser);
invAllocateMap.put("chg_term",termId); invAllocateMap.put("chg_term",termId);
invAllocateMap.put("chg_win","w_woFirmplan"); invAllocateMap.put("chg_win","w_woFirmplan");
...@@ -4061,7 +4383,7 @@ public String populateWorkOrderBill(Connection conn) throws Exception ...@@ -4061,7 +4383,7 @@ public String populateWorkOrderBill(Connection conn) throws Exception
{ {
rs.close();rs = null; rs.close();rs = null;
} }
} //}
if(! tranIDWorderMap.containsKey(WorderStkBeanObj.getWorkOrder())) if(! tranIDWorderMap.containsKey(WorderStkBeanObj.getWorkOrder()))
...@@ -6009,12 +6331,13 @@ public String populateWorkOrderBill(Connection conn) throws Exception ...@@ -6009,12 +6331,13 @@ public String populateWorkOrderBill(Connection conn) throws Exception
reserveStockXMl.append("<deallocated><![CDATA[" ).append( "" ).append( "]]></deallocated>\r\n" ); reserveStockXMl.append("<deallocated><![CDATA[" ).append( "" ).append( "]]></deallocated>\r\n" );
reserveStockXMl.append("<is_alternate><![CDATA[" ).append( tempObj.getAlternate() ).append( "]]></is_alternate>\r\n" ); reserveStockXMl.append("<is_alternate><![CDATA[" ).append( tempObj.getAlternate() ).append( "]]></is_alternate>\r\n" );
reserveStockXMl.append("<tran_id><![CDATA[" ).append( tempObj.getReserveStkTranId() ).append( "]]></tran_id>\r\n" ); reserveStockXMl.append("<tran_id><![CDATA[" ).append( tempObj.getReserveStkTranId() ).append( "]]></tran_id>\r\n" );
reserveStockXMl.append( "<upd_qty><![CDATA[" ).append(Double.parseDouble(df.format(tempObj.getUpdQty())) ).append( "]]></upd_qty>\r\n" ); reserveStockXMl.append( "<upd_qty><![CDATA[" ).append(Double.parseDouble(df.format(tempObj.getAllocQty())) ).append( "]]></upd_qty>\r\n" );
reserveStockXMl.append( "<qty_adj><![CDATA[" ).append( tempObj.getQtyAdj() ).append( "]]></qty_adj>\r\n" ); reserveStockXMl.append( "<qty_adj><![CDATA[" ).append( tempObj.getPotencyAdj() ).append( "]]></qty_adj>\r\n" );
reserveStockXMl.append("<unit><![CDATA[" ).append( tempObj.getUnit() ).append( "]]></unit>\r\n" ); reserveStockXMl.append("<unit><![CDATA[" ).append( tempObj.getUnit() ).append( "]]></unit>\r\n" );
reserveStockXMl.append("</detail>"); reserveStockXMl.append("</detail>");
} }
else //else
if ( tempObj.getAllocQty() - tempObj.getReserveStkQty() > 0)
{ {
cntStk++; cntStk++;
if(cntStk == 1) if(cntStk == 1)
...@@ -6052,7 +6375,7 @@ public String populateWorkOrderBill(Connection conn) throws Exception ...@@ -6052,7 +6375,7 @@ public String populateWorkOrderBill(Connection conn) throws Exception
stockDetailXml.append("<is_alternate><![CDATA[" ).append( tempObj.getAlternate() ).append( "]]></is_alternate>\r\n" ); stockDetailXml.append("<is_alternate><![CDATA[" ).append( tempObj.getAlternate() ).append( "]]></is_alternate>\r\n" );
stockDetailXml.append("<tran_id><![CDATA[" ).append( tempObj.getReserveStkTranId() ).append( "]]></tran_id>\r\n" ); stockDetailXml.append("<tran_id><![CDATA[" ).append( tempObj.getReserveStkTranId() ).append( "]]></tran_id>\r\n" );
stockDetailXml.append("<upd_qty><![CDATA[" ).append(Double.parseDouble(df.format((tempObj1.getOtherSiteQty()) + tempObj.getQtyAdj())) ).append( "]]></upd_qty>\r\n" ); stockDetailXml.append("<upd_qty><![CDATA[" ).append(Double.parseDouble(df.format((tempObj1.getOtherSiteQty()) + tempObj.getQtyAdj())) ).append( "]]></upd_qty>\r\n" );
stockDetailXml.append("<qty_adj><![CDATA[" ).append( tempObj.getQtyAdj() ).append( "]]></qty_adj>\r\n" ); stockDetailXml.append("<qty_adj><![CDATA[" ).append( tempObj.getPotencyAdj() ).append( "]]></qty_adj>\r\n" );
stockDetailXml.append("<unit><![CDATA[" ).append( tempObj.getUnit() ).append( "]]></unit>\r\n" ); stockDetailXml.append("<unit><![CDATA[" ).append( tempObj.getUnit() ).append( "]]></unit>\r\n" );
stockDetailXml.append("<other_site><![CDATA[" ).append("Y").append( "]]></other_site>\r\n" ); stockDetailXml.append("<other_site><![CDATA[" ).append("Y").append( "]]></other_site>\r\n" );
stockDetailXml.append("</detail>"); stockDetailXml.append("</detail>");
...@@ -6079,8 +6402,8 @@ public String populateWorkOrderBill(Connection conn) throws Exception ...@@ -6079,8 +6402,8 @@ public String populateWorkOrderBill(Connection conn) throws Exception
stockDetailXml.append("<alloc_qty><![CDATA[" ).append( Double.parseDouble(df.format( tempObj.getAllocQty())) ).append( "]]></alloc_qty>\r\n" ); stockDetailXml.append("<alloc_qty><![CDATA[" ).append( Double.parseDouble(df.format( tempObj.getAllocQty())) ).append( "]]></alloc_qty>\r\n" );
stockDetailXml.append("<deallocated><![CDATA[" ).append( "" ).append( "]]></deallocated>\r\n" ); stockDetailXml.append("<deallocated><![CDATA[" ).append( "" ).append( "]]></deallocated>\r\n" );
stockDetailXml.append("<is_alternate><![CDATA[" ).append( tempObj.getAlternate() ).append( "]]></is_alternate>\r\n" ); stockDetailXml.append("<is_alternate><![CDATA[" ).append( tempObj.getAlternate() ).append( "]]></is_alternate>\r\n" );
stockDetailXml.append( "<upd_qty><![CDATA[" ).append( Double.parseDouble(df.format(tempObj.getUpdQty())) ).append( "]]></upd_qty>\r\n" ); stockDetailXml.append( "<upd_qty><![CDATA[" ).append( Double.parseDouble(df.format(tempObj.getAllocQty())) ).append( "]]></upd_qty>\r\n" );
stockDetailXml.append( "<qty_adj><![CDATA[" ).append( tempObj.getQtyAdj() ).append( "]]></qty_adj>\r\n" ); stockDetailXml.append( "<qty_adj><![CDATA[" ).append( tempObj.getPotencyAdj() ).append( "]]></qty_adj>\r\n" );
stockDetailXml.append("<unit><![CDATA[" ).append( tempObj.getUnit() ).append( "]]></unit>\r\n" ); stockDetailXml.append("<unit><![CDATA[" ).append( tempObj.getUnit() ).append( "]]></unit>\r\n" );
stockDetailXml.append("<other_site><![CDATA[" ).append("N").append( "]]></other_site>\r\n" ); stockDetailXml.append("<other_site><![CDATA[" ).append("N").append( "]]></other_site>\r\n" );
stockDetailXml.append("</detail>"); stockDetailXml.append("</detail>");
...@@ -6368,15 +6691,18 @@ public String populateWorkOrderBill(Connection conn) throws Exception ...@@ -6368,15 +6691,18 @@ public String populateWorkOrderBill(Connection conn) throws Exception
siteItemBeanObj = (SiteItemSummaryBean) siteItemReqQtyList.get(outerCtr); siteItemBeanObj = (SiteItemSummaryBean) siteItemReqQtyList.get(outerCtr);
stockList = siteItemBeanObj.getStockList(); stockList = siteItemBeanObj.getStockList();
// 06-jun-16 manoharan moved below inside loop
issCriteria = getColumnDescr(conn,"ISS_CRITERIA","ITEM","ITEM_CODE",(String) siteItemBeanObj.getItemCode());
//System.out.println("Issue Criteria found="+issCriteria);
for (int ctr = 0; ctr < stockList.size(); ctr++) for (int ctr = 0; ctr < stockList.size(); ctr++)
{ {
StkHmap = (HashMap) stockList.get(ctr); StkHmap = (HashMap) stockList.get(ctr);
mainQuantity = (Double) StkHmap.get("QUANTITY"); mainQuantity = (Double) StkHmap.get("QUANTITY");
originalAllocQty = siteItemBeanObj.getOtherSiteQty(); originalAllocQty = siteItemBeanObj.getOtherSiteQty();
// 06-jun-16 manoharan, not required for each stock record, it should be at item level so moved above out side
issCriteria = getColumnDescr(conn,"ISS_CRITERIA","ITEM","ITEM_CODE",String.valueOf(StkHmap.get("ITEM_CODE"))); //issCriteria = getColumnDescr(conn,"ISS_CRITERIA","ITEM","ITEM_CODE",String.valueOf(StkHmap.get("ITEM_CODE")));
System.out.println("Issue Criteria found="+issCriteria); //System.out.println("Issue Criteria found="+issCriteria);
System.out.println("Other site quantity allocated="+mainQuantity); System.out.println("Other site quantity allocated="+mainQuantity);
System.out.println("Original allocated="+originalAllocQty); System.out.println("Original allocated="+originalAllocQty);
...@@ -6384,7 +6710,7 @@ public String populateWorkOrderBill(Connection conn) throws Exception ...@@ -6384,7 +6710,7 @@ public String populateWorkOrderBill(Connection conn) throws Exception
//String stkKey = tempObj.getLocCode()+":"+tempObj.getLotNo()+":"+tempObj.getLotSl()+":"+tempObj.getSiteCodeShip()+":"+tempObj.getItemCode(); //String stkKey = tempObj.getLocCode()+":"+tempObj.getLotNo()+":"+tempObj.getLotSl()+":"+tempObj.getSiteCodeShip()+":"+tempObj.getItemCode();
String stkKey = StkHmap.get("LOC_CODE")+":"+StkHmap.get("LOT_NO")+":"+StkHmap.get("LOT_SL")+":"+StkHmap.get("SITE_CODE")+":"+StkHmap.get("ITEM_CODE"); String stkKey = StkHmap.get("LOC_CODE")+":"+StkHmap.get("LOT_NO")+":"+StkHmap.get("LOT_SL")+":"+StkHmap.get("SITE_CODE")+":"+StkHmap.get("ITEM_CODE");
qtyPerArt = getQtyPerArt(stkKey,conn); //qtyPerArt = getQtyPerArt(stkKey,conn);
if("W".equalsIgnoreCase(issCriteria)) if("W".equalsIgnoreCase(issCriteria))
{ {
...@@ -6414,6 +6740,8 @@ public String populateWorkOrderBill(Connection conn) throws Exception ...@@ -6414,6 +6740,8 @@ public String populateWorkOrderBill(Connection conn) throws Exception
} }
else else
{ {
qtyPerArt = getQtyPerArt(stkKey,conn);
if(qtyPerArt > mainQuantity) if(qtyPerArt > mainQuantity)
{ {
......
package ibase.webitm.ejb.mfg; package ibase.webitm.ejb.mfg;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Comparator;
import java.text.SimpleDateFormat;
public class WorderStkBean public class WorderStkBean
{ {
...@@ -9,7 +12,7 @@ public class WorderStkBean ...@@ -9,7 +12,7 @@ public class WorderStkBean
java.sql.Timestamp expDate = null,mfgDate = null; java.sql.Timestamp expDate = null,mfgDate = null;
private String locCode = "",lotNo = "",lotSl = "",siteCode = "",itemCode = "",itemRef = "",alternate = "",itemDescr = "", private String locCode = "",lotNo = "",lotSl = "",siteCode = "",itemCode = "",itemRef = "",alternate = "",itemDescr = "",
workOrder = "",expLevel = "",critItem = "",unit = "",dimension = "",reserveStk = "",reserveStkTranId = "", workOrder = "",expLevel = "",critItem = "",unit = "",dimension = "",reserveStk = "",reserveStkTranId = "",
siteCodeMfg ="",otherSiteYN = "",stockSufficient = "",isStockDetail = "",alternateItem = ""; siteCodeMfg ="",otherSiteYN = "N",stockSufficient = "N",isStockDetail = "",alternateItem = "";
private double minQtyReq = 0,quantity = 0; private double minQtyReq = 0,quantity = 0;
int reserveLineNo = 0; int reserveLineNo = 0;
...@@ -60,10 +63,6 @@ public class WorderStkBean ...@@ -60,10 +63,6 @@ public class WorderStkBean
this.reserveStkQty = reserveStkQty; this.reserveStkQty = reserveStkQty;
} }
public int getReserveLineNo() { public int getReserveLineNo() {
return reserveLineNo; return reserveLineNo;
} }
...@@ -137,7 +136,6 @@ public class WorderStkBean ...@@ -137,7 +136,6 @@ public class WorderStkBean
this.dimension = dimension; this.dimension = dimension;
} }
public double getStkPotencyPerc() { public double getStkPotencyPerc() {
return stkPotencyPerc; return stkPotencyPerc;
} }
...@@ -146,9 +144,6 @@ public class WorderStkBean ...@@ -146,9 +144,6 @@ public class WorderStkBean
this.stkPotencyPerc = stkPotencyPerc; this.stkPotencyPerc = stkPotencyPerc;
} }
public String getLocCode() { public String getLocCode() {
return locCode; return locCode;
} }
...@@ -231,7 +226,6 @@ public class WorderStkBean ...@@ -231,7 +226,6 @@ public class WorderStkBean
this.altItemCodeList = altItemCodeList; this.altItemCodeList = altItemCodeList;
} }
//Changed by wasim on 23-03-2016 to get/set minimum quantity required [START] //Changed by wasim on 23-03-2016 to get/set minimum quantity required [START]
public double getMinQtyReq() { public double getMinQtyReq() {
return minQtyReq; return minQtyReq;
...@@ -257,4 +251,30 @@ public class WorderStkBean ...@@ -257,4 +251,30 @@ public class WorderStkBean
{ {
return quantity; return quantity;
} }
/* 31-may-16 manoharan Comparator for sorting the list by work_order,exp_lev, exp_date*/
public static Comparator<WorderStkBean> WoStkBeanComparator = new Comparator<WorderStkBean>() {
public int compare(WorderStkBean s1, WorderStkBean s2)
{
String dateStr1 = "", dateStr2 = "";
if (s1.getExpDate() != null)
{
dateStr1 = (String) (new SimpleDateFormat("yyyy/MM/dd").format(s1.getExpDate()));
}
if (s2.getExpDate() != null)
{
dateStr2 = (String) (new SimpleDateFormat("yyyy/MM/dd").format(s2.getExpDate()));
}
String KeyStockBean1 = s1.getWorkOrder().toUpperCase() + s1.getExpLevel() + dateStr1;
String KeyStockBean2 = s2.getWorkOrder().toUpperCase() + s2.getExpLevel() + dateStr2;
//ascending order
return KeyStockBean1.compareTo(KeyStockBean2);
//descending order
//return KeyStockBean2.compareTo(KeyStockBean1);
}
};
} }
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