Commit c9f5e143 authored by kmandhre's avatar kmandhre

issue tracker point 193- consider customer code in validation with station code to n from


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@93126 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 61a6d691
......@@ -133,7 +133,7 @@ public class DistributionRoute extends ValidatorEJB implements DistributionRoute
else if(childNodeName.equalsIgnoreCase("cust_code"))
{
custCode = checkNull(genericUtility.getColumnValue("cust_code", dom));
if(custCode != null && custCode.trim().length() > 0)
{
sql = "Select Count(*) from customer where cust_code = ?";
......@@ -199,7 +199,7 @@ public class DistributionRoute extends ValidatorEJB implements DistributionRoute
errFields.add(childNodeName.toLowerCase());
}
}
/*else if(currCode != null && currCode.trim().length() > 0)
/*else if(currCode != null && currCode.trim().length() > 0)
{
sql = "select count(*) from distroute where frt_amt = ?";
pstmt = conn.prepareStatement(sql);
......@@ -220,10 +220,15 @@ public class DistributionRoute extends ValidatorEJB implements DistributionRoute
pstmt.close();
pstmt = null;
}*/
else if(childNodeName.equalsIgnoreCase("stan_code__fr"))
{
StanCodeFrom = checkNull(genericUtility.getColumnValue("stan_code__fr", dom));
custCode = genericUtility.getColumnValue("cust_code", dom);
if(custCode == null)
{
custCode = " ";
}
if(StanCodeFrom != null && StanCodeFrom.trim().length() > 0)
{
......@@ -250,6 +255,11 @@ public class DistributionRoute extends ValidatorEJB implements DistributionRoute
else if(childNodeName.equalsIgnoreCase("stan_code__to"))
{
StanCodeTo = checkNull(genericUtility.getColumnValue("stan_code__to", dom));
custCode = genericUtility.getColumnValue("cust_code", dom);
/*if(custCode == null)
{
custCode = " ";
}*/
if(StanCodeTo != null && StanCodeTo.trim().length() > 0)
{
......@@ -271,33 +281,61 @@ public class DistributionRoute extends ValidatorEJB implements DistributionRoute
rs = null;
pstmt.close();
pstmt = null;
if(editFlag != null && editFlag.trim().equalsIgnoreCase("A"))
{
sql = "select count(*) from distroute where stan_code__fr = ? and stan_code__to = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,StanCodeFrom);
pstmt.setString(2,StanCodeTo);
rs = pstmt.executeQuery();
if(rs.next())
if(custCode != null && custCode.trim().length() > 0)
{
count = rs.getInt(1);
sql = "select count(*) from distroute where stan_code__fr = ? and stan_code__to = ? and cust_code = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,StanCodeFrom);
pstmt.setString(2,StanCodeTo);
pstmt.setString(3,custCode); //added by kunal on 22/05/13
rs = pstmt.executeQuery();
if(rs.next())
{
count = rs.getInt(1);
}
if(count > 0)
{
errCode = "VTSTANDB";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
}
if(count > 0)
else
{
errCode = "VTSTANDB";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
sql = "select count(*) from distroute where stan_code__fr = ? and stan_code__to = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,StanCodeFrom);
pstmt.setString(2,StanCodeTo);
rs = pstmt.executeQuery();
if(rs.next())
{
count = rs.getInt(1);
}
if(count > 0)
{
errCode = "VTSTANDB";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
}
}
}
}
break;
case 2 :
......@@ -317,11 +355,11 @@ public class DistributionRoute extends ValidatorEJB implements DistributionRoute
//errCode = "VMSTANCOD ";
//errList.add(errCode);
//errFields.add(childNodeName.toLowerCase());
/* //Changed by Sankara on 01/10/12 statin code from allowed blank [start]
/* //Changed by Sankara on 01/10/12 statin code from allowed blank [start]
errCode = "STNCDFRBK ";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase()); */
//Changed by Sankara on 01/10/12 statin code from allowed blank [end]
//Changed by Sankara on 01/10/12 statin code from allowed blank [end]
}
else if(StanCodeFrom != null && StanCodeFrom.trim().length() > 0)
{
......@@ -354,7 +392,7 @@ public class DistributionRoute extends ValidatorEJB implements DistributionRoute
//errList.add(errCode);
//errFields.add(childNodeName.toLowerCase());
//Changed by Sankara on 01/10/12 station code to allowed blank [start]
/* errCode = "STNCODTOBK ";
/* errCode = "STNCODTOBK ";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase()); */
//Changed by Sankara on 01/10/12 station code to allowed blank [end]
......@@ -424,7 +462,7 @@ public class DistributionRoute extends ValidatorEJB implements DistributionRoute
errFields.add(childNodeName.toLowerCase());
}
}
else if(childNodeName.equalsIgnoreCase("curr_code"))
else if(childNodeName.equalsIgnoreCase("curr_code"))
{
currCode = checkNull(genericUtility.getColumnValue("curr_code", dom));
if(currCode == null || currCode.trim().length() == 0)
......@@ -455,9 +493,9 @@ public class DistributionRoute extends ValidatorEJB implements DistributionRoute
pstmt = null;
}
}
else if(childNodeName.equalsIgnoreCase("min_weight"))
{
else if(childNodeName.equalsIgnoreCase("min_weight"))
{
minWeight = checkNull(genericUtility.getColumnValue("min_weight", dom));
if(minWeight == null || minWeight.trim().length() == 0)
{
......@@ -522,7 +560,7 @@ public class DistributionRoute extends ValidatorEJB implements DistributionRoute
}
//Changed by sumit on 21/01/13 adding validation to prevent not less than min case end
}
//Changed by sumit on 02/01/13 adding validation for max case and min case end.
/*else if(childNodeName.equalsIgnoreCase("state_code__fr"))
{
......@@ -587,7 +625,7 @@ public class DistributionRoute extends ValidatorEJB implements DistributionRoute
pstmt = null;
}
}*/
/*
/*
sql = "Select count(*) from station where stan_code = ? and state_code = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,StanCodeTo);
......@@ -607,7 +645,7 @@ public class DistributionRoute extends ValidatorEJB implements DistributionRoute
rs = null;
pstmt.close();
pstmt = null;
sql = "Select count(*) from station where stan_code = ? and state_code = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,StanCodeFrom);
......@@ -627,8 +665,8 @@ public class DistributionRoute extends ValidatorEJB implements DistributionRoute
rs = null;
pstmt.close();
pstmt = null;
*/
else if(childNodeName.equalsIgnoreCase("pin__fr"))
*/
else if(childNodeName.equalsIgnoreCase("pin__fr"))
{
pinCodeFrom = checkNull(genericUtility.getColumnValue("pin__fr", dom));
if(pinCodeFrom == null || pinCodeFrom.trim().length() == 0)
......@@ -675,7 +713,7 @@ public class DistributionRoute extends ValidatorEJB implements DistributionRoute
pstmt = null;
}
}
else
{
stateCodeFrom = checkNull(genericUtility.getColumnValue("state_code__fr", dom));
......@@ -684,7 +722,7 @@ public class DistributionRoute extends ValidatorEJB implements DistributionRoute
StanCodeTo = checkNull(genericUtility.getColumnValue("stan_code__to", dom));
pinCodeTo = checkNull(genericUtility.getColumnValue("pin__to", dom));
pinCodeFrom = checkNull(genericUtility.getColumnValue("pin__fr", dom));
if(StanCodeFrom.trim().length() == 0 && stateCodeFrom.trim().length() == 0 && pinCodeFrom.trim().length() == 0)
{
fromBlank = true;
......@@ -883,7 +921,7 @@ public class DistributionRoute extends ValidatorEJB implements DistributionRoute
rs = null;
pstmt.close();
pstmt = null;
// valueXmlString.append("<stationa_descr>").append("<![CDATA[" + descr +"]]>").append("</stationa_descr>");
// 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"))
......@@ -961,7 +999,7 @@ public class DistributionRoute extends ValidatorEJB implements DistributionRoute
distRoute = checkNull(genericUtility.getColumnValue("dist_route", dom1));
System.out.println("693 distRoute = "+distRoute);
valueXmlString.append("<dist_route protect = \"1\">").append("<![CDATA[" + distRoute +"]]>").append("</dist_route>");
stateCodeFr = checkNull(genericUtility.getColumnValue("state_code__fr", dom));
stanCodeFr = checkNull(genericUtility.getColumnValue("stan_code__fr", dom));
stateCodeTo = checkNull(genericUtility.getColumnValue("state_code__to", dom));
......@@ -1041,7 +1079,7 @@ public class DistributionRoute extends ValidatorEJB implements DistributionRoute
valueXmlString.append("<state_code__fr>").append("<![CDATA[" + stateCodeFr +"]]>").append("</state_code__fr>");
valueXmlString.append("<descr>").append("<![CDATA[" + stateDescr +"]]>").append("</descr>");
valueXmlString.append("<stationa_descr>").append("<![CDATA[" + descr +"]]>").append("</stationa_descr>");
if(stateCodeFr.trim().length() == 0)
{
valueXmlString.append("<state_code__fr>").append("<![CDATA[ ]]>").append("</state_code__fr>");
......@@ -1050,7 +1088,7 @@ public class DistributionRoute extends ValidatorEJB implements DistributionRoute
{
valueXmlString.append("<stan_code__fr>").append("<![CDATA[ ]]>").append("</stan_code__fr>");
}
}
else if(currentColumn.trim().equalsIgnoreCase("stan_code__to"))
{
......@@ -1092,7 +1130,7 @@ public class DistributionRoute extends ValidatorEJB implements DistributionRoute
valueXmlString.append("<state_code__to>").append("<![CDATA[" + stateCodeTo +"]]>").append("</state_code__to>");
valueXmlString.append("<station_descr_1>").append("<![CDATA[" + descr +"]]>").append("</station_descr_1>");
valueXmlString.append("<descr_1>").append("<![CDATA[" + stateDescr +"]]>").append("</descr_1>");
if(stanCodeTo.trim().length() == 0)
{
valueXmlString.append("<stan_code__to>").append("<![CDATA[ ]]>").append("</stan_code__to>");
......@@ -1188,7 +1226,7 @@ public class DistributionRoute extends ValidatorEJB implements DistributionRoute
valueXmlString.append("<state_code__fr>").append("<![CDATA[ ]]>").append("</state_code__fr>");
}
}
valueXmlString.append("</Detail2>");
break;
}
......
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