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;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.Timestamp;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
......@@ -77,10 +78,15 @@ public class PriceListIC extends ValidatorEJB implements PriceListICLocal, Price
String priceList = "";
String priceListTar = "";
String calcMethod = "";
String childNodeValue = "" ;
String active = "";
String effDateStr ="", validUptoStr ="";
Timestamp effDate = null, validUpto = null;
int ctr = 0;
int count = 0;
int currentFormNo = 0;
int childNodeListLength;
double minQty = 0.0, maxQty = 0.0, minRate = 0.0, rate = 0.0;
StringBuffer valueXmlString = new StringBuffer();
ArrayList<String> errList = new ArrayList();
ArrayList<String> errFields = new ArrayList<String>();
......@@ -120,6 +126,7 @@ public class PriceListIC extends ValidatorEJB implements PriceListICLocal, Price
{
childNode = childNodeList.item(ctr);
childNodeName = childNode.getNodeName();
/* Comment By Nasruddin [20-SEP-16] START
if(childNodeName.equalsIgnoreCase("calc_method"))
{
calcMethod = genericUtility.getColumnValue("calc_method", dom);
......@@ -150,9 +157,13 @@ public class PriceListIC extends ValidatorEJB implements PriceListICLocal, Price
errCode = "VTCALMNUL";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}*/
}
}
else if(childNodeName.equalsIgnoreCase("price_list"))
Comment By Nasruddin [20-SEP-16] END
*/
/* Comment By Nasruddin [20-SEP-16] START
else if(childNodeName.equalsIgnoreCase("price_list"))
{
priceList = genericUtility.getColumnValue("price_list", dom);
sql="select key_flag from transetup where tran_window = 'w_pricelist_mst' ";
......@@ -200,13 +211,13 @@ public class PriceListIC extends ValidatorEJB implements PriceListICLocal, Price
pstmt.close();
pstmt = null;
}
}
}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);
if (priceListParent !=null && priceListParent.trim().length() > 0)
{
......@@ -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>");
break;
......@@ -233,7 +295,8 @@ public class PriceListIC extends ValidatorEJB implements PriceListICLocal, Price
{
childNode = childNodeList.item(ctr);
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);
if (calcMethod !=null && calcMethod.trim().length() > 0)
......@@ -263,9 +326,8 @@ public class PriceListIC extends ValidatorEJB implements PriceListICLocal, Price
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}
else if(childNodeName.equalsIgnoreCase("price_list__tar"))
if(childNodeName.equalsIgnoreCase("price_list__tar"))
{
priceListTar = genericUtility.getColumnValue("price_list__tar", dom);
if (priceListTar == null || priceListTar.trim().length() == 0)
......@@ -289,8 +351,83 @@ 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>");
break;
......@@ -369,6 +506,19 @@ public class PriceListIC extends ValidatorEJB implements PriceListICLocal, Price
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
{
......
......@@ -80,7 +80,7 @@ public class PurTermTable extends ValidatorEJB implements PurTermTableLocal, Pur
String sql = "";
String errCode = "";
String errorType = "";
String errString = "";
String errString = "", termTable = "";
int ctr = 0;
int currentFormNo = 0;
int cnt = 0;
......@@ -90,6 +90,7 @@ public class PurTermTable extends ValidatorEJB implements PurTermTableLocal, Pur
Connection conn = null;
PreparedStatement pstmt = null;
ResultSet rs = null;
String termCode = "";
ConnDriver connDriver = new ConnDriver();
int childNodeListLength=0;
StringBuffer errStringXml = new StringBuffer("<?xml version = \"1.0\"?> \r\n <Root> <Errors>");
......@@ -121,10 +122,11 @@ public class PurTermTable extends ValidatorEJB implements PurTermTableLocal, Pur
childNodeName = childNode.getNodeName();
if (childNodeName.equalsIgnoreCase("term_code"))
{
String termCode = "";
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 = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,termCode);
......@@ -143,8 +145,59 @@ public class PurTermTable extends ValidatorEJB implements PurTermTableLocal, Pur
rs = null;
pstmt.close();
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>");
//break;
......
......@@ -59,78 +59,88 @@ public class PurchaseTermsIC extends ValidatorEJB implements PurchaseTermsICRemo
public String wfValData(Document dom, Document dom1, Document dom2, String objContext, String editFlag, String xtraParams)
throws RemoteException, ITMException {
String errString = "";
String sql = "", termCode = "", descr = "";
Connection conn = null;
String userId = "", keyFlag = "";
PreparedStatement pstmt = null;
ResultSet rs = null;
NodeList parentNodeList = null, childNodeList = null;
Node parentNode = null, childNode = null;
int ctr = 0, childNodeLength = 0, currentFormNo = 0;
String childNodeName = "";
try {
ConnDriver connDriver = new ConnDriver();
//Changes and Commented By Bhushan on 09-06-2016 :START
//conn = connDriver.getConnectDB("DriverITM");
conn = getConnection();
//Changes and Commented By Bhushan on 09-06-2016 :END
conn.setAutoCommit(false);
userId = genericUtility.getValueFromXTRA_PARAMS(xtraParams, userId);
if (objContext != null && objContext.trim().length() > 0) {
currentFormNo = Integer.parseInt(objContext);
}
System.out.println("in wfValdata doc :::::");
switch (currentFormNo) {
case 1:
parentNodeList = dom.getElementsByTagName("Detail1");
parentNode = parentNodeList.item(0);
childNodeList = parentNode.getChildNodes();
childNodeLength = childNodeList.getLength();
for (ctr = 0; ctr < childNodeLength; ctr++) {
childNode = childNodeList.item(ctr);
childNodeName = childNode.getNodeName();
if(childNodeName.equalsIgnoreCase("term_code")){
termCode= genericUtility.getColumnValue("term_code", dom);
termCode = termCode == null ? "" : termCode.trim();
System.out.println("termCode ::::" + termCode);
sql = "select key_flag from transetup where tran_window = 'w_pur_term' " ;
pstmt = conn.prepareStatement(sql);
rs = pstmt.executeQuery();
if(rs.next()){
keyFlag = rs.getString("key_flag");
}
keyFlag = keyFlag == null ? "" : keyFlag.trim();
System.out.println("keyFlag:::" + keyFlag);
if(keyFlag.isEmpty()){
keyFlag = "M";
}
if(termCode.isEmpty() && keyFlag.equalsIgnoreCase("M")){
errString = itmdbAccessEJB.getErrorString("term_code", "VTTERMNULL", userId);
return errString;
}else if(editFlag.equalsIgnoreCase("A")){
int count = 0;
sql = "select count(*) as count from pur_term where term_code = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, termCode);
rs = pstmt.executeQuery();
if(rs.next()){
count = rs.getInt("count");
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
if(count > 0){
errString = itmdbAccessEJB.getErrorString("term_code", "VMDUPL1", userId);
return errString;
}
}
}
if(childNodeName.equalsIgnoreCase("descr")){
String errString = "";
String sql = "", termCode = "", descr = "";
Connection conn = null;
String userId = "", keyFlag = "";
PreparedStatement pstmt = null;
ResultSet rs = null;
NodeList parentNodeList = null, childNodeList = null;
Node parentNode = null, childNode = null;
int ctr = 0, childNodeLength = 0, currentFormNo = 0;
String childNodeName = "";
try {
ConnDriver connDriver = new ConnDriver();
//Changes and Commented By Bhushan on 09-06-2016 :START
//conn = connDriver.getConnectDB("DriverITM");
conn = getConnection();
//Changes and Commented By Bhushan on 09-06-2016 :END
conn.setAutoCommit(false);
userId = genericUtility.getValueFromXTRA_PARAMS(xtraParams, userId);
if (objContext != null && objContext.trim().length() > 0) {
currentFormNo = Integer.parseInt(objContext);
}
System.out.println("in wfValdata doc :::::");
switch (currentFormNo) {
case 1:
parentNodeList = dom.getElementsByTagName("Detail1");
parentNode = parentNodeList.item(0);
childNodeList = parentNode.getChildNodes();
childNodeLength = childNodeList.getLength();
for (ctr = 0; ctr < childNodeLength; ctr++)
{
childNode = childNodeList.item(ctr);
childNodeName = childNode.getNodeName();
if(childNodeName.equalsIgnoreCase("term_code"))
{
termCode= genericUtility.getColumnValue("term_code", dom);
termCode = termCode == null ? "" : termCode.trim();
System.out.println("termCode ::::" + termCode);
sql = "select key_flag from transetup where tran_window = 'w_pur_term' " ;
pstmt = conn.prepareStatement(sql);
rs = pstmt.executeQuery();
if(rs.next())
{
keyFlag = rs.getString("key_flag");
}
keyFlag = keyFlag == null ? "" : keyFlag.trim();
System.out.println("keyFlag:::" + keyFlag);
if(keyFlag.isEmpty()){
keyFlag = "M";
}
if(termCode.isEmpty() && keyFlag.equalsIgnoreCase("M"))
{
errString = itmdbAccessEJB.getErrorString("term_code", "VTTERMNULL", userId);
return errString;
}
else if(editFlag.equalsIgnoreCase("A"))
{
int count = 0;
sql = "select count(*) as count from pur_term where term_code = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, termCode);
rs = pstmt.executeQuery();
if(rs.next())
{
count = rs.getInt("count");
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
if(count > 0)
{
errString = itmdbAccessEJB.getErrorString("term_code", "VMDUPL1", userId);
return errString;
}
}
}
/* Comment By Nasruddin [20-SEP-16] START
if(childNodeName.equalsIgnoreCase("descr"))
{
descr = genericUtility.getColumnValue("descr", dom);
descr = descr == null ? "" : descr.trim();
System.out.println("Description :::" + descr);
......@@ -139,30 +149,39 @@ public class PurchaseTermsIC extends ValidatorEJB implements PurchaseTermsICRemo
return errString;
}
}
}
}
}catch(Exception e){
System.out.println("::::" + this.getClass().getSimpleName() + ":::" + e.getMessage());
e.printStackTrace();
}finally{
try{
if(rs != null){
rs.close();
rs = null;
}
if(pstmt != null){
pstmt.close();
pstmt = null;
}
if(conn != null){
conn.close();
conn = null;
}
}catch(Exception e1){
System.out.println("::::" + this.getClass().getSimpleName() + ":::" + e1.getMessage());
e1.printStackTrace();
}
}
return errString;
}
Comment By Nasruddin [20-SEP-16] END */
}
}
}catch(Exception e)
{
System.out.println("::::" + this.getClass().getSimpleName() + ":::" + e.getMessage());
e.printStackTrace();
}
finally
{
try
{
if(rs != null)
{
rs.close();
rs = null;
}
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
if(conn != null)
{
conn.close();
conn = null;
}
}
catch(Exception e1){
System.out.println("::::" + this.getClass().getSimpleName() + ":::" + e1.getMessage());
e1.printStackTrace();
}
}
return errString;
}
}
......@@ -80,60 +80,74 @@ public class SalesReturnReasonIC extends ValidatorEJB implements SalesReturnReas
currentFormNo = Integer.parseInt(objContext);
}
System.out.println("in wfValdata doc :::::");
switch (currentFormNo) {
switch (currentFormNo)
{
case 1:
parentNodeList = dom.getElementsByTagName("Detail1");
parentNode = parentNodeList.item(0);
childNodeList = parentNode.getChildNodes();
childNodeLength = childNodeList.getLength();
for (ctr = 0; ctr < childNodeLength; ctr++) {
for (ctr = 0; ctr < childNodeLength; ctr++)
{
childNode = childNodeList.item(ctr);
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 = reasonCode == null ? "" : reasonCode.trim();
System.out.println("reasonCode ::::" + reasonCode);
if(reasonCode.isEmpty()){
if(reasonCode.isEmpty())
{
errString = itmdbAccessEJB.getErrorString("reason_code", "VTREABL", userId);
return errString;
}else if(editFlag.equalsIgnoreCase("A")){
}
else if(editFlag.equalsIgnoreCase("A"))
{
int count = 0;
sql = "select count(*) as count from SRETURN_REASON where reason_code = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, reasonCode);
rs = pstmt.executeQuery();
if(rs.next()){
if(rs.next())
{
count = rs.getInt("count");
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
if(count > 0){
if(count > 0)
{
errString = itmdbAccessEJB.getErrorString("reason_code", "VTREAINV", userId);
return errString;
}
}
}
if(childNodeName.equalsIgnoreCase("reason_descr")){
if(childNodeName.equalsIgnoreCase("reason_descr"))
{
descr = genericUtility.getColumnValue("reason_descr", dom);
descr = descr == null ? "" : descr.trim();
System.out.println("Description :::" + descr);
if(descr.trim().isEmpty()){
if(descr.trim().isEmpty())
{
errString = itmdbAccessEJB.getErrorString("reason_descr", "VMDESCR", userId);
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 = restrDays == null ? "" : restrDays.trim();
System.out.println("Restr Days" + restrDays);
if(restrDays.trim().isEmpty()){
if(restrDays.trim().isEmpty())
{
errString = itmdbAccessEJB.getErrorString("restr_days", "VTRESTBL", userId);
return errString;
}
}
}
}
}catch(Exception e){
......
......@@ -137,16 +137,48 @@ public class SiteCustomer extends ValidatorEJB implements SiteCustomerLocal,Site
{
count = rs.getInt(1);
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
if(count == 0)
{
errCode = "VMCUST1";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
// 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 = null;
pstmt.close();
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"))
{
......@@ -411,7 +443,6 @@ public class SiteCustomer extends ValidatorEJB implements SiteCustomerLocal,Site
}
}// End of try
catch(Exception e)
{
e.printStackTrace();
......
......@@ -64,14 +64,14 @@ public class SiteSupplierIC extends ValidatorEJB implements SiteSupplierICLocal,
String siteCodeCh = "";
String siteCodePay = "";
String crmTerm = "";
String taxClass = "";
String taxClass = "", lockGroup = "";
String taxEnv = "";
String childNodeName = null;
String errString = "";
String errCode = "";
String userId = "";
String sql = "";
String errorType = "";
String errorType = "", currCode = "";
int cnt = 0;
int ctr=0;
int childNodeListLength;
......@@ -155,11 +155,11 @@ public class SiteSupplierIC extends ValidatorEJB implements SiteSupplierICLocal,
}
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));
System.out.println("siteCodeCh"+siteCodeCh);
/*if(channelPartner != null && channelPartner.equalsIgnoreCase("Y"))
// Changed By nasruddin 22-SEP-16 START
if(channelPartner != null && channelPartner.equalsIgnoreCase("Y"))
{
if(siteCodeCh == null || siteCodeCh.trim().length() < 0)
{
......@@ -167,7 +167,8 @@ public class SiteSupplierIC extends ValidatorEJB implements SiteSupplierICLocal,
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}*/
}
/*
if(siteCodeCh != null && siteCodeCh.trim().length() > 0)
{
sql = "SELECT COUNT(*) FROM site where site_code = ?";
......@@ -189,6 +190,7 @@ public class SiteSupplierIC extends ValidatorEJB implements SiteSupplierICLocal,
pstmt.close();
pstmt = null;
}
Changed by Nasruddin 22-SEP-16 END*/
}
else if(childNodeName.equalsIgnoreCase("site_code__pay"))
{
......@@ -218,7 +220,8 @@ public class SiteSupplierIC extends ValidatorEJB implements SiteSupplierICLocal,
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));
if(currCode != null && currCode.trim().length() > 0)
......@@ -242,7 +245,7 @@ public class SiteSupplierIC extends ValidatorEJB implements SiteSupplierICLocal,
pstmt.close();
pstmt = null;
}
}*/
}/*Changed By Nasruddin END 22-SEP-16 START
else if(childNodeName.equalsIgnoreCase("cr_term"))
{
crmTerm = checkNull(genericUtility.getColumnValue("cr_term", dom));
......@@ -269,6 +272,7 @@ public class SiteSupplierIC extends ValidatorEJB implements SiteSupplierICLocal,
pstmt = null;
}
}
else if(childNodeName.equalsIgnoreCase("tax_class"))
{
taxClass = checkNull(genericUtility.getColumnValue("tax_class", dom));
......@@ -321,6 +325,39 @@ public class SiteSupplierIC extends ValidatorEJB implements SiteSupplierICLocal,
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;
import java.rmi.RemoteException;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import ibase.system.config.ConnDriver;
import ibase.utility.E12GenericUtility;
import ibase.webitm.ejb.ITMDBAccessEJB;
......@@ -66,7 +68,12 @@ ITMDBAccessEJB itmdbAccessEJB = new ITMDBAccessEJB();
Node parentNode = null, childNode = null;
String childNodeName = "",userId = "";
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 {
System.out.println("::in wfvalData doc::");
ConnDriver con = new ConnDriver();
......@@ -78,43 +85,109 @@ ITMDBAccessEJB itmdbAccessEJB = new ITMDBAccessEJB();
if(objContext != null && objContext.trim().length() > 0){
currentFormNo = Integer.parseInt(objContext);
}
switch(currentFormNo){
switch(currentFormNo)
{
case 1:
parentNodeList = dom.getElementsByTagName("Detail1");
parentNode = parentNodeList.item(0);
childNodeList = parentNode.getChildNodes();
childNodeLength = childNodeList.getLength();
for(ctr = 0;ctr<childNodeLength;ctr++){
for(ctr = 0;ctr<childNodeLength;ctr++)
{
childNode = childNodeList.item(ctr);
childNodeName = childNode.getNodeName();
if(childNodeName.equalsIgnoreCase("spec_ref")){
if(childNodeName.equalsIgnoreCase("spec_ref"))
{
specRef = genericUtility.getColumnValue("spec_ref", dom);
specRef = specRef == null ? "" : specRef.trim();
System.out.println(":::specification ref" + specRef);
if(specRef.isEmpty()){
if(specRef.isEmpty())
{
errString = itmdbAccessEJB.getErrorString("spec_ref", "VTSPECREF", userId);
return errString;
}
}
if(childNodeName.equalsIgnoreCase("spec_code")){
if(childNodeName.equalsIgnoreCase("spec_code"))
{
specCode = genericUtility.getColumnValue("spec_code", dom);
specCode = specCode == null ? "" : specCode.trim();
System.out.println(":::specification code" + specCode);
if(specCode.isEmpty()){
errString = itmdbAccessEJB.getErrorString("spec_code", "VTSPECCODE", userId);
if(specCode.isEmpty())
{
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;
}
}
// Changed By Nasruddin 21-SEP-16 END
}
}
}
if(conn != null) {
/* Comment By Nasruddin 21-SEP-16 START
if(conn != null)
{
conn.close();
conn = null;
}
} catch (Exception e) {
Comment By Nasruddin 21-SEP-16 END */
}
catch (Exception e)
{
System.out.println("::::" + this.getClass().getSimpleName() + "::::" + e.getMessage());
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;
}
}
......@@ -123,6 +123,7 @@ public class SreturnNormsIC extends ValidatorEJB implements SreturnNormsICLocal,
if( childNodeName.equalsIgnoreCase("days_from") && "A".equals(editFlag) )
{
String daysFrom = checkNull(genericUtility.getColumnValue("days_from", dom));
/* Comment By Nasruddin 21-SEP-16 Start
String daysTo = checkNull(genericUtility.getColumnValue("days_to", dom));
String deductPerc = checkNull(genericUtility.getColumnValue("deduct_perc", dom));
if(daysFrom.trim().length() <= 0)
......@@ -156,7 +157,8 @@ public class SreturnNormsIC extends ValidatorEJB implements SreturnNormsICLocal,
errFields.add(childNodeName.toLowerCase());
}
else
{
{*/
count2 = 0;
sql = " select count(*) from sreturn_norms where days_from <= ? and days_to >= ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setInt(1,Integer.parseInt(daysFrom));
......@@ -176,13 +178,14 @@ public class SreturnNormsIC extends ValidatorEJB implements SreturnNormsICLocal,
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}
//} Comment By Nasruddin 21-SEP-16 END
}
if(childNodeName.equalsIgnoreCase("days_to ") && "A".equals(editFlag) )
{
String daysTo = checkNull(genericUtility.getColumnValue("days_to", dom));
String daysFrom = checkNull(genericUtility.getColumnValue("days_from", dom));
/* Comment By Nasruddin 21-SEP-16 START
String deductPerc = checkNull(genericUtility.getColumnValue("deduct_perc", dom));
if(daysTo.trim().length() <= 0)
{
......@@ -208,7 +211,8 @@ public class SreturnNormsIC extends ValidatorEJB implements SreturnNormsICLocal,
errList.add(errCode);
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";
errList.add(errCode);
......@@ -235,9 +239,9 @@ public class SreturnNormsIC extends ValidatorEJB implements SreturnNormsICLocal,
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}
}
} // end for
......
......@@ -85,6 +85,7 @@ public class StationIC extends ValidatorEJB implements StationICLocal, StationIC
ConnDriver connDriver = new ConnDriver();
StringBuffer errStringXml = new StringBuffer("<?xml version = \"1.0\"?> \r\n <Root> <Errors>");
System.out.println("Station Val Start");
String modName = "w_station" , keyFlag = ""; // Changed By Nasruddin 21-SEP-16
try
{
//Changes and Commented By Bhushan on 09-06-2016 :START
......@@ -104,14 +105,17 @@ public class StationIC extends ValidatorEJB implements StationICLocal, StationIC
if(childNodeName.equalsIgnoreCase("state_code"))
{
stateCode = checkNull(genericUtility.getColumnValue("state_code", dom));
System.out.println("State code="+stateCode);
/* Comment By Nasruddin 21-SEP-16 START
if(stateCode == null || stateCode.trim().length() == 0)
{
errCode = "VMSTATCD2";
errList.add(errCode);
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 = ?";
pstmt = conn.prepareStatement(sql);
......@@ -139,34 +143,55 @@ public class StationIC extends ValidatorEJB implements StationICLocal, StationIC
System.out.println("stancode"+stanCode);
//if(stanCode == null || stanCode.trim().length() == 0)
//{
//errCode = "VMSTNBK";
//errList.add(errCode);
//errFields.add(childNodeName.toLowerCase());
//errCode = "VMSTNBK";
//errList.add(errCode);
//errFields.add(childNodeName.toLowerCase());
//}
if(editFlag.equalsIgnoreCase("A"))
// 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() )
{
sql = "select count(*) from station where stan_code = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,stanCode);
rs = pstmt.executeQuery();
if(rs.next())
{
count = rs.getInt(1);
System.out.println("COUNT = "+count);
}
if(count > 0)
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"))
{
errCode = "VMSTNDP";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
sql = "select count(*) from station where stan_code = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,stanCode);
rs = pstmt.executeQuery();
if(rs.next())
{
count = rs.getInt(1);
System.out.println("COUNT = "+count);
}
if(count > 0)
{
errCode = "VMDUPL1";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
}
}
/* Comment BY Nasruddin 21-sep-16 start
else if(childNodeName.equalsIgnoreCase("descr"))
{
desc = checkNull(genericUtility.getColumnValue("descr", dom));
......@@ -177,17 +202,22 @@ public class StationIC extends ValidatorEJB implements StationICLocal, StationIC
errFields.add(childNodeName.toLowerCase());
}
}
Comment BY Nasruddin 21-sep-16 end */
else if(childNodeName.equalsIgnoreCase("bank_code"))
{
bankCode = checkNull(genericUtility.getColumnValue("bank_code", dom));
System.out.println("bank code="+bankCode);
/* Comment BY Nasruddin 21-sep-16 start
if(bankCode == null || bankCode.trim().length() == 0)
{
errCode = "VMBANK1";
errList.add(errCode);
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 = ?";
pstmt = conn.prepareStatement(sql);
......
......@@ -102,6 +102,7 @@ public class Supplier extends ValidatorEJB implements SupplierLocal,SupplierRemo
int currentFormNo = 0;
StringBuffer errStringXml = new StringBuffer("<?xml version = \"1.0\"?> \r\n <Root> <Errors>");
String commTable = "";
String labOurInvolved = "", pfRegNo = "", lwfNo = "", pTaxNo = "", eciNo = "",esicRegNo = "", ssi = "", msmeRegDate = "", msmeRegNo = "", msmeType = "";//Changed By Nasruddin 21-SEp-16
try
{
SimpleDateFormat sdf1= new SimpleDateFormat(genericUtility.getDBDateFormat());
......@@ -199,7 +200,8 @@ public class Supplier extends ValidatorEJB implements SupplierLocal,SupplierRemo
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}
}/*
Changed By Nasruddin 21-SEP-16 STARt
else if(childNodeName.equalsIgnoreCase("supp_code__pay"))
{
System.out.println(">>>>>>>>>>>supp_code__pay validation:");
......@@ -222,18 +224,78 @@ public class Supplier extends ValidatorEJB implements SupplierLocal,SupplierRemo
errFields.add(childNodeName.toLowerCase());
}
}
}*/
else if(childNodeName.equalsIgnoreCase("supp_code__pay"))
{
System.out.println(">>>>>>>>>>>supp_code__pay validation:");
payTo = genericUtility.getColumnValue("supp_code__pay", dom);
suppCode = genericUtility.getColumnValue("supp_code", dom);
if(payTo != null && payTo.trim().length() > 0)
{
if(!(suppCode).equalsIgnoreCase(payTo))
{
count = 0;
sql = "SELECT COUNT(1) FROM SUPPLIER WHERE SUPP_CODE = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, payTo);
rs = pstmt.executeQuery();
if( rs.next() )
{
count = rs.getInt(1);
}
pstmt.close();
pstmt = null;
rs.close();
rs = null;
if (count == 0)
{
errCode = "VMCODPAY";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}
}
}
else if(childNodeName.equalsIgnoreCase("pay_to"))
{
System.out.println(">>>>>>>>>>pay_to validation:");
payTo = genericUtility.getColumnValue("pay_to", dom);
suppCode = genericUtility.getColumnValue("supp_code", dom);
keyFlag = findValue(conn, "key_flag", "transetup", "tran_window", "w_supplier");
if(!("A".equalsIgnoreCase(keyFlag)) && (payTo == null || payTo.trim().length() == 0))
{
errCode = "VEPAYTO";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
else if(!(payTo.equals(suppCode)))
{
existFlag = isExist("supplier", "supp_code", payTo, conn);
if ("FALSE".equals(existFlag))
{
errCode = "VMPAYTO";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}
}
//Changed By Nasruddin 21-SEP-16 END
else if(childNodeName.equalsIgnoreCase("curr_code"))
{
currCode =genericUtility.getColumnValue("curr_code", dom);
if(currCode== null || currCode.trim().length() == 0)
/* Comment BY Nasruddin 21-SEP-16 START
* if(currCode== null || currCode.trim().length() == 0)
{
errCode = "VMNULLCURN";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
else
{
{Comment BY Nasruddin 21-SEP-16 END
*/
existFlag = isExist("currency", "curr_code", currCode, conn);
if ("FALSE".equals(existFlag))
{
......@@ -271,7 +333,7 @@ public class Supplier extends ValidatorEJB implements SupplierLocal,SupplierRemo
}
}
}
}
//}
}
else if(childNodeName.equalsIgnoreCase("stan_code"))
{
......@@ -286,12 +348,14 @@ public class Supplier extends ValidatorEJB implements SupplierLocal,SupplierRemo
errFields.add(childNodeName.toLowerCase());
}
}
/* Comment BY Nasruddin 21_sep-16 STARt
else
{
errCode = "VMSTANCOD";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
Comment BY Nasruddin 21_sep-16 END*/
}
else if(childNodeName.equalsIgnoreCase("cr_term"))
......@@ -443,6 +507,7 @@ public class Supplier extends ValidatorEJB implements SupplierLocal,SupplierRemo
}
}
}
/* Comment By Nasruddin 21-SEP-16 START
else if(childNodeName.equalsIgnoreCase("site_code__pay"))
{
siteCodePay = genericUtility.getColumnValue("site_code__pay", dom);
......@@ -456,7 +521,8 @@ public class Supplier extends ValidatorEJB implements SupplierLocal,SupplierRemo
errFields.add(childNodeName.toLowerCase());
}
}
}
}Comment By Nasruddin 21-SEP-16 END
*/
else if(childNodeName.equalsIgnoreCase("dlv_term"))
{
dlvTerm = genericUtility.getColumnValue("dlv_term", dom);
......@@ -485,6 +551,8 @@ public class Supplier extends ValidatorEJB implements SupplierLocal,SupplierRemo
}
}
}
/* Comment By Nasruddin 21-SEp-16 START
*
else if(childNodeName.equalsIgnoreCase("tran_code"))
{
tranCode = genericUtility.getColumnValue("tran_code", dom);
......@@ -499,6 +567,7 @@ public class Supplier extends ValidatorEJB implements SupplierLocal,SupplierRemo
}
}
}
else if(childNodeName.equalsIgnoreCase("tax_env"))
{
taxEnv = genericUtility.getColumnValue("tax_env", dom);
......@@ -526,9 +595,10 @@ public class Supplier extends ValidatorEJB implements SupplierLocal,SupplierRemo
errFields.add(childNodeName.toLowerCase());
}
}
}
}Comment By Nasruddin 21-SEp-16 end*/
//Changed By Nasruddin khan [19/JUL/16] START
else if( childNodeName.equalsIgnoreCase("comm_table")){
else if( childNodeName.equalsIgnoreCase("comm_table"))
{
commTable = checkNull(this.genericUtility.getColumnValue("comm_table", dom));
......@@ -556,6 +626,121 @@ public class Supplier extends ValidatorEJB implements SupplierLocal,SupplierRemo
}
}//Changed By Nasruddin khan [19/JUL/16] END
// Changed By Nasruddin Start 21-SEP-16 START
else if(childNodeName.equalsIgnoreCase("pf_reg_no"))
{
labOurInvolved = genericUtility.getColumnValue("labour_involved", dom);
if("Y".equals(labOurInvolved))
{
pfRegNo = genericUtility.getColumnValue("pf_reg_no", dom);
if(pfRegNo == null || pfRegNo.trim().length() == 0 )
{
errCode = "VMSUPHRD01";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}
}
else if(childNodeName.equalsIgnoreCase("esic_reg_no"))
{
labOurInvolved = genericUtility.getColumnValue("labour_involved", dom);
if("Y".equals(labOurInvolved))
{
esicRegNo = genericUtility.getColumnValue("esic_reg_no", dom);
if(esicRegNo == null || esicRegNo.trim().length() == 0 )
{
errCode = "VMSUPHRD02";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}
}
else if(childNodeName.equalsIgnoreCase("eci_no"))
{
labOurInvolved = genericUtility.getColumnValue("labour_involved", dom);
if("Y".equals(labOurInvolved))
{
eciNo = genericUtility.getColumnValue("eci_no", dom);
if(eciNo == null || eciNo.trim().length() == 0 )
{
errCode = "VMSUPHRD03";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}
}
else if(childNodeName.equalsIgnoreCase("ptax_no"))
{
labOurInvolved = genericUtility.getColumnValue("labour_involved", dom);
if("Y".equals(labOurInvolved))
{
pTaxNo = genericUtility.getColumnValue("ptax_no", dom);
if(pTaxNo == null || pTaxNo.trim().length() == 0 )
{
errCode = "VMSUPHRD04";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}
}
else if(childNodeName.equalsIgnoreCase("lwf_no"))
{
labOurInvolved = genericUtility.getColumnValue("labour_involved", dom);
if("Y".equals(labOurInvolved))
{
lwfNo = genericUtility.getColumnValue("lwf_no", dom);
if(lwfNo == null || lwfNo.trim().length() == 0 )
{
errCode = "VMSUPHRD05";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}
}
else if(childNodeName.equalsIgnoreCase("msme_type"))
{
ssi = genericUtility.getColumnValue("ssi", dom);
if("Y".equals(ssi))
{
msmeType = genericUtility.getColumnValue("msme_type", dom);
if(msmeType == null || msmeType.trim().length() == 0 )
{
errCode = "VMSUPSSI02";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}
}
else if(childNodeName.equalsIgnoreCase("msme_reg_no"))
{
ssi = genericUtility.getColumnValue("ssi", dom);
if("Y".equals(ssi))
{
msmeRegNo = genericUtility.getColumnValue("msme_reg_no", dom);
if(msmeRegNo == null || msmeRegNo.trim().length() == 0 )
{
errCode = "VMSUPSSI03";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}
}
else if(childNodeName.equalsIgnoreCase("msme_reg_date"))
{
ssi = genericUtility.getColumnValue("ssi", dom);
if("Y".equals(ssi))
{
msmeRegDate = genericUtility.getColumnValue("msme_reg_date", dom);
if(msmeRegDate == null || msmeRegDate.trim().length() == 0 )
{
errCode = "VMSUPSSI04";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}
}
// Changed By Nasruddin Start 21-SEP-16 end
}
break; //end case 1 validation.
......
......@@ -64,8 +64,8 @@ public class SupplierItem extends ValidatorEJB implements SupplierItemLocal,Supp
String errCode="";
String errorType = "";
String childNodeName = null;
String errString = "";
int ctr=0;
String errString = "", lockGroup = "", sql = "";
int ctr=0, count = 0;
int childNodeListLength;
ArrayList<String> errList = new ArrayList<String>();
ArrayList<String> errFields = new ArrayList<String>();
......@@ -107,6 +107,39 @@ public class SupplierItem extends ValidatorEJB implements SupplierItemLocal,Supp
errList.add(errCode);
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
......
......@@ -88,24 +88,29 @@ public class TaxBaseIC extends ValidatorEJB implements TaxBaseICRemote, TaxBaseI
for (ctr = 0; ctr < childNodeLength; ctr++) {
childNode = childNodeList.item(ctr);
childNodeName = childNode.getNodeName();
if (childNodeName.equalsIgnoreCase("tax_base")) {
if (childNodeName.equalsIgnoreCase("tax_base"))
{
System.out.println(":::childNodeName" + childNodeName);
String taxBase = genericUtility.getColumnValue("tax_base", dom);
//String taxBase = childNode.getFirstChild().getNodeValue();
taxBase = taxBase == null ? "" : taxBase.trim();
System.out.println("::: taxBase" + taxBase);
if(taxBase.length() <= 0){
if(taxBase.length() <= 0)
{
errString = itmdbAccessEJB.getErrorString("tax_base", "VMTAXB1", userId);
break;
}
else{
if(editFlag.equalsIgnoreCase("A")){
/* Comment By Nasruddin Start 21-SEP-16 START
else
{
if(editFlag.equalsIgnoreCase("A"))
{
int count = 0;
sql = "select count(*) as count from taxbase where tax_base = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, taxBase);
rs = pstmt.executeQuery();
if(rs.next()){
count = rs.getInt("count");
}
......@@ -114,38 +119,46 @@ public class TaxBaseIC extends ValidatorEJB implements TaxBaseICRemote, TaxBaseI
break;
}
}
}
}Comment By Nasruddin Start 21-SEP-16 END*/
}
if(childNodeName.equalsIgnoreCase("descr")){
if(childNodeName.equalsIgnoreCase("descr"))
{
String descr = genericUtility.getColumnValue("descr", dom);
//String descr = childNode.getFirstChild().getNodeValue();
descr = descr == null ? "" : descr.trim();
System.out.println("::: descr" + descr);
if(descr.length() <= 0){
if(descr.length() <= 0)
{
errString = itmdbAccessEJB.getErrorString("descr", "VMDESCR", userId);
break;
}
}
if(childNodeName.equalsIgnoreCase("apply_on")){
if(childNodeName.equalsIgnoreCase("apply_on"))
{
String applyOn = genericUtility.getColumnValue("apply_on", dom);
//String applyOn = childNode.getFirstChild().getNodeValue();
applyOn = applyOn == null ? "" : applyOn.trim();
System.out.println("::: applyOn " + applyOn);
if(applyOn.length() <= 0){
if(applyOn.length() <= 0)
{
errString = itmdbAccessEJB.getErrorString("apply_on", "VMAPPON1", userId);
break;
}
}
if(childNodeName.equalsIgnoreCase("apply_perc")){
if(childNodeName.equalsIgnoreCase("apply_perc"))
{
String applyPerc = genericUtility.getColumnValue("apply_perc", dom);
//String applyPerc = childNode.getFirstChild().getNodeValue();
applyPerc = applyPerc == null ? "" : applyPerc.trim();
System.out.println("::: applyPerc " + applyPerc);
if(editFlag.equalsIgnoreCase("A") || editFlag.equalsIgnoreCase("E")){
if(applyPerc.length() <= 0){
errString = itmdbAccessEJB.getErrorString("apply_perc", "VMAPPLPERC", userId);
break;
if(editFlag.equalsIgnoreCase("A") || editFlag.equalsIgnoreCase("E"))
{
if(applyPerc.length() <= 0)
{
errString = itmdbAccessEJB.getErrorString("apply_perc", "VMAPPLPERC", userId);
break;
}
}
}
......@@ -159,62 +172,102 @@ public class TaxBaseIC extends ValidatorEJB implements TaxBaseICRemote, TaxBaseI
for (ctr = 0; ctr < childNodeLength; ctr++) {
childNode = childNodeList.item(ctr);
childNodeName = childNode.getNodeName();
if(childNodeName.equalsIgnoreCase("tax_base")){
if(childNodeName.equalsIgnoreCase("tax_base"))
{
String tax = genericUtility.getColumnValue("tax_base", dom);
//String tax = childNode.getFirstChild().getNodeValue();
System.out.println(":::tax" + tax);
tax = tax == null ? "" : tax.trim();
if(tax.length() <= 0){
if(tax.length() <= 0)
{
errString = itmdbAccessEJB.getErrorString("tax_base", "VMTAXB1", userId);
break;
}
}
if(childNodeName.equalsIgnoreCase("tax_code")){
if(childNodeName.equalsIgnoreCase("tax_code"))
{
String taxCode = genericUtility.getColumnValue("tax_code", dom);
//String taxCode = childNode.getFirstChild().getNodeValue();
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);
break;
}else {
int count = 0;
sql = "select count(*) as count from tax where tax_code = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, taxCode);
rs = pstmt.executeQuery();
if(rs.next()){
count = rs.getInt("count");
}
if(count <= 0){
errString = itmdbAccessEJB.getErrorString("tax_code", "VTTAX1", userId);
break;
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
}
//else Comment By Nasrrudn 21-SEP-16 END*/
//{
int count = 0;
sql = "select count(*) as count from tax where tax_code = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, taxCode);
rs = pstmt.executeQuery();
if(rs.next())
{
count = rs.getInt("count");
}
if(count <= 0)
{
errString = itmdbAccessEJB.getErrorString("tax_code", "VTTAX1", userId);
break;
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
//}
}
if(childNodeName.equalsIgnoreCase("seq_no")){
if(childNodeName.equalsIgnoreCase("seq_no"))
{
String seqNo = genericUtility.getColumnValue("seq_no", dom);
//String seqNo = childNode.getFirstChild().getNodeValue();
seqNo = seqNo == null ? "" : seqNo.trim();
if(seqNo.length() <= 0){
if(seqNo.length() <= 0)
{
errString = itmdbAccessEJB.getErrorString("seq_no", "VMSEQNO", userId);
break;
}
if(!seqNo.matches("\\d+")){
errString = itmdbAccessEJB.getErrorString("seq_no", "VTSEQINV", userId);
}
}
}
}
}
}catch(Exception e)
}
catch(Exception e)
{
System.out.println(":::" + this.getClass().getSimpleName() + ":::" + e.getMessage());
e.printStackTrace();
System.out.println(":::" + this.getClass().getSimpleName() + ":::" + e.getMessage());
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;
}
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
for (ctr = 0; ctr < childNodeLength; ctr++) {
childNode = childNodeList.item(ctr);
childNodeName = childNode.getNodeName();
if(childNodeName.equalsIgnoreCase("site_code")){
if(childNodeName.equalsIgnoreCase("site_code"))
{
siteCode = genericUtility.getColumnValue("site_code", dom);
//siteCode = childNode.getFirstChild().getNodeValue();
siteCode = siteCode == null ? "" : siteCode.trim();
System.out.println("site code :::" + siteCode);
if(siteCode.isEmpty()){
errString = itmdbAccessEJB.getErrorString("site_code", "VPBLKSITE", userId);
if(siteCode.isEmpty())
{
errString = itmdbAccessEJB.getErrorString("site_code", "VMSITECD1", userId);
return errString;
}else{
}
else
{
int count = 0;
sql = "select count(*) as count from site where site_code = ? ";
pstmt = conn.prepareStatement(sql);
......@@ -107,7 +111,8 @@ public class TaxDefermentIC extends ValidatorEJB implements TaxDefermentICRemote
if(rs.next()){
count = rs.getInt("count");
}
if(count == 0){
if(count == 0)
{
errString = itmdbAccessEJB.getErrorString("site_code", "VMSITE1", userId);
return errString;
}
......@@ -117,7 +122,9 @@ public class TaxDefermentIC extends ValidatorEJB implements TaxDefermentICRemote
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 = childNode.getFirstChild().getNodeValue();
tranType = tranType == null ? "" : tranType.trim();
......@@ -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 = childNode.getFirstChild().getNodeValue();
siteCodeFor = siteCodeFor == null ? "" : siteCodeFor.trim();
System.out.println("site code for :::::" + siteCodeFor);
if(siteCodeFor.isEmpty()){
errString = itmdbAccessEJB.getErrorString("site_code__for", "VPBLKSITE", userId);
if(siteCodeFor.isEmpty())
{
errString = itmdbAccessEJB.getErrorString("site_code__for", "VMSITECD1", userId);
return errString;
}else{
}
else
{
int count = 0;
sql = "select count(*) as count from site where site_code = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, siteCodeFor);
rs = pstmt.executeQuery();
if(rs.next()){
if(rs.next())
{
count = rs.getInt("count");
}
if(count == 0){
if(count == 0)
{
errString = itmdbAccessEJB.getErrorString("site_code__for", "VMSITE1", userId);
return errString;
}
......@@ -189,12 +203,14 @@ public class TaxDefermentIC extends ValidatorEJB implements TaxDefermentICRemote
pstmt = null;
}
}
if(childNodeName.equalsIgnoreCase("tax_code")){
if(childNodeName.equalsIgnoreCase("tax_code"))
{
taxCode = genericUtility.getColumnValue("tax_code", dom);
//taxCode = childNode.getFirstChild().getNodeValue();
taxCode = taxCode == null ? "" : taxCode.trim();
System.out.println("tax code :::" + taxCode);
if(taxCode.isEmpty()){
if(taxCode.isEmpty())
{
errString = itmdbAccessEJB.getErrorString("tax_code", "VTTAXC", userId);
return errString;
}
......
......@@ -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
{
String acctCode = "";
String acctCode = "", acctCodeRevr = "";
String active = "";
String cctrCode = "";
String cctrCode = "", cctrCodeRevr = "";
String tauthCode = "";
String taxGroup = "";
String taxCode = "";
......@@ -143,9 +143,9 @@ public class TaxIC extends ValidatorEJB implements TaxICLocal, TaxICRemote
pstmt.close();
pstmt = null;
}*/
}
/* Comment By Nasruddin 21-SEp-16 Start
else if(childNodeName.equalsIgnoreCase("curr_code"))
{
currCode = checkNull(genericUtility.getColumnValue("curr_code", dom));
......@@ -171,20 +171,22 @@ public class TaxIC extends ValidatorEJB implements TaxICLocal, TaxICRemote
pstmt.close();
pstmt = null;
}
}
}Comment By Nasruddin 21-SEp-16 End*/
else if(childNodeName.equalsIgnoreCase("tax_group"))
{
taxGroup = checkNull(genericUtility.getColumnValue("tax_group", dom));
taxCode = checkNull(genericUtility.getColumnValue("tax_code", dom));
System.out.println("212 taxGroup="+taxGroup);
System.out.println("213 taxCode="+taxCode);
/* Comment BY Nasruddin 21-SEP-16 START
if(taxGroup == null || taxGroup.trim().length() == 0)
{
errCode = "VMTAXGRP";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
else if(!taxCode.equalsIgnoreCase(taxGroup))
} Comment BY Nasruddin 21-SEP-16 END*/
if(!taxCode.equalsIgnoreCase(taxGroup))
{
sql = "select count(*) from tax where tax_code = ?";
pstmt = conn.prepareStatement(sql);
......@@ -206,6 +208,7 @@ public class TaxIC extends ValidatorEJB implements TaxICLocal, TaxICRemote
pstmt = null;
}
}
/* Comment By Nasruddin 21-Sep-16 Start
else if(childNodeName.equalsIgnoreCase("descr"))
{
descr = checkNull(genericUtility.getColumnValue("descr", dom));
......@@ -216,7 +219,7 @@ public class TaxIC extends ValidatorEJB implements TaxICLocal, TaxICRemote
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}
}Comment By Nasruddin 21-Sep-16 End*/
else if(childNodeName.equalsIgnoreCase("acct_code"))
{
acctCode = checkNull(genericUtility.getColumnValue("acct_code", dom));
......@@ -290,6 +293,81 @@ public class TaxIC extends ValidatorEJB implements TaxICLocal, TaxICRemote
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"))
{
tauthCode = checkNull(genericUtility.getColumnValue("tauth_code", dom));
......@@ -315,7 +393,7 @@ public class TaxIC extends ValidatorEJB implements TaxICLocal, TaxICRemote
pstmt = null;
}
}
/*Comment By Nasruddin 21-SEp-16 START
else if(childNodeName.equalsIgnoreCase("tax_method"))
{
taxMethod = checkNull(genericUtility.getColumnValue("tax_method", dom));
......@@ -341,7 +419,7 @@ public class TaxIC extends ValidatorEJB implements TaxICLocal, TaxICRemote
pstmt.close();
pstmt = null;
}
}
}Comment By Nasruddin 21-SEp-16 END*/
else if(childNodeName.equalsIgnoreCase("bal_group"))
{
balGroup = checkNull(genericUtility.getColumnValue("bal_group", dom));
......
......@@ -80,7 +80,7 @@ implements TaxRateICLocal, TaxRateICRemote
String errorType = "";
String errString = "";
String siteCode = "";
String taxCode = "";
String taxCode = "", taxSet ="";
String taxClass = "";
String sql = "";
String taxChap = "";
......@@ -158,26 +158,32 @@ implements TaxRateICLocal, TaxRateICRemote
else if(childNodeName.equalsIgnoreCase("tax_class"))
{
taxClass=checkNull(this.genericUtility.getColumnValue("tax_class", dom));
sql="Select Count(*) from taxclass where tax_class = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,taxClass);
rs=pstmt.executeQuery();
if(rs.next())
if(taxClass.trim().length() > 0)//cHANGED bY nasruddin 21-SEP16
{
cnt = rs.getInt(1);;
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,taxClass);
rs=pstmt.executeQuery();
if(rs.next())
{
cnt = rs.getInt(1);;
}
if(cnt==0)
{
errCode = "VTCLASS1";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
}
if(cnt==0)
{
errCode = "VTTAX1";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
}
/* Comment By Nasruddin End 21-SEP-16 START
else if(childNodeName.equalsIgnoreCase("slab_base"))
{
slabBase=this.genericUtility.getColumnValue("slab_base", dom);
......@@ -189,29 +195,32 @@ implements TaxRateICLocal, TaxRateICRemote
}
}
Comment By Nasruddin End 21-SEP-16 END*/
else if(childNodeName.equalsIgnoreCase("tax_chap"))
{
taxChap=checkNull(this.genericUtility.getColumnValue("tax_chap", dom));
sql="Select Count(*) from taxchap where tax_chap = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,taxChap);
rs=pstmt.executeQuery();
if(rs.next())
if(taxChap.trim().length() > 0)//cHANGED bY nasruddin 21-SEP16
{
cnt = rs.getInt(1);;
sql="Select Count(*) from taxchap where tax_chap = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,taxChap);
rs=pstmt.executeQuery();
if(rs.next())
{
cnt = rs.getInt(1);;
}
if(cnt==0)
{
errCode = "VTTCHAP1";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
}
if(cnt==0)
{
errCode = "VTTCHAP1";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
}
else if(childNodeName.equalsIgnoreCase("tax_base"))
{
......@@ -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"))
{
......@@ -259,7 +270,10 @@ implements TaxRateICLocal, TaxRateICRemote
{
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)
{
sql = "select count(*) from accounts where acct_code = ?";
......@@ -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"))
{
......@@ -306,7 +322,10 @@ implements TaxRateICLocal, TaxRateICRemote
{
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)
{
......
......@@ -100,6 +100,7 @@ public class TaxRevision extends ValidatorEJB implements TaxRevisionLocal,TaxRev
{
childNode = childNodeList.item(ctr);
childNodeName = childNode.getNodeName();
/* Comment By Nasruddin 21-SEp-16 Start
if(childNodeName.equalsIgnoreCase("tran_id"))
{
tranId = genericUtility.getColumnValue("tran_id", dom);
......@@ -162,15 +163,21 @@ public class TaxRevision extends ValidatorEJB implements TaxRevisionLocal,TaxRev
pstmt.close();
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 )
{
errCode = "VMSTCDNULL";
errList.add( errCode );
errFields.add( childNodeName.toLowerCase() );
}
Comment By Nasruddin Start 21-Sep-16 END
*/
taxChapOld = genericUtility.getColumnValue("tax_chap__old", dom);
sql = "select count(*) from taxchap where tax_chap = ?";
pstmt = conn.prepareStatement(sql);
......@@ -180,26 +187,29 @@ public class TaxRevision extends ValidatorEJB implements TaxRevisionLocal,TaxRev
{
cnt = rs.getInt(1);
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
if(cnt <= 0)
{
errCode = "VTTAXCHAP1";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
}
else if(childNodeName.equalsIgnoreCase("tax_chap__new"))
{
/*
* Comment By Nasruddin 21-SEp-16 Start
if ( childNode.getFirstChild() == null )
{
errCode = "VMSTCDNUL1";
errList.add( errCode );
errFields.add( childNodeName.toLowerCase() );
}
Comment By Nasruddin 21-SEp-16 END */
taxChapNew = genericUtility.getColumnValue("tax_chap__new", dom);
sql = "select count(*) from taxchap where tax_chap = ? ";
pstmt = conn.prepareStatement(sql);
......@@ -209,16 +219,91 @@ public class TaxRevision extends ValidatorEJB implements TaxRevisionLocal,TaxRev
{
cnt = rs.getInt(1);
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
if(cnt <=0)
{
errCode = "VTTAXCHAP1";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
}
//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 = null;
pstmt.close();
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;
......
......@@ -609,7 +609,7 @@ public class TransporterIC extends ValidatorEJB implements TransporterICLocal, T
else if(childNodeName.equalsIgnoreCase("cctr_code__fp"))
{
cctrCodeFp = genericUtility.getColumnValue("cctr_code__fp", dom);
if (cctrCodeFp != null && cctrCodeFp.trim().length() > 0 )
{
sql = " select count(*) from costctr where cctr_code = ? ";
......@@ -631,7 +631,7 @@ public class TransporterIC extends ValidatorEJB implements TransporterICLocal, T
rs = null;
pstmt.close();
pstmt = null;
}
}
}
// else if(childNodeName.equalsIgnoreCase("acct_code__adv"))
......
......@@ -5,15 +5,12 @@ import java.rmi.RemoteException;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import ibase.system.config.ConnDriver;
import ibase.webitm.ejb.ITMDBAccessEJB;
import ibase.webitm.ejb.ValidatorEJB;
import ibase.webitm.utility.GenericUtility;
import ibase.webitm.utility.ITMException;
import javax.ejb.Stateless;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
......@@ -58,100 +55,149 @@ public class TransporterModeIC extends ValidatorEJB implements TransporterModeIC
public String wfValData(Document dom, Document dom1, Document dom2, String objContext, String editFlag, String xtraParams)
throws RemoteException, ITMException {
String errString = "";
String sql = "", tranCode = "", tranType = "", transMode = "";
Connection conn = null;
String userId = "";
PreparedStatement pstmt = null;
ResultSet rs = null;
NodeList parentNodeList = null, childNodeList = null;
Node parentNode = null, childNode = null;
int ctr = 0, childNodeLength = 0, currentFormNo = 0;
String childNodeName = "";
try {
ConnDriver con = new ConnDriver();
//Changes and Commented By Bhushan on 13-06-2016 :START
//conn = con.getConnectDB("DriverITM");
conn = getConnection();
//Changes and Commented By Bhushan on 13-06-2016 :END
conn.setAutoCommit(false);
userId = genericUtility.getValueFromXTRA_PARAMS(xtraParams, userId);
if (objContext != null && objContext.trim().length() > 0) {
currentFormNo = Integer.parseInt(objContext);
}
System.out.println("in wfValdata doc :::::");
switch (currentFormNo) {
case 1:
parentNodeList = dom.getElementsByTagName("Detail1");
parentNode = parentNodeList.item(0);
childNodeList = parentNode.getChildNodes();
childNodeLength = childNodeList.getLength();
for (ctr = 0; ctr < childNodeLength; ctr++) {
childNode = childNodeList.item(ctr);
childNodeName = childNode.getNodeName();
if(childNodeName.equalsIgnoreCase("tran_code")){
tranCode = genericUtility.getColumnValue("tran_code", dom);
tranCode = tranCode == null ? "" : tranCode.trim();
System.out.println("transporter code ::::" + tranCode);
if(tranCode.isEmpty()){
errString = itmdbAccessEJB.getErrorString("tran_code", "VTBLTRSC", userId);
return errString;
}else{
int count = 0;
sql = "select count(*) as count from transporter where tran_code = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, tranCode);
rs = pstmt.executeQuery();
if(rs.next()){
count = rs.getInt("count");
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
if(count == 0){
errString = itmdbAccessEJB.getErrorString("tran_code", "VTTRANCD1", userId);
return errString;
}
}
String errString = "";
String sql = "", tranCode = "", tranType = "", transMode = "";
Connection conn = null;
String userId = "";
PreparedStatement pstmt = null;
ResultSet rs = null;
NodeList parentNodeList = null, childNodeList = null;
Node parentNode = null, childNode = null;
int ctr = 0, childNodeLength = 0, currentFormNo = 0;
String childNodeName = "";
try {
ConnDriver con = new ConnDriver();
//Changes and Commented By Bhushan on 13-06-2016 :START
//conn = con.getConnectDB("DriverITM");
conn = getConnection();
//Changes and Commented By Bhushan on 13-06-2016 :END
conn.setAutoCommit(false);
userId = genericUtility.getValueFromXTRA_PARAMS(xtraParams, userId);
if (objContext != null && objContext.trim().length() > 0) {
currentFormNo = Integer.parseInt(objContext);
}
System.out.println("in wfValdata doc :::::");
switch (currentFormNo) {
case 1:
parentNodeList = dom.getElementsByTagName("Detail1");
parentNode = parentNodeList.item(0);
childNodeList = parentNode.getChildNodes();
childNodeLength = childNodeList.getLength();
for (ctr = 0; ctr < childNodeLength; ctr++)
{
childNode = childNodeList.item(ctr);
childNodeName = childNode.getNodeName();
if(childNodeName.equalsIgnoreCase("tran_code"))
{
tranCode = genericUtility.getColumnValue("tran_code", dom);
tranCode = tranCode == null ? "" : tranCode.trim();
System.out.println("transporter code ::::" + tranCode);
if(tranCode.isEmpty())
{
errString = itmdbAccessEJB.getErrorString("tran_code", "VMCODNULL", userId);
return errString;
}
else
{
int count = 0;
sql = "select count(*) as count from transporter where tran_code = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, tranCode);
rs = pstmt.executeQuery();
if(rs.next())
{
count = rs.getInt("count");
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
if(count == 0)
{
errString = itmdbAccessEJB.getErrorString("tran_code", "VTTRANCD1", userId);
return errString;
}
}
}
if(childNodeName.equalsIgnoreCase("trans_mode"))
{
transMode = genericUtility.getColumnValue("trans_mode", dom);
transMode = transMode == null ? "" : transMode.trim();
System.out.println("mode of transport :::" + transMode);
if(transMode.isEmpty())
{
errString = itmdbAccessEJB.getErrorString("trans_mode", "VMCODNULL", userId);
return errString;
}
else
{
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 = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, tranCode);
pstmt.setString(2, transMode);
rs = pstmt.executeQuery();
if(rs.next())
{
count = rs.getInt("count");
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
if(count > 0)
{
errString = itmdbAccessEJB.getErrorString("", "VMDUPL1", userId);
return errString;
}
}
}
}
}
}
}
catch(Exception e)
{
System.out.println("::::" + this.getClass().getSimpleName() + ":::" + e.getMessage());
e.printStackTrace();
}
// Changed by Nasruddin 21-sep-16 Start
finally
{
try
{
if(conn != null)
{
if(rs != null)
{
rs.close();
rs = null;
}
if(childNodeName.equalsIgnoreCase("trans_mode")){
transMode = genericUtility.getColumnValue("trans_mode", dom);
transMode = transMode == null ? "" : transMode.trim();
System.out.println("mode of transport :::" + transMode);
if(transMode.isEmpty()){
errString = itmdbAccessEJB.getErrorString("trans_mode", "VTBLMOTRS", userId);
return errString;
}else{
int count = 0;
sql = "select count(*) as count from transporter_mode where tran_code = ? and trans_mode = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, tranCode);
pstmt.setString(2, transMode);
rs = pstmt.executeQuery();
if(rs.next()){
count = rs.getInt("count");
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
if(count > 0){
errString = itmdbAccessEJB.getErrorString("", "VTINVTCTM", userId);
return errString;
}
}
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
conn.close();
}
conn = null;
}
catch(Exception d)
{
d.printStackTrace();
throw new ITMException(d);
}
}catch(Exception e){
System.out.println("::::" + this.getClass().getSimpleName() + ":::" + e.getMessage());
e.printStackTrace();
}
return errString;
}
// Changed by Nasruddin 21-sep-16 End
return errString;
}
public String itemChanged(String xmlString, String xmlString1,String xmlString2, String objContext, String currentColumn, String editFlag,
String xtraParams) throws RemoteException, ITMException {
......
......@@ -119,6 +119,7 @@ public class UnitConvIC extends ValidatorEJB implements UnitConvICLocal,UnitConv
{
childNode = childNodeList.item(ctr);
childNodeName = childNode.getNodeName();
/* Comment By Nasruddin 21-Sep-16 START
if (childNodeName.trim().equalsIgnoreCase("unit__fr"))
{
unitFr = genericUtility.getColumnValue("unit__fr", dom);
......@@ -149,46 +150,80 @@ public class UnitConvIC extends ValidatorEJB implements UnitConvICLocal,UnitConv
errFields.add(childNodeName.toLowerCase());
}
}
} else if (childNodeName.trim()
.equalsIgnoreCase("unit__to"))
{
unitTo = genericUtility.getColumnValue("unit__to", dom);
unitFr = genericUtility.getColumnValue("unit__fr", dom);
} Comment By Nasruddin 21-Sep-16 END */
if (childNodeName.trim().equalsIgnoreCase("unit__to"))
{
unitTo = genericUtility.getColumnValue("unit__to", dom);
unitFr = genericUtility.getColumnValue("unit__fr", dom);
/* Comment By Nasruddin 21-Sep-16 START
if (unitTo == null || unitTo.trim().length() <= 0)
{
errCode = "VMUNIT1";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
if (unitTo != null && unitTo.trim().length() > 0)
{
sql = "select count(*) from uom where unit = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, unitTo);
rs = pstmt.executeQuery();
if (rs.next())
{
cnt = rs.getInt(1);
}
if (cnt == 0)
{
errCode = "VTUNIT1";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
}
if (unitFr.equalsIgnoreCase(unitTo))
{
errCode = "VTUNIT2";
errList.add(errCode);
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
} else if (childNodeName.trim().equalsIgnoreCase("item_code"))
/* Comment By Nasruddin 21-Sep-16 START
if (unitTo != null && unitTo.trim().length() > 0)
{
sql = "select count(*) from uom where unit = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, unitTo);
rs = pstmt.executeQuery();
if (rs.next())
{
cnt = rs.getInt(1);
}
if (cnt == 0)
{
errCode = "VTUNIT1";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
}
Comment By Nasruddin 21-Sep-16 END*/
}
/* Comment By Nasruddin 21-Sep-16 START
else if (childNodeName.trim().equalsIgnoreCase("item_code"))
{
System.out.println(""+""+""+"Change not made in UnitComnIC EJB extending ValidateEJB"+""+""+""+""+""+""+""+""+""+""+""+""+""+""+"");
itemCode = genericUtility.getColumnValue("item_code",dom);
......@@ -249,7 +284,7 @@ public class UnitConvIC extends ValidatorEJB implements UnitConvICLocal,UnitConv
}
}
}Comment by nasriuddin 19-sep-16 END*/
}// END OF FOR
}// END OF SWITCH
int errListSize = errList.size();
......
......@@ -81,49 +81,61 @@ public class UnitOfMeasureIC extends ValidatorEJB implements UnitOfMeasureICRemo
currentFormNo = Integer.parseInt(objContext);
}
System.out.println("in wfValdata doc :::::");
switch (currentFormNo) {
switch (currentFormNo)
{
case 1:
parentNodeList = dom.getElementsByTagName("Detail1");
parentNode = parentNodeList.item(0);
childNodeList = parentNode.getChildNodes();
childNodeLength = childNodeList.getLength();
for (ctr = 0; ctr < childNodeLength; ctr++) {
for (ctr = 0; ctr < childNodeLength; ctr++)
{
childNode = childNodeList.item(ctr);
childNodeName = childNode.getNodeName();
if(childNodeName.equalsIgnoreCase("unit")){
if(childNodeName.equalsIgnoreCase("unit"))
{
unit = genericUtility.getColumnValue("unit", dom);
unit = unit == null ? "" : unit.trim();
System.out.println("unit ::::" + unit);
if(unit.isEmpty()){
if(unit.isEmpty())
{
errString = itmdbAccessEJB.getErrorString("unit", "VTCRTERM", userId);
return errString;
}else if(editFlag.equalsIgnoreCase("A")){
}
else if(editFlag.equalsIgnoreCase("A"))
{
int count = 0;
sql = "select count(*) as count from uom where unit = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, unit);
rs = pstmt.executeQuery();
if(rs.next()){
count = rs.getInt("count");
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
if(count > 0){
errString = itmdbAccessEJB.getErrorString("unit", "VMPMKY", userId);
return errString;
if(unit !=null && unit.trim().length() > 0)
{
sql = "select count(*) as count from uom where unit = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, unit);
rs = pstmt.executeQuery();
if(rs.next()){
count = rs.getInt("count");
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
if(count > 0){
errString = itmdbAccessEJB.getErrorString("unit", "VMPMKY", userId);
return errString;
}
}
}
}
if(childNodeName.equalsIgnoreCase("descr")){
if(childNodeName.equalsIgnoreCase("descr"))
{
descr = genericUtility.getColumnValue("descr", dom);
//descr = descr == null ? "" : descr.trim();
System.out.println("Description :::" + descr);
if(descr.trim().isEmpty()){
errString = itmdbAccessEJB.getErrorString("descr", "VMDESCR", userId);
return errString;
}else{
}
else
{
int count = 0;
sql = "select count(*) as count from uom where unit != ? and trim(descr) = ?";
pstmt = conn.prepareStatement(sql);
......@@ -133,26 +145,33 @@ public class UnitOfMeasureIC extends ValidatorEJB implements UnitOfMeasureICRemo
if(rs.next()){
count = rs.getInt("count");
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
if(count > 0){
if(count > 0)
{
errString = itmdbAccessEJB.getErrorString("descr", "VMDUPDESCR", userId);
return errString;
}
}
}
}
}
}
}catch(Exception e){
}
catch(Exception e)
{
System.out.println("::::" + this.getClass().getSimpleName() + ":::" + e.getMessage());
e.printStackTrace();
}finally{
try{
if(rs != null){
}
finally
{
try
{
if(rs != null)
{
rs.close();
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