Commit ead5007f authored by smestry's avatar smestry

added new java file of customer details and item details in side panel.


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@103960 ce508802-f39f-4f6c-b175-0d175dae99d5
parent c42124cf
package ibase.webitm.bean.wms;
import java.util.ArrayList;
import ibase.system.config.AppConnectParm;
import ibase.utility.E12GenericUtility;
import ibase.webitm.ejb.wms.CustomerDetails;
import ibase.webitm.utility.ITMException;
import javax.naming.InitialContext;
import javax.servlet.http.HttpSession;
public class CustomerDetailBean
{
E12GenericUtility genericUtility = new E12GenericUtility();
private ibase.utility.UserInfoBean userInfo = null;
private HttpSession sessionCtx = null;
private String objName = "";
private String user_lang = "en";
private String user_country = "US";
public CustomerDetailBean( String objName, HttpSession sessionCtx) throws ITMException
{
try
{
this.objName = objName;
this.sessionCtx = sessionCtx;
this.userInfo = ( ibase.utility.UserInfoBean ) this.sessionCtx.getAttribute("USER_INFO");
}
catch (Exception e)
{
throw new ITMException(e);
}
}
public CustomerDetailBean()
{
}
@SuppressWarnings("rawtypes")
public ArrayList getCustomerDetails( String custCode) throws ITMException
{
ArrayList custList = new ArrayList() ;
try
{
CustomerDetails custDetails = new CustomerDetails();
custList = custDetails.getCustomerDetails(custCode);
System.out.println("ItemListBean.getItemListDetails()["+custList+"]");
}
catch (Exception e)
{
throw new ITMException(e);
}
return custList;
}
}
package ibase.webitm.bean.wms;
import java.util.ArrayList;
import ibase.system.config.AppConnectParm;
import ibase.utility.E12GenericUtility;
import ibase.webitm.ejb.wms.ItemDetails;
import ibase.webitm.utility.ITMException;
import javax.naming.InitialContext;
import javax.servlet.http.HttpSession;
public class ItemDetailBean
{
E12GenericUtility genericUtility = new E12GenericUtility();
private ibase.utility.UserInfoBean userInfo = null;
private HttpSession sessionCtx = null;
private String objName = "";
private String user_lang = "en";
private String user_country = "US";
public ItemDetailBean( String objName, HttpSession sessionCtx) throws ITMException
{
try
{
this.objName = objName;
this.sessionCtx = sessionCtx;
this.userInfo = ( ibase.utility.UserInfoBean ) this.sessionCtx.getAttribute("USER_INFO");
}
catch (Exception e)
{
throw new ITMException(e);
}
}
public ItemDetailBean()
{
}
@SuppressWarnings("rawtypes")
public ArrayList getItemListDetails( String itemCode) throws ITMException
{
ArrayList itemList = new ArrayList();
try
{
ItemDetails listDetails = new ItemDetails();
itemList = listDetails.getItemListDetails(itemCode);
System.out.println("ItemListBean.getItemListDetails()["+itemList+"]");
}
catch (Exception e)
{
throw new ITMException(e);
}
return itemList;
}
public String getDocId( String itemCode) throws ITMException
{
String docId = "" ;
try
{
ItemDetails listDetails = new ItemDetails();
docId = listDetails.getDocId(itemCode);
System.out.println("ItemListBean.getDocId()["+docId+"]");
}
catch (Exception e)
{
throw new ITMException(e);
}
return docId;
}
}
package ibase.webitm.ejb.wms;
import ibase.webitm.ejb.ValidatorEJB;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.ArrayList;
public class CustomerDetails extends ValidatorEJB
{
@SuppressWarnings({ "unchecked", "rawtypes" })
public ArrayList getCustomerDetails(String custCode)
{
String sql = "";
Connection conn = null;
PreparedStatement pstmt = null;
ResultSet rs = null;
ArrayList custList = new ArrayList();
boolean isExists = false;
try
{
conn = getConnection();
sql = "SELECT (SELECT COUNT(*) FROM SORDER SORDER, DESPATCH DESPATCH WHERE SORDER.CUST_CODE = ? AND SORDER.STATUS NOT IN ('C','X','H') "
+ " AND DESPATCH.SORD_NO = SORDER.SALE_ORDER AND DESPATCH.CONFIRMED = 'N') AS CUSTOMER_OPEN_ORDER, CUST_PRIORITY, "
+ " (SELECT COUNT(*) FROM SORDER WHERE CUST_CODE = ? AND ORDER_DATE <= SYSDATE) AS TOTAL_ORDER_TILL_DATE, CR_TERM, SALES_PERS, "
+ " WAVE_TYPE, CONT_PERS, BLACK_LISTED, BLACK_LISTED_DATE, (SELECT FN_PAYAMT_CHECK(?) FROM DUAL) AS PAY_AMOUNT, "
+ " (SELECT FN_OUVERDUE_CHECK(?) FROM DUAL) AS DUE_AMOUNT_TILL_DATE "
+ " FROM CUSTOMER WHERE CUST_CODE = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, checkNull(custCode));
pstmt.setString(2, checkNull(custCode));
pstmt.setString(3, checkNull(custCode));
pstmt.setString(4, checkNull(custCode));
pstmt.setString(5, checkNull(custCode));
rs = pstmt.executeQuery();
if ( rs.next())
{
custList.add(checkNull(rs.getString("CUSTOMER_OPEN_ORDER")));
custList.add(checkNull(rs.getString("CUST_PRIORITY")));
custList.add(checkNull(rs.getString("TOTAL_ORDER_TILL_DATE")));
custList.add(checkNull(rs.getString("CR_TERM")));
custList.add(checkNull(rs.getString("SALES_PERS")));
custList.add(checkNull(rs.getString("WAVE_TYPE")));
custList.add(checkNull(rs.getString("CONT_PERS")));
custList.add(checkNull(rs.getString("BLACK_LISTED")));
custList.add(checkNull(rs.getString("BLACK_LISTED_DATE")));
custList.add(checkNull(rs.getString("PAY_AMOUNT")));
custList.add(checkNull(rs.getString("DUE_AMOUNT_TILL_DATE")));
isExists = true;
}
if(!isExists)
{
custList.add("");
custList.add("");
custList.add("");
custList.add("");
custList.add("");
custList.add("");
custList.add("");
custList.add("");
custList.add("");
custList.add("");
custList.add("");
}
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null )
{
pstmt.close();
pstmt = null;
}
}
catch (Exception e)
{
System.out.println(" Exception in CustomerDetails.getCustomerDetails()["+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 e)
{
System.out.println("Exception in CustomerDetails.getCustomerDetails()");
e.printStackTrace();
}
}
System.out.println("return String :" + custList);
return custList;
}
private String checkNull( String input )
{
if ( input == null )
{
input = "";
}
return input.trim();
}
}
package ibase.webitm.ejb.wms;
import ibase.webitm.ejb.ValidatorEJB;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.ArrayList;
public class ItemDetails extends ValidatorEJB
{
@SuppressWarnings({ "unchecked", "rawtypes" })
public ArrayList getItemListDetails(String itemCode)
{
String sql = "";
Connection conn = null;
PreparedStatement pstmt = null;
ResultSet rs = null;
ArrayList itemList = new ArrayList();
boolean isExists = false;
try
{
conn = getConnection();
sql = "SELECT I1.ITEM_PARNT, I1.DESCR AS PARENT_DESCR, I1.PHY_ATTRIB_2, I1.PHY_ATTRIB_6, I1.PHY_ATTRIB_4, I.DESCR FROM ITEM I1, ITEM I WHERE I1.ITEM_PARNT = I.ITEM_CODE (+) AND I1.ITEM_CODE = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, checkNull(itemCode));
rs = pstmt.executeQuery();
if ( rs.next())
{
itemList.add(checkNullAndBlank( rs.getString("ITEM_PARNT") ));
itemList.add(checkNullAndBlank( rs.getString("PARENT_DESCR") ));
itemList.add(checkNullAndBlank( rs.getString("PHY_ATTRIB_2") ));
itemList.add(checkNullAndBlank( rs.getString("PHY_ATTRIB_6") ));
itemList.add(checkNullAndBlank( rs.getString("PHY_ATTRIB_4") ));
itemList.add(checkNullAndBlank( rs.getString("DESCR") ));
isExists = true;
}
if(!isExists)
{
itemList.add("");
itemList.add("");
itemList.add("");
itemList.add("");
itemList.add("");
itemList.add("");
}
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null )
{
pstmt.close();
pstmt = null;
}
}
catch (Exception e)
{
System.out.println("ItemListDetails.getItemListDetails()["+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 e)
{
System.out.println("ItemListDetails.getItemListDetails()");
e.printStackTrace();
}
}
System.out.println("ItemListDetails from ItemListDetails =======>>["+itemList+"]");
return itemList;
}
@SuppressWarnings({ "rawtypes", "unchecked" })
public String getDocId(String itemCode)
{
System.out.println("inside getDocIDImages");
PreparedStatement pstmt = null;
ResultSet rs = null;
String sql = "";
String errString = "";
Connection conn = null;
ArrayList itemList = new ArrayList();
try
{
conn = getConnection();
sql = " SELECT DOC_TRANSACTION_LINK.DOC_ID FROM DOC_TRANSACTION_LINK DOC_TRANSACTION_LINK, DOC_CONTENTS DOC_CONTENTS, ITEM ITEM "
+ " WHERE DOC_TRANSACTION_LINK.DOC_ID = DOC_CONTENTS.DOC_ID AND DOC_TRANSACTION_LINK.REF_ID = ITEM.ITEM_PARNT AND "
+ " ITEM.ITEM_CODE = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, itemCode);
rs = pstmt.executeQuery();
while (rs.next())
{
itemList.add(checkNull(rs.getString("DOC_ID")));
}
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null )
{
pstmt.close();
pstmt = null;
}
}
catch (Exception ex)
{
System.out.println("Inside catch getDocIDImages");
ex.printStackTrace();
}
finally
{
try
{
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null )
{
pstmt.close();
pstmt = null;
}
if (conn != null && !conn.isClosed())
{
conn.close();
conn = null;
}
}
catch (Exception e)
{
System.out.println("ItemListDetails.getDocId()["+e.getMessage()+"]");
}
}
errString = itemList.toString();
errString = errString.substring(1, errString.length() - 1);
System.out.println("errString ::::::::["+errString+"]");
return errString;
}
private String checkNull( String input )
{
if ( input == null )
{
input = "";
}
return input.trim();
}
private String checkNullAndBlank( String input )
{
if ( input == null )
{
input = " ";
}
return input;
}
}
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