其他分享
首页 > 其他分享> > EBS关于LPN的API【OM】

EBS关于LPN的API【OM】

作者:互联网

PROCEDURE create_lpn(x_return_status OUT NOCOPY VARCHAR2,
                       p_box_item_id   IN NUMBER,
                       p_box_number    IN VARCHAR2) IS
  
    -- Parameters for WSH_CONTAINER_PUB.create_containers
  
    p_container_item_name VARCHAR2(2000);
    p_container_item_seg  fnd_flex_ext.segmentarray;
  
    --  p_organization_code     VARCHAR2(2000) ;
    p_name_prefix VARCHAR2(2000);
    p_name_suffix VARCHAR2(2000);
    p_base_number NUMBER;
    p_num_digits  NUMBER;
    p_quantity    NUMBER;
    --P_CONTAINER_ITEM_ID        number;
    x_container_ids wsh_util_core.id_tab_type;
    --out parameters
  
    x_msg_details VARCHAR2(3000);
    x_msg_summary VARCHAR2(3000);
  
    l_msg_count     NUMBER;
    l_msg_data      VARCHAR2(4000);
    l_return_status VARCHAR2(240);
    l_lpn_dd_id     NUMBER;
  
    --Handle exceptions
    --fail_api                EXCEPTION;
  BEGIN
    -- Initialize return status
  
    p_quantity := 1;
  
    log('>>> Create LPN begin');
    /* log('LPN name: ' || p_box_number);*/
  
    wsh_container_pub.create_containers(p_api_version         => 1.0,
                                        p_init_msg_list       => fnd_api.g_true,
                                        p_commit              => fnd_api.g_false,
                                        x_return_status       => l_return_status,
                                        x_msg_count           => l_msg_count,
                                        x_msg_data            => l_msg_data,
                                        p_container_item_id   => p_box_item_id,
                                        p_container_item_name => p_container_item_name,
                                        p_container_item_seg  => p_container_item_seg,
                                        p_organization_id     => g_organization_id,
                                        p_organization_code   => 'SH',
                                        p_name_prefix         => p_name_prefix,
                                        p_name_suffix         => p_name_suffix,
                                        p_base_number         => p_base_number,
                                        p_num_digits          => p_num_digits,
                                        p_quantity            => p_quantity,
                                        p_container_name      => p_box_number,
                                        x_container_ids       => x_container_ids);
  
    IF (l_return_status <> wsh_util_core.g_ret_sts_success) THEN
      x_return_status := 'E';
    
      wsh_util_core.get_messages('Y',
                                 x_msg_summary,
                                 x_msg_details,
                                 l_msg_count);
      IF l_msg_count > 1 THEN
        l_msg_data := x_msg_summary || x_msg_details;
        dbms_output.put_line('Message Data : ' || l_msg_data);
      ELSE
        l_msg_data := x_msg_summary;
        dbms_output.put_line('Message Data : ' || l_msg_data);
      END IF;
    
     
      log('Failed to create LPN:' || p_box_number);
      --RETURN - 99;
    ELSE
      x_return_status := 'S';
    
      l_lpn_dd_id := x_container_ids(1);

    
      log('Create lpn success. LPN number:[' || p_box_number || '].Delivery detail id: ' || l_lpn_dd_id);
      log('>>> Create LPN end');
      --RETURN l_lpn_dd_id;
    
    END IF;
  
  END create_lpn;

给LPN分配交货

--给item分配交货也可以,都是使用delivery_Detail_id
PROCEDURE assign_lpn(x_return_status      OUT NOCOPY VARCHAR2,
                       p_delivery_detail_id IN NUMBER,
                       p_delivery_id        IN NUMBER) IS
  
    l_msg_count     NUMBER;
    l_msg_data      VARCHAR2(4000);
    l_msg_summary   VARCHAR2(4000);
    l_return_status VARCHAR2(240);
  
    g_dlvb_recs_tab    wsh_glbl_var_strct_grp.delivery_details_attr_tbl_type;
    g_dlvb_action_prms wsh_glbl_var_strct_grp.dd_action_parameters_rec_type;
    g_dlvb_defaults    wsh_glbl_var_strct_grp.dd_default_parameters_rec_type;
    g_dlvb_out_rec     wsh_glbl_var_strct_grp.dd_action_out_rec_type;
  
    l_true  CONSTANT VARCHAR2(1) := 'T';
    l_false CONSTANT VARCHAR2(1) := 'F';
    l_phase NUMBER := 2;
  
    l_container_name VARCHAR2(40);
    l_delivery_name  wsh_new_deliveries.name%TYPE;
  
  BEGIN
    x_return_status := 'S';
  
    BEGIN
    
      SELECT wdd.container_name
        INTO l_container_name
        FROM wsh_delivery_details wdd
       WHERE wdd.delivery_detail_id = p_delivery_detail_id;
    EXCEPTION
      WHEN OTHERS THEN
        l_container_name := NULL;
    END;
    BEGIN
      SELECT wnd.name
        INTO l_delivery_name
        FROM wsh_new_deliveries wnd
       WHERE wnd.delivery_id = p_delivery_id;
    EXCEPTION
      WHEN OTHERS THEN
        l_delivery_name := NULL;
    END;
  
    log('>>> Assign start');
    log('LPN Number: ' || l_container_name || '  Delivery: ' || l_delivery_name || 'Delivery ID: ' || p_delivery_id);
  
    -- delivetry_detail_id of lpn
    g_dlvb_recs_tab(1).delivery_detail_id := p_delivery_detail_id;
  
    g_dlvb_action_prms.action_code      := 'ASSIGN';
    g_dlvb_action_prms.caller           := 'WSH_FSTRX';
    g_dlvb_action_prms.phase            := l_phase;
    g_dlvb_action_prms.wv_override_flag := 'Y';
    g_dlvb_action_prms.delivery_id      := p_delivery_id;
  
    --call api
    wsh_delivery_details_grp.delivery_detail_action(p_api_version_number => 1.0,
                                                    p_init_msg_list      => l_true,
                                                    p_commit             => l_false,
                                                    x_return_status      => l_return_status,
                                                    x_msg_count          => l_msg_count,
                                                    x_msg_data           => l_msg_data,
                                                    p_rec_attr_tab       => g_dlvb_recs_tab,
                                                    p_action_prms        => g_dlvb_action_prms,
                                                    x_defaults           => g_dlvb_defaults,
                                                    x_action_out_rec     => g_dlvb_out_rec);
  
    IF l_return_status = 'S' THEN
      x_return_status := 'S';
      log('LPN assign to delivery successfully ');
      log('>>> Assign end');
    ELSE
      x_return_status := 'E';
      log('Failed to assign LPN to delivery');
    
      IF l_msg_count = 1 THEN
        l_msg_summary := l_msg_data;
        log(l_msg_data);
      ELSIF l_msg_count > 1 THEN
        LOOP
        
          l_msg_data := fnd_msg_pub.get(fnd_msg_pub.g_next,
                                        fnd_api.g_false);
          IF l_msg_data IS NULL THEN
            EXIT;
          END IF;
        
          log('Message' || '---' || l_msg_data);
          l_msg_summary := l_msg_summary || l_msg_data;
        END LOOP;
      END IF;

    
    END IF;
  
  EXCEPTION
    WHEN OTHERS THEN
      x_return_status := 'E';    
    
  END assign_lpn;

标签:OM,container,name,delivery,LPN,API,msg,return,id
来源: https://www.cnblogs.com/su1999/p/15953054.html