Commit 2f710f93 authored by awarekar's avatar awarekar

On change of contact_code, respective contact_type will check and all the data...

On change of contact_code, respective contact_type will check and all the data will set from customer_default. 

git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@191176 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 6f158e1c
...@@ -11,6 +11,7 @@ import java.sql.Connection; ...@@ -11,6 +11,7 @@ import java.sql.Connection;
import java.sql.PreparedStatement; import java.sql.PreparedStatement;
import java.sql.ResultSet; import java.sql.ResultSet;
import java.sql.ResultSetMetaData; import java.sql.ResultSetMetaData;
import java.sql.SQLException;
import java.sql.Timestamp; import java.sql.Timestamp;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.ArrayList;
...@@ -1793,7 +1794,7 @@ implements CustomerLocal, CustomerRemote ...@@ -1793,7 +1794,7 @@ implements CustomerLocal, CustomerRemote
Node parentNode = null; Node parentNode = null;
Node childNode = null; Node childNode = null;
String childNodeName = null; String childNodeName = null;
String sql = "", sql1 = "", sql2 = ""; String sql = "", sql1 = "", sql2 = "",sql5 = "";
Connection conn = null; Connection conn = null;
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
PreparedStatement pstmt1 = null; PreparedStatement pstmt1 = null;
...@@ -1817,7 +1818,7 @@ implements CustomerLocal, CustomerRemote ...@@ -1817,7 +1818,7 @@ implements CustomerLocal, CustomerRemote
String rateRound = ""; String rateRound = "";
String name = "", shName = "", contPers = "", contPfx = "", addr1 = "", addr2 = "", addr3 = "", stateCode = "", String name = "", shName = "", contPers = "", contPfx = "", addr1 = "", addr2 = "", addr3 = "", stateCode = "",
tele1 = "", tele2 = "", tele3 = "", teleExt = "", fax = "", emailAddr = "", ediAddr = ""; tele1 = "", tele2 = "", tele3 = "", teleExt = "", fax = "", emailAddr = "", ediAddr = "";
String contPfx1 = "", contPers1 = "", Add1 = "", emailAddr1 = "", ediAddr1 = "", keyFlag = ""; String contPfx1 = "", contPers1 = "", Add1 = "", emailAddr1 = "", ediAddr1 = "", contactType="", keyFlag = "";
String regCode = "", regDescr = "", empCodeOrd = "", empFname = "", empLname = "", empCodeOrd1 = "", String regCode = "", regDescr = "", empCodeOrd = "", empFname = "", empLname = "", empCodeOrd1 = "",
deptCode = ""; deptCode = "";
int ctr = 0; int ctr = 0;
...@@ -2044,7 +2045,8 @@ implements CustomerLocal, CustomerRemote ...@@ -2044,7 +2045,8 @@ implements CustomerLocal, CustomerRemote
{ {
contactCode = checkNull(genericUtility.getColumnValue("contact_code", dom)); contactCode = checkNull(genericUtility.getColumnValue("contact_code", dom));
sql = "select name, sh_name, cont_pers, cont_pfx, addr1, addr2,addr3, city, pin, state_code," + " count_code, tele1, tele2, tele3,tele_ext, fax, email_addr, edi_addr" + " from contact where contact_code = ?"; sql = "select name, sh_name, cont_pers, cont_pfx, addr1, addr2,addr3, city, pin, state_code," +
" count_code, tele1, tele2, tele3,tele_ext, fax, email_addr, edi_addr,contact_type from contact where contact_code = ?";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, contactCode); pstmt.setString(1, contactCode);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
...@@ -2068,12 +2070,14 @@ implements CustomerLocal, CustomerRemote ...@@ -2068,12 +2070,14 @@ implements CustomerLocal, CustomerRemote
fax = checkNull(rs.getString("fax")); fax = checkNull(rs.getString("fax"));
emailAddr = checkNull(rs.getString("email_addr")); emailAddr = checkNull(rs.getString("email_addr"));
ediAddr = checkNull(rs.getString("edi_addr")); ediAddr = checkNull(rs.getString("edi_addr"));
//Added by Amey W 25/9/2018 [To get contact_type from contact master]
contactType = checkNull(rs.getString("contact_type"));
} }
rs.close(); rs.close();
rs = null; rs = null;
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
custName = checkNull(genericUtility.getColumnValue("cust_name", dom)); custName = checkNull(genericUtility.getColumnValue("cust_name", dom));
if (custName == null || custName.trim().length() <= 0) if (custName == null || custName.trim().length() <= 0)
{ {
...@@ -2196,6 +2200,18 @@ implements CustomerLocal, CustomerRemote ...@@ -2196,6 +2200,18 @@ implements CustomerLocal, CustomerRemote
valueXmlString.append("<customer_cust_name ><![CDATA[" + custName + "]]></customer_cust_name>"); valueXmlString.append("<customer_cust_name ><![CDATA[" + custName + "]]></customer_cust_name>");
} }
} }
//Added by AMEY on 24/09/2018 [start] to get data from supplier default master from cust_type from respective contact code
if ( contactType != null || contactType.trim().length() > 0 )
{
StringBuffer customerDefaultData = setCustomerDefaultData( contactType, conn, xtraParams, dom );
if( customerDefaultData != null && customerDefaultData.length() > 0 )
{
valueXmlString.append( customerDefaultData );
}
}
//Added by AMEY on 24/09/2018 [end] to get data from supplier default master from cust_type from respective contact code
} }
else if (currentColumn.trim().equalsIgnoreCase("bank_code")) else if (currentColumn.trim().equalsIgnoreCase("bank_code"))
{ {
...@@ -2387,119 +2403,21 @@ implements CustomerLocal, CustomerRemote ...@@ -2387,119 +2403,21 @@ implements CustomerLocal, CustomerRemote
valueXmlString.append("<dept_code ><![CDATA[" + deptCode + "]]></dept_code>"); valueXmlString.append("<dept_code ><![CDATA[" + deptCode + "]]></dept_code>");
} }
} }
//Added by Pooja S. Start //Added by AMEY on 24/09/2018 [start] to get data from supplier default master from cust_type
else if (currentColumn.trim().equalsIgnoreCase("cust_type")) else if ( currentColumn.trim().equalsIgnoreCase("cust_type") )
{ {
custType = checkNull(genericUtility.getColumnValue("cust_type", dom)); custType = checkNull(genericUtility.getColumnValue("cust_type", dom));
sql = "select * from Customer_default where cust_type = ?"; if ( custType != null || custType.trim().length() > 0 )
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, custType);
rs = pstmt.executeQuery();
ResultSetMetaData rsmd = rs.getMetaData();
int columnCount = rsmd.getColumnCount();
ResultSet rset = null;
PreparedStatement pstm = null;
while (rs.next())
{ {
for (int i = 1; i <= columnCount; i++) StringBuffer customerDefaultData = setCustomerDefaultData( custType, conn, xtraParams, dom );
if( customerDefaultData!=null && customerDefaultData.length() > 0 )
{ {
colName = rsmd.getColumnName(i).toLowerCase(); valueXmlString.append(customerDefaultData);
colValue = checkNull(rs.getString(colName));
//Changes by Pooja S. on 06/09/18 [value of column does not set if field is not blank] START
if (colValue != null && colValue.trim().length() > 0)
{
valueXmlString.append("<" + colName + ">").append("<![CDATA[" + colValue + "]]>").append("</" + colName + ">");
}
//Changes by Pooja S. on 06/09/18 [value of column does not set if field is not blank] END
if (colName.equals("site_code__pay"))
{
if (colValue == null || colValue.trim().length() == 0)
{
siteCodePay = getValueFromXTRA_PARAMS(xtraParams, "loginSiteCode");
valueXmlString.append("<" + colName + ">").append("<![CDATA[" + siteCodePay + "]]>").append("</" + colName + ">");
}
}
/*else if (colName.equals("part_Qty"))
{
if (colValue == null || colValue.trim().length() == 0)
{
partQty = getValueFromXTRA_PARAMS(xtraParams, "loginSiteCode");
valueXmlString.append("<" + colName + ">").append("<![CDATA[" + partQty + "]]>").append("</" + colName + ">");
}
}*/
else if (colName.equals("site_code__rcp"))
{
if (colValue == null || colValue.trim().length() == 0)
{
siteCodeRcp = getValueFromXTRA_PARAMS(xtraParams, "loginSiteCode");
valueXmlString.append("<" + colName + ">").append("<![CDATA[" + siteCodeRcp + "]]>").append("</" + colName + ">");
}
}
else if (colName.equals("curr_code"))
{
if (colValue == null || (colValue != null && (colValue.equals("") || colValue.trim().length() == 0)))
{
String countCode2 = checkNull(genericUtility.getColumnValue("count_code", dom));
String stateCode1 = checkNull(genericUtility.getColumnValue("state_code", dom));
sql = "select curr_code from COUNTRY where count_code =? and state_code=?";
pstm = conn.prepareStatement(sql);
pstm.setString(1, countCode2);
pstm.setString(2, stateCode1);
rset = pstm.executeQuery();
if (rset.next())
{
currCode2 = checkNull(rset.getString("curr_code"));
valueXmlString.append("<curr_code ><![CDATA[" + currCode2 + "]]></curr_code>");
}
rset.close();
rset = null;
pstm.close();
pstm = null;
}
}
else if (colName.equals("price_list"))
{
System.out.print("Value colvalue5 \n [" + colValue + "]");
if (colValue == null || (colValue != null && (colValue.equals("") || colValue.trim().length() == 0)))
{
String countCode3 = checkNull(genericUtility.getColumnValue("count_code", dom));
String stateCode1 = checkNull(genericUtility.getColumnValue("state_code", dom));
sql = "select price_list from STATE where count_code =? and state_code=?";
pstm = conn.prepareStatement(sql);
pstm.setString(1, countCode3);
pstm.setString(2, stateCode1);
rset = pstm.executeQuery();
if (rset.next())
{
priceList = checkNull(rset.getString("price_list"));
valueXmlString.append("<price_list ><![CDATA[" + priceList + "]]></price_list>");
valueXmlString.append("<price_list__disc ><![CDATA[" + priceList + "]]></price_list__disc>");
}
rset.close();
rset = null;
pstm.close();
pstm = null;
}
}
//Changes by Pooja S. on 06/09/18 [value of column does not set if field is not blank] START
/*else
{
valueXmlString.append("<" + colName + ">").append("<![CDATA[" + colValue + "]]>").append("</" + colName + ">");
}*/
//Changes by Pooja S. on 06/09/18 [value of column does not set if field is not blank] END
} }
} }
rs.close();
rs = null;
pstmt.close();
pstmt = null;
} }
//Added by AMEY on 24/09/2018 [end] to get data from supplier default master from cust_type
else if (currentColumn.trim().equalsIgnoreCase("full_name")) else if (currentColumn.trim().equalsIgnoreCase("full_name"))
{ {
String fullName1 = checkNull(genericUtility.getColumnValue("full_name", dom)); String fullName1 = checkNull(genericUtility.getColumnValue("full_name", dom));
...@@ -2608,7 +2526,151 @@ implements CustomerLocal, CustomerRemote ...@@ -2608,7 +2526,151 @@ implements CustomerLocal, CustomerRemote
return Double.parseDouble(str); return Double.parseDouble(str);
} }
} }
//Added by AMEY on 24/09/2018 [start] to get data from supplier default master from cust_type
/**
*
*
* @param custType
* @param conn
* @param xtraParams
* @param dom
* @return
*/
private StringBuffer setCustomerDefaultData( String custType, Connection conn, String xtraParams, Document dom )
{
String colName="";
String colValue="";
String sql="";
PreparedStatement pstmt=null;
ResultSet rs = null ;
StringBuffer valueXmlString = new StringBuffer();
try
{
//Added By Pooja S STRAT
sql = "select * from Customer_default where cust_type = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, custType);
rs = pstmt.executeQuery();
ResultSetMetaData rsmd = rs.getMetaData();
int columnCount = rsmd.getColumnCount();
ResultSet rset = null;
PreparedStatement pstm = null;
if (rs.next())
{
for (int i = 1; i <= columnCount; i++)
{
colName = rsmd.getColumnName(i).toLowerCase();
colValue = checkNull(rs.getString(colName));
if (colValue != null && colValue.trim().length() > 0)
{
valueXmlString.append("<" + colName + ">").append("<![CDATA[" + colValue + "]]>").append("</" + colName + ">");
}
if (colName.equals("site_code__pay"))
{
if (colValue == null || colValue.trim().length() == 0)
{
String siteCodePay = getValueFromXTRA_PARAMS(xtraParams, "loginSiteCode");
valueXmlString.append("<" + colName + ">").append("<![CDATA[" + siteCodePay + "]]>").append("</" + colName + ">");
}
}
/*else if (colName.equals("part_Qty"))
{
if (colValue == null || colValue.trim().length() == 0)
{
partQty = getValueFromXTRA_PARAMS(xtraParams, "loginSiteCode");
valueXmlString.append("<" + colName + ">").append("<![CDATA[" + partQty + "]]>").append("</" + colName + ">");
}
}*/
else if (colName.equals("site_code__rcp"))
{
if (colValue == null || colValue.trim().length() == 0)
{
String siteCodeRcp = getValueFromXTRA_PARAMS(xtraParams, "loginSiteCode");
valueXmlString.append("<" + colName + ">").append("<![CDATA[" + siteCodeRcp + "]]>").append("</" + colName + ">");
}
}
else if (colName.equals("curr_code"))
{
if (colValue == null || (colValue != null && (colValue.equals("") || colValue.trim().length() == 0)))
{
String countCode2 = checkNull(genericUtility.getColumnValue("count_code", dom));
String stateCode1 = checkNull(genericUtility.getColumnValue("state_code", dom));
sql = "select curr_code from COUNTRY where count_code =? and state_code=?";
pstm = conn.prepareStatement(sql);
pstm.setString(1, countCode2);
pstm.setString(2, stateCode1);
rset = pstm.executeQuery();
if (rset.next())
{
String currCode2 = checkNull(rset.getString("curr_code"));
valueXmlString.append("<curr_code ><![CDATA[" + currCode2 + "]]></curr_code>");
}
rset.close();
rset = null;
pstm.close();
pstm = null;
}
}
else if (colName.equals("price_list"))
{
System.out.print("Value colvalue5 \n [" + colValue + "]");
if (colValue == null || (colValue != null && (colValue.equals("") || colValue.trim().length() == 0)))
{
String countCode3 = checkNull(genericUtility.getColumnValue("count_code", dom));
String stateCode1 = checkNull(genericUtility.getColumnValue("state_code", dom));
sql = "select price_list from STATE where count_code =? and state_code=?";
pstm = conn.prepareStatement(sql);
pstm.setString(1, countCode3);
pstm.setString(2, stateCode1);
rset = pstm.executeQuery();
if (rset.next())
{
String priceList = checkNull(rset.getString("price_list"));
valueXmlString.append("<price_list ><![CDATA[" + priceList + "]]></price_list>");
valueXmlString.append("<price_list__disc ><![CDATA[" + priceList + "]]></price_list__disc>");
}
rset.close();
rset = null;
pstm.close();
pstm = null;
}
}
}
}
//Added By Pooja S END
}
catch(Exception e)
{
System.out.println("Customer.setCustomerDefaultData() "+ e.getStackTrace());
}
finally
{
try
{
rs.close();
rs = null;
pstmt.close();
pstmt = null;
}
catch (SQLException e)
{
System.out.println(e);
}
}
return valueXmlString;
}
//Added by AMEY on 24/09/2018 [start] to get data from supplier default master from cust_type
private String errorType(Connection conn, String errorCode) throws ITMException private String errorType(Connection conn, String errorCode) throws ITMException
{ {
String msgType = ""; String msgType = "";
......
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