Commit 348ade1d authored by agaikwad's avatar agaikwad

Request_id-SUN15OCT15-multiple scheme define in same item then pick up the...

Request_id-SUN15OCT15-multiple scheme define in same item then pick up the wrong scheme code Quantity not selected for scheme code.


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@98763 ce508802-f39f-4f6c-b175-0d175dae99d5
parent b8f50835
...@@ -1233,7 +1233,7 @@ public class SOrderForm extends ValidatorEJB implements SOrderFormLocal, SOrderF ...@@ -1233,7 +1233,7 @@ public class SOrderForm extends ValidatorEJB implements SOrderFormLocal, SOrderF
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);
String totqtystr = genericUtility.getColumnValue("totqty",dom); String totqtystr = genericUtility.getColumnValue("totqty",dom);
System.out.println("total Quantity"+totqtystr);
if( totqtystr == null || totqtystr.trim().length() == 0 || "null".equalsIgnoreCase( totqtystr ) ) if( totqtystr == null || totqtystr.trim().length() == 0 || "null".equalsIgnoreCase( totqtystr ) )
{ {
errString = getErrorString("totqty","VTTOTQTBLK",userId); errString = getErrorString("totqty","VTTOTQTBLK",userId);
...@@ -1273,6 +1273,8 @@ public class SOrderForm extends ValidatorEJB implements SOrderFormLocal, SOrderF ...@@ -1273,6 +1273,8 @@ public class SOrderForm extends ValidatorEJB implements SOrderFormLocal, SOrderF
errString = getErrorString("qty_1",errCode,userId); errString = getErrorString("qty_1",errCode,userId);
break; break;
} }
System.out.println("totalqty"+totalqty);
System.out.println("totqty"+totqty);
if (totalqty != totqty) if (totalqty != totqty)
{ {
errCode = "VTQTY1"; errCode = "VTQTY1";
...@@ -1295,6 +1297,7 @@ public class SOrderForm extends ValidatorEJB implements SOrderFormLocal, SOrderF ...@@ -1295,6 +1297,7 @@ 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 "
+ " where a.scheme_code = b.scheme_code" + " where a.scheme_code = b.scheme_code"
...@@ -1303,7 +1306,7 @@ public class SOrderForm extends ValidatorEJB implements SOrderFormLocal, SOrderF ...@@ -1303,7 +1306,7 @@ public class SOrderForm extends ValidatorEJB implements SOrderFormLocal, SOrderF
+ " 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 = ? )";
//System.out.println("select ITEM_SER var_value.." + sql); System.out.println("select ITEM_SER var_value.." + sql);
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1,itemCode); pstmt.setString(1,itemCode);
pstmt.setString(2,orderType); pstmt.setString(2,orderType);
...@@ -1313,16 +1316,17 @@ public class SOrderForm extends ValidatorEJB implements SOrderFormLocal, SOrderF ...@@ -1313,16 +1316,17 @@ public class SOrderForm extends ValidatorEJB implements SOrderFormLocal, SOrderF
pstmt.setString(6,stateCode); pstmt.setString(6,stateCode);
pstmt.setString(7,countCode); pstmt.setString(7,countCode);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
if(rs.next()) while(rs.next()) // Request_id-SUN15OCT15-added while condition For multiple scheme code by abhijit Gaikwad on 16-OCT-2015
{ {
schemeCode = rs.getString(1) == null ? "" : rs.getString(1); schemeCode = rs.getString(1);
}
rs.close(); rs.close();
rs = null;
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
//System.out.println("schemeCode 1 [" + schemeCode + "]"); 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");
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 "
+ " where a.scheme_code = b.scheme_code" + " where a.scheme_code = b.scheme_code"
...@@ -1345,13 +1349,14 @@ public class SOrderForm extends ValidatorEJB implements SOrderFormLocal, SOrderF ...@@ -1345,13 +1349,14 @@ public class SOrderForm extends ValidatorEJB implements SOrderFormLocal, SOrderF
schemeCode = rs.getString(1) ; schemeCode = rs.getString(1) ;
} }
rs.close(); rs.close();
rs = null;
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
System.out.println("if scheme code" + schemeCode );
} }
//System.out.println("schemeCode 2 [" + 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 " sql = " select batch_qty "
+ " from bom" + " from bom"
+ " where bom_code = ?"; + " where bom_code = ?";
...@@ -1364,24 +1369,29 @@ public class SOrderForm extends ValidatorEJB implements SOrderFormLocal, SOrderF ...@@ -1364,24 +1369,29 @@ public class SOrderForm extends ValidatorEJB implements SOrderFormLocal, SOrderF
batchQty = rs.getDouble(1) ; batchQty = rs.getDouble(1) ;
} }
rs.close(); rs.close();
rs = null;
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
System.out.println("BAtch Quntity"+batchQty);
flag = false; flag = false;
for(int i = 0; i < 12; i++) for(int i = 0; i < 12; i++)
{ {
strSch=""; strSch="";
strSch = "qty_"+i; strSch = "qty_"+i;
//System.out.println("strSch value...." + strSch); System.out.println("strSch value...." + strSch);
qtyStr[i] = genericUtility.getColumnValue(strSch,dom); qtyStr[i] = genericUtility.getColumnValue(strSch,dom);
//qtyStr[i] = qty_[i]; //qtyStr[i] = qty_[i];
qty[i] = Double.parseDouble( ( qtyStr[i] == null || qtyStr[i].trim().length() == 0 ? "0" : qtyStr[i].trim() ) ); qty[i] = Double.parseDouble( ( qtyStr[i] == null || qtyStr[i].trim().length() == 0 ? "0" : qtyStr[i].trim() ) );
//System.out.println("qty[i] [" + qty[i] + "] batchQty [" + batchQty + "] mod [" + (qty[i] % batchQty) +"]"); System.out.println("qty[i] [" + qty[i] + "] batchQty [" + batchQty + "] mod [" + (qty[i] % batchQty) +"]");
if( (qty[i] % batchQty) > 0 ) if( (qty[i] % batchQty) > 0 )
{ {
flag = true; flag = true;
break; break;
} }
}//end for }//end for
System.out.println("Flag is========"+ flag);
if( flag ) if( flag )
{ {
errCode = "VTSCHQTY"; errCode = "VTSCHQTY";
...@@ -1401,6 +1411,7 @@ public class SOrderForm extends ValidatorEJB implements SOrderFormLocal, SOrderF ...@@ -1401,6 +1411,7 @@ public class SOrderForm extends ValidatorEJB implements SOrderFormLocal, SOrderF
} }
rs.close(); rs.close();
rs = null;
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
if(restrictUpto != null) if(restrictUpto != null)
...@@ -1506,6 +1517,8 @@ public class SOrderForm extends ValidatorEJB implements SOrderFormLocal, SOrderF ...@@ -1506,6 +1517,8 @@ public class SOrderForm extends ValidatorEJB implements SOrderFormLocal, SOrderF
} }
} }
} }
}//-------------------------Ended By Abhijit Gaiwkad on 16-OCT-2015
//validation as given by jasmina on 130310-DI89SUN240 //validation as given by jasmina on 130310-DI89SUN240
String natureVal = genericUtility.getColumnValue( "nature", dom ); String natureVal = genericUtility.getColumnValue( "nature", dom );
...@@ -2199,8 +2212,8 @@ public class SOrderForm extends ValidatorEJB implements SOrderFormLocal, SOrderF ...@@ -2199,8 +2212,8 @@ public class SOrderForm extends ValidatorEJB implements SOrderFormLocal, SOrderF
Node parentNode = null; Node parentNode = null;
Node childNode = null; Node childNode = null;
Connection conn = null; Connection conn = null;
PreparedStatement pstmt = null; PreparedStatement pstmt = null , pstmt1 = null;
ResultSet rs = null ; ResultSet rs = null ,rs1 = null ;
int ctr=0; int ctr=0;
String childNodeName = null; String childNodeName = null;
String columnValue = null; String columnValue = null;
...@@ -4047,7 +4060,8 @@ public class SOrderForm extends ValidatorEJB implements SOrderFormLocal, SOrderF ...@@ -4047,7 +4060,8 @@ public class SOrderForm extends ValidatorEJB implements SOrderFormLocal, SOrderF
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
while(rs.next()) while(rs.next())
{ {
lsCurscheme = rs.getString("scheme_code") == null ? "" : rs.getString("scheme_code"); lsCurscheme = rs.getString("scheme_code") == null ? "" : rs.getString("scheme_code");
System.out.println("Scheme COde of table scheme applicability total "+lsCurscheme);
mcount = 0 ; mcount = 0 ;
sql ="select (case when apply_cust_list is null then '' else apply_cust_list end) apply_cust_list, " sql ="select (case when apply_cust_list is null then '' else apply_cust_list end) apply_cust_list, "
+" (case when noapply_cust_list is null then '' else noapply_cust_list end) noapply_cust_list, " +" (case when noapply_cust_list is null then '' else noapply_cust_list end) noapply_cust_list, "
...@@ -4058,6 +4072,7 @@ public class SOrderForm extends ValidatorEJB implements SOrderFormLocal, SOrderF ...@@ -4058,6 +4072,7 @@ public class SOrderForm extends ValidatorEJB implements SOrderFormLocal, SOrderF
scmRs = scmPStmt.executeQuery(); scmRs = scmPStmt.executeQuery();
if(scmRs.next()) if(scmRs.next())
{ {
applyCustList =scmRs.getString("apply_cust_list") == null ?"" : scmRs.getString("apply_cust_list"); applyCustList =scmRs.getString("apply_cust_list") == null ?"" : scmRs.getString("apply_cust_list");
noapplyCustList=scmRs.getString("noapply_cust_list") == null ? "" : scmRs.getString("noapply_cust_list"); noapplyCustList=scmRs.getString("noapply_cust_list") == null ? "" : scmRs.getString("noapply_cust_list");
applicableordtypes=scmRs.getString("order_type") == null ? "" : scmRs.getString("order_type"); applicableordtypes=scmRs.getString("order_type") == null ? "" : scmRs.getString("order_type");
...@@ -4106,9 +4121,11 @@ public class SOrderForm extends ValidatorEJB implements SOrderFormLocal, SOrderF ...@@ -4106,9 +4121,11 @@ public class SOrderForm extends ValidatorEJB implements SOrderFormLocal, SOrderF
} }
} }
if(!lbProceed) continue; if(!lbProceed) continue;
} }
System.out.println("Prev Scheme code"+lsPrevscheme);
lsPrevscheme = schemeCode; lsPrevscheme = schemeCode;
schemeCode = lsCurscheme ; schemeCode = lsCurscheme ;
System.out.println("Scheme COde"+schemeCode);
if (applyCustList.trim().length() > 0) if (applyCustList.trim().length() > 0)
{ {
schemeCode = null; schemeCode = null;
...@@ -4180,6 +4197,8 @@ public class SOrderForm extends ValidatorEJB implements SOrderFormLocal, SOrderF ...@@ -4180,6 +4197,8 @@ public class SOrderForm extends ValidatorEJB implements SOrderFormLocal, SOrderF
rs = null; rs = null;
if (llSchcnt > 1 ) if (llSchcnt > 1 )
schemeCode = lsPrevscheme ; schemeCode = lsPrevscheme ;
System.out.println("schemeCode = lsPrevscheme "+schemeCode);
System.out.println("schemeCode = lsPrevscheme@@@ "+lsPrevscheme);
//System.out.println("Scheme count.....["+llSchcnt + "] Scheme Code [" + schemeCode + "]"); //System.out.println("Scheme count.....["+llSchcnt + "] Scheme Code [" + schemeCode + "]");
sql="select (case when item_stru is null then 'S' else item_stru end)" sql="select (case when item_stru is null then 'S' else item_stru end)"
...@@ -4220,7 +4239,8 @@ public class SOrderForm extends ValidatorEJB implements SOrderFormLocal, SOrderF ...@@ -4220,7 +4239,8 @@ public class SOrderForm extends ValidatorEJB implements SOrderFormLocal, SOrderF
schemeCode = schemeCode; schemeCode = schemeCode;
} }
} }
//System.out.println("schemeCode.....after item_stru check.....["+schemeCode + "]"); System.out.println("schemeCode.....after item_stru check.....["+schemeCode + "]");
if(schemeCode !=null && schemeCode.trim().length()>0) if(schemeCode !=null && schemeCode.trim().length()>0)
{ {
sql=" select slab_on from scheme_applicability where scheme_code = ? "; sql=" select slab_on from scheme_applicability where scheme_code = ? ";
...@@ -4235,7 +4255,7 @@ public class SOrderForm extends ValidatorEJB implements SOrderFormLocal, SOrderF ...@@ -4235,7 +4255,7 @@ public class SOrderForm extends ValidatorEJB implements SOrderFormLocal, SOrderF
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
rs = null; rs = null;
//System.out.println("slab on....["+mslabOn + "]"); System.out.println("slab on....["+mslabOn + "]");
if(mslabOn != null && mslabOn.trim().length() > 0 && mslabOn.equalsIgnoreCase("N")) if(mslabOn != null && mslabOn.trim().length() > 0 && mslabOn.equalsIgnoreCase("N"))
{ {
sql="select descr from bom " sql="select descr from bom "
...@@ -4253,6 +4273,7 @@ public class SOrderForm extends ValidatorEJB implements SOrderFormLocal, SOrderF ...@@ -4253,6 +4273,7 @@ public class SOrderForm extends ValidatorEJB implements SOrderFormLocal, SOrderF
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
rs = null; rs = null;
System.out.println("Scheme Descr"+lsDescr);
valueXmlString.append("<st_scheme>").append("<![CDATA[Scheme Descr :"+lsDescr+"]]>").append("</st_scheme>"); valueXmlString.append("<st_scheme>").append("<![CDATA[Scheme Descr :"+lsDescr+"]]>").append("</st_scheme>");
} }
else else
...@@ -4292,6 +4313,7 @@ public class SOrderForm extends ValidatorEJB implements SOrderFormLocal, SOrderF ...@@ -4292,6 +4313,7 @@ public class SOrderForm extends ValidatorEJB implements SOrderFormLocal, SOrderF
{ {
lsDescr = ""; lsDescr = "";
} }
System.out.println("Description "+lsDescr);
lcRate =rs.getString("rate") == null ? "" : rs.getString("rate"); lcRate =rs.getString("rate") == null ? "" : rs.getString("rate");
lsType =rs.getString("rate_type") == null ? "" : rs.getString("rate_type"); lsType =rs.getString("rate_type") == null ? "" : rs.getString("rate_type");
lsPriceList =rs.getString("price_list") == null ? "" : rs.getString("price_list"); lsPriceList =rs.getString("price_list") == null ? "" : rs.getString("price_list");
...@@ -4329,9 +4351,90 @@ public class SOrderForm extends ValidatorEJB implements SOrderFormLocal, SOrderF ...@@ -4329,9 +4351,90 @@ public class SOrderForm extends ValidatorEJB implements SOrderFormLocal, SOrderF
} }
//END ITEM_CODE //END ITEM_CODE
else if(currentColumn.trim().equalsIgnoreCase("totqty")) else if(currentColumn.trim().equalsIgnoreCase("totqty"))
{ {
/*Request_id-SUN15OCT15-multiple scheme define in same item then pick up the wrong scheme code Quantity not selected for scheme code.
* Abhijit Gaikwad 16/10/15 Start*/
String Curscheme = null;
String countCd1 = null;
String siteCode1 = null;
String stateCd1 = null;
String descr1= null;
String itemCode1= null;
itemCode1 = genericUtility.getColumnValue("item_code",dom);
totqtyStr = genericUtility.getColumnValue("totqty",dom); totqtyStr = genericUtility.getColumnValue("totqty",dom);
//System.out.println("totqtyStr...value....."+totqtyStr); siteCode1 = genericUtility.getColumnValue("site_code",dom1);
siteCode = siteCode ==null ? "" : siteCode;
tranDateStr = genericUtility.getColumnValue("order_date",dom1);
tranDateStr = genericUtility.getValidDateString(tranDateStr,genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat());
tranDate = java.sql.Timestamp.valueOf(tranDateStr + " 00:00:00.00");
custCd = genericUtility.getColumnValue("cust_code",dom1);
sql="select state_code, count_code from customer where cust_code = ? ";
pstmt= conn.prepareStatement(sql);
pstmt.setString(1,custCd);
rs = pstmt.executeQuery();
if(rs.next())
{
stateCd1 = rs.getString("state_code") == null ? "" : rs.getString("state_code");
countCd1 = rs.getString("count_code") == null ? "" : rs.getString("count_code");
}
rs.close();
pstmt.close();
pstmt = null;
rs = null;
//System.out.println("totqtyStr...value....."+totqtyStr);
sql = " select a.scheme_code "
+" from scheme_applicability a, "
+" scheme_applicability_det b"
+" where a.scheme_code = b.scheme_code"
+" and a.item_code = ? "
+" and a.app_from <= ? "
+" and a.valid_upto >= ? "
+" and (b.site_code = ?"
+" or b.state_code = ? or b.count_code = ? )";
pstmt= conn.prepareStatement(sql);
pstmt.setString(1,itemCode1);
pstmt.setTimestamp(2,tranDate);
pstmt.setTimestamp(3,tranDate);
pstmt.setString(4,siteCode1);
pstmt.setString(5,stateCd1);
pstmt.setString(6,countCd1);
rs = pstmt.executeQuery();
while(rs.next())
{
Curscheme = rs.getString("scheme_code") == null ? "" : rs.getString("scheme_code");
System.out.println("Scheme COde of table scheme applicability total quantity "+lsCurscheme);
sql="select descr From scheme_applicability a,bom b Where a.scheme_code = b.bom_code And b.bom_code = ? And (? between case when b.min_qty is null then 0 else b.min_qty end And case when b.max_qty is null then 0 else b.max_qty end)";
pstmt1= conn.prepareStatement(sql);
pstmt1.setString(1,Curscheme);
pstmt1.setString(2,totqtyStr);
rs1 = pstmt1.executeQuery();
if(rs1.next())
{
descr1 = rs1.getString(1);
}
rs1.close();
pstmt1.close();
pstmt1 = null;
rs1 = null;
}
rs.close();
pstmt.close();
pstmt = null;
rs = null;
System.out.println("Description:"+descr1);
if((totqtyStr != null && totqtyStr.trim().length()>0))
{
valueXmlString.append("<st_scheme>").append("<![CDATA[Scheme Descr :"+descr1+"]]>").append("</st_scheme>");
}
else
{
valueXmlString.append("<st_scheme>").append("<![CDATA[]]>").append("</st_scheme>");
} //Abhijit Gaikwad 16/10/15 End
if(totqtyStr != null && totqtyStr.trim().length() > 0) if(totqtyStr != null && totqtyStr.trim().length() > 0)
{ {
// 25/03/10 manoharan the string is in the form of 999999.999 format // 25/03/10 manoharan the string is in the form of 999999.999 format
......
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