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;
public class MrpWizPrsSaveBean
{
public String preSaveForm(String xmlString1 , String chgUser , String chgTerm )throws ITMException
{
Document dom = null;
System.out.println("@@@@@@@@@---------MrpWizPrsSaveBean EJB called...");
try
{
System.out.println("@@@@@@@xmlString1["+xmlString1+"]@@@@@@@");
System.out.println("@@@@@@ in bean chgUser["+chgUser+"]::chgTerm["+chgTerm+"]");
if (xmlString1 != null && xmlString1.trim().length() > 0)
{
dom = GenericUtility.getInstance().parseString(xmlString1);
......@@ -64,7 +64,7 @@ public class MrpWizPrsSaveBean
NodeList hdrDom = 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;
String tranId="",refId="",refLineNo="",unit="",errString="";
double quantity=0,qtyAllocated=0,totAllocQty=0,allocQty=0;
......@@ -72,16 +72,16 @@ public class MrpWizPrsSaveBean
Connection conn = null;
ConnDriver connDriver = new ConnDriver();
String supplyStr="",availableSupplyStr="";
InvAllocTrace invallocTrace = new InvAllocTrace();
StockAllocationPrc stockAllocationPrc = new StockAllocationPrc() ;
//String chgUser =" " , chgTerm = " ";
try
{
conn = connDriver.getConnectDB("DriverITM");
NodeList hdrDommList = dom.getElementsByTagName("Detail4");
System.out.println("len===["+hdrDommList.getLength()+"]");
......@@ -100,64 +100,66 @@ public class MrpWizPrsSaveBean
NodeList detail4NodeList = detail4Node.getChildNodes();
System.out.println("@@@@@@@@@refrenceNode ["+detail4NodeList.getLength()+"]node name[" + detail4Node.getNodeName()+"]");
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()))
if( detail4Node != null && detail4Node.getNodeValue() != null )
{
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+"]siteCode["+siteCode+"]-itemCode["+itemCode+"]-lotNo["+lotNo+"]-lotSl["+lotSl+"]-locCode["+locCode+"]-tranSer["+tranSer+"]allocQtyStr["+allocQtyStr+"]@@@");
if( runningSupplyStr.trim().length() > 0)
{
runningSupply = runningSupplyStr==null?0:Double.parseDouble(runningSupplyStr);
......@@ -171,13 +173,13 @@ public class MrpWizPrsSaveBean
{
allocQty = allocQtyStr==null?0:Double.parseDouble(allocQtyStr);
}
java.util.Date currentDate = new java.util.Date();
// SimpleDateFormat sdf = new SimpleDateFormat(genericUtility.getDBDateFormat());
// Timestamp newsysDate = java.sql.Timestamp.valueOf( sdf.format(currentDate)+" 00:00:00.0");
// System.out.println("Now the date is :=> ["+newsysDate+"]");
// SimpleDateFormat sdf = new SimpleDateFormat(genericUtility.getDBDateFormat());
// Timestamp newsysDate = java.sql.Timestamp.valueOf( sdf.format(currentDate)+" 00:00:00.0");
// System.out.println("Now the date is :=> ["+newsysDate+"]");
java.sql.Date date = new java.sql.Date(currentDate.getTime());
invallocTrace.setRefSer("MRPWIZ");
invallocTrace.setRefId(saleOrder);
invallocTrace.setRefLine(lineNo);
......@@ -191,16 +193,16 @@ public class MrpWizPrsSaveBean
invallocTrace.setChgTerm(chgTerm);
invallocTrace.setChgDate( date );
//invallocTrace.setChgWin("W_SORDALLOC" );
errString = stockAllocationPrc.updateInvallocTrace(invallocTrace, conn);
if (errString != null && errString.trim().length() > 0)
{
System.out.println("@@@@@@rolledback errString :::"+ errString );
conn.rollback();
return errString;
}
}//end if
}//try end
......@@ -220,14 +222,14 @@ public class MrpWizPrsSaveBean
{
try
{
if (errString == null || errString.trim().length() == 0)
{
System.out.println("@@@@@@commit errString :::"+ errString );
conn.commit();
//return errString;
}
if (pstmt!= null)
{
pstmt = null;
......@@ -248,7 +250,7 @@ public class MrpWizPrsSaveBean
return "";
}
/*
/*
private String generateTranId( String windowName, String siteCode, Connection conn )throws ITMException
{
PreparedStatement pstmt = null;
......@@ -330,9 +332,9 @@ public class MrpWizPrsSaveBean
return tranId;
}//generateTranTd()
*/
*/
/*
private String updateInvallocTrace(InvAllocTrace invallocTrace, Connection conn) throws ITMException
{
......@@ -362,7 +364,7 @@ public class MrpWizPrsSaveBean
String tranId = null;
GenericUtility genericUtility = GenericUtility.getInstance();
ITMDBAccessEJB itmDBAccessEJB = new ITMDBAccessEJB();
try
{
keyStringQuery = "SELECT KEY_STRING, TRAN_ID_COL, REF_SER FROM TRANSETUP WHERE UPPER(TRAN_WINDOW) = 'T_ALLOCTRACE'";
......@@ -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