|
|
@@ -999,7 +999,7 @@ class ocean_order {
|
|
|
// $ocean_ref_sql = " LEFT JOIN LATERAL ( SELECT string_agg(ref_code ||ref_value, ', ') AS other_refenrence_no
|
|
|
// FROM public.ocean_reference temp WHERE temp.serial_no = oo.serial_no) aa ON true ";
|
|
|
|
|
|
- $sql = "with oo as (SELECT order_from as _schemas,serial_no as __serial_no, serial_no,transport_mode,cbm,
|
|
|
+ $sql = "with oo as (SELECT oe.*, order_from as _schemas,serial_no as __serial_no, serial_no,transport_mode,
|
|
|
h_bol as _hbol, isf_bol as _isfbol, consignee_city as _consignee_city,
|
|
|
(select user_login from public.kln_user_subscribed us
|
|
|
where lower(us.user_login) = '".strtolower(_getLoginName())."' and us.subscribed_serial_no = kln_ocean.serial_no) as is_subscribe,
|
|
|
@@ -1011,42 +1011,23 @@ class ocean_order {
|
|
|
WHEN (m_iffdel is not null) THEN 'Completed'::text
|
|
|
ELSE 'Created'
|
|
|
END AS new_status, ".
|
|
|
- column::getInstance()->getSearchSqlForDisplay('Ocean_Search') . " from public.kln_ocean " . $sqlWhere .
|
|
|
- " order by $order_by limit " . $ps . " offset " . ($cp - 1) * $ps.")
|
|
|
+ column::getInstance()->getSearchSqlForDisplay('Ocean_Search') . "
|
|
|
+ from public.kln_ocean
|
|
|
+ LEFT JOIN LATERAL ( SELECT loadterm,
|
|
|
+ manifest_type,
|
|
|
+ volume
|
|
|
+ FROM public.kln_ocean_extend oe WHERE oe.serial_no::text = kln_ocean.serial_no::text) oe ON true "
|
|
|
+ . $sqlWhere . " order by $order_by limit " . $ps . " offset " . ($cp - 1) * $ps.")
|
|
|
select oo.* ,
|
|
|
case when oo.transport_mode ='sea'
|
|
|
then ( SELECT string_agg(ref_code ||ref_value, ', ') AS other_refenrence_no FROM public.ocean_reference temp WHERE temp.serial_no = oo.serial_no)
|
|
|
when oo.transport_mode ='air'
|
|
|
then ''
|
|
|
else ''
|
|
|
- end as \"Other refenrence No.\",
|
|
|
- case when oo.transport_mode ='sea' and oo._schemas ='public'
|
|
|
- then (select loadterm from public.ocean_extend where serial_no = oo.serial_no)
|
|
|
- when oo.transport_mode ='sea' and oo._schemas ='sfs'
|
|
|
- then (select loadterm from sfs.ocean_extend where serial_no = oo.serial_no)
|
|
|
- else ''
|
|
|
- end as \"Load Term\",
|
|
|
- case when oo.transport_mode ='sea' and oo._schemas ='public'
|
|
|
- then (select case when manifest_type = 'GPE' then 'LCL' else manifest_type end from public.ocean where serial_no = oo.serial_no)
|
|
|
- when oo.transport_mode ='sea' and oo._schemas ='sfs'
|
|
|
- then (select case when manifest_type = 'GPE' then 'LCL' else manifest_type end from sfs.ocean where serial_no = oo.serial_no)
|
|
|
- else ''
|
|
|
- end as \"Shipment Type\",
|
|
|
- case when oo.transport_mode ='sea' and oo._schemas ='public'
|
|
|
- then (select port_of_transshipment_name from public.ocean where serial_no = oo.serial_no)
|
|
|
- when oo.transport_mode ='sea' and oo._schemas ='sfs'
|
|
|
- then (select port_of_transshipment_name from sfs.ocean where serial_no = oo.serial_no)
|
|
|
- else ''
|
|
|
- end as \"Port of Transhipment\",
|
|
|
- case when oo.transport_mode ='sea' and oo._schemas ='public'
|
|
|
- then (SELECT sum(cbm) from public.oc_container where serial_no = oo.serial_no)
|
|
|
- when oo.transport_mode ='sea' and oo._schemas ='sfs'
|
|
|
- then (SELECT sum(cbm) from sfs.oc_container where serial_no = oo.serial_no)
|
|
|
- else oo.cbm
|
|
|
- end as \"Volume\"
|
|
|
+ end as \"Other refenrence No.\"
|
|
|
from oo";
|
|
|
|
|
|
- $tmp_search_without_limit = "with oo as (SELECT order_from as _schemas,serial_no as __serial_no, serial_no,transport_mode,cbm,
|
|
|
+ $tmp_search_without_limit = "with oo as (SELECT oe.*, order_from as _schemas,serial_no as __serial_no, serial_no,transport_mode,
|
|
|
h_bol as _hbol, isf_bol as _isfbol, consignee_city as _consignee_city,
|
|
|
(select user_login from public.kln_user_subscribed us
|
|
|
where lower(us.user_login) = '".strtolower(_getLoginName())."' and us.subscribed_serial_no = kln_ocean.serial_no) as is_subscribe,
|
|
|
@@ -1058,39 +1039,20 @@ class ocean_order {
|
|
|
WHEN (m_iffdel is not null) THEN 'Completed'::text
|
|
|
ELSE 'Created'
|
|
|
END AS new_status, ".
|
|
|
- column::getInstance()->getSearchSqlForDisplay('Ocean_Search') . " from public.kln_ocean " . $sqlWhere .
|
|
|
- " order by $order_by)
|
|
|
+ column::getInstance()->getSearchSqlForDisplay('Ocean_Search') . "
|
|
|
+ from public.kln_ocean
|
|
|
+ LEFT JOIN LATERAL ( SELECT loadterm,
|
|
|
+ manifest_type,
|
|
|
+ volume
|
|
|
+ FROM public.kln_ocean_extend oe WHERE oe.serial_no::text = kln_ocean.serial_no::text) oe ON true "
|
|
|
+ . $sqlWhere . " order by $order_by)
|
|
|
select oo.* ,
|
|
|
case when oo.transport_mode ='sea'
|
|
|
then ( SELECT string_agg(ref_code ||ref_value, ', ') AS other_refenrence_no FROM public.ocean_reference temp WHERE temp.serial_no = oo.serial_no)
|
|
|
when oo.transport_mode ='air'
|
|
|
then ''
|
|
|
else ''
|
|
|
- end as \"Other refenrence No.\",
|
|
|
- case when oo.transport_mode ='sea' and oo._schemas ='public'
|
|
|
- then (select loadterm from public.ocean_extend where serial_no = oo.serial_no)
|
|
|
- when oo.transport_mode ='sea' and oo._schemas ='sfs'
|
|
|
- then (select loadterm from sfs.ocean_extend where serial_no = oo.serial_no)
|
|
|
- else ''
|
|
|
- end as \"Load Term\",
|
|
|
- case when oo.transport_mode ='sea' and oo._schemas ='public'
|
|
|
- then (select case when manifest_type = 'GPE' then 'LCL' else manifest_type end from public.ocean where serial_no = oo.serial_no)
|
|
|
- when oo.transport_mode ='sea' and oo._schemas ='sfs'
|
|
|
- then (select case when manifest_type = 'GPE' then 'LCL' else manifest_type end from sfs.ocean where serial_no = oo.serial_no)
|
|
|
- else ''
|
|
|
- end as \"Shipment Type\",
|
|
|
- case when oo.transport_mode ='sea' and oo._schemas ='public'
|
|
|
- then (select port_of_transshipment_name from public.ocean where serial_no = oo.serial_no)
|
|
|
- when oo.transport_mode ='sea' and oo._schemas ='sfs'
|
|
|
- then (select port_of_transshipment_name from sfs.ocean where serial_no = oo.serial_no)
|
|
|
- else ''
|
|
|
- end as \"Port of Transhipment\",
|
|
|
- case when oo.transport_mode ='sea' and oo._schemas ='public'
|
|
|
- then (SELECT sum(cbm) from public.oc_container where serial_no = oo.serial_no)
|
|
|
- when oo.transport_mode ='sea' and oo._schemas ='sfs'
|
|
|
- then (SELECT sum(cbm) from sfs.oc_container where serial_no = oo.serial_no)
|
|
|
- else oo.cbm
|
|
|
- end as \"Volume\"
|
|
|
+ end as \"Other refenrence No.\"
|
|
|
from oo";
|
|
|
|
|
|
//$rs = common::excuteListSql($sql);
|
|
|
@@ -1105,6 +1067,7 @@ class ocean_order {
|
|
|
$rs[$index]["Mode"] = $val['transport_mode'] == 'sea' ? "Ocean Freight" : ($val['transport_mode'] == 'air' ? "Air Freight": "");
|
|
|
//status 改为ocean_milestone里的信息
|
|
|
$rs[$index]["Status"] = $rs[$index]["new_status"];
|
|
|
+ $rs[$index]["Shipment Type"] = $rs[$index]["Shipment Type"] == 'GPE' ? 'LCL' : $rs[$index]["Shipment Type"];
|
|
|
//订阅的参数
|
|
|
if(empty($rs[$index]["is_subscribe"])){
|
|
|
$rs[$index]['is_subscribe'] = false;
|
|
|
@@ -1970,9 +1933,7 @@ class ocean_order {
|
|
|
SELECT o.* from ocean o where serial_no = '" . $serial_no . "'
|
|
|
)
|
|
|
SELECT m_eta as _m_eta, h_bol as _h_bol, m_bol as _m_bol,job_no as _job_bol,
|
|
|
- o.* ,sh.*, cn.* ,aa.*,dd.*,fd.*,oo.*,
|
|
|
- (select uncode from $order_from.ports where code = o.port_of_transshipment) as port_of_transshipment_un,
|
|
|
- (select loadterm from $order_from.ocean_extend where serial_no = o.serial_no) as loadterm
|
|
|
+ o.* ,sh.*, cn.* ,aa.*,dd.*,fd.*,oo.*,koe.loadterm
|
|
|
from o
|
|
|
LEFT JOIN LATERAL ( SELECT tracking_no as _tracking_no,shippr_uncode,shipper_city,
|
|
|
consignee_uncode,consignee_city,incoterms,
|
|
|
@@ -1985,6 +1946,7 @@ class ocean_order {
|
|
|
atd as oo_atd,
|
|
|
ata as oo_ata,
|
|
|
carbon_emission,
|
|
|
+ port_of_transshipment_un,
|
|
|
(select time_zone from public.city_timezone where uncode = oo.fport_of_loading_un limit 1) as pol_timezone,
|
|
|
(select uncity from $order_from.ports where uncode = oo.fport_of_loading_un limit 1) as pol_uncity,
|
|
|
(select time_zone from public.city_timezone where uncode = oo.mport_of_discharge_un limit 1) as mpod_timezone,
|
|
|
@@ -2005,6 +1967,8 @@ class ocean_order {
|
|
|
ELSE 'Created'::text
|
|
|
END AS new_status
|
|
|
FROM public.kln_ocean oo WHERE oo.serial_no::text = o.serial_no::text and order_from = '$order_from') oo ON true
|
|
|
+ LEFT JOIN LATERAL ( SELECT loadterm
|
|
|
+ FROM public.kln_ocean_extend koe WHERE koe.serial_no::text = o.serial_no::text and koe.order_from = '$order_from') koe ON true
|
|
|
LEFT JOIN LATERAL ( SELECT company as cn_company,
|
|
|
address_1 as cn_address_1,
|
|
|
address_2 as cn_address_2,
|