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");
...@@ -194,46 +197,43 @@ public class BomAmdIC extends ValidatorEJB implements BomAmdICLocal, BomAmdICRem ...@@ -194,46 +197,43 @@ public class BomAmdIC extends ValidatorEJB implements BomAmdICLocal, BomAmdICRem
} }
if ( childNodeName.equalsIgnoreCase("line_no__bom")) if ( childNodeName.equalsIgnoreCase("line_no__bom"))
{ {
lineNoBOM = checkNull(genericUtility.getColumnValue("line_no__bom", dom)); lineNoBOM = checkNull(genericUtility.getColumnValue("line_no__bom", dom));
System.out.println("@@@@@@lineNoBOM["+lineNoBOM+"]"); System.out.println("@@@@@@lineNoBOM["+lineNoBOM+"]");
if(lineNoBOM == null || lineNoBOM.trim().length() == 0) if(lineNoBOM == null || lineNoBOM.trim().length() == 0)
{ {
errCode = "VTLINEBLK"; errCode = "VTLINEBLK";
errList.add(errCode); errList.add(errCode);
errFields.add(childNodeName.toLowerCase()); 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 <> ? " + else if( lineNoBOM != null && lineNoBOM.length() > 0 )
" and bom_code = ? and line_no__bom = ? "; {
pstmt = conn.prepareStatement(sql); java.util.HashSet<String> bomData=new java.util.HashSet<String>();
pstmt.setString(1,amdNo); for(int i =0; i< dom2.getElementsByTagName("Detail2").getLength();i++)
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)));
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 ...@@ -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