Commit d0658fa7 authored by ssalve's avatar ssalve

Sarita: Done changes to resolve select deselect QC Issues of Cost Center Allocation on 15JAN2018

git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@178341 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 04f3602c
...@@ -90,7 +90,7 @@ public class CostCtrAllocIC extends ValidatorEJB implements CostCtrAllocICRemote ...@@ -90,7 +90,7 @@ public class CostCtrAllocIC extends ValidatorEJB implements CostCtrAllocICRemote
NodeList childNodeList = null; NodeList childNodeList = null;
Node childNode = null; Node childNode = null;
int childNodeLength = 0; int childNodeLength = 0;
int ctr = 0, cnt = 0; int cnt = 0;
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;
...@@ -114,7 +114,7 @@ public class CostCtrAllocIC extends ValidatorEJB implements CostCtrAllocICRemote ...@@ -114,7 +114,7 @@ public class CostCtrAllocIC extends ValidatorEJB implements CostCtrAllocICRemote
childNodeList = parentNode.getChildNodes(); childNodeList = parentNode.getChildNodes();
childNodeLength = childNodeList.getLength(); childNodeLength = childNodeList.getLength();
for(ctr = 0; ctr < childNodeLength; ctr++) for(int ctr = 0; ctr < childNodeLength; ctr++)
{ {
childNode = childNodeList.item(ctr); childNode = childNodeList.item(ctr);
childNodeName = childNode.getNodeName(); childNodeName = childNode.getNodeName();
...@@ -285,7 +285,7 @@ public class CostCtrAllocIC extends ValidatorEJB implements CostCtrAllocICRemote ...@@ -285,7 +285,7 @@ public class CostCtrAllocIC extends ValidatorEJB implements CostCtrAllocICRemote
parentNode = parentNodeList.item(0); parentNode = parentNodeList.item(0);
childNodeList = parentNode.getChildNodes(); childNodeList = parentNode.getChildNodes();
childNodeLength = childNodeList.getLength(); childNodeLength = childNodeList.getLength();
for(ctr = 0; ctr < childNodeLength; ctr++) for(int ctr = 0; ctr < childNodeLength; ctr++)
{ {
childNode = childNodeList.item(ctr); childNode = childNodeList.item(ctr);
childNodeName = childNode.getNodeName(); childNodeName = childNode.getNodeName();
...@@ -297,19 +297,34 @@ public class CostCtrAllocIC extends ValidatorEJB implements CostCtrAllocICRemote ...@@ -297,19 +297,34 @@ public class CostCtrAllocIC extends ValidatorEJB implements CostCtrAllocICRemote
case 3: case 3:
{ {
System.out.println("Inside Case3 Validation:::"); System.out.println("Inside Case3 Validation:::");
parentNodeList = dom.getElementsByTagName("Detail3"); parentNodeList = dom2.getElementsByTagName("Detail3");
parentNode = parentNodeList.item(0); System.out.println("////////"+parentNodeList.getLength());
//Added by sarita on 15JAN2018
for(int dCnter = 0; dCnter < parentNodeList.getLength(); dCnter++)
{
System.out.println("Detail3 CTR["+dCnter+"]");
allocation = "";
System.out.println("Inside Case3 Validation:::loop:"+dCnter);
parentNode = parentNodeList.item(dCnter);
System.out.println("parentNode ["+parentNode+"]");
childNodeList = parentNode.getChildNodes(); childNodeList = parentNode.getChildNodes();
childNodeLength = childNodeList.getLength(); childNodeLength = childNodeList.getLength();
for(ctr = 0; ctr < childNodeLength; ctr++) System.out.println("*****"+childNodeLength);
for(int ctr = 0; ctr < childNodeLength; ctr++)
{ {
childNode = childNodeList.item(ctr); childNode = childNodeList.item(ctr);
childNodeName = childNode.getNodeName(); childNodeName = childNode.getNodeName();
System.out.println("childNodeName::: for Case3"+childNodeName +"updateFlag :::"+updateFlag); System.out.println("ctr ["+ctr+"]" +"\t"+"childNode ["+childNode+"]" + "\t" + "childNodeName["+childNodeName+"]");
//updateFlag = getUpdateFlag(dom2,3);
if("allocation".equalsIgnoreCase(childNodeName)) if("allocation".equalsIgnoreCase(childNodeName))
{ {
allocation = checkNull(genericUtility.getColumnValue("allocation",dom)).trim(); updateFlag = getAttributeVal(parentNode,"updateFlag");
CurrentLineNo= checkNull(genericUtility.getColumnValue("line_no",dom)).trim(); System.out.println("childNodeName::: for Case3"+childNodeName +"updateFlag :::"+updateFlag);
allocation = checkNull(genericUtility.getColumnValueFromNode("allocation",parentNode));
//allocation = checkNull(genericUtility.getColumnValue("allocation",dom2));
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); int detlCnt1 = getNumOfNonDelDetail(dom2,3);
System.out.println("DETAIL COUNT" +detlCnt1); System.out.println("DETAIL COUNT" +detlCnt1);
...@@ -322,12 +337,15 @@ public class CostCtrAllocIC extends ValidatorEJB implements CostCtrAllocICRemote ...@@ -322,12 +337,15 @@ public class CostCtrAllocIC extends ValidatorEJB implements CostCtrAllocICRemote
errList.add(errCode); errList.add(errCode);
errFields.add(childNodeName.toLowerCase()); errFields.add(childNodeName.toLowerCase());
} }
else if(allocation.trim().length()==0 || allocation == null)//Added by sarita on 11JAN2018 if(!"D".equalsIgnoreCase(updateFlag))//Added by sarita on 11JAN2018
{
if(allocation == null || allocation.trim().length()==0)
{ {
System.out.println("inside alloc_perc LENGTH.."); System.out.println("inside alloc_perc LENGTH..");
errCode = "VMEMPQLF03"; errCode = "VMEMPQLF03";
errList.add(errCode); errList.add(errCode);
errFields.add(childNodeName.toLowerCase()); errFields.add(childNodeName.toLowerCase());
} }
else else
{ {
...@@ -335,7 +353,7 @@ public class CostCtrAllocIC extends ValidatorEJB implements CostCtrAllocICRemote ...@@ -335,7 +353,7 @@ public class CostCtrAllocIC extends ValidatorEJB implements CostCtrAllocICRemote
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
System.out.println("detailString value is =="+genericUtility.serializeDom(dom)); //System.out.println("detailString value is =="+genericUtility.serializeDom(dom));
NodeList detailNoteList = dom2.getElementsByTagName("Detail3"); NodeList detailNoteList = dom2.getElementsByTagName("Detail3");
//updateFlag = getAttributeVal(childNode,"updateFlag"); //updateFlag = getAttributeVal(childNode,"updateFlag");
//System.out.println("updateFlag is :::::::::::::::"+updateFlag); //System.out.println("updateFlag is :::::::::::::::"+updateFlag);
...@@ -362,34 +380,13 @@ public class CostCtrAllocIC extends ValidatorEJB implements CostCtrAllocICRemote ...@@ -362,34 +380,13 @@ public class CostCtrAllocIC extends ValidatorEJB implements CostCtrAllocICRemote
errFields.add(childNodeName.toLowerCase()); errFields.add(childNodeName.toLowerCase());
} }
} }
/* if(detlCnt >=2)
{
totalPer = getNumOftotalallocPercentage( dom2 ,CurrentLineNo);
System.out.println("TOTAL AMOUNT..." +totalPer);
double remAmt = 100 - totalPer; // 5
if(crntPer > remAmt) //
{
System.out.println("EXCEED AMOUNT..." +remAmt);
errCode = "OVERALLINV";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
} }
else
{
if(crntPer > 100)
{
System.out.println("AMOUNT..." +crntPer);
errCode = "OVERALLINV";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}*/
} }
} }
}//end of for loop }//end of for loop
}
}//end of case3 }//end of case3
break; break;
}//end of switch statement }//end of switch statement
...@@ -435,6 +432,8 @@ public class CostCtrAllocIC extends ValidatorEJB implements CostCtrAllocICRemote ...@@ -435,6 +432,8 @@ public class CostCtrAllocIC extends ValidatorEJB implements CostCtrAllocICRemote
{ {
System.out.println("Exception ::"+e); System.out.println("Exception ::"+e);
e.printStackTrace(); e.printStackTrace();
//Added by sarita on 15JAN2018
errStringXml.append("</Errors> </Root> \r\n");
} }
finally finally
{ {
...@@ -467,49 +466,16 @@ public class CostCtrAllocIC extends ValidatorEJB implements CostCtrAllocICRemote ...@@ -467,49 +466,16 @@ public class CostCtrAllocIC extends ValidatorEJB implements CostCtrAllocICRemote
return errString; return errString;
}// end of wfvalData method }// end of wfvalData method
private String checkNull(String input) private String checkNull(String input)
{
return input == null ? "" : input;
}
public String defaultDataWiz() throws RemoteException, ITMException
{
return "";
}
//private String defaultDataWiz( Document dom, Document dom1, Document dom2, String objContext, String currentColumn, String editFlag, String xtraParams, String formName ) throws RemoteException,ITMException
/*public String itemChanged(String xmlString, String xmlString1,String xmlString2, String objContext, String currentColumn,String editFlag, String xtraParams) throws RemoteException,ITMException
{
Document dom=null;
Document domhr=null;
Document domAll=null;
String retString="";
try
{
System.out.println("************** Inside itemChanged method ****************");
if(xmlString != null && xmlString.trim().length()>0)
{
dom = genericUtility.parseString(xmlString);
}
if(xmlString1 != null && xmlString1.trim().length()>0)
{
domhr = genericUtility.parseString(xmlString1);
}
if(xmlString2 != null && xmlString2.trim().length()>0)
{ {
domAll = genericUtility.parseString(xmlString2); return input == null ? "" : input;
}
retString = itemChanged(dom,domhr,domAll,objContext,currentColumn,editFlag,xtraParams);
//retString = "<?xml version='"+1.0+"'?><Root><header><editFlag>null</editFlag></header><Detail1 domID='1'><site_code><![CDATA[TA821]]></site_code><site_descr><![CDATA[TARO PHARMACEUTICALS, USA, HAWTHORNE, NY]]></site_descr><period_descr><![CDATA[]]></period_descr></Detail1></Root>";
System.out.println("retString123::::::::::"+retString);
} }
catch(Exception e)
public String defaultDataWiz() throws RemoteException, ITMException
{ {
System.out.println(":::" + getClass().getSimpleName() + "::"+ e.getMessage()); return "";
e.getMessage();
} }
return retString;
}*/
public String itemChanged(String xmlString, String xmlString1,String xmlString2, String objContext, String currentColumn,String editFlag, String xtraParams) throws RemoteException,ITMException public String itemChanged(String xmlString, String xmlString1,String xmlString2, String objContext, String currentColumn,String editFlag, String xtraParams) throws RemoteException,ITMException
{ {
...@@ -556,8 +522,6 @@ public String defaultDataWiz() throws RemoteException, ITMException ...@@ -556,8 +522,6 @@ public String defaultDataWiz() throws RemoteException, ITMException
errString1 = ""; errString1 = "";
} }
errStringXml.append("</Errors></Root>\r\n"); errStringXml.append("</Errors></Root>\r\n");
} }
return errString; return errString;
} }
...@@ -1795,32 +1759,30 @@ public String defaultDataWiz() throws RemoteException, ITMException ...@@ -1795,32 +1759,30 @@ public String defaultDataWiz() throws RemoteException, ITMException
try try
{ {
NodeList detailNoteList = dom2.getElementsByTagName("Detail3"); NodeList detailNoteList = dom2.getElementsByTagName("Detail3");
System.out.println("Value of dom2 is :::::["+dom2+"]"); //System.out.println("Value of dom2 is :::::["+dom2+"]");
System.out.println("Length of detailNoteList" +detailNoteList.getLength()); System.out.println("Length of detailNoteList" +detailNoteList.getLength());
for(int cnt = 0;cnt<detailNoteList.getLength();cnt++) for(int cnt = 0;cnt<detailNoteList.getLength();cnt++)
{ {
Element pNode=(Element) detailNoteList.item(cnt); Element pNode=(Element) detailNoteList.item(cnt);
System.out.println("Inside 1"); System.out.println("COUNT VALUE IS ["+cnt+"]" + "Current Line Number is ::: ["+CurrentLineNo+"]");
updateFlag = getAttributeVal(pNode,"updateFlag"); updateFlag = getAttributeVal(pNode,"updateFlag"); System.out.println("update flag in getNumOftotalallocPercentage ["+updateFlag+"]");
//Added by sarita on 11JAN2018 //Added by sarita on 11JAN2018
if(!("D".equalsIgnoreCase(updateFlag))) if(!("D".equalsIgnoreCase(updateFlag)))
{
//Added by sarita on 15JAN2018
if(pNode.getElementsByTagName("allocation").item(0) != null && pNode.getElementsByTagName("allocation").item(0).getFirstChild() != null)
{ {
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()))
//Added by sarita on 30NOV2017
//updateFlag = getAttributeVal(pNode,"updateFlag");
System.out.println("perAmt ::"+perAmt + "\t" + "lineNo ::"+lineNo +"update Flag ::"+updateFlag);
//if(!lineNo.equalsIgnoreCase(CurrentLineNo.trim()))
if((!lineNo.equalsIgnoreCase(CurrentLineNo.trim())) && !("D".equalsIgnoreCase(updateFlag)))
{ {
System.out.println("Line No is.. "+CurrentLineNo);
num += Double.parseDouble(perAmt); num += Double.parseDouble(perAmt);
System.out.println("perAmt is ==="+perAmt); System.out.println("num is ==="+num);
}
}
} }
} }
System.out.println("num is ==="+num);
} }
catch(Exception e) catch(Exception e)
{ {
...@@ -1943,6 +1905,36 @@ public String defaultDataWiz() throws RemoteException, ITMException ...@@ -1943,6 +1905,36 @@ public String defaultDataWiz() throws RemoteException, ITMException
} }
return cntr; return cntr;
} }
//Added by sarita on 15JAN2018
public String getUpdateFlag(Document dom2,int detailNo)
{
String updateFlag="";
Node childNode = null;
NodeList updateList;
String childNodeName = "";
try
{
System.out.println("detailString value is =="+genericUtility.serializeDom(dom2));
NodeList detailNoteList = dom2.getElementsByTagName("Detail"+detailNo);
for(int cnt = 0;cnt<detailNoteList.getLength();cnt++)
{
Node pNode=detailNoteList.item(cnt);
/*NodeList cNodeList=pNode.getChildNodes();
childNodeListLength = cNodeList.getLength();*/
childNodeName = pNode.getNodeName();
//System.out.println("pNode::["+pNode+"]"+"cNodeList::["+cNodeList+"]");
updateFlag = getAttributeVal(pNode,"updateFlag");
System.out.println("updateFlag [" + updateFlag + "]");
}
}
catch(Exception e)
{
System.out.println("Exception : : getNumOfNonDelDetail :"+e);
e.printStackTrace();
}
return updateFlag;
}
}//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