Commit 46bbe806 authored by kmandhre's avatar kmandhre

add validation for period code


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@94256 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 3ff5416b
...@@ -92,7 +92,8 @@ public class MPhyItemScanIC extends ValidatorEJB implements MPhyItemScanICLocal, ...@@ -92,7 +92,8 @@ public class MPhyItemScanIC extends ValidatorEJB implements MPhyItemScanICLocal,
// added by cpatil start 06-sept-12 // added by cpatil start 06-sept-12
double quantityInput=0; double quantityInput=0;
String phyHanBasis="",unit="",toUnit="",mrfPartNo=""; String phyHanBasis="",unit="",toUnit="",mrfPartNo="";
String sqlForCase=""; String sqlForCase="",prdCode = "" , errCode = "";
java.util.Date tranDate = null;
PreparedStatement pstmt1= null; PreparedStatement pstmt1= null;
ResultSet rs2 = null; ResultSet rs2 = null;
double shipperSize = 0, volumn = 0, convFact = 1, meffQty = 0; double shipperSize = 0, volumn = 0, convFact = 1, meffQty = 0;
...@@ -111,7 +112,7 @@ public class MPhyItemScanIC extends ValidatorEJB implements MPhyItemScanICLocal, ...@@ -111,7 +112,7 @@ public class MPhyItemScanIC extends ValidatorEJB implements MPhyItemScanICLocal,
{ {
conn = connDriver.getConnectDB("DriverITM"); conn = connDriver.getConnectDB("DriverITM");
connDriver = null; connDriver = null;
SimpleDateFormat sdf1 = new SimpleDateFormat(genericUtility.getApplDateFormat());
userId = getValueFromXTRA_PARAMS(xtraParams,"loginCode"); userId = getValueFromXTRA_PARAMS(xtraParams,"loginCode");
if(objContext != null && objContext.trim().length()>0) if(objContext != null && objContext.trim().length()>0)
{ {
...@@ -234,11 +235,6 @@ public class MPhyItemScanIC extends ValidatorEJB implements MPhyItemScanICLocal, ...@@ -234,11 +235,6 @@ public class MPhyItemScanIC extends ValidatorEJB implements MPhyItemScanICLocal,
{ {
count = rs.getInt("COUNT"); count = rs.getInt("COUNT");
} }
if( count == 0 )
{
errString = getErrorString("site_code","INVSITECOD",userId);
break;
}
if(pstmt != null) if(pstmt != null)
{ {
pstmt.close(); pstmt.close();
...@@ -250,6 +246,62 @@ public class MPhyItemScanIC extends ValidatorEJB implements MPhyItemScanICLocal, ...@@ -250,6 +246,62 @@ public class MPhyItemScanIC extends ValidatorEJB implements MPhyItemScanICLocal,
rs.close(); rs.close();
rs = null; rs = null;
} }
if( count == 0 )
{
errString = getErrorString("site_code","INVSITECOD",userId);
break;
}
else //added by kunal on 15-feb-14 for period code
{
siteCode = genericUtility.getColumnValue("site_code", dom);
System.out.println("364 site code ="+siteCode);
if (genericUtility.getColumnValue("tran_date", dom) != null)
{
tranDate = sdf1.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)
{
errString = getErrorString("site_code","VTSITEPD",userId);
break;
}
// 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)
{
errString = getErrorString("site_code",errCode,userId);
break;
}
}
}//end
} }
} }
else if( childNodeName.equalsIgnoreCase( "tran_date" )) else if( childNodeName.equalsIgnoreCase( "tran_date" ))
......
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