Commit c9b06ba4 authored by tmahadi's avatar tmahadi

changes related to firmplan as per new requirements


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@104358 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 64822e13
...@@ -10,36 +10,56 @@ public class SiteItemSummaryBean ...@@ -10,36 +10,56 @@ public class SiteItemSummaryBean
private String siteCode = "",itemCode = "",workOrder = "",siteCodeShip = "",transTran = "", private String siteCode = "",itemCode = "",workOrder = "",siteCodeShip = "",transTran = "",
locCode = "",lotSl="",lotNo="",lineNoOrder = ""; locCode = "",lotSl="",lotNo="",lineNoOrder = "";
private double otherSiteQty = 0; private double otherSiteQty = 0;
private double reqQuantity=0;
ArrayList stockList = new ArrayList(); ArrayList stockList = new ArrayList();
public String getTransTran() { public String getTransTran() {
return transTran; return transTran;
} }
public void setTransTran(String transTran) { public void setTransTran(String transTran) {
this.transTran = transTran; this.transTran = transTran;
} }
public String getSiteCodeShip() { public String getSiteCodeShip() {
return siteCodeShip; return siteCodeShip;
} }
public void setSiteCodeShip(String siteCodeShip) { public void setSiteCodeShip(String siteCodeShip) {
this.siteCodeShip = siteCodeShip; this.siteCodeShip = siteCodeShip;
} }
public String getWorkOrder() { public String getWorkOrder() {
return workOrder; return workOrder;
} }
public void setWorkOrder(String workOrder) { public void setWorkOrder(String workOrder) {
this.workOrder = workOrder; this.workOrder = workOrder;
} }
public double getOtherSiteQty(){ public double getOtherSiteQty(){
return otherSiteQty; return otherSiteQty;
} }
public void setOtherSiteQty(double otherSiteQty) public void setOtherSiteQty(double otherSiteQty)
{ {
this.otherSiteQty = otherSiteQty; System.out.println("before:::" + this.otherSiteQty);
this.otherSiteQty += otherSiteQty;
System.out.println("after:::" + this.otherSiteQty);
}
public double getReqQuantity(){
return reqQuantity;
}
public void setReqQuantity(double reqQuantity)
{
System.out.println("before required:::" + this.reqQuantity);
this.reqQuantity += reqQuantity;
System.out.println("after required:::" + this.reqQuantity);
} }
//Changed by wasim on 11-04-2016 to set allocated quantity with stock details [START] //Changed by wasim on 11-04-2016 to set allocated quantity with stock details [START]
public void setStockValues(HashMap hm) public void setStockValues(HashMap hm)throws Exception
{ {
HashMap oldStockMap = null; HashMap oldStockMap = null;
int index = indexofStock(hm); int index = indexofStock(hm);
...@@ -55,6 +75,7 @@ public class SiteItemSummaryBean ...@@ -55,6 +75,7 @@ public class SiteItemSummaryBean
System.out.println("SO/DO new quantity added="+totalQty); System.out.println("SO/DO new quantity added="+totalQty);
oldStockMap.put("QUANTITY", totalQty); oldStockMap.put("QUANTITY", totalQty);
stockList.set(index, oldStockMap); stockList.set(index, oldStockMap);
} }
else else
{ {
...@@ -71,6 +92,7 @@ public class SiteItemSummaryBean ...@@ -71,6 +92,7 @@ public class SiteItemSummaryBean
oldStockMap.put("EXP_DATE", hm.get("EXP_DATE")); oldStockMap.put("EXP_DATE", hm.get("EXP_DATE"));
stockList.add(hm); stockList.add(hm);
} }
} }
public ArrayList getStockList() public ArrayList getStockList()
...@@ -91,12 +113,14 @@ public class SiteItemSummaryBean ...@@ -91,12 +113,14 @@ public class SiteItemSummaryBean
this.nonAllocQty = nonAllocQty; this.nonAllocQty = nonAllocQty;
}*/ }*/
public String getSiteCode() { public String getSiteCode() {
return siteCode; return siteCode;
} }
public void setSiteCode(String siteCode) { public void setSiteCode(String siteCode) {
this.siteCode = siteCode; this.siteCode = siteCode;
} }
public String getItemCode() { public String getItemCode() {
return itemCode; return itemCode;
} }
public void setItemCode(String itemCode) { public void setItemCode(String itemCode) {
...@@ -104,18 +128,23 @@ public class SiteItemSummaryBean ...@@ -104,18 +128,23 @@ public class SiteItemSummaryBean
} }
//Changed by wasim on 11-04-2016 for get set method for stock update [START] //Changed by wasim on 11-04-2016 for get set method for stock update [START]
public String getLotNo() { public String getLotNo() {
return lotNo; return lotNo;
} }
public void setLotNo(String lotNo) { public void setLotNo(String lotNo) {
this.lotNo = lotNo; this.lotNo = lotNo;
} }
public String getLotSl() { public String getLotSl() {
return lotSl; return lotSl;
} }
public void setLotSl(String lotSl) { public void setLotSl(String lotSl) {
this.lotSl = lotSl; this.lotSl = lotSl;
} }
public String getLocCode() { public String getLocCode() {
return locCode; return locCode;
} }
public void setLocCode(String locCode) { public void setLocCode(String locCode) {
...@@ -159,6 +188,7 @@ public class SiteItemSummaryBean ...@@ -159,6 +188,7 @@ public class SiteItemSummaryBean
//Changed by wasim on on 13-07-2016 for get set method for line number order [START] //Changed by wasim on on 13-07-2016 for get set method for line number order [START]
public String getLineNoOrder() { public String getLineNoOrder() {
return lineNoOrder; return lineNoOrder;
} }
public void setLineNoOrder(String lineNoOrder) { public void setLineNoOrder(String lineNoOrder) {
...@@ -166,4 +196,11 @@ public class SiteItemSummaryBean ...@@ -166,4 +196,11 @@ public class SiteItemSummaryBean
} }
//Changed by wasim on on 11-04-2016 for get set method for line number order [END] //Changed by wasim on on 11-04-2016 for get set method for line number order [END]
/*@Override
public String toString() {
return "qty[" +this.getOtherSiteQty()+ "] lotno in site item bean[" +this.getLotNo()+ "]";
}*/
} }
...@@ -135,6 +135,7 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi ...@@ -135,6 +135,7 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi
Map<String,Boolean> worderExpLevSufficient = new HashMap<String,Boolean>(); Map<String,Boolean> worderExpLevSufficient = new HashMap<String,Boolean>();
CommonConstants commonConstantsObj = new CommonConstants(); CommonConstants commonConstantsObj = new CommonConstants();
ArrayList<String> workOrderList = new ArrayList<String>(); ArrayList<String> workOrderList = new ArrayList<String>();
ArrayList addlnStck = new ArrayList();
@SuppressWarnings("static-access") @SuppressWarnings("static-access")
String database = commonConstantsObj.DB_NAME; String database = commonConstantsObj.DB_NAME;
String campgnNoGlb = "",chgUser,termId = "",xtraParamsG = ""; String campgnNoGlb = "",chgUser,termId = "",xtraParamsG = "";
...@@ -147,6 +148,7 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi ...@@ -147,6 +148,7 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi
Map<String,Double>potencyAdjMapN = null; Map<String,Double>potencyAdjMapN = null;
Map<String,Double> AdjPotencyExplevQtyMap = null; Map<String,Double> AdjPotencyExplevQtyMap = null;
String leastExpdtActivRm = ""; String leastExpdtActivRm = "";
HashMap<String, String> sqlMap=new HashMap<String, String>();
public String process() throws RemoteException,ITMException public String process() throws RemoteException,ITMException
{ {
return ""; return "";
...@@ -158,6 +160,7 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi ...@@ -158,6 +160,7 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi
Document headerDom = null; Document headerDom = null;
Document detailDom = null; Document detailDom = null;
System.out.println("getData(xmlString,xmlString2,windowName,xtraParams CALLED..."+ xmlString); System.out.println("getData(xmlString,xmlString2,windowName,xtraParams CALLED..."+ xmlString);
try try
{ {
...@@ -272,7 +275,7 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi ...@@ -272,7 +275,7 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi
{ {
if(workOrder.length() > 0) { if(workOrder.length() > 0) {
int countCampaign = 0; int countCampaign = 0;
sql = "select count(*) as count from workorder where work_order = ? and campgn_no is not null"; sql = "select count(*) as count from workorder where work_order = ? and campgn_no is not null and status ! = 'F' ";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, workOrder); pstmt.setString(1, workOrder);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
...@@ -1095,15 +1098,15 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi ...@@ -1095,15 +1098,15 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi
System.out.println("Other site alternate Map return=="+stockReturnMap); System.out.println("Other site alternate Map return=="+stockReturnMap);
balanceQty = Double.parseDouble(stockReturnMap.get("BALANCE_QTY")); balanceQty = Double.parseDouble(stockReturnMap.get("BALANCE_QTY"));
errorCodeRet = stockReturnMap.get("ERROR_CODE"); errorCodeRet = stockReturnMap.get("ERROR_CODE");
//Uncommented by Azhar dtd 06/jan/17
//if ("Y".equalsIgnoreCase(tempWorderObj.getCritItem())) if ("Y".equalsIgnoreCase(tempWorderObj.getCritItem()))
//{ {
isSufficient = Boolean.parseBoolean(stockReturnMap.get("IS_SUFFICIENT")); isSufficient = Boolean.parseBoolean(stockReturnMap.get("IS_SUFFICIENT"));
//} }
//else else
//{ {
// isSufficient = true; isSufficient = true;
//} }
if(errorCodeRet.length() > 0) if(errorCodeRet.length() > 0)
{ {
return stockReturnMap; return stockReturnMap;
...@@ -1415,14 +1418,14 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi ...@@ -1415,14 +1418,14 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi
worderDetailBeanObj.setOperation(operationInt); worderDetailBeanObj.setOperation(operationInt);
worderDetailBeanObj.setCritItem(critItem); worderDetailBeanObj.setCritItem(critItem);
// 06-jun-16 manoharan add sufficient flag in list // 06-jun-16 manoharan add sufficient flag in list
if ("Y".equals(critItem)) /*if ("Y".equals(critItem))
{ {
isSufficient = false; isSufficient = false;
} }
else else
{ {
isSufficient = true; isSufficient = true;
} }*/
worderExpLevSufficient.put(worderDetailBeanObj.getWorkOrder()+":"+worderDetailBeanObj.getExpLev(), isSufficient); worderExpLevSufficient.put(worderDetailBeanObj.getWorkOrder()+":"+worderDetailBeanObj.getExpLev(), isSufficient);
// end 06-jun-16 manoharan add sufficient flag in list // end 06-jun-16 manoharan add sufficient flag in list
...@@ -2112,7 +2115,9 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi ...@@ -2112,7 +2115,9 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi
if(index > -1) if(index > -1)
{ {
siteItemSumBeanObj = siteItemReqQtyList.get(index); siteItemSumBeanObj = siteItemReqQtyList.get(index);
System.out.println("Printing siteItemBeanObj.getOtherSiteQty() before "+siteItemSumBeanObj.getOtherSiteQty());
siteItemSumBeanObj.setOtherSiteQty(Double.valueOf(updQty));
System.out.println("Printing siteItemBeanObj.getOtherSiteQty() after "+siteItemSumBeanObj.getOtherSiteQty());
siteItemSumBeanObj.setStockValues(siteItemMap); siteItemSumBeanObj.setStockValues(siteItemMap);
siteItemReqQtyList.set(index, siteItemSumBeanObj); siteItemReqQtyList.set(index, siteItemSumBeanObj);
...@@ -4315,6 +4320,7 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi ...@@ -4315,6 +4320,7 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi
stockSqlBuf.append("select nvl(stock.quantity,0) - nvl(stock.alloc_qty,0) as QUANTITY, stock.loc_code as LOC_CODE,"); stockSqlBuf.append("select nvl(stock.quantity,0) - nvl(stock.alloc_qty,0) as QUANTITY, stock.loc_code as LOC_CODE,");
stockSqlBuf.append("stock.lot_no as LOT_NO, stock.lot_sl as LOT_SL, nvl(stock.potency_perc,0) as POTENCY_PERC, stock.crea_date, " ); stockSqlBuf.append("stock.lot_no as LOT_NO, stock.lot_sl as LOT_SL, nvl(stock.potency_perc,0) as POTENCY_PERC, stock.crea_date, " );
stockSqlBuf.append(" stock.dimension, stock.SITE_CODE__MFG, stock.EXP_DATE as EXP_DATE, stock.UNIT, stock.ITEM_SER, stock.MFG_DATE, stock.ALLOC_QTY, stock.PACK_CODE "); stockSqlBuf.append(" stock.dimension, stock.SITE_CODE__MFG, stock.EXP_DATE as EXP_DATE, stock.UNIT, stock.ITEM_SER, stock.MFG_DATE, stock.ALLOC_QTY, stock.PACK_CODE ");
stockSqlBuf.append(",qty_per_art ");
} }
/*if("S".equalsIgnoreCase(detailSum)) /*if("S".equalsIgnoreCase(detailSum))
...@@ -4358,7 +4364,7 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi ...@@ -4358,7 +4364,7 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
System.out.println("locType------>>["+locType+"]"); System.out.println("locType------>>["+locType+"]");
stockSqlBuf.append(" from stock,location,invstat where stock.loc_code = location.loc_code and location.inv_stat = invstat.inv_stat "); stockSqlBuf.append(" from stock,location,invstat where stock.loc_code = location.loc_code and location.inv_stat = invstat.inv_stat ");
stockSqlBuf.append(" and stock.site_code = '"+siteCode+"' "); stockSqlBuf.append(" and stock.site_code = '"+siteCode+"' ");
stockSqlBuf.append(" and stock.item_code = '"+itemCode+"' "); stockSqlBuf.append(" and stock.item_code = '"+itemCode+"' ");
...@@ -4453,6 +4459,13 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi ...@@ -4453,6 +4459,13 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi
} }
System.out.println("Final return build SQL["+stockSqlBuf.toString()+"]"); System.out.println("Final return build SQL["+stockSqlBuf.toString()+"]");
if("Y".equalsIgnoreCase(otherSite) && (!"I".equalsIgnoreCase(detailSum)) && (!"S".equalsIgnoreCase(detailSum)))
{
System.out.println("to populate sql map::[" + siteCode.trim()+"@"+itemCode.trim()+"]");
sqlMap.put(siteCode.trim()+"@"+itemCode.trim(), stockSqlBuf.toString());
}
return stockSqlBuf.toString(); return stockSqlBuf.toString();
} }
private String checkNull(String str) private String checkNull(String str)
...@@ -6640,11 +6653,12 @@ public String populateWorkOrderBill(Connection conn,String campgnNo) throws Exce ...@@ -6640,11 +6653,12 @@ public String populateWorkOrderBill(Connection conn,String campgnNo) throws Exce
String sql = "",itemCode = "",siteCode = "",errorString = "",locCode = "",lotNo = "",lotSl = "",expLev = "", String sql = "",itemCode = "",siteCode = "",errorString = "",locCode = "",lotNo = "",lotSl = "",expLev = "",
siteCodeMfg = "",unit = "",sqlInsert = "",sqlOrder = "",OrderItemCode = "", orderSiteCode = ""; siteCodeMfg = "",unit = "",sqlInsert = "",sqlOrder = "",OrderItemCode = "", orderSiteCode = "";
String lineNo = ""; String lineNo = "";
HashMap strAllocate = null; HashMap strAllocate = null,addlnStckHmap = null;
Map deallocMap = null; Map deallocMap = null;
SiteItemSummaryBean siteSumBeanObj = new SiteItemSummaryBean();
InvAllocTraceBean invAllocTrace = new InvAllocTraceBean(); InvAllocTraceBean invAllocTrace = new InvAllocTraceBean();
ResultSet rs = null; ResultSet rs = null;
ArrayList addlnStockList = new ArrayList();
double allocQty =0,balanceQty = 0,QPerArtStk = 0, allocQtyStk = 0; double allocQty =0,balanceQty = 0,QPerArtStk = 0, allocQtyStk = 0;
Timestamp expDate = null,mfgDate = null; Timestamp expDate = null,mfgDate = null;
ResultSet rsOrder = null,rsQty = null; ResultSet rsOrder = null,rsQty = null;
...@@ -6672,15 +6686,15 @@ public String populateWorkOrderBill(Connection conn,String campgnNo) throws Exce ...@@ -6672,15 +6686,15 @@ public String populateWorkOrderBill(Connection conn,String campgnNo) throws Exce
/*sqlOrder = "SELECT D.ITEM_CODE,H.SITE_CODE__SHIP AS SITE_CODE,D.LINE_NO,D.QTY_CONFIRM AS QUANTITY,' ' AS EXP_LEV FROM DISTORDER H,DISTORDER_DET D WHERE H.DIST_ORDER = D.DIST_ORDER " /*sqlOrder = "SELECT D.ITEM_CODE,H.SITE_CODE__SHIP AS SITE_CODE,D.LINE_NO,D.QTY_CONFIRM AS QUANTITY,' ' AS EXP_LEV FROM DISTORDER H,DISTORDER_DET D WHERE H.DIST_ORDER = D.DIST_ORDER "
+ "AND H.DIST_ORDER = ?";*/ + "AND H.DIST_ORDER = ?";*/
sqlOrder = "select d.exp_lev,d.line_no__ord ,d.item_code ,d.loc_code,d.site_code,d.lot_no,d.lot_sl " + /*sqlOrder = "select d.line_no__ord ,d.item_code ,d.loc_code,d.site_code,d.lot_no,d.lot_sl " +
//" dt.qty_order as quantity " + //changed by azhar because of unique constraint in distorder alloc //",d.exp_lev, dt.qty_order as quantity " + //changed by azhar because of unique constraint in distorder alloc
"from cross_dock_alloc_det d " + "from cross_dock_alloc_det d " +
//", distorder_det dt " + //changed by azhar because of unique constraint in distorder alloc //", distorder_det dt " + //changed by azhar because of unique constraint in distorder alloc
"where " + "where " +
//"d.order_no = dt.dist_order and" + //"d.order_no = dt.dist_order and" +
" d.order_no = ? group by d.exp_lev,d.line_no__ord,d.item_code, d.loc_code, d.site_code, d.lot_no, d.lot_sl" ; " d.order_no = ? group by d.line_no__ord,d.item_code, d.loc_code, d.site_code, d.lot_no, d.lot_sl" ;
//",dt.qty_order"; //",dt.qty_order";
*/ //commented by azhar as told by manoharan sir[09/jan/17]
/*sqlOrder = " SELECT S.ITEM_CODE,S.LOC_CODE,S.SITE_CODE,S.LOT_NO,S.LOT_SL,D.LINE_NO__ORD AS LINE_NO,D.QUANTITY," /*sqlOrder = " SELECT S.ITEM_CODE,S.LOC_CODE,S.SITE_CODE,S.LOT_NO,S.LOT_SL,D.LINE_NO__ORD AS LINE_NO,D.QUANTITY,"
...@@ -6690,10 +6704,42 @@ public String populateWorkOrderBill(Connection conn,String campgnNo) throws Exce ...@@ -6690,10 +6704,42 @@ public String populateWorkOrderBill(Connection conn,String campgnNo) throws Exce
+ " AND D.LOT_NO = S.LOT_NO AND D.LOT_SL = S.LOT_SL " + " AND D.LOT_NO = S.LOT_NO AND D.LOT_SL = S.LOT_SL "
+ " AND D.ORDER_NO = ? ";*/ //commented by azhar as told by manoj sir + " AND D.ORDER_NO = ? ";*/ //commented by azhar as told by manoj sir
} }
//added by azhar as told by manoharan sir[09/jan/17][start]
pstmtInsert = conn.prepareStatement(sqlInsert); pstmtInsert = conn.prepareStatement(sqlInsert);
pstmtOrder = conn.prepareStatement(sqlOrder);
for(int siteCtr =0 ; siteCtr < siteItemReqQtyList.size() ; siteCtr++)
{
siteSumBeanObj = (SiteItemSummaryBean) siteItemReqQtyList.get(siteCtr);
addlnStockList = siteSumBeanObj.getStockList();
System.out.println("addln stock list for distorder alloc::" + addlnStockList.toString());
System.out.println("addln stock list size::" + addlnStockList.size());
for(int i = 0; i < addlnStockList.size();i++){
addlnStckHmap = (HashMap)addlnStockList.get(i);
OrderItemCode = (String) addlnStckHmap.get("ITEM_CODE");
locCode = (String) addlnStckHmap.get("LOC_CODE");
orderSiteCode = (String) addlnStckHmap.get("SITE_CODE");
lotNo = (String) addlnStckHmap.get("LOT_NO");
lotSl = (String) addlnStckHmap.get("LOT_SL");
balanceQty = Double.parseDouble(addlnStckHmap.get("QUANTITY").toString());
expDate = (Timestamp) addlnStckHmap.get("EXP_DATE");
siteCodeMfg = (String) addlnStckHmap.get("SITE_CODE__MFG");
mfgDate = (Timestamp) addlnStckHmap.get("MFG_DATE");
unit = (String) addlnStckHmap.get("UNIT");
lineNo = siteSumBeanObj.getLineNoOrder();
deallocMap = new HashMap();
strAllocate = new HashMap();
//added by azhar as told by manoharan sir[09/jan/17][end]
/*pstmtOrder = conn.prepareStatement(sqlOrder);
pstmtOrder.setString(1, orderNo); pstmtOrder.setString(1, orderNo);
rsOrder = pstmtOrder.executeQuery(); rsOrder = pstmtOrder.executeQuery();
...@@ -6709,7 +6755,7 @@ public String populateWorkOrderBill(Connection conn,String campgnNo) throws Exce ...@@ -6709,7 +6755,7 @@ public String populateWorkOrderBill(Connection conn,String campgnNo) throws Exce
lotSl = rsOrder.getString("LOT_SL"); lotSl = rsOrder.getString("LOT_SL");
lineNo = rsOrder.getString("line_no__ord"); lineNo = rsOrder.getString("line_no__ord");
//balanceQty = rsOrder.getDouble("quantity"); //balanceQty = rsOrder.getDouble("quantity");
expLev = rsOrder.getString("EXP_LEV"); //expLev = rsOrder.getString("EXP_LEV");
sql = "select exp_date,site_code__mfg,mfg_date,unit,quantity,alloc_qty,qty_per_art from stock where item_code = ? and loc_code = ?" + sql = "select exp_date,site_code__mfg,mfg_date,unit,quantity,alloc_qty,qty_per_art from stock where item_code = ? and loc_code = ?" +
" and site_code = ? and lot_no = ? and lot_sl = ?"; " and site_code = ? and lot_no = ? and lot_sl = ?";
...@@ -6736,16 +6782,8 @@ public String populateWorkOrderBill(Connection conn,String campgnNo) throws Exce ...@@ -6736,16 +6782,8 @@ public String populateWorkOrderBill(Connection conn,String campgnNo) throws Exce
balanceQty = QPerArtStk; balanceQty = QPerArtStk;
}//if part of quantity is allocated }//if part of quantity is allocated*/
/*sql = "select qty_order from distorder_det where dist_order= ?and item_code = ? ";
pstmtQty = conn.prepareStatement(sql);
pstmtQty.setString(1, orderNo);
pstmtQty.setString(2, OrderItemCode);
rsQty = pstmtQty.executeQuery();
if(rsQty.next()){
balanceQty = rsQty.getDouble("qty_order");
}*/
/*OrderItemCode = rsOrder.getString("ITEM_CODE"); /*OrderItemCode = rsOrder.getString("ITEM_CODE");
locCode = rsOrder.getString("LOC_CODE"); locCode = rsOrder.getString("LOC_CODE");
...@@ -6824,15 +6862,17 @@ public String populateWorkOrderBill(Connection conn,String campgnNo) throws Exce ...@@ -6824,15 +6862,17 @@ public String populateWorkOrderBill(Connection conn,String campgnNo) throws Exce
} }
strAllocate = null; strAllocate = null;
deallocMap = null; deallocMap = null;
}
//pstmtInsert.executeBatch(); //pstmtInsert.executeBatch();
pstmtInsert.close();pstmtInsert = null;
rsOrder.close();rsOrder = null; //rsOrder.close();rsOrder = null;
pstmtOrder.close();pstmtOrder = null; //pstmtOrder.close();pstmtOrder = null;
//pstmtQty.close();pstmtQty = null; //pstmtQty.close();pstmtQty = null;
//rsQty.close();rsQty = null; //rsQty.close();rsQty = null;
}
}
} }
catch(Exception e) catch(Exception e)
{ {
...@@ -6852,14 +6892,7 @@ public String populateWorkOrderBill(Connection conn,String campgnNo) throws Exce ...@@ -6852,14 +6892,7 @@ public String populateWorkOrderBill(Connection conn,String campgnNo) throws Exce
{ {
pstmt.close();pstmt = null; pstmt.close();pstmt = null;
} }
if(rsOrder!=null)
{
rsOrder.close();rsOrder = null;
}
if(pstmtOrder!=null)
{
pstmtOrder.close();pstmtOrder = null;
}
if(pstmtInsert!=null) if(pstmtInsert!=null)
{ {
pstmtInsert.close();pstmtInsert = null; pstmtInsert.close();pstmtInsert = null;
...@@ -7693,7 +7726,236 @@ public String populateWorkOrderBill(Connection conn,String campgnNo) throws Exce ...@@ -7693,7 +7726,236 @@ public String populateWorkOrderBill(Connection conn,String campgnNo) throws Exce
return qtyPerArt; return qtyPerArt;
} }
@SuppressWarnings("rawtypes") public void roundQuantity(Connection conn,String campgnNo) throws Exception
{
SiteItemSummaryBean siteItemBeanObj = null;
ArrayList stockList = null;
HashMap StkHmap = null;
double roundOffQty = 0,mainQuantity = 0,qtyPerArt = 0,itemQuantity = 0,originalAllocQty = 0,quantity = 0,roundOffQtyNew = 0;
String issCriteria = "",allocRetStr = "",sql= "";
PreparedStatement pstmt = null;
ResultSet rs = null;
double reqQuantity=0,otherSiteQty=0;
String sqlForAddStock="";
double availQty=0;
String siteCodestr="",itemCodestr="",lotNostr="",lotSlstr="",locCodestr="";
String unit = "",siteCodeMfg = "";
java.sql.Timestamp mfgDateT = null, expDateT = null;
try
{
for(int outerCtr=0 ; outerCtr < siteItemReqQtyList.size(); outerCtr++)
{
reqQuantity=0;
otherSiteQty=0;
siteItemBeanObj = (SiteItemSummaryBean) siteItemReqQtyList.get(outerCtr);
System.out.println("Printing siteItemBeanObj.getOtherSiteQty() in roundQuantity method "+siteItemBeanObj.getOtherSiteQty());
stockList = siteItemBeanObj.getStockList();
// 06-jun-16 manoharan moved below inside loop
issCriteria = getColumnDescr(conn,"ISS_CRITERIA","ITEM","ITEM_CODE",(String) siteItemBeanObj.getItemCode(),campgnNo);
//System.out.println("Issue Criteria found="+issCriteria);
for (int ctr = 0; ctr < stockList.size(); ctr++)
{
StkHmap = (HashMap) stockList.get(ctr);
originalAllocQty = (Double) StkHmap.get("QUANTITY");
//originalAllocQty = siteItemBeanObj.getOtherSiteQty();
//mainQuantity = siteItemBeanObj.getOtherSiteQty();
mainQuantity=(Double) StkHmap.get("QUANTITY");
siteItemBeanObj.setReqQuantity(mainQuantity);
siteItemReqQtyList.set(outerCtr, siteItemBeanObj);
// 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("stock map first time::" + StkHmap.toString());
System.out.println("Other site quantity allocated="+mainQuantity);
System.out.println("Original allocated="+originalAllocQty);
//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);
if("W".equalsIgnoreCase(issCriteria))
{
sql = "SELECT (QUANTITY - ALLOC_QTY) AS QUANTITY FROM STOCK WHERE ITEM_CODE = ? AND SITE_CODE = ? AND LOC_CODE = ? AND LOT_NO = ? AND LOT_SL = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, (String) StkHmap.get("ITEM_CODE"));
pstmt.setString(2, (String) StkHmap.get("SITE_CODE"));
pstmt.setString(3, (String) StkHmap.get("LOC_CODE"));
pstmt.setString(4, (String) StkHmap.get("LOT_NO"));
pstmt.setString(5, (String) StkHmap.get("LOT_SL"));
rs = pstmt.executeQuery();
if(rs.next())
{
quantity = rs.getDouble("QUANTITY");
}
if(pstmt!=null)
{
pstmt.close();pstmt = null;
}
if(rs!=null)
{
rs.close();rs = null;
}
roundOffQty = quantity;
}
else
{
qtyPerArt = getQtyPerArt(stkKey,conn,campgnNo);
if(qtyPerArt > mainQuantity)
{
roundOffQty = qtyPerArt;
}
else
{
System.out.println("allocated quantity will be 2 shippersize");
double noArtQuot = 0,noArtRem = 0,noArt = 0;
noArtQuot= mainQuantity / qtyPerArt ;
noArtRem = mainQuantity % qtyPerArt ;
if(noArtRem > 0)
{
noArtRem = 1;
}
noArtQuot = (int) noArtQuot;
noArt = noArtQuot + noArtRem;
System.out.println("NO Art in current site="+noArt);
roundOffQty = qtyPerArt * noArt;
}
}
if(roundOffQty != originalAllocQty)
{
System.out.println("Original["+originalAllocQty+"] and Round Off["+roundOffQty+"]");
if(!"W".equalsIgnoreCase(issCriteria))
{
roundOffQtyNew = roundOffQty - originalAllocQty;
}
Map stockAllocMap = new HashMap();
stockAllocMap.put("ALLOC_QTY",""+roundOffQtyNew);
stockAllocMap.put("LOC_CODE", (String) StkHmap.get("LOC_CODE"));
stockAllocMap.put("ITEM_CODE",(String) StkHmap.get("ITEM_CODE"));
stockAllocMap.put("SITE_CODE",(String) StkHmap.get("SITE_CODE"));
stockAllocMap.put("LOT_NO",(String) StkHmap.get("LOT_NO"));
stockAllocMap.put("LOT_SL",(String) StkHmap.get("LOT_SL"));
stockAllocMap.put("QUANTITY",""+roundOffQtyNew);
stockAllocMap.put("UNIT", StkHmap.get("UNIT"));
stockAllocMap.put("SITE_CODE__MFG", StkHmap.get("site_code__mfg"));
stockAllocMap.put("MFG_DATE", StkHmap.get("mfg_date"));
stockAllocMap.put("EXP_DATE", StkHmap.get("exp_date"));
System.out.println("first time map::["+stockAllocMap+"]");
allocRetStr = updateStockAllocQty(stockAllocMap,conn,campgnNo);
System.out.println("After DO Stock updated"+allocRetStr);
siteItemBeanObj.setOtherSiteQty(roundOffQtyNew);
//
siteItemBeanObj.setStockValues((HashMap<String, String>) stockAllocMap);
siteItemReqQtyList.set(outerCtr, siteItemBeanObj);
}
}
//reqQuantity = siteItemBeanObj.getReqQuantity();
otherSiteQty=siteItemBeanObj.getOtherSiteQty();
//double addQtyReqd=0;
reqQuantity=siteItemBeanObj.getReqQuantity();
System.out.println("required qty:: roundquantity::::" + reqQuantity);
System.out.println("othersite qty :roundquantity:::" + otherSiteQty);
if(reqQuantity==otherSiteQty)
{
//addQtyReqd=reqQuantity*5/100;
sqlForAddStock=sqlMap.get(siteItemBeanObj.getSiteCodeShip().trim()+"@"+siteItemBeanObj.getItemCode().trim());
System.out.println("round quantity key::[" + siteItemBeanObj.getSiteCodeShip().trim()+"@"+siteItemBeanObj.getItemCode().trim()+"]");
System.out.println("sqlForAddStock["+sqlForAddStock+"]");
pstmt=conn.prepareStatement(sqlForAddStock);
rs=pstmt.executeQuery();
while(rs.next())
{
availQty=rs.getDouble("QUANTITY");
double qtyPerArticle=0;
qtyPerArticle=rs.getDouble("qty_per_art");
siteCodestr=rs.getString("SITE_CODE__MFG");
itemCodestr=siteItemBeanObj.getItemCode().trim();
lotNostr=rs.getString("lot_no");
lotSlstr=rs.getString("lot_sl");
locCodestr=rs.getString("loc_code");
unit = rs.getString("UNIT");
siteCodeMfg = rs.getString("site_code__mfg");
mfgDateT = rs.getTimestamp("mfg_date");
expDateT = rs.getTimestamp("exp_date");
if(availQty>=qtyPerArticle)
{
Map stockAllocMapAddnl = new HashMap();
stockAllocMapAddnl.put("ALLOC_QTY",""+qtyPerArticle);
stockAllocMapAddnl.put("LOC_CODE", locCodestr);
stockAllocMapAddnl.put("ITEM_CODE",itemCodestr);
stockAllocMapAddnl.put("SITE_CODE",siteCodestr);
stockAllocMapAddnl.put("LOT_NO",lotNostr);
stockAllocMapAddnl.put("LOT_SL",lotSlstr);
stockAllocMapAddnl.put("QUANTITY",""+qtyPerArticle);
stockAllocMapAddnl.put("UNIT", unit);
stockAllocMapAddnl.put("SITE_CODE__MFG", siteCodeMfg);
stockAllocMapAddnl.put("MFG_DATE", mfgDateT);
stockAllocMapAddnl.put("EXP_DATE", expDateT);
System.out.println("stockAllocMapAddnl["+stockAllocMapAddnl+"]");
allocRetStr = updateStockAllocQty(stockAllocMapAddnl,conn,campgnNo);
System.out.println("After DO Stock updated again:::"+allocRetStr);
siteItemBeanObj.setOtherSiteQty(qtyPerArticle);
siteItemBeanObj.setStockValues((HashMap<String, String>) stockAllocMapAddnl);
siteItemReqQtyList.set(outerCtr, siteItemBeanObj);
break;
}
}
if(rs!=null)
{
rs.close();
rs = null;
}
if(pstmt!=null)
{
pstmt.close();
pstmt = null;
}
}
}
}
catch(Exception e)
{
writeWorkOrderLog(e.toString(),campgnNo);//TODO
throw new Exception(e);
}
finally
{
if(pstmt!=null)
{
pstmt.close();pstmt = null;
}
if(rs!=null)
{
rs.close();rs = null;
}
}
}
/* @SuppressWarnings("rawtypes")
public void roundQuantity(Connection conn,String campgnNo) throws Exception public void roundQuantity(Connection conn,String campgnNo) throws Exception
{ {
SiteItemSummaryBean siteItemBeanObj = null; SiteItemSummaryBean siteItemBeanObj = null;
...@@ -7708,9 +7970,7 @@ public String populateWorkOrderBill(Connection conn,String campgnNo) throws Exce ...@@ -7708,9 +7970,7 @@ public String populateWorkOrderBill(Connection conn,String campgnNo) throws Exce
int stockSize=0; int stockSize=0;
try try
{ {
for(int outerCtr=0 ; outerCtr < siteItemReqQtyList.size(); outerCtr++) for(int outerCtr=0 ; outerCtr < siteItemReqQtyList.size(); outerCtr++)
{ {
siteItemBeanObj = (SiteItemSummaryBean) siteItemReqQtyList.get(outerCtr); siteItemBeanObj = (SiteItemSummaryBean) siteItemReqQtyList.get(outerCtr);
...@@ -7889,7 +8149,7 @@ public String populateWorkOrderBill(Connection conn,String campgnNo) throws Exce ...@@ -7889,7 +8149,7 @@ public String populateWorkOrderBill(Connection conn,String campgnNo) throws Exce
//if(stockSize<2) //if(stockSize<2)
//{ //{
//commented by azhar[start] //commented by azhar[start]
/*if(roundOffQty != originalAllocQty)//changed by manoj dtd 28/12/2016 if(roundOffQty != originalAllocQty)//changed by manoj dtd 28/12/2016
{ {
System.out.println("Original["+originalAllocQty+"] and Round Off["+roundOffQty+"]"); System.out.println("Original["+originalAllocQty+"] and Round Off["+roundOffQty+"]");
if(!"W".equalsIgnoreCase(issCriteria)) if(!"W".equalsIgnoreCase(issCriteria))
...@@ -7918,9 +8178,9 @@ public String populateWorkOrderBill(Connection conn,String campgnNo) throws Exce ...@@ -7918,9 +8178,9 @@ public String populateWorkOrderBill(Connection conn,String campgnNo) throws Exce
siteItemBeanObj.setStockValues((HashMap<String, String>) stockAllocMap); siteItemBeanObj.setStockValues((HashMap<String, String>) stockAllocMap);
siteItemReqQtyList.set(outerCtr, siteItemBeanObj); siteItemReqQtyList.set(outerCtr, siteItemBeanObj);
} */ //commented by azhar[end] } //commented by azhar[end]
// } // }
/*else else
{ {
if(PrevStockHmap!=null)//Condition added by manoj dtd 28/12/2016 if(PrevStockHmap!=null)//Condition added by manoj dtd 28/12/2016
{ {
...@@ -7956,13 +8216,13 @@ public String populateWorkOrderBill(Connection conn,String campgnNo) throws Exce ...@@ -7956,13 +8216,13 @@ public String populateWorkOrderBill(Connection conn,String campgnNo) throws Exce
siteItemReqQtyList.set(outerCtr, siteItemBeanObj); siteItemReqQtyList.set(outerCtr, siteItemBeanObj);
} }
} }
}*/ }
/*if(stockList.size() > 1){ if(stockList.size() > 1){
count++; count++;
System.out.println("count when multiple lots::" + count); System.out.println("count when multiple lots::" + count);
} }
PrevStockHmap = (HashMap) stockList.get(ctr);*/ PrevStockHmap = (HashMap) stockList.get(ctr);
} }
} }
} }
...@@ -7982,7 +8242,5 @@ public String populateWorkOrderBill(Connection conn,String campgnNo) throws Exce ...@@ -7982,7 +8242,5 @@ public String populateWorkOrderBill(Connection conn,String campgnNo) throws Exce
rs.close();rs = null; rs.close();rs = null;
} }
} }
} }*/
} }
...@@ -8,7 +8,7 @@ import java.text.SimpleDateFormat; ...@@ -8,7 +8,7 @@ import java.text.SimpleDateFormat;
public class WorderStkBean public class WorderStkBean
{ {
private double potencyAdj = 0,stkQuantityNew = 0,updQty = 0,qtyAdj = 0,reserveStkQty = 0; private double potencyAdj = 0,stkQuantityNew = 0,updQty = 0,qtyAdj = 0,reserveStkQty = 0;
private double allocQty = 0,stkQuantity = 0,stkPotencyPerc = 0,actualAllocQty = 0,requiredQty = 0; private double allocQty = 0,stkQuantity = 0,stkPotencyPerc = 0,actualAllocQty = 0;
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 = "",
...@@ -204,14 +204,8 @@ public class WorderStkBean ...@@ -204,14 +204,8 @@ public class WorderStkBean
public void setStkQuantity(double stkQuantity) { public void setStkQuantity(double stkQuantity) {
this.stkQuantity = stkQuantity; this.stkQuantity = stkQuantity;
} }
/*
public double getRequiredQuantity() {
return requiredQty;
}
public void setRequiredQuantity(double requiredQty) {
this.requiredQty = requiredQty;
}
*/
public String getCritItem() { public String getCritItem() {
return critItem; return critItem;
} }
...@@ -258,6 +252,12 @@ public class WorderStkBean ...@@ -258,6 +252,12 @@ public class WorderStkBean
return quantity; return quantity;
} }
@Override
public String toString() {
return " in work order bean Item Code:[" + this.getItemCode() +"], Lot No:["+ this.getLotNo() +"], lotsl [" + this.getLotSl() + "], loccode [" + this.getLocCode() +"]";
}
/* 31-may-16 manoharan Comparator for sorting the list by work_order,exp_lev, exp_date*/ /* 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 static Comparator<WorderStkBean> WoStkBeanComparator = new Comparator<WorderStkBean>() {
...@@ -282,5 +282,7 @@ public class WorderStkBean ...@@ -282,5 +282,7 @@ public class WorderStkBean
//return KeyStockBean2.compareTo(KeyStockBean1); //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