Commit ab8bf690 authored by arawankar's avatar arawankar

WorkorderIssConf.java

-Changes made to show error message while stock is not maintained andtran_type is ("I","O","D","F").

git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@191242 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 962d45cb
......@@ -36,6 +36,13 @@ import java.sql.*;
import javax.ejb.Stateless;
//Modified by Anjali R. on [26/09/2018][Start]
import org.w3c.dom.CDATASection;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
//Modified by Anjali R. on [26/09/2018][End]
//import org.apache.poi.hssf.record.formula.functions.Stdev;
@Stateless
......@@ -87,6 +94,10 @@ public class WorkorderIssConf extends ActionHandlerEJB implements WorkorderIssCo
//GenericUtility genericUtility = null;
boolean flag =false;
boolean localConnection = false;
//Modified by Anjali R. on[26/09/2018][Start]
int noRows = 0;
String traceInfo = "";
//Modified by Anjali R. on[26/09/2018][End]
try
{
if ( conn == null )
......@@ -536,9 +547,23 @@ public class WorkorderIssConf extends ActionHandlerEJB implements WorkorderIssCo
pstmt.setTimestamp(1,effDate);
}
}
//Modified by Anjali R. on[26/09/2018][Start]
noRows = 0;
stkQty = 0.0;
stkRate = 0.0;
stkGrade = "";
suppCodeMfg = "";
acct_code__inv = "";
cctr_code__inv = "";
acct_code__oh = "";
cctr_code__oh = "";
grossRate = 0.0;
qtyPerArt = 0.0;
//Modified by Anjali R. on[26/09/2018][End]
rs = pstmt.executeQuery();
if (rs.next())
{
noRows++;//Modified by Anjali R. on[26/09/2018]
stkQty = rs.getDouble(1);
stkRate = rs.getDouble(2);
stkGrade = rs.getString(3);
......@@ -550,10 +575,22 @@ public class WorkorderIssConf extends ActionHandlerEJB implements WorkorderIssCo
grossRate = rs.getDouble(9);
qtyPerArt = rs.getDouble(10);
}
rs.close();
rs = null;
pstmt.close();
pstmt = null ;
//Modified by Anjali R. on[26/09/2018][Error message to be shown if stock not available][Start]
if(("I".equalsIgnoreCase(tranType) || "O".equalsIgnoreCase(tranType) || "D".equalsIgnoreCase(tranType) || "F".equalsIgnoreCase(tranType))
&& noRows == 0)
{
errString = itmDBAccessEJB.getErrorString("","VTWOIN01","","",conn);
traceInfo = "Error occure at line number ["+lineNo+"] for table ["+detTable+"] transaction id for reference ["+tranID+"].";
errString = setTraceInfo(errString, traceInfo);
return errString;
}
//Modified by Anjali R. on[26/09/2018][Error message to be shown if stock not available][End]
// if any of the weight or no_art is zero get from stock as per old logic
sql =" select a.no_art, a.gross_weight,a.tare_weight,a.net_weight "
+" from stock a where a.item_code ='"+itemCode+"' "
......@@ -1888,4 +1925,47 @@ public class WorkorderIssConf extends ActionHandlerEJB implements WorkorderIssCo
}
return tranId;
}//generateTranTd()
//Modified by Anjali R. on [26/09/2018][Added method to add trace info in error message][Start]
public String setTraceInfo(String errorMessage,String traceInfo)throws ITMException
{
E12GenericUtility genericUtility = null;
Document dom = null;
String errorStringChanged = "";
try
{
genericUtility = new E12GenericUtility();
dom = genericUtility.parseString(errorMessage);
setNodeValue(dom,"trace",traceInfo);
errorStringChanged = genericUtility.serializeDom(dom);
System.out.println("errorStringChanged---["+errorStringChanged+"]");
}
catch(Exception e)
{
System.out.println("Exception in setTraceInfo---["+ e.getMessage()+"]");
e.printStackTrace();
throw new ITMException(e);
}
return errorStringChanged;
}
//Modified by Anjali R. on [26/09/2018][Added method to add trace info in error message][End]
//Modified by Anjali R. on [26/09/2018][Added method to set node value in dom][Start]
private void setNodeValue(Document dom, String nodeName,String nodeVal) throws Exception
{
Node tempNode = dom.getElementsByTagName(nodeName).item(0);
if (tempNode != null)
{
if (tempNode.getFirstChild() == null)
{
CDATASection cDataSection = dom.createCDATASection(nodeVal);
tempNode.appendChild(cDataSection);
}
else
{
tempNode.getFirstChild().setNodeValue(nodeVal);
}
}
tempNode = null;
}
//Modified by Anjali R. on [26/09/2018][Added method to set node value in dom][End]
}
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