ShuanghongS 1 year ago
parent
commit
440258b18e
2 changed files with 22 additions and 25 deletions
  1. 11 13
      main_new_version.php
  2. 11 12
      service/login.class.php

+ 11 - 13
main_new_version.php

@@ -442,19 +442,17 @@ switch ($action) {
                     to_char(last_status_315_date, 'MM/DD/YYYY'::text) as last_status_315_date,last_status_315_code, last_status_loc, last_status_city, order_from,
                     f_vessel,f_voyage,dd.*
                     FROM public.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,act_date,act_date,description
-                        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
+                    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,act_date,act_date,description
+                            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  and last_status_315_update_time is not null";
             if (_isDemo()) {
                 $sql .= " ORDER BY eta DESC limit " . $ps . " offset " . ($cp - 1) * $ps;

+ 11 - 12
service/login.class.php

@@ -1135,18 +1135,17 @@ class login {
     private function getTrackingInfo($reference_number){
         $sql = "SELECT o.* ,sh.*, cn.* ,aa.*,dd.* ,cc.status as new_status
                 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', ','))
-				        order by id desc limit 1) cc on true
+                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) cc on true
                 LEFT JOIN LATERAL ( SELECT company as cn_company,
                     address_1 as cn_address_1,
                     address_2 as cn_address_2,