Commit 4ffd6c40 authored by cpandey's avatar cpandey

add validation of duplicate item code on edit mode


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@92146 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 2b83b176
...@@ -79,9 +79,9 @@ implements BillofQuantityICLocal, BillofQuantityICRemote ...@@ -79,9 +79,9 @@ implements BillofQuantityICLocal, BillofQuantityICRemote
String currCode = ""; String currCode = "";
String suppCodePref = ""; String suppCodePref = "";
String projCode = ""; String projCode = "";
String itemCode = ""; String itemCode = "",ditemCode = "";
String packCode = ""; String packCode = "";
String hitemCode = ""; String hitemCode = "",tranId = "";
String indentNo = ""; String indentNo = "";
String tranDateS = ""; String tranDateS = "";
String unitRate=""; String unitRate="";
...@@ -119,6 +119,8 @@ implements BillofQuantityICLocal, BillofQuantityICRemote ...@@ -119,6 +119,8 @@ implements BillofQuantityICLocal, BillofQuantityICRemote
valueXmlString.append("<Detail1>"); valueXmlString.append("<Detail1>");
int childNodeListLength = childNodeList.getLength(); int childNodeListLength = childNodeList.getLength();
System.out.println("EDIT FLAG --- 1-->>["+editFlag+"]"); System.out.println("EDIT FLAG --- 1-->>["+editFlag+"]");
tranId=checkNull(this.genericUtility.getColumnValue("tran_id", dom));
System.out.println("tran id from boqdet --4-->>>>["+tranId+"]");
for (ctr = 0; ctr < childNodeListLength; ctr++) for (ctr = 0; ctr < childNodeListLength; ctr++)
{ {
childNode = childNodeList.item(ctr); childNode = childNodeList.item(ctr);
...@@ -171,7 +173,14 @@ implements BillofQuantityICLocal, BillofQuantityICRemote ...@@ -171,7 +173,14 @@ implements BillofQuantityICLocal, BillofQuantityICRemote
else if (childNodeName.equalsIgnoreCase("item_code")) else if (childNodeName.equalsIgnoreCase("item_code"))
{ {
itemCode=this.genericUtility.getColumnValue("item_code", dom); itemCode=checkNull(this.genericUtility.getColumnValue("item_code", dom));
System.out.println("Tran id from current application ----["+tranId+"]-->>");
//hitemCode=checkNull(this.genericUtility.getColumnValue("item_code", dom1));
ditemCode=checkNull(this.genericUtility.getColumnValue("item_code", dom2));
System.out.println("Detail item code --on header part--> ["+ditemCode+"] and detail item code---on header part--> ["+itemCode+"]");
itemCode = itemCode.trim();
ditemCode = ditemCode.trim();
//itemCode=this.genericUtility.getColumnValue("item_code", dom);
if (itemCode != null && itemCode.trim().length() > 0 ) if (itemCode != null && itemCode.trim().length() > 0 )
{ {
sql = "select count(*) from item where item_code = ?"; sql = "select count(*) from item where item_code = ?";
...@@ -198,6 +207,35 @@ implements BillofQuantityICLocal, BillofQuantityICRemote ...@@ -198,6 +207,35 @@ implements BillofQuantityICLocal, BillofQuantityICRemote
errCode = "VMITEMBLK"; errCode = "VMITEMBLK";
errList.add(errCode); errList.add(errCode);
errFields.add(childNodeName.toLowerCase()); errFields.add(childNodeName.toLowerCase());
}
if(("E").equalsIgnoreCase(editFlag))
{
sql = "select item_code from boqdet where tran_id = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, tranId);
rs = pstmt.executeQuery();
while(rs.next())
{
ditemCode = checkNull(rs.getString("item_code"));
ditemCode = ditemCode.trim();
System.out.println("item code from boq det table--11--["+ditemCode+"]->>");
if(ditemCode.trim().equalsIgnoreCase(itemCode.trim()))
{
System.out.println("edit flag --4>>["+editFlag+"]");
//|| ("A").equalsIgnoreCase(editFlag)
System.out.println("edit flag --2>>["+editFlag+"]");
errCode = "VMITMSM";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
System.out.println("edit flag --4>>["+editFlag+"]");
} }
} }
else if (childNodeName.trim().equalsIgnoreCase("unit__rate")) else if (childNodeName.trim().equalsIgnoreCase("unit__rate"))
...@@ -418,6 +456,8 @@ implements BillofQuantityICLocal, BillofQuantityICRemote ...@@ -418,6 +456,8 @@ implements BillofQuantityICLocal, BillofQuantityICRemote
itemCode=checkNull(this.genericUtility.getColumnValue("item_code", dom)); itemCode=checkNull(this.genericUtility.getColumnValue("item_code", dom));
hitemCode=checkNull(this.genericUtility.getColumnValue("item_code", dom1)); hitemCode=checkNull(this.genericUtility.getColumnValue("item_code", dom1));
System.out.println("Header item code ["+hitemCode+"] and detail item code ["+itemCode+"]"); System.out.println("Header item code ["+hitemCode+"] and detail item code ["+itemCode+"]");
itemCode = itemCode.trim();
hitemCode = hitemCode.trim();
if (itemCode != null && itemCode.trim().length() > 0 ) if (itemCode != null && itemCode.trim().length() > 0 )
{ {
...@@ -439,20 +479,26 @@ implements BillofQuantityICLocal, BillofQuantityICRemote ...@@ -439,20 +479,26 @@ implements BillofQuantityICLocal, BillofQuantityICRemote
errList.add(errCode); errList.add(errCode);
errFields.add(childNodeName.toLowerCase()); errFields.add(childNodeName.toLowerCase());
} }
//&& editFlag.equalsIgnoreCase("E") }
else if(itemCode.equalsIgnoreCase(hitemCode) && ("E").equalsIgnoreCase(editFlag) ) else
{
errCode = "VMITMSM";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}else
{ {
errCode = "VMITEMBLK"; errCode = "VMITEMBLK";
errList.add(errCode); errList.add(errCode);
errFields.add(childNodeName.toLowerCase()); errFields.add(childNodeName.toLowerCase());
} }
if(itemCode.trim().equalsIgnoreCase(hitemCode.trim()))
{
System.out.println("edit flag --4>>["+editFlag+"]");
if(("E").equalsIgnoreCase(editFlag) || ("A").equalsIgnoreCase(editFlag))
{
System.out.println("edit flag --2>>["+editFlag+"]");
System.out.println("EDIT VALIDATION IN CASE OF--EDIT--MODE -->>["+editFlag+"]");
errCode = "VMITMSM";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}
} }
else if (childNodeName.trim().equalsIgnoreCase("unit__rate")) else if (childNodeName.trim().equalsIgnoreCase("unit__rate"))
{ {
......
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