|
@@ -329,10 +329,11 @@ class ocean_order {
|
|
|
} else if ($_reportType == "top") {
|
|
} else if ($_reportType == "top") {
|
|
|
if (!empty($_reportRef)) {
|
|
if (!empty($_reportRef)) {
|
|
|
$_reportStationType = $_REQUEST["_reportStationType"];
|
|
$_reportStationType = $_REQUEST["_reportStationType"];
|
|
|
|
|
+ //先固定pol pod
|
|
|
if($_reportStationType == 'origin'){
|
|
if($_reportStationType == 'origin'){
|
|
|
- $sqlWhere .= " and origin = '$_reportRef'";
|
|
|
|
|
|
|
+ $sqlWhere .= " and fport_of_loading_un = '$_reportRef'";
|
|
|
}else{
|
|
}else{
|
|
|
- $sqlWhere .= " and agent = '$_reportRef'";
|
|
|
|
|
|
|
+ $sqlWhere .= " and mport_of_discharge_un = '$_reportRef'";
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
} else {
|
|
} else {
|
|
@@ -366,9 +367,31 @@ class ocean_order {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+ //取消全文检索
|
|
|
|
|
+ // if (!empty($_POST["_textSearch"])) {
|
|
|
|
|
+ // $sqlWhere .= " and text_search @@ (str_to_tsquery('" . common::check_input($_POST["_textSearch"]) . "'))";
|
|
|
|
|
+ // }
|
|
|
|
|
+ //处理reference类型的组合查询 Search booking No./HBL No./PO No./Carrier Booking No.
|
|
|
|
|
+ if (!empty($_POST["_textSearch"])) {
|
|
|
|
|
+ $textSearch_arr = $_POST['_textSearch'];
|
|
|
|
|
+ if(!is_array($textSearch_arr)){
|
|
|
|
|
+ $textSearch_arr = array($textSearch_arr);
|
|
|
|
|
+ }
|
|
|
|
|
+ $more_sql = "1<>1";
|
|
|
|
|
+ foreach($textSearch_arr as $tsv){
|
|
|
|
|
+ $more_sql .= " or booking_no ilike '%" . common::check_input(trim($tsv)) . "%'";
|
|
|
|
|
+ $more_sql .= " or h_bol ilike '%" . common::check_input(trim($tsv)) . "%'";
|
|
|
|
|
+ $more_sql .= " or po_no ilike '%" . common::check_input(trim($tsv)) . "%'";
|
|
|
|
|
+ $more_sql .= " or carrier_booking ilike '%" . common::check_input(trim($tsv)) . "%'";
|
|
|
|
|
+ }
|
|
|
|
|
+ if ($more_sql <> "1<>1"){
|
|
|
|
|
+ $sqlWhere .= " and ($more_sql)";
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ $sqlWhere_befrom_filterTag = $sqlWhere;
|
|
|
|
|
+
|
|
|
//查询tag
|
|
//查询tag
|
|
|
- // IFFBCF Booking Confirmation Booked
|
|
|
|
|
|
|
+ // IFFBCF Booking Confirmation Created
|
|
|
// IFFCPU Cargo Pickup Cargo Received
|
|
// IFFCPU Cargo Pickup Cargo Received
|
|
|
// IFFREC Cargo Arrived at Origin Cargo Received
|
|
// IFFREC Cargo Arrived at Origin Cargo Received
|
|
|
// IFFDEP Departure Departed
|
|
// IFFDEP Departure Departed
|
|
@@ -382,8 +405,8 @@ class ocean_order {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
$_sqlwhere = "1<>1";
|
|
$_sqlwhere = "1<>1";
|
|
|
- if (stripos($filterTag, "Booked") !== FALSE) {
|
|
|
|
|
- $_sqlwhere .= " or (dd.new_status = 'Booked')";
|
|
|
|
|
|
|
+ if (stripos($filterTag, "Created") !== FALSE) {
|
|
|
|
|
+ $_sqlwhere .= " or (dd.new_status = 'Created' or dd.new_status is null)";
|
|
|
}
|
|
}
|
|
|
if (stripos($filterTag, "Cargo Received") !== FALSE) {
|
|
if (stripos($filterTag, "Cargo Received") !== FALSE) {
|
|
|
$_sqlwhere .= " or (dd.new_status = 'Cargo Received')";
|
|
$_sqlwhere .= " or (dd.new_status = 'Cargo Received')";
|
|
@@ -401,75 +424,49 @@ class ocean_order {
|
|
|
$sqlWhere .= " and ($_sqlwhere)";
|
|
$sqlWhere .= " and ($_sqlwhere)";
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- //取消全文检索
|
|
|
|
|
- // if (!empty($_POST["_textSearch"])) {
|
|
|
|
|
- // $sqlWhere .= " and text_search @@ (str_to_tsquery('" . common::check_input($_POST["_textSearch"]) . "'))";
|
|
|
|
|
- // }
|
|
|
|
|
- //处理reference类型的组合查询 Search booking No./HBL No./PO No./Carrier Booking No.
|
|
|
|
|
- if (!empty($_POST["_textSearch"])) {
|
|
|
|
|
- $textSearch_arr = $_POST['_textSearch'];
|
|
|
|
|
- if(!is_array($textSearch_arr)){
|
|
|
|
|
- $textSearch_arr = array($textSearch_arr);
|
|
|
|
|
- }
|
|
|
|
|
- $more_sql = "1<>1";
|
|
|
|
|
- foreach($textSearch_arr as $tsv){
|
|
|
|
|
- $more_sql .= " or booking_no ilike '%" . common::check_input(trim($tsv)) . "%'";
|
|
|
|
|
- $more_sql .= " or h_bol ilike '%" . common::check_input(trim($tsv)) . "%'";
|
|
|
|
|
- $more_sql .= " or po_no ilike '%" . common::check_input(trim($tsv)) . "%'";
|
|
|
|
|
- $more_sql .= " or carrier_booking ilike '%" . common::check_input(trim($tsv)) . "%'";
|
|
|
|
|
- }
|
|
|
|
|
- if ($more_sql <> "1<>1"){
|
|
|
|
|
- $sqlWhere .= " and ($more_sql)";
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
|
|
|
|
|
$rc = $_POST ['rc'];
|
|
$rc = $_POST ['rc'];
|
|
|
//这里都要查询,除非多传几个参数回来
|
|
//这里都要查询,除非多传几个参数回来
|
|
|
if ($rc == - 1 || true) {
|
|
if ($rc == - 1 || true) {
|
|
|
- $sql = "select count(1) from online_ocean
|
|
|
|
|
- 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" . $sqlWhere;
|
|
|
|
|
-
|
|
|
|
|
|
|
+ $sql = $this->getOcanOrderSearchSql("All",$sqlWhere);
|
|
|
|
|
+ $search_rc = common::excuteOneSql($sql);
|
|
|
|
|
+ error_log("online_ocean_count_ALL_Search_SQL:".$sql);
|
|
|
|
|
+
|
|
|
|
|
+ //移除filterTag
|
|
|
|
|
+ $sqlWhere_bk = $sqlWhere_befrom_filterTag;
|
|
|
|
|
+
|
|
|
|
|
+ $sql = $this->getOcanOrderSearchSql("All",$sqlWhere_bk);
|
|
|
$rc = common::excuteOneSql($sql);
|
|
$rc = common::excuteOneSql($sql);
|
|
|
error_log("online_ocean_count_ALL_SQL:".$sql);
|
|
error_log("online_ocean_count_ALL_SQL:".$sql);
|
|
|
|
|
|
|
|
- //Booked
|
|
|
|
|
- $sql = $this->getOcanOrderSearchSql("Booked",$sqlWhere);
|
|
|
|
|
- $Booked = common::excuteOneSql($sql);
|
|
|
|
|
- error_log("online_ocean_count_Booked_SQL: ".$sql);
|
|
|
|
|
|
|
+ //Created
|
|
|
|
|
+ $sql = $this->getOcanOrderSearchSql("Created",$sqlWhere_bk);
|
|
|
|
|
+ $Created = common::excuteOneSql($sql);
|
|
|
|
|
+ error_log("online_ocean_count_Created_SQL: ".$sql);
|
|
|
|
|
|
|
|
//Cargo Received
|
|
//Cargo Received
|
|
|
- $sql = $this->getOcanOrderSearchSql("Cargo Received",$sqlWhere);
|
|
|
|
|
|
|
+ $sql = $this->getOcanOrderSearchSql("Cargo Received",$sqlWhere_bk);
|
|
|
$Cargo_Received = common::excuteOneSql($sql);
|
|
$Cargo_Received = common::excuteOneSql($sql);
|
|
|
error_log("online_ocean_count_Cargo_Received_SQL: ".$sql);
|
|
error_log("online_ocean_count_Cargo_Received_SQL: ".$sql);
|
|
|
|
|
|
|
|
//Departed
|
|
//Departed
|
|
|
- $sql = $this->getOcanOrderSearchSql("Departed",$sqlWhere);
|
|
|
|
|
|
|
+ $sql = $this->getOcanOrderSearchSql("Departed",$sqlWhere_bk);
|
|
|
$Departed = common::excuteOneSql($sql);
|
|
$Departed = common::excuteOneSql($sql);
|
|
|
error_log("online_ocean_count_Departed_SQL: ".$sql);
|
|
error_log("online_ocean_count_Departed_SQL: ".$sql);
|
|
|
|
|
|
|
|
//Arrived
|
|
//Arrived
|
|
|
- $sql = $this->getOcanOrderSearchSql("Arrived",$sqlWhere);
|
|
|
|
|
|
|
+ $sql = $this->getOcanOrderSearchSql("Arrived",$sqlWhere_bk);
|
|
|
$Arrived = common::excuteOneSql($sql);
|
|
$Arrived = common::excuteOneSql($sql);
|
|
|
error_log("online_ocean_count_Arrived_SQL: ".$sql);
|
|
error_log("online_ocean_count_Arrived_SQL: ".$sql);
|
|
|
|
|
|
|
|
//Completed
|
|
//Completed
|
|
|
- $sql = $this->getOcanOrderSearchSql("Completed",$sqlWhere);
|
|
|
|
|
|
|
+ $sql = $this->getOcanOrderSearchSql("Completed",$sqlWhere_bk);
|
|
|
$Completed = common::excuteOneSql($sql);
|
|
$Completed = common::excuteOneSql($sql);
|
|
|
error_log("online_ocean_count_Completed_SQL: ".$sql);
|
|
error_log("online_ocean_count_Completed_SQL: ".$sql);
|
|
|
|
|
|
|
|
if (!empty($_POST["filterTag"])) {
|
|
if (!empty($_POST["filterTag"])) {
|
|
|
$tagsList = array(array("name"=>"All","number"=>$rc,"type"=>"all","checked"=>utils::in_array('All', $_POST["filterTag"])? true : false),
|
|
$tagsList = array(array("name"=>"All","number"=>$rc,"type"=>"all","checked"=>utils::in_array('All', $_POST["filterTag"])? true : false),
|
|
|
- array("name"=>"Booked","number"=>$Booked,"type"=>"booked","checked"=>utils::in_array('Booked', $_POST["filterTag"])? true : false),
|
|
|
|
|
|
|
+ array("name"=>"Created","number"=>$Created,"type"=>"created","checked"=>utils::in_array('Created', $_POST["filterTag"])? true : false),
|
|
|
array("name"=>"Cargo Received","number"=>$Cargo_Received,"type"=>"cargo_received","checked"=>utils::in_array('Cargo Received', $_POST["filterTag"])? true : false),
|
|
array("name"=>"Cargo Received","number"=>$Cargo_Received,"type"=>"cargo_received","checked"=>utils::in_array('Cargo Received', $_POST["filterTag"])? true : false),
|
|
|
array("name"=>"Departure","number"=>$Departed,"type"=>"departure","checked"=>utils::in_array('Departure', $_POST["filterTag"])? true : false),
|
|
array("name"=>"Departure","number"=>$Departed,"type"=>"departure","checked"=>utils::in_array('Departure', $_POST["filterTag"])? true : false),
|
|
|
array("name"=>"Arrived","number"=>$Arrived,"type"=>"arrived","checked"=>utils::in_array('Arrived', $_POST["filterTag"])? true : false),
|
|
array("name"=>"Arrived","number"=>$Arrived,"type"=>"arrived","checked"=>utils::in_array('Arrived', $_POST["filterTag"])? true : false),
|
|
@@ -477,7 +474,7 @@ class ocean_order {
|
|
|
}else{
|
|
}else{
|
|
|
//初始,前端有选择着带入选择
|
|
//初始,前端有选择着带入选择
|
|
|
$tagsList = array(array("name"=>"All","number"=>$rc,"type"=>"all","checked"=> true ),
|
|
$tagsList = array(array("name"=>"All","number"=>$rc,"type"=>"all","checked"=> true ),
|
|
|
- array("name"=>"Booked","number"=>$Booked,"type"=>"booked","checked"=> false),
|
|
|
|
|
|
|
+ array("name"=>"Created","number"=>$Created,"type"=>"created","checked"=> false),
|
|
|
array("name"=>"Cargo Received","number"=>$Cargo_Received,"type"=>"cargo_received","checked"=> false),
|
|
array("name"=>"Cargo Received","number"=>$Cargo_Received,"type"=>"cargo_received","checked"=> false),
|
|
|
array("name"=>"Departure","number"=>$Departed,"type"=>"departure","checked"=> false),
|
|
array("name"=>"Departure","number"=>$Departed,"type"=>"departure","checked"=> false),
|
|
|
array("name"=>"Arrived","number"=>$Arrived,"type"=>"arrived","checked"=> false),
|
|
array("name"=>"Arrived","number"=>$Arrived,"type"=>"arrived","checked"=> false),
|
|
@@ -500,22 +497,23 @@ 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.code='IFFBCF' then 'Booked'
|
|
|
|
|
|
|
+ $ocean_status_sql = " 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'
|
|
|
when a.code='IFFDEP' then 'Departed'
|
|
when a.code='IFFDEP' then 'Departed'
|
|
|
when a.code='IFFARR' then 'Arrived'
|
|
when a.code='IFFARR' then 'Arrived'
|
|
|
when a.code='IFFAFD' then 'Completed'
|
|
when a.code='IFFAFD' then 'Completed'
|
|
|
- else 'Booked' END as new_status
|
|
|
|
|
|
|
+ else 'Created' END as new_status
|
|
|
from ocean_milestone a
|
|
from ocean_milestone a
|
|
|
where a.serial_no=online_ocean.serial_no
|
|
where a.serial_no=online_ocean.serial_no
|
|
|
and a.code in (select regexp_split_to_table('IFFBCF,IFFCPU,IFFREC,IFFDEP,IFFARR,IFFAFD', ','))
|
|
and a.code in (select regexp_split_to_table('IFFBCF,IFFCPU,IFFREC,IFFDEP,IFFARR,IFFAFD', ','))
|
|
|
|
|
+ and a.act_date is not null
|
|
|
order by id desc limit 1) dd ON true ";
|
|
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, consignee_city as _consignee_city,
|
|
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 'Created'::text
|
|
|
ELSE dd.new_status::text
|
|
ELSE dd.new_status::text
|
|
|
END AS new_status, ".
|
|
END AS new_status, ".
|
|
|
column::getInstance()->getSearchSqlForDisplay('Ocean_Search') . " from public.online_ocean $ocean_ref_sql $ocean_status_sql" . $sqlWhere .
|
|
column::getInstance()->getSearchSqlForDisplay('Ocean_Search') . " from public.online_ocean $ocean_ref_sql $ocean_status_sql" . $sqlWhere .
|
|
@@ -541,7 +539,7 @@ class ocean_order {
|
|
|
'TransportList' => $TransportList,
|
|
'TransportList' => $TransportList,
|
|
|
'allColums' => $allBookingColumns,
|
|
'allColums' => $allBookingColumns,
|
|
|
'canEdiVgm' => _canEdiVgm(),
|
|
'canEdiVgm' => _canEdiVgm(),
|
|
|
- 'rc' => $rc,
|
|
|
|
|
|
|
+ 'rc' => $search_rc,
|
|
|
'ps' => $ps,
|
|
'ps' => $ps,
|
|
|
'cp' => $cp,
|
|
'cp' => $cp,
|
|
|
'tp' => $tp,
|
|
'tp' => $tp,
|
|
@@ -567,6 +565,7 @@ class ocean_order {
|
|
|
private function _ocean_detail() {
|
|
private function _ocean_detail() {
|
|
|
$serial_no = common::deCode($_GET['a'], 'D');
|
|
$serial_no = common::deCode($_GET['a'], 'D');
|
|
|
$sql = $this->getOceanDetail($serial_no);
|
|
$sql = $this->getOceanDetail($serial_no);
|
|
|
|
|
+ error_log($sql);
|
|
|
$ocean = common::excuteObjectSql($sql);
|
|
$ocean = common::excuteObjectSql($sql);
|
|
|
|
|
|
|
|
if (!empty($ocean)) {
|
|
if (!empty($ocean)) {
|
|
@@ -991,79 +990,99 @@ class ocean_order {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
private function getOcanOrderSearchSql($type,$sqlWhere) {
|
|
private function getOcanOrderSearchSql($type,$sqlWhere) {
|
|
|
- if($type == "Booked"){
|
|
|
|
|
- $Booked_sqlWhere = " and (1<>1 or dd.new_status ='Booked')";
|
|
|
|
|
|
|
+ if($type == "All"){
|
|
|
return "select count(1) from online_ocean
|
|
return "select count(1) from online_ocean
|
|
|
- left join LATERAL (select case when a.code='IFFBCF' then 'Booked'
|
|
|
|
|
|
|
+ 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'
|
|
|
when a.code='IFFDEP' then 'Departed'
|
|
when a.code='IFFDEP' then 'Departed'
|
|
|
when a.code='IFFARR' then 'Arrived'
|
|
when a.code='IFFARR' then 'Arrived'
|
|
|
when a.code='IFFAFD' then 'Completed'
|
|
when a.code='IFFAFD' then 'Completed'
|
|
|
- else 'Booked' END as new_status
|
|
|
|
|
|
|
+ else 'Created' END as new_status
|
|
|
from ocean_milestone a
|
|
from ocean_milestone a
|
|
|
where a.serial_no=online_ocean.serial_no
|
|
where a.serial_no=online_ocean.serial_no
|
|
|
and a.code in (select regexp_split_to_table('IFFBCF,IFFCPU,IFFREC,IFFDEP,IFFARR,IFFAFD', ','))
|
|
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.$Booked_sqlWhere;
|
|
|
|
|
|
|
+ and a.act_date is not null
|
|
|
|
|
+ order by id desc limit 1) dd on true" . $sqlWhere;
|
|
|
|
|
+ }
|
|
|
|
|
+ if($type == "Created"){
|
|
|
|
|
+ $Created_sqlWhere = " and (1<>1 or dd.new_status ='Created' or dd.new_status is null)";
|
|
|
|
|
+ return "select count(1) from online_ocean
|
|
|
|
|
+ left join LATERAL (select case when a.code='IFFBCF' then 'Created'
|
|
|
|
|
+ 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 'Created' 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', ','))
|
|
|
|
|
+ and a.act_date is not null
|
|
|
|
|
+ order by id desc limit 1) dd on true" . $sqlWhere.$Created_sqlWhere;
|
|
|
}
|
|
}
|
|
|
if($type == "Cargo Received"){
|
|
if($type == "Cargo Received"){
|
|
|
$Cargo_Received_sqlWhere = " and (1<>1 or dd.new_status ='Cargo Received')";
|
|
$Cargo_Received_sqlWhere = " and (1<>1 or dd.new_status ='Cargo Received')";
|
|
|
return "select count(1) from online_ocean
|
|
return "select count(1) from online_ocean
|
|
|
- left join LATERAL (select case when a.code='IFFBCF' then 'Booked'
|
|
|
|
|
|
|
+ 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'
|
|
|
when a.code='IFFDEP' then 'Departed'
|
|
when a.code='IFFDEP' then 'Departed'
|
|
|
when a.code='IFFARR' then 'Arrived'
|
|
when a.code='IFFARR' then 'Arrived'
|
|
|
when a.code='IFFAFD' then 'Completed'
|
|
when a.code='IFFAFD' then 'Completed'
|
|
|
- else 'Booked' END as new_status
|
|
|
|
|
|
|
+ else 'Created' END as new_status
|
|
|
from ocean_milestone a
|
|
from ocean_milestone a
|
|
|
where a.serial_no=online_ocean.serial_no
|
|
where a.serial_no=online_ocean.serial_no
|
|
|
and a.code in (select regexp_split_to_table('IFFBCF,IFFCPU,IFFREC,IFFDEP,IFFARR,IFFAFD', ','))
|
|
and a.code in (select regexp_split_to_table('IFFBCF,IFFCPU,IFFREC,IFFDEP,IFFARR,IFFAFD', ','))
|
|
|
|
|
+ and a.act_date is not null
|
|
|
order by id desc limit 1) dd on true" . $sqlWhere.$Cargo_Received_sqlWhere;
|
|
order by id desc limit 1) dd on true" . $sqlWhere.$Cargo_Received_sqlWhere;
|
|
|
}
|
|
}
|
|
|
if($type == "Departed"){
|
|
if($type == "Departed"){
|
|
|
$Departed_sqlWhere = " and (1<>1 or dd.new_status ='Departed')";
|
|
$Departed_sqlWhere = " and (1<>1 or dd.new_status ='Departed')";
|
|
|
return "select count(1) from online_ocean
|
|
return "select count(1) from online_ocean
|
|
|
- left join LATERAL (select case when a.code='IFFBCF' then 'Booked'
|
|
|
|
|
|
|
+ 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'
|
|
|
when a.code='IFFDEP' then 'Departed'
|
|
when a.code='IFFDEP' then 'Departed'
|
|
|
when a.code='IFFARR' then 'Arrived'
|
|
when a.code='IFFARR' then 'Arrived'
|
|
|
when a.code='IFFAFD' then 'Completed'
|
|
when a.code='IFFAFD' then 'Completed'
|
|
|
- else 'Booked' END as new_status
|
|
|
|
|
|
|
+ else 'Created' END as new_status
|
|
|
from ocean_milestone a
|
|
from ocean_milestone a
|
|
|
where a.serial_no=online_ocean.serial_no
|
|
where a.serial_no=online_ocean.serial_no
|
|
|
and a.code in (select regexp_split_to_table('IFFBCF,IFFCPU,IFFREC,IFFDEP,IFFARR,IFFAFD', ','))
|
|
and a.code in (select regexp_split_to_table('IFFBCF,IFFCPU,IFFREC,IFFDEP,IFFARR,IFFAFD', ','))
|
|
|
|
|
+ and a.act_date is not null
|
|
|
order by id desc limit 1) dd on true" . $sqlWhere.$Departed_sqlWhere;
|
|
order by id desc limit 1) dd on true" . $sqlWhere.$Departed_sqlWhere;
|
|
|
}
|
|
}
|
|
|
if($type == "Arrived"){
|
|
if($type == "Arrived"){
|
|
|
$Arrived_sqlWhere = " and (1<>1 or dd.new_status ='Arrived')";
|
|
$Arrived_sqlWhere = " and (1<>1 or dd.new_status ='Arrived')";
|
|
|
return "select count(1) from online_ocean
|
|
return "select count(1) from online_ocean
|
|
|
- left join LATERAL (select case when a.code='IFFBCF' then 'Booked'
|
|
|
|
|
|
|
+ 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'
|
|
|
when a.code='IFFDEP' then 'Departed'
|
|
when a.code='IFFDEP' then 'Departed'
|
|
|
when a.code='IFFARR' then 'Arrived'
|
|
when a.code='IFFARR' then 'Arrived'
|
|
|
when a.code='IFFAFD' then 'Completed'
|
|
when a.code='IFFAFD' then 'Completed'
|
|
|
- else 'Booked' END as new_status
|
|
|
|
|
|
|
+ else 'Created' END as new_status
|
|
|
from ocean_milestone a
|
|
from ocean_milestone a
|
|
|
where a.serial_no=online_ocean.serial_no
|
|
where a.serial_no=online_ocean.serial_no
|
|
|
and a.code in (select regexp_split_to_table('IFFBCF,IFFCPU,IFFREC,IFFDEP,IFFARR,IFFAFD', ','))
|
|
and a.code in (select regexp_split_to_table('IFFBCF,IFFCPU,IFFREC,IFFDEP,IFFARR,IFFAFD', ','))
|
|
|
|
|
+ and a.act_date is not null
|
|
|
order by id desc limit 1) dd on true" . $sqlWhere.$Arrived_sqlWhere;
|
|
order by id desc limit 1) dd on true" . $sqlWhere.$Arrived_sqlWhere;
|
|
|
}
|
|
}
|
|
|
if($type == "Completed"){
|
|
if($type == "Completed"){
|
|
|
$Completed_sqlWhere = " and (1<>1 or dd.new_status ='Completed')";
|
|
$Completed_sqlWhere = " and (1<>1 or dd.new_status ='Completed')";
|
|
|
return "select count(1) from online_ocean
|
|
return "select count(1) from online_ocean
|
|
|
- left join LATERAL (select case when a.code='IFFBCF' then 'Booked'
|
|
|
|
|
|
|
+ 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'
|
|
|
when a.code='IFFDEP' then 'Departed'
|
|
when a.code='IFFDEP' then 'Departed'
|
|
|
when a.code='IFFARR' then 'Arrived'
|
|
when a.code='IFFARR' then 'Arrived'
|
|
|
when a.code='IFFAFD' then 'Completed'
|
|
when a.code='IFFAFD' then 'Completed'
|
|
|
- else 'Booked' END as new_status
|
|
|
|
|
|
|
+ else 'Created' END as new_status
|
|
|
from ocean_milestone a
|
|
from ocean_milestone a
|
|
|
where a.serial_no=online_ocean.serial_no
|
|
where a.serial_no=online_ocean.serial_no
|
|
|
and a.code in (select regexp_split_to_table('IFFBCF,IFFCPU,IFFREC,IFFDEP,IFFARR,IFFAFD', ','))
|
|
and a.code in (select regexp_split_to_table('IFFBCF,IFFCPU,IFFREC,IFFDEP,IFFARR,IFFAFD', ','))
|
|
|
|
|
+ and a.act_date is not null
|
|
|
order by id desc limit 1) dd on true" . $sqlWhere.$Completed_sqlWhere;
|
|
order by id desc limit 1) dd on true" . $sqlWhere.$Completed_sqlWhere;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -1163,20 +1182,26 @@ class ocean_order {
|
|
|
$_schemas = "ocean";
|
|
$_schemas = "ocean";
|
|
|
}
|
|
}
|
|
|
$sql = "SELECT m_eta as _m_eta, h_bol as _h_bol, m_bol as _m_bol,job_no as _job_bol,
|
|
$sql = "SELECT m_eta as _m_eta, h_bol as _h_bol, m_bol as _m_bol,job_no as _job_bol,
|
|
|
|
|
+ (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.*,ee.status as new_status
|
|
|
|
|
|
|
+ o.* ,sh.*, cn.* ,aa.*,dd.*,
|
|
|
|
|
+ CASE
|
|
|
|
|
+ WHEN ee.status is null THEN 'Created'::text
|
|
|
|
|
+ ELSE ee.status::text
|
|
|
|
|
+ END AS new_status
|
|
|
from ocean o
|
|
from ocean o
|
|
|
- left join LATERAL (select case when a.code='IFFBCF' then 'Booked'
|
|
|
|
|
|
|
+ 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'
|
|
|
when a.code='IFFDEP' then 'Departed'
|
|
when a.code='IFFDEP' then 'Departed'
|
|
|
when a.code='IFFARR' then 'Arrived'
|
|
when a.code='IFFARR' then 'Arrived'
|
|
|
when a.code='IFFAFD' then 'Completed'
|
|
when a.code='IFFAFD' then 'Completed'
|
|
|
- else 'Booked' END as status
|
|
|
|
|
|
|
+ else 'Created' END as status
|
|
|
from ocean_milestone a
|
|
from ocean_milestone a
|
|
|
where a.serial_no=o.serial_no
|
|
where a.serial_no=o.serial_no
|
|
|
and a.code in (select regexp_split_to_table('IFFBCF,IFFCPU,IFFREC,IFFDEP,IFFARR,IFFAFD', ','))
|
|
and a.code in (select regexp_split_to_table('IFFBCF,IFFCPU,IFFREC,IFFDEP,IFFARR,IFFAFD', ','))
|
|
|
|
|
+ and a.act_date is not null
|
|
|
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,
|
|
@@ -1247,6 +1272,9 @@ class ocean_order {
|
|
|
//未发生前
|
|
//未发生前
|
|
|
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']);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ //没有,取etd
|
|
|
|
|
+ $children[] = array("label" =>"Departure(ETD)","date" =>$ocean['f_etd']);
|
|
|
}
|
|
}
|
|
|
} else{
|
|
} else{
|
|
|
if(!empty($ocean_milestone_status_code['IFFONB']['act_date'])){
|
|
if(!empty($ocean_milestone_status_code['IFFONB']['act_date'])){
|
|
@@ -1267,6 +1295,9 @@ class ocean_order {
|
|
|
//未发生前
|
|
//未发生前
|
|
|
if(!empty($ocean_milestone_status_code['IFFARR']['est_date'])){
|
|
if(!empty($ocean_milestone_status_code['IFFARR']['est_date'])){
|
|
|
$children[] = array("label" =>"Arrival(ETA)","date" =>$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{
|
|
} else{
|
|
|
if(!empty($ocean_milestone_status_code['IFFARR']['act_date'])){
|
|
if(!empty($ocean_milestone_status_code['IFFARR']['act_date'])){
|
|
@@ -1302,7 +1333,7 @@ class ocean_order {
|
|
|
$voyage = utils::outDisplayForMerge($ocean['f_voyage'],$ocean['m_voyage']);
|
|
$voyage = utils::outDisplayForMerge($ocean['f_voyage'],$ocean['m_voyage']);
|
|
|
$basicInfo = array("MAWB/MBL No." =>$ocean['m_bol'],"HAWB/HBOL" => $ocean['h_bol'],"Carrier_Booking_No" =>$ocean['carrier_booking'],
|
|
$basicInfo = array("MAWB/MBL No." =>$ocean['m_bol'],"HAWB/HBOL" => $ocean['h_bol'],"Carrier_Booking_No" =>$ocean['carrier_booking'],
|
|
|
"PO_NO" =>$ocean['po_no'],"Vessel/Airline" =>$vessel,"Voyage/Filght" =>$voyage,
|
|
"PO_NO" =>$ocean['po_no'],"Vessel/Airline" =>$vessel,"Voyage/Filght" =>$voyage,
|
|
|
- "Incoterm" =>$ocean['terms'],"Service_Type" =>$ocean['service']);
|
|
|
|
|
|
|
+ "Incoterm" =>$ocean['incoterms'],"Service_Type" =>$ocean['service']);
|
|
|
$data['basicInfo'] = $basicInfo;
|
|
$data['basicInfo'] = $basicInfo;
|
|
|
|
|
|
|
|
//处理 拼接地址 ocean表单exp 字段无法精准分割电话和地址信息,只能从contacts表里查询
|
|
//处理 拼接地址 ocean表单exp 字段无法精准分割电话和地址信息,只能从contacts表里查询
|