Commit ce9a6a55 authored by mjadhav's avatar mjadhav

add validation for channel partner


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@98771 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 98758d40
......@@ -105,7 +105,7 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
StringBuffer valueXmlString = new StringBuffer();
String frmDateStr = "",trandateStr="",statusCust="",todateStr="",invoiceId="",itemCode="",lineNo="",orderType="",period="",tranIdLast="";
String siteCode = "",custCode="",userId="",sql="",errCode="",errorType="",errString="",itemSer="",stmtDateStr="";
String siteCode = "",custCode="",userId="",sql="",tranId="",errCode="",errorType="",errString="",itemSer="",stmtDateStr="";
Date frmdate = null,todate = null;
java.util.Date tranDate = null;
int ctr = 0,currentFormNo=0,cnt=0,countCustRef=0,refSerCnt=0,childNodeListLength=0,invCnt=0;
......@@ -118,7 +118,7 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
// boolean dateFlag=false,dateFlagTodate=false,dateFlagFrmdate=false,dateFlagstmtDate=false;
Node parentNode1 = null;
Node childNode1 = null;
int parentNodeListLength = 0,transitCnt=0;
int parentNodeListLength = 0,transitCnt=0,siteCnt=0;;
SimpleDateFormat sdf = null;
Connection conn = null;
PreparedStatement pstmt = null,pstmt1 = null,pstmt2 = null,pstmt3 = null,pstmt4 = null,pstmt5 = null,pstmt6 = null;
......@@ -211,6 +211,28 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
pstmt = null;
sql = "SELECT COUNT(1) COUNT FROM CUSTOMER WHERE CUST_CODE = ? And" +
" (CASE WHEN CHANNEL_PARTNER IS NULL THEN 'N' ELSE CHANNEL_PARTNER END ) = 'N'";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,custCode.trim());
rs = pstmt.executeQuery();
if (rs.next())
{
cnt = rs.getInt(1);
}
if (cnt == 0)
{
System.out.println("Error :Customer Should not be channel partner!! ");
errCode = "VTCUST2";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
}//cust code
}
......@@ -528,6 +550,7 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
{
childNode = childNodeList.item(ctr);
childNodeName = childNode.getNodeName();
System.out.println("childNodeName in case 2:"+childNodeName);
if (childNodeName.equalsIgnoreCase("stmt_date"))
{
stmtDateStr = this.genericUtility.getColumnValue("stmt_date",dom);
......@@ -583,12 +606,12 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
errFields.add(childNodeName.toLowerCase());
}
tranIdLast = checkNull(this.genericUtility.getColumnValue("tran_id",dom));
System.out.println("tranIdLast :"+tranIdLast);
tranId = checkNull(this.genericUtility.getColumnValue("tran_id",dom));
System.out.println("tranId :"+tranId);
sql = "select status from cust_stock where tran_id= ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,tranIdLast.trim());
pstmt.setString(1,tranId.trim());
rs = pstmt.executeQuery();
if (rs.next())
{
......@@ -607,6 +630,40 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
pstmt.close();
pstmt = null;
}
if (childNodeName.equalsIgnoreCase("site_code"))
{
custCode = this.genericUtility.getColumnValue("cust_code", dom1);
System.out.println("custCode :"+custCode);
siteCode = this.genericUtility.getColumnValue("site_code", dom1);
System.out.println("siteCode :"+siteCode);
sql = "SELECT count(*) as count FROM SITE_CUSTOMER WHERE" +
" CUST_CODE = ? AND SITE_CODE = ? AND NVL(ACTIVE_YN,'Y') = 'Y' ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,custCode.trim());
pstmt.setString(2,siteCode.trim());
rs = pstmt.executeQuery();
if (rs.next())
{
siteCnt = rs.getInt("count");
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
System.out.println("siteCnt :"+siteCnt);
if(siteCnt == 0)
{
System.out.println("Error :Record not found for this Customer and Site in CUSTOMER_SERIES.");
errCode = "VTSITECUST";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}
}
break;
......@@ -1148,7 +1205,7 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
List <String> itemListLast = new ArrayList<String>();
String selectedInvList ="";
String invoiceIdDom="";
String locality_code="";
String locality_code="",locTypeLast="";
String childNodeName = "",lineNoStrDom="",lineNoStr="",stockDlvFlg="",dlvFlagStock="";
String invoiceIdList = "",dlvFlagDom="",lineTypeAll="",lineType="";
double sretQtyAll=0.0,rateAll=0.0,retFreeQty=0.0,rcpFreeQtmDom=0.0,retQtyFreeDom=0.0,rcpQtyAll=0.0,sretQtyAllTot=0.0,transitCharQtyAll=0.0,transitQtyFreesLast=0.0,transitQtyFrees=0.0,rcpFreesAll=0.0,totReceiptLast=0.0,rcpChargableLast=0.0;
......@@ -2112,7 +2169,7 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
*
*/
System.out.println("Retrive Item Details data from previous month or current month which is exist in CUST_STOK_DET !!!!");
sql= "select item_code,unit,op_stock ,sales,purc_rcp,cl_stock,purc_ret,rate,line_no,transit_qty,item_ser ,purc_rcp__repl ,purc_rcp__free,purc_ret__repl,purc_ret__free,transit_qty__repl,transit_qty__free " +
sql= "select item_code,unit,op_stock ,sales,purc_rcp,cl_stock,purc_ret,rate,line_no,transit_qty,item_ser ,purc_rcp__repl ,purc_rcp__free,purc_ret__repl,purc_ret__free,transit_qty__repl,transit_qty__free ,loc_type " +
" from cust_stock_det where tran_id=? ";
pstmt = conn.prepareStatement(sql);
// pstmt.setString(1, tranIdLast);
......@@ -2134,6 +2191,7 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
itemCodeLast=checkNull(rs.getString("item_code"));
itemSerLast=checkNull(rs.getString("item_ser"));
unitLast=checkNull(rs.getString("unit"));
locTypeLast=checkNull(rs.getString("loc_type"));
salesLast=rs.getDouble("sales");
clStockNew=rs.getDouble("cl_stock");
lineNoCustSt=rs.getInt("line_no");
......@@ -2423,7 +2481,7 @@ public class CustStockGWTIC extends ValidatorEJB implements CustStockGWTICLocal,
//valueXmlString.append("<primary_sales>").append("<![CDATA[0]]>").append("</primary_sales>");
valueXmlString.append("<unit>").append("<![CDATA["+unitLast+"]]>").append("</unit>");
//valueXmlString.append("<loc_type>").append("<![CDATA["+itemMap.get("mlType@"+i)+"]]>").append("</loc_type>");
valueXmlString.append("<loc_type>").append("<![CDATA["+locTypeLast+"]]>").append("</loc_type>");
valueXmlString.append("<rate>").append("<![CDATA["+rateLast+"]]>").append("</rate>");
valueXmlString.append("<op_stock protect='1'>").append("<![CDATA["+opStockLast+"]]>").append("</op_stock>");
......
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