Commit 26bb6362 authored by cpatil's avatar cpatil

modify code


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@95007 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 1c96624b
/********************************************************
Title : ShipmentLocIC
Date : 25/04/2014
Developer: chandrakant patil
req id : DI3GSUN047
********************************************************/
package ibase.webitm.ejb.dis;
import ibase.system.config.ConnDriver;
......@@ -145,22 +152,6 @@ public class ShipmentLocIC extends ValidatorEJB implements ShipmentLocICLocal, S
}
//if isnull(ldt_val) then errcode = 'VTSHPDT'
/*
amdDateStr = checkNull(genericUtility.getColumnValue("amd_date", dom));
siteCodeOrd = checkNull(genericUtility.getColumnValue("site_code__ord", dom));
System.out.println("@@@@ amd_date["+amdDateStr+"]");
if( amdDateStr == null || amdDateStr.length() == 0 )
{
amdDate= Timestamp.valueOf(genericUtility.getValidDateString(amdDateStr, genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat()) + " 00:00:00.0");
errCode = this.nfCheckPeriod("PUR", amdDate, siteCodeOrd);
if( errCode!= null && errCode.trim().length() > 0 )
{
//errCode = "VMORDTYNUL";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}
*/
}
if(childNodeName.equalsIgnoreCase("site_code"))
{
......@@ -311,11 +302,8 @@ public class ShipmentLocIC extends ValidatorEJB implements ShipmentLocICLocal, S
if( loadType != null && loadType.trim().length() > 0 )
{
//mVal1 = dw_edit.getitemstring(1,'stan_code__from')
stanCodeFrom = checkNull(genericUtility.getColumnValue("stan_code__from", dom));
//mVal2 = dw_edit.getitemstring(1,'stan_code__to')
stanCodeTo = checkNull(genericUtility.getColumnValue("stan_code__to", dom));
//mval3 = dw_edit.getitemstring(1,'frt_list')
frtList = checkNull(genericUtility.getColumnValue("frt_list", dom));
if( loadType != null && stanCodeFrom != null && stanCodeTo != null && frtList != null )
......@@ -358,12 +346,9 @@ public class ShipmentLocIC extends ValidatorEJB implements ShipmentLocICLocal, S
{
currCode = checkNull(genericUtility.getColumnValue("curr_code", dom));
//mVal = dw_edit.GetItemString(dw_edit.GetRow(),fldname)
if( currCode != null && currCode.trim().length() > 0 )
{
//len(trim(mVal)) > 0 and not isnull(mVal) then
isExistFlag = isExist("currency", "curr_code", currCode, conn);
//select count(1) into :ll_cnt from currency where curr_code = :mVal;
if ("FALSE".equalsIgnoreCase(isExistFlag) )
{
errCode = "VMCURR1";
......@@ -401,7 +386,6 @@ public class ShipmentLocIC extends ValidatorEJB implements ShipmentLocICLocal, S
if ( saleOrder != null && saleOrder.trim().length() > 0 )
{
isExistFlag = isExist("sorder", "sale_order", saleOrder, conn);
//select count(1) into :ll_cnt from currency where curr_code = :mVal;
if ("FALSE".equalsIgnoreCase(isExistFlag) )
{
errCode = "VTSORD1";
......@@ -411,8 +395,6 @@ public class ShipmentLocIC extends ValidatorEJB implements ShipmentLocICLocal, S
}
}
// select * from distroute where dist_route = '00006'
if(childNodeName.equalsIgnoreCase("dist_route"))
{
String distRoute = checkNull(genericUtility.getColumnValue("dist_route", dom));
......@@ -454,25 +436,9 @@ public class ShipmentLocIC extends ValidatorEJB implements ShipmentLocICLocal, S
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
else
{
/*
isExistFlag = isExist("distroute", "dist_route", chargeCode, conn);
if ("FALSE".equalsIgnoreCase(isExistFlag) )
{
errCode = "VTDISTRT1";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
*/
}
}
} // end for
break; // case 1 end
......@@ -633,7 +599,6 @@ public class ShipmentLocIC extends ValidatorEJB implements ShipmentLocICLocal, S
}
if( childNodeName.equalsIgnoreCase("tran_code") )
{
......@@ -817,7 +782,7 @@ public class ShipmentLocIC extends ValidatorEJB implements ShipmentLocICLocal, S
ConnDriver connDriver = new ConnDriver();
int currentFormNo =0;
String columnValue="",chgUser="",chgTerm="",itemCode="",itemDescr="", fSysDate = "",channelPartner="";
String columnValue="";
String siteCode="",siteCodeDescr="",tranCode="",tranName="",currCode="",frtList="",reStr="",stanCodeFrom="",stanCodeTo="";
String stanCodeDescr="",distance="",frtDescr="",loadType="",frtTerm="",loadTypeDescr="";
......@@ -829,16 +794,12 @@ public class ShipmentLocIC extends ValidatorEJB implements ShipmentLocICLocal, S
String gencodesDescr="",mode="",chargeAdd="",sequence="",chargeAdd1="",stanCodeShip="",stationaDescr="";
String tranCodeDescr="",stanCodeDlv="",stanCodeDlvDescr="",currCodeBc="",currCodeFrt="",currCodeFrtDescr="";
String currCodeBcDescr="",exchRateDescr="",transporterTranName="",refId="",refSer="",stanCode="",siteCodeDlv="";
double amount=0,noOfLr=0,extraDlv=0,netWeight=0,nettWeight=0,exchRateFrt=0,tareWeight=0 ;
double amount=0,noOfLr=0,extraDlv=0,netWeight=0,nettWeight=0,exchRateFrt=0,tareWeight=0,grossWeightCIss=0 ;
int i=0,noArt=0;
Timestamp despDate=null;
try
{
//Calendar currentDate = Calendar.getInstance();
//SimpleDateFormat sdf = new SimpleDateFormat(genericUtility.getApplDateFormat());
//String sysDate = sdf.format(currentDate.getTime());
//System.out.println("Now the date is :=> " + sysDate);
Calendar currentDate = Calendar.getInstance();
SimpleDateFormat sdf = new SimpleDateFormat(genericUtility.getApplDateFormat());
......@@ -940,6 +901,7 @@ public class ShipmentLocIC extends ValidatorEJB implements ShipmentLocICLocal, S
valueXmlString.append(reStr);
valueXmlString.append("<frt_list>").append("<![CDATA["+frtList+"]]>").append("</frt_list>");
setNodeValue(dom, "frt_list", checkNull(frtList));
reStr = itemChanged(dom, dom1, dom2, objContext, "curr_code", editFlag, xtraParams);
pos = reStr.indexOf("<Detail1>");
......@@ -948,7 +910,6 @@ public class ShipmentLocIC extends ValidatorEJB implements ShipmentLocICLocal, S
reStr = reStr.substring(0, pos);
valueXmlString.append(reStr);
// dw_edit.setcolumn("stan_code__from") // doubt
}
else if( currentColumn.trim().equalsIgnoreCase("stan_code__from"))
......@@ -980,9 +941,18 @@ public class ShipmentLocIC extends ValidatorEJB implements ShipmentLocICLocal, S
pstmt = null;
valueXmlString.append("<distance>").append("<![CDATA["+distance+"]]>").append("</distance>");
loadType = genericUtility.getColumnValue("load_type", dom);
setNodeValue(dom, "load_type", checkNull(loadType));
reStr = itemChanged(dom, dom1, dom2, objContext, "load_type", editFlag, xtraParams);
pos = reStr.indexOf("<Detail1>");
reStr = reStr.substring(pos + 9);
pos = reStr.indexOf("</Detail1>");
reStr = reStr.substring(0, pos);
valueXmlString.append(reStr);
}
// doubt gbf_itemchanged_logic(as_form_no,"load_type",as_editflag)
}
else if( currentColumn.trim().equalsIgnoreCase("stan_code__to"))
......@@ -1015,9 +985,18 @@ public class ShipmentLocIC extends ValidatorEJB implements ShipmentLocICLocal, S
pstmt = null;
valueXmlString.append("<distance>").append("<![CDATA["+distance+"]]>").append("</distance>");
loadType = genericUtility.getColumnValue("load_type", dom);
setNodeValue(dom, "load_type", checkNull(loadType));
reStr = itemChanged(dom, dom1, dom2, objContext, "load_type", editFlag, xtraParams);
pos = reStr.indexOf("<Detail1>");
reStr = reStr.substring(pos + 9);
pos = reStr.indexOf("</Detail1>");
reStr = reStr.substring(0, pos);
valueXmlString.append(reStr);
}
// doubt gbf_itemchanged_logic(as_form_no,"load_type",as_editflag)
}
......@@ -1047,7 +1026,14 @@ public class ShipmentLocIC extends ValidatorEJB implements ShipmentLocICLocal, S
valueXmlString.append("<freight_list_descr>").append("<![CDATA["+frtDescr+"]]>").append("</freight_list_descr>");
valueXmlString.append("<load_type>").append("<![CDATA["+loadType+"]]>").append("</load_type>");
// doubt gbf_itemchanged_logic(as_form_no,"load_type",as_editflag)
setNodeValue(dom, "load_type", checkNull(loadType));
reStr = itemChanged(dom, dom1, dom2, objContext, "load_type", editFlag, xtraParams);
pos = reStr.indexOf("<Detail1>");
reStr = reStr.substring(pos + 9);
pos = reStr.indexOf("</Detail1>");
reStr = reStr.substring(0, pos);
valueXmlString.append(reStr);
}
else if( currentColumn.trim().equalsIgnoreCase("load_type"))
......@@ -1081,7 +1067,6 @@ public class ShipmentLocIC extends ValidatorEJB implements ShipmentLocICLocal, S
{
sql = " select std_pick_up,std_transit_time,transit_type,basic_freight,freight_type,min_value" +
// " into :lc_pick_up,:lc_tran_time,:ls_tran_type,:lc_basic,:ls_frt_type,:lc_minval " +
" from freight_rate where frt_list = ? and load_type = ? " +
" and stan_code__from = ? and stan_code__to = ? ";
pstmt = conn.prepareStatement(sql);
......@@ -1118,7 +1103,7 @@ public class ShipmentLocIC extends ValidatorEJB implements ShipmentLocICLocal, S
else if("G".equalsIgnoreCase(freightType)) //ls_frt_type = 'G' then
{
shipmentId = genericUtility.getColumnValue("shipment_id", dom);
//ls_shipment = dw_edit.GetItemString(ll_row, 'shipment_id')
if( shipmentId != null ) //not isnull(ls_shipment) then
{
sql = " select nvl(sum(gross_weight),0) from despatch " +
......@@ -1152,21 +1137,33 @@ public class ShipmentLocIC extends ValidatorEJB implements ShipmentLocICLocal, S
pstmt = null;
freightAmt = basicFreight * ( grossWeight + grossDist );
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+"]");
freightAmt = basicFreight * ( grossWeight + grossDist + grossWeightCIss );
if( freightAmt > minValue ) // lc_val > lc_minval then
{
valueXmlString.append("<freight_amt>").append("<![CDATA["+freightAmt+"]]>").append("</freight_amt>");
basicFreight = freightAmt ;
//dw_edit.setitem(1,'freight_amt',lc_val)
//lc_basic = lc_val
}
else
{
valueXmlString.append("<freight_amt>").append("<![CDATA["+minValue+"]]>").append("</freight_amt>");
basicFreight = minValue ;
//dw_edit.setitem(1,'freight_amt',lc_minval)
//lc_basic = lc_minval
} //end if
} //end if
}
......@@ -1175,9 +1172,7 @@ public class ShipmentLocIC extends ValidatorEJB implements ShipmentLocICLocal, S
valueXmlString.append("<freight_amt>").append("0.000").append("</freight_amt>");
} //end if
//lc_add_chgs = dw_edit.GetItemNumber(1,'add_chgs')
String addChgsStr = genericUtility.getColumnValue("add_chgs", dom)==null?"0":genericUtility.getColumnValue("add_chgs", dom);
//addChgsStr = addChgsStr==null?"0":addChgsStr;
addChgs = Double.parseDouble(addChgsStr);
freightAmt = basicFreight + addChgs;
valueXmlString.append("<total_freight>").append("<![CDATA["+freightAmt+"]]>").append("</total_freight>");
......@@ -1196,10 +1191,9 @@ public class ShipmentLocIC extends ValidatorEJB implements ShipmentLocICLocal, S
valueXmlString.append("<currency_descr>").append("<![CDATA["+currencyDescr+"]]>").append("</currency_descr>");
String shipmentDateStr = genericUtility.getColumnValue("shipment_date", dom);
//dw_edit.getitemdatetime(1,"shipment_date")
sql = " select a.curr_code from finent a, site b " +
" where b.fin_entity = a.fin_entity and b.site_code = :login_site ";
" where b.fin_entity = a.fin_entity and b.site_code = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,loginSiteCode );
......@@ -1242,10 +1236,10 @@ public class ShipmentLocIC extends ValidatorEJB implements ShipmentLocICLocal, S
valueXmlString.append("<total_freight>").append("<![CDATA["+exchRate+"]]>").append("</total_freight>");
}
else if( currentColumn.trim().equalsIgnoreCase("gross_weight") || currentColumn.trim().equalsIgnoreCase("tare_weight"))
{
//else if( currentColumn.trim().equalsIgnoreCase("gross_weight") || currentColumn.trim().equalsIgnoreCase("tare_weight"))
//{
// no code in pb
}
//}
// case 1 end
......@@ -1279,7 +1273,6 @@ public class ShipmentLocIC extends ValidatorEJB implements ShipmentLocICLocal, S
if( currentColumn.trim().equalsIgnoreCase( "itm_defaultedit" ) )
{
System.out.println("@@@@@@@@ itemchange itm_defaultedit called @@@@@@@@");
//gbf_itemchg_modifier_ds(dw_detedit[ii_currformno],"charge_code","protect","1") ;
chargeCode = genericUtility.getColumnValue("charge_code", dom);
valueXmlString.append("<charge_code protect = \"1\">").append("<![CDATA["+chargeCode+"]]>").append("</charge_code>");
}
......@@ -1287,18 +1280,9 @@ public class ShipmentLocIC extends ValidatorEJB implements ShipmentLocICLocal, S
else if ( currentColumn.trim().equalsIgnoreCase("itm_default") )
{
System.out.println("@@@@@@@@ itemchange itm_default called @@@@@@@@");
/*
lineNo = gbf_get_argval(is_extra_arg,"line_no")
if( lineNo != null && lineNo.trim().length() > 0 ) // len(trim(ls_line_no)) > 0 then
{
dw_detedit[ii_currformno].SetItem(1,"line_no",ls_line_no)
}//end if
*/
//gbf_itemchg_modifier_ds(dw_detedit[ii_currformno],"charge_code","protect","0")
chargeCode = genericUtility.getColumnValue("charge_code", dom)==null?"":genericUtility.getColumnValue("charge_code", dom);
valueXmlString.append("<charge_code protect = \"0\">").append("<![CDATA["+chargeCode+"]]>").append("</charge_code>");
//dw_detedit[ii_currformno].SetItem(1,"shipment_id",dw_edit.GetItemString(1,"shipment_id"))
shipmentId = genericUtility.getColumnValue("shipment_id", dom1);
valueXmlString.append("<shipment_id>").append("<![CDATA["+shipmentId+"]]>").append("</shipment_id>");
}
......@@ -1307,26 +1291,51 @@ public class ShipmentLocIC extends ValidatorEJB implements ShipmentLocICLocal, S
{
System.out.println("@@@@@@@@ itemchange charge_code called @@@@@@@@");
//Case "charge_code"
chargeCode = genericUtility.getColumnValue("charge_code", dom);
//ls_code = trim(dw_detedit[ii_currformno].GetItemString(dw_detedit[ii_currformno].getrow(), colname))
//ls_code1 = dw_header.GetItemString(dw_header.getrow(), keyfld)
shipmentId = genericUtility.getColumnValue("shipment_id", dom1);
//colname = upper(colname)///added - Vanita - 06/12/06
frtList = genericUtility.getColumnValue("frt_list", dom1);
stanCodeFrom = genericUtility.getColumnValue("stan_code__from", dom1);
stanCodeTo = genericUtility.getColumnValue("stan_code__to", dom1);
loadType = genericUtility.getColumnValue("load_type", dom1);
/*
sql = " select c.descr,b.charges_mode,b.amount,b.charge_code__add,sequence " +
//" into :ls_descr,:ls_mode,:lc_amt,:ls_chgs_add,:ll_seq " +
" from shipment a, freight_rate_det b, gencodes c " +
" where b.frt_list = a.frt_list and b.stan_code__from = a.stan_code__from " +
" and b.stan_code__to = a.stan_code__to and b.load_type = a.load_type " +
" and trim(b.charge_code) = c.fld_value and a.shipment_id = ? " +
" and c.fld_name = ? and c.mod_name = 'X' " +
" where b.frt_list = a.frt_list " +
" and b.stan_code__from = a.stan_code__from " +
" and b.stan_code__to = a.stan_code__to " +
" and b.load_type = a.load_type " +
" and trim(b.charge_code) = c.fld_value " +
" and a.shipment_id = ? " +
" and c.fld_name = ? " +
" and c.mod_name = 'X' " +
" and c.fld_value = ? ";
*/
sql = " select c.descr,b.charges_mode,b.amount,b.charge_code__add,sequence " +
" from " +
// " shipment a, " +
" freight_rate_det b, gencodes c " +
" where b.frt_list = ? " +
" and b.stan_code__from = ? " +
" and b.stan_code__to = ? " +
" and b.load_type = ? " +
" and trim(b.charge_code) = c.fld_value " +
// " and a.shipment_id = ? " +
" and c.fld_name = ? " +
" and c.mod_name = 'X' " +
" and c.fld_value = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,shipmentId );
pstmt.setString(2,"CHARGE_CODE" );
pstmt.setString(3,chargeCode );
pstmt.setString(1,frtList );
pstmt.setString(2,stanCodeFrom );
pstmt.setString(3,stanCodeTo );
pstmt.setString(4,loadType );
pstmt.setString(5,shipmentId );
pstmt.setString(6,"CHARGE_CODE" );
pstmt.setString(7,chargeCode );
rs = pstmt.executeQuery();
if(rs.next())
{
......@@ -1341,14 +1350,11 @@ public class ShipmentLocIC extends ValidatorEJB implements ShipmentLocICLocal, S
pstmt.close();
pstmt = null;
///and c.fld_name = upper(:colname)///commented & added - Vanita - 06/12/06 remove upper
//if isnull(lc_amt) then lc_amt = 0
if("P".equalsIgnoreCase(mode) ) //ls_mode = 'P' then//percentage on basic freight
{ //lc_val = dw_header.GetItemNumber(dw_header.getrow(), 'freight_amt')
{
String freightAmtStr = genericUtility.getColumnValue("freight_amt", dom1)==null?"0":genericUtility.getColumnValue("freight_amt", dom1);
freightAmt = Double.parseDouble(freightAmtStr);
......@@ -1358,19 +1364,12 @@ public class ShipmentLocIC extends ValidatorEJB implements ShipmentLocICLocal, S
double tempAmount=0;
i= 1;
chargeAdd1 = chargeAdd;
//do while len(ls_chgs_add1) > 0
//ls_chgs[i] = f_get_token(ls_chgs_add1,",")
tempChargeAdd = chargeAdd1.split(",");
//i = i + 1
//loop
//for ll_cnt = 1 to upperbound(ls_chgs,1)
for( i = 0; i < tempChargeAdd.length ; i++ )
{
sql = " select amount " +
// " into :lc_chgs " +
" from shipment_det where shipment_id = ? " +
" and charge_code = ? ";
// " and charge_code = :ls_chgs[ll_cnt] ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,shipmentId );
pstmt.setString(2,tempChargeAdd[i] );
......@@ -1384,35 +1383,28 @@ public class ShipmentLocIC extends ValidatorEJB implements ShipmentLocICLocal, S
pstmt.close();
pstmt = null;
//if isnull(lc_chgs) then lc_chgs = 0
freightAmt = freightAmt + tempAmount;
// next
} //end if
// lc_val = (lc_val * lc_amt)/100
freightAmt = ( freightAmt * amount )/100;
// dw_detedit[ii_currformno].setitem(1,'amount',lc_val)
valueXmlString.append("<amount>").append("<![CDATA["+freightAmt +"]]>").append("</amount>");
}
}
else if ("F".equalsIgnoreCase(mode) ) ////fixed price
{
//dw_detedit[ii_currformno].setitem(1,'amount',lc_amt)
valueXmlString.append("<amount>").append("<![CDATA["+amount+"]]>").append("</amount>");
}
else if ("D".equalsIgnoreCase(mode) ) //delivery
{
String extraDlvStr = genericUtility.getColumnValue("extra_dlv", dom1)==null?"0":genericUtility.getColumnValue("extra_dlv", dom1);
extraDlv = Double.parseDouble(extraDlvStr) * amount;
//dw_detedit[ii_currformno].setitem(1,'amount',lc_val)
valueXmlString.append("<amount>").append("<![CDATA["+extraDlv+"]]>").append("</amount>");
}
else if ("W".equalsIgnoreCase(mode) ) //weight
{
sql = " select sum(nett_weight) " +
// " into :lc_val " +
" from despatch where shipment_id = ? and confirmed = 'Y' ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,shipmentId );
......@@ -1426,10 +1418,7 @@ public class ShipmentLocIC extends ValidatorEJB implements ShipmentLocICLocal, S
pstmt.close();
pstmt = null;
// if isnull(lc_val) then lc_val = 0
sql = " select sum(net_weight) " +
// " into :lc_val1 " +
" from distord_iss where shipment_id = ? and confirmed = 'Y' ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,shipmentId );
......@@ -1443,45 +1432,28 @@ public class ShipmentLocIC extends ValidatorEJB implements ShipmentLocICLocal, S
pstmt.close();
pstmt = null;
//if isnull(lc_val1) then lc_val1 = 0
nettWeight = (nettWeight + netWeight) * amount;
//dw_detedit[ii_currformno].setitem(1,'amount',lc_val)
valueXmlString.append("<amount>").append("<![CDATA["+nettWeight+"]]>").append("</amount>");
}
else if ("V".equalsIgnoreCase(mode) ) //volume
{
//dw_detedit[ii_currformno].setitem(1,'amount','0.000')
valueXmlString.append("<amount>").append("0.000").append("</amount>");
}
else if ("L".equalsIgnoreCase(mode) ) //lr numbers
{
//lc_val = dw_header.GetItemNumber(dw_header.getrow(), 'no_of_lr')
String noOfLrStr = genericUtility.getColumnValue("no_of_lr", dom1)==null?"0":genericUtility.getColumnValue("no_of_lr", dom1);
noOfLr = Double.parseDouble(noOfLrStr) * amount;
//dw_detedit[ii_currformno].setitem(1,'amount',lc_val)
valueXmlString.append("<amount>").append("<![CDATA["+noOfLr+"]]>").append("</amount>");
}//end if
//dw_detedit[ii_currformno].setitem(1,'gencodes_descr',ls_descr)
valueXmlString.append("<gencodes_descr>").append("<![CDATA["+gencodesDescr+"]]>").append("</gencodes_descr>");
//dw_detedit[ii_currformno].setitem(1,'charges_mode',ls_mode)
valueXmlString.append("<charges_mode>").append("<![CDATA["+mode+"]]>").append("</charges_mode>");
//dw_detedit[ii_currformno].setitem(1,'sequence',ll_seq)
valueXmlString.append("<sequence>").append("<![CDATA["+sequence+"]]>").append("</sequence>");
//dw_detedit[ii_currformno].setitem(1,'charge_code__add',ls_chgs_add)
valueXmlString.append("<charge_code__add>").append("<![CDATA["+chargeAdd+"]]>").append("</charge_code__add>");
//dw_detedit[ii_currformno].setitem(1,'charge_rate',lc_amt)
valueXmlString.append("<charge_rate>").append("<![CDATA["+amount+"]]>").append("</charge_rate>");
}
valueXmlString.append("</Detail2>");
break;
......@@ -1510,16 +1482,6 @@ public class ShipmentLocIC extends ValidatorEJB implements ShipmentLocICLocal, S
if( currentColumn.trim().equalsIgnoreCase( "itm_default" ) )
{
///lineNoOrd = genericUtility.getColumnValue("line_no_ord", dom);
//System.out.println("@@@@@1 lineNoOrd ["+ lineNoOrd + "]");
//valueXmlString.append("<line_no_ord protect = \"1\">").append("<![CDATA["+lineNoOrd+"]]>").append("</line_no_ord>");
/*
ls_line_no = gbf_get_argval(is_extra_arg,"line_no")
if len(trim(ls_line_no)) > 0 then
dw_detedit[ii_currformno].SetItem(1,"line_no",ls_line_no)
end if
*/
shipmentId = genericUtility.getColumnValue("shipment_id", dom1);
valueXmlString.append("<shipment_id protect = \"1\">").append("<![CDATA["+shipmentId+"]]>").append("</shipment_id>");
......@@ -1580,16 +1542,6 @@ public class ShipmentLocIC extends ValidatorEJB implements ShipmentLocICLocal, S
if( currentColumn.trim().equalsIgnoreCase( "itm_default" ) )
{
System.out.println("@@@@@@@@@@@case4- itm_default");
///lineNoOrd = genericUtility.getColumnValue("line_no_ord", dom);
//System.out.println("@@@@@1 lineNoOrd ["+ lineNoOrd + "]");
//valueXmlString.append("<line_no_ord protect = \"1\">").append("<![CDATA["+lineNoOrd+"]]>").append("</line_no_ord>");
/*
ls_line_no = gbf_get_argval(is_extra_arg,"line_no")
if len(trim(ls_line_no)) > 0 then
dw_detedit[ii_currformno].SetItem(1,"line_no",ls_line_no)
end if
*/
//dw_detedit[ii_currformno].SetItem(1,"shipment_id",dw_edit.GetItemString(1,"shipment_id"))
shipmentId = genericUtility.getColumnValue("shipment_id", dom1);
valueXmlString.append("<shipment_id protect = \"1\">").append("<![CDATA["+shipmentId+"]]>").append("</shipment_id>");
......@@ -1603,11 +1555,8 @@ public class ShipmentLocIC extends ValidatorEJB implements ShipmentLocICLocal, S
valueXmlString.append("<currency_descr protect = \"1\">").append("<![CDATA["+currencyDescr+"]]>").append("</currency_descr>");
}
else if( currentColumn.trim().equalsIgnoreCase( "stan_code__ship" ) )
{
stanCodeShip = genericUtility.getColumnValue("stan_code__ship", dom);
System.out.println("@@@@@2 stanCodeShip ["+ stanCodeShip + "]");
stanCodeDescr = setDescription("descr", "station", "stan_code", stanCodeShip, conn);
......@@ -1622,7 +1571,6 @@ public class ShipmentLocIC extends ValidatorEJB implements ShipmentLocICLocal, S
}
else if( currentColumn.trim().equalsIgnoreCase( "curr_code__frt" ) )
{
currCodeFrt = genericUtility.getColumnValue("curr_code__frt", dom);
System.out.println("@@@@@2 currCodeFrt ["+ currCodeFrt + "]");
currCodeFrtDescr = setDescription("descr", "currency", "curr_code", currCodeFrt, conn);
......@@ -1647,12 +1595,10 @@ public class ShipmentLocIC extends ValidatorEJB implements ShipmentLocICLocal, S
System.out.println("@@@@@2 tranCode ["+ tranCode + "]");
transporterTranName = setDescription("TRAN_NAME", "TRANSPORTER", "tran_code", tranCode, conn);
valueXmlString.append("<transporter_tran_name protect = \"1\">").append("<![CDATA["+transporterTranName+"]]>").append("</transporter_tran_name>");
}
else if ( currentColumn.trim().equalsIgnoreCase( "ref_id" ) )
{
refId = genericUtility.getColumnValue("ref_id", dom);
refSer = genericUtility.getColumnValue("ref_ser", dom);
System.out.println("@@@@@2 refId ["+ refId + "]::refSer["+refSer+"]");
......@@ -1662,9 +1608,6 @@ public class ShipmentLocIC extends ValidatorEJB implements ShipmentLocICLocal, S
sql = " select tran_code, curr_code, no_art, curr_code__frt , desp_date,site_code, exch_rate__frt," +
" stan_code,gross_weight, nett_weight , tare_weight " +
//" Into :ls_tran_code , :ls_curr_code, :ll_noart , :ls_curr_frt , " +
//" :ldt_despdt , :ls_site , :ldexchrate , :ls_stan_code_dlv, " +
//" :lc_gross , :lc_net , :lc_tare " +
" From Despatch Where desp_id = ? ";
pstmt = conn.prepareStatement(sql);
......@@ -1689,11 +1632,7 @@ public class ShipmentLocIC extends ValidatorEJB implements ShipmentLocICLocal, S
pstmt.close();
pstmt = null;
//ls_date = invo_country_date.gbf_eng_to_farsi(string(ldt_despdt,'yyyymmdd'))
sql = " select A.stan_code , B.curr_code " +
// " :ls_stan_code_fr , :ls_curr_bc "
" From Site A, Finent B Where A.fin_entity = B.fin_entity " +
" And A.site_code = ? ";
pstmt = conn.prepareStatement(sql);
......@@ -1709,15 +1648,11 @@ public class ShipmentLocIC extends ValidatorEJB implements ShipmentLocICLocal, S
pstmt.close();
pstmt = null;
}
else if( "P-ORD".equalsIgnoreCase(refSer)) // ls_refser = 'P-ORD' Then
{
sql = " select tran_code , curr_code , 0 , curr_code__frt , " +
" ord_date , site_code__ord , exch_rate , site_code__dlv " +
//" Into :ls_tran_code , :ls_curr_code , :ll_noart , :ls_curr_frt , " +
// " :ldt_despdt , :ls_site , :ldexchrate , :ls_site_code_dlv " +
" From Porder Where purc_order = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,refId );
......@@ -1737,10 +1672,8 @@ public class ShipmentLocIC extends ValidatorEJB implements ShipmentLocICLocal, S
rs = null;
pstmt.close();
pstmt = null;
//ls_date = invo_country_date.gbf_eng_to_farsi(string(ldt_despdt,'yyyymmdd'))
sql = " Select A.stan_code , B.curr_code " +
//" Into :ls_stan_code_fr , :ls_curr_bc " +
" From Site A, Finent B Where A.fin_entity = B.fin_entity " +
" And A.site_code = ? ";
......@@ -1759,7 +1692,6 @@ public class ShipmentLocIC extends ValidatorEJB implements ShipmentLocICLocal, S
sql = " select A.stan_code " +
// " Into :ls_stan_code_dlv " +
" From Site A, Finent B Where A.fin_entity = B.fin_entity" +
" And A.site_code = ? ";
......@@ -1783,9 +1715,6 @@ public class ShipmentLocIC extends ValidatorEJB implements ShipmentLocICLocal, S
sql = " Select tran_code , curr_code , no_art , curr_code__frt ," +
" tran_date , site_code , exch_rate , site_code__dlv , " +
" gross_weight , net_weight , tare_weight " +
// " Into :ls_tran_code , :ls_curr_code , :ll_noart , :ls_curr_frt ," +
// " :ldt_despdt , :ls_site , :ldexchrate , :ls_site_code_dlv," +
// " :lc_gross , :lc_net , :lc_tare " +
" From Distord_iss Where tran_id = ? ";
pstmt = conn.prepareStatement(sql);
......@@ -1809,10 +1738,8 @@ public class ShipmentLocIC extends ValidatorEJB implements ShipmentLocICLocal, S
rs = null;
pstmt.close();
pstmt = null;
//ls_date = invo_country_date.gbf_eng_to_farsi(string(ldt_despdt,'yyyymmdd'))
sql = " Select A.stan_code , B.curr_code " +
// " Into :ls_stan_code_fr , :ls_curr_bc " +
" From Site A, Finent B Where A.fin_entity = B.fin_entity " +
" And A.site_code = ? ";
pstmt = conn.prepareStatement(sql);
......@@ -1830,7 +1757,6 @@ public class ShipmentLocIC extends ValidatorEJB implements ShipmentLocICLocal, S
sql = " Select A.stan_code " +
// " Into :ls_stan_code_dlv" +
" From Site A, Finent B Where A.fin_entity = B.fin_entity" +
" And A.site_code = ? ";
pstmt = conn.prepareStatement(sql);
......@@ -1846,7 +1772,72 @@ public class ShipmentLocIC extends ValidatorEJB implements ShipmentLocICLocal, S
pstmt.close();
pstmt = null;
} //End if
}
else if ( "C-ISS".equalsIgnoreCase(refSer)) // for c-iss
{
sql = " Select tran_code, curr_code, no_art, curr_code__frt, issue_date, site_code__ord," +
" exch_rate, site_code__req, gross_weight" +
// ", net_weight , tare_weight " +
" From CONSUME_ISS Where cons_issue = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,refId );
rs = pstmt.executeQuery();
if(rs.next())
{
tranCode = rs.getString("tran_code");
currCode = rs.getString("curr_code");
noArt = rs.getInt("no_art");
currCodeFrt = rs.getString("curr_code__frt");
despDate = rs.getTimestamp("issue_date");
siteCode = rs.getString("site_code__ord");
exchRateFrt = rs.getDouble("exch_rate");
siteCodeDlv = rs.getString("site_code__req");
grossWeight = rs.getDouble("gross_weight");
// nettWeight = rs.getDouble("nett_weight");
// tareWeight = rs.getDouble("tare_weight");
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
sql = " Select A.stan_code , B.curr_code " +
" From Site A, Finent B Where A.fin_entity = B.fin_entity " +
" And A.site_code = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,siteCode );
rs = pstmt.executeQuery();
if(rs.next())
{
stanCode = rs.getString("stan_code");
currCode = rs.getString("curr_code");
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
sql = " Select A.stan_code " +
" From Site A, Finent B Where A.fin_entity = B.fin_entity" +
" And A.site_code = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,siteCodeDlv );
rs = pstmt.executeQuery();
if(rs.next())
{
stanCode = rs.getString("stan_code");
// currCode = rs.getString("curr_code");
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
}
//End if
}
......
/********************************************************
Title : ShipmentLocICLocal
Date : 25/04/2014
Developer: chandrakant patil
req id : DI3GSUN047
********************************************************/
package ibase.webitm.ejb.dis;
......
/********************************************************
Title : ShipmentLocICRemote
Date : 25/04/2014
Developer: chandrakant patil
req id : DI3GSUN047
********************************************************/
package ibase.webitm.ejb.dis;
......
/********************************************************
Title : RecalFrtAct
Date : 25/04/2014
Developer: chandrakant patil
req id : DI3GSUN047
********************************************************/
package ibase.webitm.ejb.dis.adv;
import java.rmi.RemoteException;
import java.sql.*;
......@@ -35,14 +42,11 @@ public class RecalFrtAct extends ActionHandlerEJB implements RecalFrtActLocal, R
System.out.println("RecalFrtAct called........");
String sql = "";
String errString = "" ;
//String status = "",conf = "";
Connection conn = null;
//ConnDriver connDriver = null;
PreparedStatement pstmt = null;
ResultSet rs = null;
ITMDBAccessEJB itmDBAccessEJB = null;
System.out.println("tran id = "+tranId);
//GenericUtility genericUtility = null;
Timestamp sysdate = null;
String confirmed="";
ITMDBAccessLocal itmDBAccessLocal = new ITMDBAccessEJB();
......@@ -154,7 +158,7 @@ public class RecalFrtAct extends ActionHandlerEJB implements RecalFrtActLocal, R
throws RemoteException, ITMException
{
PreparedStatement pstmt = null, pstmt1 = null, pstmtSql = null;
PreparedStatement pstmt = null, pstmt1 = null;
ResultSet rs = null,rs1 = null;
int cnt = 0,updCnt=0;
String retString = "", sql = "", sql1 = "",errCode = "";
......@@ -162,16 +166,15 @@ public class RecalFrtAct extends ActionHandlerEJB implements RecalFrtActLocal, R
GenericUtility genericUtility = GenericUtility.getInstance();
ITMDBAccessEJB itmDBAccessLocal = new ITMDBAccessEJB();
int sequence=0;
//String confirmed="",lrNo="",lorryNo="",recallFrt="",despId="",lrNoUpd="",lorryNoUpd="",distOrdIssId="";
double frtAmt=0;
String freightType="",chargesMode="",lineNo="",chargeCodeAdd="",chargeCode="",chargeAdd1="",chargeAdd="";
double grossWeightDesp=0,grossWeightDist=0,val=0,freightRate=0,minValue=0,addChgs=0,chargeRate=0,tempNetWeight=0,tempNettWeight=0;
double grossWeightCIss=0;
try
{
System.out.println("@@@@@@@@@@@@@@@ recalFrtAct method called next..............");
Calendar currentDate = Calendar.getInstance();
SimpleDateFormat sdf = new SimpleDateFormat(genericUtility.getApplDateFormat());
......@@ -200,7 +203,6 @@ public class RecalFrtAct extends ActionHandlerEJB implements RecalFrtActLocal, R
if("G".equalsIgnoreCase(freightType)) // ls_frt_type = 'G' then
{
sql = " select nvl(sum(gross_weight),0) " +
// " into :lc_gross " +
" from despatch where shipment_id = ? and confirmed = 'Y' ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, tranId);
......@@ -230,18 +232,32 @@ public class RecalFrtAct extends ActionHandlerEJB implements RecalFrtActLocal, R
rs = null;
pstmt.close();
pstmt = null;
System.out.println("@@@@@@@@grossWeightDist["+grossWeightDist+"]");
// added cpatil for c-iss on 19/04/14
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, tranId);
rs = pstmt.executeQuery();
if( rs.next())
{
grossWeightCIss = rs.getDouble(1);
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
System.out.println("@@@@@@@@grossWeightCIss["+grossWeightCIss+"]");
// end cpatil
//lc_val = lc_frt_rate * (lc_gross + lc_gross_dist)
val = freightRate * ( grossWeightDesp + grossWeightDist );
val = freightRate * ( grossWeightDesp + grossWeightDist + grossWeightCIss ); // added grossWeightCIss for c-iss recalculation
System.out.println("@@@@@@@val["+val+"]minValue["+minValue+"]");
if( val > minValue ) // lc_val > lc_minval then
{
//dw_edit.setitem(1,'freight_amt',lc_val)
sql = " update shipment set freight_amt = ? where shipment_id = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setDouble(1, val);
......@@ -254,8 +270,6 @@ public class RecalFrtAct extends ActionHandlerEJB implements RecalFrtActLocal, R
}
else
{
//dw_edit.setitem(1,'freight_amt',lc_minval)
sql = " update shipment set freight_amt = ? where shipment_id = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setDouble(1, minValue);
......@@ -268,8 +282,6 @@ public class RecalFrtAct extends ActionHandlerEJB implements RecalFrtActLocal, R
} //end if
// lc_add_chgs = dw_edit.GetItemNumber(1,'add_chgs')
sql = " select add_chgs from shipment where shipment_id = ? ";
pstmt = conn.prepareStatement(sql);
......@@ -289,8 +301,6 @@ public class RecalFrtAct extends ActionHandlerEJB implements RecalFrtActLocal, R
System.out.println("@@@@@@@@ val["+val+"]");
//dw_edit.SetItem(1,"total_freight",lc_val)
sql = " update shipment set total_freight = ? where shipment_id = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setDouble(1, val);
......@@ -302,7 +312,6 @@ public class RecalFrtAct extends ActionHandlerEJB implements RecalFrtActLocal, R
}
else if("F".equalsIgnoreCase(freightType)) // ls_frt_type = 'F' then
{
// lc_frt_amt = dw_edit.getitemnumber(1,"freight_amt")
sql = " select freight_amt from shipment where shipment_id = ? ";
......@@ -336,15 +345,7 @@ public class RecalFrtAct extends ActionHandlerEJB implements RecalFrtActLocal, R
chargeCodeAdd = rs.getString("charge_code__add");
sequence = rs.getInt("sequence");
/*
ls_line_no = dw_detbrow_main.getitemstring(ll_cnt,'line_no')
ls_chg_code = dw_detbrow_main.getitemstring(ll_cnt,'charge_code')
ls_mode = dw_detbrow_main.getitemstring(ll_cnt,'charges_mode')
lc_chg_rate = dw_detbrow_main.getitemnumber(ll_cnt,'charge_rate')
ls_chgs_add = dw_detbrow_main.getitemstring(ll_cnt,'charge_code__add')
ll_seq = dw_detbrow_main.getitemnumber(ll_cnt,'sequence')
*/
System.out.println("@@@@@@@@@ chargesMode["+chargesMode+"]chargeCodeAdd["+chargeCodeAdd+"]");
System.out.println("@@@@@@@@@ chargesMode["+chargesMode+"]chargeCodeAdd["+chargeCodeAdd+"]chargeRate["+chargeRate+"]");
if("P".equalsIgnoreCase(chargesMode)) //ls_mode = 'P' then//percentage on basic freight
{
if( chargeCodeAdd != null ) // not isnull(ls_chgs_add) then
......@@ -401,7 +402,6 @@ public class RecalFrtAct extends ActionHandlerEJB implements RecalFrtActLocal, R
pstmt1.close();
pstmt1 = null;
sql1 = " select nvl(sum(net_weight),0) " +
" from distord_iss where shipment_id = ? and confirmed = 'Y' ";
......@@ -417,24 +417,33 @@ public class RecalFrtAct extends ActionHandlerEJB implements RecalFrtActLocal, R
pstmt1.close();
pstmt1 = null;
// added cpatil for c-iss on 19/04/14
sql1 = " 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' ";
pstmt1 = conn.prepareStatement(sql1);
pstmt1.setString(1, tranId);
rs1 = pstmt1.executeQuery();
if( rs1.next())
{
grossWeightCIss = rs1.getDouble(1);
}
rs1.close();
rs1 = null;
pstmt1.close();
pstmt1 = null;
System.out.println("@@@@@@@@grossWeightCIss["+grossWeightCIss+"]");
// end cpatil
val = ( tempNettWeight + tempNetWeight ) * chargeRate ;
val = ( tempNettWeight + tempNetWeight + grossWeightCIss ) * chargeRate ;
} // end if
if( "W".equalsIgnoreCase(chargesMode) || "P".equalsIgnoreCase(chargesMode) )
//ls_mode = 'W' or ls_mode = 'P' then
{
//if isnull(lc_val) then lc_val = 0
// dw_detedit_main.setitem(1,'shipment_id',ls_shipment)
// dw_detedit_main.setitem(1,'line_no',ls_line_no)
// dw_detedit_main.setitem(1,'charge_code',ls_chg_code)
// dw_detedit_main.setitem(1,'sequence',ll_seq)
// dw_detedit_main.setitem(1,'charges_mode',ls_mode)
// dw_detedit_main.setitem(1,'charge_rate',lc_chg_rate)
// dw_detedit_main.setitem(1,'charge_code__add',ls_chgs_add)
// dw_detedit_main.setitem(1,'amount',lc_val)
// dw_detedit_main.setcolumn('charge_code')
sql1 = " update shipment_det set charge_code = ?, sequence = ?, charges_mode= ?, charge_rate= ?," +
" charge_code__add= ? , amount=? where shipment_id = ? and line_no = ? ";
......@@ -453,11 +462,6 @@ public class RecalFrtAct extends ActionHandlerEJB implements RecalFrtActLocal, R
System.out.println("@@@@@ updCnt["+updCnt+"]");
// popobj = dw_detedit_main
// formno = 1
// dw_detedit_main.triggerevent('ue_postrec')
// formno = 0
// end if
} // next
} // end while
......@@ -467,7 +471,6 @@ public class RecalFrtAct extends ActionHandlerEJB implements RecalFrtActLocal, R
pstmt.close();
pstmt = null;
} // end try
catch (Exception e)
{
......@@ -477,7 +480,7 @@ public class RecalFrtAct extends ActionHandlerEJB implements RecalFrtActLocal, R
}
return errCode;
}
}
......
/********************************************************
Title : RecalFrtActLocal
Date : 25/04/2014
Developer: chandrakant patil
req id : DI3GSUN047
********************************************************/
package ibase.webitm.ejb.dis.adv;
import java.rmi.RemoteException;
......
/********************************************************
Title : RecalFrtActRemote
Date : 25/04/2014
Developer: chandrakant patil
req id : DI3GSUN047
********************************************************/
package ibase.webitm.ejb.dis.adv;
import java.rmi.RemoteException;
//import javax.ejb.EJBObject;
......
/********************************************************
Title : ShipmentLocConf
Date : 01/06/2012
Developer: Mahesh Patidar
Date : 25/04/2014
Developer: chandrakant patil
req id : DI3GSUN047
********************************************************/
package ibase.webitm.ejb.dis.adv;
......@@ -48,15 +49,11 @@ public class ShipmentLocConf extends ActionHandlerEJB implements ShipmentLocConf
GenericUtility genericUtility = GenericUtility.getInstance();
public String confirm(String tranId, String xtraParam, String forcedFlag) throws RemoteException,ITMException
{
//int cnt = 0;
String errString = "";
String sql = "";
//String refId = "",proNo = "",tranProNo = "";
String lorryNo = "";
//String tranCode = "";
String lrNo = "";
String confirmed = "";
//ArrayList<String> errList = new ArrayList<String>();
ConnDriver connDriver = new ConnDriver();
Connection conn = null;
PreparedStatement pstmt = null;
......@@ -76,7 +73,6 @@ public class ShipmentLocConf extends ActionHandlerEJB implements ShipmentLocConf
// check whether already confirmed or not
sql = " select confirmed , total_freight , lr_no , lr_date , recall_frt, lorry_no " +
// " into :mconf , :lc_frt_amt , :ls_lr_no, :ldt_lr_date , :ls_recal, :ls_lorry_no " +
" from shipment where shipment_id = ? ";
pstmt = conn.prepareStatement(sql);
......@@ -164,9 +160,9 @@ public class ShipmentLocConf extends ActionHandlerEJB implements ShipmentLocConf
Timestamp sysDate = null, tranDate = null,lrDate=null,lrDateUpd=null;
GenericUtility genericUtility = GenericUtility.getInstance();
ITMDBAccessEJB itmDBAccessLocal = new ITMDBAccessEJB();
int cntDist=0;
String confirmed="",lrNo="",lorryNo="",recallFrt="",despId="",lrNoUpd="",lorryNoUpd="",distOrdIssId="";
double totalFreight=0,gwtDesp=0,gwtDist=0,totGwt=0,grossWeight=0,calcFrt=0,totFrt=0,frtAmt=0;
int cntDist=0,cntConsIss=0;
String confirmed="",lrNo="",lorryNo="",recallFrt="",despId="",lrNoUpd="",lorryNoUpd="",distOrdIssId="",conOrdIssId="";
double totalFreight=0,gwtDesp=0,gwtDist=0,totGwt=0,grossWeight=0,calcFrt=0,totFrt=0,frtAmt=0,grossWeightCIss=0;
try
{
......@@ -179,7 +175,6 @@ public class ShipmentLocConf extends ActionHandlerEJB implements ShipmentLocConf
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 " +
// " into :mconf , :lc_frt_amt , :ls_lr_no, :ldt_lr_date , :ls_recal, :ls_lorry_no " +
" from shipment where shipment_id = ? ";
pstmt = conn.prepareStatement(sql);
......@@ -204,7 +199,6 @@ public class ShipmentLocConf extends ActionHandlerEJB implements ShipmentLocConf
// check shipment allocated to at least one despatch or dist issue
sql = " select count(1) " +
// " into :ll_cnt " +
" from despatch where shipment_id = ? and confirmed = 'Y' ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, tranId);
......@@ -235,25 +229,32 @@ public class ShipmentLocConf extends ActionHandlerEJB implements ShipmentLocConf
pstmt = null;
System.out.println("cntDist["+cntDist+"]");
if( cntDist == 0 ) // ll_cnt_dist = 0 then
if( cntDist == 0 )
{
sql = " select count(1) 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, tranId);
rs = pstmt.executeQuery();
while (rs.next())
{
cntConsIss = rs.getInt(1);
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
if( cntConsIss == 0 ) // ll_cnt_dist = 0 then /// cntDist == 0 change
{
errCode = "VTSHPALL";
return errCode;
}
}//end if
} //end if
/*
if ls_recal = 'Y' then
if dw_edit.Retrieve(ls_shipment) = 1 then
formobj[1].Retrieve(ls_shipment)
formno = 0
end if
cb_recal.triggerevent('clicked')
parent.triggerevent('ue_abort')
end if
*/
//allocating despatches and distord issue, freight proportionate to the gross weight
sql = " select nvl(sum(gross_weight),0) " +
//" into :lc_gwt_desp " +
......@@ -273,7 +274,6 @@ public class ShipmentLocConf extends ActionHandlerEJB implements ShipmentLocConf
System.out.println("@@@@gwtDesp["+gwtDesp+"]");
sql = " select nvl(sum(gross_weight),0) " +
//"into :lc_gwt_dist " +
"from distord_iss where shipment_id = ? and confirmed = 'Y' ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, tranId);
......@@ -289,10 +289,29 @@ public class ShipmentLocConf extends ActionHandlerEJB implements ShipmentLocConf
System.out.println("@@@@gwtDist["+gwtDist+"]");
totGwt = gwtDesp + gwtDist ;
// added by cpatil on 25/04/14
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, tranId);
rs = pstmt.executeQuery();
if( rs.next())
{
grossWeightCIss = rs.getDouble(1);
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
System.out.println("@@@@@@@@grossWeightCIss["+grossWeightCIss+"]");
// end 25/04/14
totGwt = gwtDesp + gwtDist + grossWeightCIss;
System.out.println("@@@@totGwt["+totGwt+"]");
//// test
sql = " select desp_id,gross_weight, lr_date, lr_no, lorry_no from despatch " +
......@@ -314,7 +333,6 @@ public class ShipmentLocConf extends ActionHandlerEJB implements ShipmentLocConf
pstmt = null;
System.out.println("@@@@totGwt["+totGwt+"]::totalFreight["+totalFreight+"]gwtDesp["+gwtDesp+"]");
//fetch c1 into :ls_tranid,:lc_gwt_desp,:ldt_lrdate, :ls_lrno, :ls_lorryno;
//calculating the freight amt proportionately
if ( totGwt != 0 ) // lc_tot_gwt <> 0 then
{
......@@ -339,22 +357,16 @@ public class ShipmentLocConf extends ActionHandlerEJB implements ShipmentLocConf
System.out.println("@@@calcFrt["+calcFrt+"]");
// if not isnull(ldt_lrdate) then ldt_lr_date = ldt_lrdate
if( lrDate != null )
{
lrDateUpd = lrDate;
}
// if not isnull(ls_lrno) then ls_lr_no = ls_lrno
if( lrNo != null )
{
lrNoUpd = lrNo;
}
// if not isnull(ls_lorryno) then ls_lorry_no = ls_lorryno
if( lorryNo != null )
{
lorryNoUpd = lorryNo;
......@@ -375,12 +387,8 @@ public class ShipmentLocConf extends ActionHandlerEJB implements ShipmentLocConf
pstmt.close();
pstmt = null;
sql = " select tran_id,gross_weight,lr_date, lr_no, lorry_no from distord_iss " +
" where shipment_id = ? and confirmed = 'Y' ";
// fetch c2 into :ls_tranid,:lc_gwt_dist,:ldt_lrdate, :ls_lrno, :ls_lorryno;
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, tranId);
rs = pstmt.executeQuery();
......@@ -419,12 +427,6 @@ public class ShipmentLocConf extends ActionHandlerEJB implements ShipmentLocConf
System.out.println("calcFrt["+calcFrt+"]totalFreight["+totalFreight+"]totFrt["+totFrt+"]");
//end if
//if not isnull(ldt_lrdate) then ldt_lr_date = ldt_lrdate
//if not isnull(ls_lrno) then ls_lr_no = ls_lrno
//if not isnull(ls_lorryno) then ls_lorry_no = ls_lorryno
if( lrDate != null )
{
lrDateUpd = lrDate;
......@@ -456,76 +458,145 @@ public class ShipmentLocConf extends ActionHandlerEJB implements ShipmentLocConf
pstmt.close();
pstmt = null;
/// test
////
if( errCode == null || errCode.trim().length() == 0 )
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' ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, tranId);
rs = pstmt.executeQuery();
while (rs.next())
{
conOrdIssId = rs.getString("cons_issue");
grossWeight = rs.getDouble("gross_weight");
lrDate = rs.getTimestamp("lr_date");
lrNo = rs.getString("lr_no");
lorryNo = rs.getString("lorry_no");
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
sql = " update shipment set confirmed = 'Y', conf_date = ? where shipment_id = ? ";
System.out.println("@@@@conOrdIssId["+conOrdIssId+"]::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+"]");
totFrt = totFrt + 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+"]");
if( lrDate != null )
{
lrDateUpd = lrDate;
}
if( lrNo != null )
{
lrNoUpd = lrNo;
}
if( lorryNo != null )
{
lorryNoUpd = lorryNo;
}
System.out.println("@@@@@@[distord_iss]::lrDate["+lrDate+"]lrNo["+lrNo+"]lorryNo["+lorryNo+"]");
System.out.println("@@@@@@[distord_iss]::lrDateUpd["+lrDateUpd+"]lrNoUpd["+lrNoUpd+"]lorryNoUpd["+lorryNoUpd+"]");
sql = " update CONSUME_ISS set FREIGHT_AMT = ?, lr_no = ? , " +
" lr_date = ?, lorry_no = ? " +
" where cons_issue = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setTimestamp(1, sysDate);
pstmt.setString(2, tranId);
pstmt.setDouble(1, calcFrt);
pstmt.setString(2, lrNoUpd);
pstmt.setTimestamp(3, lrDateUpd);
pstmt.setString(4, lorryNoUpd);
pstmt.setString(5, conOrdIssId);
updCnt = pstmt.executeUpdate();
pstmt.close();
pstmt = null;
}
/*
// END TEST
sql = "select edi_option from transetup where tran_window = 'w_qc_transfer' ";
pstmtSql = conn.prepareStatement(sql);
rs = pstmtSql.executeQuery();
if (rs.next())
//calculating the freight amt proportionately
System.out.println("@@@@totGwt["+totGwt+"]::totalFreight["+totalFreight+"]lrNo["+lrNo+"]");
if( totGwt != 0 ) // lc_tot_gwt <> 0 then
{
ediOption = rs.getString("EDI_OPTION");
}
rs.close();
rs = null;
pstmtSql.close();
pstmtSql = null;
calcFrt = Math.round((( totalFreight * grossWeight) / totGwt));
}//end if
System.out.println("calcFrt["+calcFrt+"]");
//this is to check whether total calculated freight doesnot exceed
//the total freight during rounding the figure
System.out.println("@@@@@@@@@@@@@@@ ediOption called next..............");
if ("2".equals(ediOption))
totFrt = totFrt + calcFrt;
System.out.println("totFrt["+totFrt+"]");
if( totFrt > totalFreight ) // lc_tot_frt > lc_frt_amt then
{
CreateRCPXML createRCPXML = new CreateRCPXML("w_qc_transfer","tran_id");
dataStr = createRCPXML.getTranXML(tranId, conn);
System.out.println("dataStr =[ " + dataStr + "]");
Document ediDataDom = genericUtility.parseString(dataStr);
calcFrt = totalFreight - ( totFrt - calcFrt ) ;
}
E12CreateBatchLoadEjb e12CreateBatchLoad = new E12CreateBatchLoadEjb();
retString = e12CreateBatchLoad.createBatchLoad(ediDataDom,"w_qc_transfer", "2", xtraParams, conn);
createRCPXML = null;
e12CreateBatchLoad = null;
System.out.println("calcFrt["+calcFrt+"]totalFreight["+totalFreight+"]totFrt["+totFrt+"]");
if (retString != null && "SUCCESS".equalsIgnoreCase(retString))
if( lrDate != null )
{
System.out.println("retString from batchload = [" + retString + "]");
lrDateUpd = lrDate;
}
if( lrNo != null )
{
lrNoUpd = lrNo;
}
else
if( lorryNo != null )
{
CreateRCPXML createRCPXML = new CreateRCPXML("w_qc_transfer","tran_id");
dataStr = createRCPXML.getTranXML(tranId, conn);
System.out.println("dataStr =[ " + dataStr + "]");
Document ediDataDom = genericUtility.parseString(dataStr);
lorryNoUpd = lorryNo;
}
E12CreateBatchLoadEjb e12CreateBatchLoad = new E12CreateBatchLoadEjb();
retString = e12CreateBatchLoad.createBatchLoad(ediDataDom,"w_qc_transfer", ediOption, xtraParams, conn);
createRCPXML = null;
e12CreateBatchLoad = null;
System.out.println("@@@@@@[distord_iss]::lrDate["+lrDate+"]lrNo["+lrNo+"]lorryNo["+lorryNo+"]");
System.out.println("@@@@@@[distord_iss]::lrDateUpd["+lrDateUpd+"]lrNoUpd["+lrNoUpd+"]lorryNoUpd["+lorryNoUpd+"]");
if (retString != null && "SUCCESS".equalsIgnoreCase(retString))
sql = " update distord_iss set frt_amt = ?, lr_no = ? , " +
" lr_date = ?, lorry_no = ? " +
" where tran_id = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setDouble(1, calcFrt);
pstmt.setString(2, lrNoUpd);
pstmt.setTimestamp(3, lrDateUpd);
pstmt.setString(4, lorryNoUpd);
pstmt.setString(5, distOrdIssId);
updCnt = pstmt.executeUpdate();
pstmt.close();
pstmt = null;
/// test
if( errCode == null || errCode.trim().length() == 0 )
{
System.out.println("retString from batchload = ["+ retString + "]");
}
}
System.out.println("@@@@@@@@@@@@@@@ ediOption called end..............");
*/
sql = " update shipment set confirmed = 'Y', conf_date = ? where shipment_id = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setTimestamp(1, sysDate);
pstmt.setString(2, tranId);
updCnt = pstmt.executeUpdate();
pstmt.close();
pstmt = null;
}
} // end try
catch (Exception e)
......@@ -538,8 +609,6 @@ public class ShipmentLocConf extends ActionHandlerEJB implements ShipmentLocConf
return errCode;
}
private String checkNull( String input )
{
if ( input == null )
......
/********************************************************
Title : ShipmentConfLocal
Date : 01/06/2012
Developer: Mahesh Patidar
Title : ShipmentLocConfLocal
Date : 25/04/2014
Developer: chandrakant patil
req id : DI3GSUN047
********************************************************/
package ibase.webitm.ejb.dis.adv;
......
/********************************************************
Title : ShipmentRemote
Date : 01/06/2012
Developer: Mahesh Patidar
/*******************************************************
Title : ShipmentLocConfRemote
Date : 25/04/2014
Developer: chandrakant patil
req id : DI3GSUN047
********************************************************/
package ibase.webitm.ejb.dis.adv;
import java.rmi.RemoteException;
......
/********************************************************
Title : ShipmentLocDefaultAct
Date : 25/04/2014
Developer: chandrakant patil
req id : DI3GSUN047
********************************************************/
package ibase.webitm.ejb.dis.adv;
......
/********************************************************
Title : ShipmentLocDefaultActLocal
Date : 25/04/2014
Developer: chandrakant patil
req id : DI3GSUN047
********************************************************/
package ibase.webitm.ejb.dis.adv;
......
/********************************************************
Title : ShipmentLocDefaultActRemote
Date : 25/04/2014
Developer: chandrakant patil
req id : DI3GSUN047
********************************************************/
package ibase.webitm.ejb.dis.adv;
......
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