Commit d7b66801 authored by caluka's avatar caluka

Ejb code for BOMAMD After Adding sitecode in bomamd_hdr [MF3GSUN024] .


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@94297 ce508802-f39f-4f6c-b175-0d175dae99d5
parent eb925c17
...@@ -88,13 +88,13 @@ public class BomAmdIC extends ValidatorEJB implements BomAmdICLocal, BomAmdICRem ...@@ -88,13 +88,13 @@ public class BomAmdIC extends ValidatorEJB implements BomAmdICLocal, BomAmdICRem
ConnDriver connDriver = new ConnDriver(); ConnDriver connDriver = new ConnDriver();
StringBuffer errStringXml = new StringBuffer("<?xml version = \"1.0\"?> \r\n <Root> <Errors>"); StringBuffer errStringXml = new StringBuffer("<?xml version = \"1.0\"?> \r\n <Root> <Errors>");
int currentFormNo =0,recCnt=0; int currentFormNo =0,recCnt=0,recCnt1=0;
String bomcode="",amdNo="",lineNo=""; String bomcode="",amdNo="",lineNo="";
String active = "",confirmed = ""; String active = "",confirmed = "";
String bomcodeHdr = "",lineNoBOM = "",updateStatus="",supMfgCode="",itemCode=""; String bomcodeHdr = "",lineNoBOM = "",updateStatus="",supMfgCode="",itemCode="";
String supCode="",supMfgCodeList[]=null; String supCode="",supMfgCodeList[]=null;
String loginSiteCode=""; String loginSiteCode="",siteCode="";
try try
{ {
System.out.println("@@@@@@@@ wfvaldata called"); System.out.println("@@@@@@@@ wfvaldata called");
...@@ -123,6 +123,9 @@ public class BomAmdIC extends ValidatorEJB implements BomAmdICLocal, BomAmdICRem ...@@ -123,6 +123,9 @@ public class BomAmdIC extends ValidatorEJB implements BomAmdICLocal, BomAmdICRem
if(childNodeName.equalsIgnoreCase("bom_code")) if(childNodeName.equalsIgnoreCase("bom_code"))
{ {
bomcode = checkNull(genericUtility.getColumnValue("bom_code", dom)); bomcode = checkNull(genericUtility.getColumnValue("bom_code", dom));
loginSiteCode = checkNull(genericUtility.getColumnValue("site_code", dom));
System.out.println("@@loginSiteCode"+loginSiteCode);
System.out.println("@@@@ bom_code["+bomcode+"]"); System.out.println("@@@@ bom_code["+bomcode+"]");
if(bomcode == null || bomcode.trim().length() == 0) if(bomcode == null || bomcode.trim().length() == 0)
{ {
...@@ -132,6 +135,7 @@ public class BomAmdIC extends ValidatorEJB implements BomAmdICLocal, BomAmdICRem ...@@ -132,6 +135,7 @@ public class BomAmdIC extends ValidatorEJB implements BomAmdICLocal, BomAmdICRem
} }
else else
{ {
errCode = isExist("bom","bom_code",bomcode,conn); errCode = isExist("bom","bom_code",bomcode,conn);
if( "FALSE".equalsIgnoreCase(errCode )) if( "FALSE".equalsIgnoreCase(errCode ))
{ {
...@@ -139,34 +143,75 @@ public class BomAmdIC extends ValidatorEJB implements BomAmdICLocal, BomAmdICRem ...@@ -139,34 +143,75 @@ public class BomAmdIC extends ValidatorEJB implements BomAmdICLocal, BomAmdICRem
errList.add(errCode); errList.add(errCode);
errFields.add(childNodeName.toLowerCase()); errFields.add(childNodeName.toLowerCase());
} }
sql = " select confirmed from bom where bom_code = ? "; else
{
sql = " select site_code from bom where bom_code = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,bomcode);
rs = pstmt.executeQuery();
if(rs.next())
{
siteCode = rs.getString("site_code")==null?"":rs.getString("site_code");;
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
if(siteCode.trim().length() > 0 && siteCode != null)
{
sql = " select confirmed from bom where bom_code = ? and site_code=? ";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1,bomcode); pstmt.setString(1,bomcode);
pstmt.setString(2,loginSiteCode);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
if(rs.next()) if(rs.next())
{ {
recCnt++; recCnt++;
confirmed = rs.getString("confirmed"); confirmed = rs.getString("confirmed")==null?"N":rs.getString("confirmed");
} }
rs.close(); rs.close();
rs = null; rs = null;
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
if( recCnt == 0 ) if( recCnt == 0 )
{ {
errCode = "VTBOMCD3"; errCode = "VTBOMCD4";
errList.add(errCode); errList.add(errCode);
errFields.add(childNodeName.toLowerCase()); errFields.add(childNodeName.toLowerCase());
} }
else if (!("Y".equalsIgnoreCase(confirmed))) }
else
{
sql = " select confirmed from bom where bom_code = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,bomcode);
rs = pstmt.executeQuery();
if(rs.next())
{
confirmed = rs.getString("confirmed")==null?"N":rs.getString("confirmed");
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
}
if (!("Y".equalsIgnoreCase(confirmed)) )
{ {
errCode = "VTNOTCONF1"; errCode = "VTNOTCONF1";
errList.add(errCode); errList.add(errCode);
errFields.add(childNodeName.toLowerCase()); errFields.add(childNodeName.toLowerCase());
} }
}
} }
} }
...@@ -466,7 +511,7 @@ public class BomAmdIC extends ValidatorEJB implements BomAmdICLocal, BomAmdICRem ...@@ -466,7 +511,7 @@ public class BomAmdIC extends ValidatorEJB implements BomAmdICLocal, BomAmdICRem
int currentFormNo =0; int currentFormNo =0;
String columnValue="",bomcode="",type="",descr="",sitecode="",sitedescr="",itemcode="",itemdescr=""; String columnValue="",bomcode="",type="",descr="",sitecode="",sitedescr="",itemcode="",itemdescr="";
String unit="",unitpotency=""; String unit="",unitpotency="",loginSiteCode="";
String linenobom="",itemref="",unitalt="",matchpoten="",adjpotency="",qtyperunit=""; String linenobom="",itemref="",unitalt="",matchpoten="",adjpotency="",qtyperunit="";
String criticalitem="",supcodemfg="",mfgref="",issvariencetype="",issvarvaltype="",locusagetype=""; String criticalitem="",supcodemfg="",mfgref="",issvariencetype="",issvarvaltype="",locusagetype="";
...@@ -531,7 +576,29 @@ public class BomAmdIC extends ValidatorEJB implements BomAmdICLocal, BomAmdICRem ...@@ -531,7 +576,29 @@ public class BomAmdIC extends ValidatorEJB implements BomAmdICLocal, BomAmdICRem
else if(currentColumn.trim().equalsIgnoreCase("itm_default")) else if(currentColumn.trim().equalsIgnoreCase("itm_default"))
{ {
System.out.println("@@@@@@@@ itm_default called @@@@@@@@"); System.out.println("@@@@@@@@ itm_default called @@@@@@@@");
valueXmlString.append("<amd_date>").append("<![CDATA["+sysDate+"]]>").append("</amd_date>"); valueXmlString.append("<amd_date>").append("<![CDATA["+sysDate+"]]>").append("</amd_date>");
loginSiteCode = checkNull(genericUtility.getValueFromXTRA_PARAMS(xtraParams, "loginSiteCode"));
//sitecode = checkNull(genericUtility.getColumnValue("site_code", dom));
if ( loginSiteCode!= null && loginSiteCode.trim().length() > 0 )
{
sql = "select descr from site where site_code = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, loginSiteCode);
rs = pstmt.executeQuery();
if(rs.next())
{
sitedescr = checkNull( rs.getString(1));
System.out.println("Default loginSiteCode descr["+sitedescr+"]");
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
}
valueXmlString.append("<site_code>").append("<![CDATA["+checkNull(loginSiteCode)+"]]>").append("</site_code>");
valueXmlString.append("<site_descr>").append("<![CDATA["+checkNull(sitedescr)+"]]>").append("</site_descr>");
} }
else if(currentColumn.trim().equalsIgnoreCase("bom_code")) else if(currentColumn.trim().equalsIgnoreCase("bom_code"))
...@@ -568,7 +635,7 @@ public class BomAmdIC extends ValidatorEJB implements BomAmdICLocal, BomAmdICRem ...@@ -568,7 +635,7 @@ public class BomAmdIC extends ValidatorEJB implements BomAmdICLocal, BomAmdICRem
pstmt = null; pstmt = null;
valueXmlString.append("<type>").append("<![CDATA["+type+"]]>").append("</type>"); valueXmlString.append("<type>").append("<![CDATA["+type+"]]>").append("</type>");
valueXmlString.append("<descr>").append("<![CDATA["+descr+"]]>").append("</descr>"); valueXmlString.append("<descr>").append("<![CDATA["+descr+"]]>").append("</descr>");
valueXmlString.append("<site_code>").append("<![CDATA["+sitecode+"]]>").append("</site_code>"); //valueXmlString.append("<site_code>").append("<![CDATA["+sitecode+"]]>").append("</site_code>");
valueXmlString.append("<item_code>").append("<![CDATA["+itemcode+"]]>").append("</item_code>"); valueXmlString.append("<item_code>").append("<![CDATA["+itemcode+"]]>").append("</item_code>");
valueXmlString.append("<batch_qty>").append("<![CDATA["+batchqty+"]]>").append("</batch_qty>"); valueXmlString.append("<batch_qty>").append("<![CDATA["+batchqty+"]]>").append("</batch_qty>");
valueXmlString.append("<unit>").append("<![CDATA["+unit+"]]>").append("</unit>"); valueXmlString.append("<unit>").append("<![CDATA["+unit+"]]>").append("</unit>");
...@@ -586,7 +653,7 @@ public class BomAmdIC extends ValidatorEJB implements BomAmdICLocal, BomAmdICRem ...@@ -586,7 +653,7 @@ public class BomAmdIC extends ValidatorEJB implements BomAmdICLocal, BomAmdICRem
valueXmlString.append("<valid_upto__o protect = \"1\">").append("<![CDATA[]]>").append("</valid_upto__o>"); valueXmlString.append("<valid_upto__o protect = \"1\">").append("<![CDATA[]]>").append("</valid_upto__o>");
} }
if ( sitecode!= null && sitecode.length() > 0 ) /*if ( sitecode!= null && sitecode.length() > 0 )
{ {
sql = "select descr from site where site_code = ? "; sql = "select descr from site where site_code = ? ";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
...@@ -605,8 +672,8 @@ public class BomAmdIC extends ValidatorEJB implements BomAmdICLocal, BomAmdICRem ...@@ -605,8 +672,8 @@ public class BomAmdIC extends ValidatorEJB implements BomAmdICLocal, BomAmdICRem
}else }else
{ {
valueXmlString.append("<site_descr protect = \"1\">").append("<![CDATA[]]>").append("</site_descr>"); valueXmlString.append("<site_descr protect = \"1\">").append("<![CDATA[]]>").append("</site_descr>");
} }*/
if ( itemcode!= null && itemcode.length() > 0 ) if ( itemcode!= null && itemcode.trim().length() > 0 )
{ {
sql = "select descr from item where item_code = ? "; sql = "select descr from item where item_code = ? ";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
...@@ -629,7 +696,6 @@ public class BomAmdIC extends ValidatorEJB implements BomAmdICLocal, BomAmdICRem ...@@ -629,7 +696,6 @@ public class BomAmdIC extends ValidatorEJB implements BomAmdICLocal, BomAmdICRem
} }
valueXmlString.append("</Detail1>"); valueXmlString.append("</Detail1>");
break; break;
......
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