Commit c36089bc authored by cpandey's avatar cpandey

add validation for duplicate indent and tran id


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@92819 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 0a2d7689
...@@ -87,6 +87,8 @@ implements BillofQuantityICLocal, BillofQuantityICRemote ...@@ -87,6 +87,8 @@ implements BillofQuantityICLocal, BillofQuantityICRemote
String unitRate=""; String unitRate="";
System.out.println("editFlag ---->>>["+editFlag+"]"); System.out.println("editFlag ---->>>["+editFlag+"]");
String unit = ""; String unit = "";
String rate = "",drate = "";
Double rate1 = 0.0;
String updateFlag = "",status = ""; String updateFlag = "",status = "";
int ctr = 0; int ctr = 0;
int currentFormNo = 0; int currentFormNo = 0;
...@@ -141,6 +143,47 @@ implements BillofQuantityICLocal, BillofQuantityICRemote ...@@ -141,6 +143,47 @@ implements BillofQuantityICLocal, BillofQuantityICRemote
if (indentNo != null && indentNo.trim().length() > 0 ) if (indentNo != null && indentNo.trim().length() > 0 )
{ {
itemCode=checkNull(this.genericUtility.getColumnValue("item_code", dom)); itemCode=checkNull(this.genericUtility.getColumnValue("item_code", dom));
tranId=checkNull(this.genericUtility.getColumnValue("tran_id", dom));
// added by cpandey Validation for duplicate tran id in boqhdr on 07/03/13
sql = "select count(*) from boqhdr where tran_id = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, tranId);
rs = pstmt.executeQuery();
if(rs.next())
{
cnt = rs.getInt(1);
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
if(cnt == 1 )
{
errCode = "VTDUPTRID";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
// end of validation
//added by cpandey validation for duplicate entry of indent no in boqhdr on 07/03/13
sql = "select count(*) from boqhdr where indent_no = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, indentNo);
rs = pstmt.executeQuery();
if(rs.next())
{
cnt = rs.getInt(1);
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
if(cnt == 1 )
{
errCode = "VTDUPINDNO";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
//end of addition
//changes done by cpandey for approved indent no status = 'A' //changes done by cpandey for approved indent no status = 'A'
sql = "select count(*) from indent where status = 'A' and item_code = ?"; sql = "select count(*) from indent where status = 'A' and item_code = ?";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
...@@ -223,6 +266,21 @@ implements BillofQuantityICLocal, BillofQuantityICRemote ...@@ -223,6 +266,21 @@ implements BillofQuantityICLocal, BillofQuantityICRemote
errFields.add(childNodeName.toLowerCase()); errFields.add(childNodeName.toLowerCase());
} }
} }
//validation for rate can not be null on 28/02/13
else if (childNodeName.equalsIgnoreCase("rate"))
{
rate=checkNull(this.genericUtility.getColumnValue("rate", dom));
System.out.println("Tran id from current application ----["+tranId+"]-and rate ["+rate+"]->>");
System.out.println("Detail item code --on header part--> ["+ditemCode+"] and detail item code---on header part--> ["+itemCode+"]");
rate1 =Double.parseDouble(rate);
if (rate1 == 0)
{
System.out.println("rate can not be null or 0-->>");
errCode = "VMRATEBLNK";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}
//end of changes on 05/11/12 //end of changes on 05/11/12
else if (childNodeName.trim().equalsIgnoreCase("unit__rate")) else if (childNodeName.trim().equalsIgnoreCase("unit__rate"))
{ {
...@@ -485,6 +543,22 @@ implements BillofQuantityICLocal, BillofQuantityICRemote ...@@ -485,6 +543,22 @@ implements BillofQuantityICLocal, BillofQuantityICRemote
} }
}*/ }*/
} }
else if (childNodeName.trim().equalsIgnoreCase("rate"))
{
drate=checkNull(this.genericUtility.getColumnValue("rate", dom));
System.out.println("dRate from detail window ----["+drate+"]-and rate ["+drate+"]->>");
//System.out.println("Detail item code --on header part--> ["+ditemCode+"] and detail item code---on header part--> ["+itemCode+"]");
//rate1 =Double.parseDouble(rate);
if (drate==null || drate.trim().length()==0)
{
System.out.println("drate can not be null or 0-->>");
errCode = "VMRATEBLNK";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}
//end of changes on 05/11/12 //end of changes on 05/11/12
else if (childNodeName.trim().equalsIgnoreCase("unit__rate")) else if (childNodeName.trim().equalsIgnoreCase("unit__rate"))
{ {
...@@ -1201,25 +1275,25 @@ implements BillofQuantityICLocal, BillofQuantityICRemote ...@@ -1201,25 +1275,25 @@ implements BillofQuantityICLocal, BillofQuantityICRemote
System.out.println("convQtyList = "+convQtyList); System.out.println("convQtyList = "+convQtyList);
convQtuomStduom = Double.parseDouble(convQtyList.get(0).toString()); convQtuomStduom = Double.parseDouble(convQtyList.get(0).toString());
//arraylist for rate stduom //arraylist for rate stduom
ArrayList convRateList = distCommon.getConvQuantityFact(unit, unitRate, itemCode, rate, 0, conn); ArrayList convRateList = distCommon.getConvQuantityFact(unit, unitRate, itemCode, rate, 0, conn);
convQtuomStduom = Double.parseDouble(convRateList.get(0).toString()); convQtuomStduom = Double.parseDouble(convRateList.get(0).toString());
rateStduom = Double.parseDouble(convRateList.get(1).toString()); rateStduom = Double.parseDouble(convRateList.get(1).toString());
System.out.println("meffQty ["+convQtuomStduom+"]"); System.out.println("meffQty ["+convQtuomStduom+"]");
//changes done by cpandey for rate__stduom -- rateStduom //changes done by cpandey for rate__stduom -- rateStduom
System.out.println("meffQty ["+rateStduom+"]"); System.out.println("meffQty ["+rateStduom+"]");
valueXmlString.append("<conv__qty_stduom >").append("<![CDATA["+convQtuomStduom+"]]>").append("</conv__qty_stduom>"); valueXmlString.append("<conv__qty_stduom >").append("<![CDATA["+convQtuomStduom+"]]>").append("</conv__qty_stduom>");
//valueXmlString.append("<rate__stduom >").append("<![CDATA["+quantityStduom+"]]>").append("</rate__stduom>"); //valueXmlString.append("<rate__stduom >").append("<![CDATA["+quantityStduom+"]]>").append("</rate__stduom>");
valueXmlString.append("<rate__stduom >").append("<![CDATA["+rateStduom+"]]>").append("</rate__stduom>"); valueXmlString.append("<rate__stduom >").append("<![CDATA["+rateStduom+"]]>").append("</rate__stduom>");
System.out.println("convRateList = "+convRateList); System.out.println("convRateList = "+convRateList);
System.out.println("meffQty ["+convQtuomStduom+"]"); System.out.println("meffQty ["+convQtuomStduom+"]");
quantityStduom = Double.parseDouble(convQtyList.get(1).toString()); quantityStduom = Double.parseDouble(convQtyList.get(1).toString());
System.out.println("meffQty ["+quantityStduom+"]"); System.out.println("meffQty ["+quantityStduom+"]");
//changes done by cpandey for quantity__stduom -- quantityStduom //changes done by cpandey for quantity__stduom -- quantityStduom
valueXmlString.append("<conv__rate_stduom >").append("<![CDATA["+convQtuomStduom+"]]>").append("</conv__rate_stduom>"); valueXmlString.append("<conv__rate_stduom >").append("<![CDATA["+convQtuomStduom+"]]>").append("</conv__rate_stduom>");
// valueXmlString.append("<quantity__stduom >").append("<![CDATA["+rateStduom+"]]>").append("</quantity__stduom>"); // valueXmlString.append("<quantity__stduom >").append("<![CDATA["+rateStduom+"]]>").append("</quantity__stduom>");
valueXmlString.append("<quantity__stduom >").append("<![CDATA["+quantityStduom+"]]>").append("</quantity__stduom>"); valueXmlString.append("<quantity__stduom >").append("<![CDATA["+quantityStduom+"]]>").append("</quantity__stduom>");
} }
......
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