|
@@ -368,11 +368,12 @@ class ocean_order {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
//查询tag
|
|
//查询tag
|
|
|
- // IFFBCF;Booking Confirmation
|
|
|
|
|
- // IFFREC;Cargo Arrived at Origin
|
|
|
|
|
- // IFFDEP;Departure
|
|
|
|
|
- // IFFARR;Arrived at Final Destination Port
|
|
|
|
|
- // IFFAFD;Arrived at Final Destination
|
|
|
|
|
|
|
+ // IFFBCF Booking Confirmation Booked
|
|
|
|
|
+ // IFFCPU Cargo Pickup Cargo Received
|
|
|
|
|
+ // IFFREC Cargo Arrived at Origin Cargo Received
|
|
|
|
|
+ // IFFDEP Departure Departed
|
|
|
|
|
+ // IFFARR Arrived at Final Destination Port Arrived
|
|
|
|
|
+ // IFFAFD Arrived at Final Destination Completed
|
|
|
if (!empty($_POST["filterTag"])) {
|
|
if (!empty($_POST["filterTag"])) {
|
|
|
if (utils::count($_POST['filterTag']) == 1){
|
|
if (utils::count($_POST['filterTag']) == 1){
|
|
|
$filterTag = $_POST['filterTag'][0];
|
|
$filterTag = $_POST['filterTag'][0];
|
|
@@ -426,18 +427,18 @@ class ocean_order {
|
|
|
//这里都要查询,除非多传几个参数回来
|
|
//这里都要查询,除非多传几个参数回来
|
|
|
if ($rc == - 1 || true) {
|
|
if ($rc == - 1 || true) {
|
|
|
$sql = "select count(1) from online_ocean
|
|
$sql = "select count(1) from online_ocean
|
|
|
- left join LATERAL (select case when a.description='Booking Confirmation' then 'Booked'
|
|
|
|
|
- when a.description='Cargo Pickup' then 'Cargo Received'
|
|
|
|
|
- when a.description='Cargo Arrived at Origin' then 'Cargo Received'
|
|
|
|
|
- when a.description='Departure' then 'Departed'
|
|
|
|
|
- when a.description='Arrived at Final Destination Port Arrived' then 'Arrived'
|
|
|
|
|
- when a.description='Arrived at Final Destination' then 'Completed'
|
|
|
|
|
- else 'Booked' END as status
|
|
|
|
|
- from ocean_milestone a
|
|
|
|
|
- where a.serial_no=online_ocean.serial_no
|
|
|
|
|
- and a.description in (
|
|
|
|
|
- select regexp_split_to_table('Booking Confirmation,Cargo Pickup,Cargo Arrived at Origin,Departure,Arrived at Final Destination Port,Arrived at Final Destination', ','))
|
|
|
|
|
- order by id desc limit 1) dd on true" . $sqlWhere;
|
|
|
|
|
|
|
+ left join LATERAL (select case when a.code='IFFBCF' then 'Booked'
|
|
|
|
|
+ when a.code='IFFCPU' then 'Cargo Received'
|
|
|
|
|
+ when a.code='IFFREC' then 'Cargo Received'
|
|
|
|
|
+ when a.code='IFFDEP' then 'Departed'
|
|
|
|
|
+ when a.code='IFFARR' then 'Arrived'
|
|
|
|
|
+ when a.code='IFFAFD' then 'Completed'
|
|
|
|
|
+ else 'Booked' END as status
|
|
|
|
|
+ from ocean_milestone a
|
|
|
|
|
+ where a.serial_no=online_ocean.serial_no
|
|
|
|
|
+ and a.code in (select regexp_split_to_table('IFFBCF,IFFCPU,IFFREC,IFFDEP,IFFARR,IFFAFD', ','))
|
|
|
|
|
+ order by id desc limit 1) dd on true" . $sqlWhere;
|
|
|
|
|
+
|
|
|
$rc = common::excuteOneSql($sql);
|
|
$rc = common::excuteOneSql($sql);
|
|
|
error_log("online_ocean_count_ALL_SQL:".$sql);
|
|
error_log("online_ocean_count_ALL_SQL:".$sql);
|
|
|
|
|
|
|
@@ -499,21 +500,20 @@ class ocean_order {
|
|
|
$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
|
|
|
FROM public.ocean_reference temp WHERE temp.serial_no = online_ocean.serial_no) aa ON true ";
|
|
FROM public.ocean_reference temp WHERE temp.serial_no = online_ocean.serial_no) aa ON true ";
|
|
|
|
|
|
|
|
- $ocean_status_sql = " LEFT JOIN LATERAL ( select case when a.description='Booking Confirmation' then 'Booked'
|
|
|
|
|
- when a.description='Cargo Pickup' then 'Cargo Received'
|
|
|
|
|
- when a.description='Cargo Arrived at Origin' then 'Cargo Received'
|
|
|
|
|
- when a.description='Departure' then 'Departed'
|
|
|
|
|
- when a.description='Arrived at Final Destination Port Arrived' then 'Arrived'
|
|
|
|
|
- when a.description='Arrived at Final Destination' then 'Completed'
|
|
|
|
|
- else 'Booked' END as new_status
|
|
|
|
|
- from ocean_milestone a
|
|
|
|
|
- where a.serial_no=online_ocean.serial_no
|
|
|
|
|
- and a.description in (
|
|
|
|
|
- select regexp_split_to_table('Booking Confirmation,Cargo Pickup,Cargo Arrived at Origin,Departure,Arrived at Final Destination Port,Arrived at Final Destination', ','))
|
|
|
|
|
- order by id desc limit 1) dd ON true ";
|
|
|
|
|
|
|
+ $ocean_status_sql = " LEFT JOIN LATERAL (select case when a.code='IFFBCF' then 'Booked'
|
|
|
|
|
+ when a.code='IFFCPU' then 'Cargo Received'
|
|
|
|
|
+ when a.code='IFFREC' then 'Cargo Received'
|
|
|
|
|
+ when a.code='IFFDEP' then 'Departed'
|
|
|
|
|
+ when a.code='IFFARR' then 'Arrived'
|
|
|
|
|
+ when a.code='IFFAFD' then 'Completed'
|
|
|
|
|
+ else 'Booked' END as new_status
|
|
|
|
|
+ from ocean_milestone a
|
|
|
|
|
+ where a.serial_no=online_ocean.serial_no
|
|
|
|
|
+ and a.code in (select regexp_split_to_table('IFFBCF,IFFCPU,IFFREC,IFFDEP,IFFARR,IFFAFD', ','))
|
|
|
|
|
+ order by id desc limit 1) dd ON true ";
|
|
|
|
|
|
|
|
$sql = "SELECT order_from as _schemas,serial_no as __serial_no, serial_no,
|
|
$sql = "SELECT order_from as _schemas,serial_no as __serial_no, serial_no,
|
|
|
- h_bol as _hbol, isf_bol as _isfbol,
|
|
|
|
|
|
|
+ h_bol as _hbol, isf_bol as _isfbol, consignee_city as _consignee_city,
|
|
|
CASE
|
|
CASE
|
|
|
WHEN dd.new_status is null THEN 'Booked'::text
|
|
WHEN dd.new_status is null THEN 'Booked'::text
|
|
|
ELSE dd.new_status::text
|
|
ELSE dd.new_status::text
|
|
@@ -528,7 +528,12 @@ class ocean_order {
|
|
|
//返回加密serial_no
|
|
//返回加密serial_no
|
|
|
$rs[$index]["__serial_no"] = common::deCode($val['__serial_no'], 'E');
|
|
$rs[$index]["__serial_no"] = common::deCode($val['__serial_no'], 'E');
|
|
|
$rs[$index]["mode"] = "Ocean Freight";
|
|
$rs[$index]["mode"] = "Ocean Freight";
|
|
|
|
|
+ //status 改为ocean_milestone里的信息
|
|
|
$rs[$index]["Status"] = $rs[$index]["new_status"];
|
|
$rs[$index]["Status"] = $rs[$index]["new_status"];
|
|
|
|
|
+ //以下新增的origin是 shipper和consignee的地址
|
|
|
|
|
+ if(array_key_exists("Origin", $val)){
|
|
|
|
|
+ $rs[$index]["Origin"] = utils::outDisplayForMerge($val['Origin'],$val['_consignee_city']);
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
$arrTmp = array('searchData' => $rs,
|
|
$arrTmp = array('searchData' => $rs,
|
|
@@ -621,7 +626,6 @@ class ocean_order {
|
|
|
$ref_no[] = array("label"=>$ref["ref_code"],"value"=>$ref["ref_value"]);
|
|
$ref_no[] = array("label"=>$ref["ref_code"],"value"=>$ref["ref_value"]);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
//处理Container :配置Ocean_Container字段 UI 需要的字段有:Container.no Packing,quantity,Gross weight(kg),Gross weight(LB),CBM,seal#,size.service
|
|
//处理Container :配置Ocean_Container字段 UI 需要的字段有:Container.no Packing,quantity,Gross weight(kg),Gross weight(LB),CBM,seal#,size.service
|
|
|
$ocean_container_column = array();
|
|
$ocean_container_column = array();
|
|
|
$container_column = column::getInstance()->getDisplayColumnAll('Ocean_Container');
|
|
$container_column = column::getInstance()->getDisplayColumnAll('Ocean_Container');
|
|
@@ -640,7 +644,7 @@ class ocean_order {
|
|
|
$g_weight_tolal += $rs['grs_kgs'];
|
|
$g_weight_tolal += $rs['grs_kgs'];
|
|
|
$ch_weight_tolal += $rs['grs_lbs'];
|
|
$ch_weight_tolal += $rs['grs_lbs'];
|
|
|
$cbm_tolal += $rs['cbm'];
|
|
$cbm_tolal += $rs['cbm'];
|
|
|
- $packages = " ".$rs['unit'];
|
|
|
|
|
|
|
+ $packages = $rs['unit'];
|
|
|
//特殊处理weight
|
|
//特殊处理weight
|
|
|
if(!empty($rss[$key]['grs_kgs'])){
|
|
if(!empty($rss[$key]['grs_kgs'])){
|
|
|
$rss[$key]['grs_kgs'] = $rs['grs_kgs']."KG";
|
|
$rss[$key]['grs_kgs'] = $rs['grs_kgs']."KG";
|
|
@@ -649,10 +653,10 @@ class ocean_order {
|
|
|
$rss[$key]['grs_lbs'] = $rs['grs_lbs']."LB";
|
|
$rss[$key]['grs_lbs'] = $rs['grs_lbs']."LB";
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+ //Containers信息
|
|
|
$containers = array("container_column"=>$ocean_container_column,"container_data" =>$rss);
|
|
$containers = array("container_column"=>$ocean_container_column,"container_data" =>$rss);
|
|
|
-
|
|
|
|
|
//Packing信息
|
|
//Packing信息
|
|
|
- $packing = array("Quantity/Unit"=>$quantity_tolal.$packages,"G. Weight" => $g_weight_tolal." KGS","Ch. Weight" => $ch_weight_tolal." LBS","Volume" => $cbm_tolal." CBM");
|
|
|
|
|
|
|
+ $packing = array("Quantity/Unit"=>$quantity_tolal." ".$packages,"G. Weight" => $g_weight_tolal." KGS","Ch. Weight" => $ch_weight_tolal." LBS","Volume" => $cbm_tolal." CBM");
|
|
|
|
|
|
|
|
/* Container Status */
|
|
/* Container Status */
|
|
|
//数据库里配置好
|
|
//数据库里配置好
|
|
@@ -1158,17 +1162,16 @@ class ocean_order {
|
|
|
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.*,ee.status as new_status
|
|
o.* ,sh.*, cn.* ,aa.*,dd.*,ee.status as new_status
|
|
|
from ocean o
|
|
from ocean o
|
|
|
- left join LATERAL (select case when a.description='Booking Confirmation' then 'Booked'
|
|
|
|
|
- when a.description='Cargo Pickup' then 'Cargo Received'
|
|
|
|
|
- when a.description='Cargo Arrived at Origin' then 'Cargo Received'
|
|
|
|
|
- when a.description='Departure' then 'Departed'
|
|
|
|
|
- when a.description='Arrived at Final Destination Port Arrived' then 'Arrived'
|
|
|
|
|
- when a.description='Arrived at Final Destination' then 'Completed'
|
|
|
|
|
- else 'Booked' END as status
|
|
|
|
|
- from ocean_milestone a
|
|
|
|
|
- where a.serial_no=o.serial_no
|
|
|
|
|
- and a.description in (
|
|
|
|
|
- select regexp_split_to_table('Booking Confirmation,Cargo Pickup,Cargo Arrived at Origin,Departure,Arrived at Final Destination Port,Arrived at Final Destination', ','))
|
|
|
|
|
|
|
+ left join LATERAL (select case when a.code='IFFBCF' then 'Booked'
|
|
|
|
|
+ when a.code='IFFCPU' then 'Cargo Received'
|
|
|
|
|
+ when a.code='IFFREC' then 'Cargo Received'
|
|
|
|
|
+ when a.code='IFFDEP' then 'Departed'
|
|
|
|
|
+ when a.code='IFFARR' then 'Arrived'
|
|
|
|
|
+ when a.code='IFFAFD' then 'Completed'
|
|
|
|
|
+ else 'Booked' END as status
|
|
|
|
|
+ from ocean_milestone a
|
|
|
|
|
+ where a.serial_no=o.serial_no
|
|
|
|
|
+ and a.code in (select regexp_split_to_table('IFFBCF,IFFCPU,IFFREC,IFFDEP,IFFARR,IFFAFD', ','))
|
|
|
order by id desc limit 1) ee on true
|
|
order by id desc limit 1) ee on true
|
|
|
LEFT JOIN LATERAL ( SELECT company as cn_company,
|
|
LEFT JOIN LATERAL ( SELECT company as cn_company,
|
|
|
address_1 as cn_address_1,
|
|
address_1 as cn_address_1,
|
|
@@ -1208,25 +1211,81 @@ class ocean_order {
|
|
|
|
|
|
|
|
private function returnOceanDetailData($ocean,$state){
|
|
private function returnOceanDetailData($ocean,$state){
|
|
|
$data = array();
|
|
$data = array();
|
|
|
|
|
+ //处理shipment data
|
|
|
|
|
+ $ocean_milestone_status = common::excuteListSql("select code,
|
|
|
|
|
+ act_date,est_date,timezone
|
|
|
|
|
+ from ocean_milestone a
|
|
|
|
|
+ where a.serial_no='".$ocean["serial_no"]."' and code in('IFFREC','IFFONB','IFFDEP','IFFARR','IFFDEL')
|
|
|
|
|
+ order by id");
|
|
|
|
|
+ $ocean_milestone_status_code = array();
|
|
|
|
|
+ foreach($ocean_milestone_status as $oms){
|
|
|
|
|
+ $ocean_milestone_status_code[$oms['code']] = $oms;
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
- //处理shipment data暂时写死
|
|
|
|
|
$simplexData = array();
|
|
$simplexData = array();
|
|
|
- $simplexData[] = array("index" =>1,"label" =>"Place of Receipt",
|
|
|
|
|
- "path" =>$ocean['place_of_receipt_exp']."/".$ocean['place_of_receipt'],"isArrival" =>$state == 1 ? true : false);
|
|
|
|
|
-
|
|
|
|
|
- $simplexData[] = array("index" =>2,"label" =>"Port of Loading",
|
|
|
|
|
- "path" =>$ocean['fport_of_loading_exp_exp']."/".$ocean['fport_of_loading_exp'],"isArrival" =>$state == 2 ? true : false,
|
|
|
|
|
- "children" =>array(array("label" =>"Cargo arrival at Origin","date" =>"2024-02-01"),
|
|
|
|
|
- array("label" =>"'Departure","date" =>"2024-02-01")));
|
|
|
|
|
-
|
|
|
|
|
- $simplexData[] = array("index" =>3,"label" =>"Port of Discharge",
|
|
|
|
|
- "path" =>$ocean['mport_of_discharge_exp']."/".$ocean['mport_of_discharge'],"isArrival" =>$state == 3 ? true : false,
|
|
|
|
|
- "children" =>array(array("label" =>"ETA","date" =>"2024-02-01")));
|
|
|
|
|
|
|
+ //place_of_Receipt
|
|
|
|
|
+ $place_of_Receipt_stauts = array("index" =>1,"label" =>"Place of Receipt",
|
|
|
|
|
+ "path" =>$ocean['place_of_receipt_exp']."/".$ocean['place_of_receipt'],"isArrival" =>$state >= 1 ? true : false);
|
|
|
|
|
+ $children = array();
|
|
|
|
|
+ if($state >= 1 && !empty($ocean_milestone_status_code['IFFREC']['act_date'])){
|
|
|
|
|
+ //发生后,未发生前没有
|
|
|
|
|
+ $children[] = array("label" =>"Cargo Received","date" =>$ocean_milestone_status_code['IFFREC']['act_date']);
|
|
|
|
|
+ }
|
|
|
|
|
+ $place_of_Receipt_stauts["children"] = $children;
|
|
|
|
|
+ $simplexData[] = $place_of_Receipt_stauts;
|
|
|
|
|
+
|
|
|
|
|
+ //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 >= 2 ? true : false);
|
|
|
|
|
+ $children = array();
|
|
|
|
|
+ if ($state <= 1){
|
|
|
|
|
+ //未发生前
|
|
|
|
|
+ if(!empty($ocean_milestone_status_code['IFFDEP']['est_date'])){
|
|
|
|
|
+ $children[] = array("label" =>"Departure(ETD)","date" =>$ocean_milestone_status_code['IFFDEP']['est_date']);
|
|
|
|
|
+ }
|
|
|
|
|
+ } else{
|
|
|
|
|
+ if(!empty($ocean_milestone_status_code['IFFONB']['act_date'])){
|
|
|
|
|
+ $children[] = array("label" =>"On board","date" =>$ocean_milestone_status_code['IFFONB']['act_date']);
|
|
|
|
|
+ }
|
|
|
|
|
+ if(!empty($ocean_milestone_status_code['IFFDEP']['act_date'])){
|
|
|
|
|
+ $children[] = array("label" =>"Departure(ATD)","date" =>$ocean_milestone_status_code['IFFDEP']['act_date']);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ $port_of_Loading_stauts["children"] = $children;
|
|
|
|
|
+ $simplexData[] = $port_of_Loading_stauts;
|
|
|
|
|
+
|
|
|
|
|
+ //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 >= 3 ? true : false);
|
|
|
|
|
+ $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{
|
|
|
|
|
+ if(!empty($ocean_milestone_status_code['IFFARR']['act_date'])){
|
|
|
|
|
+ $children[] = array("label" =>"Arrival(ATA)","date" =>$ocean_milestone_status_code['IFFARR']['act_date']);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ $port_of_Discharge_status["children"] = $children;
|
|
|
|
|
+ $simplexData[] = $port_of_Discharge_status;
|
|
|
|
|
|
|
|
- $simplexData[] = array("index" =>4,"label" =>"Place of Delivery",
|
|
|
|
|
|
|
+ //Place of Delivery
|
|
|
|
|
+ $place_of_Delivery_status = array("index" =>4,"label" =>"Place of Delivery",
|
|
|
"path" =>$ocean['place_of_delivery_exp']."/".$ocean['place_of_delivery'],"isArrival" =>$state == 4 ? true : false);
|
|
"path" =>$ocean['place_of_delivery_exp']."/".$ocean['place_of_delivery'],"isArrival" =>$state == 4 ? true : false);
|
|
|
|
|
+ $children = array();
|
|
|
|
|
+ if ($state <= 3){
|
|
|
|
|
+ //未发生前
|
|
|
|
|
+ } else{
|
|
|
|
|
+ if(!empty($ocean_milestone_status_code['IFFDEL']['act_date'])){
|
|
|
|
|
+ $children[] = array("label" =>"Cargo handover/Delivered","date" =>$ocean_milestone_status_code['IFFDEL']['act_date']);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ $simplexData[] = $place_of_Delivery_status;
|
|
|
$data['shipmentData'] = $simplexData;
|
|
$data['shipmentData'] = $simplexData;
|
|
|
|
|
|
|
|
|
|
+
|
|
|
//处理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'],
|