Commit 0b462335 authored by ssalve's avatar ssalve

Sarita : Done changes on 06FEB2018

git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@179748 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 23c0c30c
...@@ -41,6 +41,7 @@ public class CostCtrAllocIC extends ValidatorEJB implements CostCtrAllocICRemote ...@@ -41,6 +41,7 @@ public class CostCtrAllocIC extends ValidatorEJB implements CostCtrAllocICRemote
public String globalXtraParams = ""; public String globalXtraParams = "";
E12GenericUtility genericUtility = new E12GenericUtility(); E12GenericUtility genericUtility = new E12GenericUtility();
DecimalFormat deciFormater = new DecimalFormat("0.00"); DecimalFormat deciFormater = new DecimalFormat("0.00");
//Pattern pattern = Pattern.compile("[0-9].{2}");
public String wfValData(String xmlString, String xmlString1,String xmlString2, String objContext, String editFlag,String xtraParams) throws RemoteException, ITMException public String wfValData(String xmlString, String xmlString1,String xmlString2, String objContext, String editFlag,String xtraParams) throws RemoteException, ITMException
{ {
Document dom = null; Document dom = null;
...@@ -94,8 +95,12 @@ public class CostCtrAllocIC extends ValidatorEJB implements CostCtrAllocICRemote ...@@ -94,8 +95,12 @@ public class CostCtrAllocIC extends ValidatorEJB implements CostCtrAllocICRemote
String childNodeName = "",siteCode="",prdCode=""; String childNodeName = "",siteCode="",prdCode="";
//Added by sarita on 4JAN2018 //Added by sarita on 4JAN2018
Timestamp prdCodeCurrent=null , currDate = null; Timestamp prdCodeCurrent=null , currDate = null;
double totalPer=0 ,crntPer=0; double totalPer=0.0 ,crntPer=0.0;
String allocation = "",CurrentLineNo="",updateFlag=""; String allocation = "",CurrentLineNo="",updateFlag="";
//Added by sarita on 06FEB2018
int allocNumber = 0;
int detlCnt1 = 0;
boolean result = true;
StringBuffer errStringXml = new StringBuffer("<?xml version = \"1.0\"?> \r\n <Root> <Errors>"); StringBuffer errStringXml = new StringBuffer("<?xml version = \"1.0\"?> \r\n <Root> <Errors>");
try try
{ {
...@@ -323,33 +328,42 @@ public class CostCtrAllocIC extends ValidatorEJB implements CostCtrAllocICRemote ...@@ -323,33 +328,42 @@ public class CostCtrAllocIC extends ValidatorEJB implements CostCtrAllocICRemote
System.out.println("childNodeName::: for Case3"+childNodeName +"updateFlag :::"+updateFlag); System.out.println("childNodeName::: for Case3"+childNodeName +"updateFlag :::"+updateFlag);
allocation = checkNull(genericUtility.getColumnValueFromNode("allocation",parentNode)); allocation = checkNull(genericUtility.getColumnValueFromNode("allocation",parentNode));
//allocation = checkNull(genericUtility.getColumnValue("allocation",dom2));
CurrentLineNo= checkNull(genericUtility.getColumnValueFromNode("line_no",parentNode)); CurrentLineNo= checkNull(genericUtility.getColumnValueFromNode("line_no",parentNode));
System.out.println("Allocation Percentage Value is :::::["+allocation+"]" + "\t"+ "CurrentLineNo is :::"+CurrentLineNo); System.out.println("Allocation Percentage Value is :::::["+allocation+"]" + "\t"+ "CurrentLineNo is :::"+CurrentLineNo);
int detlCnt1 = getNumOfNonDelDetail(dom2,3); //Added by sarita on 06FEB2018
System.out.println("DETAIL COUNT" +detlCnt1); detlCnt1 = getNumOfNonDelDetail(dom2,3);
//if(!("D".equalsIgnoreCase(updateFlag)) && allocation.trim().length()==0 || allocation == null) System.out.println("DETAIL COUNT IS [[" +detlCnt1+"]]");
//Added by sarita on 12JAN2018
if(detlCnt1 == 0) if(detlCnt1 == 0)
{ {
System.out.println("Delete count is 0"); System.out.println("Delete count is 0");
errCode = "VTBLNKDTL"; errCode = "VTBLNKDTL";
errList.add(errCode); errList.add(errCode);
errFields.add(childNodeName.toLowerCase()); errFields.add(childNodeName.toLowerCase());
} }
if(!"D".equalsIgnoreCase(updateFlag))//Added by sarita on 11JAN2018
if(allocation != null && allocation.trim().length() > 0)
{ {
if(allocation == null || allocation.trim().length()==0) try
{ {
System.out.println("inside alloc_perc LENGTH.."); crntPer = Double.parseDouble(allocation);
errCode = "VMEMPQLF03"; System.out.println("::crntPer::"+crntPer);
errList.add(errCode); }
errFields.add(childNodeName.toLowerCase()); catch(Exception e)
{
} System.out.println("Error::"+e);
else errCode = "NOTANUMBR1";
{ errList.add(errCode);
System.out.println("inside alloc_perc "); errFields.add(childNodeName.toLowerCase());
result = false;
}
}
if(result && (allocation != null && allocation.trim().length() > 0))
{
System.out.println("Allocation value is ["+allocation+"] Proper Number");
if("A".equalsIgnoreCase(updateFlag))//changes by sarita on 06FEB2018
{
System.out.println("inside alloc_perc ");
crntPer = Double.parseDouble(allocation); crntPer = Double.parseDouble(allocation);
System.out.println("crntPer :::::["+crntPer+"]"); System.out.println("crntPer :::::["+crntPer+"]");
//Added by sarita on 06NOV2017 //Added by sarita on 06NOV2017
...@@ -380,10 +394,20 @@ public class CostCtrAllocIC extends ValidatorEJB implements CostCtrAllocICRemote ...@@ -380,10 +394,20 @@ public class CostCtrAllocIC extends ValidatorEJB implements CostCtrAllocICRemote
errFields.add(childNodeName.toLowerCase()); errFields.add(childNodeName.toLowerCase());
} }
} }
}
}
} }
else if(result && (allocation == null || allocation.trim().length()==0))//Added by sarita on 06FEB2018
{
System.out.println("Allocation Value is Null!!!!");
if(("A".equalsIgnoreCase(updateFlag)))
{
System.out.println("Allocation Value is null && result is true");
errCode = "VMEMPQLF03";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}
} }
}//end of for loop }//end of for loop
} }
...@@ -434,6 +458,7 @@ public class CostCtrAllocIC extends ValidatorEJB implements CostCtrAllocICRemote ...@@ -434,6 +458,7 @@ public class CostCtrAllocIC extends ValidatorEJB implements CostCtrAllocICRemote
e.printStackTrace(); e.printStackTrace();
//Added by sarita on 15JAN2018 //Added by sarita on 15JAN2018
errStringXml.append("</Errors> </Root> \r\n"); errStringXml.append("</Errors> </Root> \r\n");
throw new ITMException(e);//Added by sarita on 06FEB2018
} }
finally finally
{ {
...@@ -521,8 +546,11 @@ public class CostCtrAllocIC extends ValidatorEJB implements CostCtrAllocICRemote ...@@ -521,8 +546,11 @@ public class CostCtrAllocIC extends ValidatorEJB implements CostCtrAllocICRemote
System.out.println("errStringXml .........."+errStringXml); System.out.println("errStringXml .........."+errStringXml);
errString1 = ""; errString1 = "";
} }
errStringXml.append("</Errors></Root>\r\n"); errStringXml.append("</Errors></Root>\r\n");
throw new ITMException(e);//Added by sarita on 06FEB2018
} }
System.out.println("final retsting from ic["+errString+"]");
return errString; return errString;
} }
...@@ -555,6 +583,7 @@ public class CostCtrAllocIC extends ValidatorEJB implements CostCtrAllocICRemote ...@@ -555,6 +583,7 @@ public class CostCtrAllocIC extends ValidatorEJB implements CostCtrAllocICRemote
} }
catch(Exception e){ catch(Exception e){
e.printStackTrace(); e.printStackTrace();
throw new ITMException(e);//Added by sarita on 06FEB2018
} }
return returnStr; return returnStr;
} }
...@@ -584,7 +613,8 @@ public class CostCtrAllocIC extends ValidatorEJB implements CostCtrAllocICRemote ...@@ -584,7 +613,8 @@ public class CostCtrAllocIC extends ValidatorEJB implements CostCtrAllocICRemote
Timestamp toDateTimestamp = null; Timestamp toDateTimestamp = null;
int domID=0,domIDDet =0; int domID=0,domIDDet =0;
String drcrFlagVal = "", allocdescr = ""; String drcrFlagVal = "", allocdescr = "";
double allocation_perc=0,unitAllocation = 0;; double allocation_perc=0,unitAllocation = 0;
boolean isresult = true;
int cnt=0; int cnt=0;
double allocPercent=0; double allocPercent=0;
try try
...@@ -995,29 +1025,49 @@ public class CostCtrAllocIC extends ValidatorEJB implements CostCtrAllocICRemote ...@@ -995,29 +1025,49 @@ public class CostCtrAllocIC extends ValidatorEJB implements CostCtrAllocICRemote
System.out.println("detailString value is DOM=="+genericUtility.serializeDom(dom)); System.out.println("detailString value is DOM=="+genericUtility.serializeDom(dom));
domIDDet = Integer.parseInt(curDetail.getAttributes().getNamedItem("domID").getNodeValue()); domIDDet = Integer.parseInt(curDetail.getAttributes().getNamedItem("domID").getNodeValue());
System.out.println("domIDDet ["+domIDDet+"]"); System.out.println("domIDDet ["+domIDDet+"]");
totUnit = Double.parseDouble(genericUtility.getColumnValue("tot_units", dom)); totUnit = Double.parseDouble(genericUtility.getColumnValue("tot_units", dom));
allocation = genericUtility.getColumnValue("allocation", dom); allocation = checkNull(genericUtility.getColumnValue("allocation", dom));
System.out.println("totUnit ["+totUnit+"]" + "\t"+ "allocation ["+allocation+"]"); System.out.println("totUnit ["+totUnit+"]" + "\t"+ "allocation ["+allocation+"]");
//Added by sarita on 24JAN2018 //Added by sarita on 24JAN2018
if(allocation != null && allocation.trim().length() > 0) if(allocation != null && allocation.trim().length() > 0)
{ {
allocation_perc = Double.parseDouble(genericUtility.getColumnValue("allocation", dom)); try
{
allocation_perc = Double.parseDouble(allocation);//Added by sarita on 06FEB2018
System.out.println("::allocation_perc in ITEMCHANGE FIELD::"+allocation_perc);
}
catch(Exception e)
{
System.out.println("Error::"+e);
isresult = false;
}
} }
System.out.println("Value of totUnit :::: ["+totUnit+"]" + "allocation_perc :::: ["+allocation_perc+"]"); if(isresult && (allocation != null && allocation.trim().length() > 0))
unitAllocation = setUnitAllocationValue(totUnit,allocation_perc); {
accountCode = checkNull(genericUtility.getColumnValue("acct_code", dom)); allocation_perc = Double.parseDouble(genericUtility.getColumnValue("allocation", dom));
System.out.println("allocation_perc ::::["+allocation_perc+"]" + "unitAllocation ::::["+unitAllocation+"]" + "accountCode ::::["+accountCode+"]" + "totUnit ::::: ["+totUnit+"]"); System.out.println("Value of totUnit :::: ["+totUnit+"]" + "allocation_perc :::: ["+allocation_perc+"]");
valueXmlString.append("<Detail3 domID='" + domIDDet + "' selected=\"Y\">\r\n"); unitAllocation = setUnitAllocationValue(totUnit,allocation_perc);
valueXmlString.append("<attribute selected=\"Y\" updateFlag=\"A\" status=\"N\"/>\r\n"); accountCode = checkNull(genericUtility.getColumnValue("acct_code", dom));
valueXmlString.append("<selectbox>true</selectbox>\r\n"); System.out.println("allocation_perc ::::["+allocation_perc+"]" + "unitAllocation ::::["+unitAllocation+"]" + "accountCode ::::["+accountCode+"]" + "totUnit ::::: ["+totUnit+"]");
valueXmlString.append("<unit_alloc><![CDATA[" ).append(unitAllocation).append( "]]></unit_alloc>\r\n" ); valueXmlString.append("<Detail3 domID='" + domIDDet + "' selected=\"Y\">\r\n");
valueXmlString.append("</Detail3>\r\n"); valueXmlString.append("<attribute selected='Y' updateFlag='Y' status=\"N\"/>\r\n");
valueXmlString.append("<selectbox>true</selectbox>\r\n");
} valueXmlString.append("<allocation><![CDATA[" ).append(allocation_perc).append( "]]></allocation>\r\n" );
valueXmlString.append("<unit_alloc><![CDATA[" ).append(unitAllocation).append( "]]></unit_alloc>\r\n" );
valueXmlString.append("</Detail3>\r\n");
}
else if(isresult && (allocation == null || allocation.trim().length() == 0))
{
System.out.println("allocation if allocation value is null["+allocation+"]");
valueXmlString.append("<Detail3 domID='" + domIDDet + "' selected=\"Y\">\r\n");
valueXmlString.append("<attribute selected='Y' updateFlag='Y' status=\"N\"/>\r\n");
valueXmlString.append("<selectbox>true</selectbox>\r\n");
valueXmlString.append("<allocation><![CDATA[" ).append(allocation).append( "]]></allocation>\r\n" );
valueXmlString.append("<unit_alloc><![CDATA[" ).append(0.0).append( "]]></unit_alloc>\r\n" );
valueXmlString.append("</Detail3>\r\n");
}
}
break; break;
} }
} }
...@@ -1761,7 +1811,8 @@ public class CostCtrAllocIC extends ValidatorEJB implements CostCtrAllocICRemote ...@@ -1761,7 +1811,8 @@ public class CostCtrAllocIC extends ValidatorEJB implements CostCtrAllocICRemote
public double getNumOftotalallocPercentage(Document dom2,String CurrentLineNo) throws ITMException public double getNumOftotalallocPercentage(Document dom2,String CurrentLineNo) throws ITMException
{ {
String perAmt="",lineNo="",updateFlag = ""; String perAmt="",lineNo="",updateFlag = "";
double num=0; double num=0.0,linenum=0.0;
boolean checkPerAmt = true;
System.out.println("Inside getXmlDocument method!!!!!!!!!!!!!!"); System.out.println("Inside getXmlDocument method!!!!!!!!!!!!!!");
try try
{ {
...@@ -1782,11 +1833,23 @@ public class CostCtrAllocIC extends ValidatorEJB implements CostCtrAllocICRemote ...@@ -1782,11 +1833,23 @@ public class CostCtrAllocIC extends ValidatorEJB implements CostCtrAllocICRemote
perAmt= pNode.getElementsByTagName("allocation").item(0).getFirstChild().getNodeValue(); perAmt= pNode.getElementsByTagName("allocation").item(0).getFirstChild().getNodeValue();
lineNo = pNode.getElementsByTagName("line_no").item(0).getFirstChild().getNodeValue(); lineNo = pNode.getElementsByTagName("line_no").item(0).getFirstChild().getNodeValue();
System.out.println("[If update flag is not D ]perAmt ::"+perAmt + "\t" + "lineNo ::"+lineNo +"update Flag ::"+updateFlag); System.out.println("[If update flag is not D ]perAmt ::"+perAmt + "\t" + "lineNo ::"+lineNo +"update Flag ::"+updateFlag);
if(!lineNo.equalsIgnoreCase(CurrentLineNo.trim())) if(!lineNo.equalsIgnoreCase(CurrentLineNo.trim()))//Added by sarita on 06FEB2018
{
try
{
linenum = Double.parseDouble(perAmt);
}
catch(Exception e)
{
System.out.println(e);
checkPerAmt = false;
}
if(checkPerAmt)
{ {
num += Double.parseDouble(perAmt); num += Double.parseDouble(perAmt);
System.out.println("num is ==="+num); System.out.println("num is ==="+num);
} }
}
} }
} }
} }
...@@ -1848,12 +1911,16 @@ public class CostCtrAllocIC extends ValidatorEJB implements CostCtrAllocICRemote ...@@ -1848,12 +1911,16 @@ public class CostCtrAllocIC extends ValidatorEJB implements CostCtrAllocICRemote
}//end of method getResourceBasVal }//end of method getResourceBasVal
//Added by sarita on 06NOV2017 //Added by sarita on 06NOV2017
//public String getAttributeVal(Node dom2, String attribName )throws ITMException
public String getAttributeVal(Node dom, String attribName )throws ITMException public String getAttributeVal(Node dom, String attribName )throws ITMException
{ {
System.out.println("Inside getAttributeVal method is !!!!!!!!!!!!!!");
String AttribValue = null; String AttribValue = null;
try try
{ {
NodeList detailList = dom.getChildNodes(); //NodeList detailList = dom2.getChildNodes();
NodeList detailList = dom.getChildNodes();
System.out.println("Details NodeList is ====["+detailList+"]" + "Length is ======"+detailList.getLength());
int detListLength = detailList.getLength(); int detListLength = detailList.getLength();
for(int ctr = 0; ctr < detListLength; ctr++) for(int ctr = 0; ctr < detListLength; ctr++)
{ {
...@@ -1861,6 +1928,7 @@ public class CostCtrAllocIC extends ValidatorEJB implements CostCtrAllocICRemote ...@@ -1861,6 +1928,7 @@ public class CostCtrAllocIC extends ValidatorEJB implements CostCtrAllocICRemote
if(curDetail.getNodeName().equals("attribute")) if(curDetail.getNodeName().equals("attribute"))
{ {
AttribValue = curDetail.getAttributes().getNamedItem(attribName).getNodeValue(); AttribValue = curDetail.getAttributes().getNamedItem(attribName).getNodeValue();
System.out.println("Attribute Value is =====["+AttribValue+"]");
break; break;
} }
else else
...@@ -1877,7 +1945,7 @@ public class CostCtrAllocIC extends ValidatorEJB implements CostCtrAllocICRemote ...@@ -1877,7 +1945,7 @@ public class CostCtrAllocIC extends ValidatorEJB implements CostCtrAllocICRemote
return AttribValue; return AttribValue;
} }
//Added by sarita on 6NOV2017 //Added by sarita on 6NOV2017
public int getNumOfNonDelDetail(Document dom2,int detailNo) public int getNumOfNonDelDetail(Document dom2,int detailNo) throws ITMException
{ {
Node childNode = null; Node childNode = null;
NodeList updateList; NodeList updateList;
...@@ -1897,23 +1965,27 @@ public class CostCtrAllocIC extends ValidatorEJB implements CostCtrAllocICRemote ...@@ -1897,23 +1965,27 @@ public class CostCtrAllocIC extends ValidatorEJB implements CostCtrAllocICRemote
childNodeName = pNode.getNodeName(); childNodeName = pNode.getNodeName();
//System.out.println("pNode::["+pNode+"]"+"cNodeList::["+cNodeList+"]"); //System.out.println("pNode::["+pNode+"]"+"cNodeList::["+cNodeList+"]");
updateFlag = getAttributeVal(pNode,"updateFlag"); updateFlag = getAttributeVal(pNode,"updateFlag");
System.out.println("updateFlag [" + updateFlag + "]"); System.out.println("Before updateFlag counter is ===["+cntr+"]"+"\t"+"updateFlag [" + updateFlag + "]");
if(!updateFlag.equalsIgnoreCase("D")) //if(!updateFlag.equalsIgnoreCase("D"))
if("A".equalsIgnoreCase(updateFlag))//changes by sarita on 06FEB2018
{ {
cntr++; cntr++;
} }
System.out.println("Counter is ==="+cntr); System.out.println("After updateFlag counter is ===["+cntr+"]"+"\t"+"updateFlag [" + updateFlag + "]");
//System.out.println("Counter is ==="+cntr);
} }
} }
catch(Exception e) catch(Exception e)
{ {
System.out.println("Exception : : getNumOfNonDelDetail :"+e); System.out.println("Exception : : getNumOfNonDelDetail :"+e);
e.printStackTrace(); e.printStackTrace();
throw new ITMException(e);
} }
return cntr; return cntr;
} }
//Added by sarita on 15JAN2018 //Added by sarita on 15JAN2018
public String getUpdateFlag(Document dom2,int detailNo) public String getUpdateFlag(Document dom2,int detailNo) throws ITMException
{ {
String updateFlag=""; String updateFlag="";
Node childNode = null; Node childNode = null;
...@@ -1938,10 +2010,29 @@ public class CostCtrAllocIC extends ValidatorEJB implements CostCtrAllocICRemote ...@@ -1938,10 +2010,29 @@ public class CostCtrAllocIC extends ValidatorEJB implements CostCtrAllocICRemote
{ {
System.out.println("Exception : : getNumOfNonDelDetail :"+e); System.out.println("Exception : : getNumOfNonDelDetail :"+e);
e.printStackTrace(); e.printStackTrace();
throw new ITMException(e);
} }
return updateFlag; return updateFlag;
} }
//Added by sarita on 06FEB2018
public boolean getDataAlloc(String allocation)
{
boolean resultActNum = false;
double allocNumber = 0.0;
try
{
allocNumber = Double.parseDouble(allocation);
}
catch(NumberFormatException e)
{
System.out.println(e);
resultActNum = true;
}
System.out.println("resultActNum:::"+resultActNum);
return resultActNum;
}
}//end of class CostCtrAllocIC }//end of class CostCtrAllocIC
......
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