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,26 +73,20 @@ public class ShipmentLocConf extends ActionHandlerEJB implements ShipmentLocConf ...@@ -77,26 +73,20 @@ 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))
{ {
errString = itmDBAccessLocal.getErrorString("","VTDIST26",""); errString = itmDBAccessLocal.getErrorString("","VTDIST26","");
...@@ -104,8 +94,8 @@ public class ShipmentLocConf extends ActionHandlerEJB implements ShipmentLocConf ...@@ -104,8 +94,8 @@ public class ShipmentLocConf extends ActionHandlerEJB implements ShipmentLocConf
} }
else else
{ {
errCode = confirmShipmentLoc(tranId,1, xtraParam,conn); errCode = confirmShipmentLoc(tranId,1, xtraParam,conn);
System.out.println("@@@@ confirmQcTransfer::errCode["+errCode+"]"); System.out.println("@@@@ confirmQcTransfer::errCode["+errCode+"]");
if( errCode != null && errCode.trim().length() > 0 ) if( errCode != null && errCode.trim().length() > 0 )
...@@ -118,18 +108,13 @@ public class ShipmentLocConf extends ActionHandlerEJB implements ShipmentLocConf ...@@ -118,18 +108,13 @@ 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)
{ {
try{ try{
...@@ -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,67 +325,71 @@ public class ShipmentLocConf extends ActionHandlerEJB implements ShipmentLocConf ...@@ -336,67 +325,71 @@ 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+"]");
//calculating the freight amt proportionately
if ( totGwt != 0 ) // lc_tot_gwt <> 0 then
{
//lc_calc_frt = round(((lc_frt_amt * lc_gwt_desp) / lc_tot_gwt),0)
calcFrt = Math.round(((totalFreight * gwtDesp ) / totGwt));
}
else
{
calcFrt = 0;
}
System.out.println("@@@["+calcFrt+"]"); System.out.println("@@@@totGwt["+totGwt+"]::totalFreight["+totalFreight+"]gwtDesp["+gwtDesp+"]");
//end if //calculating the freight amt proportionately
//this is to check whether total calculated freight doesnot exceed if ( totGwt != 0 ) // lc_tot_gwt <> 0 then
//the total freight during rounding the figure {
totFrt = totFrt + calcFrt; //lc_calc_frt = round(((lc_frt_amt * lc_gwt_desp) / lc_tot_gwt),0)
System.out.println("@@@totFrt["+totFrt+"]"); calcFrt = Math.round(((totalFreight * gwtDesp ) / totGwt));
if( totFrt > frtAmt ) // lc_tot_frt > lc_frt_amt then }
{ else
calcFrt = frtAmt - ( totFrt - calcFrt ); {
} //end if calcFrt = 0;
}
System.out.println("@@@["+calcFrt+"]");
//end if
//this is to check whether total calculated freight doesnot exceed
//the total freight during rounding the figure
totFrt = totFrt + calcFrt;
System.out.println("@@@totFrt["+totFrt+"]");
if( totFrt > frtAmt ) // lc_tot_frt > lc_frt_amt then
{
calcFrt = frtAmt - ( totFrt - calcFrt );
} //end if
System.out.println("@@@calcFrt["+calcFrt+"]"); System.out.println("@@@calcFrt["+calcFrt+"]");
if( lrDate != null ) if( lrDate != null )
{ {
lrDateUpd = lrDate; lrDateUpd = lrDate;
} }
if( lrNo != null ) if( lrNo != null )
{ {
lrNoUpd = lrNo; lrNoUpd = lrNo;
} }
if( lorryNo != null ) if( lorryNo != null )
{ {
lorryNoUpd = lorryNo; lorryNoUpd = lorryNo;
} }
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+"]");
sql1 = " update despatch set freight = ?, lr_no = ? , lr_date = ? ," +
" lorry_no = ? where desp_id = ? ";
pstmt1 = conn.prepareStatement(sql1);
pstmt1.setDouble(1, calcFrt);
pstmt1.setString(2, lrNoUpd);
pstmt1.setTimestamp(3, lrDateUpd);
pstmt1.setString(4, lorryNoUpd);
pstmt1.setString(5, despId);
updCnt = pstmt1.executeUpdate();
pstmt1.close();
pstmt1 = null;
sql = " update despatch set freight = ?, lr_no = ? , lr_date = ? ," + }
" lorry_no = ? where desp_id = ? "; rs.close();
pstmt = conn.prepareStatement(sql); rs = null;
pstmt.setDouble(1, calcFrt);
pstmt.setString(2, lrNoUpd);
pstmt.setTimestamp(3, lrDateUpd);
pstmt.setString(4, lorryNoUpd);
pstmt.setString(5, despId);
updCnt = pstmt.executeUpdate();
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,67 +402,69 @@ public class ShipmentLocConf extends ActionHandlerEJB implements ShipmentLocConf ...@@ -409,67 +402,69 @@ 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+"]");
//calculating the freight amt proportionately System.out.println("@@@@distOrdIssId["+distOrdIssId+"]::grossWeight["+grossWeight+"]lrDate["+lrDate+"]");
System.out.println("@@@@totGwt["+totGwt+"]::totalFreight["+totalFreight+"]lrNo["+lrNo+"]");
if( totGwt != 0 ) // lc_tot_gwt <> 0 then
{
calcFrt = Math.round((( totalFreight * grossWeight) / totGwt));
}//end if
System.out.println("calcFrt["+calcFrt+"]"); //calculating the freight amt proportionately
//this is to check whether total calculated freight doesnot exceed System.out.println("@@@@totGwt["+totGwt+"]::totalFreight["+totalFreight+"]lrNo["+lrNo+"]");
//the total freight during rounding the figure if( totGwt != 0 ) // lc_tot_gwt <> 0 then
{
calcFrt = Math.round((( totalFreight * grossWeight) / totGwt));
}//end if
totFrt = totFrt + calcFrt; System.out.println("calcFrt["+calcFrt+"]");
System.out.println("totFrt["+totFrt+"]"); //this is to check whether total calculated freight doesnot exceed
if( totFrt > totalFreight ) // lc_tot_frt > lc_frt_amt then //the total freight during rounding the figure
{
calcFrt = totalFreight - ( totFrt - calcFrt ) ;
}
System.out.println("calcFrt["+calcFrt+"]totalFreight["+totalFreight+"]totFrt["+totFrt+"]"); totFrt = totFrt + calcFrt;
System.out.println("totFrt["+totFrt+"]");
if( totFrt > totalFreight ) // lc_tot_frt > lc_frt_amt then
{
calcFrt = totalFreight - ( totFrt - calcFrt ) ;
}
if( lrDate != null ) System.out.println("calcFrt["+calcFrt+"]totalFreight["+totalFreight+"]totFrt["+totFrt+"]");
{
lrDateUpd = lrDate;
}
if( lrNo != null ) if( lrDate != null )
{ {
lrNoUpd = lrNo; lrDateUpd = lrDate;
} }
if( lorryNo != null ) if( lrNo != null )
{ {
lorryNoUpd = lorryNo; lrNoUpd = lrNo;
} }
System.out.println("@@@@@@[distord_iss]::lrDate["+lrDate+"]lrNo["+lrNo+"]lorryNo["+lorryNo+"]"); if( lorryNo != null )
System.out.println("@@@@@@[distord_iss]::lrDateUpd["+lrDateUpd+"]lrNoUpd["+lrNoUpd+"]lorryNoUpd["+lorryNoUpd+"]"); {
lorryNoUpd = lorryNo;
}
sql = " update distord_iss set frt_amt = ?, lr_no = ? , " + System.out.println("@@@@@@[distord_iss]::lrDate["+lrDate+"]lrNo["+lrNo+"]lorryNo["+lorryNo+"]");
" lr_date = ?, lorry_no = ? " + System.out.println("@@@@@@[distord_iss]::lrDateUpd["+lrDateUpd+"]lrNoUpd["+lrNoUpd+"]lorryNoUpd["+lorryNoUpd+"]");
" where tran_id = ? ";
pstmt = conn.prepareStatement(sql); sql1 = " update distord_iss set frt_amt = ?, lr_no = ? , " +
pstmt.setDouble(1, calcFrt); " lr_date = ?, lorry_no = ? " +
pstmt.setString(2, lrNoUpd); " where tran_id = ? ";
pstmt.setTimestamp(3, lrDateUpd); pstmt1 = conn.prepareStatement(sql1);
pstmt.setString(4, lorryNoUpd); pstmt1.setDouble(1, calcFrt);
pstmt.setString(5, distOrdIssId); pstmt1.setString(2, lrNoUpd);
updCnt = pstmt.executeUpdate(); pstmt1.setTimestamp(3, lrDateUpd);
pstmt1.setString(4, lorryNoUpd);
pstmt1.setString(5, distOrdIssId);
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,64 +477,67 @@ public class ShipmentLocConf extends ActionHandlerEJB implements ShipmentLocConf ...@@ -482,64 +477,67 @@ 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("@@@@totGwt["+totGwt+"]::totalFreight["+totalFreight+"]lrNo["+lrNo+"]"); System.out.println("@@@@conOrdIssId["+conOrdIssId+"]::grossWeight["+grossWeight+"]lrDate["+lrDate+"]");
if( totGwt != 0 ) // lc_tot_gwt <> 0 then
{
calcFrt = Math.round((( totalFreight * grossWeight) / totGwt));
}//end if
System.out.println("calcFrt["+calcFrt+"]"); System.out.println("@@@@totGwt["+totGwt+"]::totalFreight["+totalFreight+"]lrNo["+lrNo+"]");
if( totGwt != 0 ) // lc_tot_gwt <> 0 then
{
calcFrt = Math.round((( totalFreight * grossWeight) / totGwt));
}//end if
totFrt = totFrt + calcFrt; System.out.println("calcFrt["+calcFrt+"]");
System.out.println("totFrt["+totFrt+"]");
if( totFrt > totalFreight ) // lc_tot_frt > lc_frt_amt then
{
calcFrt = totalFreight - ( totFrt - calcFrt ) ;
}
System.out.println("calcFrt["+calcFrt+"]totalFreight["+totalFreight+"]totFrt["+totFrt+"]"); totFrt = totFrt + calcFrt;
System.out.println("totFrt["+totFrt+"]");
if( totFrt > totalFreight ) // lc_tot_frt > lc_frt_amt then
{
calcFrt = totalFreight - ( totFrt - calcFrt ) ;
}
if( lrDate != null ) System.out.println("calcFrt["+calcFrt+"]totalFreight["+totalFreight+"]totFrt["+totFrt+"]");
{
lrDateUpd = lrDate;
}
if( lrNo != null ) if( lrDate != null )
{ {
lrNoUpd = lrNo; lrDateUpd = lrDate;
} }
if( lorryNo != null ) if( lrNo != null )
{ {
lorryNoUpd = lorryNo; lrNoUpd = lrNo;
} }
System.out.println("@@@@@@[distord_iss]::lrDate["+lrDate+"]lrNo["+lrNo+"]lorryNo["+lorryNo+"]"); if( lorryNo != null )
System.out.println("@@@@@@[distord_iss]::lrDateUpd["+lrDateUpd+"]lrNoUpd["+lrNoUpd+"]lorryNoUpd["+lorryNoUpd+"]"); {
lorryNoUpd = lorryNo;
}
sql = " update CONSUME_ISS set FREIGHT_AMT = ?, lr_no = ? , " + System.out.println("@@@@@@[distord_iss]::lrDate["+lrDate+"]lrNo["+lrNo+"]lorryNo["+lorryNo+"]");
" lr_date = ?, lorry_no = ? " + System.out.println("@@@@@@[distord_iss]::lrDateUpd["+lrDateUpd+"]lrNoUpd["+lrNoUpd+"]lorryNoUpd["+lorryNoUpd+"]");
" where cons_issue = ? ";
pstmt = conn.prepareStatement(sql); sql1 = " update CONSUME_ISS set FREIGHT_AMT = ?, lr_no = ? , " +
pstmt.setDouble(1, calcFrt); " lr_date = ?, lorry_no = ? " +
pstmt.setString(2, lrNoUpd); " where cons_issue = ? ";
pstmt.setTimestamp(3, lrDateUpd); pstmt1 = conn.prepareStatement(sql1);
pstmt.setString(4, lorryNoUpd); pstmt1.setDouble(1, calcFrt);
pstmt.setString(5, conOrdIssId); pstmt1.setString(2, lrNoUpd);
updCnt = pstmt.executeUpdate(); pstmt1.setTimestamp(3, lrDateUpd);
pstmt1.setString(4, lorryNoUpd);
pstmt1.setString(5, conOrdIssId);
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 )
{ {
...@@ -617,38 +616,38 @@ public class ShipmentLocConf extends ActionHandlerEJB implements ShipmentLocConf ...@@ -617,38 +616,38 @@ public class ShipmentLocConf extends ActionHandlerEJB implements ShipmentLocConf
} }
return errCode; return errCode;
} }
/*public String actionHandler(String tranId) throws RemoteException, ITMException /*public String actionHandler(String tranId) throws RemoteException, ITMException
{ {
String retString = ""; String retString = "";
try try
{ {
//retString = checkNull(split(tranId, xtraParams, forcedFlag,conn,subSQL)); //retString = checkNull(split(tranId, xtraParams, forcedFlag,conn,subSQL));
retString = checkNull(split(tranId)); retString = checkNull(split(tranId));
System.out.println("@@@@@@retString is :"+retString); System.out.println("@@@@@@retString is :"+retString);
} }
catch(Exception e) catch(Exception e)
{ {
e.printStackTrace(); e.printStackTrace();
System.out.println("Exception ::"+e.getMessage()); System.out.println("Exception ::"+e.getMessage());
} }
return retString; return retString;
}*/ }*/
//public String split(String tranId,String xtraParams,String forcedFlag, Connection conn,String subSQL) throws RemoteException, ITMException //public String split(String tranId,String xtraParams,String forcedFlag, Connection conn,String subSQL) throws RemoteException, ITMException
public String generateTrackInfo(String tranId,Connection conn) throws RemoteException, ITMException public String generateTrackInfo(String tranId,Connection conn) throws RemoteException, ITMException
{ {
String retString = ""; String retString = "";
String errString=""; String errString="";
StringBuffer xmlBuff = null; StringBuffer xmlBuff = null;
...@@ -658,7 +657,7 @@ public class ShipmentLocConf extends ActionHandlerEJB implements ShipmentLocConf ...@@ -658,7 +657,7 @@ public class ShipmentLocConf extends ActionHandlerEJB implements ShipmentLocConf
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
ResultSet rs = null, rs1 = null; ResultSet rs = null, rs1 = null;
String lineNoStr = "",frtTerm = ""; String lineNoStr = "",frtTerm = "";
String refId="",custCodeDlv="",dlvAdd1="",dlvAdd2="",dlvCity="",dlvPin="",dlvCountry="",siteDescr="",siteAdd1="",siteAdd2="",siteCity="",sitePin="",noArt=""; String refId="",custCodeDlv="",dlvAdd1="",dlvAdd2="",dlvCity="",dlvPin="",dlvCountry="",siteDescr="",siteAdd1="",siteAdd2="",siteCity="",sitePin="",noArt="";
String tranCode="",grossWt="",tarewt="",netwt="",unitShip="",bolNo="",scac="",planStartDt="",planEndDt="",shipMtDt="",expDt=""; String tranCode="",grossWt="",tarewt="",netwt="",unitShip="",bolNo="",scac="",planStartDt="",planEndDt="",shipMtDt="",expDt="";
String despatchId="",invoiceId="",itemCode="",lotNo="",lotSl="",quantity="",quantityOrd="",convQtyStduom="",unitStd=""; String despatchId="",invoiceId="",itemCode="",lotNo="",lotSl="",quantity="",quantityOrd="",convQtyStduom="",unitStd="";
...@@ -688,24 +687,24 @@ public class ShipmentLocConf extends ActionHandlerEJB implements ShipmentLocConf ...@@ -688,24 +687,24 @@ public class ShipmentLocConf extends ActionHandlerEJB implements ShipmentLocConf
SimpleDateFormat sdf = new SimpleDateFormat(genericUtility.getApplDateFormat()); SimpleDateFormat sdf = new SimpleDateFormat(genericUtility.getApplDateFormat());
SimpleDateFormat sdf1 = new SimpleDateFormat(genericUtility.getDBDateFormat()); SimpleDateFormat sdf1 = new SimpleDateFormat(genericUtility.getDBDateFormat());
conn = connDriver.getConnectDB( "DriverITM" ); conn = connDriver.getConnectDB( "DriverITM" );
sql = "select shipment_date from shipment where shipment_id=?"; sql = "select shipment_date 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())
{ {
shipmentDate = rs.getDate("shipment_date"); shipmentDate = rs.getDate("shipment_date");
} }
rs.close(); rs.close();
rs = null; rs = null;
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
System.out.println("shipmentDate:"+shipmentDate); System.out.println("shipmentDate:"+shipmentDate);
sql = "select SITE_CODE,CUST_CODE__DLV,DLV_ADD1,DLV_ADD2,DLV_CITY,DLV_PIN,COUNT_CODE__DLV,TRAN_CODE , "; sql = "select SITE_CODE,CUST_CODE__DLV,DLV_ADD1,DLV_ADD2,DLV_CITY,DLV_PIN,COUNT_CODE__DLV,TRAN_CODE , ";
sql = sql + "GROSS_WEIGHT,TARE_WEIGHT ,NETT_WEIGHT,UNIT__SHIP,BOL_NO,SCAC,NO_ART,DESP_ID from despatch where shipment_id=? "; sql = sql + "GROSS_WEIGHT,TARE_WEIGHT ,NETT_WEIGHT,UNIT__SHIP,BOL_NO,SCAC,NO_ART,DESP_ID from despatch where shipment_id=? ";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
...@@ -736,7 +735,7 @@ public class ShipmentLocConf extends ActionHandlerEJB implements ShipmentLocConf ...@@ -736,7 +735,7 @@ public class ShipmentLocConf extends ActionHandlerEJB implements ShipmentLocConf
errString = itmDBAccessLocal.getErrorString("","VTSHIDEXST",""); errString = itmDBAccessLocal.getErrorString("","VTSHIDEXST","");
return errString; return errString;
} }
rs.close(); rs.close();
rs = null; rs = null;
pstmt.close(); pstmt.close();
...@@ -746,10 +745,10 @@ public class ShipmentLocConf extends ActionHandlerEJB implements ShipmentLocConf ...@@ -746,10 +745,10 @@ public class ShipmentLocConf extends ActionHandlerEJB implements ShipmentLocConf
System.out.println("tranCode @@@"+tranCode); System.out.println("tranCode @@@"+tranCode);
System.out.println("noArt @@@"+noArt); System.out.println("noArt @@@"+noArt);
System.out.println("scac @@@"+scac); System.out.println("scac @@@"+scac);
sql = "select descr,add1,add2,city,pin from site where site_code=?"; sql = "select descr,add1,add2,city,pin from site where site_code=?";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, siteCode); pstmt.setString(1, siteCode);
...@@ -771,9 +770,9 @@ public class ShipmentLocConf extends ActionHandlerEJB implements ShipmentLocConf ...@@ -771,9 +770,9 @@ public class ShipmentLocConf extends ActionHandlerEJB implements ShipmentLocConf
System.out.println("siteAdd2:"+siteAdd2); System.out.println("siteAdd2:"+siteAdd2);
System.out.println("siteCity:"+siteCity); System.out.println("siteCity:"+siteCity);
System.out.println("sitePin:"+sitePin); System.out.println("sitePin:"+sitePin);
sql = "select DRUG_LIC_NO from customer where cust_code=?"; sql = "select DRUG_LIC_NO from customer where cust_code=?";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, custCodeDlv); pstmt.setString(1, custCodeDlv);
...@@ -787,11 +786,11 @@ public class ShipmentLocConf extends ActionHandlerEJB implements ShipmentLocConf ...@@ -787,11 +786,11 @@ public class ShipmentLocConf extends ActionHandlerEJB implements ShipmentLocConf
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
System.out.println("drugLicNo:"+drugLicNo); System.out.println("drugLicNo:"+drugLicNo);
System.out.println("siteCode!!!!! :"+siteCode); System.out.println("siteCode!!!!! :"+siteCode);
System.out.println("siteDescr :"+siteDescr); System.out.println("siteDescr :"+siteDescr);
System.out.println("siteAdd1 :"+siteAdd1); System.out.println("siteAdd1 :"+siteAdd1);
...@@ -813,8 +812,8 @@ public class ShipmentLocConf extends ActionHandlerEJB implements ShipmentLocConf ...@@ -813,8 +812,8 @@ public class ShipmentLocConf extends ActionHandlerEJB implements ShipmentLocConf
System.out.println("bolNo :"+bolNo); System.out.println("bolNo :"+bolNo);
System.out.println("scac :"+scac); System.out.println("scac :"+scac);
System.out.println("noArt :"+noArt); System.out.println("noArt :"+noArt);
sql = "select plan_end,plan_start from shipment_route where shipment_id=? "; sql = "select plan_end,plan_start from shipment_route where shipment_id=? ";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, tranId); pstmt.setString(1, tranId);
...@@ -830,12 +829,12 @@ public class ShipmentLocConf extends ActionHandlerEJB implements ShipmentLocConf ...@@ -830,12 +829,12 @@ public class ShipmentLocConf extends ActionHandlerEJB implements ShipmentLocConf
pstmt = null; pstmt = null;
System.out.println("planStart:"+planStart); System.out.println("planStart:"+planStart);
System.out.println("planEnd:"+planEnd); System.out.println("planEnd:"+planEnd);
/*get records for details !!!*/ /*get records for details !!!*/
sql = "select ref_id,ref_ser from ship_docs where shipment_id=?"; sql = "select ref_id,ref_ser from ship_docs where shipment_id=?";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, tranId); pstmt.setString(1, tranId);
...@@ -852,15 +851,15 @@ public class ShipmentLocConf extends ActionHandlerEJB implements ShipmentLocConf ...@@ -852,15 +851,15 @@ public class ShipmentLocConf extends ActionHandlerEJB implements ShipmentLocConf
pstmt = null; pstmt = null;
System.out.println("refId:"+refId); System.out.println("refId:"+refId);
System.out.println("refSer:"+refSer); System.out.println("refSer:"+refSer);
if(despatchId == null) if(despatchId == null)
{ {
System.out.println("despatchId found null in ship_docs"); System.out.println("despatchId found null in ship_docs");
errString = itmDBAccessLocal.getErrorString("","VTDSIDEXST",""); errString = itmDBAccessLocal.getErrorString("","VTDSIDEXST","");
return errString; return errString;
} }
sql = "select INVOICE_ID ,ITEM_CODE ,LOT_NO ,LOT_SL,QUANTITY ,QUANTITY__ORD,LOC_CODE,CONV__QTY_STDUOM , "; sql = "select INVOICE_ID ,ITEM_CODE ,LOT_NO ,LOT_SL,QUANTITY ,QUANTITY__ORD,LOC_CODE,CONV__QTY_STDUOM , ";
sql = sql + "UNIT__STD,UNIT ,QUANTITY__STDUOM ,PACK_QTY,GROSS_WEIGHT,TARE_WEIGHT,NETT_WEIGHT,SSCC_18 "; sql = sql + "UNIT__STD,UNIT ,QUANTITY__STDUOM ,PACK_QTY,GROSS_WEIGHT,TARE_WEIGHT,NETT_WEIGHT,SSCC_18 ";
...@@ -887,8 +886,8 @@ public class ShipmentLocConf extends ActionHandlerEJB implements ShipmentLocConf ...@@ -887,8 +886,8 @@ public class ShipmentLocConf extends ActionHandlerEJB implements ShipmentLocConf
tareWt = rs.getString("TARE_WEIGHT"); tareWt = rs.getString("TARE_WEIGHT");
netWt = rs.getString("NETT_WEIGHT"); netWt = rs.getString("NETT_WEIGHT");
sscc_18 = rs.getString("SSCC_18"); sscc_18 = rs.getString("SSCC_18");
invoiceId = invoiceId==null?"":invoiceId.trim(); invoiceId = invoiceId==null?"":invoiceId.trim();
itemCode = itemCode==null?"":itemCode.trim(); itemCode = itemCode==null?"":itemCode.trim();
lotNo = lotNo==null?"":lotNo.trim(); lotNo = lotNo==null?"":lotNo.trim();
...@@ -901,7 +900,7 @@ public class ShipmentLocConf extends ActionHandlerEJB implements ShipmentLocConf ...@@ -901,7 +900,7 @@ public class ShipmentLocConf extends ActionHandlerEJB implements ShipmentLocConf
qtyStduom = qtyStduom==null?"":qtyStduom.trim(); qtyStduom = qtyStduom==null?"":qtyStduom.trim();
locCode = locCode==null?"":locCode.trim(); locCode = locCode==null?"":locCode.trim();
sscc_18 = sscc_18==null?"":sscc_18.trim(); sscc_18 = sscc_18==null?"":sscc_18.trim();
System.out.println("invoiceId @@"+cnt+" "+invoiceId); System.out.println("invoiceId @@"+cnt+" "+invoiceId);
System.out.println("itemCode @@"+cnt+" "+itemCode); System.out.println("itemCode @@"+cnt+" "+itemCode);
System.out.println("lotNo @@"+cnt+" "+lotNo); System.out.println("lotNo @@"+cnt+" "+lotNo);
...@@ -911,7 +910,7 @@ public class ShipmentLocConf extends ActionHandlerEJB implements ShipmentLocConf ...@@ -911,7 +910,7 @@ public class ShipmentLocConf extends ActionHandlerEJB implements ShipmentLocConf
System.out.println("convQtyStduom @@"+cnt+" "+convQtyStduom); System.out.println("convQtyStduom @@"+cnt+" "+convQtyStduom);
System.out.println("unitStd @@"+cnt+" "+unitStd); System.out.println("unitStd @@"+cnt+" "+unitStd);
System.out.println("unit @@"+cnt+" "+unit); System.out.println("unit @@"+cnt+" "+unit);
tempMap.put("invoice_id"+cnt, invoiceId); tempMap.put("invoice_id"+cnt, invoiceId);
tempMap.put("item_code"+cnt, itemCode); tempMap.put("item_code"+cnt, itemCode);
tempMap.put("lot_no"+cnt, lotNo); tempMap.put("lot_no"+cnt, lotNo);
...@@ -927,18 +926,18 @@ public class ShipmentLocConf extends ActionHandlerEJB implements ShipmentLocConf ...@@ -927,18 +926,18 @@ public class ShipmentLocConf extends ActionHandlerEJB implements ShipmentLocConf
tempMap.put("gross_wt"+cnt, grossWt); tempMap.put("gross_wt"+cnt, grossWt);
tempMap.put("tare_wt"+cnt, tareWt); tempMap.put("tare_wt"+cnt, tareWt);
tempMap.put("net_wt"+cnt, netWt); tempMap.put("net_wt"+cnt, netWt);
} }
rs.close(); rs.close();
rs = null; rs = null;
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
System.out.println("value of cnt :"+cnt); System.out.println("value of cnt :"+cnt);
sql = "select CUST_PORD,PORD_DATE from sorder where sale_order = (select sord_no from despatch where desp_id=?)"; sql = "select CUST_PORD,PORD_DATE from sorder where sale_order = (select sord_no from despatch where desp_id=?)";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, despatchId); pstmt.setString(1, despatchId);
...@@ -947,7 +946,7 @@ public class ShipmentLocConf extends ActionHandlerEJB implements ShipmentLocConf ...@@ -947,7 +946,7 @@ public class ShipmentLocConf extends ActionHandlerEJB implements ShipmentLocConf
{ {
custProd = rs.getString("CUST_PORD"); custProd = rs.getString("CUST_PORD");
prodDate = rs.getDate("PORD_DATE"); prodDate = rs.getDate("PORD_DATE");
} }
rs.close(); rs.close();
rs = null; rs = null;
...@@ -955,8 +954,8 @@ public class ShipmentLocConf extends ActionHandlerEJB implements ShipmentLocConf ...@@ -955,8 +954,8 @@ public class ShipmentLocConf extends ActionHandlerEJB implements ShipmentLocConf
pstmt = null; pstmt = null;
System.out.println("custProd: "+custProd); System.out.println("custProd: "+custProd);
System.out.println("prodDate: "+prodDate); System.out.println("prodDate: "+prodDate);
siteCode = siteCode==null?"":siteCode.trim(); siteCode = siteCode==null?"":siteCode.trim();
siteDescr = siteDescr==null?"":siteDescr.trim(); siteDescr = siteDescr==null?"":siteDescr.trim();
siteAdd1 = siteAdd1==null?"":siteAdd1.trim(); siteAdd1 = siteAdd1==null?"":siteAdd1.trim();
...@@ -983,12 +982,12 @@ public class ShipmentLocConf extends ActionHandlerEJB implements ShipmentLocConf ...@@ -983,12 +982,12 @@ public class ShipmentLocConf extends ActionHandlerEJB implements ShipmentLocConf
shipMtDt=shipmentDate==null?"":sdf.format(shipmentDate); shipMtDt=shipmentDate==null?"":sdf.format(shipmentDate);
custProd = custProd==null?"":custProd.trim(); custProd = custProd==null?"":custProd.trim();
purcDate= prodDate==null?"":sdf.format(prodDate); purcDate= prodDate==null?"":sdf.format(prodDate);
//create xml for track information //create xml for track information
xmlBuff.append("<?xml version='1.0' encoding='ISO-8859-1'?>\n"); xmlBuff.append("<?xml version='1.0' encoding='ISO-8859-1'?>\n");
xmlBuff.append("<DocumentRoot>"); xmlBuff.append("<DocumentRoot>");
...@@ -1009,12 +1008,12 @@ public class ShipmentLocConf extends ActionHandlerEJB implements ShipmentLocConf ...@@ -1009,12 +1008,12 @@ public class ShipmentLocConf extends ActionHandlerEJB implements ShipmentLocConf
xmlBuff.append("<forcedSave><![CDATA[").append(true).append("]]></forcedSave>"); xmlBuff.append("<forcedSave><![CDATA[").append(true).append("]]></forcedSave>");
xmlBuff.append("<taxInFocus><![CDATA[").append(false).append("]]></taxInFocus>"); xmlBuff.append("<taxInFocus><![CDATA[").append(false).append("]]></taxInFocus>");
xmlBuff.append("<description>").append("Header0 members").append("</description>"); xmlBuff.append("<description>").append("Header0 members").append("</description>");
System.out.println("details 1 start!!!!!"); System.out.println("details 1 start!!!!!");
/* /*
* deatails 1 start * deatails 1 start
* */ * */
xmlBuff.append("<Detail1 dbID=\"\" domID=\"1\" objName=\"tnt_tran_info\" objContext=\"1\">"); xmlBuff.append("<Detail1 dbID=\"\" domID=\"1\" objName=\"tnt_tran_info\" objContext=\"1\">");
xmlBuff.append("<attribute selected=\"N\" updateFlag=\"A\" status=\"N\" pkNames=\"\"/>"); xmlBuff.append("<attribute selected=\"N\" updateFlag=\"A\" status=\"N\" pkNames=\"\"/>");
xmlBuff.append("<tran_id/>"); xmlBuff.append("<tran_id/>");
...@@ -1045,32 +1044,32 @@ public class ShipmentLocConf extends ActionHandlerEJB implements ShipmentLocConf ...@@ -1045,32 +1044,32 @@ public class ShipmentLocConf extends ActionHandlerEJB implements ShipmentLocConf
xmlBuff.append("<count_code__dlv><![CDATA["+ dlvCountry +"]]></count_code__dlv>"); xmlBuff.append("<count_code__dlv><![CDATA["+ dlvCountry +"]]></count_code__dlv>");
xmlBuff.append("<plan_start><![CDATA["+ planStartDt +"]]></plan_start>"); xmlBuff.append("<plan_start><![CDATA["+ planStartDt +"]]></plan_start>");
xmlBuff.append("<plan_end><![CDATA["+ planEndDt +"]]></plan_end>"); xmlBuff.append("<plan_end><![CDATA["+ planEndDt +"]]></plan_end>");
// xmlBuff.append("<remarks><![CDATA["+ tranId +"]]></remarks>"); // xmlBuff.append("<remarks><![CDATA["+ tranId +"]]></remarks>");
xmlBuff.append("</Detail1>"); xmlBuff.append("</Detail1>");
lineNo = 0; lineNo = 0;
/* /*
* deatils1 end * deatils1 end
* *
* */ * */
System.out.println("end of details 1"); System.out.println("end of details 1");
for(int itemCtr = 1; itemCtr <= cnt; itemCtr++) for(int itemCtr = 1; itemCtr <= cnt; itemCtr++)
{ {
lineNo++; lineNo++;
System.out.println("lineNo is "+lineNo); System.out.println("lineNo is "+lineNo);
// tempMap = (HashMap)tempList.get(itemCtr); // tempMap = (HashMap)tempList.get(itemCtr);
/* /*
* start of Details 2 * start of Details 2
* */ * */
System.out.println("start of details 2"); System.out.println("start of details 2");
xmlBuff.append("<Detail2 dbID='' domID=\"1\" objName=\"tnt_tran_info\" objContext=\"2\">"); xmlBuff.append("<Detail2 dbID='' domID=\"1\" objName=\"tnt_tran_info\" objContext=\"2\">");
xmlBuff.append("<attribute pkNames=\"\" selected=\"N\" updateFlag=\"A\" status=\"N\" />"); xmlBuff.append("<attribute pkNames=\"\" selected=\"N\" updateFlag=\"A\" status=\"N\" />");
xmlBuff.append("<tran_id/>"); xmlBuff.append("<tran_id/>");
...@@ -1079,15 +1078,15 @@ public class ShipmentLocConf extends ActionHandlerEJB implements ShipmentLocConf ...@@ -1079,15 +1078,15 @@ public class ShipmentLocConf extends ActionHandlerEJB implements ShipmentLocConf
System.out.println("lineNoStr "+lineNoStr); System.out.println("lineNoStr "+lineNoStr);
// xmlBuff.append("<line_no>" + new Integer(lineNo).toString().length() + "</line_no>"); // xmlBuff.append("<line_no>" + new Integer(lineNo).toString().length() + "</line_no>");
xmlBuff.append("<line_no>" + lineNoStr + "</line_no>"); xmlBuff.append("<line_no>" + lineNoStr + "</line_no>");
xmlBuff.append("<ref_ser><![CDATA["+ refSer +"]]></ref_ser>"); xmlBuff.append("<ref_ser><![CDATA["+ refSer +"]]></ref_ser>");
xmlBuff.append("<ref_id><![CDATA["+ refId+"]]></ref_id>"); xmlBuff.append("<ref_id><![CDATA["+ refId+"]]></ref_id>");
System.out.println("val of invoice_id "+(String)tempMap.get("invoice_id"+itemCtr) ); System.out.println("val of invoice_id "+(String)tempMap.get("invoice_id"+itemCtr) );
System.out.println("val of item_code "+(String)tempMap.get("item_code"+itemCtr) ); System.out.println("val of item_code "+(String)tempMap.get("item_code"+itemCtr) );
xmlBuff.append("<invoice_id><![CDATA["+ (String)tempMap.get("invoice_id"+itemCtr) +"]]></invoice_id>"); xmlBuff.append("<invoice_id><![CDATA["+ (String)tempMap.get("invoice_id"+itemCtr) +"]]></invoice_id>");
xmlBuff.append("<item_code><![CDATA["+ (String)tempMap.get("item_code"+itemCtr) +"]]></item_code>"); xmlBuff.append("<item_code><![CDATA["+ (String)tempMap.get("item_code"+itemCtr) +"]]></item_code>");
sql = "select DESCR,ITEM_CODE__UPC,ITEM_CODE__NDC from item where item_code=?"; sql = "select DESCR,ITEM_CODE__UPC,ITEM_CODE__NDC from item where item_code=?";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, tempMap.get("item_code"+itemCtr)); pstmt.setString(1, tempMap.get("item_code"+itemCtr));
...@@ -1105,14 +1104,14 @@ public class ShipmentLocConf extends ActionHandlerEJB implements ShipmentLocConf ...@@ -1105,14 +1104,14 @@ public class ShipmentLocConf extends ActionHandlerEJB implements ShipmentLocConf
System.out.println("itmDescr: "+itmDescr); System.out.println("itmDescr: "+itmDescr);
System.out.println("itmCodeUPC: "+itmCodeUPC); System.out.println("itmCodeUPC: "+itmCodeUPC);
System.out.println("itmCodeNDC: "+itmCodeNDC); System.out.println("itmCodeNDC: "+itmCodeNDC);
itmDescr = itmDescr==null?"":itmDescr.trim(); itmDescr = itmDescr==null?"":itmDescr.trim();
itmCodeUPC = itmCodeUPC==null?"":itmCodeUPC.trim(); itmCodeUPC = itmCodeUPC==null?"":itmCodeUPC.trim();
itmCodeNDC = itmCodeNDC==null?"":itmCodeNDC.trim(); itmCodeNDC = itmCodeNDC==null?"":itmCodeNDC.trim();
sql = "select exp_date from ITEM_LOT_INFO where item_code=? and lot_no=? "; sql = "select exp_date from ITEM_LOT_INFO where item_code=? and lot_no=? ";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, tempMap.get("item_code"+itemCtr)); pstmt.setString(1, tempMap.get("item_code"+itemCtr));
...@@ -1121,7 +1120,7 @@ public class ShipmentLocConf extends ActionHandlerEJB implements ShipmentLocConf ...@@ -1121,7 +1120,7 @@ public class ShipmentLocConf extends ActionHandlerEJB implements ShipmentLocConf
if (rs.next()) if (rs.next())
{ {
expDate = rs.getDate("exp_date"); expDate = rs.getDate("exp_date");
} }
expDt=expDate==null?"":sdf.format(expDate); expDt=expDate==null?"":sdf.format(expDate);
rs.close(); rs.close();
...@@ -1131,13 +1130,13 @@ public class ShipmentLocConf extends ActionHandlerEJB implements ShipmentLocConf ...@@ -1131,13 +1130,13 @@ public class ShipmentLocConf extends ActionHandlerEJB implements ShipmentLocConf
System.out.println("itmDescr: "+itmDescr); System.out.println("itmDescr: "+itmDescr);
System.out.println("itmCodeUPC: "+itmCodeUPC); System.out.println("itmCodeUPC: "+itmCodeUPC);
System.out.println("itmCodeNDC: "+itmCodeNDC); System.out.println("itmCodeNDC: "+itmCodeNDC);
itmDescr = itmDescr==null?"":itmDescr.trim(); itmDescr = itmDescr==null?"":itmDescr.trim();
itmCodeUPC = itmCodeUPC==null?"":itmCodeUPC.trim(); itmCodeUPC = itmCodeUPC==null?"":itmCodeUPC.trim();
itmCodeNDC = itmCodeNDC==null?"":itmCodeNDC.trim(); itmCodeNDC = itmCodeNDC==null?"":itmCodeNDC.trim();
xmlBuff.append("<item_descr><![CDATA["+ itmDescr +"]]></item_descr>"); xmlBuff.append("<item_descr><![CDATA["+ itmDescr +"]]></item_descr>");
xmlBuff.append("<item_code__ndc><![CDATA["+ itmCodeNDC +"]]></item_code__ndc>"); xmlBuff.append("<item_code__ndc><![CDATA["+ itmCodeNDC +"]]></item_code__ndc>");
xmlBuff.append("<item_code__upc><![CDATA["+ itmCodeUPC +"]]></item_code__upc>"); xmlBuff.append("<item_code__upc><![CDATA["+ itmCodeUPC +"]]></item_code__upc>");
...@@ -1159,21 +1158,21 @@ public class ShipmentLocConf extends ActionHandlerEJB implements ShipmentLocConf ...@@ -1159,21 +1158,21 @@ public class ShipmentLocConf extends ActionHandlerEJB implements ShipmentLocConf
xmlBuff.append("<cust_pord><![CDATA["+ custProd +"]]></cust_pord>"); xmlBuff.append("<cust_pord><![CDATA["+ custProd +"]]></cust_pord>");
xmlBuff.append("<pord_date><![CDATA["+ purcDate +"]]></pord_date>"); xmlBuff.append("<pord_date><![CDATA["+ purcDate +"]]></pord_date>");
xmlBuff.append("<sscc_18><![CDATA["+ sscc_18 +"]]></sscc_18>"); xmlBuff.append("<sscc_18><![CDATA["+ sscc_18 +"]]></sscc_18>");
xmlBuff.append("</Detail2>"); xmlBuff.append("</Detail2>");
}//end of for loop }//end of for loop
/* /*
* end of details 2 * end of details 2
* *
* */ * */
System.out.println("end of details 2"); System.out.println("end of details 2");
xmlBuff.append("</Header0>"); xmlBuff.append("</Header0>");
xmlBuff.append("</group0>"); xmlBuff.append("</group0>");
xmlBuff.append("</DocumentRoot>"); xmlBuff.append("</DocumentRoot>");
...@@ -1184,9 +1183,9 @@ public class ShipmentLocConf extends ActionHandlerEJB implements ShipmentLocConf ...@@ -1184,9 +1183,9 @@ public class ShipmentLocConf extends ActionHandlerEJB implements ShipmentLocConf
retString = saveData(siteCode,xmlString,conn); retString = saveData(siteCode,xmlString,conn);
System.out.println("#########2: retString:"+retString); System.out.println("#########2: retString:"+retString);
if (retString.indexOf("Success") > -1) if (retString.indexOf("Success") > -1)
{ {
System.out.println("Successfully!!!!!!"); System.out.println("Successfully!!!!!!");
...@@ -1197,27 +1196,27 @@ public class ShipmentLocConf extends ActionHandlerEJB implements ShipmentLocConf ...@@ -1197,27 +1196,27 @@ public class ShipmentLocConf extends ActionHandlerEJB implements ShipmentLocConf
{ {
System.out.println("failed!!!!"); System.out.println("failed!!!!");
conn.rollback(); conn.rollback();
errString = itmDBAccessLocal.getErrorString("","VTGTRTIFLD",""); errString = itmDBAccessLocal.getErrorString("","VTGTRTIFLD","");
return errString; return errString;
} }
} }
catch(Exception e) catch(Exception e)
{ {
e.printStackTrace(); e.printStackTrace();
System.out.println("Exception ::"+e.getMessage()); System.out.println("Exception ::"+e.getMessage());
} }
return retString; return retString;
} }
private String saveData(String siteCode,String xmlString, Connection conn) throws ITMException private String saveData(String siteCode,String xmlString, Connection conn) throws ITMException
{ {
System.out.println("mahendra testing !!!!saving data..........."); System.out.println("mahendra testing !!!!saving data...........");
...@@ -1251,11 +1250,11 @@ public class ShipmentLocConf extends ActionHandlerEJB implements ShipmentLocConf ...@@ -1251,11 +1250,11 @@ public class ShipmentLocConf extends ActionHandlerEJB implements ShipmentLocConf
} }
return retString; return retString;
} }
private String checkNull( String input ) private String checkNull( String input )
{ {
...@@ -1265,7 +1264,7 @@ public class ShipmentLocConf extends ActionHandlerEJB implements ShipmentLocConf ...@@ -1265,7 +1264,7 @@ public class ShipmentLocConf extends ActionHandlerEJB implements ShipmentLocConf
} }
return input; return input;
} }
} }
...@@ -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