Commit 67175348 authored by agaikwad's avatar agaikwad

Added Disparam value for null lot_Sl


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@104766 ce508802-f39f-4f6c-b175-0d175dae99d5
parent e20a7e1f
...@@ -9,7 +9,6 @@ ...@@ -9,7 +9,6 @@
package ibase.webitm.ejb.dis; package ibase.webitm.ejb.dis;
import ibase.utility.E12GenericUtility; import ibase.utility.E12GenericUtility;
import ibase.webitm.ejb.dis.DistCommon; import ibase.webitm.ejb.dis.DistCommon;
import ibase.webitm.ejb.fin.FinCommon;
import ibase.webitm.ejb.sys.SysCommon; import ibase.webitm.ejb.sys.SysCommon;
import ibase.system.config.ConnDriver; import ibase.system.config.ConnDriver;
import ibase.webitm.ejb.ValidatorEJB; import ibase.webitm.ejb.ValidatorEJB;
...@@ -274,8 +273,8 @@ public class SalesReturn extends ValidatorEJB implements SalesReturnLocal, Sales ...@@ -274,8 +273,8 @@ public class SalesReturn extends ValidatorEJB implements SalesReturnLocal, Sales
Node childNode = null; Node childNode = null;
Node tempNode = null; Node tempNode = null;
Connection conn = null; Connection conn = null;
PreparedStatement pstmt = null, pstmt1 = null; PreparedStatement pstmt = null, pstmt1 = null,pstmt7=null;
ResultSet rs = null, rs1 = null ; ResultSet rs = null, rs1 = null,rs7=null ;
String childNodeName = null; String childNodeName = null;
String columnValue = null; String columnValue = null;
int currentFormNo = 0 ,cnt = 0; int currentFormNo = 0 ,cnt = 0;
...@@ -397,16 +396,6 @@ public class SalesReturn extends ValidatorEJB implements SalesReturnLocal, Sales ...@@ -397,16 +396,6 @@ public class SalesReturn extends ValidatorEJB implements SalesReturnLocal, Sales
String siteCode3 = null; String siteCode3 = null;
try try
{ {
// Changed by Sneha on 22-07-2016 for exchange rate [Start]
java.util.Date currDate1 = new java.util.Date();
String applDateFormat = genericUtility.getApplDateFormat();
String dbDateFormat = genericUtility.getDBDateFormat();
SimpleDateFormat sdf = new SimpleDateFormat(applDateFormat);
String currDateStr = sdf.format(currDate1);
FinCommon finCommon = new FinCommon();
// Changed by Sneha on 22-07-2016 for exchange rate [End]
ITMDBAccessEJB dbEjb = new ITMDBAccessEJB(); ITMDBAccessEJB dbEjb = new ITMDBAccessEJB();
sysCommon = new SysCommon(); sysCommon = new SysCommon();
if(objContext != null && objContext.trim().length()>0) if(objContext != null && objContext.trim().length()>0)
...@@ -417,10 +406,7 @@ public class SalesReturn extends ValidatorEJB implements SalesReturnLocal, Sales ...@@ -417,10 +406,7 @@ public class SalesReturn extends ValidatorEJB implements SalesReturnLocal, Sales
valueXmlString = new StringBuffer("<?xml version=\"1.0\"?><Root><header><editFlag>"); valueXmlString = new StringBuffer("<?xml version=\"1.0\"?><Root><header><editFlag>");
valueXmlString.append(editFlag).append("</editFlag></header>"); valueXmlString.append(editFlag).append("</editFlag></header>");
//System.out.println(".....call item change ...."); //System.out.println(".....call item change ....");
//Changes and Commented By Bhushan on 09-06-2016 :START conn = connDriver.getConnectDB("DriverITM");
//conn = connDriver.getConnectDB("DriverITM");
conn = getConnection();
//Changes and Commented By Bhushan on 09-06-2016 :END
connDriver=null; connDriver=null;
System.out.println(">>>>>>>>>>>In IC currentFormNo:"+currentFormNo); System.out.println(">>>>>>>>>>>In IC currentFormNo:"+currentFormNo);
switch( currentFormNo ) switch( currentFormNo )
...@@ -574,7 +560,6 @@ public class SalesReturn extends ValidatorEJB implements SalesReturnLocal, Sales ...@@ -574,7 +560,6 @@ public class SalesReturn extends ValidatorEJB implements SalesReturnLocal, Sales
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
rs = null; rs = null;
currCode = currCode == null ?"" : currCode.trim(); currCode = currCode == null ?"" : currCode.trim();
currCodeBase = currCodeBase == null ?"" : currCodeBase.trim(); currCodeBase = currCodeBase == null ?"" : currCodeBase.trim();
if ( !( currCode.trim().equalsIgnoreCase( currCodeBase.trim() ) ) ) if ( !( currCode.trim().equalsIgnoreCase( currCodeBase.trim() ) ) )
...@@ -923,16 +908,9 @@ public class SalesReturn extends ValidatorEJB implements SalesReturnLocal, Sales ...@@ -923,16 +908,9 @@ public class SalesReturn extends ValidatorEJB implements SalesReturnLocal, Sales
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
rs = null; rs = null;
valueXmlString.append("<currency_descr>").append("<![CDATA["+getAbsString(descr)+"]]>").append("</currency_descr>"); valueXmlString.append("<currency_descr>").append("<![CDATA["+getAbsString(descr)+"]]>").append("</currency_descr>");
valueXmlString.append("<curr_code__bc>").append("<![CDATA["+getAbsString(currCode)+"]]>").append("</curr_code__bc>"); valueXmlString.append("<curr_code__bc>").append("<![CDATA["+getAbsString(currCode)+"]]>").append("</curr_code__bc>");
valueXmlString.append("<exch_rate>").append("<![CDATA["+ exchRate +"]]>").append("</exch_rate>");
// Changed by Sneha on 22-07-2016 for exchange rate [Start]
Double exchRateFinn = finCommon.getDailyExchRateSellBuy(currCode.trim(),"",siteCode.trim(),currDateStr.trim(),"S", conn);
//valueXmlString.append("<exch_rate>").append("<![CDATA["+ exchRate +"]]>").append("</exch_rate>");
valueXmlString.append("<exch_rate>").append("<![CDATA["+ exchRateFinn +"]]>").append("</exch_rate>");
// Changed by Sneha on 22-07-2016 for exchange rate [End]
valueXmlString.append("<anal_code>").append("<![CDATA["+getAbsString(analCode)+"]]>").append("</anal_code>"); valueXmlString.append("<anal_code>").append("<![CDATA["+getAbsString(analCode)+"]]>").append("</anal_code>");
valueXmlString.append("<item_ser protect =\"1\">").append("<![CDATA["+getAbsString(itemSer)+"]]>").append("</item_ser>"); valueXmlString.append("<item_ser protect =\"1\">").append("<![CDATA["+getAbsString(itemSer)+"]]>").append("</item_ser>");
...@@ -2360,26 +2338,11 @@ public class SalesReturn extends ValidatorEJB implements SalesReturnLocal, Sales ...@@ -2360,26 +2338,11 @@ public class SalesReturn extends ValidatorEJB implements SalesReturnLocal, Sales
valueXmlString.append("<claim_qty>").append("<![CDATA[" + getRequiredDecimal( sQuantity, 3 ) + "]]>").append("</claim_qty>"); valueXmlString.append("<claim_qty>").append("<![CDATA[" + getRequiredDecimal( sQuantity, 3 ) + "]]>").append("</claim_qty>");
setNodeValue( dom, "claim_qty", getRequiredDecimal( sQuantity, 3 ) ); setNodeValue( dom, "claim_qty", getRequiredDecimal( sQuantity, 3 ) );
} }
// Changed by Sneha on 28-06-2016, to set claim_qty and physical_qty [Start]
else if(Double.parseDouble(claimQty) != sQuantity)
{
valueXmlString.append("<claim_qty>").append("<![CDATA[" + getRequiredDecimal( sQuantity, 3 ) + "]]>").append("</claim_qty>");
setNodeValue( dom, "claim_qty", getRequiredDecimal( sQuantity, 3 ) );
}
// Changed by Sneha on 28-06-2016, to set claim_qty and physical_qty [End]
if (claimQty == null) if (claimQty == null)
{ {
valueXmlString.append("<physical_qty>").append("<![CDATA[" + getRequiredDecimal( sQuantity, 3 ) + "]]>").append("</physical_qty>"); valueXmlString.append("<physical_qty>").append("<![CDATA[" + getRequiredDecimal( sQuantity, 3 ) + "]]>").append("</physical_qty>");
setNodeValue( dom, "physical_qty", getRequiredDecimal( sQuantity, 3 ) ); setNodeValue( dom, "physical_qty", getRequiredDecimal( sQuantity, 3 ) );
} }
// Changed by Sneha on 28-06-2016, to set claim_qty and physical_qty [Start]
else if(Double.parseDouble(physicalQty) != sQuantity)
{
valueXmlString.append("<physical_qty>").append("<![CDATA[" + getRequiredDecimal( sQuantity, 3 ) + "]]>").append("</physical_qty>");
setNodeValue( dom, "physical_qty", getRequiredDecimal( sQuantity, 3 ) );
}
// Changed by Sneha on 28-06-2016, to set claim_qty and physical_qty [End]
infoMap = new HashMap(); infoMap = new HashMap();
retReplFlag = genericUtility.getColumnValue("ret_repl_flag", dom); retReplFlag = genericUtility.getColumnValue("ret_repl_flag", dom);
siteCode = genericUtility.getColumnValue("site_code", dom1); siteCode = genericUtility.getColumnValue("site_code", dom1);
...@@ -3090,113 +3053,7 @@ public class SalesReturn extends ValidatorEJB implements SalesReturnLocal, Sales ...@@ -3090,113 +3053,7 @@ public class SalesReturn extends ValidatorEJB implements SalesReturnLocal, Sales
{ {
iValStr = iValStr.substring(0,iValStr.indexOf(".")); iValStr = iValStr.substring(0,iValStr.indexOf("."));
} }
//Added by Santosh on 06/12/2016 to append invoice id to itemChange retStr [Start]
if(invoiceId == null || invoiceId.trim().length() == 0)
{
int noSchemeHist = 0;
String schemeKey = "", disParmVarValue = "", docKey = "", docValue = "";
String sNoSchemeHist = distCommon.getDisparams("999999","SCHEME_HIST_NUM",conn);
System.out.println( "sNoSchemeHist :: " + sNoSchemeHist );
noSchemeHist = Integer.parseInt(sNoSchemeHist);
for (int keyCtr = 1; keyCtr <= noSchemeHist ; keyCtr++)
{
schemeKey = "SCHEME_HIST_KEY" + keyCtr ;
System.out.println(">>>>>>>>>In for loop schemeKey:"+schemeKey);
disParmVarValue = distCommon.getDisparams("999999",schemeKey,conn);
System.out.println(">>>>>>>>>In for loop afer schemeKey varValue:"+disParmVarValue);
disParmVarValue = disParmVarValue.trim();
String[] varValueArry = disParmVarValue.split(",");
for(int i=0; i<varValueArry.length; i++)
{
if("cust_code".equalsIgnoreCase(varValueArry[i].trim()))
{
docValue = genericUtility.getColumnValue(varValueArry[i].trim(),dom1).trim();
}
else if("item_code".equalsIgnoreCase(varValueArry[i].trim()))
{
docValue = genericUtility.getColumnValue(varValueArry[i].trim(),dom).trim();
}
else if("lot_no".equalsIgnoreCase(varValueArry[i].trim()))
{
docValue = genericUtility.getColumnValue(varValueArry[i].trim(),dom).trim();
}
else if("invoice_id".equalsIgnoreCase(varValueArry[i].trim()))
{
continue;
}
if (docKey != "" && docKey.trim().length() > 0)
{
docKey = docKey + "," + ( docValue == null || docValue.trim().length() == 0 ? "" : docValue);
}
else
{
docKey = docValue;
}
}
}
System.out.println(">>>>>>>>after for loop docKey:"+docKey);
sql = " SELECT MRH.INVOICE_ID,SUM(CASE WHEN SRDET.QUANTITY IS NULL THEN 0 ELSE SRDET.QUANTITY END), MRH.EFF_COST "
+ " FROM MIN_RATE_HISTORY MRH, SRETURNDET SRDET WHERE MRH.INVOICE_ID=SRDET.INVOICE_ID(+) "
+ " AND MRH.DOC_KEY LIKE '"+docKey+"%' AND MRH.QUANTITY-MRH.QUANTITY_ADJ>0 AND MRH.QUANTITY IS NOT NULL "
+ " GROUP BY MRH.INVOICE_ID,MRH.QUANTITY, MRH.EFF_COST HAVING MRH.QUANTITY-SUM(CASE WHEN SRDET.QUANTITY IS NULL THEN 0 ELSE SRDET.QUANTITY END)>0 "
+ " ORDER BY MRH.EFF_COST";
pstmt = conn.prepareStatement(sql);
rs = pstmt.executeQuery();
if(rs.next())
{
invoiceId = checkNull(rs.getString("INVOICE_ID"));
valueXmlString.append("<invoice_id>").append("<![CDATA[" + invoiceId + "]]>").append("</invoice_id>");
setNodeValue(dom1, "invoice_id", invoiceId);
}
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
if(rs != null)
{
rs.close();
rs = null;
}
sql = "SELECT INV_LINE_NO, LINE_NO FROM INVOICE_TRACE WHERE INVOICE_ID = ? AND ITEM_CODE = ? AND LOT_NO = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, invoiceId);
pstmt.setString(2, itemCode);
pstmt.setString(3, lotNo);
rs = pstmt.executeQuery();
if(rs.next())
{
String liLineNoStr = getNumString( rs.getString("INV_LINE_NO"));
lineNoInv = Integer.parseInt(liLineNoStr);
String lineNoInvTrace = getNumString(rs.getString("LINE_NO"));
int ilineNoInvTrace = Integer.parseInt(lineNoInvTrace);
valueXmlString.append("<line_no__inv>").append("<![CDATA[" + lineNoInv + "]]>").append("</line_no__inv>");
valueXmlString.append("<line_no__invtrace>").append("<![CDATA[" + ilineNoInvTrace + "]]>").append("</line_no__invtrace>");
System.out.println("lineNoInv before >>> " + lineNoInv);
setNodeValue( dom, "line_no__inv", lineNoInv );
setNodeValue( dom, "line_no__invtrace", ilineNoInvTrace );
invoiceId = null;
}
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
if(rs != null)
{
rs.close();
rs = null;
}
}
//Added by Santosh on 06/12/2016 to append invoice id to itemChange retStr [End]
infoMap = new HashMap(); infoMap = new HashMap();
iValStr = iValStr == null || iValStr.trim().length() == 0 ? "0" : iValStr.trim(); iValStr = iValStr == null || iValStr.trim().length() == 0 ? "0" : iValStr.trim();
lineNoInv = Integer.parseInt( getNumString( iValStr ) ); lineNoInv = Integer.parseInt( getNumString( iValStr ) );
...@@ -3610,13 +3467,12 @@ public class SalesReturn extends ValidatorEJB implements SalesReturnLocal, Sales ...@@ -3610,13 +3467,12 @@ public class SalesReturn extends ValidatorEJB implements SalesReturnLocal, Sales
System.out.println("lotNo is:"+lotNo); System.out.println("lotNo is:"+lotNo);
System.out.println("locCode is:"+locCode); System.out.println("locCode is:"+locCode);
System.out.println("itemCode is:"+itemCode); System.out.println("itemCode is:"+itemCode);
sql="select max(lot_sl) from stock where site_code = ? and " + sql="select lot_sl from stock where site_code = ? and " +
"lot_no = ? and loc_code = ? and item_code = ?"; "lot_no = ? and item_code = ?";
pstmt= conn.prepareStatement( sql );//,,, pstmt= conn.prepareStatement( sql );//,,,
pstmt.setString( 1, siteCode); pstmt.setString( 1, siteCode);
pstmt.setString( 2, lotNo ); pstmt.setString( 2, lotNo );
pstmt.setString( 3, locCode); pstmt.setString( 3, itemCode );
pstmt.setString( 4, itemCode );
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
//amtDrCr = 0; //amtDrCr = 0;
if( rs.next() ) if( rs.next() )
...@@ -3629,11 +3485,23 @@ public class SalesReturn extends ValidatorEJB implements SalesReturnLocal, Sales ...@@ -3629,11 +3485,23 @@ public class SalesReturn extends ValidatorEJB implements SalesReturnLocal, Sales
pstmt = null; pstmt = null;
rs = null; rs = null;
System.out.println("*********Lot sl is:"+lslotsl); System.out.println("*********Lot sl is:"+lslotsl);
if (lslotsl == null) if (lslotsl == null || lslotsl.trim().length() == 0)
{
System.out.println("lslotsl is null in lot_no itemChanged"+lslotsl);
String lsSretLotsl="";
lsSretLotsl = distCommon.getDisparams( "999999", "SRETURN_DEFAULT_LOTSL", conn );
System.out.println("lsSretLotsl ["+lsSretLotsl+"] in lot_no Disparam Value");
if(lsSretLotsl == null || lsSretLotsl.trim().length()== 0 || "NULLFOUND".equalsIgnoreCase(lsSretLotsl))
{ {
valueXmlString.append("<lot_sl>").append("2S").append("</lot_sl>"); valueXmlString.append("<lot_sl>").append("2S").append("</lot_sl>");
} }
else else
{
System.out.println("lsSretLotsl["+lsSretLotsl+"]");
valueXmlString.append("<lot_sl>").append("<![CDATA[" + lsSretLotsl + "]]>").append("</lot_sl>");
}
}
else
{ {
valueXmlString.append("<lot_sl>").append("<![CDATA[" + lslotsl + "]]>").append("</lot_sl>"); valueXmlString.append("<lot_sl>").append("<![CDATA[" + lslotsl + "]]>").append("</lot_sl>");
} }
...@@ -4027,6 +3895,7 @@ public class SalesReturn extends ValidatorEJB implements SalesReturnLocal, Sales ...@@ -4027,6 +3895,7 @@ public class SalesReturn extends ValidatorEJB implements SalesReturnLocal, Sales
valueXmlString.append("<stk_opt>").append("<![CDATA[" + "N" + "]]>").append("</stk_opt>"); valueXmlString.append("<stk_opt>").append("<![CDATA[" + "N" + "]]>").append("</stk_opt>");
mvarValue = distCommon.getDisparams( "999999", "EXPIRED_LOC", conn ); mvarValue = distCommon.getDisparams( "999999", "EXPIRED_LOC", conn );
System.out.println("mvarValue is:"+mvarValue);
valueXmlString.append("<loc_code>").append("<![CDATA[" + mvarValue + "]]>").append("</loc_code>"); //dw_currobj.setitem(1,"loc_code",mvar_value) valueXmlString.append("<loc_code>").append("<![CDATA[" + mvarValue + "]]>").append("</loc_code>"); //dw_currobj.setitem(1,"loc_code",mvar_value)
sqlStr = "select descr " //into :ls_loc_descr sqlStr = "select descr " //into :ls_loc_descr
...@@ -4047,6 +3916,51 @@ public class SalesReturn extends ValidatorEJB implements SalesReturnLocal, Sales ...@@ -4047,6 +3916,51 @@ public class SalesReturn extends ValidatorEJB implements SalesReturnLocal, Sales
pstmt = null; pstmt = null;
valueXmlString.append("<location_descr>").append("<![CDATA[" + locDescr + "]]>").append("</location_descr>"); valueXmlString.append("<location_descr>").append("<![CDATA[" + locDescr + "]]>").append("</location_descr>");
/*Added by ABhijit Gaikwad-lot_sl
String lslotsl="";
System.out.println("site_code is:"+siteCode);
System.out.println("lotNo is:"+lotNo);
System.out.println("loc_code is:"+mvarValue);
System.out.println("itemCode is:"+itemCode);
sql="select lot_sl from stock where site_code = ? and " +
"lot_no = ? and loc_code = ? and item_code = ?";
pstmt= conn.prepareStatement( sql );//,,,
pstmt.setString( 1, siteCode);
pstmt.setString( 2, lotNo );
pstmt.setString( 3, mvarValue);
pstmt.setString( 4, itemCode );
rs = pstmt.executeQuery();
//amtDrCr = 0;
if( rs.next() )
{
lslotsl = rs.getString(1);
}
rs.close();
pstmt.close();
pstmt = null;
rs = null;
System.out.println("Lot sl is:"+lslotsl);
if (lslotsl == null || lslotsl.trim().length() == 0)
{
System.out.println("lslotsl is null in lot_sl itemChanged"+lslotsl);
String lsSretLotsl="";
lsSretLotsl = distCommon.getDisparams( "999999", "SRETURN_DEFAULT_LOTSL", conn );
System.out.println("lsSretLotsl ["+lsSretLotsl+"] in lot_sl ItemChanged Disparam Value");
if(lsSretLotsl == null || lsSretLotsl.trim().length()== 0)
{
valueXmlString.append("<lot_sl>").append("2S").append("</lot_sl>");
}
else
{
System.out.println("lsSretLotsl["+lsSretLotsl+"]");
valueXmlString.append("<lot_sl>").append("<![CDATA[" + lsSretLotsl + "]]>").append("</lot_sl>");
}
}
else
{
valueXmlString.append("<lot_sl>").append("<![CDATA[" + lslotsl + "]]>").append("</lot_sl>");
}*/
} }
else else
...@@ -4455,8 +4369,11 @@ public class SalesReturn extends ValidatorEJB implements SalesReturnLocal, Sales ...@@ -4455,8 +4369,11 @@ public class SalesReturn extends ValidatorEJB implements SalesReturnLocal, Sales
{ {
mstatus = genericUtility.getColumnValue( "status", dom );// dw_detedit[ii_currformno].getitemstring(1,"status") mstatus = genericUtility.getColumnValue( "status", dom );// dw_detedit[ii_currformno].getitemstring(1,"status")
System.out.println( " mstatus :1: " + mstatus ); System.out.println( " mstatus :1: " + mstatus );
lsSretLocCode = distCommon.getDisparams( "999999", "SRET_LOC_CODE", conn ); lsSretLocCode = distCommon.getDisparams( "999999", "SRET_LOC_CODE", conn );
itemCode = genericUtility.getColumnValue("item_code", dom);
lotNo = genericUtility.getColumnValue("lot_no", dom);
//lotSl = genericUtility.getColumnValue("lot_sl", dom);
siteCode = genericUtility.getColumnValue("site_code", dom1);
System.out.println( " lsSretLocCode :1: " + lsSretLocCode ); System.out.println( " lsSretLocCode :1: " + lsSretLocCode );
if( "L".equals( mstatus ) ) if( "L".equals( mstatus ) )
{ {
...@@ -4612,6 +4529,51 @@ public class SalesReturn extends ValidatorEJB implements SalesReturnLocal, Sales ...@@ -4612,6 +4529,51 @@ public class SalesReturn extends ValidatorEJB implements SalesReturnLocal, Sales
pstmt = null; pstmt = null;
valueXmlString.append("<location_descr>").append("<![CDATA[" + locDescr + "]]>").append("</location_descr>"); valueXmlString.append("<location_descr>").append("<![CDATA[" + locDescr + "]]>").append("</location_descr>");
/*Added by ABhijit Gaikwad-Status*/
/*String lslotsl="";
System.out.println("site_code is:"+siteCode);
System.out.println("lotNo is:"+lotNo);
System.out.println("loc_code is:"+lsLocCode);
System.out.println("itemCode is:"+itemCode);
sql=" stock where site_code = ? and " +
"lot_no = ? and loc_code = ? and item_code = ?";
pstmt= conn.prepareStatement( sql );//,,,
pstmt.setString( 1, siteCode);
pstmt.setString( 2, lotNo );
pstmt.setString( 3, lsLocCode);
pstmt.setString( 4, itemCode );
rs = pstmt.executeQuery();
//amtDrCr = 0;
if( rs.next() )
{
lslotsl = rs.getString(1);
}
rs.close();
pstmt.close();
pstmt = null;
rs = null;
System.out.println("Lot sl is:["+lslotsl+"] in status");
if (lslotsl == null || lslotsl.trim().length() == 0)
{
System.out.println("lslotsl is null in status itemChanged"+lslotsl);
String lsSretLotsl="";
lsSretLotsl = distCommon.getDisparams( "999999", "SRETURN_DEFAULT_LOTSL", conn );
System.out.println("lsSretLotsl ["+lsSretLotsl+"] in status ItemChanged Disparam Value");
if(lsSretLotsl == null || lsSretLotsl.trim().length()== 0)
{
valueXmlString.append("<lot_sl>").append("2S").append("</lot_sl>");
}
else
{
System.out.println("lsSretLotsl["+lsSretLotsl+"]");
valueXmlString.append("<lot_sl>").append("<![CDATA[" + lsSretLotsl + "]]>").append("</lot_sl>");
}
}
else
{
valueXmlString.append("<lot_sl>").append("<![CDATA[" + lslotsl + "]]>").append("</lot_sl>");
}*/
} }
} }
} }
...@@ -4644,6 +4606,50 @@ public class SalesReturn extends ValidatorEJB implements SalesReturnLocal, Sales ...@@ -4644,6 +4606,50 @@ public class SalesReturn extends ValidatorEJB implements SalesReturnLocal, Sales
pstmt = null; pstmt = null;
System.out.println( "locDescr :4: " + locDescr ); System.out.println( "locDescr :4: " + locDescr );
valueXmlString.append("<location_descr>").append("<![CDATA[" + locDescr + "]]>").append("</location_descr>"); valueXmlString.append("<location_descr>").append("<![CDATA[" + locDescr + "]]>").append("</location_descr>");
/*String lslotsl="";
System.out.println("site_code is:D.equals( lsSretLocCode )"+siteCode);
System.out.println("lotNo is: D.equals( lsSretLocCode )"+lotNo);
System.out.println("loc_code is: D.equals( lsSretLocCode )"+lsLocCode);
System.out.println("itemCode is:D.equals( lsSretLocCode )"+itemCode);
sql="select lot_sl from stock where site_code = ? and " +
"lot_no = ? and loc_code = ? and item_code = ?";
pstmt= conn.prepareStatement( sql );//,,,
pstmt.setString( 1, siteCode);
pstmt.setString( 2, lotNo );
pstmt.setString( 3, lsLocCode);
pstmt.setString( 4, itemCode );
rs = pstmt.executeQuery();
//amtDrCr = 0;
if( rs.next() )
{
lslotsl = rs.getString(1);
}
rs.close();
pstmt.close();
pstmt = null;
rs = null;
System.out.println("Lot sl is:"+lslotsl);
if (lslotsl == null || lslotsl.trim().length() == 0)
{
System.out.println("lslotsl is null in status itemChanged[D.equals]---"+lslotsl);
String lsSretLotsl="";
lsSretLotsl = distCommon.getDisparams( "999999", "SRETURN_DEFAULT_LOTSL", conn );
System.out.println("lsSretLotsl[D.equals]---- ["+lsSretLotsl+"] in status ItemChanged Disparam Value");
if(lsSretLotsl == null || lsSretLotsl.trim().length()== 0)
{
valueXmlString.append("<lot_sl>").append("2S").append("</lot_sl>");
}
else
{
System.out.println("lsSretLotsl["+lsSretLotsl+"]");
valueXmlString.append("<lot_sl>").append("<![CDATA[" + lsSretLotsl + "]]>").append("</lot_sl>");
}
}
else
{
valueXmlString.append("<lot_sl>").append("<![CDATA[" + lslotsl + "]]>").append("</lot_sl>");
}*/
} }
} }
} }
...@@ -4707,6 +4713,53 @@ public class SalesReturn extends ValidatorEJB implements SalesReturnLocal, Sales ...@@ -4707,6 +4713,53 @@ public class SalesReturn extends ValidatorEJB implements SalesReturnLocal, Sales
mloc = rs.getString( "mloc" ); mloc = rs.getString( "mloc" );
lsInvStat = rs.getString( "ls_inv_stat" ); lsInvStat = rs.getString( "ls_inv_stat" );
valueXmlString.append("<location_descr>").append("<![CDATA[" + mloc + "]]>").append("</location_descr>"); valueXmlString.append("<location_descr>").append("<![CDATA[" + mloc + "]]>").append("</location_descr>");
/* String lslotsl="";
System.out.println("site_code is:!S.equals( lsSretLocCode )"+siteCode);
System.out.println("lotNo is: !S.equals( lsSretLocCode "+lotNo);
System.out.println("mvarValue is: !S.equals( lsSretLocCode "+mvarValue);
System.out.println("itemCode is:!S.equals( lsSretLocCode "+itemCode);
sql="select lot_sl from stock where site_code = ? and " +
"lot_no = ? and loc_code = ? and item_code = ?";
pstmt7= conn.prepareStatement( sql );//,,,
pstmt7.setString( 1, siteCode);
pstmt7.setString( 2, lotNo );
pstmt7.setString( 3, mvarValue);
pstmt7.setString( 4, itemCode );
rs7 = pstmt7.executeQuery();
//amtDrCr = 0;
if( rs7.next() )
{
lslotsl = rs7.getString(1);
}
rs7.close();
pstmt7.close();
pstmt7 = null;
rs7 = null;
System.out.println("Lot sl is:-!S.equals( lsSretLocCode)"+lslotsl);
if (lslotsl == null || lslotsl.trim().length() == 0)
{
System.out.println("lslotsl is null in status itemChanged[!S.equals( lsSretLocCode)]---"+lslotsl);
String lsSretLotsl="";
lsSretLotsl = distCommon.getDisparams( "999999", "SRETURN_DEFAULT_LOTSL", conn );
System.out.println("lsSretLotsl[!S.equals( lsSretLocCode)]---- ["+lsSretLotsl+"] in status ItemChanged Disparam Value");
if(lsSretLotsl == null || lsSretLotsl.trim().length()== 0)
{
valueXmlString.append("<lot_sl>").append("2S").append("</lot_sl>");
}
else
{
System.out.println("lsSretLotsl["+lsSretLotsl+"]");
valueXmlString.append("<lot_sl>").append("<![CDATA[" + lsSretLotsl + "]]>").append("</lot_sl>");
}
}
else
{
valueXmlString.append("<lot_sl>").append("<![CDATA[" + lslotsl + "]]>").append("</lot_sl>");
}*/
} }
rs.close(); rs.close();
rs = null; rs = null;
...@@ -4812,7 +4865,7 @@ public class SalesReturn extends ValidatorEJB implements SalesReturnLocal, Sales ...@@ -4812,7 +4865,7 @@ public class SalesReturn extends ValidatorEJB implements SalesReturnLocal, Sales
valueXmlString.append("<rate protect =\"0\">").append("<![CDATA["+ ( sRate == null || sRate.trim().length() == 0 ? "0" : sRate ) +"]]>").append("</rate>"); valueXmlString.append("<rate protect =\"0\">").append("<![CDATA["+ ( sRate == null || sRate.trim().length() == 0 ? "0" : sRate ) +"]]>").append("</rate>");
} }
//Added by ABhijit Gaikwad //Added by ABhijit Gaikwad
if( "E".equals( mstatus ) ) /*if( "E".equals( mstatus ) )
{ {
mvarName1 = "ESTATUS_REASON"; mvarName1 = "ESTATUS_REASON";
} }
...@@ -4836,12 +4889,38 @@ public class SalesReturn extends ValidatorEJB implements SalesReturnLocal, Sales ...@@ -4836,12 +4889,38 @@ public class SalesReturn extends ValidatorEJB implements SalesReturnLocal, Sales
{ {
mvarName1 = "PSTATUS_REASON"; mvarName1 = "PSTATUS_REASON";
} }
//mvarValue = " "; //mvarValue = " ";*/
System.out.println("Status is"+ mstatus);
if(mstatus != null && mstatus.trim().length() >0)
{
mvarName1 = mstatus.trim() + "STATUS_REASON";
System.out.println("mvarName1 is"+ mvarName1);
}
if( mvarName1 != null && mvarName1.trim().length() > 0 && !"NULLFOUND".equalsIgnoreCase( mvarName1 ) ) if( mvarName1 != null && mvarName1.trim().length() > 0 && !"NULLFOUND".equalsIgnoreCase( mvarName1 ) )
{ {
mvarValue1 = distCommon.getDisparams( "999999", mvarName1, conn ); mvarValue1 = distCommon.getDisparams( "999999", mvarName1, conn );
System.out.println( "mvarValue :5: " + mvarValue1 ); System.out.println( "mvarValue Reason Code:" + mvarValue1 );
if(mvarValue1 == null || mvarValue1.equalsIgnoreCase("NULLFOUND"))
{
mvarValue1="";
}
valueXmlString.append("<reas_code>").append("<![CDATA[" + mvarValue1 + "]]>").append("</reas_code>"); valueXmlString.append("<reas_code>").append("<![CDATA[" + mvarValue1 + "]]>").append("</reas_code>");
sqlStr = " Select reason_descr mreason_descr from sreturn_reason where reason_code = ? ";
pstmt = conn.prepareStatement( sqlStr );
pstmt.setString( 1, mvarValue1 );
rs = pstmt.executeQuery();
mreasonDescr = "";
if( rs.next() )
{
mreasonDescr = rs.getString( "mreason_descr" );
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
System.out.println("Reson description is");
valueXmlString.append("<reason_descr>").append("<![CDATA["+ mreasonDescr +"]]>").append("</reason_descr>");
} }
}//end of status }//end of status
...@@ -4896,9 +4975,7 @@ public class SalesReturn extends ValidatorEJB implements SalesReturnLocal, Sales ...@@ -4896,9 +4975,7 @@ public class SalesReturn extends ValidatorEJB implements SalesReturnLocal, Sales
+" where reason_code = ? "; //:mreas_code ; +" where reason_code = ? "; //:mreas_code ;
pstmt = conn.prepareStatement( sqlStr ); pstmt = conn.prepareStatement( sqlStr );
pstmt.setString( 1, mreasCode ); pstmt.setString( 1, mreasCode );
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
mreasonDescr = ""; mreasonDescr = "";
if( rs.next() ) if( rs.next() )
...@@ -5401,10 +5478,7 @@ public class SalesReturn extends ValidatorEJB implements SalesReturnLocal, Sales ...@@ -5401,10 +5478,7 @@ public class SalesReturn extends ValidatorEJB implements SalesReturnLocal, Sales
try try
{ {
//Changes and Commented By Bhushan on 09-06-2016 :START conn = connDriver.getConnectDB("DriverITM");
//conn = connDriver.getConnectDB("DriverITM");
conn = getConnection();
//Changes and Commented By Bhushan on 09-06-2016 :END
connDriver = null; connDriver = null;
dbEjb = new ITMDBAccessEJB(); dbEjb = new ITMDBAccessEJB();
...@@ -7445,91 +7519,6 @@ public class SalesReturn extends ValidatorEJB implements SalesReturnLocal, Sales ...@@ -7445,91 +7519,6 @@ public class SalesReturn extends ValidatorEJB implements SalesReturnLocal, Sales
String lcRateStr = genericUtility.getColumnValue( "rate", dom ); String lcRateStr = genericUtility.getColumnValue( "rate", dom );
lcRate = Double.parseDouble( lcRateStr == null || lcRateStr.trim().length() == 0 ? "0" : lcRateStr.trim() ); lcRate = Double.parseDouble( lcRateStr == null || lcRateStr.trim().length() == 0 ? "0" : lcRateStr.trim() );
String llLineNoInvStr = getNumString( genericUtility.getColumnValue( "line_no__inv", dom ) ); String llLineNoInvStr = getNumString( genericUtility.getColumnValue( "line_no__inv", dom ) );
//Added by Santosh on 02/12/2016 to split quantity in multiple line as per min_rate_history[Start]
String[] col = new String[500];
int noSchemeHist = 0;
double invoiceQty = 0.0, qtyAdj = 0.0;
boolean dynamicCol = true, colMatch = false;
String schemeKey = "", varValue = "", currCol = "", docKey = "", docValue = "";
String sNoSchemeHist = distCommon.getDisparams("999999","SCHEME_HIST_NUM",conn);
System.out.println( "sNoSchemeHist :: " + sNoSchemeHist );
noSchemeHist = Integer.parseInt(sNoSchemeHist);
for (int keyCtr = 1; keyCtr <= noSchemeHist ; keyCtr++)
{
schemeKey = "SCHEME_HIST_KEY" + keyCtr ;
System.out.println(">>>>>>>>>In for loop schemeKey:"+schemeKey);
varValue = distCommon.getDisparams("999999",schemeKey,conn);
System.out.println(">>>>>>>>>In for loop afer schemeKey varValue:"+varValue);
varValue = varValue.trim();
String[] varValueArry = varValue.split(",");
for(int i=0; i<varValueArry.length; i++)
{
if("cust_code".equalsIgnoreCase(varValueArry[i].trim()))
{
docValue = genericUtility.getColumnValue(varValueArry[i].trim(),dom1).trim();
}
else if("item_code".equalsIgnoreCase(varValueArry[i].trim()))
{
docValue = genericUtility.getColumnValue(varValueArry[i].trim(),dom).trim();
}
else if("lot_no".equalsIgnoreCase(varValueArry[i].trim()))
{
docValue = genericUtility.getColumnValue(varValueArry[i].trim(),dom).trim();
}
else if("invoice_id".equalsIgnoreCase(varValueArry[i].trim()))
{
docValue = genericUtility.getColumnValue(varValueArry[i].trim(),dom).trim();
}
else
{
docValue = genericUtility.getColumnValue(varValueArry[i].trim(),dom1).trim();
}
if (docKey != "" && docKey.trim().length() > 0)
{
docKey = docKey + "," + ( docValue == null || docValue.trim().length() == 0 ? "" : docValue);
}
else
{
docKey = docValue;
}
}
}
System.out.println(">>>>>>>>after for loop docKey:"+docKey);
sql = "SELECT QUANTITY, QUANTITY_ADJ FROM MIN_RATE_HISTORY WHERE DOC_KEY = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, docKey);
rs = pstmt.executeQuery();
if(rs.next())
{
invoiceQty = rs.getDouble("QUANTITY");
qtyAdj = rs.getDouble("QUANTITY_ADJ");
}
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
if(rs != null)
{
rs.close();
rs = null;
}
if(lcQty > (invoiceQty - qtyAdj))
{
return getError((invoiceQty - qtyAdj), "VTSPLTQTY", conn);
}
//Added by Santosh on 02/12/2016 to split quantity in multiple line as per min_rate_history[End]
if (llLineNoInvStr != null && llLineNoInvStr.indexOf(".") > 0) if (llLineNoInvStr != null && llLineNoInvStr.indexOf(".") > 0)
{ {
llLineNoInvStr = llLineNoInvStr.substring(0,llLineNoInvStr.indexOf(".")); llLineNoInvStr = llLineNoInvStr.substring(0,llLineNoInvStr.indexOf("."));
...@@ -8382,8 +8371,7 @@ public class SalesReturn extends ValidatorEJB implements SalesReturnLocal, Sales ...@@ -8382,8 +8371,7 @@ public class SalesReturn extends ValidatorEJB implements SalesReturnLocal, Sales
System.out.println( "invoiceId :: " + invoiceId ); System.out.println( "invoiceId :: " + invoiceId );
if (invoiceId != null && invoiceId.trim().length() > 0 ) if (invoiceId != null && invoiceId.trim().length() > 0 )
{ {
//Commented by Santosh on 06/12/2016 [Start] return sBuff;
//return sBuff;
} }
retReplFlag = genericUtility.getColumnValue("ret_rep_flag",dom); retReplFlag = genericUtility.getColumnValue("ret_rep_flag",dom);
System.out.println( "retReplFlag :: " + retReplFlag ); System.out.println( "retReplFlag :: " + retReplFlag );
...@@ -8426,15 +8414,12 @@ public class SalesReturn extends ValidatorEJB implements SalesReturnLocal, Sales ...@@ -8426,15 +8414,12 @@ public class SalesReturn extends ValidatorEJB implements SalesReturnLocal, Sales
return sBuff; return sBuff;
} }
} }
priceList = genericUtility.getColumnValue("price_list",dom1); priceList = genericUtility.getColumnValue("price_list",dom1);
itemCode = genericUtility.getColumnValue("item_code",dom); itemCode = genericUtility.getColumnValue("item_code",dom);
lotNo = genericUtility.getColumnValue("lot_no",dom); lotNo = genericUtility.getColumnValue("lot_no",dom);
tranDate = genericUtility.getColumnValue("tran_date",dom1); tranDate = genericUtility.getColumnValue("tran_date",dom1);
//Changed and Added by Santosh on 06/12/2016 for null pointer issue [Start] qtyStdUom = Double.parseDouble(genericUtility.getColumnValue("quantity__stduom",dom));
//qtyStdUom = Double.parseDouble(genericUtility.getColumnValue("quantity__stduom",dom));
String qtyStdUomStr = genericUtility.getColumnValue("quantity__stduom",dom)== null ? "0.0" :genericUtility.getColumnValue("quantity__stduom",dom);
qtyStdUom = Double.parseDouble(qtyStdUomStr);
////Changed and Added by Santosh on 06/12/2016 for null pointer issue [End]
unitRate = genericUtility.getColumnValue("unit__rate",dom); unitRate = genericUtility.getColumnValue("unit__rate",dom);
unitStd = genericUtility.getColumnValue("unit__std",dom); unitStd = genericUtility.getColumnValue("unit__std",dom);
...@@ -8506,9 +8491,7 @@ public class SalesReturn extends ValidatorEJB implements SalesReturnLocal, Sales ...@@ -8506,9 +8491,7 @@ public class SalesReturn extends ValidatorEJB implements SalesReturnLocal, Sales
} }
else else
{ {
//Changed by Santosh on 07/12/2016 to trim docKey = docValue;
//docKey = docValue;
docKey = docValue.trim();
} }
} }
System.out.println(">>>>>>>>>>final docKey:"+docKey); System.out.println(">>>>>>>>>>final docKey:"+docKey);
...@@ -9265,32 +9248,6 @@ public class SalesReturn extends ValidatorEJB implements SalesReturnLocal, Sales ...@@ -9265,32 +9248,6 @@ public class SalesReturn extends ValidatorEJB implements SalesReturnLocal, Sales
return updateStatus; return updateStatus;
} }
//Added by Santosh on 06/12/2016 to format error string [Start]
private String getError(double validQty, String Code, Connection conn) throws ITMException, Exception
{
String mainStr ="";
try
{
String errString = "";
errString = new ITMDBAccessEJB().getErrorString("",Code,"","",conn);
String begPart = errString.substring(0,errString.indexOf("</description>"));
String endDesc = errString.substring(errString.indexOf("</description>"),errString.length());
mainStr = begPart + " ["+validQty+"]. " + endDesc;
System.out.println("mainStr:::::::::::::::::: "+mainStr);
begPart = null;
}
catch(Exception e)
{
e.printStackTrace();
throw new ITMException(e);
}
return mainStr;
}
//Added by Santosh on 06/12/2016 to format error string [End]
}// END OF MAIN CLASS }// END OF MAIN CLASS
\ No newline at end of file
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