Commit 8701b5ea authored by pdas's avatar pdas

Added validation for pricelist and slabno for same minimum and maximum quantity.


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@98527 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 33afcc96
...@@ -75,14 +75,14 @@ public class PriceList extends ValidatorEJB implements PriceListLocal, PriceList ...@@ -75,14 +75,14 @@ public class PriceList extends ValidatorEJB implements PriceListLocal, PriceList
public String itemChanged(Document dom, Document dom1,Document dom2, String objContext, String currentColumn, String editFlag, String xtraParams) throws RemoteException,ITMException public String itemChanged(Document dom, Document dom1,Document dom2, String objContext, String currentColumn, String editFlag, String xtraParams) throws RemoteException,ITMException
{ {
Connection conn = null; Connection conn = null;
Statement stmt = null; Statement stmt = null,stmt1 = null;
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
ResultSet rs = null; ResultSet rs = null;
ResultSet rs1 = null; ResultSet rs1 = null;
StringBuffer valueXmlString = new StringBuffer(); StringBuffer valueXmlString = new StringBuffer();
StringBuffer retString = new StringBuffer(); StringBuffer retString = new StringBuffer();
String errCode = ""; String errCode = "";
String sql = ""; String sql = "",sql1 ="";
String columnValue = ""; String columnValue = "";
String childNodeName = ""; String childNodeName = "";
NodeList parentNodeList = null; NodeList parentNodeList = null;
...@@ -105,6 +105,7 @@ public class PriceList extends ValidatorEJB implements PriceListLocal, PriceList ...@@ -105,6 +105,7 @@ public class PriceList extends ValidatorEJB implements PriceListLocal, PriceList
{ {
conn = getConnection(); conn = getConnection();
stmt = conn.createStatement(); stmt = conn.createStatement();
stmt1 = conn.createStatement();
if(objContext != null && objContext.trim().length()>0) if(objContext != null && objContext.trim().length()>0)
{ {
...@@ -281,7 +282,12 @@ public class PriceList extends ValidatorEJB implements PriceListLocal, PriceList ...@@ -281,7 +282,12 @@ public class PriceList extends ValidatorEJB implements PriceListLocal, PriceList
if(currentColumn.trim().equals("item_code")) if(currentColumn.trim().equals("item_code"))
{ {
String mcode="",mdescr="",munit="",msite_code=""; String mcode="",mdescr="",munit="",msite_code="";
long mslabno = 0;
mcode=genericUtility.getColumnValue("item_code",dom); mcode=genericUtility.getColumnValue("item_code",dom);
System.out.println("Item code>>>>>>>" + mcode);
priceList = genericUtility.getColumnValue("price_list",dom) ;
System.out.println("pRICELIST>>>>>>>>>" + priceList);
System.out.println("itemcode>>>>>" + mcode);
sql="SELECT DESCR,UNIT ,SITE_CODE FROM ITEM WHERE ITEM_CODE='"+mcode+"'"; sql="SELECT DESCR,UNIT ,SITE_CODE FROM ITEM WHERE ITEM_CODE='"+mcode+"'";
rs = stmt.executeQuery(sql); rs = stmt.executeQuery(sql);
...@@ -297,6 +303,21 @@ public class PriceList extends ValidatorEJB implements PriceListLocal, PriceList ...@@ -297,6 +303,21 @@ public class PriceList extends ValidatorEJB implements PriceListLocal, PriceList
valueXmlString.append("<item_descr>").append("<![CDATA["+mdescr+"]]>").append("</item_descr>"); valueXmlString.append("<item_descr>").append("<![CDATA["+mdescr+"]]>").append("</item_descr>");
valueXmlString.append("<unit>").append("<![CDATA["+munit+"]]>").append("</unit>"); valueXmlString.append("<unit>").append("<![CDATA["+munit+"]]>").append("</unit>");
valueXmlString.append("<site_code>").append("<![CDATA["+msite_code+"]]>").append("</site_code>"); valueXmlString.append("<site_code>").append("<![CDATA["+msite_code+"]]>").append("</site_code>");
sql1="SELECT MAX(SLAB_NO) FROM PRICELIST WHERE PRICE_LIST = '" + priceList + "'" +"AND ITEM_CODE = '"+ mcode +"'";
rs1=stmt1.executeQuery(sql1);
System.out.println("SQL query....."+sql1);
if(rs1.next())
{
mslabno=rs1.getLong(1);
valueXmlString.append("<slab_no protect=\"1\">").append(mslabno + 1).append("</slab_no>");
}
else
{
valueXmlString.append("<slab_no protect=\"1\">").append("1").append("</slab_no>");
}
rs1.close();
rs1 = null;
} }
else else
...@@ -429,7 +450,7 @@ public class PriceList extends ValidatorEJB implements PriceListLocal, PriceList ...@@ -429,7 +450,7 @@ public class PriceList extends ValidatorEJB implements PriceListLocal, PriceList
Node childNode = null; Node childNode = null;
int ctr,currentFormNo=0; int ctr,currentFormNo=0;
int childNodeListLength; int childNodeListLength;
String itemCode = "", unit = "", listType = "", effFromStr = "", validUptoStr = "", lotNoFrom = "", lotNoTo = "", slabno = ""; String itemCode = "", unit = "", listType = "", effFromStr = "", validUptoStr = "", lotNoFrom = "", lotNoTo = "", slabno = "",minQty = "",maxQty = "";
Timestamp effFrom =null, validUpto = null; Timestamp effFrom =null, validUpto = null;
ArrayList<String> errList = new ArrayList<String>(); ArrayList<String> errList = new ArrayList<String>();
ArrayList<String> errFields = new ArrayList<String>(); ArrayList<String> errFields = new ArrayList<String>();
...@@ -493,6 +514,9 @@ public class PriceList extends ValidatorEJB implements PriceListLocal, PriceList ...@@ -493,6 +514,9 @@ public class PriceList extends ValidatorEJB implements PriceListLocal, PriceList
lotNoFrom = genericUtility.getColumnValue("lot_no__from",dom); lotNoFrom = genericUtility.getColumnValue("lot_no__from",dom);
lotNoTo = genericUtility.getColumnValue("lot_no__to",dom); lotNoTo = genericUtility.getColumnValue("lot_no__to",dom);
slabno = genericUtility.getColumnValue("slab_no",dom) ; slabno = genericUtility.getColumnValue("slab_no",dom) ;
minQty = genericUtility.getColumnValue("min_qty",dom);
maxQty = genericUtility.getColumnValue("max_qty", dom);
// end 14/11/13 manoharan duplicate checking to consider all parameter // end 14/11/13 manoharan duplicate checking to consider all parameter
System.out.println("price_list wfvalData :::: " + priceList); System.out.println("price_list wfvalData :::: " + priceList);
// 14/11/13 manoharan commented as always it will be manual // 14/11/13 manoharan commented as always it will be manual
...@@ -521,10 +545,12 @@ public class PriceList extends ValidatorEJB implements PriceListLocal, PriceList ...@@ -521,10 +545,12 @@ public class PriceList extends ValidatorEJB implements PriceListLocal, PriceList
System.out.println("after effFromStr [" + effFromStr + "] validUptoStr [" + validUptoStr + "]"); System.out.println("after effFromStr [" + effFromStr + "] validUptoStr [" + validUptoStr + "]");
effFrom = Timestamp.valueOf(effFromStr + " 00:00:00"); effFrom = Timestamp.valueOf(effFromStr + " 00:00:00");
validUpto = Timestamp.valueOf(validUptoStr + " 00:00:00"); validUpto = Timestamp.valueOf(validUptoStr + " 00:00:00");
sql = "select count(*) from pricelist where price_list = ? " System.out.println("Quantity From [" + minQty + "] Quantity To [" + maxQty + "]");
sql = "select count(*) from pricelist where price_list = ? "
+ " and item_code = ? and unit = ? and list_type = ? " + " and item_code = ? and unit = ? and list_type = ? "
+ " and eff_from = ? and valid_upto = ? " + " and eff_from = ? and valid_upto = ? "
+ " and lot_no__from = ? and lot_no__to = ? "; + " and lot_no__from = ? and lot_no__to = ? "
+ " and min_qty = ? and max_qty = ?";
if ("E".equals(editFlag)) if ("E".equals(editFlag))
{ {
sql = sql + " and slab_no <> " + slabno ; sql = sql + " and slab_no <> " + slabno ;
...@@ -539,6 +565,8 @@ public class PriceList extends ValidatorEJB implements PriceListLocal, PriceList ...@@ -539,6 +565,8 @@ public class PriceList extends ValidatorEJB implements PriceListLocal, PriceList
pstmt.setTimestamp(6,validUpto); pstmt.setTimestamp(6,validUpto);
pstmt.setString(7,lotNoFrom); pstmt.setString(7,lotNoFrom);
pstmt.setString(8,lotNoTo); pstmt.setString(8,lotNoTo);
pstmt.setString(9,minQty);
pstmt.setString(10,maxQty);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
if(rs.next()) if(rs.next())
......
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