Commit 8ebd899c authored by smane's avatar smane

Change validation of Item code add Alert as 'On Alert' ,for SCM issue tracker point 236-N


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@95890 ce508802-f39f-4f6c-b175-0d175dae99d5
parent ebb9fe77
...@@ -6510,4 +6510,104 @@ public class SReturnForm extends ValidatorEJB implements SReturnFormLocal, SRetu ...@@ -6510,4 +6510,104 @@ public class SReturnForm extends ValidatorEJB implements SReturnFormLocal, SRetu
{ {
return Math.round(round * Math.pow(10, scale)) / Math.pow(10, scale); return Math.round(round * Math.pow(10, scale)) / Math.pow(10, scale);
} }
// isItem method added by sagar on 12/08/14
public String isItem(String siteCode, String itemCode, String modName,Connection conn) throws RemoteException,ITMException
{
String errCode = "";
String active = "";
String sql1 = "",sql2="";
PreparedStatement pstmt1 = null,pstmt2=null;
ResultSet rs1 =null,rs2=null;
try
{
sql1 = "SELECT ACTIVE FROM ITEM WHERE ITEM_CODE = ? ";
pstmt1= conn.prepareStatement(sql1);
pstmt1.setString(1,itemCode);
rs1 = pstmt1.executeQuery();
if (rs1.next())
{
active = rs1.getString(1);
}
else
{
errCode = "VTITEM1";
}
if ( active == null || active.trim().length() == 0 )
{
active = "Y";
}
if(active.equals("N"))
{
errCode ="VTITEM4";
}
else if(active.equals("D"))
{
errCode ="VTITMONALR";
}
rs1.close();
pstmt1.close();
pstmt1 = null;
rs1 = null;
sql1 = "SELECT VAR_VALUE FROM DISPARM WHERE PRD_CODE = '999999' and VAR_NAME = 'SITE_SPECIFIC_ITEM'";
pstmt1= conn.prepareStatement(sql1);
rs1 = pstmt1.executeQuery();
if (rs1.next())
{
if (rs1.getString(1).equals("Y"))
{
sql2="SELECT CASE WHEN ACTIVE IS NULL THEN 'Y' ELSE ACTIVE END FROM SITEITEM WHERE SITE_CODE = ? AND ITEM_CODE= ? ";
pstmt2= conn.prepareStatement(sql2);
pstmt2.setString(1,siteCode);
pstmt2.setString(2,itemCode);
rs2 = pstmt2.executeQuery();
if (rs2.next())
{
if (rs2.getString(1).equals("N"))
{
errCode = "VTITEM4";
}
}
else
{
errCode = "VTITEM3";
}
rs2.close();
pstmt2.close();
pstmt2 = null;
rs2 = null;
}
else
{
sql2 = "SELECT CASE WHEN COUNT(1) IS NULL THEN 0 ELSE COUNT(1) END FROM ITEM WHERE ITEM_CODE = ? ";
pstmt2= conn.prepareStatement(sql2);
pstmt2.setString(1, itemCode);
rs2 = pstmt2.executeQuery();
if (rs2.next())
{
if (rs2.getInt(1)==0)
{
errCode="VTITEM1";
}
}
rs2.close();
pstmt2.close();
pstmt2 = null;
rs2 = null;
}
}
rs1.close();
pstmt1.close();
pstmt1 = null;
rs1 = null;
}
catch(Exception e)
{
System.out.println("Exception in isItem :==>\n"+e.getMessage());
e.printStackTrace();
errCode = e.getMessage();
throw new ITMException(e);
}
return errCode;
}
} }
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