|
@@ -1959,8 +1959,8 @@ class common {
|
|
|
left join public.ra_online_edi_event e on s.event_base = e.ra_name
|
|
left join public.ra_online_edi_event e on s.event_base = e.ra_name
|
|
|
where s.serial_no = '" . pg_escape_string($cd['serial_no']) . "'
|
|
where s.serial_no = '" . pg_escape_string($cd['serial_no']) . "'
|
|
|
and s.container_no = '" . pg_escape_string($cd['ctnr']) . "' and is_display = true
|
|
and s.container_no = '" . pg_escape_string($cd['ctnr']) . "' and is_display = true
|
|
|
- order by to_timestamp(s.event_date, 'YYYYMMDD') asc,
|
|
|
|
|
- to_timestamp(s.event_time, 'HH24MI') asc,e.ra_order asc";
|
|
|
|
|
|
|
+ order by to_timestamp(s.event_date, 'YYYYMMDD') desc,
|
|
|
|
|
+ to_timestamp(s.event_time, 'HH24MI') desc,e.ra_order desc";
|
|
|
$ctnr_status = common::excuteListSql($ctnr_status_sql);
|
|
$ctnr_status = common::excuteListSql($ctnr_status_sql);
|
|
|
|
|
|
|
|
//Container_Status 新版只显示几个状态, CTNR# EE I AE VD VA
|
|
//Container_Status 新版只显示几个状态, CTNR# EE I AE VD VA
|
|
@@ -2061,72 +2061,74 @@ 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){
|
|
|
|
|
- // if(!is_array($transportation)){
|
|
|
|
|
- // $transportation = array($transportation);
|
|
|
|
|
- // }
|
|
|
|
|
- // 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"){
|
|
|
|
|
|
|
+ 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){
|
|
|
|
|
+ if(!is_array($transportation)){
|
|
|
|
|
+ $transportation = array($transportation);
|
|
|
|
|
+ }
|
|
|
|
|
+ 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"){
|
|
|
|
|
|
|
|
- // }
|
|
|
|
|
- // }
|
|
|
|
|
- // //虽然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;
|
|
|
|
|
- // }
|
|
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ //虽然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;
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
?>
|
|
?>
|