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