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
...@@ -49,7 +49,7 @@ public class CostCtrAllocIC extends ValidatorEJB implements CostCtrAllocICRemote ...@@ -49,7 +49,7 @@ public class CostCtrAllocIC extends ValidatorEJB implements CostCtrAllocICRemote
String retString = ""; String retString = "";
try try
{ {
System.out.println("*************** Inside wfValData *******************"); System.out.println("*************** Inside wfValData *******************");
if(xmlString != null && xmlString.trim().length()>0) if(xmlString != null && xmlString.trim().length()>0)
{ {
dom = genericUtility.parseString(xmlString); dom = genericUtility.parseString(xmlString);
...@@ -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,99 +297,96 @@ public class CostCtrAllocIC extends ValidatorEJB implements CostCtrAllocICRemote ...@@ -297,99 +297,96 @@ 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());
childNodeList = parentNode.getChildNodes(); //Added by sarita on 15JAN2018
childNodeLength = childNodeList.getLength(); for(int dCnter = 0; dCnter < parentNodeList.getLength(); dCnter++)
for(ctr = 0; ctr < childNodeLength; ctr++)
{ {
childNode = childNodeList.item(ctr); System.out.println("Detail3 CTR["+dCnter+"]");
childNodeName = childNode.getNodeName(); allocation = "";
System.out.println("childNodeName::: for Case3"+childNodeName +"updateFlag :::"+updateFlag); System.out.println("Inside Case3 Validation:::loop:"+dCnter);
if("allocation".equalsIgnoreCase(childNodeName)) parentNode = parentNodeList.item(dCnter);
{ System.out.println("parentNode ["+parentNode+"]");
allocation = checkNull(genericUtility.getColumnValue("allocation",dom)).trim(); childNodeList = parentNode.getChildNodes();
CurrentLineNo= checkNull(genericUtility.getColumnValue("line_no",dom)).trim(); childNodeLength = childNodeList.getLength();
System.out.println("Allocation Percentage Value is :::::["+allocation+"]" + "\t"+ "CurrentLineNo is :::"+CurrentLineNo); System.out.println("*****"+childNodeLength);
int detlCnt1 = getNumOfNonDelDetail(dom2,3); for(int ctr = 0; ctr < childNodeLength; ctr++)
System.out.println("DETAIL COUNT" +detlCnt1); {
//if(!("D".equalsIgnoreCase(updateFlag)) && allocation.trim().length()==0 || allocation == null) childNode = childNodeList.item(ctr);
//Added by sarita on 12JAN2018 childNodeName = childNode.getNodeName();
if(detlCnt1 == 0) System.out.println("ctr ["+ctr+"]" +"\t"+"childNode ["+childNode+"]" + "\t" + "childNodeName["+childNodeName+"]");
{ //updateFlag = getUpdateFlag(dom2,3);
System.out.println("Delete count is 0");
errCode = "VTBLNKDTL"; if("allocation".equalsIgnoreCase(childNodeName))
errList.add(errCode); {
errFields.add(childNodeName.toLowerCase()); updateFlag = getAttributeVal(parentNode,"updateFlag");
} System.out.println("childNodeName::: for Case3"+childNodeName +"updateFlag :::"+updateFlag);
else if(allocation.trim().length()==0 || allocation == null)//Added by sarita on 11JAN2018
{ allocation = checkNull(genericUtility.getColumnValueFromNode("allocation",parentNode));
System.out.println("inside alloc_perc LENGTH.."); //allocation = checkNull(genericUtility.getColumnValue("allocation",dom2));
errCode = "VMEMPQLF03"; CurrentLineNo= checkNull(genericUtility.getColumnValueFromNode("line_no",parentNode));
errList.add(errCode); System.out.println("Allocation Percentage Value is :::::["+allocation+"]" + "\t"+ "CurrentLineNo is :::"+CurrentLineNo);
errFields.add(childNodeName.toLowerCase()); int detlCnt1 = getNumOfNonDelDetail(dom2,3);
} System.out.println("DETAIL COUNT" +detlCnt1);
else //if(!("D".equalsIgnoreCase(updateFlag)) && allocation.trim().length()==0 || allocation == null)
{ //Added by sarita on 12JAN2018
System.out.println("inside alloc_perc "); if(detlCnt1 == 0)
crntPer = Double.parseDouble(allocation); {
System.out.println("crntPer :::::["+crntPer+"]"); System.out.println("Delete count is 0");
//Added by sarita on 06NOV2017 errCode = "VTBLNKDTL";
System.out.println("detailString value is =="+genericUtility.serializeDom(dom)); errList.add(errCode);
NodeList detailNoteList = dom2.getElementsByTagName("Detail3"); errFields.add(childNodeName.toLowerCase());
//updateFlag = getAttributeVal(childNode,"updateFlag"); }
//System.out.println("updateFlag is :::::::::::::::"+updateFlag); if(!"D".equalsIgnoreCase(updateFlag))//Added by sarita on 11JAN2018
//int detlCnt = detailNoteList.getLength(); {
int detlCnt = getNumOfNonDelDetail(dom2,3); if(allocation == null || allocation.trim().length()==0)
System.out.println("DETAIL COUNT" +detlCnt); {
totalPer = getNumOftotalallocPercentage( dom2 ,CurrentLineNo); System.out.println("inside alloc_perc LENGTH..");
System.out.println("TOTAL AMOUNT..." +totalPer); errCode = "VMEMPQLF03";
//Added by sarita on 06NOV2017 errList.add(errCode);
if(detlCnt != 0) errFields.add(childNodeName.toLowerCase());
{
if(totalPer > 100) }
{ else
System.out.println("AMOUNT..." +crntPer); {
errCode = "OVERALLINV"; System.out.println("inside alloc_perc ");
errList.add(errCode); crntPer = Double.parseDouble(allocation);
errFields.add(childNodeName.toLowerCase()); System.out.println("crntPer :::::["+crntPer+"]");
} //Added by sarita on 06NOV2017
else if(totalPer < 100) //System.out.println("detailString value is =="+genericUtility.serializeDom(dom));
{ NodeList detailNoteList = dom2.getElementsByTagName("Detail3");
System.out.println("AMOUNT..." +crntPer); //updateFlag = getAttributeVal(childNode,"updateFlag");
errCode = "VTRCONT2"; //System.out.println("updateFlag is :::::::::::::::"+updateFlag);
errList.add(errCode); //int detlCnt = detailNoteList.getLength();
errFields.add(childNodeName.toLowerCase()); int detlCnt = getNumOfNonDelDetail(dom2,3);
} System.out.println("DETAIL COUNT" +detlCnt);
} totalPer = getNumOftotalallocPercentage( dom2 ,CurrentLineNo);
System.out.println("TOTAL AMOUNT..." +totalPer);
/* if(detlCnt >=2) //Added by sarita on 06NOV2017
{ if(detlCnt != 0)
totalPer = getNumOftotalallocPercentage( dom2 ,CurrentLineNo); {
System.out.println("TOTAL AMOUNT..." +totalPer); if(totalPer > 100)
double remAmt = 100 - totalPer; // 5 {
if(crntPer > remAmt) // System.out.println("AMOUNT..." +crntPer);
{ errCode = "OVERALLINV";
System.out.println("EXCEED AMOUNT..." +remAmt); errList.add(errCode);
errCode = "OVERALLINV"; errFields.add(childNodeName.toLowerCase());
errList.add(errCode); }
errFields.add(childNodeName.toLowerCase()); else if(totalPer < 100)
{
} System.out.println("AMOUNT..." +crntPer);
} errCode = "VTRCONT2";
else errList.add(errCode);
{ errFields.add(childNodeName.toLowerCase());
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; return input == null ? "" : input;
} }
public String defaultDataWiz() throws RemoteException, ITMException 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; return "";
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);
}
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)
{
System.out.println(":::" + getClass().getSimpleName() + "::"+ e.getMessage());
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
{ {
...@@ -555,9 +521,7 @@ public String defaultDataWiz() throws RemoteException, ITMException ...@@ -555,9 +521,7 @@ public String defaultDataWiz() throws RemoteException, ITMException
System.out.println("errStringXml .........."+errStringXml); System.out.println("errStringXml .........."+errStringXml);
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)))
{ {
perAmt= pNode.getElementsByTagName("allocation").item(0).getFirstChild().getNodeValue(); //Added by sarita on 15JAN2018
lineNo= pNode.getElementsByTagName("line_no").item(0).getFirstChild().getNodeValue(); if(pNode.getElementsByTagName("allocation").item(0) != null && pNode.getElementsByTagName("allocation").item(0).getFirstChild() != null)
System.out.println("[If update flag is not D ]perAmt ::"+perAmt + "\t" + "lineNo ::"+lineNo +"update Flag ::"+updateFlag); {
perAmt= pNode.getElementsByTagName("allocation").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);
if(!lineNo.equalsIgnoreCase(CurrentLineNo.trim()))
{
num += Double.parseDouble(perAmt);
System.out.println("num is ==="+num);
}
}
} }
//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);
System.out.println("perAmt is ==="+perAmt);
}
}
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