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