Commit e8f007ea authored by nkhan's avatar nkhan

[S15IBAS003] Updated Sources For Adding Validation From MSI And removing extra validation


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@103421 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 0e61e5c9
...@@ -12,6 +12,7 @@ import java.rmi.RemoteException; ...@@ -12,6 +12,7 @@ import java.rmi.RemoteException;
import java.sql.Connection; import java.sql.Connection;
import java.sql.PreparedStatement; import java.sql.PreparedStatement;
import java.sql.ResultSet; import java.sql.ResultSet;
import java.sql.Timestamp;
import org.w3c.dom.Document; import org.w3c.dom.Document;
import org.w3c.dom.Node; import org.w3c.dom.Node;
import org.w3c.dom.NodeList; import org.w3c.dom.NodeList;
...@@ -77,10 +78,15 @@ public class PriceListIC extends ValidatorEJB implements PriceListICLocal, Price ...@@ -77,10 +78,15 @@ public class PriceListIC extends ValidatorEJB implements PriceListICLocal, Price
String priceList = ""; String priceList = "";
String priceListTar = ""; String priceListTar = "";
String calcMethod = ""; String calcMethod = "";
String childNodeValue = "" ;
String active = "";
String effDateStr ="", validUptoStr ="";
Timestamp effDate = null, validUpto = null;
int ctr = 0; int ctr = 0;
int count = 0; int count = 0;
int currentFormNo = 0; int currentFormNo = 0;
int childNodeListLength; int childNodeListLength;
double minQty = 0.0, maxQty = 0.0, minRate = 0.0, rate = 0.0;
StringBuffer valueXmlString = new StringBuffer(); StringBuffer valueXmlString = new StringBuffer();
ArrayList<String> errList = new ArrayList(); ArrayList<String> errList = new ArrayList();
ArrayList<String> errFields = new ArrayList<String>(); ArrayList<String> errFields = new ArrayList<String>();
...@@ -120,6 +126,7 @@ public class PriceListIC extends ValidatorEJB implements PriceListICLocal, Price ...@@ -120,6 +126,7 @@ public class PriceListIC extends ValidatorEJB implements PriceListICLocal, Price
{ {
childNode = childNodeList.item(ctr); childNode = childNodeList.item(ctr);
childNodeName = childNode.getNodeName(); childNodeName = childNode.getNodeName();
/* Comment By Nasruddin [20-SEP-16] START
if(childNodeName.equalsIgnoreCase("calc_method")) if(childNodeName.equalsIgnoreCase("calc_method"))
{ {
calcMethod = genericUtility.getColumnValue("calc_method", dom); calcMethod = genericUtility.getColumnValue("calc_method", dom);
...@@ -150,8 +157,12 @@ public class PriceListIC extends ValidatorEJB implements PriceListICLocal, Price ...@@ -150,8 +157,12 @@ public class PriceListIC extends ValidatorEJB implements PriceListICLocal, Price
errCode = "VTCALMNUL"; errCode = "VTCALMNUL";
errList.add(errCode); errList.add(errCode);
errFields.add(childNodeName.toLowerCase()); errFields.add(childNodeName.toLowerCase());
}*/
} }
}
Comment By Nasruddin [20-SEP-16] END
*/
/* Comment By Nasruddin [20-SEP-16] START
else if(childNodeName.equalsIgnoreCase("price_list")) else if(childNodeName.equalsIgnoreCase("price_list"))
{ {
priceList = genericUtility.getColumnValue("price_list", dom); priceList = genericUtility.getColumnValue("price_list", dom);
...@@ -202,10 +213,10 @@ public class PriceListIC extends ValidatorEJB implements PriceListICLocal, Price ...@@ -202,10 +213,10 @@ public class PriceListIC extends ValidatorEJB implements PriceListICLocal, Price
} }
}
}Comment By Nasruddin [20-SEP-16] END*/
else if(childNodeName.equalsIgnoreCase("price_list__parent")) if(childNodeName.equalsIgnoreCase("price_list__parent"))
{ {
priceListParent = genericUtility.getColumnValue("price_list__parent", dom); priceListParent = genericUtility.getColumnValue("price_list__parent", dom);
if (priceListParent !=null && priceListParent.trim().length() > 0) if (priceListParent !=null && priceListParent.trim().length() > 0)
...@@ -220,6 +231,57 @@ public class PriceListIC extends ValidatorEJB implements PriceListICLocal, Price ...@@ -220,6 +231,57 @@ public class PriceListIC extends ValidatorEJB implements PriceListICLocal, Price
} }
} }
//Changed By Nasruddin [20-SEP-16] start
else if(childNodeName.equalsIgnoreCase("slab_no") || childNodeName.equalsIgnoreCase("tax_base") || childNodeName.equalsIgnoreCase("item_code"))
{
childNodeValue = checkNullAndTrim(genericUtility.getColumnValue(childNodeName, dom));
if (childNodeValue !=null && childNodeValue.trim().length() > 0)
{
count = 0;
sql = "SELECT COUNT(1) FROM ITEM WHERE ITEM_CODE = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, childNodeValue);
rs = pstmt.executeQuery();
if( rs.next() )
{
count = rs.getInt(1);
}
pstmt.close();
pstmt=null;
rs.close();
rs = null;
if( count == 0)
{
errCode = "VMITEM_CD";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
else
{
sql = "SELECT ACTIVE FROM ITEM WHERE ITEM_CODE = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, childNodeValue);
rs = pstmt.executeQuery();
if( rs.next() )
{
active = rs.getString("ACTIVE");
}
pstmt.close();
pstmt=null;
rs.close();
rs = null;
if("N".equalsIgnoreCase(active))
{
errCode = "VTITEM4";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}
}
}
//Changed By Nasruddin [20-SEP-16] end
} }
valueXmlString.append("</Detail1>"); valueXmlString.append("</Detail1>");
break; break;
...@@ -233,7 +295,8 @@ public class PriceListIC extends ValidatorEJB implements PriceListICLocal, Price ...@@ -233,7 +295,8 @@ public class PriceListIC extends ValidatorEJB implements PriceListICLocal, Price
{ {
childNode = childNodeList.item(ctr); childNode = childNodeList.item(ctr);
childNodeName = childNode.getNodeName(); childNodeName = childNode.getNodeName();
if(childNodeName.equalsIgnoreCase("calc_method")) /* cOMMENT bY Nasruddin [20-SEP-16] START
* if(childNodeName.equalsIgnoreCase("calc_method"))
{ {
calcMethod = genericUtility.getColumnValue("calc_method", dom); calcMethod = genericUtility.getColumnValue("calc_method", dom);
if (calcMethod !=null && calcMethod.trim().length() > 0) if (calcMethod !=null && calcMethod.trim().length() > 0)
...@@ -263,9 +326,8 @@ public class PriceListIC extends ValidatorEJB implements PriceListICLocal, Price ...@@ -263,9 +326,8 @@ public class PriceListIC extends ValidatorEJB implements PriceListICLocal, Price
errList.add(errCode); errList.add(errCode);
errFields.add(childNodeName.toLowerCase()); errFields.add(childNodeName.toLowerCase());
} }
} }
else if(childNodeName.equalsIgnoreCase("price_list__tar")) if(childNodeName.equalsIgnoreCase("price_list__tar"))
{ {
priceListTar = genericUtility.getColumnValue("price_list__tar", dom); priceListTar = genericUtility.getColumnValue("price_list__tar", dom);
if (priceListTar == null || priceListTar.trim().length() == 0) if (priceListTar == null || priceListTar.trim().length() == 0)
...@@ -289,9 +351,84 @@ public class PriceListIC extends ValidatorEJB implements PriceListICLocal, Price ...@@ -289,9 +351,84 @@ public class PriceListIC extends ValidatorEJB implements PriceListICLocal, Price
} }
} }
}cOMMENT bY Nasruddin [20-SEP-16] end*/
//Changed By Nasruddin STARt [20-sep-16] START
if(childNodeName.equalsIgnoreCase("min_qty"))
{
minQty = convertNumber(checkNullAndTrim(genericUtility.getColumnValue("min_qty", dom)));
maxQty = convertNumber(checkNullAndTrim(genericUtility.getColumnValue("max_qty", dom)));
if(maxQty < minQty)
{
errCode = "VMMINQTY";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}
else if(childNodeName.equalsIgnoreCase("min_rate"))
{
minRate = convertNumber(checkNullAndTrim(genericUtility.getColumnValue("min_rate", dom)));
rate = convertNumber(checkNullAndTrim(genericUtility.getColumnValue("rate", dom)));
if(rate < minRate)
{
errCode = "VMMINQTY";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}
else if(childNodeName.equalsIgnoreCase("valid_upto"))
{
effDateStr = genericUtility.getColumnValue("eff_date",dom);
validUptoStr = genericUtility.getColumnValue("valid_upto",dom);
if((effDateStr != null) && (validUptoStr != null))
{
effDate = Timestamp.valueOf(genericUtility.getValidDateString(effDateStr, genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat()) + " 00:00:00.0");
validUpto = Timestamp.valueOf(genericUtility.getValidDateString(validUptoStr, genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat()) + " 00:00:00.0");
if( !validUpto.after(effDate) )
{
errCode = "VMVAL_UPTO";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}
}
else if(childNodeName.equalsIgnoreCase("tax_code"))
{
childNodeValue = checkNullAndTrim(genericUtility.getColumnValue("tax_code", dom));
count = 0;
sql = "SELECT COUNT(1) FROM TAX WHERE TAX_CODE = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, childNodeValue);
rs = pstmt.executeQuery();
if( rs.next() )
{
count = rs.getInt(1);
}
pstmt.close();
pstmt=null;
rs.close();
rs = null;
if( count == 0)
{
errCode = "VTTAX1";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
} }
} }
else if(childNodeName.equalsIgnoreCase("rate"))
{
rate = convertNumber(checkNullAndTrim(genericUtility.getColumnValue("rate", dom)));
if(rate <= 0)
{
errCode = "VTRATE2";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}
//Changed By Nasruddin [20-sep-16] END
}
valueXmlString.append("</Detail2>"); valueXmlString.append("</Detail2>");
break; break;
} }
...@@ -369,6 +506,19 @@ public class PriceListIC extends ValidatorEJB implements PriceListICLocal, Price ...@@ -369,6 +506,19 @@ public class PriceListIC extends ValidatorEJB implements PriceListICLocal, Price
return errString; return errString;
} }
private double convertNumber(String columnValue)
{
return columnValue.trim().length() == 0 ? 0 : Double.parseDouble(columnValue);
}
// Changed By Nasruddin 20-SEP-16 STARt
private String checkNullAndTrim(String value)
{
return value == null ? "" : value.trim();
}
// Changed By Nasruddin 20-SEP-16 END
public String itemChanged(String xmlString, String xmlString1, String xmlString2, String objContext, String currentColumn, String editFlag, String xtraParams) throws RemoteException, ITMException public String itemChanged(String xmlString, String xmlString1, String xmlString2, String objContext, String currentColumn, String editFlag, String xtraParams) throws RemoteException, ITMException
{ {
......
...@@ -80,7 +80,7 @@ public class PurTermTable extends ValidatorEJB implements PurTermTableLocal, Pur ...@@ -80,7 +80,7 @@ public class PurTermTable extends ValidatorEJB implements PurTermTableLocal, Pur
String sql = ""; String sql = "";
String errCode = ""; String errCode = "";
String errorType = ""; String errorType = "";
String errString = ""; String errString = "", termTable = "";
int ctr = 0; int ctr = 0;
int currentFormNo = 0; int currentFormNo = 0;
int cnt = 0; int cnt = 0;
...@@ -90,6 +90,7 @@ public class PurTermTable extends ValidatorEJB implements PurTermTableLocal, Pur ...@@ -90,6 +90,7 @@ public class PurTermTable extends ValidatorEJB implements PurTermTableLocal, Pur
Connection conn = null; Connection conn = null;
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
ResultSet rs = null; ResultSet rs = null;
String termCode = "";
ConnDriver connDriver = new ConnDriver(); ConnDriver connDriver = new ConnDriver();
int childNodeListLength=0; int childNodeListLength=0;
StringBuffer errStringXml = new StringBuffer("<?xml version = \"1.0\"?> \r\n <Root> <Errors>"); StringBuffer errStringXml = new StringBuffer("<?xml version = \"1.0\"?> \r\n <Root> <Errors>");
...@@ -121,10 +122,11 @@ public class PurTermTable extends ValidatorEJB implements PurTermTableLocal, Pur ...@@ -121,10 +122,11 @@ public class PurTermTable extends ValidatorEJB implements PurTermTableLocal, Pur
childNodeName = childNode.getNodeName(); childNodeName = childNode.getNodeName();
if (childNodeName.equalsIgnoreCase("term_code")) if (childNodeName.equalsIgnoreCase("term_code"))
{ {
String termCode = "";
termCode = this.genericUtility.getColumnValue("term_code", dom); termCode = this.genericUtility.getColumnValue("term_code", dom);
if(termCode != null && termCode.trim().length() > 0 ) //Comment By Nasruddin [20-SEP-16]
{ //if(termCode != null && termCode.trim().length() > 0 )
//{
sql = "select count(*) from pur_term where term_code = ?"; sql = "select count(*) from pur_term where term_code = ?";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1,termCode); pstmt.setString(1,termCode);
...@@ -143,8 +145,59 @@ public class PurTermTable extends ValidatorEJB implements PurTermTableLocal, Pur ...@@ -143,8 +145,59 @@ public class PurTermTable extends ValidatorEJB implements PurTermTableLocal, Pur
rs = null; rs = null;
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
//}
}
//Changed By Nasruddin Start [20-SEP-16]
else if(childNodeName.equalsIgnoreCase("term_table"))
{
termTable = this.genericUtility.getColumnValue("term_table", dom);
sql = "SELECT COUNT(1) FROM PUR_TERM_TABLE WHERE TERM_TABLE = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,termTable);
rs = pstmt.executeQuery();
if (rs.next())
{
cnt = rs.getInt(1);
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
if (cnt == 0)
{
errCode = "VTITABL1";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
else
{
if("A".equalsIgnoreCase(editFlag) && errCode == null || errCode.trim().length()==0)
{
termCode = this.genericUtility.getColumnValue("term_code", dom);
sql ="SELECT COUNT(1) FROM PUR_TERM_TABLE WHERE TERM_TABLE = ? AND TERM_CODE = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,termTable);
pstmt.setString(2, termCode);
rs = pstmt.executeQuery();
if (rs.next())
{
cnt = rs.getInt(1);
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
if (cnt > 0)
{
errCode = "VTDUPENTRY";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}
} }
} }
//Changed By Nasruddin [20-SEP-16] END
} }
//valueXmlString.append("</Detail1>"); //valueXmlString.append("</Detail1>");
//break; //break;
......
...@@ -87,10 +87,12 @@ public class PurchaseTermsIC extends ValidatorEJB implements PurchaseTermsICRemo ...@@ -87,10 +87,12 @@ public class PurchaseTermsIC extends ValidatorEJB implements PurchaseTermsICRemo
parentNode = parentNodeList.item(0); parentNode = parentNodeList.item(0);
childNodeList = parentNode.getChildNodes(); childNodeList = parentNode.getChildNodes();
childNodeLength = childNodeList.getLength(); childNodeLength = childNodeList.getLength();
for (ctr = 0; ctr < childNodeLength; ctr++) { for (ctr = 0; ctr < childNodeLength; ctr++)
{
childNode = childNodeList.item(ctr); childNode = childNodeList.item(ctr);
childNodeName = childNode.getNodeName(); childNodeName = childNode.getNodeName();
if(childNodeName.equalsIgnoreCase("term_code")){ if(childNodeName.equalsIgnoreCase("term_code"))
{
termCode= genericUtility.getColumnValue("term_code", dom); termCode= genericUtility.getColumnValue("term_code", dom);
termCode = termCode == null ? "" : termCode.trim(); termCode = termCode == null ? "" : termCode.trim();
System.out.println("termCode ::::" + termCode); System.out.println("termCode ::::" + termCode);
...@@ -98,7 +100,8 @@ public class PurchaseTermsIC extends ValidatorEJB implements PurchaseTermsICRemo ...@@ -98,7 +100,8 @@ public class PurchaseTermsIC extends ValidatorEJB implements PurchaseTermsICRemo
sql = "select key_flag from transetup where tran_window = 'w_pur_term' " ; sql = "select key_flag from transetup where tran_window = 'w_pur_term' " ;
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
if(rs.next()){ if(rs.next())
{
keyFlag = rs.getString("key_flag"); keyFlag = rs.getString("key_flag");
} }
...@@ -108,29 +111,36 @@ public class PurchaseTermsIC extends ValidatorEJB implements PurchaseTermsICRemo ...@@ -108,29 +111,36 @@ public class PurchaseTermsIC extends ValidatorEJB implements PurchaseTermsICRemo
if(keyFlag.isEmpty()){ if(keyFlag.isEmpty()){
keyFlag = "M"; keyFlag = "M";
} }
if(termCode.isEmpty() && keyFlag.equalsIgnoreCase("M")){ if(termCode.isEmpty() && keyFlag.equalsIgnoreCase("M"))
{
errString = itmdbAccessEJB.getErrorString("term_code", "VTTERMNULL", userId); errString = itmdbAccessEJB.getErrorString("term_code", "VTTERMNULL", userId);
return errString; return errString;
}else if(editFlag.equalsIgnoreCase("A")){ }
else if(editFlag.equalsIgnoreCase("A"))
{
int count = 0; int count = 0;
sql = "select count(*) as count from pur_term where term_code = ?"; sql = "select count(*) as count from pur_term where term_code = ?";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, termCode); pstmt.setString(1, termCode);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
if(rs.next()){ if(rs.next())
{
count = rs.getInt("count"); count = rs.getInt("count");
} }
rs.close(); rs.close();
rs = null; rs = null;
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
if(count > 0){ if(count > 0)
{
errString = itmdbAccessEJB.getErrorString("term_code", "VMDUPL1", userId); errString = itmdbAccessEJB.getErrorString("term_code", "VMDUPL1", userId);
return errString; return errString;
} }
} }
} }
if(childNodeName.equalsIgnoreCase("descr")){ /* Comment By Nasruddin [20-SEP-16] START
if(childNodeName.equalsIgnoreCase("descr"))
{
descr = genericUtility.getColumnValue("descr", dom); descr = genericUtility.getColumnValue("descr", dom);
descr = descr == null ? "" : descr.trim(); descr = descr == null ? "" : descr.trim();
System.out.println("Description :::" + descr); System.out.println("Description :::" + descr);
...@@ -139,26 +149,35 @@ public class PurchaseTermsIC extends ValidatorEJB implements PurchaseTermsICRemo ...@@ -139,26 +149,35 @@ public class PurchaseTermsIC extends ValidatorEJB implements PurchaseTermsICRemo
return errString; return errString;
} }
} }
Comment By Nasruddin [20-SEP-16] END */
} }
} }
}catch(Exception e){ }catch(Exception e)
{
System.out.println("::::" + this.getClass().getSimpleName() + ":::" + e.getMessage()); System.out.println("::::" + this.getClass().getSimpleName() + ":::" + e.getMessage());
e.printStackTrace(); e.printStackTrace();
}finally{ }
try{ finally
if(rs != null){ {
try
{
if(rs != null)
{
rs.close(); rs.close();
rs = null; rs = null;
} }
if(pstmt != null){ if(pstmt != null)
{
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
} }
if(conn != null){ if(conn != null)
{
conn.close(); conn.close();
conn = null; conn = null;
} }
}catch(Exception e1){ }
catch(Exception e1){
System.out.println("::::" + this.getClass().getSimpleName() + ":::" + e1.getMessage()); System.out.println("::::" + this.getClass().getSimpleName() + ":::" + e1.getMessage());
e1.printStackTrace(); e1.printStackTrace();
} }
......
...@@ -80,55 +80,69 @@ public class SalesReturnReasonIC extends ValidatorEJB implements SalesReturnReas ...@@ -80,55 +80,69 @@ public class SalesReturnReasonIC extends ValidatorEJB implements SalesReturnReas
currentFormNo = Integer.parseInt(objContext); currentFormNo = Integer.parseInt(objContext);
} }
System.out.println("in wfValdata doc :::::"); System.out.println("in wfValdata doc :::::");
switch (currentFormNo) { switch (currentFormNo)
{
case 1: case 1:
parentNodeList = dom.getElementsByTagName("Detail1"); parentNodeList = dom.getElementsByTagName("Detail1");
parentNode = parentNodeList.item(0); parentNode = parentNodeList.item(0);
childNodeList = parentNode.getChildNodes(); childNodeList = parentNode.getChildNodes();
childNodeLength = childNodeList.getLength(); childNodeLength = childNodeList.getLength();
for (ctr = 0; ctr < childNodeLength; ctr++) { for (ctr = 0; ctr < childNodeLength; ctr++)
{
childNode = childNodeList.item(ctr); childNode = childNodeList.item(ctr);
childNodeName = childNode.getNodeName(); childNodeName = childNode.getNodeName();
if(childNodeName.equalsIgnoreCase("reason_code")){ /* Comment By Nasruddin 21-SEP-16 START
if(childNodeName.equalsIgnoreCase("reason_code"))
{
reasonCode = genericUtility.getColumnValue("reason_code", dom); reasonCode = genericUtility.getColumnValue("reason_code", dom);
reasonCode = reasonCode == null ? "" : reasonCode.trim(); reasonCode = reasonCode == null ? "" : reasonCode.trim();
System.out.println("reasonCode ::::" + reasonCode); System.out.println("reasonCode ::::" + reasonCode);
if(reasonCode.isEmpty()){ if(reasonCode.isEmpty())
{
errString = itmdbAccessEJB.getErrorString("reason_code", "VTREABL", userId); errString = itmdbAccessEJB.getErrorString("reason_code", "VTREABL", userId);
return errString; return errString;
}else if(editFlag.equalsIgnoreCase("A")){ }
else if(editFlag.equalsIgnoreCase("A"))
{
int count = 0; int count = 0;
sql = "select count(*) as count from SRETURN_REASON where reason_code = ? "; sql = "select count(*) as count from SRETURN_REASON where reason_code = ? ";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, reasonCode); pstmt.setString(1, reasonCode);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
if(rs.next()){ if(rs.next())
{
count = rs.getInt("count"); count = rs.getInt("count");
} }
rs.close(); rs.close();
rs = null; rs = null;
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
if(count > 0){ if(count > 0)
{
errString = itmdbAccessEJB.getErrorString("reason_code", "VTREAINV", userId); errString = itmdbAccessEJB.getErrorString("reason_code", "VTREAINV", userId);
return errString; return errString;
} }
} }
} }
if(childNodeName.equalsIgnoreCase("reason_descr")){ if(childNodeName.equalsIgnoreCase("reason_descr"))
{
descr = genericUtility.getColumnValue("reason_descr", dom); descr = genericUtility.getColumnValue("reason_descr", dom);
descr = descr == null ? "" : descr.trim(); descr = descr == null ? "" : descr.trim();
System.out.println("Description :::" + descr); System.out.println("Description :::" + descr);
if(descr.trim().isEmpty()){ if(descr.trim().isEmpty())
{
errString = itmdbAccessEJB.getErrorString("reason_descr", "VMDESCR", userId); errString = itmdbAccessEJB.getErrorString("reason_descr", "VMDESCR", userId);
return errString; return errString;
} }
} }
if(childNodeName.equalsIgnoreCase("restr_days")){ Comment By Nasruddin 21-SEP-16 END */
if(childNodeName.equalsIgnoreCase("restr_days"))
{
restrDays = genericUtility.getColumnValue("restr_days", dom); restrDays = genericUtility.getColumnValue("restr_days", dom);
restrDays = restrDays == null ? "" : restrDays.trim(); restrDays = restrDays == null ? "" : restrDays.trim();
System.out.println("Restr Days" + restrDays); System.out.println("Restr Days" + restrDays);
if(restrDays.trim().isEmpty()){ if(restrDays.trim().isEmpty())
{
errString = itmdbAccessEJB.getErrorString("restr_days", "VTRESTBL", userId); errString = itmdbAccessEJB.getErrorString("restr_days", "VTRESTBL", userId);
return errString; return errString;
} }
......
...@@ -137,16 +137,48 @@ public class SiteCustomer extends ValidatorEJB implements SiteCustomerLocal,Site ...@@ -137,16 +137,48 @@ public class SiteCustomer extends ValidatorEJB implements SiteCustomerLocal,Site
{ {
count = rs.getInt(1); count = rs.getInt(1);
} }
rs.close();
rs = null;
pstmt.close();
pstmt = null;
if(count == 0) if(count == 0)
{ {
errCode = "VMCUST1"; errCode = "VMCUST1";
errList.add(errCode); errList.add(errCode);
errFields.add(childNodeName.toLowerCase()); errFields.add(childNodeName.toLowerCase());
} }
// Changed By Nasruddin START [22-SEP-16]
else
{
if("A".equals(editFlag) && errCode.trim().length() == 0)
{
custCode = genericUtility.getColumnValue("cust_code", dom);
siteCode = genericUtility.getColumnValue("site_code", dom);
sql = "SELECT COUNT(1) FROM SITE_CUSTOMER WHERE SITE_CODE = ? AND CUST_CODE = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, siteCode);
pstmt.setString(2, custCode);
rs = pstmt.executeQuery();
if(rs.next())
{
count = rs.getInt(1);
}
rs.close(); rs.close();
rs = null; rs = null;
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
if(count > 0)
{
errCode = "VMPMKY";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}
}
// Changed By Nasruddin END [22-SEP-16]
} }
else if(childNodeName.equalsIgnoreCase("terr_code")) else if(childNodeName.equalsIgnoreCase("terr_code"))
{ {
...@@ -411,7 +443,6 @@ public class SiteCustomer extends ValidatorEJB implements SiteCustomerLocal,Site ...@@ -411,7 +443,6 @@ public class SiteCustomer extends ValidatorEJB implements SiteCustomerLocal,Site
} }
}// End of try }// End of try
catch(Exception e) catch(Exception e)
{ {
e.printStackTrace(); e.printStackTrace();
......
...@@ -64,14 +64,14 @@ public class SiteSupplierIC extends ValidatorEJB implements SiteSupplierICLocal, ...@@ -64,14 +64,14 @@ public class SiteSupplierIC extends ValidatorEJB implements SiteSupplierICLocal,
String siteCodeCh = ""; String siteCodeCh = "";
String siteCodePay = ""; String siteCodePay = "";
String crmTerm = ""; String crmTerm = "";
String taxClass = ""; String taxClass = "", lockGroup = "";
String taxEnv = ""; String taxEnv = "";
String childNodeName = null; String childNodeName = null;
String errString = ""; String errString = "";
String errCode = ""; String errCode = "";
String userId = ""; String userId = "";
String sql = ""; String sql = "";
String errorType = ""; String errorType = "", currCode = "";
int cnt = 0; int cnt = 0;
int ctr=0; int ctr=0;
int childNodeListLength; int childNodeListLength;
...@@ -155,11 +155,11 @@ public class SiteSupplierIC extends ValidatorEJB implements SiteSupplierICLocal, ...@@ -155,11 +155,11 @@ public class SiteSupplierIC extends ValidatorEJB implements SiteSupplierICLocal,
} }
else if(childNodeName.equalsIgnoreCase("site_code__ch")) else if(childNodeName.equalsIgnoreCase("site_code__ch"))
{ {
//channelPartner = checkNull(genericUtility.getColumnValue("channel_partner", dom)); channelPartner = checkNull(genericUtility.getColumnValue("channel_partner", dom));
siteCodeCh = checkNull(genericUtility.getColumnValue("site_code__ch", dom)); siteCodeCh = checkNull(genericUtility.getColumnValue("site_code__ch", dom));
System.out.println("siteCodeCh"+siteCodeCh); System.out.println("siteCodeCh"+siteCodeCh);
// Changed By nasruddin 22-SEP-16 START
/*if(channelPartner != null && channelPartner.equalsIgnoreCase("Y")) if(channelPartner != null && channelPartner.equalsIgnoreCase("Y"))
{ {
if(siteCodeCh == null || siteCodeCh.trim().length() < 0) if(siteCodeCh == null || siteCodeCh.trim().length() < 0)
{ {
...@@ -167,7 +167,8 @@ public class SiteSupplierIC extends ValidatorEJB implements SiteSupplierICLocal, ...@@ -167,7 +167,8 @@ public class SiteSupplierIC extends ValidatorEJB implements SiteSupplierICLocal,
errList.add(errCode); errList.add(errCode);
errFields.add(childNodeName.toLowerCase()); errFields.add(childNodeName.toLowerCase());
} }
}*/ }
/*
if(siteCodeCh != null && siteCodeCh.trim().length() > 0) if(siteCodeCh != null && siteCodeCh.trim().length() > 0)
{ {
sql = "SELECT COUNT(*) FROM site where site_code = ?"; sql = "SELECT COUNT(*) FROM site where site_code = ?";
...@@ -189,6 +190,7 @@ public class SiteSupplierIC extends ValidatorEJB implements SiteSupplierICLocal, ...@@ -189,6 +190,7 @@ public class SiteSupplierIC extends ValidatorEJB implements SiteSupplierICLocal,
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
} }
Changed by Nasruddin 22-SEP-16 END*/
} }
else if(childNodeName.equalsIgnoreCase("site_code__pay")) else if(childNodeName.equalsIgnoreCase("site_code__pay"))
{ {
...@@ -218,7 +220,8 @@ public class SiteSupplierIC extends ValidatorEJB implements SiteSupplierICLocal, ...@@ -218,7 +220,8 @@ public class SiteSupplierIC extends ValidatorEJB implements SiteSupplierICLocal,
pstmt = null; pstmt = null;
} }
} }
/*else if(childNodeName.equalsIgnoreCase("curr_code")) // Changed By Nasruddin START 22-SEP-16
else if(childNodeName.equalsIgnoreCase("curr_code"))
{ {
currCode = checkNull(genericUtility.getColumnValue("curr_code", dom)); currCode = checkNull(genericUtility.getColumnValue("curr_code", dom));
if(currCode != null && currCode.trim().length() > 0) if(currCode != null && currCode.trim().length() > 0)
...@@ -242,7 +245,7 @@ public class SiteSupplierIC extends ValidatorEJB implements SiteSupplierICLocal, ...@@ -242,7 +245,7 @@ public class SiteSupplierIC extends ValidatorEJB implements SiteSupplierICLocal,
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
} }
}*/ }/*Changed By Nasruddin END 22-SEP-16 START
else if(childNodeName.equalsIgnoreCase("cr_term")) else if(childNodeName.equalsIgnoreCase("cr_term"))
{ {
crmTerm = checkNull(genericUtility.getColumnValue("cr_term", dom)); crmTerm = checkNull(genericUtility.getColumnValue("cr_term", dom));
...@@ -269,6 +272,7 @@ public class SiteSupplierIC extends ValidatorEJB implements SiteSupplierICLocal, ...@@ -269,6 +272,7 @@ public class SiteSupplierIC extends ValidatorEJB implements SiteSupplierICLocal,
pstmt = null; pstmt = null;
} }
} }
else if(childNodeName.equalsIgnoreCase("tax_class")) else if(childNodeName.equalsIgnoreCase("tax_class"))
{ {
taxClass = checkNull(genericUtility.getColumnValue("tax_class", dom)); taxClass = checkNull(genericUtility.getColumnValue("tax_class", dom));
...@@ -321,6 +325,39 @@ public class SiteSupplierIC extends ValidatorEJB implements SiteSupplierICLocal, ...@@ -321,6 +325,39 @@ public class SiteSupplierIC extends ValidatorEJB implements SiteSupplierICLocal,
pstmt = null; pstmt = null;
} }
} }
*/
//Changed By Nasruddin 22-SEP-16 START
else if(childNodeName.equalsIgnoreCase("lock_group"))
{
lockGroup = genericUtility.getColumnValue("lock_group", dom);
if(lockGroup != null && lockGroup.trim().length() > 0)
{
cnt = 0;
sql = "SELECT COUNT(1) FROM LOCK_GROUP Where LOCK_GROUP = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, lockGroup);
rs = pstmt.executeQuery();
if( rs.next() )
{
cnt = rs.getInt(1);
}
pstmt.close();
pstmt = null;
rs.close();
rs = null;
if( cnt == 0 )
{
errCode = "VMLOCKCODE";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}
}
//Changed By Nasruddin 22-SEP-16 END
} }
......
...@@ -3,6 +3,8 @@ package ibase.webitm.ejb.dis; ...@@ -3,6 +3,8 @@ package ibase.webitm.ejb.dis;
import java.rmi.RemoteException; import java.rmi.RemoteException;
import java.sql.Connection; import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import ibase.system.config.ConnDriver; import ibase.system.config.ConnDriver;
import ibase.utility.E12GenericUtility; import ibase.utility.E12GenericUtility;
import ibase.webitm.ejb.ITMDBAccessEJB; import ibase.webitm.ejb.ITMDBAccessEJB;
...@@ -66,7 +68,12 @@ ITMDBAccessEJB itmdbAccessEJB = new ITMDBAccessEJB(); ...@@ -66,7 +68,12 @@ ITMDBAccessEJB itmdbAccessEJB = new ITMDBAccessEJB();
Node parentNode = null, childNode = null; Node parentNode = null, childNode = null;
String childNodeName = "",userId = ""; String childNodeName = "",userId = "";
int currentFormNo = 0, childNodeLength = 0, ctr = 0; int currentFormNo = 0, childNodeLength = 0, ctr = 0;
// Changed By Nasruddin Start 21-SEp-16
String sql= "";
PreparedStatement pstmt = null;
ResultSet rs = null;
int count = 0 ;
// Changed By Nasruddin 21-SEp-16 END
try { try {
System.out.println("::in wfvalData doc::"); System.out.println("::in wfvalData doc::");
ConnDriver con = new ConnDriver(); ConnDriver con = new ConnDriver();
...@@ -78,43 +85,109 @@ ITMDBAccessEJB itmdbAccessEJB = new ITMDBAccessEJB(); ...@@ -78,43 +85,109 @@ ITMDBAccessEJB itmdbAccessEJB = new ITMDBAccessEJB();
if(objContext != null && objContext.trim().length() > 0){ if(objContext != null && objContext.trim().length() > 0){
currentFormNo = Integer.parseInt(objContext); currentFormNo = Integer.parseInt(objContext);
} }
switch(currentFormNo){ switch(currentFormNo)
{
case 1: case 1:
parentNodeList = dom.getElementsByTagName("Detail1"); parentNodeList = dom.getElementsByTagName("Detail1");
parentNode = parentNodeList.item(0); parentNode = parentNodeList.item(0);
childNodeList = parentNode.getChildNodes(); childNodeList = parentNode.getChildNodes();
childNodeLength = childNodeList.getLength(); childNodeLength = childNodeList.getLength();
for(ctr = 0;ctr<childNodeLength;ctr++){ for(ctr = 0;ctr<childNodeLength;ctr++)
{
childNode = childNodeList.item(ctr); childNode = childNodeList.item(ctr);
childNodeName = childNode.getNodeName(); childNodeName = childNode.getNodeName();
if(childNodeName.equalsIgnoreCase("spec_ref")){ if(childNodeName.equalsIgnoreCase("spec_ref"))
{
specRef = genericUtility.getColumnValue("spec_ref", dom); specRef = genericUtility.getColumnValue("spec_ref", dom);
specRef = specRef == null ? "" : specRef.trim(); specRef = specRef == null ? "" : specRef.trim();
System.out.println(":::specification ref" + specRef); System.out.println(":::specification ref" + specRef);
if(specRef.isEmpty()){ if(specRef.isEmpty())
{
errString = itmdbAccessEJB.getErrorString("spec_ref", "VTSPECREF", userId); errString = itmdbAccessEJB.getErrorString("spec_ref", "VTSPECREF", userId);
return errString; return errString;
} }
} }
if(childNodeName.equalsIgnoreCase("spec_code")){ if(childNodeName.equalsIgnoreCase("spec_code"))
{
specCode = genericUtility.getColumnValue("spec_code", dom); specCode = genericUtility.getColumnValue("spec_code", dom);
specCode = specCode == null ? "" : specCode.trim(); specCode = specCode == null ? "" : specCode.trim();
System.out.println(":::specification code" + specCode); System.out.println(":::specification code" + specCode);
if(specCode.isEmpty()){ if(specCode.isEmpty())
errString = itmdbAccessEJB.getErrorString("spec_code", "VTSPECCODE", userId); {
errString = itmdbAccessEJB.getErrorString("spec_code", "VMCODNULL", userId);
return errString;
}
// Changed By Nasruddin 21-SEP-16 Start
else
{
if("A".equals(editFlag))
{
sql = "SELECT COUNT(1) FROM SPECIFICATION WHERE SPEC_CODE = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, specCode);
rs = pstmt.executeQuery();
if( rs.next() )
{
count = rs.getInt(1);
}
pstmt.close();
pstmt = null;
rs.close();
rs = null;
}
if( count > 0)
{
errString = itmdbAccessEJB.getErrorString("spec_code", "VMPMKY", userId);
return errString; return errString;
} }
} }
// Changed By Nasruddin 21-SEP-16 END
} }
} }
if(conn != null) { }
/* Comment By Nasruddin 21-SEP-16 START
if(conn != null)
{
conn.close(); conn.close();
conn = null; conn = null;
} }
} catch (Exception e) { Comment By Nasruddin 21-SEP-16 END */
}
catch (Exception e)
{
System.out.println("::::" + this.getClass().getSimpleName() + "::::" + e.getMessage()); System.out.println("::::" + this.getClass().getSimpleName() + "::::" + e.getMessage());
e.printStackTrace(); e.printStackTrace();
} }
//Changed By Nasruddin 21-SEP-16 STart
finally
{
try
{
if(conn != null)
{
if(rs != null)
{
rs.close();
rs = null;
}
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
conn.close();
}
conn = null;
}
catch(Exception e)
{
e.printStackTrace();
throw new ITMException(e);
}
}
//Changed By Nasruddin 21-SEP-16 END
return errString; return errString;
} }
} }
...@@ -123,6 +123,7 @@ public class SreturnNormsIC extends ValidatorEJB implements SreturnNormsICLocal, ...@@ -123,6 +123,7 @@ public class SreturnNormsIC extends ValidatorEJB implements SreturnNormsICLocal,
if( childNodeName.equalsIgnoreCase("days_from") && "A".equals(editFlag) ) if( childNodeName.equalsIgnoreCase("days_from") && "A".equals(editFlag) )
{ {
String daysFrom = checkNull(genericUtility.getColumnValue("days_from", dom)); String daysFrom = checkNull(genericUtility.getColumnValue("days_from", dom));
/* Comment By Nasruddin 21-SEP-16 Start
String daysTo = checkNull(genericUtility.getColumnValue("days_to", dom)); String daysTo = checkNull(genericUtility.getColumnValue("days_to", dom));
String deductPerc = checkNull(genericUtility.getColumnValue("deduct_perc", dom)); String deductPerc = checkNull(genericUtility.getColumnValue("deduct_perc", dom));
if(daysFrom.trim().length() <= 0) if(daysFrom.trim().length() <= 0)
...@@ -156,7 +157,8 @@ public class SreturnNormsIC extends ValidatorEJB implements SreturnNormsICLocal, ...@@ -156,7 +157,8 @@ public class SreturnNormsIC extends ValidatorEJB implements SreturnNormsICLocal,
errFields.add(childNodeName.toLowerCase()); errFields.add(childNodeName.toLowerCase());
} }
else else
{ {*/
count2 = 0;
sql = " select count(*) from sreturn_norms where days_from <= ? and days_to >= ? "; sql = " select count(*) from sreturn_norms where days_from <= ? and days_to >= ? ";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setInt(1,Integer.parseInt(daysFrom)); pstmt.setInt(1,Integer.parseInt(daysFrom));
...@@ -176,13 +178,14 @@ public class SreturnNormsIC extends ValidatorEJB implements SreturnNormsICLocal, ...@@ -176,13 +178,14 @@ public class SreturnNormsIC extends ValidatorEJB implements SreturnNormsICLocal,
errList.add(errCode); errList.add(errCode);
errFields.add(childNodeName.toLowerCase()); errFields.add(childNodeName.toLowerCase());
} }
} //} Comment By Nasruddin 21-SEP-16 END
} }
if(childNodeName.equalsIgnoreCase("days_to ") && "A".equals(editFlag) ) if(childNodeName.equalsIgnoreCase("days_to ") && "A".equals(editFlag) )
{ {
String daysTo = checkNull(genericUtility.getColumnValue("days_to", dom)); String daysTo = checkNull(genericUtility.getColumnValue("days_to", dom));
String daysFrom = checkNull(genericUtility.getColumnValue("days_from", dom)); String daysFrom = checkNull(genericUtility.getColumnValue("days_from", dom));
/* Comment By Nasruddin 21-SEP-16 START
String deductPerc = checkNull(genericUtility.getColumnValue("deduct_perc", dom)); String deductPerc = checkNull(genericUtility.getColumnValue("deduct_perc", dom));
if(daysTo.trim().length() <= 0) if(daysTo.trim().length() <= 0)
{ {
...@@ -208,7 +211,8 @@ public class SreturnNormsIC extends ValidatorEJB implements SreturnNormsICLocal, ...@@ -208,7 +211,8 @@ public class SreturnNormsIC extends ValidatorEJB implements SreturnNormsICLocal,
errList.add(errCode); errList.add(errCode);
errFields.add(childNodeName.toLowerCase()); errFields.add(childNodeName.toLowerCase());
} }
else if (Integer.parseInt(daysTo) < Integer.parseInt(daysFrom)) Comment By Nasruddin 21-SEP-16 END */
if (Integer.parseInt(daysTo) < Integer.parseInt(daysFrom))
{ {
errCode = "VMNORMS01"; errCode = "VMNORMS01";
errList.add(errCode); errList.add(errCode);
......
...@@ -85,6 +85,7 @@ public class StationIC extends ValidatorEJB implements StationICLocal, StationIC ...@@ -85,6 +85,7 @@ public class StationIC extends ValidatorEJB implements StationICLocal, StationIC
ConnDriver connDriver = new ConnDriver(); ConnDriver connDriver = new ConnDriver();
StringBuffer errStringXml = new StringBuffer("<?xml version = \"1.0\"?> \r\n <Root> <Errors>"); StringBuffer errStringXml = new StringBuffer("<?xml version = \"1.0\"?> \r\n <Root> <Errors>");
System.out.println("Station Val Start"); System.out.println("Station Val Start");
String modName = "w_station" , keyFlag = ""; // Changed By Nasruddin 21-SEP-16
try try
{ {
//Changes and Commented By Bhushan on 09-06-2016 :START //Changes and Commented By Bhushan on 09-06-2016 :START
...@@ -104,14 +105,17 @@ public class StationIC extends ValidatorEJB implements StationICLocal, StationIC ...@@ -104,14 +105,17 @@ public class StationIC extends ValidatorEJB implements StationICLocal, StationIC
if(childNodeName.equalsIgnoreCase("state_code")) if(childNodeName.equalsIgnoreCase("state_code"))
{ {
stateCode = checkNull(genericUtility.getColumnValue("state_code", dom)); stateCode = checkNull(genericUtility.getColumnValue("state_code", dom));
System.out.println("State code="+stateCode); System.out.println("State code="+stateCode);
/* Comment By Nasruddin 21-SEP-16 START
if(stateCode == null || stateCode.trim().length() == 0) if(stateCode == null || stateCode.trim().length() == 0)
{ {
errCode = "VMSTATCD2"; errCode = "VMSTATCD2";
errList.add(errCode); errList.add(errCode);
errFields.add(childNodeName.toLowerCase()); errFields.add(childNodeName.toLowerCase());
} }
else if(stateCode != null && stateCode.trim().length() > 0) Comment By Nasruddin 21-SEP-16 END */
if(stateCode != null && stateCode.trim().length() > 0)
{ {
sql = "select count(*) from state where state_code = ?"; sql = "select count(*) from state where state_code = ?";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
...@@ -143,6 +147,25 @@ public class StationIC extends ValidatorEJB implements StationICLocal, StationIC ...@@ -143,6 +147,25 @@ public class StationIC extends ValidatorEJB implements StationICLocal, StationIC
//errList.add(errCode); //errList.add(errCode);
//errFields.add(childNodeName.toLowerCase()); //errFields.add(childNodeName.toLowerCase());
//} //}
// Changed By Nasruddin 21-SEP-16 START
sql = "SELECT KEY_FLAG FROM TRANSETUP WHERE TRAN_WINDOW = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, modName);
rs = pstmt.executeQuery();
if( rs.next() )
{
keyFlag = rs.getString("KEY_FLAG");
}
keyFlag = keyFlag == null ? "M" : keyFlag.trim();
if( keyFlag == "M" && stanCode == null || stanCode.trim().length() == 0)
{
errCode = "VMSTAN1";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
else
{
if(editFlag.equalsIgnoreCase("A")) if(editFlag.equalsIgnoreCase("A"))
{ {
sql = "select count(*) from station where stan_code = ?"; sql = "select count(*) from station where stan_code = ?";
...@@ -157,7 +180,7 @@ public class StationIC extends ValidatorEJB implements StationICLocal, StationIC ...@@ -157,7 +180,7 @@ public class StationIC extends ValidatorEJB implements StationICLocal, StationIC
} }
if(count > 0) if(count > 0)
{ {
errCode = "VMSTNDP"; errCode = "VMDUPL1";
errList.add(errCode); errList.add(errCode);
errFields.add(childNodeName.toLowerCase()); errFields.add(childNodeName.toLowerCase());
} }
...@@ -167,6 +190,8 @@ public class StationIC extends ValidatorEJB implements StationICLocal, StationIC ...@@ -167,6 +190,8 @@ public class StationIC extends ValidatorEJB implements StationICLocal, StationIC
pstmt = null; pstmt = null;
} }
} }
}
/* Comment BY Nasruddin 21-sep-16 start
else if(childNodeName.equalsIgnoreCase("descr")) else if(childNodeName.equalsIgnoreCase("descr"))
{ {
desc = checkNull(genericUtility.getColumnValue("descr", dom)); desc = checkNull(genericUtility.getColumnValue("descr", dom));
...@@ -177,17 +202,22 @@ public class StationIC extends ValidatorEJB implements StationICLocal, StationIC ...@@ -177,17 +202,22 @@ public class StationIC extends ValidatorEJB implements StationICLocal, StationIC
errFields.add(childNodeName.toLowerCase()); errFields.add(childNodeName.toLowerCase());
} }
} }
Comment BY Nasruddin 21-sep-16 end */
else if(childNodeName.equalsIgnoreCase("bank_code")) else if(childNodeName.equalsIgnoreCase("bank_code"))
{ {
bankCode = checkNull(genericUtility.getColumnValue("bank_code", dom)); bankCode = checkNull(genericUtility.getColumnValue("bank_code", dom));
System.out.println("bank code="+bankCode); System.out.println("bank code="+bankCode);
/* Comment BY Nasruddin 21-sep-16 start
if(bankCode == null || bankCode.trim().length() == 0) if(bankCode == null || bankCode.trim().length() == 0)
{ {
errCode = "VMBANK1"; errCode = "VMBANK1";
errList.add(errCode); errList.add(errCode);
errFields.add(childNodeName.toLowerCase()); errFields.add(childNodeName.toLowerCase());
} }
else if(bankCode != null && bankCode.trim().length() > 0) Comment BY Nasruddin 21-sep-16 end */
if(bankCode != null && bankCode.trim().length() > 0)
{ {
sql = "select count(*) from bank where bank_code = ?"; sql = "select count(*) from bank where bank_code = ?";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
......
...@@ -64,8 +64,8 @@ public class SupplierItem extends ValidatorEJB implements SupplierItemLocal,Supp ...@@ -64,8 +64,8 @@ public class SupplierItem extends ValidatorEJB implements SupplierItemLocal,Supp
String errCode=""; String errCode="";
String errorType = ""; String errorType = "";
String childNodeName = null; String childNodeName = null;
String errString = ""; String errString = "", lockGroup = "", sql = "";
int ctr=0; int ctr=0, count = 0;
int childNodeListLength; int childNodeListLength;
ArrayList<String> errList = new ArrayList<String>(); ArrayList<String> errList = new ArrayList<String>();
ArrayList<String> errFields = new ArrayList<String>(); ArrayList<String> errFields = new ArrayList<String>();
...@@ -107,6 +107,39 @@ public class SupplierItem extends ValidatorEJB implements SupplierItemLocal,Supp ...@@ -107,6 +107,39 @@ public class SupplierItem extends ValidatorEJB implements SupplierItemLocal,Supp
errList.add(errCode); errList.add(errCode);
errFields.add(childNodeName.toLowerCase()); errFields.add(childNodeName.toLowerCase());
} }
//Changed By Nasruddin 22-SEP-16 START
else if(childNodeName.equalsIgnoreCase("lock_group"))
{
lockGroup = genericUtility.getColumnValue("lock_group", dom);
if(lockGroup != null && lockGroup.trim().length() > 0)
{
sql = "SELECT COUNT(1) FROM LOCK_GROUP Where LOCK_GROUP = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, lockGroup);
rs = pstmt.executeQuery();
if( rs.next() )
{
count = rs.getInt(1);
}
pstmt.close();
pstmt = null;
rs.close();
rs = null;
if( count == 0 )
{
errCode = "VMLOCKCODE";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}
}
//Changed By Nasruddin 22-SEP-16 END
}//end of for }//end of for
......
...@@ -88,18 +88,23 @@ public class TaxBaseIC extends ValidatorEJB implements TaxBaseICRemote, TaxBaseI ...@@ -88,18 +88,23 @@ public class TaxBaseIC extends ValidatorEJB implements TaxBaseICRemote, TaxBaseI
for (ctr = 0; ctr < childNodeLength; ctr++) { for (ctr = 0; ctr < childNodeLength; ctr++) {
childNode = childNodeList.item(ctr); childNode = childNodeList.item(ctr);
childNodeName = childNode.getNodeName(); childNodeName = childNode.getNodeName();
if (childNodeName.equalsIgnoreCase("tax_base")) { if (childNodeName.equalsIgnoreCase("tax_base"))
{
System.out.println(":::childNodeName" + childNodeName); System.out.println(":::childNodeName" + childNodeName);
String taxBase = genericUtility.getColumnValue("tax_base", dom); String taxBase = genericUtility.getColumnValue("tax_base", dom);
//String taxBase = childNode.getFirstChild().getNodeValue(); //String taxBase = childNode.getFirstChild().getNodeValue();
taxBase = taxBase == null ? "" : taxBase.trim(); taxBase = taxBase == null ? "" : taxBase.trim();
System.out.println("::: taxBase" + taxBase); System.out.println("::: taxBase" + taxBase);
if(taxBase.length() <= 0){ if(taxBase.length() <= 0)
{
errString = itmdbAccessEJB.getErrorString("tax_base", "VMTAXB1", userId); errString = itmdbAccessEJB.getErrorString("tax_base", "VMTAXB1", userId);
break; break;
} }
else{ /* Comment By Nasruddin Start 21-SEP-16 START
if(editFlag.equalsIgnoreCase("A")){ else
{
if(editFlag.equalsIgnoreCase("A"))
{
int count = 0; int count = 0;
sql = "select count(*) as count from taxbase where tax_base = ? "; sql = "select count(*) as count from taxbase where tax_base = ? ";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
...@@ -115,35 +120,43 @@ public class TaxBaseIC extends ValidatorEJB implements TaxBaseICRemote, TaxBaseI ...@@ -115,35 +120,43 @@ public class TaxBaseIC extends ValidatorEJB implements TaxBaseICRemote, TaxBaseI
} }
} }
}Comment By Nasruddin Start 21-SEP-16 END*/
} }
} if(childNodeName.equalsIgnoreCase("descr"))
if(childNodeName.equalsIgnoreCase("descr")){ {
String descr = genericUtility.getColumnValue("descr", dom); String descr = genericUtility.getColumnValue("descr", dom);
//String descr = childNode.getFirstChild().getNodeValue(); //String descr = childNode.getFirstChild().getNodeValue();
descr = descr == null ? "" : descr.trim(); descr = descr == null ? "" : descr.trim();
System.out.println("::: descr" + descr); System.out.println("::: descr" + descr);
if(descr.length() <= 0){ if(descr.length() <= 0)
{
errString = itmdbAccessEJB.getErrorString("descr", "VMDESCR", userId); errString = itmdbAccessEJB.getErrorString("descr", "VMDESCR", userId);
break; break;
} }
} }
if(childNodeName.equalsIgnoreCase("apply_on")){ if(childNodeName.equalsIgnoreCase("apply_on"))
{
String applyOn = genericUtility.getColumnValue("apply_on", dom); String applyOn = genericUtility.getColumnValue("apply_on", dom);
//String applyOn = childNode.getFirstChild().getNodeValue(); //String applyOn = childNode.getFirstChild().getNodeValue();
applyOn = applyOn == null ? "" : applyOn.trim(); applyOn = applyOn == null ? "" : applyOn.trim();
System.out.println("::: applyOn " + applyOn); System.out.println("::: applyOn " + applyOn);
if(applyOn.length() <= 0){ if(applyOn.length() <= 0)
{
errString = itmdbAccessEJB.getErrorString("apply_on", "VMAPPON1", userId); errString = itmdbAccessEJB.getErrorString("apply_on", "VMAPPON1", userId);
break; break;
} }
} }
if(childNodeName.equalsIgnoreCase("apply_perc")){
if(childNodeName.equalsIgnoreCase("apply_perc"))
{
String applyPerc = genericUtility.getColumnValue("apply_perc", dom); String applyPerc = genericUtility.getColumnValue("apply_perc", dom);
//String applyPerc = childNode.getFirstChild().getNodeValue(); //String applyPerc = childNode.getFirstChild().getNodeValue();
applyPerc = applyPerc == null ? "" : applyPerc.trim(); applyPerc = applyPerc == null ? "" : applyPerc.trim();
System.out.println("::: applyPerc " + applyPerc); System.out.println("::: applyPerc " + applyPerc);
if(editFlag.equalsIgnoreCase("A") || editFlag.equalsIgnoreCase("E")){ if(editFlag.equalsIgnoreCase("A") || editFlag.equalsIgnoreCase("E"))
if(applyPerc.length() <= 0){ {
if(applyPerc.length() <= 0)
{
errString = itmdbAccessEJB.getErrorString("apply_perc", "VMAPPLPERC", userId); errString = itmdbAccessEJB.getErrorString("apply_perc", "VMAPPLPERC", userId);
break; break;
} }
...@@ -159,33 +172,42 @@ public class TaxBaseIC extends ValidatorEJB implements TaxBaseICRemote, TaxBaseI ...@@ -159,33 +172,42 @@ public class TaxBaseIC extends ValidatorEJB implements TaxBaseICRemote, TaxBaseI
for (ctr = 0; ctr < childNodeLength; ctr++) { for (ctr = 0; ctr < childNodeLength; ctr++) {
childNode = childNodeList.item(ctr); childNode = childNodeList.item(ctr);
childNodeName = childNode.getNodeName(); childNodeName = childNode.getNodeName();
if(childNodeName.equalsIgnoreCase("tax_base")){ if(childNodeName.equalsIgnoreCase("tax_base"))
{
String tax = genericUtility.getColumnValue("tax_base", dom); String tax = genericUtility.getColumnValue("tax_base", dom);
//String tax = childNode.getFirstChild().getNodeValue(); //String tax = childNode.getFirstChild().getNodeValue();
System.out.println(":::tax" + tax); System.out.println(":::tax" + tax);
tax = tax == null ? "" : tax.trim(); tax = tax == null ? "" : tax.trim();
if(tax.length() <= 0){ if(tax.length() <= 0)
{
errString = itmdbAccessEJB.getErrorString("tax_base", "VMTAXB1", userId); errString = itmdbAccessEJB.getErrorString("tax_base", "VMTAXB1", userId);
break; break;
} }
} }
if(childNodeName.equalsIgnoreCase("tax_code")){ if(childNodeName.equalsIgnoreCase("tax_code"))
{
String taxCode = genericUtility.getColumnValue("tax_code", dom); String taxCode = genericUtility.getColumnValue("tax_code", dom);
//String taxCode = childNode.getFirstChild().getNodeValue(); //String taxCode = childNode.getFirstChild().getNodeValue();
taxCode = taxCode == null ? "" : taxCode.trim(); taxCode = taxCode == null ? "" : taxCode.trim();
if(taxCode.length() <= 0){ /* Comment By Nasrrudn 21-SEP-16 START
if(taxCode.length() <= 0)
{
errString = itmdbAccessEJB.getErrorString("tax_code", "VTTAXC", userId); errString = itmdbAccessEJB.getErrorString("tax_code", "VTTAXC", userId);
break; break;
}else { }
//else Comment By Nasrrudn 21-SEP-16 END*/
//{
int count = 0; int count = 0;
sql = "select count(*) as count from tax where tax_code = ?"; sql = "select count(*) as count from tax where tax_code = ?";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, taxCode); pstmt.setString(1, taxCode);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
if(rs.next()){ if(rs.next())
{
count = rs.getInt("count"); count = rs.getInt("count");
} }
if(count <= 0){ if(count <= 0)
{
errString = itmdbAccessEJB.getErrorString("tax_code", "VTTAX1", userId); errString = itmdbAccessEJB.getErrorString("tax_code", "VTTAX1", userId);
break; break;
} }
...@@ -193,28 +215,59 @@ public class TaxBaseIC extends ValidatorEJB implements TaxBaseICRemote, TaxBaseI ...@@ -193,28 +215,59 @@ public class TaxBaseIC extends ValidatorEJB implements TaxBaseICRemote, TaxBaseI
rs = null; rs = null;
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
//}
} }
} if(childNodeName.equalsIgnoreCase("seq_no"))
if(childNodeName.equalsIgnoreCase("seq_no")){ {
String seqNo = genericUtility.getColumnValue("seq_no", dom); String seqNo = genericUtility.getColumnValue("seq_no", dom);
//String seqNo = childNode.getFirstChild().getNodeValue(); //String seqNo = childNode.getFirstChild().getNodeValue();
seqNo = seqNo == null ? "" : seqNo.trim(); seqNo = seqNo == null ? "" : seqNo.trim();
if(seqNo.length() <= 0){ if(seqNo.length() <= 0)
{
errString = itmdbAccessEJB.getErrorString("seq_no", "VMSEQNO", userId); errString = itmdbAccessEJB.getErrorString("seq_no", "VMSEQNO", userId);
break; break;
} }
if(!seqNo.matches("\\d+")){ if(!seqNo.matches("\\d+")){
errString = itmdbAccessEJB.getErrorString("seq_no", "VTSEQINV", userId); errString = itmdbAccessEJB.getErrorString("seq_no", "VTSEQINV", userId);
} }
} }
} }
} }
}catch(Exception e) }
catch(Exception e)
{ {
System.out.println(":::" + this.getClass().getSimpleName() + ":::" + e.getMessage()); System.out.println(":::" + this.getClass().getSimpleName() + ":::" + e.getMessage());
e.printStackTrace(); e.printStackTrace();
} }
// Changed By Nasruddin 21-SEP-16 STart
finally
{
try
{
if(conn != null)
{
if(rs != null)
{
rs.close();
rs = null;
}
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
conn.close();
}
conn = null;
}
catch(Exception d)
{
d.printStackTrace();
throw new ITMException(d);
}
} // Changed By Nasruddin 21-SEP-16 STart
return errString; return errString;
} }
public String itemChanged(String xmlString, String xmlString1,String xmlString2, String objContext, String currentColumn, String editFlag, public String itemChanged(String xmlString, String xmlString1,String xmlString2, String objContext, String currentColumn, String editFlag,
......
...@@ -90,15 +90,19 @@ public class TaxDefermentIC extends ValidatorEJB implements TaxDefermentICRemote ...@@ -90,15 +90,19 @@ public class TaxDefermentIC extends ValidatorEJB implements TaxDefermentICRemote
for (ctr = 0; ctr < childNodeLength; ctr++) { for (ctr = 0; ctr < childNodeLength; ctr++) {
childNode = childNodeList.item(ctr); childNode = childNodeList.item(ctr);
childNodeName = childNode.getNodeName(); childNodeName = childNode.getNodeName();
if(childNodeName.equalsIgnoreCase("site_code")){ if(childNodeName.equalsIgnoreCase("site_code"))
{
siteCode = genericUtility.getColumnValue("site_code", dom); siteCode = genericUtility.getColumnValue("site_code", dom);
//siteCode = childNode.getFirstChild().getNodeValue(); //siteCode = childNode.getFirstChild().getNodeValue();
siteCode = siteCode == null ? "" : siteCode.trim(); siteCode = siteCode == null ? "" : siteCode.trim();
System.out.println("site code :::" + siteCode); System.out.println("site code :::" + siteCode);
if(siteCode.isEmpty()){ if(siteCode.isEmpty())
errString = itmdbAccessEJB.getErrorString("site_code", "VPBLKSITE", userId); {
errString = itmdbAccessEJB.getErrorString("site_code", "VMSITECD1", userId);
return errString; return errString;
}else{ }
else
{
int count = 0; int count = 0;
sql = "select count(*) as count from site where site_code = ? "; sql = "select count(*) as count from site where site_code = ? ";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
...@@ -107,7 +111,8 @@ public class TaxDefermentIC extends ValidatorEJB implements TaxDefermentICRemote ...@@ -107,7 +111,8 @@ public class TaxDefermentIC extends ValidatorEJB implements TaxDefermentICRemote
if(rs.next()){ if(rs.next()){
count = rs.getInt("count"); count = rs.getInt("count");
} }
if(count == 0){ if(count == 0)
{
errString = itmdbAccessEJB.getErrorString("site_code", "VMSITE1", userId); errString = itmdbAccessEJB.getErrorString("site_code", "VMSITE1", userId);
return errString; return errString;
} }
...@@ -117,7 +122,9 @@ public class TaxDefermentIC extends ValidatorEJB implements TaxDefermentICRemote ...@@ -117,7 +122,9 @@ public class TaxDefermentIC extends ValidatorEJB implements TaxDefermentICRemote
pstmt = null; pstmt = null;
} }
} }
if(childNodeName.equalsIgnoreCase("tran_type")){ /*Comment By Nasruddin 21-SEp-16 STart
if(childNodeName.equalsIgnoreCase("tran_type"))
{
tranType = genericUtility.getColumnValue("tran_type", dom); tranType = genericUtility.getColumnValue("tran_type", dom);
//tranType = childNode.getFirstChild().getNodeValue(); //tranType = childNode.getFirstChild().getNodeValue();
tranType = tranType == null ? "" : tranType.trim(); tranType = tranType == null ? "" : tranType.trim();
...@@ -160,26 +167,33 @@ public class TaxDefermentIC extends ValidatorEJB implements TaxDefermentICRemote ...@@ -160,26 +167,33 @@ public class TaxDefermentIC extends ValidatorEJB implements TaxDefermentICRemote
} }
} }
} }Comment By Nasruddin 21-SEp-16 END*/
if(childNodeName.equalsIgnoreCase("site_code__for")){ if(childNodeName.equalsIgnoreCase("site_code__for"))
{
siteCodeFor = genericUtility.getColumnValue("site_code__for", dom); siteCodeFor = genericUtility.getColumnValue("site_code__for", dom);
//siteCodeFor = childNode.getFirstChild().getNodeValue(); //siteCodeFor = childNode.getFirstChild().getNodeValue();
siteCodeFor = siteCodeFor == null ? "" : siteCodeFor.trim(); siteCodeFor = siteCodeFor == null ? "" : siteCodeFor.trim();
System.out.println("site code for :::::" + siteCodeFor); System.out.println("site code for :::::" + siteCodeFor);
if(siteCodeFor.isEmpty()){ if(siteCodeFor.isEmpty())
errString = itmdbAccessEJB.getErrorString("site_code__for", "VPBLKSITE", userId); {
errString = itmdbAccessEJB.getErrorString("site_code__for", "VMSITECD1", userId);
return errString; return errString;
}else{ }
else
{
int count = 0; int count = 0;
sql = "select count(*) as count from site where site_code = ? "; sql = "select count(*) as count from site where site_code = ? ";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, siteCodeFor); pstmt.setString(1, siteCodeFor);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
if(rs.next()){ if(rs.next())
{
count = rs.getInt("count"); count = rs.getInt("count");
} }
if(count == 0){ if(count == 0)
{
errString = itmdbAccessEJB.getErrorString("site_code__for", "VMSITE1", userId); errString = itmdbAccessEJB.getErrorString("site_code__for", "VMSITE1", userId);
return errString; return errString;
} }
...@@ -189,12 +203,14 @@ public class TaxDefermentIC extends ValidatorEJB implements TaxDefermentICRemote ...@@ -189,12 +203,14 @@ public class TaxDefermentIC extends ValidatorEJB implements TaxDefermentICRemote
pstmt = null; pstmt = null;
} }
} }
if(childNodeName.equalsIgnoreCase("tax_code")){ if(childNodeName.equalsIgnoreCase("tax_code"))
{
taxCode = genericUtility.getColumnValue("tax_code", dom); taxCode = genericUtility.getColumnValue("tax_code", dom);
//taxCode = childNode.getFirstChild().getNodeValue(); //taxCode = childNode.getFirstChild().getNodeValue();
taxCode = taxCode == null ? "" : taxCode.trim(); taxCode = taxCode == null ? "" : taxCode.trim();
System.out.println("tax code :::" + taxCode); System.out.println("tax code :::" + taxCode);
if(taxCode.isEmpty()){ if(taxCode.isEmpty())
{
errString = itmdbAccessEJB.getErrorString("tax_code", "VTTAXC", userId); errString = itmdbAccessEJB.getErrorString("tax_code", "VTTAXC", userId);
return errString; return errString;
} }
......
...@@ -59,9 +59,9 @@ public class TaxIC extends ValidatorEJB implements TaxICLocal, TaxICRemote ...@@ -59,9 +59,9 @@ public class TaxIC extends ValidatorEJB implements TaxICLocal, TaxICRemote
public String wfValData(Document dom, Document dom1, Document dom2, String objContext, String editFlag, String xtraParams) throws RemoteException,ITMException public String wfValData(Document dom, Document dom1, Document dom2, String objContext, String editFlag, String xtraParams) throws RemoteException,ITMException
{ {
String acctCode = ""; String acctCode = "", acctCodeRevr = "";
String active = ""; String active = "";
String cctrCode = ""; String cctrCode = "", cctrCodeRevr = "";
String tauthCode = ""; String tauthCode = "";
String taxGroup = ""; String taxGroup = "";
String taxCode = ""; String taxCode = "";
...@@ -144,8 +144,8 @@ public class TaxIC extends ValidatorEJB implements TaxICLocal, TaxICRemote ...@@ -144,8 +144,8 @@ public class TaxIC extends ValidatorEJB implements TaxICLocal, TaxICRemote
pstmt = null; pstmt = null;
}*/ }*/
} }
/* Comment By Nasruddin 21-SEp-16 Start
else if(childNodeName.equalsIgnoreCase("curr_code")) else if(childNodeName.equalsIgnoreCase("curr_code"))
{ {
currCode = checkNull(genericUtility.getColumnValue("curr_code", dom)); currCode = checkNull(genericUtility.getColumnValue("curr_code", dom));
...@@ -171,20 +171,22 @@ public class TaxIC extends ValidatorEJB implements TaxICLocal, TaxICRemote ...@@ -171,20 +171,22 @@ public class TaxIC extends ValidatorEJB implements TaxICLocal, TaxICRemote
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
} }
} }Comment By Nasruddin 21-SEp-16 End*/
else if(childNodeName.equalsIgnoreCase("tax_group")) else if(childNodeName.equalsIgnoreCase("tax_group"))
{ {
taxGroup = checkNull(genericUtility.getColumnValue("tax_group", dom)); taxGroup = checkNull(genericUtility.getColumnValue("tax_group", dom));
taxCode = checkNull(genericUtility.getColumnValue("tax_code", dom)); taxCode = checkNull(genericUtility.getColumnValue("tax_code", dom));
System.out.println("212 taxGroup="+taxGroup); System.out.println("212 taxGroup="+taxGroup);
System.out.println("213 taxCode="+taxCode); System.out.println("213 taxCode="+taxCode);
/* Comment BY Nasruddin 21-SEP-16 START
if(taxGroup == null || taxGroup.trim().length() == 0) if(taxGroup == null || taxGroup.trim().length() == 0)
{ {
errCode = "VMTAXGRP"; errCode = "VMTAXGRP";
errList.add(errCode); errList.add(errCode);
errFields.add(childNodeName.toLowerCase()); errFields.add(childNodeName.toLowerCase());
} } Comment BY Nasruddin 21-SEP-16 END*/
else if(!taxCode.equalsIgnoreCase(taxGroup))
if(!taxCode.equalsIgnoreCase(taxGroup))
{ {
sql = "select count(*) from tax where tax_code = ?"; sql = "select count(*) from tax where tax_code = ?";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
...@@ -206,6 +208,7 @@ public class TaxIC extends ValidatorEJB implements TaxICLocal, TaxICRemote ...@@ -206,6 +208,7 @@ public class TaxIC extends ValidatorEJB implements TaxICLocal, TaxICRemote
pstmt = null; pstmt = null;
} }
} }
/* Comment By Nasruddin 21-Sep-16 Start
else if(childNodeName.equalsIgnoreCase("descr")) else if(childNodeName.equalsIgnoreCase("descr"))
{ {
descr = checkNull(genericUtility.getColumnValue("descr", dom)); descr = checkNull(genericUtility.getColumnValue("descr", dom));
...@@ -216,7 +219,7 @@ public class TaxIC extends ValidatorEJB implements TaxICLocal, TaxICRemote ...@@ -216,7 +219,7 @@ public class TaxIC extends ValidatorEJB implements TaxICLocal, TaxICRemote
errList.add(errCode); errList.add(errCode);
errFields.add(childNodeName.toLowerCase()); errFields.add(childNodeName.toLowerCase());
} }
} }Comment By Nasruddin 21-Sep-16 End*/
else if(childNodeName.equalsIgnoreCase("acct_code")) else if(childNodeName.equalsIgnoreCase("acct_code"))
{ {
acctCode = checkNull(genericUtility.getColumnValue("acct_code", dom)); acctCode = checkNull(genericUtility.getColumnValue("acct_code", dom));
...@@ -290,6 +293,81 @@ public class TaxIC extends ValidatorEJB implements TaxICLocal, TaxICRemote ...@@ -290,6 +293,81 @@ public class TaxIC extends ValidatorEJB implements TaxICLocal, TaxICRemote
pstmt = null; pstmt = null;
} }
} }
// Changed By nasruddin 21-SEp-16 Start
else if(childNodeName.equalsIgnoreCase("cctr_code__revr"))
{
cctrCodeRevr = checkNull(genericUtility.getColumnValue("cctr_code__revr", dom));
if(cctrCodeRevr != null && cctrCodeRevr.trim().length() > 0)
{
sql = "select count(*) from costctr where cctr_code = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,cctrCodeRevr);
rs = pstmt.executeQuery();
if(rs.next())
{
count = rs.getInt(1);
}
if(count == 0)
{
errCode = "VMCCTRCD1";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
}
}
else if(childNodeName.equalsIgnoreCase("acct_code__revr"))
{
acctCodeRevr = checkNull(genericUtility.getColumnValue("acct_code__revr", dom));
System.out.println("acctCodeRevr="+acctCodeRevr);
if(acctCodeRevr != null && acctCodeRevr.trim().length() > 0)
{
sql = "SELECT count(*) from accounts where acct_code = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,acctCodeRevr);
rs = pstmt.executeQuery();
if(rs.next())
{
count = rs.getInt(1);
}
if(count == 0)
{
errCode = "VMACCTA";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
else
{
sql2 = "select active from accounts where acct_code = ?";
pstmt2 = conn.prepareStatement(sql2);
pstmt2.setString(1,acctCodeRevr);
rs2 = pstmt2.executeQuery();
if(rs2.next())
{
active = rs2.getString(1);
}
if(active != null && active.equalsIgnoreCase("Y"))
{
errCode = "VMACCTA";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
rs2.close();
rs2 = null;
pstmt2.close();
pstmt2 = null;
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
}
}
// Changed By nasruddin 21-SEp-16 END
else if(childNodeName.equalsIgnoreCase("tauth_code")) else if(childNodeName.equalsIgnoreCase("tauth_code"))
{ {
tauthCode = checkNull(genericUtility.getColumnValue("tauth_code", dom)); tauthCode = checkNull(genericUtility.getColumnValue("tauth_code", dom));
...@@ -315,7 +393,7 @@ public class TaxIC extends ValidatorEJB implements TaxICLocal, TaxICRemote ...@@ -315,7 +393,7 @@ public class TaxIC extends ValidatorEJB implements TaxICLocal, TaxICRemote
pstmt = null; pstmt = null;
} }
} }
/*Comment By Nasruddin 21-SEp-16 START
else if(childNodeName.equalsIgnoreCase("tax_method")) else if(childNodeName.equalsIgnoreCase("tax_method"))
{ {
taxMethod = checkNull(genericUtility.getColumnValue("tax_method", dom)); taxMethod = checkNull(genericUtility.getColumnValue("tax_method", dom));
...@@ -341,7 +419,7 @@ public class TaxIC extends ValidatorEJB implements TaxICLocal, TaxICRemote ...@@ -341,7 +419,7 @@ public class TaxIC extends ValidatorEJB implements TaxICLocal, TaxICRemote
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
} }
} }Comment By Nasruddin 21-SEp-16 END*/
else if(childNodeName.equalsIgnoreCase("bal_group")) else if(childNodeName.equalsIgnoreCase("bal_group"))
{ {
balGroup = checkNull(genericUtility.getColumnValue("bal_group", dom)); balGroup = checkNull(genericUtility.getColumnValue("bal_group", dom));
......
...@@ -80,7 +80,7 @@ implements TaxRateICLocal, TaxRateICRemote ...@@ -80,7 +80,7 @@ implements TaxRateICLocal, TaxRateICRemote
String errorType = ""; String errorType = "";
String errString = ""; String errString = "";
String siteCode = ""; String siteCode = "";
String taxCode = ""; String taxCode = "", taxSet ="";
String taxClass = ""; String taxClass = "";
String sql = ""; String sql = "";
String taxChap = ""; String taxChap = "";
...@@ -158,7 +158,10 @@ implements TaxRateICLocal, TaxRateICRemote ...@@ -158,7 +158,10 @@ implements TaxRateICLocal, TaxRateICRemote
else if(childNodeName.equalsIgnoreCase("tax_class")) else if(childNodeName.equalsIgnoreCase("tax_class"))
{ {
taxClass=checkNull(this.genericUtility.getColumnValue("tax_class", dom)); taxClass=checkNull(this.genericUtility.getColumnValue("tax_class", dom));
sql="Select Count(*) from taxclass where tax_class = ?"; sql="Select Count(*) from taxclass where tax_class = ?";
if(taxClass.trim().length() > 0)//cHANGED bY nasruddin 21-SEP16
{
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1,taxClass); pstmt.setString(1,taxClass);
rs=pstmt.executeQuery(); rs=pstmt.executeQuery();
...@@ -169,7 +172,7 @@ implements TaxRateICLocal, TaxRateICRemote ...@@ -169,7 +172,7 @@ implements TaxRateICLocal, TaxRateICRemote
} }
if(cnt==0) if(cnt==0)
{ {
errCode = "VTTAX1"; errCode = "VTCLASS1";
errList.add(errCode); errList.add(errCode);
errFields.add(childNodeName.toLowerCase()); errFields.add(childNodeName.toLowerCase());
} }
...@@ -178,6 +181,9 @@ implements TaxRateICLocal, TaxRateICRemote ...@@ -178,6 +181,9 @@ implements TaxRateICLocal, TaxRateICRemote
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
} }
}
/* Comment By Nasruddin End 21-SEP-16 START
else if(childNodeName.equalsIgnoreCase("slab_base")) else if(childNodeName.equalsIgnoreCase("slab_base"))
{ {
slabBase=this.genericUtility.getColumnValue("slab_base", dom); slabBase=this.genericUtility.getColumnValue("slab_base", dom);
...@@ -189,10 +195,12 @@ implements TaxRateICLocal, TaxRateICRemote ...@@ -189,10 +195,12 @@ implements TaxRateICLocal, TaxRateICRemote
} }
} }
Comment By Nasruddin End 21-SEP-16 END*/
else if(childNodeName.equalsIgnoreCase("tax_chap")) else if(childNodeName.equalsIgnoreCase("tax_chap"))
{ {
taxChap=checkNull(this.genericUtility.getColumnValue("tax_chap", dom)); taxChap=checkNull(this.genericUtility.getColumnValue("tax_chap", dom));
if(taxChap.trim().length() > 0)//cHANGED bY nasruddin 21-SEP16
{
sql="Select Count(*) from taxchap where tax_chap = ?"; sql="Select Count(*) from taxchap where tax_chap = ?";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1,taxChap); pstmt.setString(1,taxChap);
...@@ -213,6 +221,7 @@ implements TaxRateICLocal, TaxRateICRemote ...@@ -213,6 +221,7 @@ implements TaxRateICLocal, TaxRateICRemote
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
} }
}
else if(childNodeName.equalsIgnoreCase("tax_base")) else if(childNodeName.equalsIgnoreCase("tax_base"))
{ {
taxBase=checkNull(this.genericUtility.getColumnValue("tax_base", dom)); taxBase=checkNull(this.genericUtility.getColumnValue("tax_base", dom));
...@@ -249,7 +258,9 @@ implements TaxRateICLocal, TaxRateICRemote ...@@ -249,7 +258,9 @@ implements TaxRateICLocal, TaxRateICRemote
} }
} }
else if(childNodeName.equalsIgnoreCase("acct_code__reco") || childNodeName.equalsIgnoreCase("acct_code")) // Changed By Nasruddin 21-SEP-16 START
else if(childNodeName.equalsIgnoreCase("acct_code__reco") || childNodeName.equalsIgnoreCase("acct_code") || childNodeName.equalsIgnoreCase("acct_code__revr"))
//else if(childNodeName.equalsIgnoreCase("acct_code__reco") || childNodeName.equalsIgnoreCase("acct_code"))
{ {
if(childNodeName.equalsIgnoreCase("acct_code__reco")) if(childNodeName.equalsIgnoreCase("acct_code__reco"))
{ {
...@@ -259,7 +270,10 @@ implements TaxRateICLocal, TaxRateICRemote ...@@ -259,7 +270,10 @@ implements TaxRateICLocal, TaxRateICRemote
{ {
acctCode= checkNull(this.genericUtility.getColumnValue("acct_code", dom)); acctCode= checkNull(this.genericUtility.getColumnValue("acct_code", dom));
} }
else if(childNodeName.equalsIgnoreCase("acct_code__revr"))
{
acctCode= checkNull(this.genericUtility.getColumnValue("acct_code__revr", dom));
}
if(acctCode != null && acctCode.trim().length() > 0) if(acctCode != null && acctCode.trim().length() > 0)
{ {
sql = "select count(*) from accounts where acct_code = ?"; sql = "select count(*) from accounts where acct_code = ?";
...@@ -296,7 +310,9 @@ implements TaxRateICLocal, TaxRateICRemote ...@@ -296,7 +310,9 @@ implements TaxRateICLocal, TaxRateICRemote
} }
} }
else if(childNodeName.equalsIgnoreCase("cctr_code__reco") || childNodeName.equalsIgnoreCase("cctr_code")) // Changed By Nasruddin 21-SEP-16
else if(childNodeName.equalsIgnoreCase("cctr_code__reco") || childNodeName.equalsIgnoreCase("cctr_code") || childNodeName.equalsIgnoreCase("cctr_code__revr"))
//else if(childNodeName.equalsIgnoreCase("cctr_code__reco") || childNodeName.equalsIgnoreCase("cctr_code"))
{ {
if(childNodeName.equalsIgnoreCase("cctr_code__reco")) if(childNodeName.equalsIgnoreCase("cctr_code__reco"))
{ {
...@@ -306,7 +322,10 @@ implements TaxRateICLocal, TaxRateICRemote ...@@ -306,7 +322,10 @@ implements TaxRateICLocal, TaxRateICRemote
{ {
cctrCode= checkNull(this.genericUtility.getColumnValue("cctr_code", dom)); cctrCode= checkNull(this.genericUtility.getColumnValue("cctr_code", dom));
} }
else if(childNodeName.equalsIgnoreCase("cctr_code"))
{
cctrCode= checkNull(this.genericUtility.getColumnValue("cctr_code__revr", dom));
}
if(acctCode != null && acctCode.trim().length() > 0) if(acctCode != null && acctCode.trim().length() > 0)
{ {
......
...@@ -100,6 +100,7 @@ public class TaxRevision extends ValidatorEJB implements TaxRevisionLocal,TaxRev ...@@ -100,6 +100,7 @@ public class TaxRevision extends ValidatorEJB implements TaxRevisionLocal,TaxRev
{ {
childNode = childNodeList.item(ctr); childNode = childNodeList.item(ctr);
childNodeName = childNode.getNodeName(); childNodeName = childNode.getNodeName();
/* Comment By Nasruddin 21-SEp-16 Start
if(childNodeName.equalsIgnoreCase("tran_id")) if(childNodeName.equalsIgnoreCase("tran_id"))
{ {
tranId = genericUtility.getColumnValue("tran_id", dom); tranId = genericUtility.getColumnValue("tran_id", dom);
...@@ -162,15 +163,21 @@ public class TaxRevision extends ValidatorEJB implements TaxRevisionLocal,TaxRev ...@@ -162,15 +163,21 @@ public class TaxRevision extends ValidatorEJB implements TaxRevisionLocal,TaxRev
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
} }
Comment By Nasruddin 21-SEp-16 End;
*/
else if(childNodeName.equalsIgnoreCase("tax_chap__old")) if(childNodeName.equalsIgnoreCase("tax_chap__old"))
{ {
/*
Comment By Nasruddin 21-Sep-16 Start
if ( childNode.getFirstChild() == null ) if ( childNode.getFirstChild() == null )
{ {
errCode = "VMSTCDNULL"; errCode = "VMSTCDNULL";
errList.add( errCode ); errList.add( errCode );
errFields.add( childNodeName.toLowerCase() ); errFields.add( childNodeName.toLowerCase() );
} }
Comment By Nasruddin Start 21-Sep-16 END
*/
taxChapOld = genericUtility.getColumnValue("tax_chap__old", dom); taxChapOld = genericUtility.getColumnValue("tax_chap__old", dom);
sql = "select count(*) from taxchap where tax_chap = ?"; sql = "select count(*) from taxchap where tax_chap = ?";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
...@@ -180,26 +187,29 @@ public class TaxRevision extends ValidatorEJB implements TaxRevisionLocal,TaxRev ...@@ -180,26 +187,29 @@ public class TaxRevision extends ValidatorEJB implements TaxRevisionLocal,TaxRev
{ {
cnt = rs.getInt(1); cnt = rs.getInt(1);
} }
rs.close();
rs = null;
pstmt.close();
pstmt = null;
if(cnt <= 0) if(cnt <= 0)
{ {
errCode = "VTTAXCHAP1"; errCode = "VTTAXCHAP1";
errList.add(errCode); errList.add(errCode);
errFields.add(childNodeName.toLowerCase()); errFields.add(childNodeName.toLowerCase());
} }
rs.close();
rs = null;
pstmt.close();
pstmt = null;
}
}
else if(childNodeName.equalsIgnoreCase("tax_chap__new")) else if(childNodeName.equalsIgnoreCase("tax_chap__new"))
{ {
/*
* Comment By Nasruddin 21-SEp-16 Start
if ( childNode.getFirstChild() == null ) if ( childNode.getFirstChild() == null )
{ {
errCode = "VMSTCDNUL1"; errCode = "VMSTCDNUL1";
errList.add( errCode ); errList.add( errCode );
errFields.add( childNodeName.toLowerCase() ); errFields.add( childNodeName.toLowerCase() );
} }
Comment By Nasruddin 21-SEp-16 END */
taxChapNew = genericUtility.getColumnValue("tax_chap__new", dom); taxChapNew = genericUtility.getColumnValue("tax_chap__new", dom);
sql = "select count(*) from taxchap where tax_chap = ? "; sql = "select count(*) from taxchap where tax_chap = ? ";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
...@@ -209,16 +219,91 @@ public class TaxRevision extends ValidatorEJB implements TaxRevisionLocal,TaxRev ...@@ -209,16 +219,91 @@ public class TaxRevision extends ValidatorEJB implements TaxRevisionLocal,TaxRev
{ {
cnt = rs.getInt(1); cnt = rs.getInt(1);
} }
rs.close();
rs = null;
pstmt.close();
pstmt = null;
if(cnt <=0) if(cnt <=0)
{ {
errCode = "VTTAXCHAP1"; errCode = "VTTAXCHAP1";
errList.add(errCode); errList.add(errCode);
errFields.add(childNodeName.toLowerCase()); errFields.add(childNodeName.toLowerCase());
} }
//Changed By nasruddin 21-Sep-16 Start
else
{
sql = "SELECT COUNT(1) FROM TAXSET WHERE TAX_CHAP = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,taxChapNew);
rs = pstmt.executeQuery();
if(rs.next())
{
cnt = rs.getInt(1);
}
rs.close(); rs.close();
rs = null; rs = null;
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
if(cnt >0)
{
errCode = "VTTAXCHAP2";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
else
{
taxChapOld = genericUtility.getColumnValue("tax_chap__old", dom);
tranId = genericUtility.getColumnValue("tran_id", dom);
cnt = 0;
if(tranId != null && tranId.trim().length() > 0)
{
sql = "SELECT COUNT(1) FROM TAX_REVISION WHERE ( TAX_REVISION.TAX_CHAP__OLD = ?) AND ( TAX_REVISION.TAX_CHAP__NEW = ? ) AND ( TAX_REVISION.TRAN_ID <> ?)";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, taxChapOld);
pstmt.setString(2, taxChapNew);
pstmt.setString(3, tranId);
rs = pstmt.executeQuery();
if(rs.next())
{
cnt = rs.getInt(1);
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
}
else
{
sql = "SELECT COUNT(1) FROM TAX_REVISION WHERE ( TAX_REVISION.TAX_CHAP__OLD = ?) AND ( TAX_REVISION.TAX_CHAP__NEW = ? )";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, taxChapOld);
pstmt.setString(2, taxChapNew);
rs = pstmt.executeQuery();
if(rs.next())
{
cnt = rs.getInt(1);
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
}
if( cnt > 0)
{
errCode = "VTTAXRDUP";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}
}
// Changed By nasruddin 21-SEP-16 ENd
} }
} }
break; break;
......
...@@ -5,15 +5,12 @@ import java.rmi.RemoteException; ...@@ -5,15 +5,12 @@ import java.rmi.RemoteException;
import java.sql.Connection; import java.sql.Connection;
import java.sql.PreparedStatement; import java.sql.PreparedStatement;
import java.sql.ResultSet; import java.sql.ResultSet;
import ibase.system.config.ConnDriver; import ibase.system.config.ConnDriver;
import ibase.webitm.ejb.ITMDBAccessEJB; import ibase.webitm.ejb.ITMDBAccessEJB;
import ibase.webitm.ejb.ValidatorEJB; import ibase.webitm.ejb.ValidatorEJB;
import ibase.webitm.utility.GenericUtility; import ibase.webitm.utility.GenericUtility;
import ibase.webitm.utility.ITMException; import ibase.webitm.utility.ITMException;
import javax.ejb.Stateless; import javax.ejb.Stateless;
import org.w3c.dom.Document; import org.w3c.dom.Document;
import org.w3c.dom.Node; import org.w3c.dom.Node;
import org.w3c.dom.NodeList; import org.w3c.dom.NodeList;
...@@ -86,50 +83,66 @@ public class TransporterModeIC extends ValidatorEJB implements TransporterModeIC ...@@ -86,50 +83,66 @@ public class TransporterModeIC extends ValidatorEJB implements TransporterModeIC
parentNode = parentNodeList.item(0); parentNode = parentNodeList.item(0);
childNodeList = parentNode.getChildNodes(); childNodeList = parentNode.getChildNodes();
childNodeLength = childNodeList.getLength(); childNodeLength = childNodeList.getLength();
for (ctr = 0; ctr < childNodeLength; ctr++) { for (ctr = 0; ctr < childNodeLength; ctr++)
{
childNode = childNodeList.item(ctr); childNode = childNodeList.item(ctr);
childNodeName = childNode.getNodeName(); childNodeName = childNode.getNodeName();
if(childNodeName.equalsIgnoreCase("tran_code")){ if(childNodeName.equalsIgnoreCase("tran_code"))
{
tranCode = genericUtility.getColumnValue("tran_code", dom); tranCode = genericUtility.getColumnValue("tran_code", dom);
tranCode = tranCode == null ? "" : tranCode.trim(); tranCode = tranCode == null ? "" : tranCode.trim();
System.out.println("transporter code ::::" + tranCode); System.out.println("transporter code ::::" + tranCode);
if(tranCode.isEmpty()){ if(tranCode.isEmpty())
errString = itmdbAccessEJB.getErrorString("tran_code", "VTBLTRSC", userId); {
errString = itmdbAccessEJB.getErrorString("tran_code", "VMCODNULL", userId);
return errString; return errString;
}else{ }
else
{
int count = 0; int count = 0;
sql = "select count(*) as count from transporter where tran_code = ?"; sql = "select count(*) as count from transporter where tran_code = ?";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, tranCode); pstmt.setString(1, tranCode);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
if(rs.next()){ if(rs.next())
{
count = rs.getInt("count"); count = rs.getInt("count");
} }
rs.close(); rs.close();
rs = null; rs = null;
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
if(count == 0){ if(count == 0)
{
errString = itmdbAccessEJB.getErrorString("tran_code", "VTTRANCD1", userId); errString = itmdbAccessEJB.getErrorString("tran_code", "VTTRANCD1", userId);
return errString; return errString;
} }
} }
} }
if(childNodeName.equalsIgnoreCase("trans_mode")){ if(childNodeName.equalsIgnoreCase("trans_mode"))
{
transMode = genericUtility.getColumnValue("trans_mode", dom); transMode = genericUtility.getColumnValue("trans_mode", dom);
transMode = transMode == null ? "" : transMode.trim(); transMode = transMode == null ? "" : transMode.trim();
System.out.println("mode of transport :::" + transMode); System.out.println("mode of transport :::" + transMode);
if(transMode.isEmpty()){ if(transMode.isEmpty())
errString = itmdbAccessEJB.getErrorString("trans_mode", "VTBLMOTRS", userId); {
errString = itmdbAccessEJB.getErrorString("trans_mode", "VMCODNULL", userId);
return errString; return errString;
}else{ }
else
{
int count = 0; int count = 0;
//Changed By Nasruddin 21-sep-16 start
if("A".equals(editFlag))
{
sql = "select count(*) as count from transporter_mode where tran_code = ? and trans_mode = ?"; sql = "select count(*) as count from transporter_mode where tran_code = ? and trans_mode = ?";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, tranCode); pstmt.setString(1, tranCode);
pstmt.setString(2, transMode); pstmt.setString(2, transMode);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
if(rs.next()){ if(rs.next())
{
count = rs.getInt("count"); count = rs.getInt("count");
} }
...@@ -138,18 +151,51 @@ public class TransporterModeIC extends ValidatorEJB implements TransporterModeIC ...@@ -138,18 +151,51 @@ public class TransporterModeIC extends ValidatorEJB implements TransporterModeIC
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
if(count > 0){ if(count > 0)
errString = itmdbAccessEJB.getErrorString("", "VTINVTCTM", userId); {
errString = itmdbAccessEJB.getErrorString("", "VMDUPL1", userId);
return errString; return errString;
} }
}
} }
} }
} }
} }
}catch(Exception e){ }
catch(Exception e)
{
System.out.println("::::" + this.getClass().getSimpleName() + ":::" + e.getMessage()); System.out.println("::::" + this.getClass().getSimpleName() + ":::" + e.getMessage());
e.printStackTrace(); e.printStackTrace();
} }
// Changed by Nasruddin 21-sep-16 Start
finally
{
try
{
if(conn != null)
{
if(rs != null)
{
rs.close();
rs = null;
}
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
conn.close();
}
conn = null;
}
catch(Exception d)
{
d.printStackTrace();
throw new ITMException(d);
}
}
// Changed by Nasruddin 21-sep-16 End
return errString; return errString;
} }
......
...@@ -119,6 +119,7 @@ public class UnitConvIC extends ValidatorEJB implements UnitConvICLocal,UnitConv ...@@ -119,6 +119,7 @@ public class UnitConvIC extends ValidatorEJB implements UnitConvICLocal,UnitConv
{ {
childNode = childNodeList.item(ctr); childNode = childNodeList.item(ctr);
childNodeName = childNode.getNodeName(); childNodeName = childNode.getNodeName();
/* Comment By Nasruddin 21-Sep-16 START
if (childNodeName.trim().equalsIgnoreCase("unit__fr")) if (childNodeName.trim().equalsIgnoreCase("unit__fr"))
{ {
unitFr = genericUtility.getColumnValue("unit__fr", dom); unitFr = genericUtility.getColumnValue("unit__fr", dom);
...@@ -149,17 +150,55 @@ public class UnitConvIC extends ValidatorEJB implements UnitConvICLocal,UnitConv ...@@ -149,17 +150,55 @@ public class UnitConvIC extends ValidatorEJB implements UnitConvICLocal,UnitConv
errFields.add(childNodeName.toLowerCase()); errFields.add(childNodeName.toLowerCase());
} }
} }
} else if (childNodeName.trim() } Comment By Nasruddin 21-Sep-16 END */
.equalsIgnoreCase("unit__to")) if (childNodeName.trim().equalsIgnoreCase("unit__to"))
{ {
unitTo = genericUtility.getColumnValue("unit__to", dom); unitTo = genericUtility.getColumnValue("unit__to", dom);
unitFr = genericUtility.getColumnValue("unit__fr", dom); unitFr = genericUtility.getColumnValue("unit__fr", dom);
/* Comment By Nasruddin 21-Sep-16 START
if (unitTo == null || unitTo.trim().length() <= 0) if (unitTo == null || unitTo.trim().length() <= 0)
{ {
errCode = "VMUNIT1"; errCode = "VMUNIT1";
errList.add(errCode); errList.add(errCode);
errFields.add(childNodeName.toLowerCase()); errFields.add(childNodeName.toLowerCase());
} Comment By Nasruddin 21-Sep-16 Nasruddin */
if (unitFr.equalsIgnoreCase(unitTo))
{
errCode = "VTUNIT2";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
// Changed By Nasruddin Start 21-SEP-16
else
{
if("A".equals(editFlag))
{
itemCode = genericUtility.getColumnValue("item_code", dom);
sql ="SELECT COUNT(1) FROM UOMCONV WHERE UNIT__FR = ? AND UNIT__TO = ? AND ITEM_CODE = ?;";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, unitFr);
pstmt.setString(2, unitTo);
pstmt.setString(3, itemCode);
rs = pstmt.executeQuery();
if (rs.next())
{
cnt = rs.getInt(1);
}
if (cnt == 0)
{
errCode = "VMDUPL1";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
} }
rs.close();
rs = null;
pstmt.close();
pstmt = null;
}
} // Changed By Nasruddin Start 21-SEP-16 END
/* Comment By Nasruddin 21-Sep-16 START
if (unitTo != null && unitTo.trim().length() > 0) if (unitTo != null && unitTo.trim().length() > 0)
{ {
sql = "select count(*) from uom where unit = ? "; sql = "select count(*) from uom where unit = ? ";
...@@ -181,14 +220,10 @@ public class UnitConvIC extends ValidatorEJB implements UnitConvICLocal,UnitConv ...@@ -181,14 +220,10 @@ public class UnitConvIC extends ValidatorEJB implements UnitConvICLocal,UnitConv
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
} }
if (unitFr.equalsIgnoreCase(unitTo)) Comment By Nasruddin 21-Sep-16 END*/
{
errCode = "VTUNIT2";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
} }
/* Comment By Nasruddin 21-Sep-16 START
} else if (childNodeName.trim().equalsIgnoreCase("item_code")) else if (childNodeName.trim().equalsIgnoreCase("item_code"))
{ {
System.out.println(""+""+""+"Change not made in UnitComnIC EJB extending ValidateEJB"+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""); System.out.println(""+""+""+"Change not made in UnitComnIC EJB extending ValidateEJB"+""+""+""+""+""+""+""+""+""+""+""+""+""+""+"");
itemCode = genericUtility.getColumnValue("item_code",dom); itemCode = genericUtility.getColumnValue("item_code",dom);
...@@ -249,7 +284,7 @@ public class UnitConvIC extends ValidatorEJB implements UnitConvICLocal,UnitConv ...@@ -249,7 +284,7 @@ public class UnitConvIC extends ValidatorEJB implements UnitConvICLocal,UnitConv
} }
} }Comment by nasriuddin 19-sep-16 END*/
}// END OF FOR }// END OF FOR
}// END OF SWITCH }// END OF SWITCH
int errListSize = errList.size(); int errListSize = errList.size();
......
...@@ -81,24 +81,32 @@ public class UnitOfMeasureIC extends ValidatorEJB implements UnitOfMeasureICRemo ...@@ -81,24 +81,32 @@ public class UnitOfMeasureIC extends ValidatorEJB implements UnitOfMeasureICRemo
currentFormNo = Integer.parseInt(objContext); currentFormNo = Integer.parseInt(objContext);
} }
System.out.println("in wfValdata doc :::::"); System.out.println("in wfValdata doc :::::");
switch (currentFormNo) { switch (currentFormNo)
{
case 1: case 1:
parentNodeList = dom.getElementsByTagName("Detail1"); parentNodeList = dom.getElementsByTagName("Detail1");
parentNode = parentNodeList.item(0); parentNode = parentNodeList.item(0);
childNodeList = parentNode.getChildNodes(); childNodeList = parentNode.getChildNodes();
childNodeLength = childNodeList.getLength(); childNodeLength = childNodeList.getLength();
for (ctr = 0; ctr < childNodeLength; ctr++) { for (ctr = 0; ctr < childNodeLength; ctr++)
{
childNode = childNodeList.item(ctr); childNode = childNodeList.item(ctr);
childNodeName = childNode.getNodeName(); childNodeName = childNode.getNodeName();
if(childNodeName.equalsIgnoreCase("unit")){ if(childNodeName.equalsIgnoreCase("unit"))
{
unit = genericUtility.getColumnValue("unit", dom); unit = genericUtility.getColumnValue("unit", dom);
unit = unit == null ? "" : unit.trim(); unit = unit == null ? "" : unit.trim();
System.out.println("unit ::::" + unit); System.out.println("unit ::::" + unit);
if(unit.isEmpty()){ if(unit.isEmpty())
{
errString = itmdbAccessEJB.getErrorString("unit", "VTCRTERM", userId); errString = itmdbAccessEJB.getErrorString("unit", "VTCRTERM", userId);
return errString; return errString;
}else if(editFlag.equalsIgnoreCase("A")){ }
else if(editFlag.equalsIgnoreCase("A"))
{
int count = 0; int count = 0;
if(unit !=null && unit.trim().length() > 0)
{
sql = "select count(*) as count from uom where unit = ?"; sql = "select count(*) as count from uom where unit = ?";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, unit); pstmt.setString(1, unit);
...@@ -116,14 +124,18 @@ public class UnitOfMeasureIC extends ValidatorEJB implements UnitOfMeasureICRemo ...@@ -116,14 +124,18 @@ public class UnitOfMeasureIC extends ValidatorEJB implements UnitOfMeasureICRemo
} }
} }
} }
if(childNodeName.equalsIgnoreCase("descr")){ }
if(childNodeName.equalsIgnoreCase("descr"))
{
descr = genericUtility.getColumnValue("descr", dom); descr = genericUtility.getColumnValue("descr", dom);
//descr = descr == null ? "" : descr.trim(); //descr = descr == null ? "" : descr.trim();
System.out.println("Description :::" + descr); System.out.println("Description :::" + descr);
if(descr.trim().isEmpty()){ if(descr.trim().isEmpty()){
errString = itmdbAccessEJB.getErrorString("descr", "VMDESCR", userId); errString = itmdbAccessEJB.getErrorString("descr", "VMDESCR", userId);
return errString; return errString;
}else{ }
else
{
int count = 0; int count = 0;
sql = "select count(*) as count from uom where unit != ? and trim(descr) = ?"; sql = "select count(*) as count from uom where unit != ? and trim(descr) = ?";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
...@@ -139,7 +151,8 @@ public class UnitOfMeasureIC extends ValidatorEJB implements UnitOfMeasureICRemo ...@@ -139,7 +151,8 @@ public class UnitOfMeasureIC extends ValidatorEJB implements UnitOfMeasureICRemo
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
if(count > 0){ if(count > 0)
{
errString = itmdbAccessEJB.getErrorString("descr", "VMDUPDESCR", userId); errString = itmdbAccessEJB.getErrorString("descr", "VMDUPDESCR", userId);
return errString; return errString;
} }
...@@ -147,12 +160,18 @@ public class UnitOfMeasureIC extends ValidatorEJB implements UnitOfMeasureICRemo ...@@ -147,12 +160,18 @@ public class UnitOfMeasureIC extends ValidatorEJB implements UnitOfMeasureICRemo
} }
} }
} }
}catch(Exception e){ }
catch(Exception e)
{
System.out.println("::::" + this.getClass().getSimpleName() + ":::" + e.getMessage()); System.out.println("::::" + this.getClass().getSimpleName() + ":::" + e.getMessage());
e.printStackTrace(); e.printStackTrace();
}finally{ }
try{ finally
if(rs != null){ {
try
{
if(rs != null)
{
rs.close(); rs.close();
rs = null; rs = null;
} }
......
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