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
String retString = "";
try
{
System.out.println("*************** Inside wfValData *******************");
System.out.println("*************** Inside wfValData *******************");
if(xmlString != null && xmlString.trim().length()>0)
{
dom = genericUtility.parseString(xmlString);
......@@ -90,7 +90,7 @@ public class CostCtrAllocIC extends ValidatorEJB implements CostCtrAllocICRemote
NodeList childNodeList = null;
Node childNode = null;
int childNodeLength = 0;
int ctr = 0, cnt = 0;
int cnt = 0;
String childNodeName = "",siteCode="",prdCode="";
//Added by sarita on 4JAN2018
Timestamp prdCodeCurrent=null , currDate = null;
......@@ -114,7 +114,7 @@ public class CostCtrAllocIC extends ValidatorEJB implements CostCtrAllocICRemote
childNodeList = parentNode.getChildNodes();
childNodeLength = childNodeList.getLength();
for(ctr = 0; ctr < childNodeLength; ctr++)
for(int ctr = 0; ctr < childNodeLength; ctr++)
{
childNode = childNodeList.item(ctr);
childNodeName = childNode.getNodeName();
......@@ -285,7 +285,7 @@ public class CostCtrAllocIC extends ValidatorEJB implements CostCtrAllocICRemote
parentNode = parentNodeList.item(0);
childNodeList = parentNode.getChildNodes();
childNodeLength = childNodeList.getLength();
for(ctr = 0; ctr < childNodeLength; ctr++)
for(int ctr = 0; ctr < childNodeLength; ctr++)
{
childNode = childNodeList.item(ctr);
childNodeName = childNode.getNodeName();
......@@ -297,99 +297,96 @@ public class CostCtrAllocIC extends ValidatorEJB implements CostCtrAllocICRemote
case 3:
{
System.out.println("Inside Case3 Validation:::");
parentNodeList = dom.getElementsByTagName("Detail3");
parentNode = parentNodeList.item(0);
childNodeList = parentNode.getChildNodes();
childNodeLength = childNodeList.getLength();
for(ctr = 0; ctr < childNodeLength; ctr++)
parentNodeList = dom2.getElementsByTagName("Detail3");
System.out.println("////////"+parentNodeList.getLength());
//Added by sarita on 15JAN2018
for(int dCnter = 0; dCnter < parentNodeList.getLength(); dCnter++)
{
childNode = childNodeList.item(ctr);
childNodeName = childNode.getNodeName();
System.out.println("childNodeName::: for Case3"+childNodeName +"updateFlag :::"+updateFlag);
if("allocation".equalsIgnoreCase(childNodeName))
{
allocation = checkNull(genericUtility.getColumnValue("allocation",dom)).trim();
CurrentLineNo= checkNull(genericUtility.getColumnValue("line_no",dom)).trim();
System.out.println("Allocation Percentage Value is :::::["+allocation+"]" + "\t"+ "CurrentLineNo is :::"+CurrentLineNo);
int detlCnt1 = getNumOfNonDelDetail(dom2,3);
System.out.println("DETAIL COUNT" +detlCnt1);
//if(!("D".equalsIgnoreCase(updateFlag)) && allocation.trim().length()==0 || allocation == null)
//Added by sarita on 12JAN2018
if(detlCnt1 == 0)
{
System.out.println("Delete count is 0");
errCode = "VTBLNKDTL";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
else if(allocation.trim().length()==0 || allocation == null)//Added by sarita on 11JAN2018
{
System.out.println("inside alloc_perc LENGTH..");
errCode = "VMEMPQLF03";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
else
{
System.out.println("inside alloc_perc ");
crntPer = Double.parseDouble(allocation);
System.out.println("crntPer :::::["+crntPer+"]");
//Added by sarita on 06NOV2017
System.out.println("detailString value is =="+genericUtility.serializeDom(dom));
NodeList detailNoteList = dom2.getElementsByTagName("Detail3");
//updateFlag = getAttributeVal(childNode,"updateFlag");
//System.out.println("updateFlag is :::::::::::::::"+updateFlag);
//int detlCnt = detailNoteList.getLength();
int detlCnt = getNumOfNonDelDetail(dom2,3);
System.out.println("DETAIL COUNT" +detlCnt);
totalPer = getNumOftotalallocPercentage( dom2 ,CurrentLineNo);
System.out.println("TOTAL AMOUNT..." +totalPer);
//Added by sarita on 06NOV2017
if(detlCnt != 0)
{
if(totalPer > 100)
{
System.out.println("AMOUNT..." +crntPer);
errCode = "OVERALLINV";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
else if(totalPer < 100)
{
System.out.println("AMOUNT..." +crntPer);
errCode = "VTRCONT2";
errList.add(errCode);
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
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();
childNodeLength = childNodeList.getLength();
System.out.println("*****"+childNodeLength);
for(int ctr = 0; ctr < childNodeLength; ctr++)
{
childNode = childNodeList.item(ctr);
childNodeName = childNode.getNodeName();
System.out.println("ctr ["+ctr+"]" +"\t"+"childNode ["+childNode+"]" + "\t" + "childNodeName["+childNodeName+"]");
//updateFlag = getUpdateFlag(dom2,3);
if("allocation".equalsIgnoreCase(childNodeName))
{
updateFlag = getAttributeVal(parentNode,"updateFlag");
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);
int detlCnt1 = getNumOfNonDelDetail(dom2,3);
System.out.println("DETAIL COUNT" +detlCnt1);
//if(!("D".equalsIgnoreCase(updateFlag)) && allocation.trim().length()==0 || allocation == null)
//Added by sarita on 12JAN2018
if(detlCnt1 == 0)
{
System.out.println("Delete count is 0");
errCode = "VTBLNKDTL";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
if(!"D".equalsIgnoreCase(updateFlag))//Added by sarita on 11JAN2018
{
if(allocation == null || allocation.trim().length()==0)
{
System.out.println("inside alloc_perc LENGTH..");
errCode = "VMEMPQLF03";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
else
{
System.out.println("inside alloc_perc ");
crntPer = Double.parseDouble(allocation);
System.out.println("crntPer :::::["+crntPer+"]");
//Added by sarita on 06NOV2017
//System.out.println("detailString value is =="+genericUtility.serializeDom(dom));
NodeList detailNoteList = dom2.getElementsByTagName("Detail3");
//updateFlag = getAttributeVal(childNode,"updateFlag");
//System.out.println("updateFlag is :::::::::::::::"+updateFlag);
//int detlCnt = detailNoteList.getLength();
int detlCnt = getNumOfNonDelDetail(dom2,3);
System.out.println("DETAIL COUNT" +detlCnt);
totalPer = getNumOftotalallocPercentage( dom2 ,CurrentLineNo);
System.out.println("TOTAL AMOUNT..." +totalPer);
//Added by sarita on 06NOV2017
if(detlCnt != 0)
{
if(totalPer > 100)
{
System.out.println("AMOUNT..." +crntPer);
errCode = "OVERALLINV";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
else if(totalPer < 100)
{
System.out.println("AMOUNT..." +crntPer);
errCode = "VTRCONT2";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}
}
}
}
}//end of for loop
}
}//end of case3
break;
}//end of switch statement
......@@ -435,6 +432,8 @@ public class CostCtrAllocIC extends ValidatorEJB implements CostCtrAllocICRemote
{
System.out.println("Exception ::"+e);
e.printStackTrace();
//Added by sarita on 15JAN2018
errStringXml.append("</Errors> </Root> \r\n");
}
finally
{
......@@ -467,49 +466,16 @@ public class CostCtrAllocIC extends ValidatorEJB implements CostCtrAllocICRemote
return errString;
}// end of wfvalData method
private String checkNull(String input)
{
return input == null ? "" : 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
public String defaultDataWiz() 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);
}
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;
}*/
return "";
}
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
System.out.println("errStringXml .........."+errStringXml);
errString1 = "";
}
errStringXml.append("</Errors></Root>\r\n");
errStringXml.append("</Errors></Root>\r\n");
}
return errString;
}
......@@ -1795,32 +1759,30 @@ public String defaultDataWiz() throws RemoteException, ITMException
try
{
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());
for(int cnt = 0;cnt<detailNoteList.getLength();cnt++)
{
Element pNode=(Element) detailNoteList.item(cnt);
System.out.println("Inside 1");
updateFlag = getAttributeVal(pNode,"updateFlag");
System.out.println("COUNT VALUE IS ["+cnt+"]" + "Current Line Number is ::: ["+CurrentLineNo+"]");
updateFlag = getAttributeVal(pNode,"updateFlag"); System.out.println("update flag in getNumOftotalallocPercentage ["+updateFlag+"]");
//Added by sarita on 11JAN2018
if(!("D".equalsIgnoreCase(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);
//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();
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)
{
......@@ -1943,6 +1905,36 @@ public String defaultDataWiz() throws RemoteException, ITMException
}
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
......
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