Commit b6137f11 authored by kmandhre's avatar kmandhre

add validation for period code


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@94254 ce508802-f39f-4f6c-b175-0d175dae99d5
parent cb1fc8b8
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -17,6 +17,7 @@ import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.GregorianCalendar;
import java.util.StringTokenizer;
import java.sql.Timestamp;
import org.w3c.dom.Document;
......@@ -85,12 +86,14 @@ public class PhyItemVerifyIC extends ValidatorEJB implements PhyItemVerifyICLoca
String invStat = "",isEmpty;
double quantityInput=0;
String phyHanBasis="",unit="",toUnit="",mrfPartNo="";
String prdCode = "" ;
String sqlForCase="";
PreparedStatement pstmt1= null;
ResultSet rs2 = null;
double shipperSize = 0, volumn = 0, convFact = 1, meffQty = 0;
DistCommon discommon = new DistCommon();
Timestamp date1 = null;
java.util.Date tranDate = null;
String remarks="";
String reverify="";
ArrayList errList = new ArrayList();
......@@ -102,7 +105,7 @@ public class PhyItemVerifyIC extends ValidatorEJB implements PhyItemVerifyICLoca
{
conn = connDriver.getConnectDB("DriverITM");
connDriver = null;
SimpleDateFormat sdf = new SimpleDateFormat(genericUtility.getApplDateFormat());
userId = getValueFromXTRA_PARAMS(xtraParams,"loginCode");
if(objContext != null && objContext.trim().length()>0)
{
......@@ -111,6 +114,121 @@ public class PhyItemVerifyIC extends ValidatorEJB implements PhyItemVerifyICLoca
switch(currentFormNo)
{
case 1 :
{
parentNodeList = dom.getElementsByTagName("Detail1");
parentNode = parentNodeList.item(0);
childNodeList = parentNode.getChildNodes();
childNodeListLength = childNodeList.getLength();
for(ctr = 0; ctr < childNodeListLength; ctr++)
{
childNode = childNodeList.item(ctr);
childNodeName = childNode.getNodeName();
if ( childNode != null && childNode.getFirstChild() != null )
{
columnValue = childNode.getFirstChild().getNodeValue();
}
System.out.println(" columnName [" + childNodeName + "] columnValue [" + columnValue + "]");
if( childNodeName.equalsIgnoreCase( "site_code" ))
{
if(childNode.getFirstChild() == null)
{
errList.add( "NULLSITECO" );
errFields.add( childNodeName.toLowerCase() );
}
else
{
sql = "SELECT COUNT(*) AS COUNT FROM SITE WHERE SITE_CODE = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,getColumnValue("site_code",dom));
rs = pstmt.executeQuery();
if( rs.next() )
{
count = rs.getInt("COUNT");
}
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
if(rs != null)
{
rs.close();
rs = null;
}
if( count == 0 )
{
errList.add( "INVSITECOD" );
errFields.add( childNodeName.toLowerCase() );
}
else //added by kunal on 14-feb-14
{
siteCode = genericUtility.getColumnValue("site_code", dom);
System.out.println("364 site code ="+siteCode);
if (genericUtility.getColumnValue("tran_date", dom) != null)
{
tranDate = sdf.parse(genericUtility.getColumnValue("tran_date", dom));
sql = "select code from period where ? between fr_date and to_date";
pstmt = conn.prepareStatement(sql);
pstmt.setDate(1, new java.sql.Date(tranDate.getTime()));
rs = pstmt.executeQuery();
if (rs.next())
{
prdCode = rs.getString(1);
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
sql = "select count(*) from period_stat where site_code = ? and prd_code = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, siteCode);
pstmt.setString(2, prdCode);
rs = pstmt.executeQuery();
if (rs.next())
{
count = rs.getInt(1);
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
if (count == 0)
{
errList.add( "VTSITEPD" );
errFields.add( childNodeName.toLowerCase() );
}
// nvo_functions_adv.nf_check_period('SAL',mdate1,msite_code)
errCode = nfCheckPeriod("IC", tranDate, siteCode);
System.out.println("425 Error Code = " + errCode);
if (errCode != null && errCode.trim().length() > 0)
{
errList.add( errCode );
errFields.add( childNodeName.toLowerCase() );
}
}
}
}
}//END SITE CODE
else if( childNodeName.equalsIgnoreCase( "tran_date" ))
{
if(childNode.getFirstChild() == null)
{
errList.add( "NULLTRANDT" );
errFields.add( childNodeName.toLowerCase() );
}
}
}
}
break;
case 2:
{
parentNodeList = dom.getElementsByTagName("Detail2");
......
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