ShuanghongS 11 miesięcy temu
rodzic
commit
abf45b4d06

+ 10 - 0
main_new_version.php

@@ -353,6 +353,11 @@ switch ($action) {
             if($mode == 'Air'){
                 //暂时查询空数据
                 $sqlWhere_air = $sqlWhere ." and 1<>1 ";
+                //拼接的date_start数据
+                //todo 根据权限信息获取一共air查询的总表的整合,因为air信息是分别存在public 和sfs 两个模式中的
+                // $air_view = "";
+                // $air_sql = common::getAirSql($air_view,$type,$sql_where);
+                // $Airlist = common::excuteListSql("select count as c, distext as d from ($air_sql) aa ");
                 $Airlist = common::excuteListSql("select * from public.online_order_status_date_kpi_new('$type'::text,'$sqlWhere_air'::text) "
                     . "r (c bigint, d text)");
                 //拼接数据     
@@ -366,6 +371,11 @@ switch ($action) {
             }
             if($mode == 'Road'){
                 $sqlWhere_road = $sqlWhere ." and 1<>1 ";
+                //拼接的date_start数据  road 没有数据  可以置为1<>1
+                //todo 根据权限信息获取一共air查询的总表的整合,因为air信息是分别存在sspublic 和sfs 两个模式中的
+                // $air_view = "";
+                // $air_sql = common::getAirSql($air_view,$type,$sql_where);
+                // $Airlist = common::excuteListSql("select count as c, distext as d from ($air_sql) aa ");
                 $roadlist = common::excuteListSql("select * from public.online_order_status_date_kpi_new('$type'::text,'$sqlWhere_road'::text) "
                  . "r (c bigint, d text)");  
                 //拼接数据     

+ 6 - 6
service/login.class.php

@@ -1427,7 +1427,7 @@ class login {
                 address_4 as aa_address_4,
                 city as aa_city, state as aa_state, zipcode as aa_zipcode, country as aa_country,
                 phone_1 as aa_phone,
-                (select time_zone from public.city_timezone where uncode = LEFT(country, 2) || COALESCE(city_code,'') limit 1) as aa_timezone
+                (select time_zone from public.city_timezone where uncode = LEFT(c.country, 2) || COALESCE(c.city_code,'') limit 1) as aa_timezone
             FROM ocean.contacts c WHERE o.origin_station::text = c.contact_id::text) aa ON true
             LEFT JOIN LATERAL ( SELECT company as dd_company,
                 address_1 as dd_address_1,
@@ -1436,11 +1436,11 @@ class login {
                 address_4 as dd_address_4,
                 city as dd_city, state as dd_state, zipcode as dd_zipcode, country as dd_country,
                 phone_1 as dd_phone,
-                (select time_zone from public.city_timezone where uncode = LEFT(country, 2) || COALESCE(city_code,'') limit 1) as dd_timezone
+                (select time_zone from public.city_timezone where uncode = LEFT(c.country, 2) || COALESCE(c.city_code,'') limit 1) as dd_timezone
             FROM ocean.contacts c WHERE o.destination_station::text = c.contact_id::text) dd ON true
             LEFT JOIN LATERAL ( SELECT 
                 city as fd_city,
-                (select time_zone from public.city_timezone where uncode = LEFT(country, 2) || COALESCE(city_code,'') limit 1) as fd_timezone
+                (select time_zone from public.city_timezone where uncode = LEFT(c.country, 2) || COALESCE(c.city_code,'') limit 1) as fd_timezone
             FROM ocean.contacts c WHERE o.final_desination::text = c.contact_id::text) fd ON true";
 
         $sfs_sql = "with o as(
@@ -1497,7 +1497,7 @@ class login {
                 address_4 as aa_address_4,
                 city as aa_city, state as aa_state, zipcode as aa_zipcode, country as aa_country,
                 phone_1 as aa_phone,
-                (select time_zone from public.city_timezone where uncode = LEFT(country, 2) || COALESCE(city_code,'') limit 1) as aa_timezone
+                (select time_zone from public.city_timezone where uncode = LEFT(c.country, 2) || COALESCE(c.city_code,'') limit 1) as aa_timezone
             FROM sfs.contacts c WHERE o.origin_station::text = c.contact_id::text) aa ON true
             LEFT JOIN LATERAL ( SELECT company as dd_company,
                 address_1 as dd_address_1,
@@ -1506,11 +1506,11 @@ class login {
                 address_4 as dd_address_4,
                 city as dd_city, state as dd_state, zipcode as dd_zipcode, country as dd_country,
                 phone_1 as dd_phone,
-                (select time_zone from public.city_timezone where uncode = LEFT(country, 2) || COALESCE(city_code,'') limit 1) as dd_timezone
+                (select time_zone from public.city_timezone where uncode = LEFT(c.country, 2) || COALESCE(c.city_code,'') limit 1) as dd_timezone
             FROM sfs.contacts c WHERE o.destination_station::text = c.contact_id::text) dd ON true
             LEFT JOIN LATERAL ( SELECT 
                 city as fd_city,
-                (select time_zone from public.city_timezone where uncode = LEFT(country, 2) || COALESCE(city_code,'') limit 1) as fd_timezone
+                (select time_zone from public.city_timezone where uncode = LEFT(c.country, 2) || COALESCE(c.city_code,'') limit 1) as fd_timezone
             FROM sfs.contacts c WHERE o.final_desination::text = c.contact_id::text) fd ON true";
         if(strtolower($order_from) == "public"){
             return $public_sql;

+ 4 - 0
service/ocean_order.class.php

@@ -207,6 +207,10 @@ class ocean_order {
                 $rs[$rk]['container_no'] = $rv['ctnr'];
                 $rs[$rk]['vgm_kg_lg'] = $rv['unit'];
                 $rs[$rk]['vgm_date'] = $rv['vgm_time'];
+                //这个是前端逻辑,carrier_booking_no为空的话,取carrier_booking
+                if(empty($rs[$rk]['carrier_booking_no'])){
+                    $rs[$rk]['carrier_booking_no'] = $ocean_info["carrier_booking"];
+                }
             }
             $detail_information =array("detail_information_column" =>$detail_information_column,
                 "detail_information_data" =>$rs);

+ 70 - 0
utils/common.class.php

@@ -1412,6 +1412,8 @@ class common {
                 '' 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";
+        //todo 这里预写个大概
+        //common::getTopBarSQL($toporiginType,$_REQUEST["transportation"]);    
         $shippr_uncode_10 = common::excuteListSql($shippr_uncode_10_sql);
         //如果值没有:客户地址-->站点地址-->Port地址(POL/POD) 
         if(count($shippr_uncode_10) == 1 && empty($shippr_uncode_10[0]["shippr_uncode"])){
@@ -2058,5 +2060,73 @@ class common {
         }
         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"){
+                
+    //         }
+    //     }
+    //     //虽然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;
+    // }
 }
 ?>