Commit 7225aa12 authored by cpatil's avatar cpatil

fright rate calculation code modified


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@98438 ce508802-f39f-4f6c-b175-0d175dae99d5
parent f1f2eb43
...@@ -10,7 +10,8 @@ package ibase.webitm.ejb.dis; ...@@ -10,7 +10,8 @@ package ibase.webitm.ejb.dis;
import ibase.system.config.ConnDriver; import ibase.system.config.ConnDriver;
import ibase.webitm.ejb.ValidatorEJB; import ibase.webitm.ejb.ValidatorEJB;
import ibase.webitm.ejb.fin.FinCommon; import ibase.webitm.ejb.fin.FinCommon;
import ibase.webitm.utility.GenericUtility; // import ibase.webitm.utility.GenericUtility;
import ibase.utility.E12GenericUtility;
import ibase.webitm.utility.ITMException; import ibase.webitm.utility.ITMException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
...@@ -31,7 +32,9 @@ import java.sql.Timestamp; ...@@ -31,7 +32,9 @@ import java.sql.Timestamp;
public class ShipmentLocIC extends ValidatorEJB implements ShipmentLocICLocal, ShipmentLocICRemote public class ShipmentLocIC extends ValidatorEJB implements ShipmentLocICLocal, ShipmentLocICRemote
{ {
GenericUtility genericUtility = GenericUtility.getInstance();
// GenericUtility genericUtility = GenericUtility.getInstance();
E12GenericUtility genericUtility = new E12GenericUtility();
//method for validation //method for validation
public String wfValData(String xmlString, String xmlString1, String xmlString2, String objContext, String editFlag, String xtraParams) throws RemoteException,ITMException public String wfValData(String xmlString, String xmlString1, String xmlString2, String objContext, String editFlag, String xtraParams) throws RemoteException,ITMException
...@@ -121,7 +124,7 @@ public class ShipmentLocIC extends ValidatorEJB implements ShipmentLocICLocal, S ...@@ -121,7 +124,7 @@ public class ShipmentLocIC extends ValidatorEJB implements ShipmentLocICLocal, S
if(childNodeName.equalsIgnoreCase("shipment_id")) if(childNodeName.equalsIgnoreCase("shipment_id"))
{ {
shipmentId = genericUtility.getColumnValue("shipment_id", dom); shipmentId = checkNull(genericUtility.getColumnValue("shipment_id", dom));
//Shipment Date should not be blank. //Shipment Date should not be blank.
String keyFlag = setDescription("key_flag", "transetup", "tran_window", "w_shipment_loc", conn); String keyFlag = setDescription("key_flag", "transetup", "tran_window", "w_shipment_loc", conn);
...@@ -718,6 +721,7 @@ public class ShipmentLocIC extends ValidatorEJB implements ShipmentLocICLocal, S ...@@ -718,6 +721,7 @@ public class ShipmentLocIC extends ValidatorEJB implements ShipmentLocICLocal, S
rs = null; rs = null;
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
System.out.println("COUNT["+cnt+"]");
if( cnt > 0) if( cnt > 0)
{ {
retStr = "TRUE"; retStr = "TRUE";
...@@ -778,7 +782,8 @@ public class ShipmentLocIC extends ValidatorEJB implements ShipmentLocICLocal, S ...@@ -778,7 +782,8 @@ public class ShipmentLocIC extends ValidatorEJB implements ShipmentLocICLocal, S
Connection conn = null; Connection conn = null;
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
ResultSet rs = null ; ResultSet rs = null ;
GenericUtility genericUtility = GenericUtility.getInstance(); // GenericUtility genericUtility = GenericUtility.getInstance();
E12GenericUtility genericUtility = new E12GenericUtility();
ConnDriver connDriver = new ConnDriver(); ConnDriver connDriver = new ConnDriver();
int currentFormNo =0; int currentFormNo =0;
...@@ -798,6 +803,7 @@ public class ShipmentLocIC extends ValidatorEJB implements ShipmentLocICLocal, S ...@@ -798,6 +803,7 @@ public class ShipmentLocIC extends ValidatorEJB implements ShipmentLocICLocal, S
int i=0,noArt=0; int i=0,noArt=0;
Timestamp despDate=null; Timestamp despDate=null;
double netWeightCIss=0;
try try
{ {
...@@ -1291,13 +1297,13 @@ public class ShipmentLocIC extends ValidatorEJB implements ShipmentLocICLocal, S ...@@ -1291,13 +1297,13 @@ public class ShipmentLocIC extends ValidatorEJB implements ShipmentLocICLocal, S
{ {
System.out.println("@@@@@@@@ itemchange charge_code called @@@@@@@@"); System.out.println("@@@@@@@@ itemchange charge_code called @@@@@@@@");
chargeCode = genericUtility.getColumnValue("charge_code", dom); chargeCode = genericUtility.getColumnValue("charge_code", dom)==null?"":genericUtility.getColumnValue("charge_code", dom).trim();
shipmentId = genericUtility.getColumnValue("shipment_id", dom1); shipmentId = genericUtility.getColumnValue("shipment_id", dom1)==null?"":genericUtility.getColumnValue("shipment_id", dom1).trim();
frtList = genericUtility.getColumnValue("frt_list", dom1); frtList = genericUtility.getColumnValue("frt_list", dom1)==null?"":genericUtility.getColumnValue("frt_list", dom1).trim();
stanCodeFrom = genericUtility.getColumnValue("stan_code__from", dom1); stanCodeFrom = genericUtility.getColumnValue("stan_code__from", dom1)==null?"":genericUtility.getColumnValue("stan_code__from", dom1).trim();
stanCodeTo = genericUtility.getColumnValue("stan_code__to", dom1); stanCodeTo = genericUtility.getColumnValue("stan_code__to", dom1)==null?"":genericUtility.getColumnValue("stan_code__to", dom1).trim();
loadType = genericUtility.getColumnValue("load_type", dom1); loadType = genericUtility.getColumnValue("load_type", dom1)==null?"":genericUtility.getColumnValue("load_type", dom1).trim();
/* /*
sql = " select c.descr,b.charges_mode,b.amount,b.charge_code__add,sequence " + sql = " select c.descr,b.charges_mode,b.amount,b.charge_code__add,sequence " +
" from shipment a, freight_rate_det b, gencodes c " + " from shipment a, freight_rate_det b, gencodes c " +
...@@ -1332,9 +1338,9 @@ public class ShipmentLocIC extends ValidatorEJB implements ShipmentLocICLocal, S ...@@ -1332,9 +1338,9 @@ public class ShipmentLocIC extends ValidatorEJB implements ShipmentLocICLocal, S
pstmt.setString(3,stanCodeTo ); pstmt.setString(3,stanCodeTo );
pstmt.setString(4,loadType ); pstmt.setString(4,loadType );
pstmt.setString(5,shipmentId ); // pstmt.setString(5,shipmentId );
pstmt.setString(6,"CHARGE_CODE" ); pstmt.setString(5,"CHARGE_CODE" );
pstmt.setString(7,chargeCode ); pstmt.setString(6,chargeCode );
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
if(rs.next()) if(rs.next())
...@@ -1432,7 +1438,24 @@ public class ShipmentLocIC extends ValidatorEJB implements ShipmentLocICLocal, S ...@@ -1432,7 +1438,24 @@ public class ShipmentLocIC extends ValidatorEJB implements ShipmentLocICLocal, S
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
nettWeight = (nettWeight + netWeight) * amount; sql = " select nvl(sum(gross_weight),0) from CONSUME_ISS " +
" where cons_issue in ( select ref_id from ship_docs where shipment_id = ? ) and confirmed = 'Y' ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, shipmentId);
rs = pstmt.executeQuery();
if( rs.next())
{
grossWeightCIss = rs.getDouble(1);
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
System.out.println("@@@@@@@@grossWeightCIss["+grossWeightCIss+"]");
nettWeight = (nettWeight + netWeight + grossWeightCIss ) * amount;
valueXmlString.append("<amount>").append("<![CDATA["+nettWeight+"]]>").append("</amount>"); valueXmlString.append("<amount>").append("<![CDATA["+nettWeight+"]]>").append("</amount>");
} }
else if ("V".equalsIgnoreCase(mode) ) //volume else if ("V".equalsIgnoreCase(mode) ) //volume
...@@ -1492,7 +1515,7 @@ public class ShipmentLocIC extends ValidatorEJB implements ShipmentLocICLocal, S ...@@ -1492,7 +1515,7 @@ public class ShipmentLocIC extends ValidatorEJB implements ShipmentLocICLocal, S
System.out.println("@@@@@2 stanCodeShip ["+ stanCodeShip + "]"); System.out.println("@@@@@2 stanCodeShip ["+ stanCodeShip + "]");
stationaDescr = setDescription("descr", "station", "stan_code", stanCodeShip, conn); stationaDescr = setDescription("descr", "station", "stan_code", stanCodeShip, conn);
valueXmlString.append("<stationa_descr protect = \"1\">").append("<![CDATA["+stationaDescr+"]]>").append("</stationa_descr>"); valueXmlString.append("<stationa_descr protect = \"1\">").append("<![CDATA["+stationaDescr+"]]>").append("</stationa_descr>");
} } //stationa_descr
else if( currentColumn.trim().equalsIgnoreCase( "stan_code__dlv" ) ) else if( currentColumn.trim().equalsIgnoreCase( "stan_code__dlv" ) )
......
...@@ -265,7 +265,7 @@ public class RecalFrtAct extends ActionHandlerEJB implements RecalFrtActLocal, R ...@@ -265,7 +265,7 @@ public class RecalFrtAct extends ActionHandlerEJB implements RecalFrtActLocal, R
updCnt = pstmt.executeUpdate(); updCnt = pstmt.executeUpdate();
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
System.out.println("updCnt["+updCnt+"]");
frtAmt = val; frtAmt = val;
} }
else else
...@@ -277,7 +277,7 @@ public class RecalFrtAct extends ActionHandlerEJB implements RecalFrtActLocal, R ...@@ -277,7 +277,7 @@ public class RecalFrtAct extends ActionHandlerEJB implements RecalFrtActLocal, R
updCnt = pstmt.executeUpdate(); updCnt = pstmt.executeUpdate();
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
System.out.println("updCnt["+updCnt+"]");
frtAmt = minValue; frtAmt = minValue;
} //end if } //end if
...@@ -378,13 +378,13 @@ public class RecalFrtAct extends ActionHandlerEJB implements RecalFrtActLocal, R ...@@ -378,13 +378,13 @@ public class RecalFrtAct extends ActionHandlerEJB implements RecalFrtActLocal, R
} }
val = val + frtAmt; val = val + frtAmt;
} }
else else
{ {
val = frtAmt; val = frtAmt;
} // end if } // end if
System.out.println("@@@@@@ val["+val+"]chargeRate["+chargeRate+"]"); System.out.println("@@@@@@ val["+val+"]chargeRate["+chargeRate+"]");
val = ( val * chargeRate)/100 ; val = ( val * chargeRate)/100 ;
System.out.println("@@@@@@ val["+val+"]");
} }
else if("W".equalsIgnoreCase(chargesMode)) // ls_mode = 'W' then//weight else if("W".equalsIgnoreCase(chargesMode)) // ls_mode = 'W' then//weight
{ {
...@@ -438,6 +438,7 @@ public class RecalFrtAct extends ActionHandlerEJB implements RecalFrtActLocal, R ...@@ -438,6 +438,7 @@ public class RecalFrtAct extends ActionHandlerEJB implements RecalFrtActLocal, R
val = ( tempNettWeight + tempNetWeight + grossWeightCIss ) * chargeRate ; val = ( tempNettWeight + tempNetWeight + grossWeightCIss ) * chargeRate ;
System.out.println("@@@@@@ val["+val+"]chargeRate["+chargeRate+"]");
} // end if } // end if
......
...@@ -56,16 +56,12 @@ public class ShipmentLocConf extends ActionHandlerEJB implements ShipmentLocConf ...@@ -56,16 +56,12 @@ public class ShipmentLocConf extends ActionHandlerEJB implements ShipmentLocConf
String retString=""; String retString="";
String errString = ""; String errString = "";
String sql = ""; String sql = "";
String lorryNo = "";
String lrNo = "";
String confirmed = ""; String confirmed = "";
ConnDriver connDriver = new ConnDriver(); ConnDriver connDriver = new ConnDriver();
Connection conn = null; Connection conn = null;
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
ResultSet rs = null; ResultSet rs = null;
String errCode="",recallFrt=""; String errCode="" ;
double totalFreight=0;
Timestamp lrDate=null;
try try
{ {
...@@ -77,25 +73,19 @@ public class ShipmentLocConf extends ActionHandlerEJB implements ShipmentLocConf ...@@ -77,25 +73,19 @@ public class ShipmentLocConf extends ActionHandlerEJB implements ShipmentLocConf
// check whether already confirmed or not // check whether already confirmed or not
sql = " select confirmed , total_freight , lr_no , lr_date , recall_frt, lorry_no " + sql = " select confirmed from shipment where shipment_id = ? ";
" from shipment where shipment_id = ? ";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, tranId); pstmt.setString(1, tranId);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
if( rs.next()) if( rs.next())
{ {
confirmed = rs.getString("confirmed"); confirmed = checkNull(rs.getString("confirmed"));
totalFreight = rs.getDouble("total_freight");
lrNo = checkNull(rs.getString("lr_no"));
lrDate = rs.getTimestamp("lr_date");
recallFrt = checkNull(rs.getString("recall_frt"));
lorryNo = checkNull(rs.getString("lorry_no"));
} }
System.out.println("@@@@confirmed["+confirmed+"]totalFreight["+totalFreight+"]lrNo["+lrNo+"]"); rs.close();
System.out.println("@@@@lrDate["+lrDate+"]recallFrt["+recallFrt+"]lorryNo["+lorryNo+"]"); rs = null;
rs.close();rs = null; pstmt.close();
pstmt.close();pstmt = null; pstmt = null;
System.out.println("@@@@shipment_id["+tranId+"]confirmed["+confirmed+"]");
if( "Y".equalsIgnoreCase(confirmed)) if( "Y".equalsIgnoreCase(confirmed))
{ {
...@@ -118,17 +108,12 @@ public class ShipmentLocConf extends ActionHandlerEJB implements ShipmentLocConf ...@@ -118,17 +108,12 @@ public class ShipmentLocConf extends ActionHandlerEJB implements ShipmentLocConf
else else
{ {
conn.commit(); conn.commit();
//retString=generateTrackInfo(tranId,conn); // retString=generateTrackInfo(tranId,conn); // comment this method by mahendra
System.out.println("final retString @@@@@"+retString);
System.out.println("@@@@@@@@@ commit successful..........."); System.out.println("@@@@@@@@@ commit successful...........");
errString = itmDBAccessLocal.getErrorString("","VTCONFIRM",""); errString = itmDBAccessLocal.getErrorString("","VTCONFIRM","");
System.out.println("@@@@@@@@@ confirm successful..........."); System.out.println("@@@@@@@@@ confirm successful...........");
} }
} }
} }
catch(Exception e) catch(Exception e)
{ {
...@@ -155,6 +140,7 @@ public class ShipmentLocConf extends ActionHandlerEJB implements ShipmentLocConf ...@@ -155,6 +140,7 @@ public class ShipmentLocConf extends ActionHandlerEJB implements ShipmentLocConf
throw new ITMException(se); throw new ITMException(se);
} }
} }
System.out.println("final errString @@@@@"+errString);
return errString; return errString;
} }
...@@ -163,11 +149,11 @@ public class ShipmentLocConf extends ActionHandlerEJB implements ShipmentLocConf ...@@ -163,11 +149,11 @@ public class ShipmentLocConf extends ActionHandlerEJB implements ShipmentLocConf
throws RemoteException, ITMException throws RemoteException, ITMException
{ {
PreparedStatement pstmt = null, pstmtSql = null; PreparedStatement pstmt = null, pstmt1 = null;
ResultSet rs = null; ResultSet rs = null;
int cnt = 0,updCnt=0; int cnt = 0,updCnt=0;
String retString = "", sql = "", errCode = ""; String sql = "", sql1 = "", errCode = "";
Timestamp sysDate = null, tranDate = null,lrDate=null,lrDateUpd=null; Timestamp sysDate = null, lrDate=null,lrDateUpd=null;
ibase.utility.E12GenericUtility genericUtility= new ibase.utility.E12GenericUtility(); ibase.utility.E12GenericUtility genericUtility= new ibase.utility.E12GenericUtility();
ITMDBAccessEJB itmDBAccessLocal = new ITMDBAccessEJB(); ITMDBAccessEJB itmDBAccessLocal = new ITMDBAccessEJB();
int cntDist=0,cntConsIss=0; int cntDist=0,cntConsIss=0;
...@@ -177,35 +163,35 @@ public class ShipmentLocConf extends ActionHandlerEJB implements ShipmentLocConf ...@@ -177,35 +163,35 @@ public class ShipmentLocConf extends ActionHandlerEJB implements ShipmentLocConf
try try
{ {
System.out.println("@@@@@@@@@@@@@@@ confirmShipmentLoc method called next.............."); System.out.println("@@@@@@@@@@@@@@@ confirmShipmentLoc method called next.....1, tranId["+tranId+"].........");
Calendar currentDate = Calendar.getInstance(); Calendar currentDate = Calendar.getInstance();
SimpleDateFormat sdf = new SimpleDateFormat(genericUtility.getApplDateFormat()); SimpleDateFormat sdf = new SimpleDateFormat(genericUtility.getApplDateFormat());
String sysDateStr = sdf.format(currentDate.getTime()); String sysDateStr = sdf.format(currentDate.getTime());
System.out.println("Now the date is :=> " + sysDateStr); System.out.println("Now the date is :=> " + sysDateStr);
sysDate= Timestamp.valueOf(genericUtility.getValidDateString(sysDateStr, genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat()) + " 00:00:00.0"); sysDate= Timestamp.valueOf(genericUtility.getValidDateString(sysDateStr, genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat()) + " 00:00:00.0");
sql = " select confirmed , total_freight , lr_no , lr_date , recall_frt, lorry_no " + sql = " select confirmed , total_freight , lr_no , lr_date , recall_frt, lorry_no " +
" from shipment where shipment_id = ? "; " from shipment where shipment_id = ? ";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, tranId); pstmt.setString(1, tranId);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
if( rs.next()) if( rs.next())
{ {
confirmed = rs.getString("confirmed"); confirmed = checkNull(rs.getString("confirmed"));
totalFreight = rs.getDouble("total_freight"); totalFreight = rs.getDouble("total_freight");
lrNo = checkNull(rs.getString("lr_no")); lrNo = checkNull(rs.getString("lr_no"));
lrDate = rs.getTimestamp("lr_date"); lrDate = rs.getTimestamp("lr_date");
recallFrt = checkNull(rs.getString("recall_frt")); recallFrt = checkNull(rs.getString("recall_frt"));
lorryNo = checkNull(rs.getString("lorry_no")); lorryNo = checkNull(rs.getString("lorry_no"));
} }
System.out.println("@@@@confirmed["+confirmed+"]totalFreight["+totalFreight+"]lrNo["+lrNo+"]");
System.out.println("@@@@lrDate["+lrDate+"]recallFrt["+recallFrt+"]lorryNo["+lorryNo+"]");
rs.close(); rs.close();
rs = null; rs = null;
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
System.out.println("@@@@confirmed["+confirmed+"]totalFreight["+totalFreight+"]lrNo["+lrNo+"]");
System.out.println("@@@@lrDate["+lrDate+"]recallFrt["+recallFrt+"]lorryNo["+lorryNo+"]");
// check shipment allocated to at least one despatch or dist issue // check shipment allocated to at least one despatch or dist issue
sql = " select count(1) " + sql = " select count(1) " +
...@@ -221,7 +207,9 @@ public class ShipmentLocConf extends ActionHandlerEJB implements ShipmentLocConf ...@@ -221,7 +207,9 @@ public class ShipmentLocConf extends ActionHandlerEJB implements ShipmentLocConf
rs = null; rs = null;
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
System.out.println("cnt["+cnt+"]"); System.out.println("cnt["+cnt+"]");
if( cnt == 0 ) // ll_cnt = 0 then if( cnt == 0 ) // ll_cnt = 0 then
{ {
sql = " select count(1) " + sql = " select count(1) " +
...@@ -244,7 +232,8 @@ public class ShipmentLocConf extends ActionHandlerEJB implements ShipmentLocConf ...@@ -244,7 +232,8 @@ public class ShipmentLocConf extends ActionHandlerEJB implements ShipmentLocConf
{ {
sql = " select count(1) from CONSUME_ISS " + sql = " select count(1) from CONSUME_ISS " +
" where cons_issue in ( select ref_id from ship_docs where shipment_id = ? ) and confirmed = 'Y' "; " where cons_issue in ( select ref_id from ship_docs where shipment_id = ? ) " +
" and confirmed = 'Y' ";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, tranId); pstmt.setString(1, tranId);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
...@@ -323,7 +312,7 @@ public class ShipmentLocConf extends ActionHandlerEJB implements ShipmentLocConf ...@@ -323,7 +312,7 @@ public class ShipmentLocConf extends ActionHandlerEJB implements ShipmentLocConf
System.out.println("@@@@totGwt["+totGwt+"]"); System.out.println("@@@@totGwt["+totGwt+"]");
// for despatch
sql = " select desp_id,gross_weight, lr_date, lr_no, lorry_no from despatch " + sql = " select desp_id,gross_weight, lr_date, lr_no, lorry_no from despatch " +
" where shipment_id = ? and confirmed = 'Y' "; " where shipment_id = ? and confirmed = 'Y' ";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
...@@ -336,11 +325,7 @@ public class ShipmentLocConf extends ActionHandlerEJB implements ShipmentLocConf ...@@ -336,11 +325,7 @@ public class ShipmentLocConf extends ActionHandlerEJB implements ShipmentLocConf
lrDate = rs.getTimestamp("lr_date"); lrDate = rs.getTimestamp("lr_date");
lrNo = rs.getString("lr_no"); lrNo = rs.getString("lr_no");
lorryNo = rs.getString("lorry_no"); lorryNo = rs.getString("lorry_no");
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
System.out.println("@@@@totGwt["+totGwt+"]::totalFreight["+totalFreight+"]gwtDesp["+gwtDesp+"]"); System.out.println("@@@@totGwt["+totGwt+"]::totalFreight["+totalFreight+"]gwtDesp["+gwtDesp+"]");
//calculating the freight amt proportionately //calculating the freight amt proportionately
...@@ -385,18 +370,26 @@ public class ShipmentLocConf extends ActionHandlerEJB implements ShipmentLocConf ...@@ -385,18 +370,26 @@ public class ShipmentLocConf extends ActionHandlerEJB implements ShipmentLocConf
System.out.println("@@@@@@[despatch]::lrDate["+lrDate+"]lrNo["+lrNo+"]lorryNo["+lorryNo+"]"); System.out.println("@@@@@@[despatch]::lrDate["+lrDate+"]lrNo["+lrNo+"]lorryNo["+lorryNo+"]");
System.out.println("@@@@@@[despatch]::lrDateUpd["+lrDateUpd+"]lrNoUpd["+lrNoUpd+"]lorryNoUpd["+lorryNoUpd+"]"); System.out.println("@@@@@@[despatch]::lrDateUpd["+lrDateUpd+"]lrNoUpd["+lrNoUpd+"]lorryNoUpd["+lorryNoUpd+"]");
sql = " update despatch set freight = ?, lr_no = ? , lr_date = ? ," + sql1 = " update despatch set freight = ?, lr_no = ? , lr_date = ? ," +
" lorry_no = ? where desp_id = ? "; " lorry_no = ? where desp_id = ? ";
pstmt = conn.prepareStatement(sql); pstmt1 = conn.prepareStatement(sql1);
pstmt.setDouble(1, calcFrt); pstmt1.setDouble(1, calcFrt);
pstmt.setString(2, lrNoUpd); pstmt1.setString(2, lrNoUpd);
pstmt.setTimestamp(3, lrDateUpd); pstmt1.setTimestamp(3, lrDateUpd);
pstmt.setString(4, lorryNoUpd); pstmt1.setString(4, lorryNoUpd);
pstmt.setString(5, despId); pstmt1.setString(5, despId);
updCnt = pstmt.executeUpdate(); updCnt = pstmt1.executeUpdate();
pstmt1.close();
pstmt1 = null;
}
rs.close();
rs = null;
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
// for distord_iss
sql = " select tran_id,gross_weight,lr_date, lr_no, lorry_no from distord_iss " + sql = " select tran_id,gross_weight,lr_date, lr_no, lorry_no from distord_iss " +
" where shipment_id = ? and confirmed = 'Y' "; " where shipment_id = ? and confirmed = 'Y' ";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
...@@ -409,11 +402,7 @@ public class ShipmentLocConf extends ActionHandlerEJB implements ShipmentLocConf ...@@ -409,11 +402,7 @@ public class ShipmentLocConf extends ActionHandlerEJB implements ShipmentLocConf
lrDate = rs.getTimestamp("lr_date"); lrDate = rs.getTimestamp("lr_date");
lrNo = rs.getString("lr_no"); lrNo = rs.getString("lr_no");
lorryNo = rs.getString("lorry_no"); lorryNo = rs.getString("lorry_no");
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
System.out.println("@@@@distOrdIssId["+distOrdIssId+"]::grossWeight["+grossWeight+"]lrDate["+lrDate+"]"); System.out.println("@@@@distOrdIssId["+distOrdIssId+"]::grossWeight["+grossWeight+"]lrDate["+lrDate+"]");
...@@ -455,21 +444,27 @@ public class ShipmentLocConf extends ActionHandlerEJB implements ShipmentLocConf ...@@ -455,21 +444,27 @@ public class ShipmentLocConf extends ActionHandlerEJB implements ShipmentLocConf
System.out.println("@@@@@@[distord_iss]::lrDate["+lrDate+"]lrNo["+lrNo+"]lorryNo["+lorryNo+"]"); System.out.println("@@@@@@[distord_iss]::lrDate["+lrDate+"]lrNo["+lrNo+"]lorryNo["+lorryNo+"]");
System.out.println("@@@@@@[distord_iss]::lrDateUpd["+lrDateUpd+"]lrNoUpd["+lrNoUpd+"]lorryNoUpd["+lorryNoUpd+"]"); System.out.println("@@@@@@[distord_iss]::lrDateUpd["+lrDateUpd+"]lrNoUpd["+lrNoUpd+"]lorryNoUpd["+lorryNoUpd+"]");
sql = " update distord_iss set frt_amt = ?, lr_no = ? , " + sql1 = " update distord_iss set frt_amt = ?, lr_no = ? , " +
" lr_date = ?, lorry_no = ? " + " lr_date = ?, lorry_no = ? " +
" where tran_id = ? "; " where tran_id = ? ";
pstmt = conn.prepareStatement(sql); pstmt1 = conn.prepareStatement(sql1);
pstmt.setDouble(1, calcFrt); pstmt1.setDouble(1, calcFrt);
pstmt.setString(2, lrNoUpd); pstmt1.setString(2, lrNoUpd);
pstmt.setTimestamp(3, lrDateUpd); pstmt1.setTimestamp(3, lrDateUpd);
pstmt.setString(4, lorryNoUpd); pstmt1.setString(4, lorryNoUpd);
pstmt.setString(5, distOrdIssId); pstmt1.setString(5, distOrdIssId);
updCnt = pstmt.executeUpdate(); updCnt = pstmt1.executeUpdate();
pstmt1.close();
pstmt1 = null;
}
rs.close();
rs = null;
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
//// ////
// for cons_issue
sql = " select cons_issue,gross_weight,lr_date, lr_no, lorry_no from CONSUME_ISS " + sql = " select cons_issue,gross_weight,lr_date, lr_no, lorry_no from CONSUME_ISS " +
" where cons_issue in ( select ref_id from ship_docs where shipment_id = ? ) and confirmed = 'Y' "; " where cons_issue in ( select ref_id from ship_docs where shipment_id = ? ) and confirmed = 'Y' ";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
...@@ -482,11 +477,7 @@ public class ShipmentLocConf extends ActionHandlerEJB implements ShipmentLocConf ...@@ -482,11 +477,7 @@ public class ShipmentLocConf extends ActionHandlerEJB implements ShipmentLocConf
lrDate = rs.getTimestamp("lr_date"); lrDate = rs.getTimestamp("lr_date");
lrNo = rs.getString("lr_no"); lrNo = rs.getString("lr_no");
lorryNo = rs.getString("lorry_no"); lorryNo = rs.getString("lorry_no");
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
System.out.println("@@@@conOrdIssId["+conOrdIssId+"]::grossWeight["+grossWeight+"]lrDate["+lrDate+"]"); System.out.println("@@@@conOrdIssId["+conOrdIssId+"]::grossWeight["+grossWeight+"]lrDate["+lrDate+"]");
...@@ -525,21 +516,28 @@ public class ShipmentLocConf extends ActionHandlerEJB implements ShipmentLocConf ...@@ -525,21 +516,28 @@ public class ShipmentLocConf extends ActionHandlerEJB implements ShipmentLocConf
System.out.println("@@@@@@[distord_iss]::lrDate["+lrDate+"]lrNo["+lrNo+"]lorryNo["+lorryNo+"]"); System.out.println("@@@@@@[distord_iss]::lrDate["+lrDate+"]lrNo["+lrNo+"]lorryNo["+lorryNo+"]");
System.out.println("@@@@@@[distord_iss]::lrDateUpd["+lrDateUpd+"]lrNoUpd["+lrNoUpd+"]lorryNoUpd["+lorryNoUpd+"]"); System.out.println("@@@@@@[distord_iss]::lrDateUpd["+lrDateUpd+"]lrNoUpd["+lrNoUpd+"]lorryNoUpd["+lorryNoUpd+"]");
sql = " update CONSUME_ISS set FREIGHT_AMT = ?, lr_no = ? , " + sql1 = " update CONSUME_ISS set FREIGHT_AMT = ?, lr_no = ? , " +
" lr_date = ?, lorry_no = ? " + " lr_date = ?, lorry_no = ? " +
" where cons_issue = ? "; " where cons_issue = ? ";
pstmt = conn.prepareStatement(sql); pstmt1 = conn.prepareStatement(sql1);
pstmt.setDouble(1, calcFrt); pstmt1.setDouble(1, calcFrt);
pstmt.setString(2, lrNoUpd); pstmt1.setString(2, lrNoUpd);
pstmt.setTimestamp(3, lrDateUpd); pstmt1.setTimestamp(3, lrDateUpd);
pstmt.setString(4, lorryNoUpd); pstmt1.setString(4, lorryNoUpd);
pstmt.setString(5, conOrdIssId); pstmt1.setString(5, conOrdIssId);
updCnt = pstmt.executeUpdate(); updCnt = pstmt1.executeUpdate();
pstmt1.close();
pstmt1 = null;
}
rs.close();
rs = null;
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
// END TEST
// END TEST /*
//calculating the freight amt proportionately //calculating the freight amt proportionately
System.out.println("@@@@totGwt["+totGwt+"]::totalFreight["+totalFreight+"]lrNo["+lrNo+"]"); System.out.println("@@@@totGwt["+totGwt+"]::totalFreight["+totalFreight+"]lrNo["+lrNo+"]");
...@@ -555,7 +553,7 @@ public class ShipmentLocConf extends ActionHandlerEJB implements ShipmentLocConf ...@@ -555,7 +553,7 @@ public class ShipmentLocConf extends ActionHandlerEJB implements ShipmentLocConf
totFrt = totFrt + calcFrt; totFrt = totFrt + calcFrt;
System.out.println("totFrt["+totFrt+"]"); System.out.println("totFrt["+totFrt+"]");
if( totFrt > totalFreight ) // lc_tot_frt > lc_frt_amt then if( totFrt > totalFreight ) // lc_tot_frt > lc_frt_amt then
{ { // lc_calc_frt = lc_frt_amt - (lc_tot_frt - lc_calc_frt)
calcFrt = totalFreight - ( totFrt - calcFrt ) ; calcFrt = totalFreight - ( totFrt - calcFrt ) ;
} }
...@@ -591,9 +589,10 @@ public class ShipmentLocConf extends ActionHandlerEJB implements ShipmentLocConf ...@@ -591,9 +589,10 @@ public class ShipmentLocConf extends ActionHandlerEJB implements ShipmentLocConf
updCnt = pstmt.executeUpdate(); updCnt = pstmt.executeUpdate();
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
*/
/// test /// test
// everything's OK, update shipment.
if( errCode == null || errCode.trim().length() == 0 ) if( errCode == null || errCode.trim().length() == 0 )
{ {
......
...@@ -246,6 +246,11 @@ public class ShipmentLocDefaultAct extends ActionHandlerEJB implements ShipmentL ...@@ -246,6 +246,11 @@ public class ShipmentLocDefaultAct extends ActionHandlerEJB implements ShipmentL
valueXmlString.append("</Detail>\r\n"); valueXmlString.append("</Detail>\r\n");
} }
} }
rs.close();
rs = null;
pstmt.close();
pstmt = null;
System.out.println("valueXmlString =" + valueXmlString.toString()); System.out.println("valueXmlString =" + valueXmlString.toString());
valueXmlString.append("</Root>\r\n"); valueXmlString.append("</Root>\r\n");
......
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