Commit e4102c3a authored by skale's avatar skale

Added some validations.


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@91250 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 77fc2284
...@@ -85,6 +85,7 @@ public class ChargeBackLoc extends ValidatorEJB implements ChargeBackLocLocal, C ...@@ -85,6 +85,7 @@ public class ChargeBackLoc extends ValidatorEJB implements ChargeBackLocLocal, C
String saleRetQty = ""; String saleRetQty = "";
String unconfQty = ""; String unconfQty = "";
String confQty = ""; String confQty = "";
String tranDate = "";
int cnt = 0; int cnt = 0;
int ctr = 0; int ctr = 0;
int currentFormNo = 0; int currentFormNo = 0;
...@@ -93,9 +94,13 @@ public class ChargeBackLoc extends ValidatorEJB implements ChargeBackLocLocal, C ...@@ -93,9 +94,13 @@ public class ChargeBackLoc extends ValidatorEJB implements ChargeBackLocLocal, C
PreparedStatement pStmt=null; PreparedStatement pStmt=null;
ResultSet rs = null; ResultSet rs = null;
String sql = null; String sql = null;
String statSal = "";
ConnDriver connDriver = new ConnDriver(); ConnDriver connDriver = new ConnDriver();
String lineNoDet = null; String lineNoDet = null;
String updateFlag = null; String updateFlag = null;
String siteCode = "";
String prdCode = "";
java.sql.Timestamp tranDateTs = null;
try try
{ {
System.out.println( "wfValData called" ); System.out.println( "wfValData called" );
...@@ -151,6 +156,73 @@ public class ChargeBackLoc extends ValidatorEJB implements ChargeBackLocLocal, C ...@@ -151,6 +156,73 @@ public class ChargeBackLoc extends ValidatorEJB implements ChargeBackLocLocal, C
pStmt = null; pStmt = null;
} }
} }
if ( childNodeName.equalsIgnoreCase( "tran_date" ) )
{
tranDate = genericUtility.getColumnValue( "tran_date", dom, "1" );
tranDateTs = Timestamp.valueOf(genericUtility.getValidDateString(tranDate, genericUtility.getApplDateFormat(), genericUtility.getDBDateFormat()) + " 00:00:00.0");
sql = "Select code from period where ? between fr_date and to_date ";
pStmt = conn.prepareStatement(sql);
pStmt.setTimestamp(1,tranDateTs);
rs = pStmt.executeQuery();
if( rs.next() )
{
prdCode = rs.getString( 1 );
}
rs.close();
rs = null;
pStmt.close();
pStmt = null;
if( prdCode != null && prdCode.trim().length() > 0 )
{
sql = "Select count(1) from period_stat where prd_code = ? "
+" AND site_code = ? ";
pStmt = conn.prepareStatement(sql);
pStmt.setString(1,prdCode.trim());
pStmt.setString(2,loginSite.trim());
rs = pStmt.executeQuery();
if( rs.next() )
{
cnt = rs.getInt( 1 );
}
rs.close();
rs = null;
pStmt.close();
pStmt = null;
if( cnt > 0 )
{
sql = "Select stat_sal from period_stat where prd_code = ? and site_code = ? ";
pStmt = conn.prepareStatement(sql);
pStmt.setString(1,prdCode.trim());
pStmt.setString(2,loginSite.trim());
rs = pStmt.executeQuery();
if( rs.next() )
{
statSal = rs.getString( 1 );
}
rs.close();
rs = null;
pStmt.close();
pStmt = null;
if( statSal != null && statSal.trim().equalsIgnoreCase("N") )
{
errString =itmDBAccessEJB.getErrorString("","VMSTATSNVL",userId);
break ;
}
}
else
{
errString =itmDBAccessEJB.getErrorString("","VMSTATSND",userId);
break ;
}
}
else
{
errString =itmDBAccessEJB.getErrorString("","VMPRDNTDF",userId);
break ;
}
}
if ( childNodeName.equalsIgnoreCase( "tran_type" ) ) if ( childNodeName.equalsIgnoreCase( "tran_type" ) )
{ {
if ( childNode.getFirstChild() == null ) if ( childNode.getFirstChild() == null )
...@@ -176,6 +248,13 @@ public class ChargeBackLoc extends ValidatorEJB implements ChargeBackLocLocal, C ...@@ -176,6 +248,13 @@ public class ChargeBackLoc extends ValidatorEJB implements ChargeBackLocLocal, C
} }
} }
if ( childNodeName.equalsIgnoreCase( "cust_code__credit" ) ) if ( childNodeName.equalsIgnoreCase( "cust_code__credit" ) )
{
if ( childNode.getFirstChild() == null )
{
errString =itmDBAccessEJB.getErrorString("cust_code__credit","VMCUSTNUL",userId);
break ;
}
else
{ {
custCode = genericUtility.getColumnValue( "cust_code__credit", dom, "1" ); custCode = genericUtility.getColumnValue( "cust_code__credit", dom, "1" );
if( custCode != null && custCode.trim().length() > 0 ) if( custCode != null && custCode.trim().length() > 0 )
...@@ -201,6 +280,73 @@ public class ChargeBackLoc extends ValidatorEJB implements ChargeBackLocLocal, C ...@@ -201,6 +280,73 @@ public class ChargeBackLoc extends ValidatorEJB implements ChargeBackLocLocal, C
} }
} }
} }
if ( childNodeName.equalsIgnoreCase( "site_code" ) )
{
if ( childNode.getFirstChild() == null )
{
errString =itmDBAccessEJB.getErrorString("site_code","VMSITENUL",userId);
break ;
}
else
{
siteCode = genericUtility.getColumnValue( "site_code", dom, "1" );
if( siteCode != null && siteCode.trim().length() > 0 )
{
sql = " SELECT COUNT(1) FROM site WHERE site_code = ? ";
pStmt = conn.prepareStatement( sql );
pStmt.setString(1,siteCode.trim());
rs = pStmt.executeQuery();
if( rs.next() )
{
cnt = rs.getInt( 1 );
}
if( cnt == 0 )
{
errCode = "VMINVSITE";
errString = getErrorString( "site_code", errCode, userId );
break ;
}
rs.close();
rs = null;
pStmt.close();
pStmt = null;
}
}
}
if ( childNodeName.equalsIgnoreCase( "site_code__cr" ) )
{
if ( childNode.getFirstChild() == null )
{
errString =itmDBAccessEJB.getErrorString("site_code__cr","VMSITENUL",userId);
break ;
}
else
{
siteCode = genericUtility.getColumnValue( "site_code__cr", dom, "1" );
if( siteCode != null && siteCode.trim().length() > 0 )
{
sql = " SELECT COUNT(1) FROM site WHERE site_code = ? ";
pStmt = conn.prepareStatement( sql );
pStmt.setString(1,siteCode.trim());
rs = pStmt.executeQuery();
if( rs.next() )
{
cnt = rs.getInt( 1 );
}
if( cnt == 0 )
{
errCode = "VMINVSITE";
errString = getErrorString( "site_code__cr", errCode, userId );
break ;
}
rs.close();
rs = null;
pStmt.close();
pStmt = null;
}
}
}
}
//END OF CASE1 //END OF CASE1
break; break;
case 2 : case 2 :
...@@ -770,6 +916,60 @@ public class ChargeBackLoc extends ValidatorEJB implements ChargeBackLocLocal, C ...@@ -770,6 +916,60 @@ public class ChargeBackLoc extends ValidatorEJB implements ChargeBackLocLocal, C
valueXmlString.append("<cust_code__end protect=\"1\" >").append("").append("</cust_code__end>"); valueXmlString.append("<cust_code__end protect=\"1\" >").append("").append("</cust_code__end>");
} */ } */
} }
if (currentColumn.trim().equals( "site_code" ))
{
siteCode = genericUtility.getColumnValue( "site_code", dom );
System.out.println("site_code is==>"+siteCode);
/* siteCode = genericUtility.getColumnValue( "site_code", dom, "1" );
System.out.println("site_code is==>"+siteCode);
siteCode = childNode.getFirstChild().getNodeValue().trim();
System.out.println("site_code is==>"+siteCode); */
if( siteCode != null && siteCode.trim().length() > 0 )
{
sql = "select descr from site where site_code = ? ";
pStmt = conn.prepareStatement( sql );
pStmt.setString(1,siteCode.trim());
rs = pStmt.executeQuery();
if( rs.next() )
{
siteDescr = rs.getString( "descr" );
}
rs.close();
rs = null;
pStmt.close();
pStmt = null;
}
valueXmlString.append("<site_bill_descr>").append("<![CDATA[" + ( siteDescr )+ "]]>").append("</site_bill_descr>");
valueXmlString.append("<site_code__cr>").append("<![CDATA[" + ( siteCode )+ "]]>").append("</site_code__cr>");
valueXmlString.append("<site_cr_descr>").append("<![CDATA[" + ( siteDescr )+ "]]>").append("</site_cr_descr>");
}
if (currentColumn.trim().equals( "site_code__cr" ))
{
siteCode = genericUtility.getColumnValue( "site_code__cr", dom );
System.out.println("site_code__cr is==>"+siteCode);
/* siteCode = genericUtility.getColumnValue( "site_code__cr", dom, "1" );
System.out.println("site_code__cr is==>"+siteCode);
siteCode = childNode.getFirstChild().getNodeValue().trim();
System.out.println("site_code__cr is==>"+siteCode); */
if( siteCode != null && siteCode.trim().length() > 0 )
{
sql = "select descr from site where site_code = ? ";
pStmt = conn.prepareStatement( sql );
pStmt.setString(1,siteCode.trim());
rs = pStmt.executeQuery();
if( rs.next() )
{
siteDescr = rs.getString( "descr" );
}
rs.close();
rs = null;
pStmt.close();
pStmt = null;
}
valueXmlString.append("<site_cr_descr>").append("<![CDATA[" + ( siteDescr )+ "]]>").append("</site_cr_descr>");
}
if (currentColumn.trim().equals( "cust_code__credit" )) if (currentColumn.trim().equals( "cust_code__credit" ))
{ {
custCode = genericUtility.getColumnValue( "cust_code__credit", dom ); custCode = genericUtility.getColumnValue( "cust_code__credit", dom );
......
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