|
@@ -195,21 +195,34 @@ class common {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ public static function searchExtendHand_KLN($type, $user, $company_name = "station_name") {
|
|
|
|
|
+ $sqlWhere = " 1=1";
|
|
|
|
|
+ if($type == "booking"){
|
|
|
|
|
+ $ocean_booking_sqlWhere = self::searchExtendHandNew("booking",$user, $company_name);
|
|
|
|
|
+ $air_booking_sqlWhere = self::searchExtendHandNew("air_booking",$user, $company_name);
|
|
|
|
|
+ $sqlWhere = "((transport_mode ='sea' and ".$ocean_booking_sqlWhere.") or (transport_mode ='air' and ".$air_booking_sqlWhere."))";
|
|
|
|
|
+ }
|
|
|
|
|
+ if($type == "ocean"){
|
|
|
|
|
+ $ocean_booking_sqlWhere = self::searchExtendHandNew("ocean",$user, $company_name);
|
|
|
|
|
+ $air_booking_sqlWhere = self::searchExtendHandNew("air",$user, $company_name);
|
|
|
|
|
+ $sqlWhere = "((transport_mode ='sea' and ".$ocean_booking_sqlWhere.") or (transport_mode ='air' and ".$air_booking_sqlWhere."))";
|
|
|
|
|
+ }
|
|
|
|
|
+ return $sqlWhere;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
public static function searchExtendHandNew($type, $user, $company_name = "station_name") {
|
|
public static function searchExtendHandNew($type, $user, $company_name = "station_name") {
|
|
|
if (_isAdminHandNew($user)) {
|
|
if (_isAdminHandNew($user)) {
|
|
|
- if(strtolower($type) == "air_booking" ) //|| strtolower($type) == "air"
|
|
|
|
|
|
|
+ if(strtolower($type) == "air_booking" )
|
|
|
{
|
|
{
|
|
|
return "1=1";
|
|
return "1=1";
|
|
|
}
|
|
}
|
|
|
- //return " (schem_not_display is null or schem_not_display=false)";
|
|
|
|
|
return " (COALESCE(schem_not_display,false) = false)";
|
|
return " (COALESCE(schem_not_display,false) = false)";
|
|
|
}
|
|
}
|
|
|
if (_isDocAdmin($user["user_login"])) {
|
|
if (_isDocAdmin($user["user_login"])) {
|
|
|
- if(strtolower($type) == "air_booking" ) //|| strtolower($type) == "air"
|
|
|
|
|
|
|
+ if(strtolower($type) == "air_booking" )
|
|
|
{
|
|
{
|
|
|
return "1=1";
|
|
return "1=1";
|
|
|
}
|
|
}
|
|
|
- //return ' (schem_not_display is null or schem_not_display=false)';
|
|
|
|
|
return ' (COALESCE(schem_not_display,false) = false)';
|
|
return ' (COALESCE(schem_not_display,false) = false)';
|
|
|
}
|
|
}
|
|
|
if (strtolower($type) != "ocean" && strtolower($type) != "booking" && strtolower($type) != "air_booking"&& strtolower($type) != "air") {
|
|
if (strtolower($type) != "ocean" && strtolower($type) != "booking" && strtolower($type) != "air_booking"&& strtolower($type) != "air") {
|
|
@@ -223,7 +236,6 @@ class common {
|
|
|
if ($user["is_kerry_shipment"] == "t") {
|
|
if ($user["is_kerry_shipment"] == "t") {
|
|
|
$sqlWhere = " is_kerry_shipment is not null and is_kerry_shipment=true";
|
|
$sqlWhere = " is_kerry_shipment is not null and is_kerry_shipment=true";
|
|
|
} else if ($user["is_kerry_shipment"] == "f") {
|
|
} else if ($user["is_kerry_shipment"] == "f") {
|
|
|
- //$sqlWhere = " (is_kerry_shipment is null or is_kerry_shipment=false)";
|
|
|
|
|
$sqlWhere = " (COALESCE(is_kerry_shipment,false) = false)";
|
|
$sqlWhere = " (COALESCE(is_kerry_shipment,false) = false)";
|
|
|
} else {
|
|
} else {
|
|
|
$sqlWhere = " 1=1";
|
|
$sqlWhere = " 1=1";
|
|
@@ -263,31 +275,17 @@ class common {
|
|
|
$sqlWhere .= self::_bookingHandNew($user, $schames);
|
|
$sqlWhere .= self::_bookingHandNew($user, $schames);
|
|
|
}
|
|
}
|
|
|
if (strtolower($type) == "air_booking") {
|
|
if (strtolower($type) == "air_booking") {
|
|
|
- $sqlWhere .= self::_airHandNew($user, $schames);
|
|
|
|
|
|
|
+ $sqlWhere .= self::_air($schames);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
if (strtolower($type) == "air") {
|
|
if (strtolower($type) == "air") {
|
|
|
- $sqlWhere .= self::_airHandNew($user, $schames);
|
|
|
|
|
- if ($company_name == "doc") {
|
|
|
|
|
- if (empty($user["view_file_format"])) {
|
|
|
|
|
- if (strtolower($user["user_type"]) == "customer") {
|
|
|
|
|
- $sqlWhere .= " and serial_no in (SELECT serial_no from $schames.ra_online_file_format where active = true and client_display = true)";
|
|
|
|
|
- } else {
|
|
|
|
|
- $sqlWhere .= " and serial_no in (SELECT serial_no from $schames.ra_online_file_format where active = true)";
|
|
|
|
|
- }
|
|
|
|
|
- } else {
|
|
|
|
|
- $sqlWhere .= " and serial_no in (SELECT regexp_split_to_table('" . $user["view_file_format"] . "',';'))";
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ $sqlWhere .= self::_air($schames);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
} elseif (count($schemas_list) == 2) {
|
|
} elseif (count($schemas_list) == 2) {
|
|
|
- if(strtolower($type) == "air_booking" )//|| strtolower($type) == "air"
|
|
|
|
|
- {
|
|
|
|
|
- // $sqlWhere .= " and 1=1";
|
|
|
|
|
- }
|
|
|
|
|
- else{
|
|
|
|
|
- //$sqlWhere .= " and (schem_not_display is null or schem_not_display=false)";
|
|
|
|
|
|
|
+ if(strtolower($type) == "air_booking" ){
|
|
|
|
|
+
|
|
|
|
|
+ }else{
|
|
|
$sqlWhere .= " and (COALESCE(schem_not_display,false) = false)";
|
|
$sqlWhere .= " and (COALESCE(schem_not_display,false) = false)";
|
|
|
}
|
|
}
|
|
|
if (strtolower($type) == "ocean") {
|
|
if (strtolower($type) == "ocean") {
|
|
@@ -335,48 +333,24 @@ class common {
|
|
|
}
|
|
}
|
|
|
if (strtolower($type) == "air_booking") {
|
|
if (strtolower($type) == "air_booking") {
|
|
|
$sqlWhere .= " and ((order_from='public' ";
|
|
$sqlWhere .= " and ((order_from='public' ";
|
|
|
- $sqlWhere .= self::_airHandNew($user, "public");
|
|
|
|
|
|
|
+ $sqlWhere .= self::_air("public");
|
|
|
$sqlWhere .= ") or (order_from='sfs' ";
|
|
$sqlWhere .= ") or (order_from='sfs' ";
|
|
|
if (empty($user["sfs_ONLINE_USER"])) {
|
|
if (empty($user["sfs_ONLINE_USER"])) {
|
|
|
$user = $_SESSION["sfs_ONLINE_USER"];
|
|
$user = $_SESSION["sfs_ONLINE_USER"];
|
|
|
}
|
|
}
|
|
|
- $sqlWhere .= self::_airHandNew($user, "sfs");
|
|
|
|
|
|
|
+ $sqlWhere .= self::_air("sfs");
|
|
|
$sqlWhere .= "))";
|
|
$sqlWhere .= "))";
|
|
|
-
|
|
|
|
|
- // $sqlWhere .= self::_airHandNew($user, $schames);
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
if (strtolower($type) == "air") {
|
|
if (strtolower($type) == "air") {
|
|
|
$sqlWhere .= " and ((order_from='public' ";
|
|
$sqlWhere .= " and ((order_from='public' ";
|
|
|
- $sqlWhere .= self::_airHandNew($user, "public");
|
|
|
|
|
- if ($company_name == "doc") {
|
|
|
|
|
- if (empty($user["view_file_format"])) {
|
|
|
|
|
- if (strtolower($user["user_type"]) == "customer") {
|
|
|
|
|
- $sqlWhere .= " and serial_no in (SELECT serial_no from public.ra_online_file_format where active = true and client_display = true)";
|
|
|
|
|
- } else {
|
|
|
|
|
- $sqlWhere .= " and serial_no in (SELECT serial_no from public.ra_online_file_format where active = true)";
|
|
|
|
|
- }
|
|
|
|
|
- } else {
|
|
|
|
|
- $sqlWhere .= " and serial_no in (SELECT regexp_split_to_table('" . $user["view_file_format"] . "',';'))";
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ $sqlWhere .= self::_air($user, "public");
|
|
|
$sqlWhere .= ") or (order_from='sfs' ";
|
|
$sqlWhere .= ") or (order_from='sfs' ";
|
|
|
|
|
|
|
|
if (empty($user["sfs_ONLINE_USER"])) {
|
|
if (empty($user["sfs_ONLINE_USER"])) {
|
|
|
$user = $_SESSION["sfs_ONLINE_USER"];
|
|
$user = $_SESSION["sfs_ONLINE_USER"];
|
|
|
}
|
|
}
|
|
|
- $sqlWhere .= self::_airHandNew($user, "sfs");
|
|
|
|
|
- if ($company_name == "doc") {
|
|
|
|
|
- if (empty($user["view_file_format"])) {
|
|
|
|
|
- if (strtolower($user["user_type"]) == "customer") {
|
|
|
|
|
- $sqlWhere .= " and serial_no in (SELECT serial_no from sfs.ra_online_file_format where active = true and client_display = true)";
|
|
|
|
|
- } else {
|
|
|
|
|
- $sqlWhere .= " and serial_no in (SELECT serial_no from sfs.ra_online_file_format where active = true)";
|
|
|
|
|
- }
|
|
|
|
|
- } else {
|
|
|
|
|
- $sqlWhere .= " and serial_no in (SELECT regexp_split_to_table('" . $user["view_file_format"] . "',';'))";
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ $sqlWhere .= self::_air($user, "sfs");
|
|
|
$sqlWhere .= ") )";
|
|
$sqlWhere .= ") )";
|
|
|
}
|
|
}
|
|
|
} else {
|
|
} else {
|
|
@@ -591,7 +565,9 @@ class common {
|
|
|
exit();
|
|
exit();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * _bookingHandNew 和 _oceanHandNew逻辑完全一样,只是ocean 多一个dest_op字段,在booking里没有的
|
|
|
|
|
+ */
|
|
|
private static function _oceanHandNew($user, $schemas = "public") {
|
|
private static function _oceanHandNew($user, $schemas = "public") {
|
|
|
$o = $user['ocean_station'];
|
|
$o = $user['ocean_station'];
|
|
|
$o_or = $user['ocean_station_or'];
|
|
$o_or = $user['ocean_station_or'];
|
|
@@ -609,7 +585,6 @@ class common {
|
|
|
}
|
|
}
|
|
|
$sqlWhere = "";
|
|
$sqlWhere = "";
|
|
|
if (_isCustomerLoginHandNew($user)) {
|
|
if (_isCustomerLoginHandNew($user)) {
|
|
|
- //error_log("_oceanHandNew".$schemas);
|
|
|
|
|
$sqlWhere .= " and " . _customerFilerSearchHandNew($user, $schemas);
|
|
$sqlWhere .= " and " . _customerFilerSearchHandNew($user, $schemas);
|
|
|
} else {
|
|
} else {
|
|
|
if (empty($o) && empty($d) && empty($sales) && empty($op) && empty($follow)) {
|
|
if (empty($o) && empty($d) && empty($sales) && empty($op) && empty($follow)) {
|
|
@@ -712,10 +687,10 @@ class common {
|
|
|
return $sqlWhere;
|
|
return $sqlWhere;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * _bookingHandNew 和 _oceanHandNew逻辑完全一样,只是ocean 多一个dest_op字段,在booking里没有的
|
|
|
|
|
+ */
|
|
|
private static function _bookingHandNew($user, $schames) {
|
|
private static function _bookingHandNew($user, $schames) {
|
|
|
- // if (_isDemo())
|
|
|
|
|
- // return " serial_no = 'D4DD1D79-83F4-4E65-9773-CF5277D72738'";
|
|
|
|
|
-
|
|
|
|
|
$o = $user['ocean_station'];
|
|
$o = $user['ocean_station'];
|
|
|
$o_or = $user['ocean_station_or'];
|
|
$o_or = $user['ocean_station_or'];
|
|
|
$d = $user['ocean_agent'];
|
|
$d = $user['ocean_agent'];
|
|
@@ -730,25 +705,7 @@ class common {
|
|
|
if (strtolower($o_or) == "all" || strtolower($d_or) == "all" || strtolower($sales_or) == "all") {
|
|
if (strtolower($o_or) == "all" || strtolower($d_or) == "all" || strtolower($sales_or) == "all") {
|
|
|
return " and 1=1";
|
|
return " and 1=1";
|
|
|
}
|
|
}
|
|
|
- // $sc_list = $user['schemas_list'];
|
|
|
|
|
- // if (empty($sc_list)) {
|
|
|
|
|
- // $sc_list = $_SESSION["schemas_list"];
|
|
|
|
|
- // }
|
|
|
|
|
- // if (empty($sc_list)) {
|
|
|
|
|
- // return " and 1<>1";
|
|
|
|
|
- // }
|
|
|
|
|
- // $sqlWhere = " and 1=1";
|
|
|
|
|
- // if ($user["is_kerry_shipment"] == "t") {
|
|
|
|
|
- // $sqlWhere = " and and is_kerry_shipment is not null and is_kerry_shipment=true";
|
|
|
|
|
- // } else if ($user["is_kerry_shipment"] == "f") {
|
|
|
|
|
- // $sqlWhere = " and (is_kerry_shipment is null or is_kerry_shipment=false)";
|
|
|
|
|
- // }
|
|
|
|
|
- // if (count($sc_list) == 1) {
|
|
|
|
|
- // $sch = $sc_list[0]['schemas_name'];
|
|
|
|
|
- // $sqlWhere .= " and order_from='$sch'";
|
|
|
|
|
- // } else {
|
|
|
|
|
- // $sqlWhere .= " and (schem_not_display is null or schem_not_display=false)";
|
|
|
|
|
- // }
|
|
|
|
|
|
|
+
|
|
|
$sqlWhere = "";
|
|
$sqlWhere = "";
|
|
|
if (_isCustomerLoginHandNew($user)) {
|
|
if (_isCustomerLoginHandNew($user)) {
|
|
|
$sqlWhere .= " and " . _customerFilerSearchHandNew($user, $schames);
|
|
$sqlWhere .= " and " . _customerFilerSearchHandNew($user, $schames);
|
|
@@ -842,115 +799,46 @@ class common {
|
|
|
return $sqlWhere;
|
|
return $sqlWhere;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- private static function _airHandNew($user, $schemas = "public")
|
|
|
|
|
- {
|
|
|
|
|
- if($schemas=="public")
|
|
|
|
|
- {
|
|
|
|
|
- $station = $user['air_station'];
|
|
|
|
|
- $station_or = $user['air_station_or'];
|
|
|
|
|
-
|
|
|
|
|
- $sales = $user['air_sales'];
|
|
|
|
|
- $sales_or = $user['air_sales_or'];
|
|
|
|
|
- }
|
|
|
|
|
- else
|
|
|
|
|
- {
|
|
|
|
|
- $station = $user[$schemas."_ONLINE_USER"]['air_station'];
|
|
|
|
|
- $station_or = $user[$schemas."_ONLINE_USER"]['air_station_or'];
|
|
|
|
|
-
|
|
|
|
|
- $sales = $user[$schemas."_ONLINE_USER"]['air_sales'];
|
|
|
|
|
- $sales_or = $user[$schemas."_ONLINE_USER"]['air_sales_or'];
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * online air
|
|
|
|
|
+ */
|
|
|
|
|
+ private static function _air($schemas = "public") {
|
|
|
|
|
+ $station = _getAirStation($schemas);
|
|
|
|
|
+ $station_or = _getAirStationOr($schemas);
|
|
|
|
|
+ $sales = _getAirSales($schemas);
|
|
|
|
|
+ $sales_or = _getAirSalesOr($schemas);
|
|
|
|
|
|
|
|
- if (strtolower($station_or) == "all" || strtolower($sales_or) == "all" ) //|| strtolower($d_or) == "all"|| strtolower($op_or) == "all"|| strtolower($follow_or) == "all"
|
|
|
|
|
- {
|
|
|
|
|
- return " and 1=1";
|
|
|
|
|
- }
|
|
|
|
|
- $sqlWhere = "";
|
|
|
|
|
- if (_isCustomerLoginHandNew($user)) {
|
|
|
|
|
- //error_log("_oceanHandNew".$schemas);
|
|
|
|
|
- $sqlWhere .= " and " . _customerFilerSearchHandNew_Air($user, $schemas);
|
|
|
|
|
- }
|
|
|
|
|
- else
|
|
|
|
|
- {
|
|
|
|
|
- if (empty($station) && empty($sales) ) //&& empty($d)&& empty($op) && empty($follow)
|
|
|
|
|
- {
|
|
|
|
|
- return " and 1<>1";
|
|
|
|
|
|
|
+ $sqlWhere = " 1=1";
|
|
|
|
|
+ if (_isCustomerLogin()) {
|
|
|
|
|
+ $sqlWhere .= " and " . _customerAirFilerSearch($schemas);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ if (empty($station) && empty($sales)) {
|
|
|
|
|
+ return " 1<>1";
|
|
|
}
|
|
}
|
|
|
- if ((strtolower($station) == 'all' || empty($station)) ) //&& (strtolower($d) == "all" || empty($d))
|
|
|
|
|
- {
|
|
|
|
|
-
|
|
|
|
|
- }
|
|
|
|
|
- else
|
|
|
|
|
- {
|
|
|
|
|
- $sql = "1=1";
|
|
|
|
|
- if (!empty($station) && strtolower($station) != 'all') {
|
|
|
|
|
- $sql .= " and (lower(origin)";
|
|
|
|
|
- $sql .= utils::getInSql($station);
|
|
|
|
|
- $sql .= " or lower(destination_station)";
|
|
|
|
|
- $sql .= utils::getInSql($station);
|
|
|
|
|
- $sql .= ")";
|
|
|
|
|
- }
|
|
|
|
|
- $sqlWhere .= " and (" . $sql . ")";
|
|
|
|
|
|
|
+ if (strtolower($station_or) == "all" || strtolower($sales_or) == "all")
|
|
|
|
|
+ return $sqlWhere;
|
|
|
|
|
+
|
|
|
|
|
+ if (strtolower($station) == 'all' || empty($station)) {
|
|
|
|
|
+
|
|
|
|
|
+ } else {
|
|
|
|
|
+ $sqlWhere .= " and (lower(origin)";
|
|
|
|
|
+ $sqlWhere .= utils::getInSql($station);
|
|
|
|
|
+ $sqlWhere .= " or lower(agent)";
|
|
|
|
|
+ $sqlWhere .= utils::getInSql($station);
|
|
|
|
|
+ $sqlWhere .= ")";
|
|
|
}
|
|
}
|
|
|
if (strtolower($sales) == 'all' || empty($sales)) {
|
|
if (strtolower($sales) == 'all' || empty($sales)) {
|
|
|
-
|
|
|
|
|
- } else
|
|
|
|
|
- {
|
|
|
|
|
- if (utils::checkExist($sales, ";")) {
|
|
|
|
|
- $sql = "1!=1";
|
|
|
|
|
- $tt = explode(";", $sales);
|
|
|
|
|
- foreach ($tt as $t) {
|
|
|
|
|
- $t = trim($t);
|
|
|
|
|
- if (!empty($t))
|
|
|
|
|
- {
|
|
|
|
|
- $sql .= " or lower(sales_rep)='" . strtolower($t) . "'";
|
|
|
|
|
- $sql .= " or lower(following_sales)='" . strtolower($t) . "'";
|
|
|
|
|
-
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- $sqlWhere .= " and ($sql)";
|
|
|
|
|
- } else
|
|
|
|
|
- {
|
|
|
|
|
- $sqlWhere .= " or lower(sales_rep)='" . strtolower($sales) . "'";
|
|
|
|
|
- $sqlWhere .= " or lower(following_sales)='" . strtolower($sales) . "'";
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- $sqlWhere = " (1=1 $sqlWhere)";
|
|
|
|
|
- if (!empty($station_or)) {
|
|
|
|
|
- $sqlWhere .= " or lower(origin)";
|
|
|
|
|
- $sqlWhere .= utils::getInSql($station_or);
|
|
|
|
|
- $sqlWhere .= " or lower(destination_station)";
|
|
|
|
|
- $sqlWhere .= utils::getInSql($station_or);
|
|
|
|
|
- }
|
|
|
|
|
- if (!empty($sales_or)) {
|
|
|
|
|
- if (utils::checkExist($sales_or, ";")) {
|
|
|
|
|
- $sql = "1!=1";
|
|
|
|
|
- $tt = explode(";", $sales_or);
|
|
|
|
|
- foreach ($tt as $t) {
|
|
|
|
|
- $t = trim($t);
|
|
|
|
|
- if (!empty($t))
|
|
|
|
|
- {
|
|
|
|
|
- $sql .= " or lower(sales_rep)='" . strtolower($t) . "'";
|
|
|
|
|
- $sql .= " or lower(following_sales)='" . strtolower($t) . "'";
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- $sqlWhere .= " or ($sql)";
|
|
|
|
|
- } else
|
|
|
|
|
- {
|
|
|
|
|
- $sqlWhere .= " or lower(sales_rep)='" . strtolower($sales_or) . "'";
|
|
|
|
|
- $sqlWhere .= " or lower(following_sales)='" . strtolower($sales_or) . "'";
|
|
|
|
|
-
|
|
|
|
|
- }
|
|
|
|
|
|
|
+
|
|
|
|
|
+ } else {
|
|
|
|
|
+ $sqlWhere .= " and (lower(sales_rep) " . utils::getInSql($sales) . " or lower(following_sales) " . utils::getInSql($sales) . ")";
|
|
|
}
|
|
}
|
|
|
- $sqlWhere = " and ($sqlWhere)";
|
|
|
|
|
|
|
+ $sqlWhere = " ($sqlWhere)";
|
|
|
|
|
+ if (!empty($station_or))
|
|
|
|
|
+ $sqlWhere = "$sqlWhere or lower(origin)" . utils::getInSql($station_or) . " or lower(agent)" . utils::getInSql($station_or);
|
|
|
|
|
+ if (!empty($sales_or))
|
|
|
|
|
+ $sqlWhere = "$sqlWhere or lower(sales_rep)" . utils::getInSql($sales_or) . " or lower(following_sales)" . utils::getInSql($sales_or);
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
- return $sqlWhere;
|
|
|
|
|
|
|
+ return "($sqlWhere)";
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
public static function isNewVersion() {
|
|
public static function isNewVersion() {
|
|
@@ -1291,9 +1179,8 @@ class common {
|
|
|
public static function getCo2eBar(){
|
|
public static function getCo2eBar(){
|
|
|
//新UI air sea road 目前只有sea
|
|
//新UI air sea road 目前只有sea
|
|
|
$type = $_REQUEST["r_type"];
|
|
$type = $_REQUEST["r_type"];
|
|
|
- $shipment_mode_arr = array("air","sea","road");
|
|
|
|
|
|
|
|
|
|
- $sqlWhere = ' and ' . common::searchExtendHandNew("ocean", $_SESSION["ONLINE_USER"]);
|
|
|
|
|
|
|
+ $sqlWhere = ' and ' . common::searchExtendHand_KLN("ocean", $_SESSION["ONLINE_USER"]);
|
|
|
$sqlWhere = " " . $sqlWhere;
|
|
$sqlWhere = " " . $sqlWhere;
|
|
|
|
|
|
|
|
$date_type = strtolower($_REQUEST["date_type"]);
|
|
$date_type = strtolower($_REQUEST["date_type"]);
|
|
@@ -1301,18 +1188,31 @@ class common {
|
|
|
$sqlWhere .= " and $date_type >= '" . common::usDate2sqlDate($_REQUEST['date_start']) . " 00:00:00'";
|
|
$sqlWhere .= " and $date_type >= '" . common::usDate2sqlDate($_REQUEST['date_start']) . " 00:00:00'";
|
|
|
if (isset($_REQUEST['date_end']) && !empty($_REQUEST['date_end']))
|
|
if (isset($_REQUEST['date_end']) && !empty($_REQUEST['date_end']))
|
|
|
$sqlWhere .= " and $date_type <= '" . common::usDate2sqlDate($_REQUEST['date_end']) . " 23:59:59'";
|
|
$sqlWhere .= " and $date_type <= '" . common::usDate2sqlDate($_REQUEST['date_end']) . " 23:59:59'";
|
|
|
|
|
+
|
|
|
|
|
+ $transportation = $_REQUEST["transportation"];
|
|
|
|
|
+ if(!is_array($transportation)){
|
|
|
|
|
+ $transportation = array($transportation);
|
|
|
|
|
+ }
|
|
|
|
|
+ $mode_param = "";
|
|
|
|
|
+ if(count($transportation) == 1 && strtolower($transportation[0]) == 'all' ){
|
|
|
|
|
+ $mode_param = "'sea','air','road'";
|
|
|
|
|
+ }else{
|
|
|
|
|
+ $transport_mode = implode(';', $transportation);
|
|
|
|
|
+ $mode_param = common::getInNotInSqlForSearch($transport_mode);
|
|
|
|
|
+ }
|
|
|
|
|
+ $sqlWhere .= " and transport_mode in ($mode_param)";
|
|
|
|
|
|
|
|
$ContainerCount_Title = array();
|
|
$ContainerCount_Title = array();
|
|
|
//先查询总的排放量sea air road,确定排名后,在分别查询对应的sea air road
|
|
//先查询总的排放量sea air road,确定排名后,在分别查询对应的sea air road
|
|
|
//这里的问题跟 top 一样 。总的排放量查询有问题。目前是总的排放量 暂时等于 sea的排放量
|
|
//这里的问题跟 top 一样 。总的排放量查询有问题。目前是总的排放量 暂时等于 sea的排放量
|
|
|
if ($type == "co2e_orgin"){
|
|
if ($type == "co2e_orgin"){
|
|
|
$co2e_shippr_sql = "select SUM(COALESCE(carbon_emission,0)) as catnum ,
|
|
$co2e_shippr_sql = "select SUM(COALESCE(carbon_emission,0)) as catnum ,
|
|
|
- shippr_uncode as station from online_ocean where 1=1 and COALESCE(shippr_uncode,'')<>'' and carbon_emission is not null $sqlWhere group by shippr_uncode order by catnum desc limit 10";
|
|
|
|
|
|
|
+ shippr_uncode as station from kln_ocean where 1=1 and COALESCE(shippr_uncode,'')<>'' and carbon_emission is not null $sqlWhere group by shippr_uncode order by catnum desc limit 10";
|
|
|
$co2e_aLL = common::excuteListSql($co2e_shippr_sql);
|
|
$co2e_aLL = common::excuteListSql($co2e_shippr_sql);
|
|
|
}
|
|
}
|
|
|
if ($type == "co2e_destination"){
|
|
if ($type == "co2e_destination"){
|
|
|
$co2e_consignee_sql = "select SUM(COALESCE(carbon_emission,0)) as catnum ,
|
|
$co2e_consignee_sql = "select SUM(COALESCE(carbon_emission,0)) as catnum ,
|
|
|
- consignee_uncode as station from online_ocean where 1=1 and COALESCE(consignee_uncode,'')<>'' and carbon_emission is not null $sqlWhere group by consignee_uncode order by catnum desc limit 10";
|
|
|
|
|
|
|
+ consignee_uncode as station from kln_ocean where 1=1 and COALESCE(consignee_uncode,'')<>'' and carbon_emission is not null $sqlWhere group by consignee_uncode order by catnum desc limit 10";
|
|
|
$co2e_aLL = common::excuteListSql($co2e_consignee_sql);
|
|
$co2e_aLL = common::excuteListSql($co2e_consignee_sql);
|
|
|
}
|
|
}
|
|
|
//最大Y值
|
|
//最大Y值
|
|
@@ -1328,6 +1228,7 @@ class common {
|
|
|
$station_str = utils::implode(',',$stations);
|
|
$station_str = utils::implode(',',$stations);
|
|
|
|
|
|
|
|
$ContainerCounSeries = array();
|
|
$ContainerCounSeries = array();
|
|
|
|
|
+ $shipment_mode_arr = array("air","sea","road");
|
|
|
foreach($shipment_mode_arr as $_shipment_mode){
|
|
foreach($shipment_mode_arr as $_shipment_mode){
|
|
|
//类型有 sea air road,目前之类只查询sea的,其他为空
|
|
//类型有 sea air road,目前之类只查询sea的,其他为空
|
|
|
$shipment_mode = $_shipment_mode;
|
|
$shipment_mode = $_shipment_mode;
|
|
@@ -1355,21 +1256,6 @@ class common {
|
|
|
$total = $total + $val['catnum'];
|
|
$total = $total + $val['catnum'];
|
|
|
$max = $max < $val['catnum'] ? $val['catnum'] : $max;
|
|
$max = $max < $val['catnum'] ? $val['catnum'] : $max;
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
- $transportation = $_REQUEST["transportation"];
|
|
|
|
|
- if(!is_array($transportation)){
|
|
|
|
|
- $transportation = array($transportation);
|
|
|
|
|
- }
|
|
|
|
|
- if(count($transportation) == 1 && strtolower($transportation[0]) == 'all' ){
|
|
|
|
|
-
|
|
|
|
|
- }else{
|
|
|
|
|
- //这里不用处理,只有sea的数据
|
|
|
|
|
- if (!in_array("Sea", $transportation)){
|
|
|
|
|
- $data = array_fill_keys(array_keys($data), 0);
|
|
|
|
|
- $total = 0;
|
|
|
|
|
- $max = 0;
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
$ContainerCounSeries[$shipment_mode] = array("data"=>$data,"total"=>$total,"max"=>$max);
|
|
$ContainerCounSeries[$shipment_mode] = array("data"=>$data,"total"=>$total,"max"=>$max);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -1394,7 +1280,7 @@ class common {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
public static function getTopBar(){
|
|
public static function getTopBar(){
|
|
|
- $sqlWhere = ' and ' . common::searchExtendHandNew("ocean", $_SESSION["ONLINE_USER"]);
|
|
|
|
|
|
|
+ $sqlWhere = ' and ' . common::searchExtendHand_KLN("ocean", $_SESSION["ONLINE_USER"]);
|
|
|
$sqlWhere = " " . $sqlWhere;
|
|
$sqlWhere = " " . $sqlWhere;
|
|
|
|
|
|
|
|
$date_type = strtolower($_REQUEST["date_type"]);
|
|
$date_type = strtolower($_REQUEST["date_type"]);
|
|
@@ -1402,10 +1288,23 @@ class common {
|
|
|
$sqlWhere .= " and $date_type >= '" . common::usDate2sqlDate($_REQUEST['date_start']) . " 00:00:00'";
|
|
$sqlWhere .= " and $date_type >= '" . common::usDate2sqlDate($_REQUEST['date_start']) . " 00:00:00'";
|
|
|
if (isset($_REQUEST['date_end']) && !empty($_REQUEST['date_end']))
|
|
if (isset($_REQUEST['date_end']) && !empty($_REQUEST['date_end']))
|
|
|
$sqlWhere .= " and $date_type <= '" . common::usDate2sqlDate($_REQUEST['date_end']) . " 23:59:59'";
|
|
$sqlWhere .= " and $date_type <= '" . common::usDate2sqlDate($_REQUEST['date_end']) . " 23:59:59'";
|
|
|
|
|
+
|
|
|
|
|
+ $transportation = $_REQUEST["transportation"];
|
|
|
|
|
+ if(!is_array($transportation)){
|
|
|
|
|
+ $transportation = array($transportation);
|
|
|
|
|
+ }
|
|
|
|
|
+ $mode_param = "";
|
|
|
|
|
+ if(count($transportation) == 1 && strtolower($transportation[0]) == 'all' ){
|
|
|
|
|
+ $mode_param = "'sea','air','road'";
|
|
|
|
|
+ }else{
|
|
|
|
|
+ $transport_mode = implode(';', $transportation);
|
|
|
|
|
+ $mode_param = common::getInNotInSqlForSearch($transport_mode);
|
|
|
|
|
+ }
|
|
|
|
|
+ $sqlWhere .= " and transport_mode in ($mode_param)";
|
|
|
|
|
|
|
|
$toporiginType = "shippr_uncode";
|
|
$toporiginType = "shippr_uncode";
|
|
|
$shippr_uncode_10_sql ="with aa as (select count(shippr_uncode) as num,shippr_uncode,
|
|
$shippr_uncode_10_sql ="with aa as (select count(shippr_uncode) as num,shippr_uncode,
|
|
|
- (array_agg(shipper_city))[1] AS shipper_city from online_ocean
|
|
|
|
|
|
|
+ (array_agg(shipper_city))[1] AS shipper_city from kln_ocean
|
|
|
where 1=1 and COALESCE(shippr_uncode,'')<>'' $sqlWhere group by shippr_uncode order by num desc limit 10)
|
|
where 1=1 and COALESCE(shippr_uncode,'')<>'' $sqlWhere group by shippr_uncode order by num desc limit 10)
|
|
|
select aa.*,dd.* from aa
|
|
select aa.*,dd.* from aa
|
|
|
left join LATERAL ( select lon as lng, lat as lat,
|
|
left join LATERAL ( select lon as lng, lat as lat,
|
|
@@ -1419,7 +1318,7 @@ class common {
|
|
|
if(count($shippr_uncode_10) == 1 && empty($shippr_uncode_10[0]["shippr_uncode"])){
|
|
if(count($shippr_uncode_10) == 1 && empty($shippr_uncode_10[0]["shippr_uncode"])){
|
|
|
$toporiginType = "fport_of_loading_un";
|
|
$toporiginType = "fport_of_loading_un";
|
|
|
$shippr_uncode_10_sql = "with aa as (select count(fport_of_loading_un) as num,fport_of_loading_un as shippr_uncode
|
|
$shippr_uncode_10_sql = "with aa as (select count(fport_of_loading_un) as num,fport_of_loading_un as shippr_uncode
|
|
|
- from online_ocean where 1=1 and COALESCE(fport_of_loading_un,'')<>'' $sqlWhere group by fport_of_loading_un order by num desc limit 10)
|
|
|
|
|
|
|
+ from kln_ocean where 1=1 and COALESCE(fport_of_loading_un,'')<>'' $sqlWhere group by fport_of_loading_un order by num desc limit 10)
|
|
|
select aa.*,dd.* from aa
|
|
select aa.*,dd.* from aa
|
|
|
left join LATERAL ( select lon as lng, lat as lat,
|
|
left join LATERAL ( select lon as lng, lat as lat,
|
|
|
'' as label, '' as infor, 3 as sort,
|
|
'' as label, '' as infor, 3 as sort,
|
|
@@ -1432,7 +1331,7 @@ class common {
|
|
|
$topdestinationinType = "consignee_uncode";
|
|
$topdestinationinType = "consignee_uncode";
|
|
|
$consignee_uncode_10_sql = "with aa as (select count(consignee_uncode) as num,consignee_uncode,
|
|
$consignee_uncode_10_sql = "with aa as (select count(consignee_uncode) as num,consignee_uncode,
|
|
|
(array_agg(consignee_city))[1] AS consignee_city
|
|
(array_agg(consignee_city))[1] AS consignee_city
|
|
|
- from online_ocean where 1=1 and COALESCE(consignee_uncode,'')<>'' $sqlWhere group by consignee_uncode order by num desc limit 10)
|
|
|
|
|
|
|
+ from kln_ocean where 1=1 and COALESCE(consignee_uncode,'')<>'' $sqlWhere group by consignee_uncode order by num desc limit 10)
|
|
|
select aa.*,dd.* from aa
|
|
select aa.*,dd.* from aa
|
|
|
left join LATERAL ( select lon as lng, lat as lat,
|
|
left join LATERAL ( select lon as lng, lat as lat,
|
|
|
'' as label, '' as infor, 3 as sort,
|
|
'' as label, '' as infor, 3 as sort,
|
|
@@ -1443,7 +1342,7 @@ class common {
|
|
|
//如果值没有:客户地址-->站点地址-->Port地址(POL/POD)
|
|
//如果值没有:客户地址-->站点地址-->Port地址(POL/POD)
|
|
|
if(count($consignee_uncode_10) == 1 && empty($consignee_uncode_10[0]["consignee_uncode"])){
|
|
if(count($consignee_uncode_10) == 1 && empty($consignee_uncode_10[0]["consignee_uncode"])){
|
|
|
$topdestinationinType = "mport_of_discharge_un";
|
|
$topdestinationinType = "mport_of_discharge_un";
|
|
|
- $consignee_uncode_10_sql = "with aa as (select count(mport_of_discharge_un) as num,mport_of_discharge_un as consignee_uncode from online_ocean where 1=1 and COALESCE(mport_of_discharge_un,'')<>'' $sqlWhere group by mport_of_discharge_un order by num desc limit 10)
|
|
|
|
|
|
|
+ $consignee_uncode_10_sql = "with aa as (select count(mport_of_discharge_un) as num,mport_of_discharge_un as consignee_uncode from kln_ocean where 1=1 and COALESCE(mport_of_discharge_un,'')<>'' $sqlWhere group by mport_of_discharge_un order by num desc limit 10)
|
|
|
select aa.*,dd.* from aa
|
|
select aa.*,dd.* from aa
|
|
|
left join LATERAL ( select lon as lng, lat as lat,
|
|
left join LATERAL ( select lon as lng, lat as lat,
|
|
|
'' as label, '' as infor, 3 as sort,
|
|
'' as label, '' as infor, 3 as sort,
|
|
@@ -1452,22 +1351,6 @@ class common {
|
|
|
$consignee_uncode_10 = common::excuteListSql($consignee_uncode_10_sql);
|
|
$consignee_uncode_10 = common::excuteListSql($consignee_uncode_10_sql);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- //Top查询有点问题,暂时这样查询: 理论上查询air sea road 所有数据的top 10,在更加这个top的站点,分别去查询对于mode的数据计总。
|
|
|
|
|
- //但是目前只有sea, 所有模式计总 = sea计总(以后这里是要改的)
|
|
|
|
|
- $transportation = $_REQUEST["transportation"];
|
|
|
|
|
- if(!is_array($transportation)){
|
|
|
|
|
- $transportation = array($transportation);
|
|
|
|
|
- }
|
|
|
|
|
- if(count($transportation) == 1 && strtolower($transportation[0]) == 'all' ){
|
|
|
|
|
-
|
|
|
|
|
- }else{
|
|
|
|
|
- //这里不用处理,只有sea的数据
|
|
|
|
|
- if (!in_array("Sea", $transportation)){
|
|
|
|
|
- $shippr_uncode_10 = array();
|
|
|
|
|
- $consignee_uncode_10 = array();
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
$toporigin = array();
|
|
$toporigin = array();
|
|
|
$toporiginMap = array();
|
|
$toporiginMap = array();
|
|
|
$i = 0;
|
|
$i = 0;
|
|
@@ -1550,7 +1433,7 @@ class common {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
public static function getRevenue(){
|
|
public static function getRevenue(){
|
|
|
- $data = '{"bar_title":"Total: 0","barList":["DEC,23","JAN,24","FEB,24","MAR,24","APR,24","MAY,24","JUN,24","JUL,24","AUG,24","SEP,24","OCT,24","NOV,24"],"barSeries":[{"name":"USD","type":"bar","data":[1,1,1,1,1,1,1,1,1,1,1,1],"emphasis":{"disabled":true,"focus":"none"},"itemStyle":{"color":"#FF7500","borderRadius":6},"label":{"show":false,"color":"#646A73","position":"top","fontFamily":"Lato-Light","hideWhenMouseLeave":false}},{"name":"THB","type":"bar","data":[2,2,2,2,2,2,2,2,2,2,2,2],"emphasis":{"disabled":true,"focus":"none"},"itemStyle":{"color":"#FFAC66","borderRadius":6},"label":{"show":false,"color":"#646A73","position":"top","fontFamily":"Lato-Light","hideWhenMouseLeave":false}},{"name":"SGD","type":"bar","data":[3,3,3,3,3,3,3,3,3,3,3,3],"emphasis":{"disabled":true,"focus":"none"},"itemStyle":{"color":"#FFE3CC","borderRadius":6},"label":{"show":false,"color":"#646A73","position":"top","fontFamily":"Lato-Light","hideWhenMouseLeave":false}}],"Max":5,"interval":1,"download_name":"Rvenue","isShowTooltips":true}';
|
|
|
|
|
|
|
+ //$data = '{"bar_title":"Total: 0","barList":["DEC,23","JAN,24","FEB,24","MAR,24","APR,24","MAY,24","JUN,24","JUL,24","AUG,24","SEP,24","OCT,24","NOV,24"],"barSeries":[{"name":"USD","type":"bar","data":[1,1,1,1,1,1,1,1,1,1,1,1],"emphasis":{"disabled":true,"focus":"none"},"itemStyle":{"color":"#FF7500","borderRadius":6},"label":{"show":false,"color":"#646A73","position":"top","fontFamily":"Lato-Light","hideWhenMouseLeave":false}},{"name":"THB","type":"bar","data":[2,2,2,2,2,2,2,2,2,2,2,2],"emphasis":{"disabled":true,"focus":"none"},"itemStyle":{"color":"#FFAC66","borderRadius":6},"label":{"show":false,"color":"#646A73","position":"top","fontFamily":"Lato-Light","hideWhenMouseLeave":false}},{"name":"SGD","type":"bar","data":[3,3,3,3,3,3,3,3,3,3,3,3],"emphasis":{"disabled":true,"focus":"none"},"itemStyle":{"color":"#FFE3CC","borderRadius":6},"label":{"show":false,"color":"#646A73","position":"top","fontFamily":"Lato-Light","hideWhenMouseLeave":false}}],"Max":5,"interval":1,"download_name":"Rvenue","isShowTooltips":true}';
|
|
|
//return json_decode($data,true);
|
|
//return json_decode($data,true);
|
|
|
$date_from = null;
|
|
$date_from = null;
|
|
|
$date_to = null;
|
|
$date_to = null;
|
|
@@ -1666,12 +1549,12 @@ class common {
|
|
|
"title"=>"Container Count",
|
|
"title"=>"Container Count",
|
|
|
"switchValue"=>true,
|
|
"switchValue"=>true,
|
|
|
"text"=>"Pie chart showing figures of shipments which are soon to depart/arrive (Calculated from ETD/ETA).");
|
|
"text"=>"Pie chart showing figures of shipments which are soon to depart/arrive (Calculated from ETD/ETA).");
|
|
|
- // if(_isRevenueDisplay()){
|
|
|
|
|
- // $Management[] = array("id"=>5 ,
|
|
|
|
|
- // "title"=>"Revenue Spent",
|
|
|
|
|
- // "switchValue"=>true,
|
|
|
|
|
- // "text"=>"Revenue data for the past 12 months.");
|
|
|
|
|
- // }
|
|
|
|
|
|
|
+ if(_isRevenueDisplay()){
|
|
|
|
|
+ $Management[] = array("id"=>5 ,
|
|
|
|
|
+ "title"=>"Revenue Spent",
|
|
|
|
|
+ "switchValue"=>true,
|
|
|
|
|
+ "text"=>"Revenue data for the past 12 months.");
|
|
|
|
|
+ }
|
|
|
$Management[] = array("id"=>6 ,
|
|
$Management[] = array("id"=>6 ,
|
|
|
"title"=>"Top 10 Origin/Destination",
|
|
"title"=>"Top 10 Origin/Destination",
|
|
|
"switchValue"=>true,
|
|
"switchValue"=>true,
|
|
@@ -1807,7 +1690,7 @@ class common {
|
|
|
return $str;
|
|
return $str;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- public static function getMilestonesInfo($ocean,$EDI315TimeAndLocation){
|
|
|
|
|
|
|
+ public static function getMilestonesInfo($ocean,$transport_mode,$_schemas,$EDI315TimeAndLocation=array()){
|
|
|
//Milestones info列名固定
|
|
//Milestones info列名固定
|
|
|
$Milestones_column = array();
|
|
$Milestones_column = array();
|
|
|
$Milestones_column[] = array("title" =>"Milestones","field" =>"milestones","formatter" =>"normal","type" =>"normal");
|
|
$Milestones_column[] = array("title" =>"Milestones","field" =>"milestones","formatter" =>"normal","type" =>"normal");
|
|
@@ -1820,13 +1703,22 @@ class common {
|
|
|
|
|
|
|
|
//Milestones 数据信息待定
|
|
//Milestones 数据信息待定
|
|
|
$Milestones_data = array();
|
|
$Milestones_data = array();
|
|
|
- $Milestones_data_arr = common::excuteListSql("select sn.description,act_date||' '||COALESCE(act_time,'') as date_time,
|
|
|
|
|
- remark,timezone,a.code
|
|
|
|
|
- from public.ocean_milestone a
|
|
|
|
|
- inner join public.customer_service_milestone_sno sn on sn.code=a.code
|
|
|
|
|
- where a.serial_no='".$ocean["serial_no"]."' and act_date is not null order by sn.sno asc");
|
|
|
|
|
|
|
+ if($transport_mode == 'sea'){
|
|
|
|
|
+ $Milestones_data_arr = common::excuteListSql("select sn.description,act_date||' '||COALESCE(act_time,'') as date_time,
|
|
|
|
|
+ remark,timezone,a.code
|
|
|
|
|
+ from public.ocean_milestone a
|
|
|
|
|
+ inner join public.customer_service_milestone_sno sn on sn.code=a.code
|
|
|
|
|
+ where a.serial_no='".$ocean["serial_no"]."' and act_date is not null order by sn.sno asc");
|
|
|
|
|
+ }else{
|
|
|
|
|
+ $Milestones_data_arr = common::excuteListSql("select sn.description,act_date||' '||COALESCE(act_time,'') as date_time,
|
|
|
|
|
+ remark,timezone,a.code
|
|
|
|
|
+ from $_schemas.air_milestone a
|
|
|
|
|
+ inner join public.customer_service_milestone_sno sn on sn.code=a.code
|
|
|
|
|
+ where a.serial_no='".$ocean["serial_no"]."' and act_date is not null order by sn.sno asc");
|
|
|
|
|
+ }
|
|
|
foreach($Milestones_data_arr as $mda){
|
|
foreach($Milestones_data_arr as $mda){
|
|
|
$timezone = "";
|
|
$timezone = "";
|
|
|
|
|
+ $IFFICC_locations ="";
|
|
|
if(!empty($EDI315TimeAndLocation[$mda['code']])){
|
|
if(!empty($EDI315TimeAndLocation[$mda['code']])){
|
|
|
$edi315Info = $EDI315TimeAndLocation[$mda['code']];
|
|
$edi315Info = $EDI315TimeAndLocation[$mda['code']];
|
|
|
if(!empty($edi315Info)){
|
|
if(!empty($edi315Info)){
|
|
@@ -2061,74 +1953,21 @@ class common {
|
|
|
return $EDI315TimeAndLocation;
|
|
return $EDI315TimeAndLocation;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- public static function getAirSql($air_view,$type,$sql_where){
|
|
|
|
|
- $r3_r4_sql = "";
|
|
|
|
|
- if($type == 'ata_r3'){
|
|
|
|
|
- $r3_r4_sql = "select count(1) as count, '0 Day' as distext
|
|
|
|
|
- from ($air_view) aa where 1=1 $sql_where and ata >= etd and (ata-etd) >= 0 and (ata-etd) < 1
|
|
|
|
|
- union all
|
|
|
|
|
- select count(1) as count, '1-2 Days' as distext
|
|
|
|
|
- from ($air_view) aa where 1=1 $sql_where and ata >= etd and (ata-etd) >= 1 and (ata-etd) < 2
|
|
|
|
|
- union all
|
|
|
|
|
- select count(1) as count, '3-6 Days' as distext
|
|
|
|
|
- from ($air_view) aa where 1=1 $sql_where and ata >= etd and (ata-etd) >= 2 and (ata-etd) < 6
|
|
|
|
|
- union all
|
|
|
|
|
- select count(1) as count, '7 Days' as distext
|
|
|
|
|
- from ($air_view) aa where 1=1 $sql_where and ata >= etd and (ata-etd) >= 6";
|
|
|
|
|
- }
|
|
|
|
|
- if($type == 'atd_r4'){
|
|
|
|
|
- $r3_r4_sql ="select count(1) as count, ''0 Day'' as distext
|
|
|
|
|
- from ($air_view) aa where 1=1 $sql_where and atd >= etd and (atd-etd) >= 0 and (atd-etd) < 1
|
|
|
|
|
- union all
|
|
|
|
|
- select count(1) as count, ''1-2 Days'' as distext
|
|
|
|
|
- from ($air_view) aa where 1=1 $sql_where and atd >= etd and (atd-etd) >= 1 and (atd-etd) < 2
|
|
|
|
|
- union all
|
|
|
|
|
- select count(1) as count, ''3-6 Days'' as distext
|
|
|
|
|
- from ($air_view) aa where 1=1 $sql_where and atd >= etd and (atd-etd) >= 2 and (atd-etd) < 6
|
|
|
|
|
- union all
|
|
|
|
|
- select count(1) as count, ''7 Days'' as distext
|
|
|
|
|
- from ($air_view) aa where 1=1 $sql_where and and atd >= etd and (atd-etd) >= 6";
|
|
|
|
|
- }
|
|
|
|
|
- return $r3_r4_sql;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- public static function getTopBarSQL($toporiginType,$transportation,$sqlWhere,$air_v){
|
|
|
|
|
|
|
+ public static function getDashboardTransportationSqlWhere(){
|
|
|
|
|
+ $transportation = $_REQUEST["transportation"];
|
|
|
if(!is_array($transportation)){
|
|
if(!is_array($transportation)){
|
|
|
$transportation = array($transportation);
|
|
$transportation = array($transportation);
|
|
|
}
|
|
}
|
|
|
|
|
+ $mode_param = "";
|
|
|
if(count($transportation) == 1 && strtolower($transportation[0]) == 'all' ){
|
|
if(count($transportation) == 1 && strtolower($transportation[0]) == 'all' ){
|
|
|
- $transportation = array("Ocean","Air","Road");
|
|
|
|
|
- }
|
|
|
|
|
- //处理生成TopBarSQL
|
|
|
|
|
- $_tmp_table = "";
|
|
|
|
|
- foreach($transportation as $mode){
|
|
|
|
|
- if($mode == "Ocean"){
|
|
|
|
|
- if(empty($_tmp_table)){
|
|
|
|
|
- $_tmp_table .= "select shippr_uncode,shipper_city from online_ocean where 1=1 and COALESCE(shippr_uncode,'')<>'' $sqlWhere";
|
|
|
|
|
- }else{
|
|
|
|
|
- $_tmp_table .= "union all select shippr_uncode,shipper_city from online_ocean where 1=1 and COALESCE(shippr_uncode,'')<>'' $sqlWhere";
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- if($mode == "Air"){
|
|
|
|
|
- if(empty($_tmp_table)){
|
|
|
|
|
- $_tmp_table .= "select shippr_uncode,shipper_city from $air_v where 1=1 and COALESCE(shippr_uncode,'')<>'' $sqlWhere";
|
|
|
|
|
- }else{
|
|
|
|
|
- $_tmp_table .= "union all select shippr_uncode,shipper_city from $air_v where 1=1 and COALESCE(shippr_uncode,'')<>'' $sqlWhere";
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- if($mode == "Road"){
|
|
|
|
|
-
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ $mode_param = "'sea','air','road'";
|
|
|
|
|
+ }else{
|
|
|
|
|
+ $transport_mode = implode(';', $transportation);
|
|
|
|
|
+ $mode_param = common::getInNotInSqlForSearch($transport_mode);
|
|
|
}
|
|
}
|
|
|
- //虽然air 没有地图信息,但是坐标查询为空的过滤掉
|
|
|
|
|
- $TopBarSQL = "with aa as (select count(shippr_uncode) as num,shippr_uncode,
|
|
|
|
|
- (array_agg(shipper_city))[1] AS shipper_city from ($_tmp_table) as _tmp group by shippr_uncode order by num desc limit 10)
|
|
|
|
|
- select aa.*,dd.* from aa
|
|
|
|
|
- left join LATERAL ( select lon as lng, lat as lat,
|
|
|
|
|
- '' as label, '' as infor, 3 as sort,
|
|
|
|
|
- null::timestamp without time zone as stime,''::text as ptype
|
|
|
|
|
- from vessel.vt_unlocode where lon<>0 and lat<>0 and lon is not null and lat is not null and uncode=aa.shippr_uncode ) dd on true";
|
|
|
|
|
- return $TopBarSQL;
|
|
|
|
|
|
|
+ return " and transport_mode in ($mode_param)";
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
}
|
|
}
|
|
|
?>
|
|
?>
|