Commit bfd4192b authored by caluka's avatar caluka

SITE_CUSTOMER validation added for customer for site code condition


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@100254 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 60d869cf
......@@ -195,7 +195,9 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
{
custCode = this.genericUtility.getColumnValue("cust_code", dom);
System.out.println("custCode :"+custCode);
if(custCode == null)
siteCode = this.genericUtility.getColumnValue("site_code", dom);
System.out.println("siteCode@@@@@@@ :"+siteCode);
if(custCode == null)
{
System.out.println("Error : customer code should not be blank!!!");
errCode = "NULSTRGCD";
......@@ -245,9 +247,17 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
rs = null;
pstmt.close();
pstmt = null;
if(siteCode == null || siteCode.trim().length()==0)
{
System.out.println("Error : Site code should exist in site_customer!!!");
errCode = "NULSITECD";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}//cust code
}
if (childNodeName.equalsIgnoreCase("item_ser"))
......@@ -1338,7 +1348,7 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
int netValue=0,decimalNumber=0;
int lineNoCustSt=0,currentFormNo = 0,varValue=0,domID3=0,sreturnCnt=0;
int lineNoItmCnt=0,itemResLen=0,itemPos=0,itmDetCnt=0,domID2=0;
int invCnt=0,dlvFlgCnt=0;
int invCnt=0,dlvFlgCnt=0,siteCustCnt=0;
Date invDate=null,frmDate=null,toDate=null,stmtDate=null,lrDate=null;
Date RelativeDate=null;
Date nextMonthDate=null;
......@@ -1352,7 +1362,7 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
Timestamp fromDatetmstmp=null,previousDay=null,frmDate1=null;
Timestamp thirdMonthDay=null,thirdMonthFrDt=null;
Timestamp entryStartDt=null,entryEndDt=null;
Boolean isClStockInt=true,isDouble= true,isTableNo=false,isCustomer=false,isPreviusItem=false;
Boolean isClStockInt=true,isDouble= true,isTableNo=false,isCustomer=false,isPreviusItem=false,isSiteExist=false;
SimpleDateFormat sdf;
ArrayList defData = null;
windowName = (new StringBuilder("w_")).append(getObjName(dom, objContext)).toString();
......@@ -2030,7 +2040,7 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
stmtDateStr= genericUtility.getColumnValue("stmt_date", dom);
siteCode= genericUtility.getColumnValue("site_code", dom);
itemSer= genericUtility.getColumnValue("item_ser", dom);
//System.out.println("siteCode :"+siteCode);
System.out.println("login siteCode :"+siteCode);
positionCode = checkNull(genericUtility.getColumnValue("pos_code",dom));
empCode = checkNull(genericUtility.getColumnValue("emp_code",dom));
spCode=empCode;
......@@ -2082,6 +2092,60 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
pstmt.close();
pstmt = null;
//Start added by chandr shekar on 23-feb-2016
sql= "SELECT COUNT(1) COUNT FROM SITE_CUSTOMER WHERE CUST_CODE = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, custCode);
rs = pstmt.executeQuery();
if(rs.next())
{
siteCustCnt = rs.getInt(1);
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
if(siteCustCnt >1)
{
sql= "SELECT SITE_CODE FROM SITE_CUSTOMER WHERE CUST_CODE = ? " +
" and case when primary_site is null then 'N' else primary_site end= 'Y' ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, custCode);
rs = pstmt.executeQuery();
if(rs.next())
{
siteCode=checkNull(rs.getString("SITE_CODE"));
isSiteExist=true;
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
}else if(siteCustCnt == 1)
{
sql= "SELECT SITE_CODE FROM SITE_CUSTOMER WHERE CUST_CODE = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, custCode);
rs = pstmt.executeQuery();
if(rs.next())
{
siteCode=checkNull(rs.getString("SITE_CODE"));
isSiteExist=true;
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
}
System.out.println("isSiteExist@@@@@@@@@"+isSiteExist);
if(!isSiteExist)
{
siteCode="";
}
//End added by chandr shekar on 23-feb-2016
/*sql= "SELECT SITE_CODE FROM SITE_CUSTOMER WHERE CUST_CODE = ? ";
pstmt = conn.prepareStatement(sql);
......
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