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;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import com.sybase.jaguar.management.jdk12utils.HashSet;
import javax.ejb.Stateless;
@Stateless
......@@ -89,7 +92,7 @@ public class BomAmdIC extends ValidatorEJB implements BomAmdICLocal, BomAmdICRem
String bomcode="",amdNo="",lineNo="";
String active = "",confirmed = "";
String bomcodeHdr = "",lineNoBOM = "";
String bomcodeHdr = "",lineNoBOM = "",updateStatus="";
try
{
System.out.println("@@@@@@@@ wfvaldata called");
......@@ -194,46 +197,43 @@ public class BomAmdIC extends ValidatorEJB implements BomAmdICLocal, BomAmdICRem
}
if ( childNodeName.equalsIgnoreCase("line_no__bom"))
{
lineNoBOM = checkNull(genericUtility.getColumnValue("line_no__bom", dom));
System.out.println("@@@@@@lineNoBOM["+lineNoBOM+"]");
lineNoBOM = checkNull(genericUtility.getColumnValue("line_no__bom", dom));
System.out.println("@@@@@@lineNoBOM["+lineNoBOM+"]");
if(lineNoBOM == null || lineNoBOM.trim().length() == 0)
{
errCode = "VTLINEBLK";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
else if( lineNoBOM != null && lineNoBOM.length() > 0 )
{
bomcode = checkNull(genericUtility.getColumnValue("bom_code", dom));
amdNo = checkNull(genericUtility.getColumnValue("amd_no", dom));
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())
else if( lineNoBOM != null && lineNoBOM.length() > 0 )
{
java.util.HashSet<String> bomData=new java.util.HashSet<String>();
for(int i =0; i< dom2.getElementsByTagName("Detail2").getLength();i++)
{
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)));
bomcode = checkNull(genericUtility.getColumnValueFromNode("bom_code",dom2.getElementsByTagName("Detail2").item(i)));
lineNoBOM = checkNull(genericUtility.getColumnValueFromNode("line_no__bom",dom2.getElementsByTagName("Detail2").item(i)));
System.out.println("bomcode = ["+bomcode+"]"+"Update Status =[ "+updateStatus+"]"+"lineNoBOM["+lineNoBOM+"]");
if(!updateStatus.equalsIgnoreCase("D"))
{
if ( ! bomData.contains(bomcode.trim()+"@"+lineNoBOM.trim()))
{
bomData.add(bomcode.trim()+"@"+lineNoBOM.trim());
}
else
{ errCode = "VTDUPBOMLN";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
System.out.println("bomData LIST["+bomData+"]");
}
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
if( cnt > 0 )
{
errCode = "VTDUPENTRY";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}
}
......@@ -682,6 +682,25 @@ public class BomAmdIC extends ValidatorEJB implements BomAmdICLocal, BomAmdICRem
}
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)
{
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