DBA Data[Home] [Help]

APPS.WSH_TRIPS_ACTIONS SQL Statements

The following lines contain the word 'select', 'insert', 'update' or 'delete':

Line: 94

       select distinct st.stop_id, st.stop_location_id
       from   wsh_trip_stops st,
              wsh_delivery_legs dg
       where  st.trip_id = c_trip_id
       and    dg.pick_up_stop_id = st.stop_id;
Line: 101

       select '1'
       from dual
       where exists (select dl.delivery_id
                     from   wsh_new_deliveries dl,
                            wsh_delivery_legs dg
                     where  dg.pick_up_stop_id = c_stop_id
                     and    dl.initial_pickup_location_id = c_stop_location_id
                     AND    nvl(dl.shipment_direction,'O') IN ('O','IO')   -- J-IB-NPARIKH
                     and    dl.delivery_id = dg.delivery_id );
Line: 112

       select distinct dl.organization_id
       from   wsh_trip_stops st, wsh_delivery_legs dg, wsh_new_deliveries dl
       where  st.trip_id = c_trip_id
       and    dg.delivery_id = dl.delivery_id
       and    st.stop_location_id = dl.initial_pickup_location_id
       and    st.stop_id = dg.pick_up_stop_id;
Line: 120

       select name
       from   wsh_report_sets
       where  report_set_id = c_report_set_id;
Line: 286

  select stop_id
  from   wsh_trip_stops
  where  trip_id = p_trip_id
  and    stop_id = NVL(c_stop_id, stop_id)
  and    status_code IN ('OP','AR')
  and    nvl(SHIPMENTS_TYPE_FLAG, 'O') IN  ('O', 'M')  -- J Inbound Logistics jckwok
  order by stop_sequence_number asc ;
Line: 295

  select t.stop_id
  from   wsh_trip_stops t,
         wsh_delivery_legs dg
  where  t.trip_id = p_trip_id
  and    dg.pick_up_stop_id = t.stop_id
  and    t.status_code IN ('OP','AR')
  and    nvl(SHIPMENTS_TYPE_FLAG, 'O') IN  ('O', 'M');  -- J Inbound Logistics jckwok
Line: 312

SELECT 1
FROM   wsh_new_deliveries dl,
       wsh_delivery_legs dg,
       wsh_trip_stops st,
       wsh_trips t
WHERE  dl.delivery_id = dg.delivery_id AND
       (dg.pick_up_stop_id = st.stop_id OR dg.drop_off_stop_id = st.stop_id) AND
       st.trip_id = t.trip_id AND
       dl.STATUS_CODE <> 'CO' and
       st.stop_id = p_stop_id;
Line: 339

  SELECT status_code
  FROM   wsh_trips
  WHERE  trip_id = p_trip_id ;
Line: 412

      l_exceptions_tab.delete;
Line: 712

select status_code,
       NVL(shipments_type_flag,'O')   -- J-IB-NPARIKH
from wsh_trips
where trip_id = c_trip_id;
Line: 718

select 'Y'
from wsh_trip_stops
where trip_id = c_trip_id
and status_code <> 'OP'
and rownum = 1;
Line: 725

select 'Y'
from wsh_trips
where trip_id=p_tripid AND
planned_flag='F';
Line: 972

   l_exceptions_tab.delete;
Line: 1063

       p_action => 'UPDATE',
       x_return_status => l_return_status);
Line: 1087

  UPDATE wsh_trips
   SET status_code = p_status_code,
       last_update_date  = SYSDATE,
       last_updated_by   = fnd_global.user_id,
       last_update_login = fnd_global.login_id
   WHERE trip_id = p_trip_id;
Line: 1197

    SELECT delivery_id
    FROM wsh_delivery_legs wdl, wsh_trip_stops wts
    WHERE wdl.pick_up_stop_id=wts.stop_id AND
        wts.trip_id=p_in_rec.trip_id;
Line: 1305

           p_action => 'UPDATE',
           x_return_status => l_return_status);
Line: 1321

      UPDATE wsh_trips
       SET status_code       = p_in_rec.new_status_code,
           last_update_date  = SYSDATE,
           last_updated_by   = fnd_global.user_id,
           last_update_login = fnd_global.login_id
       WHERE trip_id         = p_in_rec.trip_id;
Line: 1376

             l_del_tmp_rows.delete;
Line: 1393

            l_trip_id_tab.delete;
Line: 1541

      SELECT  wdl.delivery_id, wt.name
      FROM    wsh_trip_stops wts,
              wsh_Delivery_legs wdl,
              wsh_new_deliveries wnd,
              wsh_trips wt
      WHERE   wt.trip_id                      = p_trip_id
      AND     wts.trip_id                     = p_trip_id
      AND     wdl.pick_up_stop_id             = wts.stop_id
      AND     wnd.delivery_id                 = wdl.delivery_id
      AND     nvl(wnd.shipment_direction,'O') NOT IN ('O','IO')   -- J-IB-NPARIKH
      AND     wnd.initial_pickup_location_id  = wts.stop_location_id;
Line: 2011

   SELECT id,
          column1,
          column2,
          column3,
          column4,
          column5
   FROM WSH_TMP
   WHERE flag = '~'
   order by column1, column2, column3, column4, column5;
Line: 2044

   DELETE FROM wsh_tmp where flag = '~';
Line: 2048

    INSERT INTO wsh_tmp (id,
                         flag,
                         column1,
                         column2,
                         column3,
                         column4,
                         column5 )
                   VALUES(p_del_tbl.delivery_id(i),
                         '~',
                         p_del_tbl.MODE_OF_TRANSPORT(i),
                         p_del_tbl.service_level(i),
                         p_del_tbl.carrier_id(i),
                         p_del_tbl.INITIAL_PICKUP_LOCATION_ID(i),
                         p_del_tbl.ULTIMATE_DROPOFF_LOCATION_ID(i)
                   );
Line: 2135

      SELECT delivery_id,
             INITIAL_PICKUP_LOCATION_ID,
             ULTIMATE_DROPOFF_LOCATION_ID,
             MODE_OF_TRANSPORT,
             service_level,
             carrier_id
      FROM wsh_new_deliveries
      WHERE delivery_id = v_delivery_id;
Line: 2241

        l_del_rows.DELETE;
Line: 2295

SELECT NVL(ignore_for_planning,p_ignore_flag) ignore_for_planning
FROM wsh_new_deliveries
WHERE delivery_id=p_delid;
Line: 2435

         l_trip_ids.DELETE;
Line: 2436

         l_trip_names.DELETE;
Line: 2500

SELECT delivery_id
FROM   wsh_delivery_legs
WHERE  delivery_id = p_del_id;
Line: 2512

SELECT ship_method_code, carrier_id, mode_of_transport, service_level,
       status_code,
       --OTM R12, glog proj
       NVL(ignore_for_planning,p_ignore_flag),
       initial_pickup_date, ultimate_dropoff_date , nvl(shipment_direction,'O')
FROM   wsh_new_deliveries
WHERE  delivery_id = p_del_id;
Line: 2523

SELECT stop_id,
     planned_departure_date,
     planned_arrival_date,
     NVL(shipments_type_flag,'O') shipments_type_flag  --J-IB-NPARIKH
FROM   wsh_trip_stops
WHERE  trip_id = p_trip_id
ORDER BY stop_sequence_number;   -- J-IB-NPARIKH
Line: 2770

    l_trip_info.last_update_date  := SYSDATE;
Line: 2771

    l_trip_info.last_updated_by   := fnd_global.user_id;
Line: 2772

    l_trip_info.last_update_login := fnd_global.login_id;
Line: 2873

             p_action => 'UPDATE',
             x_return_status => l_return_status);
Line: 2896

         UPDATE wsh_trip_stops
         SET   planned_departure_date = nvl(planned_arrival_date, SYSDATE)
         WHERE  stop_id = st.stop_id;
Line: 2939

            p_action => 'UPDATE',
            x_return_status => l_return_status);
Line: 2961

        UPDATE wsh_trip_stops
        SET   planned_arrival_date = nvl(planned_departure_date, SYSDATE)
        WHERE  stop_id = st.stop_id;
Line: 2973

        WSH_INTEGRATION.DBI_Update_Trip_Stop_Log
          (p_stop_id_tab    => l_stop_tab,
           p_dml_type       => 'UPDATE',
           x_return_status      => l_dbi_rs);
Line: 3159

    SELECT SHIP_METHOD_CODE, INTMED_SHIP_TO_LOCATION_ID
    FROM wsh_new_deliveries
    WHERE delivery_id = p_dlvy_id;
Line: 3165

    SELECT SHIP_METHOD_CODE
    FROM wsh_trips
    WHERE trip_id = p_trip_id;
Line: 3346

                            update wsh_new_deliveries set INTMED_SHIP_TO_LOCATION_ID=null
                            where delivery_id=l_id_tab_temp(i);
Line: 3351

                            update wsh_new_deliveries
                            set SHIP_METHOD_CODE=null,
                                CARRIER_ID = null,
                                MODE_OF_TRANSPORT = null,
                                SERVICE_LEVEL = null
                            where delivery_id=l_id_tab_temp(i);
Line: 3444

                               update wsh_new_deliveries set INTMED_SHIP_TO_LOCATION_ID=null
                               where delivery_id=x_del_rows(i);
Line: 3449

                               update wsh_new_deliveries
                               set SHIP_METHOD_CODE=null,
                                CARRIER_ID = null,
                                MODE_OF_TRANSPORT = null,
                                SERVICE_LEVEL = null
                               where delivery_id=x_del_rows(i);
Line: 3502

    l_cc_failed_records.DELETE;
Line: 3503

    l_cc_line_groups.DELETE;
Line: 3504

    l_cc_group_ids.DELETE;
Line: 3505

    l_id_tab_temp.DELETE;
Line: 3651

                            update wsh_trips
                            set SHIP_METHOD_CODE=null,
                                CARRIER_ID = null,
                                MODE_OF_TRANSPORT = null,
                                SERVICE_LEVEL = null
                            where trip_id=l_trip_ids(l_tripindex);
Line: 3728

                            update wsh_trips
                            set SHIP_METHOD_CODE=null,
                                CARRIER_ID = null,
                                MODE_OF_TRANSPORT = null,
                                SERVICE_LEVEL = null
                            where trip_id=l_trip_id_tab(l_tripindex);
Line: 3970

SELECT dg.delivery_leg_id,
     st.stop_id
FROM   wsh_trip_stops st,
      wsh_delivery_legs dg
WHERE  dg.delivery_id = l_delivery_id AND
      dg.pick_up_stop_id = st.stop_id AND
      st.stop_location_id = p_pickup_location_id;
Line: 3979

SELECT dg.delivery_leg_id,
     st.stop_id
FROM   wsh_trip_stops st,
      wsh_delivery_legs dg
WHERE  dg.delivery_id = l_delivery_id AND
      dg.drop_off_stop_id = st.stop_id AND
      st.stop_location_id = p_dropoff_location_id;
Line: 4081

          WSH_DEBUG_SV.logmsg(l_module_name,'Calling program unit WSH_DELIVERY_LEGS_PVT.DELETE_DELIVERY_LEG',WSH_DEBUG_SV.C_PROC_LEVEL);
Line: 4084

      wsh_delivery_legs_pvt.delete_delivery_leg(NULL, l_delivery_leg_id, x_return_status);
Line: 4114

          WSH_DEBUG_SV.logmsg(l_module_name,'Calling program unit WSH_DELIVERY_LEGS_PVT.DELETE_DELIVERY_LEG',WSH_DEBUG_SV.C_PROC_LEVEL);
Line: 4117

      wsh_delivery_legs_pvt.delete_delivery_leg(NULL, l_delivery_leg_id, x_return_status);
Line: 4246

SELECT  stop_location_id
FROM   wsh_trip_stops
WHERE stop_id = l_trip_stop_id;
Line: 4251

SELECT '1'
FROM wsh_delivery_legs wdl
WHERE (wdl.pick_up_stop_id=p_stop_id OR wdl.drop_off_stop_id=p_stop_id)
AND rownum=1;
Line: 4257

SELECT stop_id, stop_location_id, status_code
FROM wsh_trip_stops
WHERE trip_id=p_trip_id
ORDER BY stop_sequence_number;
Line: 4263

SELECT  initial_pickup_location_id,
ultimate_dropoff_location_id
FROM    wsh_new_deliveries
WHERE delivery_id = del_id;
Line: 4269

SELECT  'Y'
FROM    wsh_new_deliveries
WHERE delivery_id = del_id
AND ultimate_dropoff_location_id=loc_id;
Line: 4287

b_physical_loc_updated      BOOLEAN:=FALSE;
Line: 4305

b_checkstopupdate           BOOLEAN:=TRUE;
Line: 4314

         SELECT ts2.stop_sequence_number
         FROM   wsh_trip_stops ts1, -- get this stop's SSN
                wsh_trip_stops ts2  -- then look for SSN and next SSN
         WHERE  ts1.stop_id = p_stop_id
         AND    ts2.trip_id = p_trip_id
         AND    ts2.stop_sequence_number >= ts1.stop_sequence_number
         AND    rownum <= 2
         ORDER BY ts2.stop_sequence_number;
Line: 4479

                        UPDATE wsh_trip_stops
                        SET stop_location_id= l_phys_trip_pickup_loc_id,
                            physical_location_id=null,
                            last_update_date      = sysdate,
                            last_updated_by       = FND_GLOBAL.USER_ID
                        WHERE stop_id=p_pickup_stop_id;
Line: 4634

                                      b_checkstopupdate:=FALSE;
Line: 4643

                            IF NOT(b_checkstopupdate) THEN
                               IF l_debug_on THEN
                                  WSH_DEBUG_SV.log(l_module_name,'Have to create new internal stop as del with physical dropoff has been passed',l_dropoff_location_id);
Line: 4662

                               UPDATE wsh_trip_stops
                               SET stop_location_id= l_dropoff_location_id,
                                   physical_location_id=l_trip_dropoff_loc_id,
                                   last_update_date      = sysdate,
                                   last_updated_by       = FND_GLOBAL.USER_ID
                               WHERE stop_id=p_dropoff_stop_id;
Line: 4770

SELECT st.stop_id
FROM   wsh_trip_stops st,
     wsh_delivery_legs dg
WHERE  st.stop_location_id = l_loc_id AND
     dg.pick_up_stop_id = st.stop_id AND
     dg.delivery_id = l_del_id;
Line: 4778

SELECT st.stop_id
FROM   wsh_trip_stops st,
     wsh_delivery_legs dg
WHERE  st.stop_location_id = l_loc_id AND
     dg.drop_off_stop_id = st.stop_id AND
     dg.delivery_id = l_del_id;
Line: 5199

SELECT trip_id,
       weight_uom_code,
       volume_uom_code
FROM   wsh_trip_stops
WHERE  stop_id = c_stop_id;
Line: 5206

SELECT vehicle_item_id,
       vehicle_organization_id
FROM   wsh_trips
WHERE  trip_id = c_trip_id;
Line: 5212

SELECT msi.maximum_load_weight,
       msi.internal_volume,
       msi.minimum_fill_percent,
       msi.weight_uom_code,
       msi.volume_uom_code,
       msi.organization_id
FROM   mtl_system_items msi,
       wsh_trips t
WHERE  msi.organization_id = t.vehicle_organization_id AND
       t.vehicle_item_id = msi.inventory_item_id AND
       t.trip_id = c_trip_id;
Line: 5225

SELECT wsp.percent_fill_basis_flag
FROM   wsh_shipping_parameters wsp,
       wsh_trips t
WHERE  wsp.organization_id  = t.vehicle_organization_id AND
       t.trip_id = c_trip_id;
Line: 5398

SELECT stop_id,
     weight_uom_code,
     volume_uom_code,
     status_code,
     departure_gross_weight,
     departure_net_weight,
     departure_volume,
     nvl(shipments_type_flag,'O'),
     nvl(wv_frozen_flag,'Y')
FROM   wsh_trip_stops
WHERE  trip_id = l_trip_id AND
      nvl(planned_departure_date, nvl(p_start_departure_date, FND_API.G_MISS_DATE))  >= nvl(p_start_departure_date, FND_API.G_MISS_DATE)
ORDER BY stop_sequence_number;
Line: 5414

SELECT stop_id
FROM   wsh_trip_stops
WHERE  stop_id = c_stop_id
FOR UPDATE NOWAIT;
Line: 5421

SELECT stop_id,
     departure_gross_weight,
     departure_net_weight,
     departure_volume,
     weight_uom_code,
     volume_uom_code
FROM   wsh_trip_stops
WHERE  trip_id = l_trip_id AND
      nvl(planned_departure_date, nvl(p_start_departure_date, FND_API.G_MISS_DATE))  <= nvl(p_start_departure_date, FND_API.G_MISS_DATE) AND
     rownum = 1
ORDER BY stop_sequence_number DESC;
Line: 5434

SELECT stop_id
FROM   wsh_trip_stops
WHERE  trip_id = l_trip_id
AND    stop_sequence_number = ( SELECT MAX(wts.stop_sequence_number)
                                FROM   wsh_trip_stops wts
                                WHERE  wts.trip_id = l_trip_id );
Line: 5442

SELECT dl.delivery_id d_id,
     dl.weight_uom_code wt_uom,
     dl.volume_uom_code vol_uom,
     dl.gross_weight,
     dl.net_weight,
     dl.volume,
        dl.organization_id
FROM   wsh_trip_stops t,
     wsh_delivery_legs dg,
     wsh_new_deliveries dl
WHERE  t.stop_id = l_stop_id AND
     dg.pick_up_stop_id = t.stop_id AND
     dl.delivery_id = dg.delivery_id AND
     dg.parent_delivery_leg_id is NULL;
Line: 5458

SELECT dl.delivery_id d_id,
       dl.organization_id
FROM   wsh_trip_stops t,
     wsh_delivery_legs dg,
     wsh_new_deliveries dl
WHERE  t.stop_id = l_stop_id AND
     dg.drop_off_stop_id = t.stop_id AND
     dl.delivery_id = dg.delivery_id AND
     dg.parent_delivery_leg_id is NULL;
Line: 5469

SELECT msi.maximum_load_weight,
     msi.internal_volume,
     msi.minimum_fill_percent,
     msi.weight_uom_code,
     msi.volume_uom_code,
     msi.organization_id
FROM   mtl_system_items msi,
     wsh_trips t
WHERE  msi.organization_id = t.vehicle_organization_id AND
     t.vehicle_item_id = msi.inventory_item_id AND
     t.trip_id = l_trip_id;
Line: 5482

SELECT wsp.percent_fill_basis_flag
FROM   wsh_shipping_parameters wsp,
     wsh_trips t
WHERE  wsp.organization_id  = t.vehicle_organization_id AND
     t.trip_id = l_trip_id;
Line: 5489

SELECT vehicle_item_id,
     vehicle_organization_id
FROM   wsh_trips
WHERE  trip_id = l_trip_id;
Line: 5592

so use l_trip_num_warn to update for warnings and then if l_trip_num_warn is >1 at loop end,
increase l_num_warn by 1. In some cases, l_num_warn is directly updated and since it is directly
redirected to end of loop, those are okay.
     */
     l_trip_num_warn:=0;
Line: 5600

     pickup_del_tab.delete;
Line: 5849

                    p_update_flag       => 'Y',
                    p_calc_wv_if_frozen => p_calc_wv_if_frozen,
                    x_gross_weight      => l_gross_weight,
                    x_net_weight        => l_net_weight,
                    x_volume            => l_volume,
                    x_return_status     => l_return_status);
Line: 6155

                    UPDATE wsh_trip_stops
                    SET   pick_up_weight = l_total_pick_up_weight,
                          drop_off_weight = l_total_drop_off_weight,
                          pick_up_volume = l_total_pick_up_volume,
                          drop_off_volume = l_total_drop_off_volume
                    WHERE  stop_id = l_stop_id;
Line: 6172

                 UPDATE wsh_trip_stops
                    SET   departure_gross_weight = l_total_gross_weight,
                          departure_net_weight =  l_total_net_weight,
                          departure_volume = l_total_volume,
                          departure_fill_percent = l_stop_fill_percent,
                          wv_frozen_flag = 'N'
                    WHERE  stop_id = l_stop_id;
Line: 6325

SELECT stop_id,
     stop_sequence_number,
     planned_arrival_date,
     planned_departure_date
FROM   wsh_trip_stops
WHERE  trip_id = p_trip_id
ORDER BY stop_sequence_number;
Line: 6487

   stmt_str := 'select st.trip_id, count(*) '||
            'from   wsh_trip_stops st, wsh_delivery_legs dg, wsh_trips tr '||
            'where  dg.pick_up_stop_id = st.stop_id AND '||
                           'tr.trip_id = st.trip_id AND tr.planned_flag IN (''N'',''Y'') AND ' ||
         'dg.delivery_id IN (' || del_str || ') ' ||
            'group by st.trip_id '||
            'having count(*) = '||to_char(p_del_rows.count);
Line: 6540

SELECT name, planned_flag
FROM   wsh_trips
WHERE  trip_id = p_trip_id;
Line: 6546

select l.delivery_id from wsh_delivery_legs l, wsh_trip_stops s
where l.delivery_id = p_delivery_id
and l.parent_delivery_leg_id is not null
and l.pick_up_stop_id = s.stop_id
and s.trip_id = p_trip_id;
Line: 6618

          l_mdc_del_tab.delete(j);
Line: 6667

   l_trip_tab.delete;
Line: 6855

    p_action   => 'UPDATE',
    x_return_status => l_return_status);
Line: 6906

  SELECT stop_id
  FROM   wsh_trip_stops
  WHERE  stop_id = c_stop_id
  FOR UPDATE NOWAIT;
Line: 6912

  SELECT wst.stop_sequence_number,
         wst.stop_id,
         wst.status_code,
         wst.planned_arrival_date,
         wst.planned_departure_date,
         wst.actual_arrival_date,
         wst.actual_departure_date
  FROM wsh_trip_stops wst,
       wsh_trips wtp
  WHERE wtp.status_code in ('OP', 'IT')
  AND   wtp.trip_id = c_trip_id
  AND   wtp.trip_id = wst.trip_id
  ORDER  BY wst.stop_sequence_number,wst.stop_id;
Line: 6933

l_update_flag     BOOLEAN;
Line: 6984

        l_update_flag := FALSE;
Line: 7001

              l_update_flag := TRUE;
Line: 7021

              l_update_flag := TRUE;
Line: 7024

           IF l_update_flag THEN
              IF l_stop_rec.planned_departure_date < l_stop_rec.planned_arrival_date THEN
                 l_stop_rec.planned_departure_date := l_stop_rec.planned_arrival_date;
Line: 7033

                 UPDATE wsh_trip_stops
                 SET planned_arrival_date = l_stop_rec.planned_arrival_date,
                     planned_departure_date = l_stop_rec.planned_departure_date,
                     last_update_date  = SYSDATE,
                     last_updated_by   = FND_GLOBAL.user_id,
                     last_update_login = FND_GLOBAL.login_id
                 WHERE  stop_id = l_stop_rec.stop_id;
Line: 7049

                 WSH_INTEGRATION.DBI_Update_Trip_Stop_Log
                    (p_stop_id_tab    => l_stop_tab,
                     p_dml_type       => 'UPDATE',
                     x_return_status  => l_dbi_rs);
Line: 7077

                      WSH_DEBUG_SV.logmsg(l_module_name,'ERROR: stop is locked, cannot update it');
Line: 7338

SELECT wts.stop_id,
       wts.stop_location_id,
       wts.physical_location_id,
       wts.physical_stop_id,
       wts.stop_sequence_number,

       -- conditions to keep the link to synchronize the columns:
       --    a. physical stop exists
       --    b. (physical location matches or dummy stop's status is Arrived)
       --
       -- The same DECODE structure must be maintained for these columns
       -- in this cursor:
       --             PLANNED_ARRIVAL_DATE,
       --             PLANNED_DEPARTURE_DATE,
       --             BREAK_LINK_FLAG,
       --         and ORDER BY first clause
       DECODE(
              DECODE(wts.physical_stop_id,
                     NULL, 0,
                     NVL(pts.stop_id,-1),
                           DECODE(wts.physical_location_id,
                                  pts.stop_location_id, 1,
                                  DECODE(wts.status_code,'AR',1, 0)
                                 ),
                     0 -- linked to a non-existent physical stop
                    ),
              1, (pts.planned_arrival_date - C_TEN_SECONDS),
              wts.planned_arrival_date)    PLANNED_ARRIVAL_DATE,

       DECODE(
              DECODE(wts.physical_stop_id,
                     NULL, 0,
                     NVL(pts.stop_id,-1),
                           DECODE(wts.physical_location_id,
                                  pts.stop_location_id, 1,
                                  DECODE(wts.status_code,'AR',1, 0)
                                ),
                     0 -- linked to a non-existent physical stop
                    ),
               1, (pts.planned_arrival_date - C_TEN_SECONDS),
              wts.planned_departure_date)    PLANNED_DEPARTURE_DATE,

       wts.stop_sequence_number  org_stop_seq_num,
       wts.planned_arrival_date org_pl_arr_date,
       wts.planned_departure_date org_pl_dep_date,
       wts.status_code,

       -- break_link_flag: 'Y' or 'N'
       -- The DECODE structure is slightly modified
       -- to decide whether link needs breaking.
       -- If stop is not linked (NULL), there is no link to break.
       -- If physical stop_id matches, check for need to break link.
       DECODE(
              DECODE(wts.physical_stop_id,
                     NULL, 1,  -- modified value because there is no link to break
                     NVL(pts.stop_id,-1),
                           DECODE(wts.physical_location_id,
                                  pts.stop_location_id, 1,
                                  DECODE(wts.status_code,'AR',1, 0)
                                 ),
                     0 -- linked to a non-existent physical stop
                    ),
              1, 'N',
              'Y')   BREAK_LINK_FLAG
FROM wsh_trip_stops wts,
     wsh_trip_stops pts
WHERE wts.trip_id = c_trip_id
      and wts.physical_stop_id = pts.stop_id(+)
ORDER BY
      -- we need to order by PAD;
Line: 7441

SELECT wts.stop_id,
       wts.stop_location_id,
       wts.physical_location_id,
       wts.physical_stop_id,

       -- conditions to keep the link to synchronize the columns:
       --    a. physical stop exists/matches
       --    b. (physical location matches or dummy stop's status is Arrived)
       --
       -- The same DECODE structure must be maintained for these columns
       -- in this cursor:
       --             STOP_SEQUENCE_NUMBER
       --             PLANNED_ARRIVAL_DATE,
       --             PLANNED_DEPARTURE_DATE,
       --             BREAK_LINK_FLAG,
       --         and ORDER BY first clause
       DECODE(
              DECODE(wts.physical_stop_id,
                     NULL, 0,
                     NVL(pts.stop_id,-1),
                           DECODE(wts.physical_location_id,
                                  pts.stop_location_id, 1,
                                  DECODE(wts.status_code,'AR',1, 0)
                                 ),
                     0 -- linked to a non-existent physical stop
                    ),
              1, (pts.stop_sequence_number - 1),
              wts.stop_sequence_number)    STOP_SEQUENCE_NUMBER,

       DECODE(
              DECODE(wts.physical_stop_id,
                     NULL, 0,
                     NVL(pts.stop_id,-1),
                           DECODE(wts.physical_location_id,
                                  pts.stop_location_id, 1,
                                  DECODE(wts.status_code,'AR',1, 0)
                                 ),
                     0 -- linked to a non-existent physical stop
                    ),
              1, (pts.planned_arrival_date - C_TEN_SECONDS),
              wts.planned_arrival_date)    PLANNED_ARRIVAL_DATE,

       DECODE(
              DECODE(wts.physical_stop_id,
                     NULL, 0,
                     NVL(pts.stop_id,-1),
                           DECODE(wts.physical_location_id,
                                  pts.stop_location_id, 1,
                                  DECODE(wts.status_code,'AR',1, 0)
                                 ),
                     0 -- linked to a non-existent physical stop
                    ),
               1, (pts.planned_arrival_date - C_TEN_SECONDS),
              wts.planned_departure_date)    PLANNED_DEPARTURE_DATE,

       wts.stop_sequence_number  org_stop_seq_num,
       wts.planned_arrival_date org_pl_arr_date,
       wts.planned_departure_date org_pl_dep_date,
       wts.status_code,

       -- break_link_flag: 'Y' or 'N'
       -- The DECODE structure is modified
       -- to decide whether link needs breaking.
       -- If stop is not linked (NULL), there is no link to break.
       -- If physical stop_id matches, check for delinking.
       -- Otherwise, the physical stop must have been deleted.
       DECODE(
              DECODE(wts.physical_stop_id,
                     NULL, 1,  -- no link to break
                     NVL(pts.stop_id,-1),
                           DECODE(wts.physical_location_id,
                                  pts.stop_location_id, 1,
                                  DECODE(wts.status_code,'AR',1, 0)
                                 ),
                     0 -- linked to a non-existent physical stop
                    ),
              1, 'N',
              'Y')   BREAK_LINK_FLAG
FROM wsh_trip_stops wts,
     wsh_trip_stops pts
WHERE wts.trip_id = c_trip_id
      and wts.physical_stop_id = pts.stop_id(+)
ORDER BY
      -- we need to order by SSN;
Line: 7545

 select delivery_leg_id
 from
    wsh_delivery_legs wlg
 where
    pick_up_stop_id = c_physical_stop_id
    AND drop_off_stop_id = c_dummy_stop_id
    AND rownum = 1;
Line: 7575

l_update_flag            BOOLEAN;
Line: 7598

  x_success_trip_ids.delete;
Line: 7626

        l_update_flag := FALSE;
Line: 7705

                      l_update_flag := TRUE;
Line: 7725

                     l_update_flag := TRUE;
Line: 7772

                         l_update_flag := TRUE;
Line: 7832

                        l_update_flag := TRUE;
Line: 7842

                     l_update_flag := TRUE;
Line: 7862

                        l_update_flag := TRUE;
Line: 7889

        IF l_update_flag or p_caller = 'WSH_CREATE_TRIP_STOP' THEN
           IF l_debug_on THEN
          WSH_DEBUG_SV.log(l_module_name,'updating stops ' , l_getstops_stop_id.count);
Line: 7894

              UPDATE WSH_TRIP_STOPS
              SET
                PHYSICAL_LOCATION_ID    = l_getstops_phys_loc_id(j),
                PHYSICAL_STOP_ID        = l_getstops_phys_stop_id(j),
                PLANNED_ARRIVAL_DATE    = l_getstops_pl_arr_date(j),
                PLANNED_DEPARTURE_DATE  = l_getstops_pl_dep_date(j),
                STOP_SEQUENCE_NUMBER    = l_getstops_stop_seq_num(j),
                last_update_date        = SYSDATE,
                last_updated_by         = FND_GLOBAL.USER_ID,
                last_update_login       = FND_GLOBAL.LOGIN_ID
              WHERE  STOP_ID = l_getstops_stop_id(j);
Line: 7906

          WSH_DEBUG_SV.log(l_module_name,'done update' , l_getstops_stop_id.count);
Line: 7916

	    WSH_INTEGRATION.DBI_Update_Trip_Stop_Log
          (p_stop_id_tab	=> l_getstops_stop_id,
           p_dml_type		=> 'UPDATE',
           x_return_status      => l_dbi_rs);
Line: 8083

PROCEDURE PROCESS_CARRIER_SELECTION (
        p_init_msg_list            IN            VARCHAR2 DEFAULT fnd_api.g_false,
        p_trip_id_tab              IN            wsh_util_core.id_tab_type,
        p_caller                   IN  VARCHAR2 DEFAULT NULL, -- WSH_FSTRX / WSH_PUB /  WSH_GROUP/ FTE
        x_msg_count                OUT NOCOPY    NUMBER,
        x_msg_data                 OUT NOCOPY    VARCHAR2,
        x_return_status            OUT NOCOPY  VARCHAR2)

IS

-- Cursor to get trip level information
   CURSOR c_get_trip_details(c_tripid IN NUMBER) is
   SELECT trip_id
      , name
      , planned_flag
      , status_code
      , carrier_id
      , mode_of_transport
      , service_level
      , ship_method_code
--      , track_only_flag,
      , consignee_carrier_ac_no
      , freight_terms_code
      , Load_tender_status
      , lane_id
      , rank_id
    FROM WSH_TRIPS
    WHERE trip_id = c_tripid;
Line: 8114

    SELECT wts.STOP_ID
      , wts.TRIP_ID
      --To handle dummy locations #DUM_LOC(S)
      , wts.STOP_LOCATION_ID
      , wts.STATUS_CODE
      , wts.STOP_SEQUENCE_NUMBER
      , wts.PLANNED_ARRIVAL_DATE
      , wts.PLANNED_DEPARTURE_DATE
      , wts.ACTUAL_ARRIVAL_DATE
      , wts.ACTUAL_DEPARTURE_DATE
      --#DUM_LOC(S)
      , wts.PHYSICAL_LOCATION_ID
      --#DUM_LOC(E)
      , wts.PHYSICAL_STOP_ID
      , wts.pick_up_weight
      , wts.weight_uom_code
      , wts.pick_up_volume
      , wts.volume_uom_code
    FROM wsh_trip_stops wts
    WHERE wts.trip_id = c_tripid
    order by wts.STOP_SEQUENCE_NUMBER;
Line: 8137

    SELECT wnd.DELIVERY_ID
      , wnd.CUSTOMER_ID
      , wnd.ORGANIZATION_ID
    FROM wsh_new_deliveries wnd,
         wsh_delivery_legs wdl,
         wsh_trip_stops wts1
    WHERE wnd.delivery_id = wdl.delivery_id
    AND   wdl.pick_up_stop_id = wts1.stop_id
    AND   wnd.initial_pickup_location_id = wts1.stop_location_id
    AND   nvl(wnd.shipping_control,'BUYER') <> 'SUPPLIER'
    AND   wts1.stop_id = c_stop_id;
Line: 8150

    SELECT wnd.DELIVERY_ID
      , wnd.CUSTOMER_ID
      , wnd.ORGANIZATION_ID
    FROM wsh_new_deliveries wnd,
         wsh_delivery_legs wdl,
         wsh_trip_stops wts1
    WHERE wnd.delivery_id = wdl.delivery_id
    AND   wdl.drop_off_stop_id = wts1.stop_id
    AND   wnd.ultimate_dropoff_location_id = wts1.stop_location_id
    AND   nvl(wnd.shipping_control,'BUYER') <> 'SUPPLIER'
    AND   wts1.stop_id = c_stop_id;
Line: 8164

    SELECT MOVE_ID
    FROM   FTE_TRIP_MOVES
    WHERE  TRIP_ID = c_trip_id;
Line: 8170

SELECT SITE.SITE_USE_ID
FROM HZ_CUST_ACCT_SITES_ALL     ACCT_SITE,
 HZ_PARTY_SITES             PARTY_SITE,
 HZ_LOCATIONS               LOC,
 HZ_CUST_SITE_USES_ALL      SITE
WHERE
 SITE.SITE_USE_CODE = 'SHIP_TO'
 AND SITE.CUST_ACCT_SITE_ID = ACCT_SITE.CUST_ACCT_SITE_ID
 AND ACCT_SITE.PARTY_SITE_ID    = PARTY_SITE.PARTY_SITE_ID
 AND PARTY_SITE.LOCATION_ID     = LOC.LOCATION_ID
 AND LOC.LOCATION_ID = c_location_id;
Line: 8249

l_module_name CONSTANT VARCHAR2(100) := 'wsh.plsql.' || G_PKG_NAME || '.' || 'PROCESS_CARRIER_SELECTION';
Line: 8272

      SAVEPOINT before_trip_update;
Line: 8279

         l_cs_tripstops_tab.DELETE;
Line: 8435

               l_stop_delivery_id_tab.DELETE;
Line: 8436

               l_stop_customer_id_tab.DELETE;
Line: 8437

               l_stop_organization_id_tab.DELETE;
Line: 8575

      WSH_FTE_INTEGRATION.CARRIER_SELECTION(
                                          p_format_cs_tab           => l_cs_input_tab,
                                          p_messaging_yn            => 'Y',
                                          p_caller                  => p_caller,
                                          p_entity                  => 'TRIP',
                                          x_cs_output_tab           => l_cs_result_tab,
                                          x_cs_output_message_tab   => l_cs_output_message_tab,
                                          x_return_message          => l_return_message,
                                          x_return_status           => l_return_status);
Line: 8646

                        l_trip_info_tab.DELETE;
Line: 8651

                        l_trip_in_rec.action_code := 'UPDATE';
Line: 8677

                        WSH_TRIPS_GRP.Create_Update_Trip(
                          p_api_version_number => 1.0,
                          p_init_msg_list      => l_init_msg_list,
                          p_commit             => l_commit,
                          x_return_status      => l_return_status,
                          x_msg_count          => l_msg_count,
                          x_msg_data           => l_msg_data,
                          p_trip_info_tab      => l_trip_info_tab,
                          p_in_rec             => l_trip_in_rec,
                          x_out_tab            => l_trip_out_rec_tab);
Line: 8751

                        l_ranked_list.DELETE;
Line: 8774

                     WSH_DEBUG_SV.logmsg(l_module_name,  'NO RANKED RESULT FOUND FROM PROCESS CARRIER SELECTION '  );
Line: 8783

                  FND_MESSAGE.SET_NAME('WSH','WSH_FTE_CS_NO_CARRIER_SELECTED');
Line: 8790

                     WSH_DEBUG_SV.logmsg(l_module_name,  'NO CARRIER FOUND FROM PROCESS CARRIER SELECTION '  );
Line: 8806

                     WSH_DEBUG_SV.logmsg(l_module_name,  'NO VALID TRIP FOUND FOR PROCESS CARRIER SELECTION '  );
Line: 8829

      ROLLBACK TO before_trip_update;
Line: 8840

    ROLLBACK TO before_trip_update;
Line: 8862

    wsh_util_core.default_handler('WSH_TRIPS_ACTIONS.PROCESS_CARRIER_SELECTION');
Line: 8870

END PROCESS_CARRIER_SELECTION;
Line: 8895

select d.delivery_id, d.delivery_type
from wsh_new_deliveries d, wsh_trip_stops s, wsh_delivery_legs l
where d.delivery_id = l.delivery_id
and   l.pick_up_stop_id = s.stop_id
and   s.trip_id = p_trip_id
order by d.delivery_type;
Line: 8943

     l_delivery_tab.delete;
Line: 8944

     l_consol_delivery_tab.delete;