Commit 684ab56f authored by dpawar's avatar dpawar

change logic in shipment logic and despatch confirmed


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@97655 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 8179faa9
...@@ -115,6 +115,9 @@ public class ShipmentConf extends ActionHandlerEJB implements ShipmentConfLocal, ...@@ -115,6 +115,9 @@ public class ShipmentConf extends ActionHandlerEJB implements ShipmentConfLocal,
CommodityInfo comInfo = null; CommodityInfo comInfo = null;
ArrayList<String> cartonNoList = new ArrayList<String>(); ArrayList<String> cartonNoList = new ArrayList<String>();
ArrayList<String> refIdList = new ArrayList<String>();
ArrayList<String> refSerList = new ArrayList<String>();
String custName = ""; String custName = "";
String shipAdd1 = ""; String shipAdd1 = "";
...@@ -175,6 +178,7 @@ public class ShipmentConf extends ActionHandlerEJB implements ShipmentConfLocal, ...@@ -175,6 +178,7 @@ public class ShipmentConf extends ActionHandlerEJB implements ShipmentConfLocal,
//changed by sankara on 22/09/14 for site transporter //changed by sankara on 22/09/14 for site transporter
String siteCodeShip = ""; String siteCodeShip = "";
boolean isSiteTransporterexist = true; boolean isSiteTransporterexist = true;
boolean isError = false;
try try
{ {
conn = connDriver.getConnectDB( "DriverITM" ); conn = connDriver.getConnectDB( "DriverITM" );
...@@ -479,7 +483,8 @@ public class ShipmentConf extends ActionHandlerEJB implements ShipmentConfLocal, ...@@ -479,7 +483,8 @@ public class ShipmentConf extends ActionHandlerEJB implements ShipmentConfLocal,
pstmt.setString(2, "N"); pstmt.setString(2, "N");
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
while( rs.next() ) //Changed and commented by Dadaso pawar on 26/03/15 [Start]
/*while( rs.next() )
{ {
refId = rs.getString(1); refId = rs.getString(1);
refSerNew = checkNull(rs.getString("REF_SER")); refSerNew = checkNull(rs.getString("REF_SER"));
...@@ -501,8 +506,18 @@ public class ShipmentConf extends ActionHandlerEJB implements ShipmentConfLocal, ...@@ -501,8 +506,18 @@ public class ShipmentConf extends ActionHandlerEJB implements ShipmentConfLocal,
updateShipDocs(refId,refSerNew,sealNo,dataLoggerNo, findError(errString)); updateShipDocs(refId,refSerNew,sealNo,dataLoggerNo, findError(errString));
} }
} }*/
while( rs.next() )
{
refId = checkNull(rs.getString(1));
refSerNew = checkNull(rs.getString("REF_SER"));
refIdList.add(refId.trim());
refSerList.add(refSerNew.trim());
}
System.out.println("refIdList after while----->>["+refIdList+"]");
System.out.println("refSerList after while----->>["+refSerList+"]");
if(pstmt != null) if(pstmt != null)
{ {
pstmt.close(); pstmt.close();
...@@ -513,7 +528,30 @@ public class ShipmentConf extends ActionHandlerEJB implements ShipmentConfLocal, ...@@ -513,7 +528,30 @@ public class ShipmentConf extends ActionHandlerEJB implements ShipmentConfLocal,
rs.close(); rs.close();
rs = null; rs = null;
} }
int refCnt = 0;
for (String refIdL : refIdList)
{
if(refIdL.length() > 0)
{
errString = confirmShipment( objName, refIdL, xtraParam, forcedFlag, conn);
System.out.println(" errString ---------------- > ["+errString);
//int despcount = updateDespatch (refIdL,conn);
/*if( despcount > 0 )
{
System.out.println("lr date updated in despatch sucessfully");
}*/
//Changed By Pragyan seal no and data logger no
//updateShipDocs(refId,refSerNew, findError(errString));
updateShipDocs(refIdL,refSerList.get(refCnt),sealNo,dataLoggerNo, findError(errString),conn);
}
refCnt++;
}
//Changed and commented by Dadaso pawar on 26/03/15 [Start]
isAllDespConfirmed = isCountSame(tranId, conn); isAllDespConfirmed = isCountSame(tranId, conn);
...@@ -1389,10 +1427,12 @@ public class ShipmentConf extends ActionHandlerEJB implements ShipmentConfLocal, ...@@ -1389,10 +1427,12 @@ public class ShipmentConf extends ActionHandlerEJB implements ShipmentConfLocal,
} }
//changed by sankara on 08/01/14 for update shipment_date in shipment header based on transetup end. //changed by sankara on 08/01/14 for update shipment_date in shipment header based on transetup end.
if(conn != null) //changes and commented by Dadaso pawar on 26/03/15[Start]
/*if(conn != null)
{ {
conn.commit(); conn.commit();
} }*/
//changes and commented by Dadaso pawar on 26/03/15[ENd]
//changed by sankara on 26/06/14 for consumption issue start. //changed by sankara on 26/06/14 for consumption issue start.
//errString = itmDBAccessLocal.getErrorString("","VTCONFIRM",""); //errString = itmDBAccessLocal.getErrorString("","VTCONFIRM","");
System.out.println("coming confirm error message::::::"+errString); System.out.println("coming confirm error message::::::"+errString);
...@@ -1417,6 +1457,7 @@ public class ShipmentConf extends ActionHandlerEJB implements ShipmentConfLocal, ...@@ -1417,6 +1457,7 @@ public class ShipmentConf extends ActionHandlerEJB implements ShipmentConfLocal,
} }
catch(Exception e) catch(Exception e)
{ {
isError = true;
try{ try{
conn.rollback(); conn.rollback();
} }
...@@ -1430,6 +1471,7 @@ public class ShipmentConf extends ActionHandlerEJB implements ShipmentConfLocal, ...@@ -1430,6 +1471,7 @@ public class ShipmentConf extends ActionHandlerEJB implements ShipmentConfLocal,
finally finally
{ {
System.out.println("!! Closing Connection in Shipment Confirm() !!"); System.out.println("!! Closing Connection in Shipment Confirm() !!");
System.out.println("in main finally------->>["+isError+"]");
try try
{ {
if( pstmtSord!= null) if( pstmtSord!= null)
...@@ -1458,9 +1500,24 @@ public class ShipmentConf extends ActionHandlerEJB implements ShipmentConfLocal, ...@@ -1458,9 +1500,24 @@ public class ShipmentConf extends ActionHandlerEJB implements ShipmentConfLocal,
rsSet.close(); rsSet.close();
rsSet = null; rsSet = null;
} }
/*//chnages and commented by Dadaso pawar on 26/03/15[Start]
conn.close(); if(isError)
conn = null; {
conn.rollback();
}
else
{
conn.commit();
}*/
/*conn.close();
conn = null;*/
if(conn !=null)
{
conn.close();
conn = null;
}
//chnages and commented by Dadaso pawar on 26/03/15[Start]
} }
catch(Exception se){ catch(Exception se){
System.out.println(se.getMessage()); System.out.println(se.getMessage());
...@@ -3248,19 +3305,23 @@ public class ShipmentConf extends ActionHandlerEJB implements ShipmentConfLocal, ...@@ -3248,19 +3305,23 @@ public class ShipmentConf extends ActionHandlerEJB implements ShipmentConfLocal,
//Chnaged by Rohan on 14-08-13 for passing argument //Chnaged by Rohan on 14-08-13 for passing argument
//private String updateShipDocs ( String refId, HashMap error) throws ITMException //private String updateShipDocs ( String refId, HashMap error) throws ITMException
//private String updateShipDocs ( String refId,String refSer, HashMap error) throws ITMException //private String updateShipDocs ( String refId,String refSer, HashMap error) throws ITMException
private String updateShipDocs ( String refId,String refSer,String sealNo ,String dataLoggerNo, HashMap error) throws ITMException private String updateShipDocs ( String refId,String refSer,String sealNo ,String dataLoggerNo, HashMap error,Connection conn) throws ITMException
{ {
String sql = "",sSQL = ""; String sql = "",sSQL = "";
//Changed By Pragyan //Changed By Pragyan
//PreparedStatement pstmt1 = null, pstmt = null; //PreparedStatement pstmt1 = null, pstmt = null;
PreparedStatement pstmt1 = null, pstmt = null,pstmtLog = null; PreparedStatement pstmt1 = null, pstmt = null,pstmtLog = null;
Connection conn = null; //Changes and commented by Dadaso pawar 26/03/15 [Start]
ConnDriver connDriver = null; /*Connection conn = null;
ConnDriver connDriver = null;*/
//Changes and commented by Dadaso pawar 26/03/15 [End]
try try
{ {
connDriver = new ConnDriver(); //Changes and commented by Dadaso pawar 26/03/15 [Start]
/*connDriver = new ConnDriver();
conn = connDriver.getConnectDB("DriverITM"); conn = connDriver.getConnectDB("DriverITM");
connDriver = null; connDriver = null;*/
//Changes and commented by Dadaso pawar 26/03/15 [End]
sql = " UPDATE SHIP_DOCS SET DESP_CONFIRMED = ?, ERROR_MSG = ? WHERE REF_ID = ? "; sql = " UPDATE SHIP_DOCS SET DESP_CONFIRMED = ?, ERROR_MSG = ? WHERE REF_ID = ? ";
pstmt1 = conn.prepareStatement(sql); pstmt1 = conn.prepareStatement(sql);
if( "E".equals(error.get("type").toString())) if( "E".equals(error.get("type").toString()))
...@@ -3298,12 +3359,13 @@ public class ShipmentConf extends ActionHandlerEJB implements ShipmentConfLocal, ...@@ -3298,12 +3359,13 @@ public class ShipmentConf extends ActionHandlerEJB implements ShipmentConfLocal,
pstmt1.executeUpdate(); pstmt1.executeUpdate();
sSQL = "UPDATE DESPATCH SET SEAL_NO = ?, DATA_LOGGER_NO = ? WHERE DESP_ID = ? "; sSQL = "UPDATE DESPATCH SET SEAL_NO = ?, DATA_LOGGER_NO = ?,LR_DATE = ? WHERE DESP_ID = ? ";
pstmtLog = conn.prepareStatement(sSQL); pstmtLog = conn.prepareStatement(sSQL);
pstmtLog.setString(1, sealNo); pstmtLog.setString(1, sealNo);
pstmtLog.setString(2, dataLoggerNo); pstmtLog.setString(2, dataLoggerNo);
pstmtLog.setString(3, refId); pstmtLog.setDate(3, new java.sql.Date(new java.util.Date().getTime()));
pstmtLog.setString(4, refId);
if(pstmtLog.executeUpdate() > 0 ) if(pstmtLog.executeUpdate() > 0 )
{ {
...@@ -3354,7 +3416,7 @@ public class ShipmentConf extends ActionHandlerEJB implements ShipmentConfLocal, ...@@ -3354,7 +3416,7 @@ public class ShipmentConf extends ActionHandlerEJB implements ShipmentConfLocal,
pstmt1.close(); pstmt1.close();
pstmt1 = null; pstmt1 = null;
} }
conn.commit(); conn.commit();
} }
catch( Exception e) catch( Exception e)
{ {
...@@ -3383,11 +3445,13 @@ public class ShipmentConf extends ActionHandlerEJB implements ShipmentConfLocal, ...@@ -3383,11 +3445,13 @@ public class ShipmentConf extends ActionHandlerEJB implements ShipmentConfLocal,
pstmt1.close(); pstmt1.close();
pstmt1 = null; pstmt1 = null;
} }
if( conn != null) //Changes and commented by Dadaso pawar 26/03/15 [Start]
/*if( conn != null)
{ {
conn.close(); conn.close();
conn = null; conn = null;
} }*/
//Changes and commented by Dadaso pawar 26/03/15 [End]
} catch (Exception e2) } catch (Exception e2)
{ {
throw new ITMException(e2); throw new ITMException(e2);
...@@ -3843,23 +3907,28 @@ public class ShipmentConf extends ActionHandlerEJB implements ShipmentConfLocal, ...@@ -3843,23 +3907,28 @@ public class ShipmentConf extends ActionHandlerEJB implements ShipmentConfLocal,
} }
//changed by sankara on 08/01/14 for update lr_date in despatch start. //changed by sankara on 08/01/14 for update lr_date in despatch start.
private int updateDespatch (String refId) throws ITMException private int updateDespatch (String refId,Connection conn) throws ITMException
{ {
String sql = ""; String sql = "";
PreparedStatement pstmt1 = null; PreparedStatement pstmt1 = null;
int despcount = 0; int despcount = 0;
Connection con = null; //Changed and commented by Dadaso pawar on [26/03/15]
ConnDriver conDriver = null; /*Connection con = null;
ConnDriver conDriver = null;*/
//Changed and commented by Dadaso pawar on [26/03/15] [End]
try try
{ {
conDriver = new ConnDriver(); //Changed and commented by Dadaso pawar on [26/03/15] [Start]
/*conDriver = new ConnDriver();
con = conDriver.getConnectDB("DriverITM"); con = conDriver.getConnectDB("DriverITM");
conDriver = null; conDriver = null;*/
//Changed and commented by Dadaso pawar on [26/03/15] [End]
if(refId != null && refId.trim().length() > 0 ) if(refId != null && refId.trim().length() > 0 )
{ {
System.out.println("sankara in despatc2"); System.out.println("sankara in despatc2");
sql = " UPDATE DESPATCH SET LR_DATE = ? WHERE DESP_ID = ? "; sql = " UPDATE DESPATCH SET LR_DATE = ? WHERE DESP_ID = ? ";
pstmt1 = con.prepareStatement(sql); //pstmt1 = con.prepareStatement(sql); Changed and commented by Dadaso pawar on [26/03/15]
pstmt1 = conn.prepareStatement(sql);
pstmt1.setDate(1, new java.sql.Date(new java.util.Date().getTime())); pstmt1.setDate(1, new java.sql.Date(new java.util.Date().getTime()));
pstmt1.setString(2, refId); pstmt1.setString(2, refId);
despcount = pstmt1.executeUpdate(); despcount = pstmt1.executeUpdate();
...@@ -3874,11 +3943,12 @@ public class ShipmentConf extends ActionHandlerEJB implements ShipmentConfLocal, ...@@ -3874,11 +3943,12 @@ public class ShipmentConf extends ActionHandlerEJB implements ShipmentConfLocal,
pstmt1.close(); pstmt1.close();
pstmt1 = null; pstmt1 = null;
} }
con.commit(); //con.commit(); //Changed and commented by Dadaso pawar on [26/03/15]
} }
catch( Exception e) catch( Exception e)
{ {
try //Changed and commented by Dadaso pawar on [26/03/15]
/*try
{ {
con.rollback(); con.rollback();
} }
...@@ -3886,7 +3956,8 @@ public class ShipmentConf extends ActionHandlerEJB implements ShipmentConfLocal, ...@@ -3886,7 +3956,8 @@ public class ShipmentConf extends ActionHandlerEJB implements ShipmentConfLocal,
{ {
System.out.println("Unable to rollback"); System.out.println("Unable to rollback");
s.printStackTrace(); s.printStackTrace();
} }*/
//Changed and commented by Dadaso pawar on [26/03/15] [End]
throw new ITMException(e); throw new ITMException(e);
} }
finally finally
...@@ -3898,11 +3969,13 @@ public class ShipmentConf extends ActionHandlerEJB implements ShipmentConfLocal, ...@@ -3898,11 +3969,13 @@ public class ShipmentConf extends ActionHandlerEJB implements ShipmentConfLocal,
pstmt1.close(); pstmt1.close();
pstmt1 = null; pstmt1 = null;
} }
if( con != null) //Changed and commented by Dadaso pawar on [26/03/15]
/*if( con != null)
{ {
con.close(); con.close();
con = null; con = null;
} }*/
//Changed and commented by Dadaso pawar on [26/03/15] [End]
} }
catch (Exception e2) catch (Exception e2)
{ {
......
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