Commit ba886c8d authored by cpatil's avatar cpatil

added condition for null pointer exception


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@95275 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 06e26fb4
...@@ -26,19 +26,19 @@ import ibase.webitm.utility.TransIDGenerator; ...@@ -26,19 +26,19 @@ import ibase.webitm.utility.TransIDGenerator;
public class MrpWizPrsSaveBean public class MrpWizPrsSaveBean
{ {
public String preSaveForm(String xmlString1 , String chgUser , String chgTerm )throws ITMException public String preSaveForm(String xmlString1 , String chgUser , String chgTerm )throws ITMException
{ {
Document dom = null; Document dom = null;
System.out.println("@@@@@@@@@---------MrpWizPrsSaveBean EJB called..."); System.out.println("@@@@@@@@@---------MrpWizPrsSaveBean EJB called...");
try try
{ {
System.out.println("@@@@@@@xmlString1["+xmlString1+"]@@@@@@@"); System.out.println("@@@@@@@xmlString1["+xmlString1+"]@@@@@@@");
System.out.println("@@@@@@ in bean chgUser["+chgUser+"]::chgTerm["+chgTerm+"]"); System.out.println("@@@@@@ in bean chgUser["+chgUser+"]::chgTerm["+chgTerm+"]");
if (xmlString1 != null && xmlString1.trim().length() > 0) if (xmlString1 != null && xmlString1.trim().length() > 0)
{ {
dom = GenericUtility.getInstance().parseString(xmlString1); dom = GenericUtility.getInstance().parseString(xmlString1);
...@@ -64,7 +64,7 @@ public class MrpWizPrsSaveBean ...@@ -64,7 +64,7 @@ public class MrpWizPrsSaveBean
NodeList hdrDom = null; NodeList hdrDom = null;
//Node currDetail = null; //Node currDetail = null;
String saleOrder="",lineNo="", siteCode="", lotNo="", locCode="", lotSl="", tranSer="", runningSupplyStr="", qtyReqdStr="",allocQtyStr=""; String saleOrder=" ",lineNo=" ", siteCode=" ", lotNo=" ", locCode="", lotSl=" ", tranSer="", runningSupplyStr="", qtyReqdStr="",allocQtyStr="";
double runningSupply=0,qtyReqd=0; double runningSupply=0,qtyReqd=0;
String tranId="",refId="",refLineNo="",unit="",errString=""; String tranId="",refId="",refLineNo="",unit="",errString="";
double quantity=0,qtyAllocated=0,totAllocQty=0,allocQty=0; double quantity=0,qtyAllocated=0,totAllocQty=0,allocQty=0;
...@@ -72,16 +72,16 @@ public class MrpWizPrsSaveBean ...@@ -72,16 +72,16 @@ public class MrpWizPrsSaveBean
Connection conn = null; Connection conn = null;
ConnDriver connDriver = new ConnDriver(); ConnDriver connDriver = new ConnDriver();
String supplyStr="",availableSupplyStr=""; String supplyStr="",availableSupplyStr="";
InvAllocTrace invallocTrace = new InvAllocTrace(); InvAllocTrace invallocTrace = new InvAllocTrace();
StockAllocationPrc stockAllocationPrc = new StockAllocationPrc() ; StockAllocationPrc stockAllocationPrc = new StockAllocationPrc() ;
//String chgUser =" " , chgTerm = " "; //String chgUser =" " , chgTerm = " ";
try try
{ {
conn = connDriver.getConnectDB("DriverITM"); conn = connDriver.getConnectDB("DriverITM");
NodeList hdrDommList = dom.getElementsByTagName("Detail4"); NodeList hdrDommList = dom.getElementsByTagName("Detail4");
System.out.println("len===["+hdrDommList.getLength()+"]"); System.out.println("len===["+hdrDommList.getLength()+"]");
...@@ -100,64 +100,66 @@ public class MrpWizPrsSaveBean ...@@ -100,64 +100,66 @@ public class MrpWizPrsSaveBean
NodeList detail4NodeList = detail4Node.getChildNodes(); NodeList detail4NodeList = detail4Node.getChildNodes();
System.out.println("@@@@@@@@@refrenceNode ["+detail4NodeList.getLength()+"]node name[" + detail4Node.getNodeName()+"]"); System.out.println("@@@@@@@@@refrenceNode ["+detail4NodeList.getLength()+"]node name[" + detail4Node.getNodeName()+"]");
if("sale_order".equalsIgnoreCase( detail4Node.getNodeName())) if( detail4Node != null && detail4Node.getNodeValue() != null )
{
saleOrder = detail4List.item(cntr).getFirstChild().getNodeValue();
}
if("line_no".equalsIgnoreCase( detail4Node.getNodeName()))
{
lineNo = detail4List.item(cntr).getFirstChild().getNodeValue();
}
if("site_code".equalsIgnoreCase( detail4Node.getNodeName()))
{
siteCode = detail4List.item(cntr).getFirstChild().getNodeValue();
}
if("item_code".equalsIgnoreCase( detail4Node.getNodeName()))
{
itemCode = detail4List.item(cntr).getFirstChild().getNodeValue();
}
if("lot_no".equalsIgnoreCase( detail4Node.getNodeName()))
{
lotNo = detail4List.item(cntr).getFirstChild().getNodeValue();
}
if("lot_sl".equalsIgnoreCase( detail4Node.getNodeName()))
{
lotSl = detail4List.item(cntr).getFirstChild().getNodeValue();
}
if("loc_code".equalsIgnoreCase( detail4Node.getNodeName()))
{
locCode = detail4List.item(cntr).getFirstChild().getNodeValue();
}
if("tran_ser".equalsIgnoreCase( detail4Node.getNodeName()))
{
tranSer = detail4List.item(cntr).getFirstChild().getNodeValue();
}
if("running_supply".equalsIgnoreCase( detail4Node.getNodeName()))
{
runningSupplyStr = detail4List.item(cntr).getFirstChild().getNodeValue();
}
if("qty_reqd".equalsIgnoreCase( detail4Node.getNodeName()))
{ {
qtyReqdStr = detail4List.item(cntr).getFirstChild().getNodeValue(); if("sale_order".equalsIgnoreCase( detail4Node.getNodeName()))
{
saleOrder = detail4List.item(cntr).getFirstChild().getNodeValue();
}
if("line_no".equalsIgnoreCase( detail4Node.getNodeName()))
{
lineNo = detail4List.item(cntr).getFirstChild().getNodeValue();
}
if("site_code".equalsIgnoreCase( detail4Node.getNodeName()))
{
siteCode = detail4List.item(cntr).getFirstChild().getNodeValue();
}
if("item_code".equalsIgnoreCase( detail4Node.getNodeName()))
{
itemCode = detail4List.item(cntr).getFirstChild().getNodeValue();
}
if("lot_no".equalsIgnoreCase( detail4Node.getNodeName()))
{
lotNo = detail4List.item(cntr).getFirstChild().getNodeValue();
}
if("lot_sl".equalsIgnoreCase( detail4Node.getNodeName()))
{
lotSl = detail4List.item(cntr).getFirstChild().getNodeValue();
}
if("loc_code".equalsIgnoreCase( detail4Node.getNodeName()))
{
locCode = detail4List.item(cntr).getFirstChild().getNodeValue();
}
if("tran_ser".equalsIgnoreCase( detail4Node.getNodeName()))
{
tranSer = detail4List.item(cntr).getFirstChild().getNodeValue();
}
if("running_supply".equalsIgnoreCase( detail4Node.getNodeName()))
{
runningSupplyStr = detail4List.item(cntr).getFirstChild().getNodeValue();
}
if("qty_reqd".equalsIgnoreCase( detail4Node.getNodeName()))
{
qtyReqdStr = detail4List.item(cntr).getFirstChild().getNodeValue();
}
if("alloc_qty".equalsIgnoreCase( detail4Node.getNodeName()))
{
allocQtyStr = detail4List.item(cntr).getFirstChild().getNodeValue();
}
if("supply".equalsIgnoreCase( detail4Node.getNodeName()))
{
supplyStr = detail4List.item(cntr).getFirstChild().getNodeValue();
}
if("available_supply".equalsIgnoreCase( detail4Node.getNodeName()))
{
availableSupplyStr = detail4List.item(cntr).getFirstChild().getNodeValue();
}
} }
if("alloc_qty".equalsIgnoreCase( detail4Node.getNodeName()))
{
allocQtyStr = detail4List.item(cntr).getFirstChild().getNodeValue();
}
if("supply".equalsIgnoreCase( detail4Node.getNodeName()))
{
supplyStr = detail4List.item(cntr).getFirstChild().getNodeValue();
}
if("available_supply".equalsIgnoreCase( detail4Node.getNodeName()))
{
availableSupplyStr = detail4List.item(cntr).getFirstChild().getNodeValue();
}
} }
} }
System.out.println("@@@@ctr["+dtlCtr+"]saleOrder["+saleOrder+"]-lineNo["+lineNo+"]-qtyReqd["+qtyReqdStr+"]@@@"); System.out.println("@@@@ctr["+dtlCtr+"]saleOrder["+saleOrder+"]-lineNo["+lineNo+"]-qtyReqd["+qtyReqdStr+"]@@@");
System.out.println("@@@@ctr["+dtlCtr+"]siteCode["+siteCode+"]-itemCode["+itemCode+"]-lotNo["+lotNo+"]-lotSl["+lotSl+"]-locCode["+locCode+"]-tranSer["+tranSer+"]allocQtyStr["+allocQtyStr+"]@@@"); System.out.println("@@@@ctr["+dtlCtr+"]siteCode["+siteCode+"]-itemCode["+itemCode+"]-lotNo["+lotNo+"]-lotSl["+lotSl+"]-locCode["+locCode+"]-tranSer["+tranSer+"]allocQtyStr["+allocQtyStr+"]@@@");
if( runningSupplyStr.trim().length() > 0) if( runningSupplyStr.trim().length() > 0)
{ {
runningSupply = runningSupplyStr==null?0:Double.parseDouble(runningSupplyStr); runningSupply = runningSupplyStr==null?0:Double.parseDouble(runningSupplyStr);
...@@ -171,13 +173,13 @@ public class MrpWizPrsSaveBean ...@@ -171,13 +173,13 @@ public class MrpWizPrsSaveBean
{ {
allocQty = allocQtyStr==null?0:Double.parseDouble(allocQtyStr); allocQty = allocQtyStr==null?0:Double.parseDouble(allocQtyStr);
} }
java.util.Date currentDate = new java.util.Date(); java.util.Date currentDate = new java.util.Date();
// SimpleDateFormat sdf = new SimpleDateFormat(genericUtility.getDBDateFormat()); // SimpleDateFormat sdf = new SimpleDateFormat(genericUtility.getDBDateFormat());
// Timestamp newsysDate = java.sql.Timestamp.valueOf( sdf.format(currentDate)+" 00:00:00.0"); // Timestamp newsysDate = java.sql.Timestamp.valueOf( sdf.format(currentDate)+" 00:00:00.0");
// System.out.println("Now the date is :=> ["+newsysDate+"]"); // System.out.println("Now the date is :=> ["+newsysDate+"]");
java.sql.Date date = new java.sql.Date(currentDate.getTime()); java.sql.Date date = new java.sql.Date(currentDate.getTime());
invallocTrace.setRefSer("MRPWIZ"); invallocTrace.setRefSer("MRPWIZ");
invallocTrace.setRefId(saleOrder); invallocTrace.setRefId(saleOrder);
invallocTrace.setRefLine(lineNo); invallocTrace.setRefLine(lineNo);
...@@ -191,16 +193,16 @@ public class MrpWizPrsSaveBean ...@@ -191,16 +193,16 @@ public class MrpWizPrsSaveBean
invallocTrace.setChgTerm(chgTerm); invallocTrace.setChgTerm(chgTerm);
invallocTrace.setChgDate( date ); invallocTrace.setChgDate( date );
//invallocTrace.setChgWin("W_SORDALLOC" ); //invallocTrace.setChgWin("W_SORDALLOC" );
errString = stockAllocationPrc.updateInvallocTrace(invallocTrace, conn); errString = stockAllocationPrc.updateInvallocTrace(invallocTrace, conn);
if (errString != null && errString.trim().length() > 0) if (errString != null && errString.trim().length() > 0)
{ {
System.out.println("@@@@@@rolledback errString :::"+ errString ); System.out.println("@@@@@@rolledback errString :::"+ errString );
conn.rollback(); conn.rollback();
return errString; return errString;
} }
}//end if }//end if
}//try end }//try end
...@@ -220,14 +222,14 @@ public class MrpWizPrsSaveBean ...@@ -220,14 +222,14 @@ public class MrpWizPrsSaveBean
{ {
try try
{ {
if (errString == null || errString.trim().length() == 0) if (errString == null || errString.trim().length() == 0)
{ {
System.out.println("@@@@@@commit errString :::"+ errString ); System.out.println("@@@@@@commit errString :::"+ errString );
conn.commit(); conn.commit();
//return errString; //return errString;
} }
if (pstmt!= null) if (pstmt!= null)
{ {
pstmt = null; pstmt = null;
...@@ -248,7 +250,7 @@ public class MrpWizPrsSaveBean ...@@ -248,7 +250,7 @@ public class MrpWizPrsSaveBean
return ""; return "";
} }
/* /*
private String generateTranId( String windowName, String siteCode, Connection conn )throws ITMException private String generateTranId( String windowName, String siteCode, Connection conn )throws ITMException
{ {
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
...@@ -330,9 +332,9 @@ public class MrpWizPrsSaveBean ...@@ -330,9 +332,9 @@ public class MrpWizPrsSaveBean
return tranId; return tranId;
}//generateTranTd() }//generateTranTd()
*/ */
/* /*
private String updateInvallocTrace(InvAllocTrace invallocTrace, Connection conn) throws ITMException private String updateInvallocTrace(InvAllocTrace invallocTrace, Connection conn) throws ITMException
{ {
...@@ -362,7 +364,7 @@ public class MrpWizPrsSaveBean ...@@ -362,7 +364,7 @@ public class MrpWizPrsSaveBean
String tranId = null; String tranId = null;
GenericUtility genericUtility = GenericUtility.getInstance(); GenericUtility genericUtility = GenericUtility.getInstance();
ITMDBAccessEJB itmDBAccessEJB = new ITMDBAccessEJB(); ITMDBAccessEJB itmDBAccessEJB = new ITMDBAccessEJB();
try try
{ {
keyStringQuery = "SELECT KEY_STRING, TRAN_ID_COL, REF_SER FROM TRANSETUP WHERE UPPER(TRAN_WINDOW) = 'T_ALLOCTRACE'"; keyStringQuery = "SELECT KEY_STRING, TRAN_ID_COL, REF_SER FROM TRANSETUP WHERE UPPER(TRAN_WINDOW) = 'T_ALLOCTRACE'";
...@@ -527,14 +529,14 @@ public class MrpWizPrsSaveBean ...@@ -527,14 +529,14 @@ public class MrpWizPrsSaveBean
} }
} }
*/ */
} }
\ No newline at end of file
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