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
public String itemChanged(Document dom, Document dom1,Document dom2, String objContext, String currentColumn, String editFlag, String xtraParams) throws RemoteException,ITMException
{
Connection conn = null;
Statement stmt = null;
Statement stmt = null,stmt1 = null;
PreparedStatement pstmt = null;
ResultSet rs = null;
ResultSet rs1 = null;
StringBuffer valueXmlString = new StringBuffer();
StringBuffer retString = new StringBuffer();
String errCode = "";
String sql = "";
String sql = "",sql1 ="";
String columnValue = "";
String childNodeName = "";
NodeList parentNodeList = null;
......@@ -105,6 +105,7 @@ public class PriceList extends ValidatorEJB implements PriceListLocal, PriceList
{
conn = getConnection();
stmt = conn.createStatement();
stmt1 = conn.createStatement();
if(objContext != null && objContext.trim().length()>0)
{
......@@ -281,7 +282,12 @@ public class PriceList extends ValidatorEJB implements PriceListLocal, PriceList
if(currentColumn.trim().equals("item_code"))
{
String mcode="",mdescr="",munit="",msite_code="";
long mslabno = 0;
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+"'";
rs = stmt.executeQuery(sql);
......@@ -298,6 +304,21 @@ public class PriceList extends ValidatorEJB implements PriceListLocal, PriceList
valueXmlString.append("<unit>").append("<![CDATA["+munit+"]]>").append("</unit>");
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
if(currentColumn.trim().equals("unit"))
......@@ -429,7 +450,7 @@ public class PriceList extends ValidatorEJB implements PriceListLocal, PriceList
Node childNode = null;
int ctr,currentFormNo=0;
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;
ArrayList<String> errList = new ArrayList<String>();
ArrayList<String> errFields = new ArrayList<String>();
......@@ -493,6 +514,9 @@ public class PriceList extends ValidatorEJB implements PriceListLocal, PriceList
lotNoFrom = genericUtility.getColumnValue("lot_no__from",dom);
lotNoTo = genericUtility.getColumnValue("lot_no__to",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
System.out.println("price_list wfvalData :::: " + priceList);
// 14/11/13 manoharan commented as always it will be manual
......@@ -521,10 +545,12 @@ public class PriceList extends ValidatorEJB implements PriceListLocal, PriceList
System.out.println("after effFromStr [" + effFromStr + "] validUptoStr [" + validUptoStr + "]");
effFrom = Timestamp.valueOf(effFromStr + " 00:00:00");
validUpto = Timestamp.valueOf(validUptoStr + " 00:00:00");
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 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))
{
sql = sql + " and slab_no <> " + slabno ;
......@@ -539,6 +565,8 @@ public class PriceList extends ValidatorEJB implements PriceListLocal, PriceList
pstmt.setTimestamp(6,validUpto);
pstmt.setString(7,lotNoFrom);
pstmt.setString(8,lotNoTo);
pstmt.setString(9,minQty);
pstmt.setString(10,maxQty);
rs = pstmt.executeQuery();
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