Commit f2356253 authored by kmandhre's avatar kmandhre

Done By Kunal Mandhre change in itemchange of station code to and station code from


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@91723 ce508802-f39f-4f6c-b175-0d175dae99d5
parent f1c7cf59
...@@ -390,8 +390,8 @@ public class DistributionRoute extends ValidatorEJB implements DistributionRoute ...@@ -390,8 +390,8 @@ public class DistributionRoute extends ValidatorEJB implements DistributionRoute
else if(childNodeName.equalsIgnoreCase("state_code__to")) else if(childNodeName.equalsIgnoreCase("state_code__to"))
{ {
stateCodeTo = checkNull(genericUtility.getColumnValue("state_code__to", dom)); stateCodeTo = checkNull(genericUtility.getColumnValue("state_code__to", dom));
if(stateCodeTo != null || stateCodeTo.trim().length() > 0) StanCodeTo = checkNull(genericUtility.getColumnValue("stan_code__to", dom));
{
sql = "Select count(*) from state where state_code = ?"; sql = "Select count(*) from state where state_code = ?";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1,stateCodeTo); pstmt.setString(1,stateCodeTo);
...@@ -410,14 +410,36 @@ public class DistributionRoute extends ValidatorEJB implements DistributionRoute ...@@ -410,14 +410,36 @@ public class DistributionRoute extends ValidatorEJB implements DistributionRoute
rs = null; rs = null;
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
sql = "Select count(*) from station where stan_code = ? and state_code = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,StanCodeTo);
pstmt.setString(2,stateCodeTo);
rs = pstmt.executeQuery();
if(rs.next())
{
count = rs.getInt(1);
} }
if(count == 0)
{
errCode = "VTSTATETO";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
} }
else if(childNodeName.equalsIgnoreCase("state_code__fr")) else if(childNodeName.equalsIgnoreCase("state_code__fr"))
{ {
stateCodeFrom = checkNull(genericUtility.getColumnValue("state_code__fr", dom)); stateCodeFrom = checkNull(genericUtility.getColumnValue("state_code__fr", dom));
if(stateCodeFrom != null || stateCodeFrom.trim().length() > 0) StanCodeFrom = checkNull(genericUtility.getColumnValue("stan_code__fr", dom));
{
sql = "Select count(*) from state where state_code = ?"; sql = "Select count(*) from state where state_code = ?";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1,stateCodeTo); pstmt.setString(1,stateCodeTo);
...@@ -436,9 +458,28 @@ public class DistributionRoute extends ValidatorEJB implements DistributionRoute ...@@ -436,9 +458,28 @@ public class DistributionRoute extends ValidatorEJB implements DistributionRoute
rs = null; rs = null;
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
}
sql = "Select count(*) from station where stan_code = ? and state_code = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,StanCodeFrom);
pstmt.setString(2,stateCodeFrom);
rs = pstmt.executeQuery();
if(rs.next())
{
count = rs.getInt(1);
} }
if(count == 0)
{
errCode = "VTSTATEFR";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
}
} }
break; break;
} }
...@@ -537,7 +578,7 @@ public class DistributionRoute extends ValidatorEJB implements DistributionRoute ...@@ -537,7 +578,7 @@ public class DistributionRoute extends ValidatorEJB implements DistributionRoute
} }
catch(Exception e) catch(Exception e)
{ {
System.out.println("Exception : [DistributionRouteIC][itemChanged( String, String )] :==>\n" + e.getMessage()); System.out.println("Exception : [DistributionRoute][itemChanged( String, String )] :==>\n" + e.getMessage());
} }
return valueXmlString; return valueXmlString;
} }
...@@ -553,6 +594,7 @@ public class DistributionRoute extends ValidatorEJB implements DistributionRoute ...@@ -553,6 +594,7 @@ public class DistributionRoute extends ValidatorEJB implements DistributionRoute
String descr = ""; String descr = "";
String distRoute = ""; String distRoute = "";
String tranCode = ""; String tranCode = "";
String stateDescr = "";
String childNodeName = null; String childNodeName = null;
String sql = ""; String sql = "";
StringBuffer valueXmlString = new StringBuffer(); StringBuffer valueXmlString = new StringBuffer();
...@@ -694,18 +736,38 @@ public class DistributionRoute extends ValidatorEJB implements DistributionRoute ...@@ -694,18 +736,38 @@ public class DistributionRoute extends ValidatorEJB implements DistributionRoute
else if(currentColumn.trim().equalsIgnoreCase("stan_code__fr")) else if(currentColumn.trim().equalsIgnoreCase("stan_code__fr"))
{ {
stanCodeFr = checkNull(genericUtility.getColumnValue("stan_code__fr", dom)); stanCodeFr = checkNull(genericUtility.getColumnValue("stan_code__fr", dom));
sql = "Select descr from station where stan_code = ?"; if(stanCodeFr != null && stanCodeFr.trim().length() > 0)
{
sql = "Select descr,state_code from station where stan_code = ?";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1,stanCodeFr); pstmt.setString(1,stanCodeFr);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
if(rs.next()) if(rs.next())
{ {
descr = rs.getString(1); descr = checkNull(rs.getString("descr"));
stateCodeFr = checkNull(rs.getString("state_code"));
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
if(stateCodeFr != null && stateCodeFr.trim().length() > 0)
{
sql = "select descr from state where state_code = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,stateCodeFr);
rs = pstmt.executeQuery();
if(rs.next())
{
stateDescr = rs.getString(1);
} }
rs.close(); rs.close();
rs = null; rs = null;
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
}
}
valueXmlString.append("<descr_1>").append("<![CDATA[" + stateDescr +"]]>").append("</descr_1>");
valueXmlString.append("<stationa_descr>").append("<![CDATA[" + descr +"]]>").append("</stationa_descr>"); valueXmlString.append("<stationa_descr>").append("<![CDATA[" + descr +"]]>").append("</stationa_descr>");
} }
else if(currentColumn.trim().equalsIgnoreCase("stan_code__to")) else if(currentColumn.trim().equalsIgnoreCase("stan_code__to"))
...@@ -713,24 +775,37 @@ public class DistributionRoute extends ValidatorEJB implements DistributionRoute ...@@ -713,24 +775,37 @@ public class DistributionRoute extends ValidatorEJB implements DistributionRoute
stanCodeTo = checkNull(genericUtility.getColumnValue("stan_code__to", dom)); stanCodeTo = checkNull(genericUtility.getColumnValue("stan_code__to", dom));
if(stanCodeTo != null && stanCodeTo.trim().length() > 0) if(stanCodeTo != null && stanCodeTo.trim().length() > 0)
{ {
valueXmlString.append("<state_code__to>").append("<![CDATA[ ]]>").append("</state_code__to>"); sql = "Select descr,state_code from station where stan_code = ?";
valueXmlString.append("<descr>").append("<![CDATA[]]>").append("</descr>");
valueXmlString.append("<state_code__fr>").append("<![CDATA[ ]]>").append("</state_code__fr>");
valueXmlString.append("<descr_1>").append("<![CDATA[]]>").append("</descr_1>");
sql = "Select descr from station where stan_code = ?";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1,stanCodeTo); pstmt.setString(1,stanCodeTo);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
if(rs.next()) if(rs.next())
{ {
descr = rs.getString(1); descr = checkNull(rs.getString("descr"));
stateCodeTo = checkNull(rs.getString("state_code"));
} }
rs.close(); rs.close();
rs = null; rs = null;
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
if(stateCodeFr != null && stateCodeFr.trim().length() > 0)
{
sql = "select descr from state where state_code = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,stateCodeTo);
rs = pstmt.executeQuery();
if(rs.next())
{
stateDescr = rs.getString(1);
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
}
} }
valueXmlString.append("<station_descr_1>").append("<![CDATA[" + descr +"]]>").append("</station_descr_1>"); valueXmlString.append("<station_descr_1>").append("<![CDATA[" + descr +"]]>").append("</station_descr_1>");
valueXmlString.append("<descr>").append("<![CDATA[" + stateDescr +"]]>").append("</descr>");
} }
else if(currentColumn.trim().equalsIgnoreCase("tran_code")) else if(currentColumn.trim().equalsIgnoreCase("tran_code"))
{ {
...@@ -774,10 +849,6 @@ public class DistributionRoute extends ValidatorEJB implements DistributionRoute ...@@ -774,10 +849,6 @@ public class DistributionRoute extends ValidatorEJB implements DistributionRoute
if(stateCodeTo != null && stateCodeTo.trim().length() > 0) if(stateCodeTo != null && stateCodeTo.trim().length() > 0)
{ {
valueXmlString.append("<stan_code__to>").append("<![CDATA[ ]]>").append("</stan_code__to>");
valueXmlString.append("<station_descr_1>").append("<![CDATA[]]>").append("</station_descr_1>");
valueXmlString.append("<stan_code__fr>").append("<![CDATA[ ]]>").append("</stan_code__fr>");
valueXmlString.append("<stationa_descr>").append("<![CDATA[]]>").append("</stationa_descr>");
sql = "select descr from state where state_code = ?"; sql = "select descr from state where state_code = ?";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1,stateCodeTo); pstmt.setString(1,stateCodeTo);
......
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