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,6 +195,8 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal, ...@@ -195,6 +195,8 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
{ {
custCode = this.genericUtility.getColumnValue("cust_code", dom); custCode = this.genericUtility.getColumnValue("cust_code", dom);
System.out.println("custCode :"+custCode); System.out.println("custCode :"+custCode);
siteCode = this.genericUtility.getColumnValue("site_code", dom);
System.out.println("siteCode@@@@@@@ :"+siteCode);
if(custCode == null) if(custCode == null)
{ {
System.out.println("Error : customer code should not be blank!!!"); System.out.println("Error : customer code should not be blank!!!");
...@@ -246,9 +248,17 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal, ...@@ -246,9 +248,17 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
pstmt.close(); pstmt.close();
pstmt = null; 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 }//cust code
} }
if (childNodeName.equalsIgnoreCase("item_ser")) if (childNodeName.equalsIgnoreCase("item_ser"))
{ {
...@@ -1338,7 +1348,7 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal, ...@@ -1338,7 +1348,7 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
int netValue=0,decimalNumber=0; int netValue=0,decimalNumber=0;
int lineNoCustSt=0,currentFormNo = 0,varValue=0,domID3=0,sreturnCnt=0; int lineNoCustSt=0,currentFormNo = 0,varValue=0,domID3=0,sreturnCnt=0;
int lineNoItmCnt=0,itemResLen=0,itemPos=0,itmDetCnt=0,domID2=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 invDate=null,frmDate=null,toDate=null,stmtDate=null,lrDate=null;
Date RelativeDate=null; Date RelativeDate=null;
Date nextMonthDate=null; Date nextMonthDate=null;
...@@ -1352,7 +1362,7 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal, ...@@ -1352,7 +1362,7 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
Timestamp fromDatetmstmp=null,previousDay=null,frmDate1=null; Timestamp fromDatetmstmp=null,previousDay=null,frmDate1=null;
Timestamp thirdMonthDay=null,thirdMonthFrDt=null; Timestamp thirdMonthDay=null,thirdMonthFrDt=null;
Timestamp entryStartDt=null,entryEndDt=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; SimpleDateFormat sdf;
ArrayList defData = null; ArrayList defData = null;
windowName = (new StringBuilder("w_")).append(getObjName(dom, objContext)).toString(); windowName = (new StringBuilder("w_")).append(getObjName(dom, objContext)).toString();
...@@ -2030,7 +2040,7 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal, ...@@ -2030,7 +2040,7 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
stmtDateStr= genericUtility.getColumnValue("stmt_date", dom); stmtDateStr= genericUtility.getColumnValue("stmt_date", dom);
siteCode= genericUtility.getColumnValue("site_code", dom); siteCode= genericUtility.getColumnValue("site_code", dom);
itemSer= genericUtility.getColumnValue("item_ser", 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)); positionCode = checkNull(genericUtility.getColumnValue("pos_code",dom));
empCode = checkNull(genericUtility.getColumnValue("emp_code",dom)); empCode = checkNull(genericUtility.getColumnValue("emp_code",dom));
spCode=empCode; spCode=empCode;
...@@ -2082,6 +2092,60 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal, ...@@ -2082,6 +2092,60 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
pstmt.close(); pstmt.close();
pstmt = null; 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 = ? "; /*sql= "SELECT SITE_CODE FROM SITE_CUSTOMER WHERE CUST_CODE = ? ";
pstmt = conn.prepareStatement(sql); 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