Commit cd59b43c authored by manohar's avatar manohar

For allocation and deallocation proper component used, throwing exception in...

For allocation and deallocation proper component used, throwing exception in all the methods added also the win_name dynamically picked from dom and set


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@97488 ce508802-f39f-4f6c-b175-0d175dae99d5
parent fb1cdfbd
......@@ -50,7 +50,7 @@ public class SReturnPos extends ValidatorEJB implements SReturnPosLocal, SReturn
if (xmlString1 != null && xmlString1.trim().length() > 0)
{
dom = GenericUtility.getInstance().parseString(xmlString1);
executepostSaveRec(dom,domId,objContext,editFlag,xtraParams,conn);
return (executepostSaveRec(dom,domId,objContext,editFlag,xtraParams,conn));
}
}
catch(Exception e)
......@@ -64,7 +64,7 @@ public class SReturnPos extends ValidatorEJB implements SReturnPosLocal, SReturn
private String executepostSaveRec(Document dom, String domID, String ObjContext, String editFlag, String xtraParams, Connection conn) throws RemoteException, ITMException
{
String siteCode = "", itemCode = "", lineNo = "",locCode = "", lotNo = "", lotSl = "";
String tranId = "", updateStatus = "", qtyStr = "";
String tranId = "", updateStatus = "", qtyStr = "", errString = "", winName = "";
String sqlStr = "", retFlg = "";
double quantity = 0d;
java.util.Date tranDate = null;
......@@ -74,6 +74,10 @@ public class SReturnPos extends ValidatorEJB implements SReturnPosLocal, SReturn
//Statement stmt = null;
//ResultSet rs = null;
HashMap strAllocate = new HashMap();
InvAllocTraceBean invAllocTrace = new InvAllocTraceBean();
NodeList parentNodeList = null;
Node parentNode = null;
try
{
distStkUpd = getComponent("DistStkUpd");
......@@ -86,6 +90,10 @@ public class SReturnPos extends ValidatorEJB implements SReturnPosLocal, SReturn
System.out.println("\n siteCode :"+siteCode);
currDetail = getCurrentDetailFromDom(dom,domID);
updateStatus = getCurrentUpdateFlag(currDetail);
// 03/03/15 manoharan
parentNodeList = dom.getElementsByTagName("Detail1");
parentNode = parentNodeList.item( 0 );
winName = getWinName(parentNode);
if (currDetail != null && !updateStatus.equalsIgnoreCase("D"))
{
......@@ -107,7 +115,7 @@ public class SReturnPos extends ValidatorEJB implements SReturnPosLocal, SReturn
quantity = Double.parseDouble(qtyStr);
lineNo =" " + lineNo;
strAllocate.put("tran_date",tranDate);
/*strAllocate.put("tran_date",tranDate);
strAllocate.put("ref_ser","S-RET");
strAllocate.put("ref_id",tranId);
strAllocate.put("ref_line",lineNo.substring(lineNo.length()-3));
......@@ -125,6 +133,38 @@ public class SReturnPos extends ValidatorEJB implements SReturnPosLocal, SReturn
{
System.out.println("distStkUpd.UpdAllocTrace(HashMap, Connection) : Sucessuful!");
}
else
{
throw new Exception ("Exception while deallocating old allocation");
}
*/
strAllocate = null;
strAllocate = new HashMap();
strAllocate.put("tran_date",tranDate);
strAllocate.put("ref_ser","S-RET");
strAllocate.put("ref_id",tranId);
strAllocate.put("ref_line",lineNo.substring(lineNo.length()-3));
strAllocate.put("site_code",siteCode);
strAllocate.put("item_code",itemCode);
strAllocate.put("loc_code",locCode);
strAllocate.put("lot_no",lotNo);
strAllocate.put("lot_sl",lotSl);
strAllocate.put("alloc_qty",new Double(quantity));
strAllocate.put("chg_user",GenericUtility.getInstance().getValueFromXTRA_PARAMS(xtraParams,"loginCode"));
strAllocate.put("chg_term",GenericUtility.getInstance().getValueFromXTRA_PARAMS(xtraParams,"termId"));
strAllocate.put("chg_win",winName);
errString = invAllocTrace.updateInvallocTrace(strAllocate, conn);
if (errString == null || errString.trim().length() == 0 )
{
System.out.println("invAllocTrace.updateInvallocTrace : Sucessuful!");
}
else
{
throw new Exception ("Exception while allocating stock ");
}
}
}
}
......@@ -157,7 +197,7 @@ public class SReturnPos extends ValidatorEJB implements SReturnPosLocal, SReturn
throw new ITMException(e);
}
}*/
return "";
return errString;
}
private Node getCurrentDetailFromDom(Document dom,String domId)
{
......@@ -239,4 +279,17 @@ public class SReturnPos extends ValidatorEJB implements SReturnPosLocal, SReturn
}
return comp;
}
private String getWinName(Node node) throws Exception
{
String objName = null;
NodeList nodeList = null;
Node detaulNode = null;
Node detailNode = null;
nodeList = node.getChildNodes();
NamedNodeMap attrMap = node.getAttributes();
objName = attrMap.getNamedItem( "objName" ).getNodeValue();
return "w_" + objName;
}
}
......@@ -50,7 +50,7 @@ public class SReturnPrs extends ValidatorEJB implements SReturnPrsLocal, SReturn
if (xmlString1 != null && xmlString1.trim().length() > 0)
{
dom = GenericUtility.getInstance().parseString(xmlString1);
executepreSaveRec(dom,domId,objContext,editFlag,xtraParams,conn);
return (executepreSaveRec(dom,domId,objContext,editFlag,xtraParams,conn));
}
}
catch(Exception e)
......@@ -64,7 +64,7 @@ public class SReturnPrs extends ValidatorEJB implements SReturnPrsLocal, SReturn
private String executepreSaveRec(Document dom, String domID, String ObjContext, String editFlag, String xtraParams, Connection conn) throws RemoteException, ITMException
{
String siteCode = "", itemCode = "", lineNo = "",locCode = "", lotNo = "", lotSl = "";
String tranId = "", updateStatus = "", qtyStr = "";
String tranId = "", updateStatus = "", qtyStr = "",errString = "", winName = "";
String sqlStr = "", retFlg = "";
double quantity = 0d;
java.util.Date tranDate = null;
......@@ -74,6 +74,9 @@ public class SReturnPrs extends ValidatorEJB implements SReturnPrsLocal, SReturn
Statement stmt = null;
ResultSet rs = null;
HashMap strAllocate = new HashMap();
InvAllocTraceBean invAllocTrace = new InvAllocTraceBean();
NodeList parentNodeList = null;
Node parentNode = null;
try
{
distStkUpd = getComponent("DistStkUpd");
......@@ -86,6 +89,11 @@ public class SReturnPrs extends ValidatorEJB implements SReturnPrsLocal, SReturn
System.out.println("\n siteCode :"+siteCode);
currDetail = getCurrentDetailFromDom(dom,domID);
updateStatus = getCurrentUpdateFlag(currDetail);
// 03/03/15 manoharan
parentNodeList = dom.getElementsByTagName("Detail1");
parentNode = parentNodeList.item( 0 );
winName = getWinName(parentNode);
// end 03/03/15 manoharan
if (currDetail != null && !updateStatus.equalsIgnoreCase("A"))
{
......@@ -126,6 +134,7 @@ public class SReturnPrs extends ValidatorEJB implements SReturnPrsLocal, SReturn
lineNo =" " + lineNo;
System.out.println("Line No : lineNo := "+lineNo);
quantity = Double.parseDouble(qtyStr);
/*
strAllocate.put("tran_date",tranDate);
strAllocate.put("ref_ser","S-RET");
strAllocate.put("ref_id",tranId);
......@@ -144,6 +153,37 @@ public class SReturnPrs extends ValidatorEJB implements SReturnPrsLocal, SReturn
{
System.out.println("distStkUpd.UpdAllocTrace(HashMap, Connection) : Sucessuful!");
}
else
{
throw new Exception ("Exception while deallocating old allocation");
}
*/
strAllocate = null;
strAllocate = new HashMap();
strAllocate.put("tran_date",tranDate);
strAllocate.put("ref_ser","S-RET");
strAllocate.put("ref_id",tranId);
strAllocate.put("ref_line",lineNo.substring(lineNo.length()-3));
strAllocate.put("site_code",siteCode);
strAllocate.put("item_code",itemCode);
strAllocate.put("loc_code",locCode);
strAllocate.put("lot_no",lotNo);
strAllocate.put("lot_sl",lotSl);
strAllocate.put("alloc_qty",new Double(-1*quantity));
strAllocate.put("chg_user",GenericUtility.getInstance().getValueFromXTRA_PARAMS(xtraParams,"loginCode"));
strAllocate.put("chg_term",GenericUtility.getInstance().getValueFromXTRA_PARAMS(xtraParams,"termId"));
strAllocate.put("chg_win",winName);
errString = invAllocTrace.updateInvallocTrace(strAllocate, conn);
if (errString == null || errString.trim().length() == 0 )
{
System.out.println("invAllocTrace.updateInvallocTrace : Sucessuful!");
}
else
{
throw new Exception ("Exception while deallocating old allocation");
}
}
}
}
......@@ -169,14 +209,14 @@ public class SReturnPrs extends ValidatorEJB implements SReturnPrsLocal, SReturn
stmt = null;
}
}
catch(Exception e)
catch(Exception ef)
{
System.err.println("Exception :SReturnPrsEJB :\n"+e.getMessage());
e.printStackTrace();
throw new ITMException(e);
//System.err.println("Exception :SReturnPrsEJB :\n"+ef.getMessage());
//ef.printStackTrace();
//throw new ITMException(ef);
}
}
return "";
return errString;
}
private Node getCurrentDetailFromDom(Document dom,String domId)
{
......@@ -258,4 +298,16 @@ public class SReturnPrs extends ValidatorEJB implements SReturnPrsLocal, SReturn
}
return comp;
}
private String getWinName(Node node) throws Exception
{
String objName = null;
NodeList nodeList = null;
Node detaulNode = null;
Node detailNode = null;
nodeList = node.getChildNodes();
NamedNodeMap attrMap = node.getAttributes();
objName = attrMap.getNamedItem( "objName" ).getNodeValue();
return "w_" + objName;
}
}
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