Commit 11695c18 authored by msingh's avatar msingh

Change in UploadOrderEJB for setting Exchange Rate from FinnCommon


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@100256 ce508802-f39f-4f6c-b175-0d175dae99d5
parent bfd4192b
...@@ -43,6 +43,7 @@ import ibase.webitm.ejb.ITMDBAccessEJB; ...@@ -43,6 +43,7 @@ import ibase.webitm.ejb.ITMDBAccessEJB;
import ibase.webitm.ejb.MasterStatefulLocal; import ibase.webitm.ejb.MasterStatefulLocal;
import ibase.webitm.ejb.dis.DistCommon; import ibase.webitm.ejb.dis.DistCommon;
import ibase.webitm.ejb.dis.InvAllocTraceBean; import ibase.webitm.ejb.dis.InvAllocTraceBean;
import ibase.webitm.ejb.fin.FinCommon;
import ibase.webitm.utility.ITMException; import ibase.webitm.utility.ITMException;
import ibase.webitm.utility.TransIDGenerator; import ibase.webitm.utility.TransIDGenerator;
import ibase.webitm.utility.wms.CommonWmsUtil; import ibase.webitm.utility.wms.CommonWmsUtil;
...@@ -58,8 +59,8 @@ public class UploadOrderEJB extends ActionHandlerEJB implements UploadOrderEJBLo ...@@ -58,8 +59,8 @@ public class UploadOrderEJB extends ActionHandlerEJB implements UploadOrderEJBLo
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
ResultSet rs = null; ResultSet rs = null;
String sql = "",retString = "",siteCode = "",itemCodeOrd = "",unitRate = "",custCodeH = "", String sql = "",retString = "",siteCode = "",itemCodeOrd = "",unitRate = "",custCodeH = "",
packCode = "",quantity = "",saleOrderNo = "",itemCodeS = "",lineNoS = "",rate = "", packCode = "",quantity = "",saleOrderNo = "",itemCodeS = "",lineNoS = "",rate = "",
custTranId = "",newCustCode = "",ErrSaleOrder = "",taxCodeFinParm = ""; custTranId = "",newCustCode = "",ErrSaleOrder = "",taxCodeFinParm = "",currCode = "";
String orderCheck = "N"; //Changed by wasim on 03-07-2015 String orderCheck = "N"; //Changed by wasim on 03-07-2015
int taxAmt = 0, taxAmtMagento = 0; //Changed by wasim on 03-07-2015 int taxAmt = 0, taxAmtMagento = 0; //Changed by wasim on 03-07-2015
ITMDBAccessEJB itmDBAccessEJB = new ITMDBAccessEJB(); //Changed by wasim on 03-07-2015 ITMDBAccessEJB itmDBAccessEJB = new ITMDBAccessEJB(); //Changed by wasim on 03-07-2015
...@@ -72,6 +73,12 @@ public class UploadOrderEJB extends ActionHandlerEJB implements UploadOrderEJBLo ...@@ -72,6 +73,12 @@ public class UploadOrderEJB extends ActionHandlerEJB implements UploadOrderEJBLo
java.sql.Timestamp currDate = null; java.sql.Timestamp currDate = null;
boolean isError = false; boolean isError = false;
CommonWmsUtil commonUtilObj = new CommonWmsUtil(); CommonWmsUtil commonUtilObj = new CommonWmsUtil();
FinCommon finCommon = new FinCommon();
DistCommon distcommon = new DistCommon();
String exchRate = "";
String finEntity = "";
String finCurrCode = "";
try try
{ {
...@@ -150,7 +157,81 @@ public class UploadOrderEJB extends ActionHandlerEJB implements UploadOrderEJBLo ...@@ -150,7 +157,81 @@ public class UploadOrderEJB extends ActionHandlerEJB implements UploadOrderEJBLo
setNodeValue(dom, "cust_code__dlv", newCustCode); setNodeValue(dom, "cust_code__dlv", newCustCode);
setNodeValue(dom, "cust_code__bil", newCustCode); setNodeValue(dom, "cust_code__bil", newCustCode);
System.out.println("siteCodeG------>>["+siteCodeG+"]"); System.out.println("siteCodeG------>>["+siteCodeG+"]");
//Changed by manish on 23/02/16 for setting Exchange Rate from FinnCommon [start]
currCode = checkNull(headerValuesMap.get("curr_code"));
sql = " SELECT FIN_ENTITY FROM SITE WHERE SITE_CODE = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,siteCodeG);
rs = pstmt.executeQuery();
while (rs.next())
{
finEntity = checkNullAndTrim(rs.getString("FIN_ENTITY"));
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
sql = " SELECT CURR_CODE FROM FINENT WHERE FIN_ENTITY = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,finEntity);
rs = pstmt.executeQuery();
while (rs.next())
{
finCurrCode = checkNullAndTrim(rs.getString("CURR_CODE"));
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
if(currCode.equals(finCurrCode))
{
exchRate = "1";
System.out.println("Exchange Rate is="+exchRate);
}
else
{
System.out.println("TODAY IS="+currDateStr);
System.out.println("Order Site="+siteCodeG);
Double exchRateFinn = finCommon.getDailyExchRateSellBuy(currCode.trim(),"",siteCodeG.trim(),currDateStr.trim(),"S", conn);
if(exchRateFinn != null)
{
exchRateFinn = distcommon.getRndamt(exchRateFinn, "R", 0.000001);
}
exchRate = String.valueOf(exchRateFinn);
System.out.println("Exch Rate from FinnCommon="+exchRate);
if(exchRate != null && exchRate.equals(""))
{
sql = " SELECT std_exrt FROM currency WHERE CURR_CODE = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,currCode);
rs = pstmt.executeQuery();
if(rs.next())
{
exchRate = checkNullAndTrim(rs.getString("std_exrt"));
}
rs.close(); rs = null;
pstmt.close(); pstmt = null;
}
System.out.println("Exchange Rate is="+exchRate);
}
setNodeValue(dom, "exch_rate", exchRate);
//Changed by manish on 23/02/16 for setting Exchange Rate from FinnCommon [end]
xmlString = genericUtility.serializeDom(dom); xmlString = genericUtility.serializeDom(dom);
ErrSaleOrder = genericUtility.getColumnValue("sale_order", dom); ErrSaleOrder = genericUtility.getColumnValue("sale_order", dom);
System.out.println("ErrSaleOrder------>>["+ErrSaleOrder+"]"); System.out.println("ErrSaleOrder------>>["+ErrSaleOrder+"]");
...@@ -166,10 +247,10 @@ public class UploadOrderEJB extends ActionHandlerEJB implements UploadOrderEJBLo ...@@ -166,10 +247,10 @@ public class UploadOrderEJB extends ActionHandlerEJB implements UploadOrderEJBLo
System.out.println("Transaction committed successfully........"); System.out.println("Transaction committed successfully........");
String[] arrayForTranId = retString.split("<TranID>"); String[] arrayForTranId = retString.split("<TranID>");
int endIndex = arrayForTranId[1].indexOf("</TranID>"); int endIndex = arrayForTranId[1].indexOf("</TranID>");
saleOrderNo = arrayForTranId[1].substring(0,endIndex); saleOrderNo = arrayForTranId[1].substring(0,endIndex);
System.out.println("saleOrderNo------>>>["+saleOrderNo+"]"); System.out.println("saleOrderNo------>>>["+saleOrderNo+"]");
//Changed by wasim on 03-07-2015 to check tax_amount with megento server [START] //Changed by wasim on 03-07-2015 to check tax_amount with megento server [START]
sql="SELECT VAR_VALUE FROM DISPARM WHERE VAR_NAME = 'IS_ORDER_CHECK' "; sql="SELECT VAR_VALUE FROM DISPARM WHERE VAR_NAME = 'IS_ORDER_CHECK' ";
pstmt=conn.prepareStatement(sql); pstmt=conn.prepareStatement(sql);
...@@ -182,11 +263,11 @@ public class UploadOrderEJB extends ActionHandlerEJB implements UploadOrderEJBLo ...@@ -182,11 +263,11 @@ public class UploadOrderEJB extends ActionHandlerEJB implements UploadOrderEJBLo
rs=null; rs=null;
pstmt.close(); pstmt.close();
pstmt=null; pstmt=null;
if(orderCheck.equals("Y")) if(orderCheck.equals("Y"))
{ {
sql=" SELECT SUM(TAX_AMT) AS TAXAMOUNT FROM TAXTRAN T,TAX X WHERE T.TRAN_ID = ? "+ sql=" SELECT SUM(TAX_AMT) AS TAXAMOUNT FROM TAXTRAN T,TAX X WHERE T.TRAN_ID = ? "+
" AND T.TRAN_CODE = 'S-ORD' AND TRIM(T.TAX_CODE) = TRIM(X.TAX_CODE) AND X.TAX_TYPE ='S' "; " AND T.TRAN_CODE = 'S-ORD' AND TRIM(T.TAX_CODE) = TRIM(X.TAX_CODE) AND X.TAX_TYPE ='S' ";
pstmt=conn.prepareStatement(sql); pstmt=conn.prepareStatement(sql);
pstmt.setString(1, saleOrderNo); pstmt.setString(1, saleOrderNo);
rs=pstmt.executeQuery(); rs=pstmt.executeQuery();
...@@ -301,7 +382,7 @@ public class UploadOrderEJB extends ActionHandlerEJB implements UploadOrderEJBLo ...@@ -301,7 +382,7 @@ public class UploadOrderEJB extends ActionHandlerEJB implements UploadOrderEJBLo
} }
/*retString = confirmSaleOrder("sorder",saleOrderNo,xtraParams,"",conn); /*retString = confirmSaleOrder("sorder",saleOrderNo,xtraParams,"",conn);
System.out.println("After retString------>>["+retString+"]"); System.out.println("After retString------>>["+retString+"]");
if(retString !=null && retString.indexOf("PRCSTATUS") > -1) if(retString !=null && retString.indexOf("PRCSTATUS") > -1)
...@@ -368,7 +449,7 @@ public class UploadOrderEJB extends ActionHandlerEJB implements UploadOrderEJBLo ...@@ -368,7 +449,7 @@ public class UploadOrderEJB extends ActionHandlerEJB implements UploadOrderEJBLo
e.printStackTrace(); e.printStackTrace();
e.printStackTrace(new PrintWriter(errors)); e.printStackTrace(new PrintWriter(errors));
return errors.toString(); return errors.toString();
} }
finally finally
{ {
...@@ -415,7 +496,7 @@ public class UploadOrderEJB extends ActionHandlerEJB implements UploadOrderEJBLo ...@@ -415,7 +496,7 @@ public class UploadOrderEJB extends ActionHandlerEJB implements UploadOrderEJBLo
System.out.println("attachement Flag-------"+attachFlag); System.out.println("attachement Flag-------"+attachFlag);
System.out.println("formatCode-------"+formatCode); System.out.println("formatCode-------"+formatCode);
System.out.println("attachPath-------"+attachPath); System.out.println("attachPath-------"+attachPath);
if(saleOrderNo != null && saleOrderNo.length() > 0) if(saleOrderNo != null && saleOrderNo.length() > 0)
{ {
fileName1 = saleOrderNo+"_Error"; fileName1 = saleOrderNo+"_Error";
...@@ -424,13 +505,13 @@ public class UploadOrderEJB extends ActionHandlerEJB implements UploadOrderEJBLo ...@@ -424,13 +505,13 @@ public class UploadOrderEJB extends ActionHandlerEJB implements UploadOrderEJBLo
{ {
fileName1 = "ErrorSalesIntegration"; fileName1 = "ErrorSalesIntegration";
} }
String separator = String.valueOf( attachPath.charAt(attachPath.length() - 1)); String separator = String.valueOf( attachPath.charAt(attachPath.length() - 1));
if(!separator.equalsIgnoreCase(File.separator) ) if(!separator.equalsIgnoreCase(File.separator) )
{ {
attachPath = attachPath + File.separator; attachPath = attachPath + File.separator;
} }
System.out.println("Error File Name--->>["+fileName1+"]"); System.out.println("Error File Name--->>["+fileName1+"]");
System.out.println("Error File Path--->>["+attachPath+"]"); System.out.println("Error File Path--->>["+attachPath+"]");
File file=new File(attachPath); File file=new File(attachPath);
...@@ -444,15 +525,15 @@ public class UploadOrderEJB extends ActionHandlerEJB implements UploadOrderEJBLo ...@@ -444,15 +525,15 @@ public class UploadOrderEJB extends ActionHandlerEJB implements UploadOrderEJBLo
logger.addHandler(fh); logger.addHandler(fh);
logger.setLevel(Level.FINE); logger.setLevel(Level.FINE);
logger.log(Level.SEVERE, errorString, errorString); logger.log(Level.SEVERE, errorString, errorString);
fh.flush(); fh.flush();
fh.close(); fh.close();
commonWmsUtil.sendMail(mailFlag,attachFlag,formatCode,attachPath +fileName1,errorString,conn); commonWmsUtil.sendMail(mailFlag,attachFlag,formatCode,attachPath +fileName1,errorString,conn);
} }
catch(Exception e) catch(Exception e)
{ {
} }
} }
private static void setNodeValue( Document dom, String nodeName, String nodeVal ) throws Exception private static void setNodeValue( Document dom, String nodeName, String nodeVal ) throws Exception
...@@ -476,49 +557,49 @@ public class UploadOrderEJB extends ActionHandlerEJB implements UploadOrderEJBLo ...@@ -476,49 +557,49 @@ public class UploadOrderEJB extends ActionHandlerEJB implements UploadOrderEJBLo
public String getColumnDescr(Connection conn, String columnName ,String tableName, String columnName2, String value) throws ITMException,Exception public String getColumnDescr(Connection conn, String columnName ,String tableName, String columnName2, String value) throws ITMException,Exception
{ {
PreparedStatement pstmt = null ; PreparedStatement pstmt = null ;
ResultSet rs = null ; ResultSet rs = null ;
String sql = ""; String sql = "";
String findValue = ""; String findValue = "";
try try
{ {
sql = "SELECT " + columnName + " from " + tableName + " where " + columnName2 +"= ?"; sql = "SELECT " + columnName + " from " + tableName + " where " + columnName2 +"= ?";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1,value); pstmt.setString(1,value);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
if(rs.next()) if(rs.next())
{ {
findValue = checkNull(rs.getString(1)); findValue = checkNull(rs.getString(1));
} }
rs.close();
rs = null;
pstmt.close();
pstmt = null;
}
catch(Exception e)
{
System.out.println("Exception in getColumnDescr ");
e.printStackTrace();
throw new ITMException(e);
}
finally
{
if(rs != null)
{
rs.close(); rs.close();
rs = null; rs = null;
pstmt.close();
pstmt = null;
} }
catch(Exception e) if(pstmt != null)
{ {
System.out.println("Exception in getColumnDescr "); pstmt.close();
e.printStackTrace(); pstmt = null;
throw new ITMException(e);
} }
finally }
{ System.out.println("returning String from getColumnDescr " + findValue);
if(rs != null) return findValue;
{
rs.close();
rs = null;
}
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
}
System.out.println("returning String from getColumnDescr " + findValue);
return findValue;
} }
public String confirmSaleOrder(String businessObj, String tranIdFr,String xtraParams, String forcedFlag, Connection conn) throws ITMException public String confirmSaleOrder(String businessObj, String tranIdFr,String xtraParams, String forcedFlag, Connection conn) throws ITMException
{ {
...@@ -633,20 +714,20 @@ public class UploadOrderEJB extends ActionHandlerEJB implements UploadOrderEJBLo ...@@ -633,20 +714,20 @@ public class UploadOrderEJB extends ActionHandlerEJB implements UploadOrderEJBLo
GenericUtility genericUtility = GenericUtility.getInstance(); GenericUtility genericUtility = GenericUtility.getInstance();
loginCode=genericUtility.getValueFromXTRA_PARAMS(xtraParams,"loginEmpCode"); loginCode=genericUtility.getValueFromXTRA_PARAMS(xtraParams,"loginEmpCode");
Calendar currentDate = Calendar.getInstance(); Calendar currentDate = Calendar.getInstance();
SimpleDateFormat simpleDateFormatObj = new SimpleDateFormat(genericUtility.getApplDateFormat()); SimpleDateFormat simpleDateFormatObj = new SimpleDateFormat(genericUtility.getApplDateFormat());
String currDate = simpleDateFormatObj.format(currentDate.getTime()); String currDate = simpleDateFormatObj.format(currentDate.getTime());
remoteHost = genericUtility.getValueFromXTRA_PARAMS(xtraParams,"termId"); remoteHost = genericUtility.getValueFromXTRA_PARAMS(xtraParams,"termId");
java.sql.Timestamp currentDate1 = new Timestamp(System.currentTimeMillis()); java.sql.Timestamp currentDate1 = new Timestamp(System.currentTimeMillis());
//Changed by wasim to set data from finparm on 12-08-2015 [START] //Changed by wasim to set data from finparm on 12-08-2015 [START]
CommonWmsUtil common = new CommonWmsUtil(); CommonWmsUtil common = new CommonWmsUtil();
String acctCodeAdv = "", cctrCodeAdv = "", acctCodeAr = "", cctrCodeAr = ""; String acctCodeAdv = "", cctrCodeAdv = "", acctCodeAr = "", cctrCodeAr = "";
//Changed by wasim to set data from finparm on 12-08-2015 [END] //Changed by wasim to set data from finparm on 12-08-2015 [END]
//currDate =genericUtility.getValidDateString( tranDate, genericUtility.getApplDateFormat(),dateFormat ); //currDate =genericUtility.getValidDateString( tranDate, genericUtility.getApplDateFormat(),dateFormat );
System.out.println("currDate---->>"+currDate); System.out.println("currDate---->>"+currDate);
System.out.println("----------new Customer found ---------------------- "); System.out.println("----------new Customer found ---------------------- ");
try try
{ {
if(headerValesMap.containsKey("stan_code")) if(headerValesMap.containsKey("stan_code"))
...@@ -697,40 +778,40 @@ public class UploadOrderEJB extends ActionHandlerEJB implements UploadOrderEJBLo ...@@ -697,40 +778,40 @@ public class UploadOrderEJB extends ActionHandlerEJB implements UploadOrderEJBLo
{ {
stateCodeDlv = "UKENG"; stateCodeDlv = "UKENG";
} }
//Changed by wasim on to set data from finparm 12-08-2015 [START] //Changed by wasim on to set data from finparm 12-08-2015 [START]
/* acctCodeAdv = checkNull(common.getfinparm("999999", "DD_ACCT_CODE__ADV", conn)); /* acctCodeAdv = checkNull(common.getfinparm("999999", "DD_ACCT_CODE__ADV", conn));
cctrCodeAdv = checkNull(common.getfinparm("999999", "DD_CCTR_CODE__ADV", conn)); cctrCodeAdv = checkNull(common.getfinparm("999999", "DD_CCTR_CODE__ADV", conn));
acctCodeAr = checkNull(common.getfinparm("999999", "DD_ACCT_CODE__AR", conn)); acctCodeAr = checkNull(common.getfinparm("999999", "DD_ACCT_CODE__AR", conn));
cctrCodeAr = checkNull(common.getfinparm("999999", "DD_CCTR_CODE__AR", conn));*/ cctrCodeAr = checkNull(common.getfinparm("999999", "DD_CCTR_CODE__AR", conn));*/
//Changed by Manish for getting actual values from database for these fields on 19/01/16 for DDUK[start] //Changed by Manish for getting actual values from database for these fields on 19/01/16 for DDUK[start]
acctCodeAdv = checkNull(common.getfinparm("999999", "DD_ACCT_CODE__ADV", conn)); acctCodeAdv = checkNull(common.getfinparm("999999", "DD_ACCT_CODE__ADV", conn));
cctrCodeAdv = common.getfinparm("999999", "DD_CCTR_CODE__ADV", conn); cctrCodeAdv = common.getfinparm("999999", "DD_CCTR_CODE__ADV", conn);
acctCodeAr = checkNull(common.getfinparm("999999", "DD_ACCT_CODE__AR", conn)); acctCodeAr = checkNull(common.getfinparm("999999", "DD_ACCT_CODE__AR", conn));
cctrCodeAr = common.getfinparm("999999", "DD_CCTR_CODE__AR", conn); cctrCodeAr = common.getfinparm("999999", "DD_CCTR_CODE__AR", conn);
//Changed by Manish for getting actual values from database for these fields on 19/01/16 for DDUK[end] //Changed by Manish for getting actual values from database for these fields on 19/01/16 for DDUK[end]
System.out.println("ACCT_CODE__ADV="+acctCodeAdv); System.out.println("ACCT_CODE__ADV="+acctCodeAdv);
System.out.println("CCTR_CODE__ADV="+cctrCodeAdv); System.out.println("CCTR_CODE__ADV="+cctrCodeAdv);
System.out.println("ACCT_CODE__AR="+acctCodeAr); System.out.println("ACCT_CODE__AR="+acctCodeAr);
System.out.println("CCTR_CODE__AR="+cctrCodeAr); System.out.println("CCTR_CODE__AR="+cctrCodeAr);
//Changed by wasim on to set data from finparm 12-08-2015 [END] //Changed by wasim on to set data from finparm 12-08-2015 [END]
sql = "insert into customer ( cust_code,cust_type,cust_name,sh_name,group_code,addr1,addr2,addr3,city,state_code," sql = "insert into customer ( cust_code,cust_type,cust_name,sh_name,group_code,addr1,addr2,addr3,city,state_code,"
+ "pin,count_code,stan_code, tele1,tele2,tele3,fax,cust_code__bil,credit_lmt,chq_name," + "pin,count_code,stan_code, tele1,tele2,tele3,fax,cust_code__bil,credit_lmt,chq_name,"
+ "curr_code,acct_code__ar,cctr_code__ar,tax_chap,cr_term,tran_code,sales_pers,channel_partner,site_code,dis_link," + "curr_code,acct_code__ar,cctr_code__ar,tax_chap,cr_term,tran_code,sales_pers,channel_partner,site_code,dis_link,"
+ "fin_link,black_listed,contact_code,trans_mode,rcp_mode,ignore_credit,pending_order,ignore_days,round,round_to," + "fin_link,black_listed,contact_code,trans_mode,rcp_mode,ignore_credit,pending_order,ignore_days,round,round_to,"
+ "located_at,stop_business,sales_option,dlv_term,hold_shipment,acct_code__adv,cctr_code__adv,site_code__pbus,part_qty,split_factor," + "located_at,stop_business,sales_option,dlv_term,hold_shipment,acct_code__adv,cctr_code__adv,site_code__pbus,part_qty,split_factor,"
+ "curr_code__frt,curr_code__ins,adhoc_repl_perc,full_name,rate_round,rate_round_to,master_pack,cancel_bo,single_lot,asn_reqd," + "curr_code__frt,curr_code__ins,adhoc_repl_perc,full_name,rate_round,rate_round_to,master_pack,cancel_bo,single_lot,asn_reqd,"
+ "return_allowed,edi_reqd,chg_date,chg_term,chg_user,wave_type,email_addr) "//6 + "return_allowed,edi_reqd,chg_date,chg_term,chg_user,wave_type,email_addr) "//6
+ "values (?,?,?,?,?,?,?,?,?,?," + "values (?,?,?,?,?,?,?,?,?,?,"
+ "?,?,?,?,?,?,?,?,?,?," + "?,?,?,?,?,?,?,?,?,?,"
+ "?,?,?,?,?,?,?,?,?,?," + "?,?,?,?,?,?,?,?,?,?,"
+ "?,?,?,?,?,?,?,?,?,?," + "?,?,?,?,?,?,?,?,?,?,"
+ "?,?,?,?,?,?,?,?,?,?," + "?,?,?,?,?,?,?,?,?,?,"
+ "?,?,?,?,?,?,?,?,?,?," + "?,?,?,?,?,?,?,?,?,?,"
+ "?,?,?,?,?,?,?)"; //67 + "?,?,?,?,?,?,?)"; //67
pstmt=conn.prepareStatement(sql); pstmt=conn.prepareStatement(sql);
pstmt.setString(1, headerValesMap.get("cust_code")); //cust_code pstmt.setString(1, headerValesMap.get("cust_code")); //cust_code
...@@ -913,7 +994,7 @@ public class UploadOrderEJB extends ActionHandlerEJB implements UploadOrderEJBLo ...@@ -913,7 +994,7 @@ public class UploadOrderEJB extends ActionHandlerEJB implements UploadOrderEJBLo
String errCode = "",sql="",expLev=""; String errCode = "",sql="",expLev="";
//Connection conn = null; //Connection conn = null;
PreparedStatement pstmtStock = null,pstmt=null; PreparedStatement pstmtStock = null,pstmt=null;
PreparedStatement pstmtStockInsertSordAlloc = null; PreparedStatement pstmtStockInsertSordAlloc = null;
//Changed by Rohan on 13-04-12 To create prepared statement & result set.start //Changed by Rohan on 13-04-12 To create prepared statement & result set.start
String manStockData = ""; String manStockData = "";
...@@ -935,7 +1016,7 @@ public class UploadOrderEJB extends ActionHandlerEJB implements UploadOrderEJBLo ...@@ -935,7 +1016,7 @@ public class UploadOrderEJB extends ActionHandlerEJB implements UploadOrderEJBLo
HashMap strAllocate = null; HashMap strAllocate = null;
boolean isStockToDock = false; boolean isStockToDock = false;
boolean isActives = false; boolean isActives = false;
ArrayList tempListForRepl =null;//Added by Ashish ArrayList tempListForRepl =null;//Added by Ashish
String directPickLoc = ""; String directPickLoc = "";
double palletVolume = 0.0 ,packSize = 0.0, perItemVolume = 0.0, double palletVolume = 0.0 ,packSize = 0.0, perItemVolume = 0.0,
...@@ -989,411 +1070,411 @@ public class UploadOrderEJB extends ActionHandlerEJB implements UploadOrderEJBLo ...@@ -989,411 +1070,411 @@ public class UploadOrderEJB extends ActionHandlerEJB implements UploadOrderEJBLo
//directPickLoc = genericUtility.getColumnValue("direct_pick_loc",headerDom); //directPickLoc = genericUtility.getColumnValue("direct_pick_loc",headerDom);
System.out.println("CASE_PICK_INVSTAT"+casePickLoc+"ACTIVE_PICK_INVSTAT"+activePickLoc+"RESERV_LOCATION"+resrvLoc+"Reserve Location["+partialResrvLoc+"]"); System.out.println("CASE_PICK_INVSTAT"+casePickLoc+"ACTIVE_PICK_INVSTAT"+activePickLoc+"RESERV_LOCATION"+resrvLoc+"Reserve Location["+partialResrvLoc+"]");
getDataSql = "SELECT STOCK.LOT_NO,STOCK.LOT_SL," getDataSql = "SELECT STOCK.LOT_NO,STOCK.LOT_SL,"
+"STOCK.LOC_CODE, " +"STOCK.LOC_CODE, "
+"STOCK.UNIT, " +"STOCK.UNIT, "
+"(STOCK.QUANTITY - STOCK.ALLOC_QTY - (CASE WHEN STOCK.HOLD_QTY IS NULL THEN 0 ELSE STOCK.HOLD_QTY END)) AS QTY_AVAIL_ALLOC ," +"(STOCK.QUANTITY - STOCK.ALLOC_QTY - (CASE WHEN STOCK.HOLD_QTY IS NULL THEN 0 ELSE STOCK.HOLD_QTY END)) AS QTY_AVAIL_ALLOC ,"
+"STOCK.GRADE,STOCK.EXP_DATE,STOCK.CONV__QTY_STDUOM,STOCK.QUANTITY, " +"STOCK.GRADE,STOCK.EXP_DATE,STOCK.CONV__QTY_STDUOM,STOCK.QUANTITY, "
+"STOCK.MFG_DATE,STOCK.SITE_CODE__MFG, " +"STOCK.MFG_DATE,STOCK.SITE_CODE__MFG, "
+"STOCK.NO_ART,INVSTAT.INV_STAT,ITEM.LOC_TYPE__PARENT,ITEM.LOC_TYPE,ITEM.LOC_ZONE__PREF,STOCK.ALLOC_QTY " +"STOCK.NO_ART,INVSTAT.INV_STAT,ITEM.LOC_TYPE__PARENT,ITEM.LOC_TYPE,ITEM.LOC_ZONE__PREF,STOCK.ALLOC_QTY "
+"FROM STOCK,ITEM,LOCATION,INVSTAT " +"FROM STOCK,ITEM,LOCATION,INVSTAT "
+"WHERE (ITEM.ITEM_CODE = STOCK.ITEM_CODE) " +"WHERE (ITEM.ITEM_CODE = STOCK.ITEM_CODE) "
+"AND (LOCATION.LOC_CODE = STOCK.LOC_CODE ) " +"AND (LOCATION.LOC_CODE = STOCK.LOC_CODE ) "
+"AND (LOCATION.INV_STAT = INVSTAT.INV_STAT) " +"AND (LOCATION.INV_STAT = INVSTAT.INV_STAT) "
+"AND INVSTAT.AVAILABLE = 'Y' " +"AND INVSTAT.AVAILABLE = 'Y' "
+"AND STOCK.ITEM_CODE = ? AND STOCK.SITE_CODE = ? " +"AND STOCK.ITEM_CODE = ? AND STOCK.SITE_CODE = ? "
+"AND (STOCK.QUANTITY - STOCK.ALLOC_QTY - CASE WHEN STOCK.HOLD_QTY IS NULL THEN 0 ELSE STOCK.HOLD_QTY END) > 0 " // 25/06/12 manoharan +"AND (STOCK.QUANTITY - STOCK.ALLOC_QTY - CASE WHEN STOCK.HOLD_QTY IS NULL THEN 0 ELSE STOCK.HOLD_QTY END) > 0 " // 25/06/12 manoharan
+"AND NOT EXISTS (SELECT 1 FROM INV_RESTR I WHERE I.INV_STAT = INVSTAT.INV_STAT AND I.REF_SER = 'S-DSP' ) " +"AND NOT EXISTS (SELECT 1 FROM INV_RESTR I WHERE I.INV_STAT = INVSTAT.INV_STAT AND I.REF_SER = 'S-DSP' ) "
+" AND LOCATION.INV_STAT IN(?,?,?,?,?) ORDER BY STOCK.EXP_DATE,INVSTAT.ALLOC_PREF, STOCK.LOC_CODE "; +" AND LOCATION.INV_STAT IN(?,?,?,?,?) ORDER BY STOCK.EXP_DATE,INVSTAT.ALLOC_PREF, STOCK.LOC_CODE ";
pstmtStock = conn.prepareStatement(getDataSql); pstmtStock = conn.prepareStatement(getDataSql);
pstmtStock.setString(1,itemCode); pstmtStock.setString(1,itemCode);
pstmtStock.setString(2,siteCodeG); pstmtStock.setString(2,siteCodeG);
pstmtStock.setString(3,resrvLoc); pstmtStock.setString(3,resrvLoc);
pstmtStock.setString(4,casePickLoc); pstmtStock.setString(4,casePickLoc);
pstmtStock.setString(5,activePickLoc); pstmtStock.setString(5,activePickLoc);
pstmtStock.setString(6,deepStoreLoc); pstmtStock.setString(6,deepStoreLoc);
pstmtStock.setString(7,partialResrvLoc); pstmtStock.setString(7,partialResrvLoc);
rs = pstmtStock.executeQuery(); rs = pstmtStock.executeQuery();
System.out.println("siteCode------"+ siteCodeG); System.out.println("siteCode------"+ siteCodeG);
System.out.println("itemCode------"+ itemCode); System.out.println("itemCode------"+ itemCode);
System.out.println("Select completed"); System.out.println("Select completed");
while(rs.next())
{ while(rs.next())
isStockToDock = false;
System.out.println( "INSIDE WHILE LOOP...........For allocation.["+allocQty);
//LOT_NO
lotNo = rs.getString(1);
//LOT_SL
lotSl = rs.getString(2);
//LOC_CODE
locCode = rs.getString(3);
//UNIT
unit = rs.getString(4);
//QTY_AVAIL_ALLO
qtyAvailAlloc = rs.getDouble(5);
System.out.println("qtyAvailAlloc--------------->"+qtyAvailAlloc);
//GRADE
grade = rs.getString(6);
//EXP_DATE
expDate =rs.getDate(7);
//CONV__QTY_STDUOM
convQtyStduom=rs.getDouble(8);
//QUANTITY
quantity= rs.getDouble(9);
//MFG_DATE
mfgDate = rs.getDate(10);
//SITE_CODE__MFG
siteCodeMfg = rs.getString(11);
noArt = rs.getInt(12);
invStat = rs.getString(13);
locTypeParent = checkNull(rs.getString(14)); //Changes done by chandni 08-06-12(instead of loc_type, loc_type__parent should be selected)
//Changed by sankara on 03-08-2012 for adding locType
locType= rs.getString(15);
locZonePref = rs.getInt(16);
//Changed By Pragyan 06-DEC-13 to get Stock alloc quantity as per KB sir
stkAllocQty = rs.getDouble(17);
//Changed By Pragyan 31-MAY-14 for single lot start
HashMap itmVolumeMap = getItemVoumeMap(itemCode,lotNo,conn);
double packSizeActive = (Double)itmVolumeMap.get("PACK_SIZE");
//Changed by Rohan on 8/2/12 to get packsize of item.end
System.out.println("GOING FOR populateReplHistory************************");
System.out.println("Return qty from function:::::"+qtyAvailAlloc);
invStat = invStat != null?invStat.trim():"";
System.out.println("allocQty"+allocQty+"qtyAvailAlloc:::"+qtyAvailAlloc);
if (allocQty >= qtyAvailAlloc)
{
lotQtyToBeAllocated = qtyAvailAlloc;
}
else
{ {
System.out.println("Enetr in else"); isStockToDock = false;
lotQtyToBeAllocated = allocQty; System.out.println( "INSIDE WHILE LOOP...........For allocation.["+allocQty);
} //LOT_NO
lotNo = rs.getString(1);
//LOT_SL
System.out.println("Stock To Dock change["+isStockToDock+"]"); lotSl = rs.getString(2);
//LOC_CODE
allocQty -= lotQtyToBeAllocated ; locCode = rs.getString(3);
//UNIT
System.out.print("AllocQty = " + lotQtyToBeAllocated); unit = rs.getString(4);
System.out.print("AllocQty2 = " + allocQty); //QTY_AVAIL_ALLO
if (lotQtyToBeAllocated > 0) qtyAvailAlloc = rs.getDouble(5);
{ System.out.println("qtyAvailAlloc--------------->"+qtyAvailAlloc);
//GRADE
grade = rs.getString(6);
//EXP_DATE
expDate =rs.getDate(7);
//CONV__QTY_STDUOM
convQtyStduom=rs.getDouble(8);
//QUANTITY
quantity= rs.getDouble(9);
//MFG_DATE
mfgDate = rs.getDate(10);
//SITE_CODE__MFG
siteCodeMfg = rs.getString(11);
noArt = rs.getInt(12);
invStat = rs.getString(13);
locTypeParent = checkNull(rs.getString(14)); //Changes done by chandni 08-06-12(instead of loc_type, loc_type__parent should be selected)
//Changed by sankara on 03-08-2012 for adding locType
locType= rs.getString(15);
locZonePref = rs.getInt(16);
//Changed By Pragyan 06-DEC-13 to get Stock alloc quantity as per KB sir
stkAllocQty = rs.getDouble(17);
//Changed By Pragyan 31-MAY-14 for single lot start
HashMap itmVolumeMap = getItemVoumeMap(itemCode,lotNo,conn);
double packSizeActive = (Double)itmVolumeMap.get("PACK_SIZE");
//Changed by Rohan on 8/2/12 to get packsize of item.end
System.out.println("GOING FOR populateReplHistory************************");
System.out.println("Return qty from function:::::"+qtyAvailAlloc);
invStat = invStat != null?invStat.trim():""; invStat = invStat != null?invStat.trim():"";
System.out.println("allocQty"+allocQty+"qtyAvailAlloc:::"+qtyAvailAlloc);
System.out.println("Finally Loc Code["+locCode+"]");
strAllocate = new HashMap();
strAllocate.put("tran_date",tranDate); if (allocQty >= qtyAvailAlloc)
strAllocate.put("ref_ser","S-ALC");
strAllocate.put("ref_id",saleOrder);
strAllocate.put("ref_line", "" + lineNo);
strAllocate.put("site_code",siteCodeG);
strAllocate.put("item_code",itemCode);
strAllocate.put("loc_code",locCode);
strAllocate.put("lot_no",lotNo);
strAllocate.put("lot_sl",lotSl);
strAllocate.put("alloc_qty",new Double(lotQtyToBeAllocated));
strAllocate.put("chg_user",GenericUtility.getInstance().getValueFromXTRA_PARAMS(xtraParams,"loginCode"));
strAllocate.put("chg_term",GenericUtility.getInstance().getValueFromXTRA_PARAMS(xtraParams,"termId"));
strAllocate.put("chg_win","W_SORDER");
System.out.println("To allocate ::: " + strAllocate.toString()+"]lotQtyToBeAllocated["+lotQtyToBeAllocated+"]");
errString = invAllocTrace.updateInvallocTrace(strAllocate, conn);
System.out.println("invAllocTrace errString ::: " + errString);
if (errString != null && errString.trim().length() > 0 )
{ {
break; lotQtyToBeAllocated = qtyAvailAlloc;
} }
strAllocate = null; else
sorditemSql = "SELECT ITEM_CODE,ITEM_CODE__ORD,UNIT, QTY_DESP, ITEM_REF,"
+" QUANTITY - QTY_DESP PENDING_QUANTITY "
+" FROM SORDITEM WHERE SALE_ORDER = '" + saleOrder + "' "
+" AND LINE_NO = '" + lineNo + "' ";
System.out.println("sorditemSql:::"+sorditemSql);
st = conn.createStatement();
rsSItem = st.executeQuery(sorditemSql);
if (rsSItem.next())
{
//ITEM_CODE
itemCode = rsSItem.getString(1);
System.out.println("itemCode::::"+ itemCode);
//ITEM_CODE__ORD
itemCodeOrd = rsSItem.getString(2);
//UNIT
unitStd = rsSItem.getString(3);
//QTY_DESP
qtyDesp = 0;
//ITEM_REF
itemRef = rsSItem.getString(5);
//PENDING_QUANTITY
pendingQuantity = rsSItem.getDouble(6);
}
rsSItem.close();
//Changed by sumit on 31/01/13 changing below quantity as per unit start
pendingQuantity = getStockQtyAfterConvert(saleOrder, lineNo, itemCodeOrd, pendingQuantity, 1, conn);
updateSorditem ="UPDATE SORDITEM SET QTY_ALLOC = CASE WHEN QTY_ALLOC IS NULL THEN 0 ELSE QTY_ALLOC END + " + new Double(lotQtyToBeAllocated).toString()
+" WHERE SALE_ORDER = '" + saleOrder + "' "
+" AND LINE_NO = '" + lineNo + "' "
+" AND EXP_LEV = '" + expLev + "' ";
System.out.println("updateSql------->"+updateSorditem);
st.executeUpdate(updateSorditem);
System.out.println("UPDATE SUCCESS FOR SORDITEM....>>>>>>>>");
sorditemSql = "SELECT COUNT(1) FROM SORDALLOC "
+ " WHERE SALE_ORDER = '" + saleOrder + "' "
+ " AND LINE_NO = '" + lineNo + "' "
+ " AND EXP_LEV = '" + expLev + "' "
+ " AND ITEM_CODE__ORD = '" + itemCodeOrd + "' "
+ " AND ITEM_CODE = '" + itemCode + "' "
+ " AND LOT_NO = '" + lotNo + "' "
+ " AND LOT_SL = '" + lotSl + "' "
+ " AND LOC_CODE = '" + locCode + "' " ;
rsSItem = st.executeQuery(sorditemSql);
int count = 0 ;
if (rsSItem.next())
{ {
count = rsSItem.getInt(1); System.out.println("Enetr in else");
lotQtyToBeAllocated = allocQty;
} }
if (count > 0 )
{
//updateSql = "UPDATE SORDALLOC SET QTY_ALLOC = QTY_ALLOC + " + new Double(lotQtyToBeAllocated).toString() System.out.println("Stock To Dock change["+isStockToDock+"]");
updateSql = "UPDATE SORDALLOC SET WAVE_FLAG = 'Y' , QTY_ALLOC = QTY_ALLOC + " + new Double(lotQtyToBeAllocated).toString()
+ " WHERE SALE_ORDER = '" + saleOrder + " ' " allocQty -= lotQtyToBeAllocated ;
+ " AND LINE_NO = '" + lineNo + "' "
+ " AND EXP_LEV = '" + expLev + "' " System.out.print("AllocQty = " + lotQtyToBeAllocated);
+ " AND ITEM_CODE__ORD = '" + itemCodeOrd + "' " System.out.print("AllocQty2 = " + allocQty);
+ " AND ITEM_CODE = '" + itemCode + "' " if (lotQtyToBeAllocated > 0)
+ " AND LOT_NO = '" + lotNo + "' " {
+ " AND LOT_SL = '" + lotSl + "' "
+ " AND LOC_CODE = '" + locCode + "' " ; invStat = invStat != null?invStat.trim():"";
System.out.println("updateSql:::>>>>"+ updateSql);
st.executeUpdate(updateSql);
System.out.println("UPDATE SUCCESS FOR SORDALLOC...."); System.out.println("Finally Loc Code["+locCode+"]");
}
else strAllocate = new HashMap();
{ strAllocate.put("tran_date",tranDate);
insertSql ="INSERT INTO SORDALLOC (SALE_ORDER,LINE_NO,EXP_LEV,ITEM_CODE__ORD,SITE_CODE ," strAllocate.put("ref_ser","S-ALC");
+"ITEM_CODE,QUANTITY ,LOT_NO, LOT_SL, LOC_CODE, UNIT, QTY_ALLOC," strAllocate.put("ref_id",saleOrder);
+"ITEM_REF, DATE_ALLOC, STATUS,ITEM_GRADE, EXP_DATE, ALLOC_MODE, " strAllocate.put("ref_line", "" + lineNo);
+" CONV__QTY_STDUOM, UNIT__STD, QUANTITY__STDUOM, " strAllocate.put("site_code",siteCodeG);
//+"MFG_DATE, SITE_CODE__MFG ) " strAllocate.put("item_code",itemCode);
+"MFG_DATE, SITE_CODE__MFG,WAVE_FLAG ) " strAllocate.put("loc_code",locCode);
+"VALUES ( ?, ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? ," strAllocate.put("lot_no",lotNo);
//+" ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? ) " ; strAllocate.put("lot_sl",lotSl);
+" ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? ,? ) " ; strAllocate.put("alloc_qty",new Double(lotQtyToBeAllocated));
strAllocate.put("chg_user",GenericUtility.getInstance().getValueFromXTRA_PARAMS(xtraParams,"loginCode"));
pstmtStockInsertSordAlloc = conn.prepareStatement(insertSql); strAllocate.put("chg_term",GenericUtility.getInstance().getValueFromXTRA_PARAMS(xtraParams,"termId"));
strAllocate.put("chg_win","W_SORDER");
System.out.println("Insert Sql :"+ insertSql );
pstmtStockInsertSordAlloc.setString(1, saleOrder); System.out.println("To allocate ::: " + strAllocate.toString()+"]lotQtyToBeAllocated["+lotQtyToBeAllocated+"]");
System.out.println("saleOrder------->"+saleOrder);
pstmtStockInsertSordAlloc.setString(2, lineNo); errString = invAllocTrace.updateInvallocTrace(strAllocate, conn);
System.out.println("lineNo------->"+lineNo);
pstmtStockInsertSordAlloc.setString(3, expLev);
System.out.println("EXP_LEV------->"+expLev); System.out.println("invAllocTrace errString ::: " + errString);
pstmtStockInsertSordAlloc.setString(4, itemCodeOrd); if (errString != null && errString.trim().length() > 0 )
System.out.println("itemCode------->"+itemCodeOrd); {
pstmtStockInsertSordAlloc.setString(5, siteCodeG); break;
System.out.println("siteCode------->"+siteCodeG); }
pstmtStockInsertSordAlloc.setString(6, itemCode); strAllocate = null;
System.out.println("itemCode------->"+itemCode);
pstmtStockInsertSordAlloc.setDouble(7, pendingQuantity); sorditemSql = "SELECT ITEM_CODE,ITEM_CODE__ORD,UNIT, QTY_DESP, ITEM_REF,"
System.out.println("pendingQuantity------->"+pendingQuantity); +" QUANTITY - QTY_DESP PENDING_QUANTITY "
+" FROM SORDITEM WHERE SALE_ORDER = '" + saleOrder + "' "
pstmtStockInsertSordAlloc.setString(8, lotNo); +" AND LINE_NO = '" + lineNo + "' ";
System.out.println("lotNo------->"+lotNo);
pstmtStockInsertSordAlloc.setString(9, lotSl); System.out.println("sorditemSql:::"+sorditemSql);
System.out.println("lotSl------->"+lotSl); st = conn.createStatement();
pstmtStockInsertSordAlloc.setString(10, locCode); rsSItem = st.executeQuery(sorditemSql);
System.out.println("locCode------->"+locCode); if (rsSItem.next())
pstmtStockInsertSordAlloc.setString(11, unit); {
System.out.println("unit------->"+unit); //ITEM_CODE
pstmtStockInsertSordAlloc.setDouble(12, lotQtyToBeAllocated); itemCode = rsSItem.getString(1);
System.out.println("lotQtyToBeAllocated------->"+lotQtyToBeAllocated); System.out.println("itemCode::::"+ itemCode);
//ITEM_CODE__ORD
pstmtStockInsertSordAlloc.setString(13,itemRef); itemCodeOrd = rsSItem.getString(2);
System.out.println("itemRef------->"+itemRef); //UNIT
pstmtStockInsertSordAlloc.setDate(14,dateAlloc); unitStd = rsSItem.getString(3);
System.out.println("dateAlloc------->"+dateAlloc); //QTY_DESP
pstmtStockInsertSordAlloc.setString(15,"P"); qtyDesp = 0;
System.out.println("status------->P"); //ITEM_REF
pstmtStockInsertSordAlloc.setString(16,grade); itemRef = rsSItem.getString(5);
System.out.println("grade------->"+grade); //PENDING_QUANTITY
pstmtStockInsertSordAlloc.setDate(17,expDate); pendingQuantity = rsSItem.getDouble(6);
System.out.println("expDate------->"+expDate); }
pstmtStockInsertSordAlloc.setString(18,"M"); rsSItem.close();
pstmtStockInsertSordAlloc.setDouble(19,convQtyStduom);
System.out.println("convQtyStduom------->"+convQtyStduom); //Changed by sumit on 31/01/13 changing below quantity as per unit start
pstmtStockInsertSordAlloc.setString(20,unitStd); pendingQuantity = getStockQtyAfterConvert(saleOrder, lineNo, itemCodeOrd, pendingQuantity, 1, conn);
System.out.println("unitStd------->"+unitStd); updateSorditem ="UPDATE SORDITEM SET QTY_ALLOC = CASE WHEN QTY_ALLOC IS NULL THEN 0 ELSE QTY_ALLOC END + " + new Double(lotQtyToBeAllocated).toString()
quantityStduom = convQtyStduom * lotQtyToBeAllocated ; +" WHERE SALE_ORDER = '" + saleOrder + "' "
pstmtStockInsertSordAlloc.setDouble(21,quantityStduom); +" AND LINE_NO = '" + lineNo + "' "
System.out.println("quantityStduom------->"+quantityStduom); +" AND EXP_LEV = '" + expLev + "' ";
pstmtStockInsertSordAlloc.setDate(22,mfgDate);
System.out.println("mfgDate------->"+mfgDate); System.out.println("updateSql------->"+updateSorditem);
pstmtStockInsertSordAlloc.setString(23,siteCodeMfg); st.executeUpdate(updateSorditem);
System.out.println("siteCodeMfg------->"+siteCodeMfg); System.out.println("UPDATE SUCCESS FOR SORDITEM....>>>>>>>>");
pstmtStockInsertSordAlloc.setString(24,"N");
System.out.println("WAVE FLAG-------> Y"); sorditemSql = "SELECT COUNT(1) FROM SORDALLOC "
+ " WHERE SALE_ORDER = '" + saleOrder + "' "
+ " AND LINE_NO = '" + lineNo + "' "
intCnt = pstmtStockInsertSordAlloc.executeUpdate(); + " AND EXP_LEV = '" + expLev + "' "
System.out.println("insertion success ...............>>>>>>>>"); + " AND ITEM_CODE__ORD = '" + itemCodeOrd + "' "
pstmtStockInsertSordAlloc.close(); + " AND ITEM_CODE = '" + itemCode + "' "
}//end else + " AND LOT_NO = '" + lotNo + "' "
+ " AND LOT_SL = '" + lotSl + "' "
+ " AND LOC_CODE = '" + locCode + "' " ;
rsSItem = st.executeQuery(sorditemSql);
int count = 0 ;
if (rsSItem.next())
{
count = rsSItem.getInt(1);
}
if (count > 0 )
{
//updateSql = "UPDATE SORDALLOC SET QTY_ALLOC = QTY_ALLOC + " + new Double(lotQtyToBeAllocated).toString()
updateSql = "UPDATE SORDALLOC SET WAVE_FLAG = 'Y' , QTY_ALLOC = QTY_ALLOC + " + new Double(lotQtyToBeAllocated).toString()
+ " WHERE SALE_ORDER = '" + saleOrder + " ' "
+ " AND LINE_NO = '" + lineNo + "' "
+ " AND EXP_LEV = '" + expLev + "' "
+ " AND ITEM_CODE__ORD = '" + itemCodeOrd + "' "
+ " AND ITEM_CODE = '" + itemCode + "' "
+ " AND LOT_NO = '" + lotNo + "' "
+ " AND LOT_SL = '" + lotSl + "' "
+ " AND LOC_CODE = '" + locCode + "' " ;
System.out.println("updateSql:::>>>>"+ updateSql);
st.executeUpdate(updateSql);
System.out.println("UPDATE SUCCESS FOR SORDALLOC....");
}
else
{
insertSql ="INSERT INTO SORDALLOC (SALE_ORDER,LINE_NO,EXP_LEV,ITEM_CODE__ORD,SITE_CODE ,"
+"ITEM_CODE,QUANTITY ,LOT_NO, LOT_SL, LOC_CODE, UNIT, QTY_ALLOC,"
+"ITEM_REF, DATE_ALLOC, STATUS,ITEM_GRADE, EXP_DATE, ALLOC_MODE, "
+" CONV__QTY_STDUOM, UNIT__STD, QUANTITY__STDUOM, "
//+"MFG_DATE, SITE_CODE__MFG ) "
+"MFG_DATE, SITE_CODE__MFG,WAVE_FLAG ) "
+"VALUES ( ?, ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? ,"
//+" ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? ) " ;
+" ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? ,? ) " ;
pstmtStockInsertSordAlloc = conn.prepareStatement(insertSql);
System.out.println("Insert Sql :"+ insertSql );
pstmtStockInsertSordAlloc.setString(1, saleOrder);
System.out.println("saleOrder------->"+saleOrder);
pstmtStockInsertSordAlloc.setString(2, lineNo);
System.out.println("lineNo------->"+lineNo);
pstmtStockInsertSordAlloc.setString(3, expLev);
System.out.println("EXP_LEV------->"+expLev);
pstmtStockInsertSordAlloc.setString(4, itemCodeOrd);
System.out.println("itemCode------->"+itemCodeOrd);
pstmtStockInsertSordAlloc.setString(5, siteCodeG);
System.out.println("siteCode------->"+siteCodeG);
pstmtStockInsertSordAlloc.setString(6, itemCode);
System.out.println("itemCode------->"+itemCode);
pstmtStockInsertSordAlloc.setDouble(7, pendingQuantity);
System.out.println("pendingQuantity------->"+pendingQuantity);
pstmtStockInsertSordAlloc.setString(8, lotNo);
System.out.println("lotNo------->"+lotNo);
pstmtStockInsertSordAlloc.setString(9, lotSl);
System.out.println("lotSl------->"+lotSl);
pstmtStockInsertSordAlloc.setString(10, locCode);
System.out.println("locCode------->"+locCode);
pstmtStockInsertSordAlloc.setString(11, unit);
System.out.println("unit------->"+unit);
pstmtStockInsertSordAlloc.setDouble(12, lotQtyToBeAllocated);
System.out.println("lotQtyToBeAllocated------->"+lotQtyToBeAllocated);
pstmtStockInsertSordAlloc.setString(13,itemRef);
System.out.println("itemRef------->"+itemRef);
pstmtStockInsertSordAlloc.setDate(14,dateAlloc);
System.out.println("dateAlloc------->"+dateAlloc);
pstmtStockInsertSordAlloc.setString(15,"P");
System.out.println("status------->P");
pstmtStockInsertSordAlloc.setString(16,grade);
System.out.println("grade------->"+grade);
pstmtStockInsertSordAlloc.setDate(17,expDate);
System.out.println("expDate------->"+expDate);
pstmtStockInsertSordAlloc.setString(18,"M");
pstmtStockInsertSordAlloc.setDouble(19,convQtyStduom);
System.out.println("convQtyStduom------->"+convQtyStduom);
pstmtStockInsertSordAlloc.setString(20,unitStd);
System.out.println("unitStd------->"+unitStd);
quantityStduom = convQtyStduom * lotQtyToBeAllocated ;
pstmtStockInsertSordAlloc.setDouble(21,quantityStduom);
System.out.println("quantityStduom------->"+quantityStduom);
pstmtStockInsertSordAlloc.setDate(22,mfgDate);
System.out.println("mfgDate------->"+mfgDate);
pstmtStockInsertSordAlloc.setString(23,siteCodeMfg);
System.out.println("siteCodeMfg------->"+siteCodeMfg);
pstmtStockInsertSordAlloc.setString(24,"N");
System.out.println("WAVE FLAG-------> Y");
intCnt = pstmtStockInsertSordAlloc.executeUpdate();
System.out.println("insertion success ...............>>>>>>>>");
pstmtStockInsertSordAlloc.close();
}//end else
st.close();
//Changed By Pragyan.end
}//end of if(lotQtyToBeAllocated > 0)
}//end of while
if(st != null)
{
st.close(); st.close();
//Changed By Pragyan.end st = null;
}
if(pstmtStock != null)
{
}//end of if(lotQtyToBeAllocated > 0) pstmtStock.close();
}//end of while pstmtStock = null;
}
if(st != null) if(pstmtStockInsertSordAlloc != null)
{ {
st.close(); pstmtStockInsertSordAlloc.close();
st = null; pstmtStockInsertSordAlloc = null;
} }
if(pstmtStock != null) if(pstmtShelf != null)
{ {
pstmtStock.close(); pstmtShelf.close();
pstmtStock = null; pstmtShelf = null;
} }
if(pstmtStockInsertSordAlloc != null) if(rSetShelf != null)
{ {
pstmtStockInsertSordAlloc.close(); rSetShelf.close();
pstmtStockInsertSordAlloc = null; rSetShelf = null;
} }
if(pstmtShelf != null) if(rsSItem != null)
{ {
pstmtShelf.close(); rsSItem.close();
pstmtShelf = null; rsSItem = null;
}
if(rs != null)
{
rs.close();
rs =null;
}
//Changed by Rohan on 29-08-12 for bug fixing
//pstmtStock.clearParameters();
} }
if(rSetShelf != null) catch(SQLException se)
{ {
rSetShelf.close(); System.out.println("SQLException :" + se);
rSetShelf = null; se.printStackTrace();
errString = se.getMessage();
//return errString;
throw se;
} }
if(rsSItem != null)
catch(Exception e)
{ {
rsSItem.close(); System.out.println("Exception :" + e);
rsSItem = null; errString = e.getMessage();
e.printStackTrace();
throw e;
} }
if(rs != null) finally
{ {
rs.close(); try
rs =null; {
} if(conn != null)
//Changed by Rohan on 29-08-12 for bug fixing {
//pstmtStock.clearParameters(); if(st != null)
{
} st.close();
catch(SQLException se) st = null;
{ }
System.out.println("SQLException :" + se); if(pstmtStock != null)
se.printStackTrace(); {
errString = se.getMessage(); pstmtStock.close();
//return errString; pstmtStock = null;
throw se; }
} if(rs != null)
{
rs.close();
rs =null;
}
catch(Exception e) if(rsSItem != null)
{ {
System.out.println("Exception :" + e); rsSItem.close();
errString = e.getMessage(); rsSItem = null;
e.printStackTrace(); }
throw e; if(pstmtStockInsertSordAlloc != null)
{
pstmtStockInsertSordAlloc.close();
} pstmtStockInsertSordAlloc = null;
finally }
{ if(st != null)
try {
{ st.close();
if(conn != null) st = null;
{ }
if(st != null) if(pstmtShelf != null)
{ {
st.close(); pstmtShelf.close();
st = null; pstmtShelf = null;
} }
if(pstmtStock != null) if(rSetShelf != null)
{ {
pstmtStock.close(); rSetShelf.close();
pstmtStock = null; rSetShelf = null;
} }
if(rs != null) //conn.close();
{ //conn = null;
rs.close();
rs =null;
}
if(rsSItem != null)
{
rsSItem.close();
rsSItem = null;
}
if(pstmtStockInsertSordAlloc != null)
{
pstmtStockInsertSordAlloc.close();
pstmtStockInsertSordAlloc = null;
}
if(st != null)
{
st.close();
st = null;
}
if(pstmtShelf != null)
{
pstmtShelf.close();
pstmtShelf = null;
}
if(rSetShelf != null)
{
rSetShelf.close();
rSetShelf = null;
} }
//conn.close();
//conn = null;
} }
catch(Exception e)
{
errString = e.getMessage();
e.printStackTrace();
return errString ;
}
return errString;
} }
catch(Exception e)
{
errString = e.getMessage();
e.printStackTrace();
return errString ;
}
return errString;
}
} }
private String generateTranId( String windowName, String siteCode, String tranDateStr, Connection conn )throws ITMException,Exception private String generateTranId( String windowName, String siteCode, String tranDateStr, Connection conn )throws ITMException,Exception
{ {
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
...@@ -1477,17 +1558,17 @@ public class UploadOrderEJB extends ActionHandlerEJB implements UploadOrderEJBLo ...@@ -1477,17 +1558,17 @@ public class UploadOrderEJB extends ActionHandlerEJB implements UploadOrderEJBLo
ResultSet rs = null; ResultSet rs = null;
double itmLen = 0,itmWidth = 0,itmHeight = 0,itemWeight = 0,lotLen = 0 ,lotHeight = 0,lotWidth = 0,lotWeight = 0; double itmLen = 0,itmWidth = 0,itmHeight = 0,itemWeight = 0,lotLen = 0 ,lotHeight = 0,lotWidth = 0,lotWeight = 0;
HashMap dataVolumeMap = new HashMap(); HashMap dataVolumeMap = new HashMap();
try { try {
sql = "SELECT I.LENGTH ITEM_LEN,I.WIDTH ITEM_WID,I.HEIGHT ITEM_HEIGHT,I.GROSS_WEIGHT ITEM_WEIGHT,I.HAZARDOUS HAZARD, " sql = "SELECT I.LENGTH ITEM_LEN,I.WIDTH ITEM_WID,I.HEIGHT ITEM_HEIGHT,I.GROSS_WEIGHT ITEM_WEIGHT,I.HAZARDOUS HAZARD, "
+" I.HARMONIZATION_NO HARMONIZATION_NO,I.HARMONIZATION_DESCR HARMONIZATION_DESCR,I.COUNT_CODE__MFG ORIGIN_COUNTRY," +" I.HARMONIZATION_NO HARMONIZATION_NO,I.HARMONIZATION_DESCR HARMONIZATION_DESCR,I.COUNT_CODE__MFG ORIGIN_COUNTRY,"
+" L.LENGTH LITEM_LEN,L.WIDTH LITEM_WID,L.HEIGHT LITEM_HEIGHT,L.SHIPPER_SIZE SHIPSIZE,L.GROSS_WEIGHT LOT_WEIGHT FROM" +" L.LENGTH LITEM_LEN,L.WIDTH LITEM_WID,L.HEIGHT LITEM_HEIGHT,L.SHIPPER_SIZE SHIPSIZE,L.GROSS_WEIGHT LOT_WEIGHT FROM"
+" ITEM I,ITEM_LOT_PACKSIZE L" +" ITEM I,ITEM_LOT_PACKSIZE L"
+" WHERE I.ITEM_CODE = L.ITEM_CODE" +" WHERE I.ITEM_CODE = L.ITEM_CODE"
+" AND L.LOT_NO__FROM <= ? AND L.LOT_NO__TO >= ?" +" AND L.LOT_NO__FROM <= ? AND L.LOT_NO__TO >= ?"
+" AND I.ITEM_CODE = ?"; +" AND I.ITEM_CODE = ?";
pstmt = con.prepareStatement(sql); pstmt = con.prepareStatement(sql);
if(lotNo != null && lotNo.length() > 0) if(lotNo != null && lotNo.length() > 0)
{ {
...@@ -1501,7 +1582,7 @@ public class UploadOrderEJB extends ActionHandlerEJB implements UploadOrderEJBLo ...@@ -1501,7 +1582,7 @@ public class UploadOrderEJB extends ActionHandlerEJB implements UploadOrderEJBLo
} }
pstmt.setString(3, itemCode); pstmt.setString(3, itemCode);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
if(rs.next()) if(rs.next())
{ {
itmLen = rs.getDouble("ITEM_LEN"); itmLen = rs.getDouble("ITEM_LEN");
...@@ -1519,10 +1600,10 @@ public class UploadOrderEJB extends ActionHandlerEJB implements UploadOrderEJBLo ...@@ -1519,10 +1600,10 @@ public class UploadOrderEJB extends ActionHandlerEJB implements UploadOrderEJBLo
harmonizDescr = rs.getString("HARMONIZATION_DESCR"); harmonizDescr = rs.getString("HARMONIZATION_DESCR");
originCountry = rs.getString("ORIGIN_COUNTRY"); originCountry = rs.getString("ORIGIN_COUNTRY");
} }
itemSize = itmLen * itmWidth * itmHeight; itemSize = itmLen * itmWidth * itmHeight;
lotSize = lotHeight * lotWidth * lotLen; lotSize = lotHeight * lotWidth * lotLen;
dataVolumeMap.put("PACK_SIZE", packSize); dataVolumeMap.put("PACK_SIZE", packSize);
dataVolumeMap.put("ITEM_SIZE", itemSize); dataVolumeMap.put("ITEM_SIZE", itemSize);
dataVolumeMap.put("LOT_SIZE", lotSize); dataVolumeMap.put("LOT_SIZE", lotSize);
...@@ -1539,25 +1620,25 @@ public class UploadOrderEJB extends ActionHandlerEJB implements UploadOrderEJBLo ...@@ -1539,25 +1620,25 @@ public class UploadOrderEJB extends ActionHandlerEJB implements UploadOrderEJBLo
dataVolumeMap.put("LITEM_LEN", lotLen); dataVolumeMap.put("LITEM_LEN", lotLen);
dataVolumeMap.put("LITEM_WID", lotWidth); dataVolumeMap.put("LITEM_WID", lotWidth);
dataVolumeMap.put("LITEM_HEIGHT", lotHeight); dataVolumeMap.put("LITEM_HEIGHT", lotHeight);
if(pstmt != null) if(pstmt != null)
{ {
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
} }
if(rs != null) if(rs != null)
{ {
rs.close(); rs.close();
rs = null; rs = null;
} }
} catch (Exception e) { } catch (Exception e) {
// TODO: handle exception // TODO: handle exception
throw e; throw e;
...@@ -1570,13 +1651,13 @@ public class UploadOrderEJB extends ActionHandlerEJB implements UploadOrderEJBLo ...@@ -1570,13 +1651,13 @@ public class UploadOrderEJB extends ActionHandlerEJB implements UploadOrderEJBLo
{ {
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
} }
if(rs != null) if(rs != null)
{ {
rs.close(); rs.close();
rs = null; rs = null;
} }
} }
catch(Exception e) catch(Exception e)
...@@ -1584,7 +1665,7 @@ public class UploadOrderEJB extends ActionHandlerEJB implements UploadOrderEJBLo ...@@ -1584,7 +1665,7 @@ public class UploadOrderEJB extends ActionHandlerEJB implements UploadOrderEJBLo
throw e; throw e;
} }
} }
return dataVolumeMap; return dataVolumeMap;
...@@ -1593,42 +1674,42 @@ public class UploadOrderEJB extends ActionHandlerEJB implements UploadOrderEJBLo ...@@ -1593,42 +1674,42 @@ public class UploadOrderEJB extends ActionHandlerEJB implements UploadOrderEJBLo
{ {
String sql = ""; String sql = "";
String itemUnit = ""; String itemUnit = "";
String orderUnit = ""; String orderUnit = "";
String unitStd = ""; String unitStd = "";
double convQtyStduom = 0.0; double convQtyStduom = 0.0;
double newQty = 0.0; double newQty = 0.0;
double convFact = 0; double convFact = 0;
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
ResultSet rs = null; ResultSet rs = null;
DistCommon discommon = new DistCommon(); DistCommon discommon = new DistCommon();
GenericUtility genericUtility=GenericUtility.getInstance(); GenericUtility genericUtility=GenericUtility.getInstance();
try try
{ {
//System.out.println(" -- saleOrder ["+saleOrder+"] lineNo ["+lineNo+"] itemCode ["+itemCode+"] "); //System.out.println(" -- saleOrder ["+saleOrder+"] lineNo ["+lineNo+"] itemCode ["+itemCode+"] ");
sql = "SELECT DISTINCT ITEM.UNIT ,SORDDET.UNIT AS ORDER_UNIT,SORDDET.UNIT__STD AS UNIT__STD, " + sql = "SELECT DISTINCT ITEM.UNIT ,SORDDET.UNIT AS ORDER_UNIT,SORDDET.UNIT__STD AS UNIT__STD, " +
" SORDDET.CONV__QTY_STDUOM FROM ITEM, SORDDET WHERE ITEM.ITEM_CODE = ? " + " SORDDET.CONV__QTY_STDUOM FROM ITEM, SORDDET WHERE ITEM.ITEM_CODE = ? " +
" AND SORDDET.SALE_ORDER = ? AND SORDDET.LINE_NO = ? AND ITEM.ITEM_CODE = SORDDET.ITEM_CODE "; " AND SORDDET.SALE_ORDER = ? AND SORDDET.LINE_NO = ? AND ITEM.ITEM_CODE = SORDDET.ITEM_CODE ";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, itemCode); pstmt.setString(1, itemCode);
pstmt.setString(2, saleOrder); pstmt.setString(2, saleOrder);
pstmt.setString(3, lineNo); pstmt.setString(3, lineNo);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
if( rs.next()) if( rs.next())
{ {
itemUnit = rs.getString("UNIT"); itemUnit = rs.getString("UNIT");
orderUnit = rs.getString("ORDER_UNIT"); orderUnit = rs.getString("ORDER_UNIT");
unitStd = checkNull(rs.getString("UNIT__STD")); unitStd = checkNull(rs.getString("UNIT__STD"));
convQtyStduom = rs.getDouble("CONV__QTY_STDUOM"); convQtyStduom = rs.getDouble("CONV__QTY_STDUOM");
} }
rs.close(); rs = null; rs.close(); rs = null;
pstmt.close(); pstmt = null; pstmt.close(); pstmt = null;
ArrayList convQtyList = new ArrayList(); ArrayList convQtyList = new ArrayList();
if(!orderUnit.equalsIgnoreCase(unitStd)) if(!orderUnit.equalsIgnoreCase(unitStd))
{ {
if(convQtyStduom != 0 && check == 1) if(convQtyStduom != 0 && check == 1)
{ {
convFact = convQtyStduom; convFact = convQtyStduom;
...@@ -1647,7 +1728,7 @@ public class UploadOrderEJB extends ActionHandlerEJB implements UploadOrderEJBLo ...@@ -1647,7 +1728,7 @@ public class UploadOrderEJB extends ActionHandlerEJB implements UploadOrderEJBLo
System.out.println("convQtyList = "+convQtyList); System.out.println("convQtyList = "+convQtyList);
newQty = Double.parseDouble(convQtyList.get(1).toString()); newQty = Double.parseDouble(convQtyList.get(1).toString());
System.out.println("newQty ["+newQty+"]"); System.out.println("newQty ["+newQty+"]");
if(newQty == -999999999) if(newQty == -999999999)
{ {
newQty = 0; newQty = 0;
...@@ -1656,20 +1737,20 @@ public class UploadOrderEJB extends ActionHandlerEJB implements UploadOrderEJBLo ...@@ -1656,20 +1737,20 @@ public class UploadOrderEJB extends ActionHandlerEJB implements UploadOrderEJBLo
{ {
convQtyStduom= Double.parseDouble(convQtyList.get(0).toString()); convQtyStduom= Double.parseDouble(convQtyList.get(0).toString());
} }
} }
else else
{ {
newQty = quantity; newQty = quantity;
} }
//pendingQty = meffQty; //pendingQty = meffQty;
} }
catch(Exception ex) catch(Exception ex)
{ {
ex.printStackTrace(); ex.printStackTrace();
throw new ITMException(ex); throw new ITMException(ex);
} }
return newQty; return newQty;
} }
...@@ -1684,25 +1765,25 @@ public class UploadOrderEJB extends ActionHandlerEJB implements UploadOrderEJBLo ...@@ -1684,25 +1765,25 @@ public class UploadOrderEJB extends ActionHandlerEJB implements UploadOrderEJBLo
ResultSet rs = null; ResultSet rs = null;
double itmLen = 0,itmWidth = 0,itmHeight = 0,itemWeight = 0,lotLen = 0 ,lotHeight = 0,lotWidth = 0,lotWeight = 0; double itmLen = 0,itmWidth = 0,itmHeight = 0,itemWeight = 0,lotLen = 0 ,lotHeight = 0,lotWidth = 0,lotWeight = 0;
HashMap dataVolumeMap = new HashMap(); HashMap dataVolumeMap = new HashMap();
System.out.println("As Lot No Passed as Blank Calling Override method for getItemVoumeMap"); System.out.println("As Lot No Passed as Blank Calling Override method for getItemVoumeMap");
try { try {
sql = "SELECT I.LENGTH ITEM_LEN,I.WIDTH ITEM_WID,I.HEIGHT ITEM_HEIGHT,I.GROSS_WEIGHT ITEM_WEIGHT,I.HAZARDOUS HAZARD, " sql = "SELECT I.LENGTH ITEM_LEN,I.WIDTH ITEM_WID,I.HEIGHT ITEM_HEIGHT,I.GROSS_WEIGHT ITEM_WEIGHT,I.HAZARDOUS HAZARD, "
+" I.HARMONIZATION_NO HARMONIZATION_NO,I.HARMONIZATION_DESCR HARMONIZATION_DESCR,I.COUNT_CODE__MFG ORIGIN_COUNTRY," +" I.HARMONIZATION_NO HARMONIZATION_NO,I.HARMONIZATION_DESCR HARMONIZATION_DESCR,I.COUNT_CODE__MFG ORIGIN_COUNTRY,"
+" L.LENGTH LITEM_LEN,L.WIDTH LITEM_WID,L.HEIGHT LITEM_HEIGHT,L.SHIPPER_SIZE SHIPSIZE,L.GROSS_WEIGHT LOT_WEIGHT FROM" +" L.LENGTH LITEM_LEN,L.WIDTH LITEM_WID,L.HEIGHT LITEM_HEIGHT,L.SHIPPER_SIZE SHIPSIZE,L.GROSS_WEIGHT LOT_WEIGHT FROM"
+" ITEM I,ITEM_LOT_PACKSIZE L" +" ITEM I,ITEM_LOT_PACKSIZE L"
+" WHERE I.ITEM_CODE = L.ITEM_CODE" +" WHERE I.ITEM_CODE = L.ITEM_CODE"
+" AND L.LOT_NO__TO IN (SELECT MAX(LOT_NO__TO) FROM ITEM_LOT_PACKSIZE WHERE ITEM_CODE = ?)" +" AND L.LOT_NO__TO IN (SELECT MAX(LOT_NO__TO) FROM ITEM_LOT_PACKSIZE WHERE ITEM_CODE = ?)"
+" AND I.ITEM_CODE = ?"; +" AND I.ITEM_CODE = ?";
pstmt = con.prepareStatement(sql); pstmt = con.prepareStatement(sql);
pstmt.setString(1, itemCode); pstmt.setString(1, itemCode);
pstmt.setString(2, itemCode); pstmt.setString(2, itemCode);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
if(rs.next()) if(rs.next())
{ {
itmLen = rs.getDouble("ITEM_LEN"); itmLen = rs.getDouble("ITEM_LEN");
...@@ -1722,7 +1803,7 @@ public class UploadOrderEJB extends ActionHandlerEJB implements UploadOrderEJBLo ...@@ -1722,7 +1803,7 @@ public class UploadOrderEJB extends ActionHandlerEJB implements UploadOrderEJBLo
} }
itemSize = itmLen * itmWidth * itmHeight; itemSize = itmLen * itmWidth * itmHeight;
lotSize = lotHeight * lotWidth * lotLen; lotSize = lotHeight * lotWidth * lotLen;
dataVolumeMap.put("PACK_SIZE", packSize); dataVolumeMap.put("PACK_SIZE", packSize);
dataVolumeMap.put("ITEM_SIZE", itemSize); dataVolumeMap.put("ITEM_SIZE", itemSize);
dataVolumeMap.put("LOT_SIZE", lotSize); dataVolumeMap.put("LOT_SIZE", lotSize);
...@@ -1738,28 +1819,28 @@ public class UploadOrderEJB extends ActionHandlerEJB implements UploadOrderEJBLo ...@@ -1738,28 +1819,28 @@ public class UploadOrderEJB extends ActionHandlerEJB implements UploadOrderEJBLo
dataVolumeMap.put("LITEM_LEN", lotLen); dataVolumeMap.put("LITEM_LEN", lotLen);
dataVolumeMap.put("LITEM_WID", lotWidth); dataVolumeMap.put("LITEM_WID", lotWidth);
dataVolumeMap.put("LITEM_HEIGHT", lotHeight); dataVolumeMap.put("LITEM_HEIGHT", lotHeight);
if(pstmt != null) if(pstmt != null)
{ {
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
} }
if(rs != null) if(rs != null)
{ {
rs.close(); rs.close();
rs = null; rs = null;
} }
} catch (Exception e) { } catch (Exception e) {
// TODO: handle exception // TODO: handle exception
throw e; throw e;
} }
finally finally
...@@ -1770,13 +1851,13 @@ public class UploadOrderEJB extends ActionHandlerEJB implements UploadOrderEJBLo ...@@ -1770,13 +1851,13 @@ public class UploadOrderEJB extends ActionHandlerEJB implements UploadOrderEJBLo
{ {
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
} }
if(rs != null) if(rs != null)
{ {
rs.close(); rs.close();
rs = null; rs = null;
} }
} }
catch(Exception e) catch(Exception e)
...@@ -1784,7 +1865,7 @@ public class UploadOrderEJB extends ActionHandlerEJB implements UploadOrderEJBLo ...@@ -1784,7 +1865,7 @@ public class UploadOrderEJB extends ActionHandlerEJB implements UploadOrderEJBLo
throw e; throw e;
} }
} }
return dataVolumeMap; return dataVolumeMap;
...@@ -1800,10 +1881,10 @@ public class UploadOrderEJB extends ActionHandlerEJB implements UploadOrderEJBLo ...@@ -1800,10 +1881,10 @@ public class UploadOrderEJB extends ActionHandlerEJB implements UploadOrderEJBLo
String countCodeDlv = "", crTerm= "",rcpMode = "",buyerName = "",notifyTo = "",siteCodeHdr = ""; String countCodeDlv = "", crTerm= "",rcpMode = "",buyerName = "",notifyTo = "",siteCodeHdr = "";
String salesPers = "",taxEnv = "",pordDateStr = "",itemSer = "",saleOrderMangento = "",udfStr1 = "", String salesPers = "",taxEnv = "",pordDateStr = "",itemSer = "",saleOrderMangento = "",udfStr1 = "",
trnAmountStr = "",pordMode = "",siteCodeShip = "",remarks = "",totAmt = "",dlvTo = "", trnAmountStr = "",pordMode = "",siteCodeShip = "",remarks = "",totAmt = "",dlvTo = "",
vendorTxCode = "",exchRateStr = "",ordAmtStr = "",dueDateStr = "",taxDateStr = "",acctCodeSal = "", vendorTxCode = "",exchRateStr = "",ordAmtStr = "",dueDateStr = "",taxDateStr = "",acctCodeSal = "",
securityKey = "",frtAmtStr = "",empCodeOrd = "",orderDateStr = "",taxAmtStr = "",dlvTerm = "", securityKey = "",frtAmtStr = "",empCodeOrd = "",orderDateStr = "",taxAmtStr = "",dlvTerm = "",
vpsTxId = "",saleOrder = "",priceList = ""; vpsTxId = "",saleOrder = "",priceList = "";
NodeList parentNodeList = null; NodeList parentNodeList = null;
NodeList childNodeList = null; NodeList childNodeList = null;
...@@ -1884,7 +1965,7 @@ public class UploadOrderEJB extends ActionHandlerEJB implements UploadOrderEJBLo ...@@ -1884,7 +1965,7 @@ public class UploadOrderEJB extends ActionHandlerEJB implements UploadOrderEJBLo
siteCodeShip = checkNull(eElement.getElementsByTagName("site_code__ship").item(0).getTextContent()); siteCodeShip = checkNull(eElement.getElementsByTagName("site_code__ship").item(0).getTextContent());
pordMode = checkNull(eElement.getElementsByTagName("pord_mode").item(0).getTextContent()); pordMode = checkNull(eElement.getElementsByTagName("pord_mode").item(0).getTextContent());
udfStr1 = checkNull(eElement.getElementsByTagName("udf__str1").item(0).getTextContent()); udfStr1 = checkNull(eElement.getElementsByTagName("udf__str1").item(0).getTextContent());
System.out.println("udfStr1----->"+udfStr1); System.out.println("udfStr1----->"+udfStr1);
vendorTxCode = checkNull(eElement.getElementsByTagName("vendor_tx_code").item(0).getTextContent()); vendorTxCode = checkNull(eElement.getElementsByTagName("vendor_tx_code").item(0).getTextContent());
vpsTxId = checkNull(eElement.getElementsByTagName("vps_tx_id").item(0).getTextContent()); vpsTxId = checkNull(eElement.getElementsByTagName("vps_tx_id").item(0).getTextContent());
...@@ -2006,7 +2087,7 @@ public class UploadOrderEJB extends ActionHandlerEJB implements UploadOrderEJBLo ...@@ -2006,7 +2087,7 @@ public class UploadOrderEJB extends ActionHandlerEJB implements UploadOrderEJBLo
System.out.println("xmlString in masterStateful :::: " + xmlString); System.out.println("xmlString in masterStateful :::: " + xmlString);
retString = masterStateful.processRequest(authencate, siteCode, true, xmlString, true, conn); retString = masterStateful.processRequest(authencate, siteCode, true, xmlString, true, conn);
masterStateful = null; masterStateful = null;
} }
catch(ITMException e) catch(ITMException e)
{ {
...@@ -2019,9 +2100,9 @@ public class UploadOrderEJB extends ActionHandlerEJB implements UploadOrderEJBLo ...@@ -2019,9 +2100,9 @@ public class UploadOrderEJB extends ActionHandlerEJB implements UploadOrderEJBLo
throw new Exception(e); throw new Exception(e);
} }
return retString; return retString;
} }
public String checkNull(String str) public String checkNull(String str)
{ {
if(str == null) if(str == null)
...@@ -2029,7 +2110,16 @@ public class UploadOrderEJB extends ActionHandlerEJB implements UploadOrderEJBLo ...@@ -2029,7 +2110,16 @@ public class UploadOrderEJB extends ActionHandlerEJB implements UploadOrderEJBLo
str=""; str="";
} }
return str.trim(); return str.trim();
}
private static String checkNullAndTrim(String input)
{
if (input==null)
{
input="";
}
return input.trim();
} }
} }
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