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;
import java.util.HashSet;
import java.util.Iterator;
import java.util.ListIterator;
import java.util.Collections;
import java.util.Comparator;
import java.util.Map;
import java.util.Set;
import java.util.logging.FileHandler;
......@@ -143,6 +145,12 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi
DistCommon disCommon = new DistCommon();
DecimalFormat df = new DecimalFormat("#.###");
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
{
return "";
......@@ -323,7 +331,15 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi
{*/
//stock sufficient
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);
// 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("worderStkBeanList size 4="+worderStkBeanList.size());
//displayStkBean(workOrderBeanList, "H");
......@@ -348,18 +364,12 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi
errString = createDistSaleOrder(conn);
//CreateDistSorderAllocation
//according to transType create dist. or sale order
errString = generateXml(conn);
}
/*if(errString !=null && errString.indexOf("Error") > -1)
{
return errString;
}*/
/*}
else
{
......@@ -582,6 +592,7 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi
tempWorderObj.setSufficient("Y");
workOrderBeanList.set(count, tempWorderObj);
worderExpLevSufficient.put(tempWorderObj.getWorkOrder()+":"+tempWorderObj.getExpLev(), isSufficient);
updateWoBeanSufficient(tempWorderObj.getWorkOrder(), tempWorderObj.getExpLev(), "Y");
continue;
}
detailMap.put("BALANCE_QTY", String.valueOf(balanceQty) );
......@@ -650,6 +661,7 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi
tempWorderObj.setSufficient("Y");
workOrderBeanList.set(count, tempWorderObj);
worderExpLevSufficient.put(tempWorderObj.getWorkOrder()+":"+tempWorderObj.getExpLev(), isSufficient);
updateWoBeanSufficient(tempWorderObj.getWorkOrder(), tempWorderObj.getExpLev(), "Y");
continue;
}
......@@ -1049,6 +1061,17 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi
worderDetailBeanObj.setExpLev(expLev);
worderDetailBeanObj.setOperation(operationInt);
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.setUseInvStatus(useInvStatus);
......@@ -1139,10 +1162,10 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi
int count = 0;
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 = "",
mfgDate= "",stkKey = "",otherSite = "",errorCode = "",issCriteria = "",controlledYn = "",matchPotency = "";
double stkQuantity = 0,stkPotencyPerc = 0,allocQty = 0,minPotencyPerc = 0;
mfgDate= "",stkKey = "",otherSite = "",errorCode = "",issCriteria = "",controlledYn = "",matchPotency = "",adjPotency = "";
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
java.sql.Timestamp expDateT = null,mfgDateT= null;
Map<String,String> returnMapDetails = new HashMap<String,String>();
......@@ -1151,13 +1174,12 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi
WorderStkBean worderStkBeanObj = null;
int count1 = 0;
int stkindex = -1;
double finalAllocatedQty = 0;
double finalAllocatedQty = 0, ItemStdPotency = 100, qtyPerArt = 0,finalAllocQty = 0;;
try
{
Calendar currentDate = Calendar.getInstance();
SimpleDateFormat sdf = new SimpleDateFormat(genericUtility.getApplDateFormat());
String currDate = sdf.format(currentDate.getTime());
System.out.println("isReallocationFlag="+isReallocation);
otherSite = detailMap.get("OTHER_SITE");
if("Y".equals(otherSite))
......@@ -1177,6 +1199,8 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi
controlledYn = detailMap.get("CONTROLLED_YN");
minPotencyPerc = Double.parseDouble(detailMap.get("MIN_POTENCY_PERC"));
matchPotency = detailMap.get("MATCH_POTENCY");
adjPotency = detailMap.get("ADJ_POTENCY");
alternateItem = detailMap.get("IS_ALTERNATE");
System.out.println("IS_ALTERNATE : "+alternateItem);
System.out.println("CONSIDER_PARTIAL_ALT : "+considerPartialAlt);
......@@ -1198,6 +1222,8 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi
pstmt.close();
pstmt = null;
// 31-may-16 manoharan
ItemStdPotency = getItemStandardPotency(detailMap.get("ITEM_CODE"), conn);
dimension = checkNull(detailMap.get("DIMENSION"));
detailMap.put("QC_REQD", qcReqd);
......@@ -1242,7 +1268,7 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi
pstmt.close();
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"));
System.out.println("shortageQty......................"+shortageQty);
......@@ -1254,17 +1280,29 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi
{
requiredQty = Double.parseDouble(detailMap.get("QUANTITY"));
}
//if(isReallocation)
//{
balanceQty = requiredQty;
//}
//Excecute stock sql and set in WorderStkBean object
//for detailsum S = check sum of stock, I - used for check same manufactured,D -
sqlString = getBuildedWoIssueSql(detailMap, conn);
pstmt = conn.prepareStatement(sqlString);
System.out.println("in checkCurrentSiteStock getBuildedWoIssueSql balanceQty [" + balanceQty + "] For item code ["+detailMap.get("ITEM_CODE") + "] sqlString ["+sqlString+"]");
rs = pstmt.executeQuery();
while(rs.next())
{
updQty = 0;
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"));
lotNo = checkNull(rs.getString("LOT_NO"));
lotSl = checkNull(rs.getString("LOT_SL"));
......@@ -1375,8 +1413,6 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi
System.out.println("stkPotencyPerc------>>["+stkPotencyPerc+"]");
System.out.println("minPotencyPerc------>>["+minPotencyPerc+"]");
stkindex = -1;
if(stkPotencyPerc >= minPotencyPerc)
{
if(!isReallocation)
{
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
worderStkBeanObj.setIsStockDetail("Y");
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);
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]
if(!"Y".equalsIgnoreCase(otherSite))
{
issCriteria = getColumnDescr(conn,"ISS_CRITERIA","ITEM","ITEM_CODE",detailMap.get("ITEM_CODE"));
System.out.println("Issue Criteria found="+issCriteria);
if("F".equalsIgnoreCase(issCriteria))
......@@ -1464,7 +1742,7 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi
System.out.println("Final Allocated quantity in current site="+requiredQty);
}
//Changed by wasim on 08-03-2016 to consider issue criteria [END]
*/
//If other site Y then set quantity according to site code and
//item code wise in siteItemReqQtyList. (For creating distribution issue / sale order )
if("Y".equalsIgnoreCase(otherSite))
......@@ -1478,7 +1756,7 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi
siteItemMap.put("LOT_NO", lotNo);
siteItemMap.put("LOT_SL", lotSl);
siteItemMap.put("SITE_CODE", detailMap.get("SITE_CODE"));
siteItemMap.put("QUANTITY", requiredQty);
siteItemMap.put("QUANTITY", updQty);
siteItemMap.put("UNIT", unit);
siteItemMap.put("SITE_CODE__MFG", siteCodeMfg);
siteItemMap.put("MFG_DATE", mfgDateT);
......@@ -1498,7 +1776,7 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi
siteItemSumBeanObj = new SiteItemSummaryBean();
//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);
//System.out.println("Allocating quantity for other site="+qtyPerArt);
//siteItemSumBeanObj.setOtherSiteQty(Double.valueOf(qtyPerArt));
......@@ -1520,17 +1798,17 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi
//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
//then item1 already stock allocate then for item2 same stock allocated .
//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("softAllocQty@@ : ["+softAllocQty+"] ");
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]
/*double minReqQty = worderStkBeanObj.getMinQtyReq();
......@@ -1549,32 +1827,7 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi
System.out.println("Finally required quantity ="+requiredQty);
//Changed by wasim on 16-03-2016 to consider and allocate minimum qty req [END]
if(requiredQty <= (stkQuantity + softAllocQty))
{
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("ALLOC_QTY",""+updQty);
stockAllocMap.put("LOC_CODE", locCode);
stockAllocMap.put("ITEM_CODE",detailMap.get("ITEM_CODE"));
stockAllocMap.put("SITE_CODE",detailMap.get("SITE_CODE"));
......@@ -1583,20 +1836,10 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi
allocRetStr = updateStockAllocQty(stockAllocMap,conn);
System.out.println("allocRetStr :"+allocRetStr);
balanceQty = Double.parseDouble(df.format(balanceQty));
System.out.println("balanceQty@@ : ["+balanceQty+"] ");
System.out.println("softAllocQty@@ : ["+softAllocQty+"] ");
requiredQty = balanceQty;
worderStkBeanObj.setStockSufficient("N");
/*worderStkBeanObj.setAllocQty(stkQuantity);
worderStkBeanObj.setQuantity(stkQuantity);*/
finalAllocatedQty = stkQuantity;
}
finalAllocatedQty = updQty;
System.out.println("Adding stk..........."+worderStkBeanObj.getStockSufficient());
System.out.println("isReallocation Flag in check site["+isReallocation+"] [" + stkindex + "]");
if (!isReallocation)
/*if (!isReallocation)
{
if(stkindex != -1)
{
......@@ -1609,12 +1852,17 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi
{
worderStkBeanObj.setAllocQty(finalAllocatedQty);
System.out.println("manohar before .setQuantity 2["+worderStkBeanObj.getQuantity()+"]");
worderStkBeanObj.setQuantity(finalAllocatedQty);
//worderStkBeanObj.setQuantity(finalAllocatedQty);
System.out.println("manohar after .setQuantity 2["+worderStkBeanObj.getQuantity()+"]");
}
}*/
if(isSufficient)
{
worderStkBeanObj.setStockSufficient("Y");
}
if(isReallocation)
{
// 31-may-16 manoharan potency to be calculated if necessary
tempWorderExpStkBeanList.add(worderStkBeanObj);
}
else
......@@ -1639,19 +1887,13 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi
{
break;
}
}
else
{
System.out.println("stkPotencyPerc is less than minimum potency please check........");
}
} //end while
rs.close();
rs= null;
pstmt.close();
pstmt = null;
System.out.println("manohar in checkCurrentSiteStock after allocation balanceQty ["+balanceQty+"] isSufficient[" + isSufficient + "]");
if(isSufficient)
{
returnMapDetails.put("ERROR_CODE","");
......@@ -1672,6 +1914,7 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi
returnMapDetails.put("BALANCE_QTY",String.valueOf(balanceQty));
returnMapDetails.put("IS_SUFFICIENT","false");
}
System.out.println("manohar in checkCurrentSiteStock after allocation balanceQty ["+balanceQty+"] isSufficient[" + isSufficient + "] returnMapDetails [" + returnMapDetails + "]");
}
catch(Exception e)
{
......@@ -1691,7 +1934,7 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi
pstmt.close();
pstmt = null;
}
}
System.out.println("Consider Partial Alternative in last current site["+considerPartialAlt+"]");
if("N".equalsIgnoreCase(considerPartialAlt))
......@@ -1710,8 +1953,9 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi
conn.rollback();
}
}
return returnMapDetails;
}
return returnMapDetails;
}
//Get item standard potency
//if in item master POTENCY_PERC is null or 0 then return 100.
private double getItemStandardPotency(String itemCode,Connection conn) throws ITMException, Exception
......@@ -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 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;
Map<String,Double>potencyAdjMapY = null;
//Map<String,Double>potencyAdjMapY = null;
//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>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
//ArrayList<WorkOrderDetailBean> tempWorderBeanList = new ArrayList<WorkOrderDetailBean>(); // 09-mar-16 manoharan not used
......@@ -1797,13 +2041,18 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi
int foundIndex = -1;
boolean isSufficient = false;
double deallocQty = 0,allocatedQty = 0, extraQty = 0, potencyAdjLot = 0, quantityReqLot = 0;
Map<String,String> stockAllocMap = new HashMap<String,String>();
boolean removeElement = false;
try
{
for(String workOrderPotency : workOrderList)
{
potencyAdjMapY = null;
potencyAdjMapN = null;
AdjPotencyExplevQtyMap = null;
potencyAdjMapY = new HashMap<String,Double>();
potencyAdjMapN = new HashMap<String,Double>();
//deAllocQtyMap = new HashMap<String,Double>();// 09-mar-16 manoharan
......@@ -1871,7 +2120,7 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi
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
stkPotencyPerc = worderStkBeanObj.getStkPotencyPerc();
itemCode = worderStkBeanObj.getItemCode();
......@@ -1946,83 +2195,82 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi
potencyAdj = ( balance /stkPotencyPerc * ItemStdPotency) - balance;
potencyAdj = Double.parseDouble(df.format(potencyAdj));
System.out.println("After calculating potencyAdj SUFFICIENT----->>["+potencyAdj+"]");//0.244
System.out.println("After calculating potencyAdj SUFFICIENT----->>["+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 = balance + potencyAdj; //2.2+0.244 = 2.444
System.out.println("manohar before .setQuantity 4["+worderStkBeanObj.getQuantity()+"]");
worderStkBeanObj.setQuantity(worderStkBeanObj.getAllocQty() ); // 2.2 - 0.2444 = /// 23-may-16 manoharan
System.out.println("manohar after .setQuantity 3["+worderStkBeanObj.getQuantity()+"]");
System.out.println("manohar before .setQuantity 4["+worderStkBeanObj.getQuantity()+"] .setPotencyAdj[" + worderStkBeanObj.getPotencyAdj() + "] .setQtyAdj[" + worderStkBeanObj.getQtyAdj() + "]" );
worderStkBeanObj.setQuantity(balance);
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.setQuantity(updQty); // 2.2 - 0.2444 =
worderStkBeanObj.setUpdQty(updQty);
worderStkBeanObj.setStockSufficient("Y");
worderStkBeanObj.setQtyAdj(potencyAdj);//wasim on 13-04-2016
worderStkBeanObj.setPotencyAdj(potencyAdj);//wasim on 13-04-2016
System.out.println("manohar after .setQuantity 4["+worderStkBeanObj.getQuantity()+"] .setPotencyAdj[" + worderStkBeanObj.getPotencyAdj() + "] .setQtyAdj[" + worderStkBeanObj.getQtyAdj() + "]" );
worderStkBeanList.set(innerCtr, worderStkBeanObj);
if(potencyAdjMapY.containsKey(adjPotency) )
{
potencyAdjMapY.put(adjPotency, Double.parseDouble(df.format((potencyAdjMapY.get(adjPotency) + potencyAdj ))) );
}
else
{
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>();
detailMap.put("USE_INV_STATUS", worderDetailBeanObj.getUseInvStatus());
detailMap.put("SUPP_CODE_MFG", worderDetailBeanObj.getSuppCodeMfg());
detailMap.put("DIMENSION", worderDetailBeanObj.getDimension());
detailMap.put("MIN_POTENCY_PERC", String.valueOf(worderDetailBeanObj.getMinPotencyPerc()) );
detailMap.put("EXP_LEV", worderDetailBeanObj.getExpLev());
detailMap.put("OPERATION", ""+worderDetailBeanObj.getOperation());
detailMap.put("CRIT_ITEM", worderDetailBeanObj.getCritItem());
detailMap.put("ITEM_REF", worderDetailBeanObj.getItemRef());
detailMap.put("BOM_CODE", worderDetailBeanObj.getBomCode());
detailMap.put("ITEM_CODE", worderDetailBeanObj.getItemCode());
detailMap.put("QUANTITY", String.valueOf(worderDetailBeanObj.getQuantity()));
detailMap.put("SITE_CODE", worderStkBeanObj.getSiteCode());//wasim
detailMap.put("UNIT", worderDetailBeanObj.getUnit());
detailMap.put("MATCH_POTENCY", worderDetailBeanObj.getMatchPotency());
detailMap.put("ADJ_POTENCY", worderDetailBeanObj.getAdjPotency());
detailMap.put("USAGE_TYPE", worderDetailBeanObj.getUsageType());
detailMap.put("CONSIDER_LOTNO_ISSUE", worderDetailBeanObj.getConsiderLotNoIssue());
detailMap.put("LOC_USAGE_TYPE", worderDetailBeanObj.getLocUsageType());
detailMap.put("WORK_ORDER", worderDetailBeanObj.getWorkOrder());
detailMap.put("ITEM_ACTIVE", worderDetailBeanObj.getItemActive());
detailMap.put("ALLOCATE_TYPE", worderDetailBeanObj.getAllocateType());
detailMap.put("ITEM_CATEGORY", worderDetailBeanObj.getItemCategory());
detailMap.put("IS_ALTERNATE", "N");
if("Y".equalsIgnoreCase(worderStkBeanObj.getOtherSiteYN()))
potencyAdj = Double.parseDouble(df.format((potencyAdj - (updQty - availableStock)))) ;
stockAllocMap.put("ALLOC_QTY",""+potencyAdj);
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);
updQty = worderStkBeanObj.getAllocQty() + potencyAdj; //2 + 0.244 = 2.244
updQty = Double.parseDouble(df.format(updQty));
worderStkBeanObj.setAllocQty(updQty); // 2 + 0.244 = 2.244
worderStkBeanObj.setUpdQty(updQty);
worderStkBeanObj.setStockSufficient("N");
worderStkBeanObj.setQtyAdj(potencyAdj);//wasim on 13-04-2016
worderStkBeanObj.setPotencyAdj(potencyAdj);//wasim on 13-04-2016
System.out.println("manohar after .setQuantity 4["+worderStkBeanObj.getQuantity()+"] .setPotencyAdj[" + worderStkBeanObj.getPotencyAdj() + "] .setQtyAdj[" + worderStkBeanObj.getQtyAdj() + "]" );
worderStkBeanList.set(innerCtr, worderStkBeanObj);
if(potencyAdjMapY.containsKey(adjPotency) )
{
detailMap.put("OTHER_SITE", "Y");
potencyAdjMapY.put(adjPotency, Double.parseDouble(df.format((potencyAdjMapY.get(adjPotency) + potencyAdj ))) );
}
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
......@@ -2089,7 +2337,7 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi
else
{
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)
{
System.out.println("Potency to be adjusted [" + adjPotency + "]");
......@@ -2183,11 +2431,13 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi
{
System.out.println("manohar before templist merge " );
worderStkBeanObj = (WorderStkBean) worderStkBeanList.get(foundIndex);
System.out.println("manohar before templist merge getAllocQty [" + worderStkBeanObj.getAllocQty()+ "] potencyadj [" + worderStkBeanObj.getPotencyAdj() + "]" );
worderStkBeanObj.setAllocQty(worderStkBeanObj.getAllocQty() + tempStkObj.getAllocQty());
worderStkBeanObj.setPotencyAdj(worderStkBeanObj.getPotencyAdj() + tempStkObj.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(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())));
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
......@@ -2237,7 +2487,10 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi
System.out.println("potencyAdjExpLev---------->>["+potencyAdjExpLev+"]");//-93.733
quantityReqExpLev = adjPotencyExpLevel.getValue() + potencyAdjExpLev;//56.366
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)
{
// Extra allocation done to be deallocated
......@@ -2245,6 +2498,8 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi
extraQty = adjPotencyExpLevel.getValue() - quantityReqExpLev;
extraQty = Double.parseDouble(df.format(extraQty));
int stockListSize = worderStkBeanList.size() -1;
System.out.println("Deallocate stockListSize [" + stockListSize + "] ExpLev [" + expLevelNew+"] quantity["+ adjPotencyExpLevel.getValue() + "] quantityReqExpLev ["+quantityReqExpLev+"] extraQty [" + extraQty + "]");
for(int potencyCtr = stockListSize; potencyCtr > 0 ; potencyCtr--)
{
......@@ -2255,11 +2510,13 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi
{
if (extraQty <= 0)
{
worderExpLevSufficient.put(worderStkBeanObj.getWorkOrder()+":"+worderStkBeanObj.getExpLevel(), true);
updateWoBeanSufficient(worderStkBeanObj.getWorkOrder(), worderStkBeanObj.getExpLevel(), "Y");
break;
}
removeElement = false;
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
if (allocatedQty <= extraQty )
{
......@@ -2272,7 +2529,7 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi
deallocQty = extraQty;
extraQty = 0;
}
Map<String,String> stockAllocMap = new HashMap<String,String>();
stockAllocMap.put("ALLOC_QTY",""+ (deallocQty * -1));
stockAllocMap.put("LOC_CODE", worderStkBeanObj.getLocCode());
stockAllocMap.put("ITEM_CODE",worderStkBeanObj.getItemCode());
......@@ -2288,11 +2545,15 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi
}
else
{
worderStkBeanObj.setUpdQty(worderStkBeanObj.getAllocQty() - deallocQty);
worderStkBeanObj.setAllocQty(worderStkBeanObj.getAllocQty() - deallocQty);
worderStkBeanObj.setUpdQty(Double.parseDouble(df.format(worderStkBeanObj.getAllocQty() - deallocQty)));
worderStkBeanObj.setAllocQty(Double.parseDouble(df.format(worderStkBeanObj.getAllocQty() - deallocQty)));
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
worderStkBeanObj = (WorderStkBean) worderStkBeanList.get(potencyCtr);
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
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));
quantityReqLot = allocatedQty + potencyAdjLot;
quantityReqLot = allocatedQty - potencyAdjLot;
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.setPotencyAdj(potencyAdjLot);
//worderStkBeanObj.setQuantity(quantityReqLot);
worderStkBeanObj.setUpdQty(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()+"]");
worderStkBeanObj.setQuantity(quantityReqLot);
//worderStkBeanObj.setUpdQty(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()+"]");
worderStkBeanList.set(potencyCtr, worderStkBeanObj);// 09-mar-16 manoharan added for index based
}
}
......@@ -2392,7 +2656,7 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi
potencyAdjLot = Double.parseDouble(df.format(potencyAdjLot));
quantityReqLot = allocatedQty - potencyAdjLot;
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.setPotencyAdj(potencyAdjLot);
System.out.println("manohar before .setQuantity 5["+worderStkBeanObj.getQuantity()+"]");
......@@ -2400,7 +2664,7 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi
System.out.println("manohar after .setQuantity 5["+worderStkBeanObj.getQuantity()+"]");
worderStkBeanObj.setUpdQty(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);
}
......@@ -2424,8 +2688,13 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi
if (foundIndex > -1) // already exists add alloc_qty and petencyadj to existing
{
worderStkBeanObj = (WorderStkBean) worderStkBeanList.get(foundIndex);
worderStkBeanObj.setAllocQty(worderStkBeanObj.getAllocQty() + tempStkObj.getAllocQty());
worderStkBeanObj.setPotencyAdj(worderStkBeanObj.getPotencyAdj() + tempStkObj.getPotencyAdj());
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.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
}
else
......@@ -2440,8 +2709,10 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi
for(int potencyCtr = 0; potencyCtr < worderStkBeanList.size(); 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)
......@@ -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
{
ResultSet rs = null,rs1 = null;
PreparedStatement pstmt = null,pstmt1 = null;
PreparedStatement pstmt = null,pstmt1 = null, pstmtUpd = null;
StringBuffer reserveStkSql = new StringBuffer();
MfgCommon mfgCommon = new MfgCommon();
Map<String,String> returnMapDetails = new HashMap<String,String>();
......@@ -2492,6 +2763,7 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi
ArrayList<String> altItemCodeList = new ArrayList<String>();
ArrayList<String> invAllocateTranIDList = new ArrayList<String>();
WorderStkBean worderStkBeanObj = null;
java.sql.Timestamp expDate = null, mfgDate = null;
try
{
Calendar currentDate = Calendar.getInstance();
......@@ -2545,6 +2817,12 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi
System.out.println("Min Quantity Required="+minQtyReq);
//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+"]");
if(invAllocateTranIDList.size() > 0)
{
......@@ -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(" (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(" 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(" 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
reserveStkQty = rs.getDouble("inv_qty");
stkPotencyPerc = rs.getDouble("potency_perc");
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]
if(reserveStkQty < minQtyReq)
......@@ -2719,13 +2999,15 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi
worderStkBeanObj.setSiteCode(siteCode);
worderStkBeanObj.setItemCode(itemCode);
worderStkBeanObj.setStkQuantity(stkAvailQuantity);
worderStkBeanObj.setStkQuantity(stkAvailQuantity + reserveStkQty);
worderStkBeanObj.setReserveStkQty(reserveStkQty);
worderStkBeanObj.setItemDescr(itemDescr);
worderStkBeanObj.setStkPotencyPerc(stkPotencyPerc);
worderStkBeanObj.setWorkOrder(worder);
worderStkBeanObj.setExpLevel(expLevel);
worderStkBeanObj.setMfgDate(mfgDate);
worderStkBeanObj.setExpDate(expDate);
worderStkBeanObj.setItemRef(itemRef);
worderStkBeanObj.setCritItem(critItem);
worderStkBeanObj.setUnit(unit);
......@@ -2744,6 +3026,12 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi
worderStkBeanObj.setQuantity(reserveStkQty);
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;
//System.out.println("requiredQty------>>["+requiredQty+"]");
......@@ -2839,6 +3127,12 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi
returnMapDetails.put("IS_SUFFICIENT", "false");
}
// 20-may-16 manoharan update dealloc_qty in inv_alloc_det
pstmtUpd.executeBatch();
if(pstmtUpd !=null)
{
pstmtUpd.close();pstmtUpd = null;
}
/*
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 = ?";
......@@ -2848,8 +3142,8 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi
{
worderStkBeanObj = (WorderStkBean) worderStkBeanList.get(potencyCtr);
pstmt.setDouble(1, worderStkBeanObj.getAllocQty());
pstmt.setDouble(2, worderStkBeanObj.getAllocQty());
pstmt.setDouble(1, worderStkBeanObj.getReserveStkQty());
pstmt.setDouble(2, worderStkBeanObj.getReserveStkQty());
pstmt.setString(3,worderStkBeanObj.getReserveStkTranId());
pstmt.setInt(4,worderStkBeanObj.getReserveLineNo());
pstmt.addBatch();
......@@ -2861,7 +3155,7 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi
{
pstmt.close();pstmt = null;
}
}
}*/
}
......@@ -3225,6 +3519,26 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi
}
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
{
int retVal = -1;
......@@ -3792,17 +4106,17 @@ public String populateWorkOrderBill(Connection conn) throws Exception
System.out.println("workOrder------>>["+workOrder+"] workOrderDetail : ["+tempObj.getWorkOrder()+"]") ;
System.out.println("expLevel------>>["+expLevel+"] expLevelDetail : ["+tempObj.getExpLevel()+"]") ;
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()))
{
System.out.println("worderExpMap------>>["+worderExpMap+"]");
if(worderExpMap.containsKey(workOrder+":"+expLevel))
{
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 = ?";
pstmt1 = conn.prepareStatement(sql);
pstmt1.setDouble(1, tempObj.getUpdQty());
pstmt1.setDouble(1, tempObj.getAllocQty());
pstmt1.setDouble(2, tempObj.getPotencyAdj());
pstmt1.setString(3, workOrder);
pstmt1.setInt(4, wOrderBillObj.getOperation());
......@@ -3834,7 +4148,7 @@ public String populateWorkOrderBill(Connection conn) throws Exception
}
else
{
pstmt1.setDouble(10, tempObj.getUpdQty()); //alloc_qty
pstmt1.setDouble(10, tempObj.getAllocQty()); //alloc_qty
}
pstmt1.setTimestamp(11, getCurrtDate()); //alloc_date
pstmt1.setString(12, wOrderBillObj.getSiteCode());//site_code
......@@ -3865,7 +4179,7 @@ public String populateWorkOrderBill(Connection conn) throws Exception
pstmt1.setDouble(31, wOrderBillObj.getQuantity()); //quantity__std
int i = pstmt1.executeUpdate();
worderExpMap.put(workOrder+":"+expLevel, tempObj.getUpdQty());
worderExpMap.put(workOrder+":"+expLevel, tempObj.getAllocQty());
System.out.println("pstmt1 is null....................."+i);
if(pstmt !=null)
{
......@@ -3944,9 +4258,9 @@ public String populateWorkOrderBill(Connection conn) throws Exception
for(WorderStkBean WorderStkBeanObj : worderStkBeanList)
{
System.out.println("Going for item code["+WorderStkBeanObj.getItemCode()+"] and alloc quantity ["+WorderStkBeanObj.getAllocQty()+"]");
if("Y".equalsIgnoreCase(WorderStkBeanObj.getReserveStk()))
{
// 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()))
//{
//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
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
{
pstmt.close();pstmt = null;
} */
}
else
{
//}
//else
//{
sql = "SELECT ALLOC_QTY FROM STOCK where item_code = ? and site_code = ? and loc_code = ? "
+" and lot_no = ? and lot_sl = ? ";
pstmt = conn.prepareStatement(sql);
......@@ -4009,12 +4323,18 @@ public String populateWorkOrderBill(Connection conn) throws Exception
+" and lot_no = ? and lot_sl = ? ";
//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+"]");
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+"]");
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(3,WorderStkBeanObj.getSiteCode());
......@@ -4031,7 +4351,7 @@ public String populateWorkOrderBill(Connection conn) throws Exception
invAllocateMap = new HashMap();
invAllocTrace = new InvAllocTraceBean();
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_line", "" + lineNo);
invAllocateMap.put("site_code",WorderStkBeanObj.getSiteCode());
......@@ -4042,7 +4362,9 @@ public String populateWorkOrderBill(Connection conn) throws Exception
invAllocateMap.put("lot_no",WorderStkBeanObj.getLotNo());
invAllocateMap.put("lot_sl",WorderStkBeanObj.getLotSl());
//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_term",termId);
invAllocateMap.put("chg_win","w_woFirmplan");
......@@ -4061,7 +4383,7 @@ public String populateWorkOrderBill(Connection conn) throws Exception
{
rs.close();rs = null;
}
}
//}
if(! tranIDWorderMap.containsKey(WorderStkBeanObj.getWorkOrder()))
......@@ -6009,12 +6331,13 @@ public String populateWorkOrderBill(Connection conn) throws Exception
reserveStockXMl.append("<deallocated><![CDATA[" ).append( "" ).append( "]]></deallocated>\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( "<upd_qty><![CDATA[" ).append(Double.parseDouble(df.format(tempObj.getUpdQty())) ).append( "]]></upd_qty>\r\n" );
reserveStockXMl.append( "<qty_adj><![CDATA[" ).append( tempObj.getQtyAdj() ).append( "]]></qty_adj>\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.getPotencyAdj() ).append( "]]></qty_adj>\r\n" );
reserveStockXMl.append("<unit><![CDATA[" ).append( tempObj.getUnit() ).append( "]]></unit>\r\n" );
reserveStockXMl.append("</detail>");
}
else
//else
if ( tempObj.getAllocQty() - tempObj.getReserveStkQty() > 0)
{
cntStk++;
if(cntStk == 1)
......@@ -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("<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("<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("<other_site><![CDATA[" ).append("Y").append( "]]></other_site>\r\n" );
stockDetailXml.append("</detail>");
......@@ -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("<deallocated><![CDATA[" ).append( "" ).append( "]]></deallocated>\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( "<qty_adj><![CDATA[" ).append( tempObj.getQtyAdj() ).append( "]]></qty_adj>\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.getPotencyAdj() ).append( "]]></qty_adj>\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("</detail>");
......@@ -6368,15 +6691,18 @@ public String populateWorkOrderBill(Connection conn) throws Exception
siteItemBeanObj = (SiteItemSummaryBean) siteItemReqQtyList.get(outerCtr);
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++)
{
StkHmap = (HashMap) stockList.get(ctr);
mainQuantity = (Double) StkHmap.get("QUANTITY");
originalAllocQty = siteItemBeanObj.getOtherSiteQty();
issCriteria = getColumnDescr(conn,"ISS_CRITERIA","ITEM","ITEM_CODE",String.valueOf(StkHmap.get("ITEM_CODE")));
System.out.println("Issue Criteria found="+issCriteria);
// 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")));
//System.out.println("Issue Criteria found="+issCriteria);
System.out.println("Other site quantity allocated="+mainQuantity);
System.out.println("Original allocated="+originalAllocQty);
......@@ -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 = 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))
{
......@@ -6414,6 +6740,8 @@ public String populateWorkOrderBill(Connection conn) throws Exception
}
else
{
qtyPerArt = getQtyPerArt(stkKey,conn);
if(qtyPerArt > mainQuantity)
{
......
package ibase.webitm.ejb.mfg;
import java.util.ArrayList;
import java.util.Comparator;
import java.text.SimpleDateFormat;
public class WorderStkBean
{
......@@ -9,7 +12,7 @@ public class WorderStkBean
java.sql.Timestamp expDate = null,mfgDate = null;
private String locCode = "",lotNo = "",lotSl = "",siteCode = "",itemCode = "",itemRef = "",alternate = "",itemDescr = "",
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;
int reserveLineNo = 0;
......@@ -60,10 +63,6 @@ public class WorderStkBean
this.reserveStkQty = reserveStkQty;
}
public int getReserveLineNo() {
return reserveLineNo;
}
......@@ -137,7 +136,6 @@ public class WorderStkBean
this.dimension = dimension;
}
public double getStkPotencyPerc() {
return stkPotencyPerc;
}
......@@ -146,9 +144,6 @@ public class WorderStkBean
this.stkPotencyPerc = stkPotencyPerc;
}
public String getLocCode() {
return locCode;
}
......@@ -231,7 +226,6 @@ public class WorderStkBean
this.altItemCodeList = altItemCodeList;
}
//Changed by wasim on 23-03-2016 to get/set minimum quantity required [START]
public double getMinQtyReq() {
return minQtyReq;
......@@ -257,4 +251,30 @@ public class WorderStkBean
{
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