Commit 874f0211 authored by caluka's avatar caluka

Updated BomAmdIC EJB code change Bom line Number validation for BOMAMDIC[MF3GSUN024]


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@94167 ce508802-f39f-4f6c-b175-0d175dae99d5
parent c86736a9
...@@ -22,6 +22,9 @@ import java.sql.Timestamp; ...@@ -22,6 +22,9 @@ import java.sql.Timestamp;
import org.w3c.dom.Document; import org.w3c.dom.Document;
import org.w3c.dom.Node; import org.w3c.dom.Node;
import org.w3c.dom.NodeList; import org.w3c.dom.NodeList;
import com.sybase.jaguar.management.jdk12utils.HashSet;
import javax.ejb.Stateless; import javax.ejb.Stateless;
@Stateless @Stateless
...@@ -89,7 +92,7 @@ public class BomAmdIC extends ValidatorEJB implements BomAmdICLocal, BomAmdICRem ...@@ -89,7 +92,7 @@ public class BomAmdIC extends ValidatorEJB implements BomAmdICLocal, BomAmdICRem
String bomcode="",amdNo="",lineNo=""; String bomcode="",amdNo="",lineNo="";
String active = "",confirmed = ""; String active = "",confirmed = "";
String bomcodeHdr = "",lineNoBOM = ""; String bomcodeHdr = "",lineNoBOM = "",updateStatus="";
try try
{ {
System.out.println("@@@@@@@@ wfvaldata called"); System.out.println("@@@@@@@@ wfvaldata called");
...@@ -203,37 +206,34 @@ public class BomAmdIC extends ValidatorEJB implements BomAmdICLocal, BomAmdICRem ...@@ -203,37 +206,34 @@ public class BomAmdIC extends ValidatorEJB implements BomAmdICLocal, BomAmdICRem
errList.add(errCode); errList.add(errCode);
errFields.add(childNodeName.toLowerCase()); errFields.add(childNodeName.toLowerCase());
} }
else if( lineNoBOM != null && lineNoBOM.length() > 0 ) else if( lineNoBOM != null && lineNoBOM.length() > 0 )
{ {
bomcode = checkNull(genericUtility.getColumnValue("bom_code", dom)); java.util.HashSet<String> bomData=new java.util.HashSet<String>();
amdNo = checkNull(genericUtility.getColumnValue("amd_no", dom)); for(int i =0; i< dom2.getElementsByTagName("Detail2").getLength();i++)
lineNo = checkNull(genericUtility.getColumnValue("line_no", dom));
System.out.println("lineNoBOM@@@@@["+lineNoBOM+"]");
sql = " select count(1) from bomamd_det where amd_no = ? and line_no <> ? " +
" and bom_code = ? and line_no__bom = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,amdNo);
pstmt.setString(2,lineNo);
pstmt.setString(3,bomcode);
pstmt.setString(4,lineNoBOM);
rs = pstmt.executeQuery();
if(rs.next())
{ {
cnt = rs.getInt(1); updateStatus = checkNull(getCurrentUpdateFlag(dom2.getElementsByTagName("Detail2").item(i)));
} System.out.println("lineno ="+genericUtility.getColumnValueFromNode("line_no",dom2.getElementsByTagName("Detail2").item(i)));
rs.close(); bomcode = checkNull(genericUtility.getColumnValueFromNode("bom_code",dom2.getElementsByTagName("Detail2").item(i)));
rs = null; lineNoBOM = checkNull(genericUtility.getColumnValueFromNode("line_no__bom",dom2.getElementsByTagName("Detail2").item(i)));
pstmt.close(); System.out.println("bomcode = ["+bomcode+"]"+"Update Status =[ "+updateStatus+"]"+"lineNoBOM["+lineNoBOM+"]");
pstmt = null;
if( cnt > 0 ) if(!updateStatus.equalsIgnoreCase("D"))
{ {
errCode = "VTDUPENTRY"; if ( ! bomData.contains(bomcode.trim()+"@"+lineNoBOM.trim()))
{
bomData.add(bomcode.trim()+"@"+lineNoBOM.trim());
}
else
{ errCode = "VTDUPBOMLN";
errList.add(errCode); errList.add(errCode);
errFields.add(childNodeName.toLowerCase()); errFields.add(childNodeName.toLowerCase());
} }
System.out.println("bomData LIST["+bomData+"]");
}
}
} }
} }
...@@ -682,6 +682,25 @@ public class BomAmdIC extends ValidatorEJB implements BomAmdICLocal, BomAmdICRem ...@@ -682,6 +682,25 @@ public class BomAmdIC extends ValidatorEJB implements BomAmdICLocal, BomAmdICRem
} }
return valueXmlString.toString(); return valueXmlString.toString();
} }
private String getCurrentUpdateFlag(Node currDetail)
{
NodeList currDetailList = null;
String updateStatus = "",nodeName = "";
int currDetailListLength = 0;
currDetailList = currDetail.getChildNodes();
currDetailListLength = currDetailList.getLength();
for (int i=0;i< currDetailListLength;i++)
{
nodeName = currDetailList.item(i).getNodeName();
if (nodeName.equalsIgnoreCase("Attribute"))
{
updateStatus =currDetailList.item(i).getAttributes().getNamedItem("updateFlag").getNodeValue();
break;
}
}
return updateStatus;
}
private String checkNull(String input) private String checkNull(String input)
{ {
if(input == null) if(input == null)
......
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