|
|
@@ -909,6 +909,7 @@ class ocean_order {
|
|
|
$filterTag_param = "1=1";
|
|
|
}
|
|
|
$tag_and_mode_param = $filterTag_param.$transport_mode_search;
|
|
|
+ $mode_param_search = "1=1 ".$transport_mode_search;
|
|
|
|
|
|
$rc = $_POST ['rc'];
|
|
|
//这里都要查询,除非多传几个参数回来
|
|
|
@@ -919,15 +920,15 @@ class ocean_order {
|
|
|
sum(case when (1<>1 or (transport_mode_extend='road')) then 1 else 0 end) as road_rc,
|
|
|
sum(case when (1<>1 or (transport_mode_extend='rail')) then 1 else 0 end) as rail_rc,
|
|
|
sum(case when $tag_and_mode_param then 1 else 0 end) as seach_rc,
|
|
|
- sum(case when (m_iffcpu is null and m_iffrec is null and m_iffdep is null and m_iffarr is null and m_iffdel is null)
|
|
|
+ sum(case when ($mode_param_search and m_iffcpu is null and m_iffrec is null and m_iffdep is null and m_iffarr is null and m_iffdel is null)
|
|
|
then 1 else 0 end)
|
|
|
as created,
|
|
|
- sum(case when ((m_iffcpu is not null or m_iffrec is not null) and m_iffdep is null and m_iffarr is null and m_iffdel is null)
|
|
|
+ sum(case when ($mode_param_search and (m_iffcpu is not null or m_iffrec is not null) and m_iffdep is null and m_iffarr is null and m_iffdel is null)
|
|
|
then 1 else 0 end)
|
|
|
as cargo_received,
|
|
|
- sum(case when (m_iffdep is not null and m_iffarr is null and m_iffdel is null) then 1 else 0 end) as departed,
|
|
|
- sum(case when (m_iffarr is not null and m_iffdel is null) then 1 else 0 end) as arrived,
|
|
|
- sum(case when (m_iffdel is not null) then 1 else 0 end) as completed,
|
|
|
+ sum(case when ($mode_param_search and m_iffdep is not null and m_iffarr is null and m_iffdel is null) then 1 else 0 end) as departed,
|
|
|
+ sum(case when ($mode_param_search and m_iffarr is not null and m_iffdel is null) then 1 else 0 end) as arrived,
|
|
|
+ sum(case when ($mode_param_search and m_iffdel is not null) then 1 else 0 end) as completed,
|
|
|
string_agg(distinct incoterms, '<$>') as incoterm_str,
|
|
|
string_agg(distinct service, '<$>') as service_str
|
|
|
from public.kln_ocean". $sqlWhere_befrom_filterTag;
|
|
|
@@ -962,7 +963,7 @@ class ocean_order {
|
|
|
$Completed = $sql_all_status_data['completed'];
|
|
|
|
|
|
if (!empty($_POST["filterTag"])) {
|
|
|
- $tagsList = array(array("name"=>"All","number"=>intval($rc),"type"=>"all","checked"=>utils::in_array('All', $_POST["filterTag"])? true : false),
|
|
|
+ $tagsList = array(array("name"=>"All","number"=>intval($search_rc),"type"=>"all","checked"=>utils::in_array('All', $_POST["filterTag"])? true : false),
|
|
|
array("name"=>"Created","number"=>intval($Created),"type"=>"created","checked"=>utils::in_array('Created', $_POST["filterTag"])? true : false),
|
|
|
array("name"=>"Cargo Received","number"=>intval($Cargo_Received),"type"=>"cargo_received","checked"=>utils::in_array('Cargo Received', $_POST["filterTag"])? true : false),
|
|
|
array("name"=>"Departure","number"=>intval($Departed),"type"=>"departure","checked"=>utils::in_array('Departure', $_POST["filterTag"])? true : false),
|
|
|
@@ -970,7 +971,7 @@ class ocean_order {
|
|
|
array("name"=>"Completed","number"=>intval($Completed),"type"=>"completed","checked"=>utils::in_array('Completed', $_POST["filterTag"])? true : false));
|
|
|
}else{
|
|
|
//初始,前端有选择着带入选择
|
|
|
- $tagsList = array(array("name"=>"All","number"=>intval($rc),"type"=>"all","checked"=> true ),
|
|
|
+ $tagsList = array(array("name"=>"All","number"=>intval($search_rc),"type"=>"all","checked"=> true ),
|
|
|
array("name"=>"Created","number"=>intval($Created),"type"=>"created","checked"=> false),
|
|
|
array("name"=>"Cargo Received","number"=>intval($Cargo_Received),"type"=>"cargo_received","checked"=> false),
|
|
|
array("name"=>"Departure","number"=>intval($Departed),"type"=>"departure","checked"=> false),
|
|
|
@@ -980,7 +981,9 @@ class ocean_order {
|
|
|
|
|
|
$TransportList = array(
|
|
|
array("name"=>"Ocean Freight","sname"=>"Sea","number"=>intval($sea_rc),"checked"=>false,"icon"=>"#icon-icon_ocean_b"),
|
|
|
- array("name"=>"Air Freight","sname"=>"Air","number"=>intval($air_rc),"checked"=>false,"icon"=>"#icon-icon_airplane_b"));
|
|
|
+ array("name"=>"Air Freight","sname"=>"Air","number"=>intval($air_rc),"checked"=>false,"icon"=>"#icon-icon_airplane_b"),
|
|
|
+ array("name"=>"Rail Freight","sname"=>"Rail","number"=>intval($rail_rc),"checked"=>false,"icon"=>"#icon-icon_railway_b"),
|
|
|
+ array("name"=>"Road Freight","sname"=>"Road","number"=>intval($road_rc),"checked"=>false,"icon"=>"#icon-icon_truck_b"));
|
|
|
|
|
|
$transport_mode_arr = explode(";", $transport_mode);
|
|
|
foreach($transport_mode_arr as $mode){
|
|
|
@@ -1003,7 +1006,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 oe.*, order_from as _schemas,serial_no as __serial_no, serial_no,transport_mode,
|
|
|
+ $sql = "with oo as (SELECT oe.*, order_from as _schemas,serial_no as __serial_no, serial_no,transport_mode,transport_mode_extend,
|
|
|
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,
|
|
|
@@ -1023,15 +1026,17 @@ class ocean_order {
|
|
|
FROM public.kln_ocean_extend oe WHERE oe.serial_no::text = kln_ocean.serial_no::text and oe.order_from::text = kln_ocean.order_from::text) oe ON true "
|
|
|
. $sqlWhere . " order by $order_by limit " . $ps . " offset " . ($cp - 1) * $ps.")
|
|
|
select oo.* ,
|
|
|
- case when oo.transport_mode ='sea'
|
|
|
+ case when oo.transport_mode ='sea' and oo.order_from ='public'
|
|
|
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 ='sea' and oo.order_from ='sfs'
|
|
|
+ then ( SELECT string_agg(ref_code ||ref_value, ', ') AS other_refenrence_no FROM sfs.ocean_reference temp WHERE temp.serial_no = oo.serial_no)
|
|
|
when oo.transport_mode ='air'
|
|
|
then ''
|
|
|
else ''
|
|
|
end as \"Other refenrence No.\"
|
|
|
from oo";
|
|
|
|
|
|
- $tmp_search_without_limit = "with oo as (SELECT oe.*, order_from as _schemas,serial_no as __serial_no, serial_no,transport_mode,
|
|
|
+ $tmp_search_without_limit = "with oo as (SELECT oe.*, order_from as _schemas,serial_no as __serial_no, serial_no,transport_mode,transport_mode_extend,
|
|
|
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,
|
|
|
@@ -1051,8 +1056,10 @@ class ocean_order {
|
|
|
FROM public.kln_ocean_extend oe WHERE oe.serial_no::text = kln_ocean.serial_no::text and oe.order_from::text = kln_ocean.order_from::text) oe ON true "
|
|
|
. $sqlWhere . " order by $order_by)
|
|
|
select oo.* ,
|
|
|
- case when oo.transport_mode ='sea'
|
|
|
+ case when oo.transport_mode ='sea' and oo.order_from ='public'
|
|
|
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 ='sea' and oo.order_from ='sfs'
|
|
|
+ then ( SELECT string_agg(ref_code ||ref_value, ', ') AS other_refenrence_no FROM sfs.ocean_reference temp WHERE temp.serial_no = oo.serial_no)
|
|
|
when oo.transport_mode ='air'
|
|
|
then ''
|
|
|
else ''
|
|
|
@@ -1068,7 +1075,9 @@ class ocean_order {
|
|
|
//返回加密serial_no
|
|
|
$rs[$index]["__serial_no"] = common::deCode($val['__serial_no'], 'E');
|
|
|
//$rs[$index]["mode"] = "Ocean Freight";
|
|
|
- $rs[$index]["Mode"] = $val['transport_mode'] == 'sea' ? "Ocean Freight" : ($val['transport_mode'] == 'air' ? "Air Freight": "");
|
|
|
+ $rs[$index]["Mode"] = $val['transport_mode_extend'] == 'sea' ? "Ocean Freight" : ($val['transport_mode_extend'] == 'air' ? "Air Freight":
|
|
|
+ ($val['transport_mode_extend'] == 'rail' ? "Rail Freight":
|
|
|
+ ($val['transport_mode_extend'] == 'road' ? "Road 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"];
|
|
|
@@ -1191,6 +1200,8 @@ class ocean_order {
|
|
|
//处理Container :配置Ocean_Container字段 UI 需要的字段有:Container.no Packing,quantity,Gross weight(kg),Gross weight(LB),CBM,seal#,size.service
|
|
|
$ocean_container_column = array();
|
|
|
$container_column = column::getInstance()->getDisplayColumnAll('Ocean_Container');
|
|
|
+ //特殊处理po_no,配置column在查询的时候,不好
|
|
|
+ $container_column[] = array("database_column_name" => "po_no","name"=>"PO_NO");
|
|
|
$container_column_config = array("Quantity" => array("formatter"=>"number","digits"=>0),
|
|
|
"Gross Weight" => array("formatter"=>"number","digits"=>3),
|
|
|
"Gross Weight" => array("formatter"=>"number","digits"=>3),
|
|
|
@@ -1207,7 +1218,10 @@ class ocean_order {
|
|
|
}
|
|
|
|
|
|
}
|
|
|
- $sql = "SELECT " . column::getInstance()->getSearchSql('Ocean_Container') . ",net_lbs from oc_container where lower(serial_no) = '" . strtolower($serial_no) . "'";
|
|
|
+ $sql = "SELECT " . column::getInstance()->getSearchSql('Ocean_Container') . ",
|
|
|
+ net_lbs,po_no as oc_po_no,
|
|
|
+ (select po_no from oc_container_item where oc_container_id = oc_container.id) as item_po_no
|
|
|
+ from oc_container where lower(serial_no) = '" . strtolower($serial_no) . "'";
|
|
|
$rss = common::excuteListSql($sql);
|
|
|
|
|
|
$quantity_unit = array();
|
|
|
@@ -1216,6 +1230,9 @@ class ocean_order {
|
|
|
$ch_weight_tolal_grs_lbs = 0;
|
|
|
$cbm_tolal = 0;
|
|
|
foreach ($rss as $key => $rs) {
|
|
|
+ //特殊处理po_no
|
|
|
+ $rss[$key]['po_no'] = utils::outDisplayForMergeForDISTINCT($rs['oc_po_no'],$rs['item_po_no']);
|
|
|
+
|
|
|
$unit = $rs['unit'];
|
|
|
if (array_key_exists($unit, $quantity_unit)) {
|
|
|
$quantity_unit[$unit] = $quantity_unit[$unit] + $rs['qty'];
|
|
|
@@ -1559,7 +1576,10 @@ class ocean_order {
|
|
|
//返回加密serial_no
|
|
|
$rs[$index]["__serial_no"] = common::deCode($val['__serial_no'], 'E');
|
|
|
//$rs[$index]["mode"] = "Ocean Freight";
|
|
|
- $rs[$index]["Mode"] = $val['transport_mode'] == 'sea' ? "Ocean Freight" : ($val['transport_mode'] == 'air' ? "Air Freight": "");
|
|
|
+ $rs[$index]["Mode"] = $val['transport_mode_extend'] == 'sea' ? "Ocean Freight" :
|
|
|
+ ($val['transport_mode_extend'] == 'air' ? "Air Freight":
|
|
|
+ ($val['transport_mode_extend'] == 'rail' ? "Rail Freight":
|
|
|
+ ($val['transport_mode_extend'] == 'road'? "Road Freight": "")));
|
|
|
//status 改为ocean_milestone里的信息
|
|
|
$rs[$index]["Status"] = $rs[$index]["new_status"];
|
|
|
}
|
|
|
@@ -1953,6 +1973,7 @@ class ocean_order {
|
|
|
atd as oo_atd,
|
|
|
ata as oo_ata,
|
|
|
carbon_emission,
|
|
|
+ transport_mode_extend,
|
|
|
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,
|
|
|
@@ -2211,7 +2232,12 @@ class ocean_order {
|
|
|
$data['shipmentData'] = $simplexData;
|
|
|
|
|
|
//处理transportInfo信息数据(air改过,从KLN_Ocean主表信息 etd 和eta 的取值跟ocean的f_etd,m_eta)
|
|
|
- $transportInfo = array("Tracking No." =>$ocean['_tracking_no'],"status"=>$ocean['new_status'],"mode" => "Ocean Freight",
|
|
|
+ $_mode = $ocean['transport_mode_extend'] == 'sea' ? "Ocean Freight" :
|
|
|
+ ($ocean['transport_mode_extend'] == 'air' ? "Air Freight":
|
|
|
+ ($ocean['transport_mode_extend'] == 'rail' ? "Rail Freight":
|
|
|
+ ($ocean['transport_mode_extend'] == 'road' ? "Road Freight": "")));
|
|
|
+
|
|
|
+ $transportInfo = array("Tracking No." =>$ocean['_tracking_no'],"status"=>$ocean['new_status'],"mode" => $_mode,
|
|
|
"origin" =>$ocean['shippr_uncode'],"destination" =>$ocean['consignee_uncode'],
|
|
|
"etd" =>$ocean['f_etd'],"atd" =>$ocean['atd'],
|
|
|
"etd_timezone" =>$ocean['pol_timezone'],
|
|
|
@@ -2374,7 +2400,11 @@ class ocean_order {
|
|
|
$data['shipmentData'] = $simplexData;
|
|
|
|
|
|
//处理transportInfo信息数据(air改过,从KLN_Ocean主表信息 etd 和eta 的取值跟ocean的f_etd,m_eta)
|
|
|
- $transportInfo = array("Tracking No." =>$ocean['tracking_no'],"status"=>$ocean['new_status'],"mode" => "Air Freight",
|
|
|
+ $_mode = $ocean['transport_mode_extend'] == 'sea' ? "Ocean Freight" :
|
|
|
+ ($ocean['transport_mode_extend'] == 'air' ? "Air Freight":
|
|
|
+ ($ocean['transport_mode_extend'] == 'rail' ? "Rail Freight":
|
|
|
+ ($ocean['transport_mode_extend'] == 'road' ? "Road Freight": "")));
|
|
|
+ $transportInfo = array("Tracking No." =>$ocean['tracking_no'],"status"=>$ocean['new_status'],"mode" => $_mode,
|
|
|
"origin" =>$ocean['shippr_uncode'],"destination" =>$ocean['consignee_uncode'],
|
|
|
"etd" =>$ocean['etd'],"atd" =>$ocean['atd'],
|
|
|
"etd_timezone" =>$ocean['pol_timezone'],
|