|
@@ -527,9 +527,9 @@ class ocean_order {
|
|
|
$allBookingColumns = column::getInstance()->tableColumns('Ocean_Search',$allColumn);
|
|
$allBookingColumns = column::getInstance()->tableColumns('Ocean_Search',$allColumn);
|
|
|
}
|
|
}
|
|
|
$tp = ceil($rc / $ps);
|
|
$tp = ceil($rc / $ps);
|
|
|
- $order_by = " etd desc NULLS LAST, id";
|
|
|
|
|
|
|
+ $order_by = " etd desc NULLS LAST";
|
|
|
if (_isCustomerLogin()) {
|
|
if (_isCustomerLogin()) {
|
|
|
- $order_by = " eta desc NULLS LAST, id";
|
|
|
|
|
|
|
+ $order_by = " eta desc NULLS LAST";
|
|
|
}
|
|
}
|
|
|
if ($rc > 0) {
|
|
if ($rc > 0) {
|
|
|
$ocean_ref_sql = " LEFT JOIN LATERAL ( SELECT string_agg(ref_code ||ref_value, ', ') AS other_refenrence_no
|
|
$ocean_ref_sql = " LEFT JOIN LATERAL ( SELECT string_agg(ref_code ||ref_value, ', ') AS other_refenrence_no
|
|
@@ -678,6 +678,7 @@ class ocean_order {
|
|
|
$quantity_unit = array();
|
|
$quantity_unit = array();
|
|
|
$g_weight_tolal = 0;
|
|
$g_weight_tolal = 0;
|
|
|
$ch_weight_tolal = 0;
|
|
$ch_weight_tolal = 0;
|
|
|
|
|
+ $ch_weight_tolal_grs_lbs = 0;
|
|
|
$cbm_tolal = 0;
|
|
$cbm_tolal = 0;
|
|
|
foreach ($rss as $key => $rs) {
|
|
foreach ($rss as $key => $rs) {
|
|
|
$unit = $rs['unit'];
|
|
$unit = $rs['unit'];
|
|
@@ -688,6 +689,7 @@ class ocean_order {
|
|
|
}
|
|
}
|
|
|
$g_weight_tolal += $rs['grs_kgs'];
|
|
$g_weight_tolal += $rs['grs_kgs'];
|
|
|
$ch_weight_tolal += $rs['net_lbs'];
|
|
$ch_weight_tolal += $rs['net_lbs'];
|
|
|
|
|
+ $ch_weight_tolal_grs_lbs += $rs['grs_lbs'];
|
|
|
$cbm_tolal += $rs['cbm'];
|
|
$cbm_tolal += $rs['cbm'];
|
|
|
//特殊处理weight
|
|
//特殊处理weight
|
|
|
if(!empty($rss[$key]['grs_kgs'])){
|
|
if(!empty($rss[$key]['grs_kgs'])){
|
|
@@ -701,6 +703,7 @@ class ocean_order {
|
|
|
foreach($quantity_unit as $uk => $uv){
|
|
foreach($quantity_unit as $uk => $uv){
|
|
|
$quantity_tolal.=$uv." ".$uk." ";
|
|
$quantity_tolal.=$uv." ".$uk." ";
|
|
|
}
|
|
}
|
|
|
|
|
+ $ch_weight_tolal = empty($ch_weight_tolal) ? $ch_weight_tolal_grs_lbs : $ch_weight_tolal;
|
|
|
//Containers信息
|
|
//Containers信息
|
|
|
$containers = array("container_column"=>$ocean_container_column,"container_data" =>$rss);
|
|
$containers = array("container_column"=>$ocean_container_column,"container_data" =>$rss);
|
|
|
//Packing信息
|
|
//Packing信息
|
|
@@ -731,6 +734,7 @@ class ocean_order {
|
|
|
//Container_Status 新版只显示几个状态, CTNR# EE I AE VD VA
|
|
//Container_Status 新版只显示几个状态, CTNR# EE I AE VD VA
|
|
|
$container_status_column = array("EE","I","AE","VD","VA");
|
|
$container_status_column = array("EE","I","AE","VD","VA");
|
|
|
$containerStatusDataTemp = array();
|
|
$containerStatusDataTemp = array();
|
|
|
|
|
+ $ctnr_uncodes = "";
|
|
|
$content = array();
|
|
$content = array();
|
|
|
foreach($container_status_column as $status){
|
|
foreach($container_status_column as $status){
|
|
|
foreach($ctnr_status as $event){
|
|
foreach($ctnr_status as $event){
|
|
@@ -739,11 +743,18 @@ class ocean_order {
|
|
|
if (empty($event["source_id"]) || $event["source_id"]==0) {
|
|
if (empty($event["source_id"]) || $event["source_id"]==0) {
|
|
|
$eventdate.= " " . $event["eventtime"];
|
|
$eventdate.= " " . $event["eventtime"];
|
|
|
}
|
|
}
|
|
|
- $location_code = $event["eventtype"] . "," . $event["eventcode"];
|
|
|
|
|
|
|
+ $location_code = $event["eventcode"];
|
|
|
$content[] = array("title" =>$event['description'],"date"=>$eventdate,"country"=>$location_code);
|
|
$content[] = array("title" =>$event['description'],"date"=>$eventdate,"country"=>$location_code);
|
|
|
|
|
+ $ctnr_uncodes .=$location_code.";";
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+ //查询全部uncode timezone
|
|
|
|
|
+ $uncode_rs = common::getCityPortsInfo($ctnr_uncodes);
|
|
|
|
|
+ //循环去回填时区
|
|
|
|
|
+ foreach($content as $ck => $cv){
|
|
|
|
|
+ $content[$ck]['timezone'] = $uncode_rs[$cv['country']];
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
$containerStatusDataTemp['label'] = $cd['ctnr']." / ".$cd['size'];
|
|
$containerStatusDataTemp['label'] = $cd['ctnr']." / ".$cd['size'];
|
|
|
$containerStatusDataTemp['content'] = $content;
|
|
$containerStatusDataTemp['content'] = $content;
|
|
@@ -1236,12 +1247,15 @@ class ocean_order {
|
|
|
(select incoterms from online_ocean where online_ocean.serial_no = o.serial_no limit 1) as incoterms,
|
|
(select incoterms from online_ocean where online_ocean.serial_no = o.serial_no limit 1) as incoterms,
|
|
|
public.z_get_eta_dest(o.final_eta::date, o.eta_dest::text, o.service::text, o.m_eta::date, o.place_of_delivery::text, o.mport_of_discharge::text) as _eta_dest,
|
|
public.z_get_eta_dest(o.final_eta::date, o.eta_dest::text, o.service::text, o.m_eta::date, o.place_of_delivery::text, o.mport_of_discharge::text) as _eta_dest,
|
|
|
to_char(final_eta, 'MM/DD/YYYY') as _final_eta,
|
|
to_char(final_eta, 'MM/DD/YYYY') as _final_eta,
|
|
|
- o.* ,sh.*, cn.* ,aa.*,dd.*,
|
|
|
|
|
|
|
+ o.* ,sh.*, cn.* ,aa.*,dd.*,oo.*,
|
|
|
CASE
|
|
CASE
|
|
|
WHEN ee.status is null THEN 'Created'::text
|
|
WHEN ee.status is null THEN 'Created'::text
|
|
|
ELSE ee.status::text
|
|
ELSE ee.status::text
|
|
|
END AS new_status
|
|
END AS new_status
|
|
|
from ocean o
|
|
from ocean o
|
|
|
|
|
+ LEFT JOIN LATERAL ( SELECT shippr_uncode,shipper_city,
|
|
|
|
|
+ consignee_uncode,consignee_city,fport_of_loading_un,mport_of_discharge_un
|
|
|
|
|
+ FROM public.online_ocean oo WHERE oo.serial_no::text = o.serial_no::text) oo ON true
|
|
|
left join LATERAL (select case when a.code='IFFBCF' then 'Created'
|
|
left join LATERAL (select case when a.code='IFFBCF' then 'Created'
|
|
|
when a.code='IFFCPU' then 'Cargo Received'
|
|
when a.code='IFFCPU' then 'Cargo Received'
|
|
|
when a.code='IFFREC' then 'Cargo Received'
|
|
when a.code='IFFREC' then 'Cargo Received'
|
|
@@ -1317,12 +1331,14 @@ class ocean_order {
|
|
|
|
|
|
|
|
//port_of_Loading
|
|
//port_of_Loading
|
|
|
$port_of_Loading_stauts = array("index" =>2,"label" =>"Port of Loading",
|
|
$port_of_Loading_stauts = array("index" =>2,"label" =>"Port of Loading",
|
|
|
- "path" =>$ocean['fport_of_loading_exp_exp']."/".$ocean['fport_of_loading_exp'],"isArrival" =>$state >= 1 ? true : false);
|
|
|
|
|
|
|
+ "path" =>$ocean['fport_of_loading_exp']."/".$ocean['fport_of_loading'],"isArrival" =>$state >= 1 ? true : false);
|
|
|
$children = array();
|
|
$children = array();
|
|
|
if ($state < 1){
|
|
if ($state < 1){
|
|
|
//未发生前
|
|
//未发生前
|
|
|
if(!empty($ocean_milestone_status_code['IFFDEP']['est_date'])){
|
|
if(!empty($ocean_milestone_status_code['IFFDEP']['est_date'])){
|
|
|
$children[] = array("label" =>"Departure(ETD)","date" =>$ocean_milestone_status_code['IFFDEP']['est_date']);
|
|
$children[] = array("label" =>"Departure(ETD)","date" =>$ocean_milestone_status_code['IFFDEP']['est_date']);
|
|
|
|
|
+ //如果milestone有值,或者与milestone不等,以milestone的优先度最高
|
|
|
|
|
+ $ocean['f_etd'] = $ocean_milestone_status_code['IFFDEP']['est_date'];
|
|
|
} else {
|
|
} else {
|
|
|
//没有,取etd
|
|
//没有,取etd
|
|
|
$children[] = array("label" =>"Departure(ETD)","date" =>$ocean['f_etd']);
|
|
$children[] = array("label" =>"Departure(ETD)","date" =>$ocean['f_etd']);
|
|
@@ -1333,6 +1349,8 @@ class ocean_order {
|
|
|
}
|
|
}
|
|
|
if(!empty($ocean_milestone_status_code['IFFDEP']['act_date'])){
|
|
if(!empty($ocean_milestone_status_code['IFFDEP']['act_date'])){
|
|
|
$children[] = array("label" =>"Departure(ATD)","date" =>$ocean_milestone_status_code['IFFDEP']['act_date']);
|
|
$children[] = array("label" =>"Departure(ATD)","date" =>$ocean_milestone_status_code['IFFDEP']['act_date']);
|
|
|
|
|
+ //如果milestone有值,或者与milestone不等,以milestone的优先度最高
|
|
|
|
|
+ $ocean['f_etd'] = $ocean_milestone_status_code['IFFDEP']['act_date'];
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
$port_of_Loading_stauts["children"] = $children;
|
|
$port_of_Loading_stauts["children"] = $children;
|
|
@@ -1342,19 +1360,21 @@ class ocean_order {
|
|
|
$port_of_Discharge_status = array("index" =>3,"label" =>"Port of Discharge",
|
|
$port_of_Discharge_status = array("index" =>3,"label" =>"Port of Discharge",
|
|
|
"path" =>$ocean['mport_of_discharge_exp']."/".$ocean['mport_of_discharge'],"isArrival" =>$state >= 2 ? true : false);
|
|
"path" =>$ocean['mport_of_discharge_exp']."/".$ocean['mport_of_discharge'],"isArrival" =>$state >= 2 ? true : false);
|
|
|
$children = array();
|
|
$children = array();
|
|
|
- if ($state < 2){
|
|
|
|
|
- //未发生前
|
|
|
|
|
- if(!empty($ocean_milestone_status_code['IFFARR']['est_date'])){
|
|
|
|
|
- $children[] = array("label" =>"Arrival(ETA)","date" =>$ocean_milestone_status_code['IFFARR']['est_date']);
|
|
|
|
|
- }else{
|
|
|
|
|
- //没有,取eta
|
|
|
|
|
- $children[] = array("label" =>"Arrival(ETA)","date" =>$ocean['m_eta']);
|
|
|
|
|
- }
|
|
|
|
|
- } else{
|
|
|
|
|
- if(!empty($ocean_milestone_status_code['IFFARR']['act_date'])){
|
|
|
|
|
- $children[] = array("label" =>"Arrival(ATA)","date" =>$ocean_milestone_status_code['IFFARR']['act_date']);
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ // if ($state < 2){
|
|
|
|
|
+ // //未发生前
|
|
|
|
|
+ // if(!empty($ocean_milestone_status_code['IFFARR']['est_date'])){
|
|
|
|
|
+ // $children[] = array("label" =>"Arrival(ETA)","date" =>$ocean_milestone_status_code['IFFARR']['est_date']);
|
|
|
|
|
+ // }else{
|
|
|
|
|
+ // //没有,取eta
|
|
|
|
|
+ // $children[] = array("label" =>"Arrival(ETA)","date" =>$ocean['m_eta']);
|
|
|
|
|
+ // }
|
|
|
|
|
+ // } else{
|
|
|
|
|
+ // if(!empty($ocean_milestone_status_code['IFFARR']['act_date'])){
|
|
|
|
|
+ // $children[] = array("label" =>"Arrival(ATA)","date" =>$ocean_milestone_status_code['IFFARR']['act_date']);
|
|
|
|
|
+ // }
|
|
|
|
|
+ // }
|
|
|
|
|
+ //不需要判断是否发送,根据 milestone 和m_eta 的同步关系,这里m_eta 优先度最高
|
|
|
|
|
+ $children[] = array("label" =>"Arrival(ETA)","date" =>$ocean['m_eta']);
|
|
|
$port_of_Discharge_status["children"] = $children;
|
|
$port_of_Discharge_status["children"] = $children;
|
|
|
$simplexData[] = $port_of_Discharge_status;
|
|
$simplexData[] = $port_of_Discharge_status;
|
|
|
|
|
|
|
@@ -1373,10 +1393,19 @@ class ocean_order {
|
|
|
$data['shipmentData'] = $simplexData;
|
|
$data['shipmentData'] = $simplexData;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+ //获取对应uncode 对应的时间
|
|
|
|
|
+ $uncodes = $ocean['fport_of_loading_un'].";".$ocean['mport_of_discharge_un'];
|
|
|
|
|
+ $codeinfo = common::getCityPortsInfo($uncodes);
|
|
|
|
|
+
|
|
|
//处理transportInfo信息数据
|
|
//处理transportInfo信息数据
|
|
|
$transportInfo = array("Tracking No." =>$ocean['tracking_no'],"status"=>$ocean['new_status'],"mode" => "Ocean Freight",
|
|
$transportInfo = array("Tracking No." =>$ocean['tracking_no'],"status"=>$ocean['new_status'],"mode" => "Ocean Freight",
|
|
|
"origin" =>$ocean['origin_station'],"destination" =>$ocean['destination_station'],
|
|
"origin" =>$ocean['origin_station'],"destination" =>$ocean['destination_station'],
|
|
|
- "etd" =>$ocean['f_etd'],"atd" =>"","eta" =>$ocean['m_eta'],"ata" =>"");
|
|
|
|
|
|
|
+ "etd" =>$ocean['f_etd'],"atd" =>$ocean['atd'],
|
|
|
|
|
+ "etd_timezone" =>$codeinfo[$ocean['fport_of_loading_un']],
|
|
|
|
|
+ "atd_timezone" =>$codeinfo[$ocean['fport_of_loading_un']],
|
|
|
|
|
+ "eta" =>$ocean['m_eta'],"ata" =>$ocean['ata'],
|
|
|
|
|
+ "eta_timezone" =>$codeinfo[$ocean['mport_of_discharge_un']],
|
|
|
|
|
+ "ata_timezone" =>$codeinfo[$ocean['mport_of_discharge_un']]);
|
|
|
$data['transportInfo'] = $transportInfo;
|
|
$data['transportInfo'] = $transportInfo;
|
|
|
|
|
|
|
|
//处理basicInfo信息数据
|
|
//处理basicInfo信息数据
|
|
@@ -1407,15 +1436,15 @@ class ocean_order {
|
|
|
//处理routes 转船可能有多个情况
|
|
//处理routes 转船可能有多个情况
|
|
|
$routes = array(array("mode" =>"Ocean Freight","mode_label" =>"Sea", "origin" =>$ocean['fport_of_loading'],
|
|
$routes = array(array("mode" =>"Ocean Freight","mode_label" =>"Sea", "origin" =>$ocean['fport_of_loading'],
|
|
|
"destination" => $ocean['fport_of_discharge'],
|
|
"destination" => $ocean['fport_of_discharge'],
|
|
|
- "etd" => $ocean['f_etd'],"atd" => "",
|
|
|
|
|
- "eta" =>$ocean['f_eta'],"ata" =>"",
|
|
|
|
|
|
|
+ "etd" => $ocean['f_etd'],"atd" => $ocean['atd'],
|
|
|
|
|
+ "eta" =>$ocean['f_eta'],"ata" => $ocean['ata'],
|
|
|
"vessel" =>$ocean['f_vessel'],"voyageNo" =>$ocean['f_voyage']));
|
|
"vessel" =>$ocean['f_vessel'],"voyageNo" =>$ocean['f_voyage']));
|
|
|
//不是直航
|
|
//不是直航
|
|
|
if ($ocean['is_vessel_direct'] <> "t"){
|
|
if ($ocean['is_vessel_direct'] <> "t"){
|
|
|
$routes[] = array("mode" =>"Ocean Freight", "mode_label" =>"Sea","origin" =>$ocean['mport_of_loading'],
|
|
$routes[] = array("mode" =>"Ocean Freight", "mode_label" =>"Sea","origin" =>$ocean['mport_of_loading'],
|
|
|
"destination" => $ocean['mport_of_discharge'],
|
|
"destination" => $ocean['mport_of_discharge'],
|
|
|
- "etd" => $ocean['m_etd'],"atd" => "",
|
|
|
|
|
- "eta" =>$ocean['m_eta'],"ata" =>"",
|
|
|
|
|
|
|
+ "etd" => $ocean['m_etd'],"atd" => $ocean['atd'],
|
|
|
|
|
+ "eta" =>$ocean['m_eta'],"ata" =>$ocean['ata'],
|
|
|
"vessel" =>$ocean['m_vessel'],"voyageNo" =>$ocean['m_voyage']);
|
|
"vessel" =>$ocean['m_vessel'],"voyageNo" =>$ocean['m_voyage']);
|
|
|
}
|
|
}
|
|
|
$data['routes'] = $routes;
|
|
$data['routes'] = $routes;
|