Commit 4d7a6d09 authored by agaikwad's avatar agaikwad

Added sql for multiple Scheme code


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@99178 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 70044cab
......@@ -112,8 +112,8 @@ public class SOrderForm extends ValidatorEJB implements SOrderFormLocal, SOrderF
String errString = "";
String errCode = "",errcode = "";
Connection conn = null;
PreparedStatement pstmt = null ;
ResultSet rs = null , rs1 = null;
PreparedStatement pstmt = null,pstmt1=null ;
ResultSet rs = null , rs1 = null,rs2=null;
String sql = "" ,sql1 = "";
String userId = "";
String effFromStr = null;
......@@ -183,6 +183,7 @@ public class SOrderForm extends ValidatorEJB implements SOrderFormLocal, SOrderF
DistCommon distCommon = null;
distCommon = new DistCommon();
String SalesPers1 = null;
String totqtyStr=null;
try
{
//System.out.println(".....call validate method ....");
......@@ -1229,6 +1230,7 @@ public class SOrderForm extends ValidatorEJB implements SOrderFormLocal, SOrderF
orderDate = genericUtility.getColumnValue("order_date",dom1);
custCode = genericUtility.getColumnValue("cust_code",dom1);
orderType = genericUtility.getColumnValue("order_type",dom1);
totqtyStr = genericUtility.getColumnValue("totqty",dom);
orderDateStr = genericUtility.getValidDateString(orderDate,genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat());
OrderDate = java.sql.Timestamp.valueOf(orderDateStr + " 00:00:00.00");
//System.out.println("OrderDate in time stamp:-" +OrderDate);
......@@ -1264,7 +1266,7 @@ public class SOrderForm extends ValidatorEJB implements SOrderFormLocal, SOrderF
if( qty[i] < 0 )
{
flag = true;
//break;
//break;""
}
}//end for
if( flag )
......@@ -1297,33 +1299,30 @@ public class SOrderForm extends ValidatorEJB implements SOrderFormLocal, SOrderF
rs.close();
pstmt.close();
pstmt = null;
sql = " select a.scheme_code"
+ " from scheme_applicability a, scheme_applicability_det b "
+ " where a.scheme_code = b.scheme_code"
+ " from scheme_applicability a, scheme_applicability_det b,bom c "
+ " where a.scheme_code = b.scheme_code and a.scheme_code = c.bom_code"
+ " and a.item_code = ?"
+ " and a.order_type = ? "
+ " and a.app_from <= ?"
+ " and a.valid_upto >= ?"
+ " and (b.site_code = ? or b.state_code = ? or b.count_code = ? )";
+ " and (b.site_code = ? or b.state_code = ? or b.count_code = ? ) and" +
"(? between case when c.min_qty is null then 0 else c.min_qty end And case when c.max_qty is null then 0 else c.max_qty end) ";
System.out.println("select ITEM_SER var_value.." + sql);
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,itemCode);
pstmt.setString(2,orderType);
pstmt.setTimestamp(3,OrderDate);
pstmt.setTimestamp(4,OrderDate);
pstmt.setString(5,siteCode);
pstmt.setString(6,stateCode);
pstmt.setString(7,countCode);
rs = pstmt.executeQuery();
while(rs.next()) // Request_id-SUN15OCT15-added while condition For multiple scheme code by abhijit Gaikwad on 16-OCT-2015
{
schemeCode = rs.getString(1);
rs.close();
rs = null;
pstmt.close();
pstmt = null;
System.out.println("schemeCode 1 [" + schemeCode + "]");
pstmt1 = conn.prepareStatement(sql);
pstmt1.setString(1,itemCode);
pstmt1.setString(2,orderType);
pstmt1.setTimestamp(3,OrderDate);
pstmt1.setTimestamp(4,OrderDate);
pstmt1.setString(5,siteCode);
pstmt1.setString(6,stateCode);
pstmt1.setString(7,countCode);
pstmt1.setString(8,totqtyStr);
rs2 = pstmt1.executeQuery();
while(rs2.next()) // Request_id-SUN15OCT15-added while condition For multiple scheme code by abhijit Gaikwad on 16-OCT-2015
{
schemeCode = rs2.getString("scheme_code") ;
System.out.println("schemeCode 1@@@@@@ [" + schemeCode + "]");
if( schemeCode == null || schemeCode.trim().length() == 0 )
{
System.out.println("Enter if condition");
......@@ -1354,7 +1353,7 @@ public class SOrderForm extends ValidatorEJB implements SOrderFormLocal, SOrderF
pstmt = null;
System.out.println("if scheme code" + schemeCode );
}
else if(schemeCode != null && schemeCode.trim().length() > 0 )
if(schemeCode != null && schemeCode.trim().length() > 0 )
{
System.out.println("schemeCode 2 [" + schemeCode + "]");
sql = " select batch_qty "
......@@ -1517,7 +1516,11 @@ public class SOrderForm extends ValidatorEJB implements SOrderFormLocal, SOrderF
}
}
}
}//-------------------------Ended By Abhijit Gaiwkad on 16-OCT-2015
}
rs2.close();
rs2 = null;
pstmt1.close();
pstmt1 = null;//-------------------------Ended By Abhijit Gaiwkad on 16-OCT-2015
//validation as given by jasmina on 130310-DI89SUN240
......@@ -1542,8 +1545,6 @@ public class SOrderForm extends ValidatorEJB implements SOrderFormLocal, SOrderF
String custSchemeCode = null, noapplyCust = null;
int llRow = 0, llSchcnt = 0, llCnt = 0, i = 0;
boolean proceed;
PreparedStatement pstmt1 = null;
//ResultSet rs1;
itemCode = genericUtility.getColumnValue( "item_code", dom );
......
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