代码demo-内部订单批量投料

news2024/12/23 22:37:03

为了简化用户操作,开发内部订单批量投料功能
在这里插入图片描述
用户可以批量上传,或者选择对应的物料,输入库位和内部订单号后进行过账操作
在这里插入图片描述
对用户选择的内部订单做校验,内部订单是否正确
在这里插入图片描述内部订单的公司是否和工厂对应的公司一致等等
在这里插入图片描述

下面展示ZPPA0011代码

REPORT ZPPA0011 MESSAGE-ID zpp..

INCLUDE ZPPA0011_TOP.
INCLUDE ZPPA0011_FRM.

INITIALIZATION.
  DATA but_down(255) TYPE c.
  CALL FUNCTION 'ICON_CREATE' " 给按钮添加图标和文本
    EXPORTING
      name   = icon_xls   " 按钮的图片的名字
      text   = '下载模板'                   "按钮的文本
*     info   = '请下载模板来批导入数据'
    IMPORTING
      result = but_down
    EXCEPTIONS
      OTHERS = 0.
  sscrfields-functxt_01 = but_down.


AT SELECTION-SCREEN.

  CASE sscrfields-ucomm.
    WHEN 'FC01'.
      PERFORM frm_down_template.
  ENDCASE.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
  PERFORM frm_get_file USING p_file.



START-OF-SELECTION.
  PERFORM frm_run."主程序

下面展示ZPPA0011_TOP代码

TABLES: sscrfields.
TABLES:mara,mseg.
TYPE-POOLS: icon, slis.


DATA : BEGIN OF itab_sdata OCCURS 0,
         werks TYPE string, "工厂
         lgort TYPE string, "库位
         aufnr TYPE string, "内部订单
         matnr TYPE string, "物料代码
         menge TYPE string, "数量
       END OF itab_sdata.

"ALV显示数据结构
DATA : BEGIN OF itab_data OCCURS 0,
         sel(1),"选择
         icon         TYPE icon_d,     "状态标识
         bukrs        TYPE coas-bukrs, "公司
         butxt        TYPE t001-butxt,
         werks        TYPE marc-werks, "工厂
         name1        TYPE name1,
         matnr        TYPE marc-matnr, "物料编码
         maktx        TYPE makt-maktx, "物料描述
         meins        TYPE stko-bmein, "单位
         labst        TYPE mard-labst, "库存量
         bdmng        TYPE afpo-wemng, "已投料量
         menge        TYPE stpo-menge, "本次录入数量
         lgort        TYPE stpo-lgort, "库位
         lgobe        TYPE goitem-lgobe, "库位描述
         budat        TYPE mkpf-budat, "过账日期
         xlokez       TYPE char1, "冲销标识
         type(1),
         message(100),"处理结果
         aufnr        TYPE afpo-aufnr, "内部订单
         ktext        TYPE coas-ktext, "内部订单描述
         field_style  TYPE lvc_t_styl, " 为内表添加设置编辑状态所需的字段
       END OF itab_data.

*-------- ALV 结构设置
DATA: wa_fieldcat TYPE  lvc_s_fcat,
      it_fieldcat TYPE  lvc_t_fcat,
      g_layout    TYPE slis_layout_alv,
      g_title     TYPE lvc_title,
      pos         TYPE i,
      l_field     TYPE slis_fieldcat_alv,   "字段列结构
      l_fieldcat  TYPE slis_t_fieldcat_alv, "字段列内表
      l_status_01 TYPE slis_formname VALUE 'L_STATUS_01'.


DATA: gt_events TYPE slis_t_event,
      gs_event  LIKE LINE OF gt_events.
DATA: gt_event_exit TYPE slis_t_event_exit WITH HEADER LINE.

DATA:lv_gjahr TYPE gjahr,
     lv_monat TYPE monat,
     lv_poper TYPE poper,
     lv_begda TYPE d,
     lv_endda TYPE d.

DEFINE add_col.
  CLEAR wa_fieldcat.
  ADD 1 TO pos.
  wa_fieldcat-col_pos = pos.
  wa_fieldcat-fieldname = &1.
  wa_fieldcat-ref_field = &2.
  wa_fieldcat-ref_table = &3.
  wa_fieldcat-scrtext_m = &4.
  wa_fieldcat-tabname = &5.
  wa_fieldcat-outputlen = &6.
  wa_fieldcat-f4availabl = &7.
  wa_fieldcat-hotspot = &8.
  wa_fieldcat-checkbox = &9.

  IF wa_fieldcat-fieldname = 'MATNR'.
     wa_fieldcat-edit_mask = '==ALPHA'."隐藏前导零
  ENDIF.

  IF wa_fieldcat-fieldname = 'MENGE'.
     wa_fieldcat-edit = 'X'.
     wa_fieldcat-emphasize = 'C510'.
  ENDIF.

  IF wa_fieldcat-fieldname = 'AUFNR'.
     wa_fieldcat-edit = 'X'.
     wa_fieldcat-emphasize = 'C510'.
  ENDIF.

  IF wa_fieldcat-fieldname = 'LGORT'.
*     wa_fieldcat-edit = 'X'.
     wa_fieldcat-outputlen = '6'.
  ENDIF.
  wa_fieldcat-scrtext_l = wa_fieldcat-scrtext_m.
  wa_fieldcat-scrtext_s = wa_fieldcat-scrtext_m.
  wa_fieldcat-coltext   = wa_fieldcat-scrtext_m.
  APPEND wa_fieldcat TO it_fieldcat.
END-OF-DEFINITION.


CLASS lcl_event_receiver DEFINITION DEFERRED.

DATA: go_events_receiver TYPE REF TO lcl_event_receiver.
*----------------------------------------------------------------------*
*       CLASS lcl_event_receiver DEFINITION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
CLASS lcl_event_receiver DEFINITION.

  PUBLIC SECTION.
    METHODS:
      handle_data_changed
        FOR EVENT data_changed OF cl_gui_alv_grid
        IMPORTING er_data_changed.
ENDCLASS.                    "lcl_event_receiver DEFINITION
*---------------------------------------------------------
CLASS lcl_event_receiver IMPLEMENTATION.
  METHOD handle_data_changed.
    PERFORM handle_data_changed USING er_data_changed.
  ENDMETHOD.                    "HANDLE_BUTTON_CLICK
ENDCLASS .                    "lcl_event_receiver IMPLEMENTATION


TABLES afpo.

SELECTION-SCREEN:FUNCTION KEY 1.
SELECTION-SCREEN: BEGIN OF BLOCK b1 WITH FRAME TITLE TEXT-020.
  PARAMETERS:p_werks  TYPE  marc-werks.
  PARAMETERS:p_budat  TYPE matdoc-budat DEFAULT sy-datum.
  PARAMETERS:p_file   TYPE rlgrap-filename MODIF ID m2. "上传路径
  PARAMETERS:p_aufnr  TYPE aufk-aufnr      MODIF ID m1.
  SELECT-OPTIONS: s_mtart FOR mara-mtart   MODIF ID m1.
  SELECT-OPTIONS: s_matnr FOR mara-matnr   MODIF ID m1.
  SELECT-OPTIONS: s_lgort FOR mseg-lgort   MODIF ID m1.
SELECTION-SCREEN:END OF BLOCK b1.

SELECTION-SCREEN: BEGIN OF BLOCK a1 WITH FRAME TITLE TEXT-010.
  SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN POSITION 5.
    PARAMETERS : r1 RADIOBUTTON GROUP grp DEFAULT 'X' USER-COMMAND sele.
    SELECTION-SCREEN COMMENT 10(12) TEXT-011 FOR FIELD r1.


    SELECTION-SCREEN POSITION 30.
    PARAMETERS : r2 RADIOBUTTON GROUP grp.
    SELECTION-SCREEN COMMENT 35(12) TEXT-012 FOR FIELD r2.

  SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN: END OF BLOCK a1.



AT SELECTION-SCREEN OUTPUT.
  LOOP AT SCREEN .
    "屏幕组
    CASE screen-group1.
      WHEN 'M1'.
        IF r1 EQ 'X' .
          screen-active = 0.                "设置屏幕隐藏
        ELSE .
          screen-active = 1.                "设置屏幕显示
        ENDIF .
      WHEN 'M2'.
        IF r1 EQ 'X' .
          screen-active = 1.                "设置屏幕隐藏
        ELSE .
          screen-active = 0.                "设置屏幕显示
        ENDIF .
    ENDCASE .
    MODIFY SCREEN .                        "修改选择屏幕属性
  ENDLOOP .

下面展示ZPPA0011_FRM代码

FORM frm_run .
  PERFORM frm_get_data.
  PERFORM frm_display_data."展示数据
ENDFORM.
*&---------------------------------------------------------------------*
*& Form frm_get_data
*&---------------------------------------------------------------------*
*& text
*&---------------------------------------------------------------------*
*& -->  p1        text
*& <--  p2        text
*&---------------------------------------------------------------------*
FORM frm_get_data .
  REFRESH itab_data[].
  "获取日期
  PERFORM frm_get_date.

  IF r1 = 'X '.
    PERFORM frm_get_from_excel."从EXCEL数据中读取
  ELSE.
    PERFORM frm_get_from_database."读取有库存数据并展示
  ENDIF.

  IF itab_data[] IS INITIAL.
    MESSAGE '没有满足条件的记录' TYPE 'S'.
    STOP.
  ENDIF.

ENDFORM.
*&---------------------------------------------------------------------*
*& Form frm_display_data
*&---------------------------------------------------------------------*
*& text
*&---------------------------------------------------------------------*
*& -->  p1        text
*& <--  p2        text
*&---------------------------------------------------------------------*
FORM frm_display_data .
  REFRESH: it_fieldcat.
  CLEAR g_layout.

  DATA: x_layout TYPE lvc_s_layo.

*  g_layout-zebra       = 'X'.   "ALV行的颜色间隔更换(间隔色带)
  x_layout-stylefname  = 'FIELD_STYLE'. " 将内表中的字段名存入显示格式
  x_layout-zebra = 'X'.   "ALV行的颜色间隔更换(间隔色带)

  add_col 'SEL'        space space '选择'                   'ITAB_DATA' '3' space 'X'   'X'.
  add_col 'ICON'       space space '状态'                   'ITAB_DATA' '4' space space space.
  add_col 'NAME1'      'NAME1'  'GOITEM'  '工厂名称'        'ITAB_DATA' '15' space space space.
  add_col 'MAKTX'      space space '物料描述'               'ITAB_DATA' '20' space space space.
  add_col 'BDMNG'     space space '本月已投料数量'          'ITAB_DATA' '8' space space space.
  add_col 'MEINS'      space space '单位'                   'ITAB_DATA' '4' space space space.
  add_col 'LABST'      space space '当前库存'               'ITAB_DATA' '8' space space space.
  add_col 'MENGE'      'MENGE'  'GOITEM'    '领用数量'      'ITAB_DATA' '10' space space space.
  add_col 'LGORT'      'LGORT'  'GOITEM'   '库位代码'       'ITAB_DATA' '4' space space space.
  add_col 'LGOBE'      'LGOBE'  'GOITEM'   '库位描述'       'ITAB_DATA' '10' space space space.
  add_col 'AUFNR'      'AUFNR'  'AUFK'     '内部订单'       'ITAB_DATA' '12' space space space.
  add_col 'KTEXT'      space space '内部订单描述'           'ITAB_DATA' '20' space space space.
  add_col 'XLOKEZ'     space space '冲销'                   'ITAB_DATA' '3' space 'X'   'X'.
  add_col 'MESSAGE'    space space '处理消息'               'ITAB_DATA' '40' space space space.
  add_col 'WERKS'      'WERKS'  'GOITEM'  '工厂代码'        'ITAB_DATA' '4' space space space.
  add_col 'BUKRS'      space space '公司代码'               'ITAB_DATA' '4' space space space.
  add_col 'BUTXT'      space space '公司名称'               'ITAB_DATA' '14' space space space.
  add_col 'MATNR'      space space '物料代码'               'ITAB_DATA' '10' space space space.


  gs_event-name = 'CALLER_EXIT'.
  gs_event-form = 'FRM_CELL_CHANGE'.
  APPEND gs_event TO gt_events.CLEAR gs_event.

  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY_LVC'
    EXPORTING
      i_callback_program       = sy-repid
      i_callback_pf_status_set = 'L_STATUS100'
      i_callback_user_command  = 'FRM_USER_COMMAND'
      is_layout_lvc            = x_layout
      it_fieldcat_lvc          = it_fieldcat
      i_save                   = 'A'
      it_events                = gt_events              "注册事件
    TABLES
      t_outtab                 = itab_data
    EXCEPTIONS
      program_error            = 1
      OTHERS                   = 2.
  IF sy-subrc NE 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  ENDIF.


ENDFORM.

FORM l_status100 USING extab TYPE slis_t_extab.
  SET  PF-STATUS  'MAIN'.
ENDFORM.                    "L_STATUS100


*&---------------------------------------------------------------------*
*&      Form  frm_user_command
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      -->R_UCOMM      text
*      -->RS_SELFIELD  text
*----------------------------------------------------------------------*
FORM frm_user_command USING r_ucomm LIKE sy-ucomm rs_selfield TYPE slis_selfield.
  DATA: ref TYPE REF TO cl_gui_alv_grid.
  CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
    IMPORTING
      e_grid = ref.
  CALL METHOD ref->check_changed_data.
  CASE r_ucomm.
    WHEN '&IC1'.
      IF rs_selfield-fieldname = 'SEL'.
        READ TABLE itab_data INDEX rs_selfield-tabindex.
        IF itab_data-sel = ''.
          itab_data-sel = 'X'.
        ELSE.
          itab_data-sel = ''.
        ENDIF.
        MODIFY itab_data INDEX rs_selfield-tabindex.
        CLEAR itab_data.
      ENDIF.
      IF rs_selfield-fieldname = 'XLOKEZ'.
        READ TABLE itab_data INDEX rs_selfield-tabindex.
        IF itab_data-xlokez = ''.
          itab_data-xlokez = 'X'.
        ELSE.
          itab_data-xlokez = ''.
        ENDIF.
        MODIFY itab_data INDEX rs_selfield-tabindex.
        CLEAR itab_data.
      ENDIF.


    WHEN 'ALL'.
      itab_data-sel = 'X'.
      MODIFY itab_data FROM itab_data  TRANSPORTING sel   WHERE sel = '' .
    WHEN 'SAL'.
      itab_data-sel = ''.
      MODIFY itab_data FROM itab_data  TRANSPORTING sel   WHERE sel = 'X' .
    WHEN '&IMP'.
      PERFORM frm_excute.
    WHEN '&QUERY'.
      PERFORM frm_query.
    WHEN '&REF'.
      PERFORM frm_get_data.
    WHEN '&CHG'.
      PERFORM frm_change_date.
  ENDCASE.

  PERFORM frm_re_alv.
ENDFORM.                    "FRM_USER_COMMAND
*&---------------------------------------------------------------------*
*& Form frm_excute
*&---------------------------------------------------------------------*
*& text
*&---------------------------------------------------------------------*
*& -->  p1        text
*& <--  p2        text
*&---------------------------------------------------------------------*
FORM frm_excute .

  DATA:ls_goodsmvt_head TYPE bapi2017_gm_head_01.
  DATA:lt_goodsmvt_item    TYPE TABLE OF bapi2017_gm_item_create,
       ls_goodsmvt_item    TYPE bapi2017_gm_item_create,
       lt_extensionin      TYPE TABLE OF bapiparex,
       ls_extensionin      TYPE bapiparex,
       lv_materialdocument TYPE bapi2017_gm_head_ret-mat_doc,
       lv_matdocumentyear  TYPE bapi2017_gm_head_ret-doc_year,
       lv_matzeile         TYPE mseg-zeile,
       lv_goodsmvt_code    TYPE bapi2017_gm_code.
  DATA:lt_return TYPE TABLE OF bapiret2,
       ls_return LIKE LINE OF lt_return.


  DATA ls_xmseg  TYPE bapi_te_xmseg.
  DATA lv_index TYPE sy-tabix.

  LOOP AT itab_data WHERE sel = 'X' AND type NE 'S'.
    IF itab_data-menge =< 0.
      itab_data-icon = icon_red_light.
      itab_data-type = 'E'.
      itab_data-message = '请填写数量'.
      MODIFY itab_data.
      CLEAR itab_data.
      CONTINUE.
    ENDIF.

    IF itab_data-lgort IS INITIAL.
      itab_data-icon = icon_red_light.
      itab_data-type = 'E'.
      itab_data-message = '请填写库位'.
      MODIFY itab_data.
      CLEAR itab_data.
      CONTINUE.
    ENDIF.

    CLEAR lv_index.
    lv_index = lv_index + 1.
    CLEAR:ls_goodsmvt_item, ls_goodsmvt_head,ls_return,ls_extensionin.
    REFRESH:lt_return,lt_goodsmvt_item,lt_extensionin.
    "赋值逻辑
    ls_goodsmvt_head-pstng_date = p_budat."记账日期
    ls_goodsmvt_head-doc_date   = sy-datum."凭证日期
    lv_goodsmvt_code = '03'.
    ls_goodsmvt_item-material   = itab_data-matnr."物料代码
    ls_goodsmvt_item-plant      = itab_data-werks."工厂代码
    ls_goodsmvt_item-stge_loc   = itab_data-lgort."库位
    ls_goodsmvt_item-orderid    = itab_data-aufnr.
    ls_goodsmvt_item-entry_qnt  = itab_data-menge."数量
    "冲销处理逻辑
    IF itab_data-xlokez IS NOT INITIAL .
      ls_goodsmvt_item-move_type = '262'.
    ELSE.
      ls_goodsmvt_item-move_type  = '261'.
    ENDIF.
    APPEND ls_goodsmvt_item TO lt_goodsmvt_item.
    CLEAR: ls_goodsmvt_item.

    CALL FUNCTION 'BAPI_GOODSMVT_CREATE'
      EXPORTING
        goodsmvt_header  = ls_goodsmvt_head
        goodsmvt_code    = lv_goodsmvt_code
      IMPORTING
        materialdocument = lv_materialdocument
        matdocumentyear  = lv_matdocumentyear
      TABLES
        goodsmvt_item    = lt_goodsmvt_item
        extensionin      = lt_extensionin
        return           = lt_return.
    READ TABLE lt_return INTO ls_return INDEX 1.
    IF ls_return-type = 'E' OR ls_return-type = 'A'.
      CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.
      itab_data-type = 'E'.
      itab_data-icon = icon_red_light.
      itab_data-message = |处理失败:|.
      LOOP AT lt_return INTO ls_return WHERE type CA 'EAX'.
        itab_data-message = |{ itab_data-message },{ ls_return-message }|.
      ENDLOOP.
    ELSE.
      CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
        EXPORTING
          wait = 'X'.
      itab_data-type = 'S'.
      itab_data-icon = icon_green_light.
      itab_data-message = |录入成功,生成凭证{ lv_materialdocument }|.

      SELECT SUM( CASE bwart
        WHEN '262' THEN menge * -1
        ELSE menge
        END
        ) AS bdmng
       INTO @itab_data-bdmng
       FROM nsdm_e_mseg
        WHERE bwart IN ('261','262')
          AND werks = @itab_data-werks
          AND lgort = @itab_data-lgort
          AND matnr = @itab_data-matnr
          AND aufnr = @itab_data-aufnr
          AND budat_mkpf BETWEEN @lv_begda AND @lv_endda.

      "更新库存
      SELECT SINGLE labst
        FROM mard
        INTO @itab_data-labst
        WHERE matnr = @itab_data-matnr
          AND werks = @itab_data-werks
          AND lgort = @itab_data-lgort.
      MODIFY itab_data TRANSPORTING labst WHERE matnr = itab_data-matnr AND werks = itab_data-werks AND lgort = itab_data-lgort.
    ENDIF.
    MODIFY itab_data.
    CLEAR  itab_data.
  ENDLOOP.
ENDFORM.
*&---------------------------------------------------------------------*
*& Form frm_re_alv
*&---------------------------------------------------------------------*
*& text
*&---------------------------------------------------------------------*
*& -->  p1        text
*& <--  p2        text
*&---------------------------------------------------------------------*
FORM frm_re_alv .
  DATA:lv_grid   TYPE REF TO cl_gui_alv_grid,
       is_stable TYPE lvc_s_stbl,
       ls_layout TYPE lvc_s_layo.
  CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
    IMPORTING
      e_grid = lv_grid.
* 获取ALV变化过后的布局参数
  CALL METHOD lv_grid->get_frontend_layout
    IMPORTING
      es_layout = ls_layout.

* 重新回写自适应宽度
  ls_layout-zebra      = 'X'.
*  ls_layout-cwidth_opt = 'X'.


* 回写ALV变化过后的布局参数
  CALL METHOD lv_grid->set_frontend_layout
    EXPORTING
      is_layout = ls_layout.
* 刷新ALV布局
  is_stable-col = 'X'.
*  is_stable-row = 'X'.
  CALL METHOD lv_grid->refresh_table_display
    EXPORTING
      is_stable = is_stable.
ENDFORM.
*&---------------------------------------------------------------------*
*& Form frm_query
*&---------------------------------------------------------------------*
*& text
*&---------------------------------------------------------------------*
*& -->  p1        text
*& <--  p2        text
*&---------------------------------------------------------------------*
FORM frm_query .
  DATA: lv_va TYPE slis_vari.   " Tcode MB51对应程序变式,将变式清空
  FIELD-SYMBOLS: <lt_pay_data> TYPE ANY TABLE,
                 <lt_temp>     TYPE ANY TABLE,
                 <ls_data>.
  DATA lr_pay_data TYPE REF TO data.
  RANGES:s_bwart FOR resb-bwart,
         s_werks FOR resb-werks,
         s_budat FOR mseg-budat_mkpf,
         s_aufnr FOR resb-aufnr,
         s_lgort FOR resb-lgort,
         s_matnr FOR resb-matnr.

  lv_va = ''.
  "工厂
  s_werks-low = p_werks.
  s_werks-option = 'EQ'.
  s_werks-sign   = 'I'.
  APPEND s_werks.
  CLEAR  s_bwart.

  s_bwart-low = '261'.
  s_bwart-option = 'EQ'.
  s_bwart-sign   = 'I'.
  APPEND s_bwart.
  CLEAR  s_bwart.

  s_bwart-low = '262'.
  s_bwart-option = 'EQ'.
  s_bwart-sign   = 'I'.
  APPEND s_bwart.
  CLEAR  s_bwart.

  s_budat-low  = lv_begda.
  s_budat-high = lv_endda.
  s_budat-option = 'BT'.
  s_budat-sign   = 'I'.
  APPEND s_budat.
  CLEAR s_budat.

  LOOP AT itab_data WHERE sel = 'X'.
    s_matnr-low = itab_data-matnr.
    s_matnr-option = 'EQ'.
    s_matnr-sign   = 'I'.
    APPEND s_matnr.
    CLEAR  s_matnr.


    IF itab_data-aufnr IS NOT INITIAL.
      s_aufnr-low    = itab_data-aufnr.
      s_aufnr-option = 'EQ'.
      s_aufnr-sign   = 'I'.
      APPEND s_aufnr.
      CLEAR s_aufnr.
    ENDIF.

    IF itab_data-lgort IS NOT INITIAL.
      s_lgort-low    = itab_data-lgort.
      s_lgort-option = 'EQ'.
      s_lgort-sign   = 'I'.
      APPEND s_lgort.
      CLEAR s_lgort.
    ENDIF.
    CLEAR itab_data.
  ENDLOOP.

  cl_salv_bs_runtime_info=>set(
       EXPORTING
         display  = abap_true
         metadata = abap_false
         data     = abap_true ).

  SUBMIT rm07docs                " Tcode MB51对应程序
    WITH matnr IN s_matnr   "物料
    WITH werks IN s_werks   "工厂
    WITH bwart IN s_bwart"移动类型
    WITH budat IN s_budat "过账日期
    WITH lgort IN s_lgort
    WITH aufnr IN s_aufnr
    WITH rhier_l  = ''
    WITH rflat_l  = abap_true"扁平结构
    WITH database = abap_true "读取数据库
    WITH alv_def  = lv_va"变式清空,否则会影响取数内容
    AND RETURN.

ENDFORM.

*&---------------------------------------------------------------------*
*&      Form  CALLER_EXIT
*&---------------------------------------------------------------------*
*& ALV单元格事件
*&---------------------------------------------------------------------*
*&      -->E_GRID     text
*&---------------------------------------------------------------------*
FORM frm_cell_change USING e_grid TYPE slis_data_caller_exit.
  DATA:lr_grid TYPE REF TO cl_gui_alv_grid.
  CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
    IMPORTING
      e_grid = lr_grid.
  CREATE OBJECT go_events_receiver.
  SET HANDLER go_events_receiver->handle_data_changed FOR lr_grid.
  lr_grid->register_edit_event( cl_gui_alv_grid=>mc_evt_enter ).
  lr_grid->register_edit_event( cl_gui_alv_grid=>mc_evt_modified ).
ENDFORM.                    "CALLER_EXIT

*&---------------------------------------------------------------------*
*& Form handle_data_changed
*&---------------------------------------------------------------------*
*& ALV单元格数据修改事件
*&---------------------------------------------------------------------*
*&      --> ER_DATA_CHANGED
*&      --> SENDER
*&---------------------------------------------------------------------*
FORM handle_data_changed  USING er_data_changed TYPE REF TO cl_alv_changed_data_protocol.

  DATA:lv_msg       TYPE char255,
       lv_condition TYPE char10.

  DATA:ls_good_cells TYPE lvc_s_modi.
  FIELD-SYMBOLS: <f_field> TYPE any .
  DATA:lr_grid TYPE REF TO cl_gui_alv_grid.
  DATA:ls_stable TYPE lvc_s_stbl .


  ls_stable-col = 'X'.
  ls_stable-row = 'X'.
  CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
    IMPORTING
      e_grid = lr_grid.

  LOOP AT er_data_changed->mt_good_cells INTO ls_good_cells .
    READ TABLE itab_data ASSIGNING FIELD-SYMBOL(<fs_output>) INDEX ls_good_cells-row_id.
    IF sy-subrc = 0.
      ASSIGN COMPONENT ls_good_cells-fieldname OF STRUCTURE <fs_output> TO <f_field>.
      <f_field> = ls_good_cells-value.
      IF ls_good_cells-fieldname = 'LGORT'.
        SELECT SINGLE lgobe
          FROM t001l
          INTO @<fs_output>-lgobe
          WHERE werks = @<fs_output>-werks
            AND lgort = @<fs_output>-lgort.

        IF <fs_output>-lgort IS INITIAL.
          SELECT SUM( labst )
            FROM mard
            INTO @<fs_output>-labst
            WHERE matnr = @<fs_output>-matnr
              AND werks = @<fs_output>-werks.
        ELSE.
          SELECT SINGLE labst
            INTO @<fs_output>-labst
            FROM mard
            WHERE werks = @<fs_output>-werks
              AND matnr = @<fs_output>-matnr
              AND lgort = @<fs_output>-lgort.
        ENDIF.

        IF sy-subrc <> 0.
          CLEAR <fs_output>-labst.
        ENDIF.
      ELSEIF ls_good_cells-fieldname = 'AUFNR'."当更改内部订单号时,进行校验
        IF <fs_output>-aufnr IS NOT INITIAL.
          "判断内部订单公司与当前工厂公司是否一致
          SELECT SINGLE ktext,bukrs,autyp
            FROM coas
            INTO @DATA(lw_coas)
            WHERE aufnr = @<fs_output>-aufnr
              AND autyp = '01'.
          IF lw_coas IS INITIAL.
            <fs_output>-icon = icon_red_light.
            <fs_output>-message = '输入的订单号不是内部订单,请确认'.
          ELSEIF lw_coas IS NOT INITIAL AND lw_coas-bukrs <> <fs_output>-bukrs.
            <fs_output>-icon = icon_red_light.
            <fs_output>-message = '所选内部订单的公司代码与工厂所属公司代码不一致'.
          ELSE.
            "内部订单描述
            <fs_output>-ktext = lw_coas-ktext.
            "获取已投料信息  订单号+ 物料 + 261 -262
            SELECT SUM( CASE bwart
              WHEN '262' THEN menge * -1
              ELSE menge
              END
              ) AS bdmng
             INTO @<fs_output>-bdmng
             FROM nsdm_e_mseg
              WHERE bwart IN ('261','262')
                AND werks = @<fs_output>-werks
                AND lgort = @<fs_output>-lgort
                AND matnr = @<fs_output>-matnr
                AND aufnr = @<fs_output>-aufnr
                AND budat_mkpf BETWEEN @lv_begda AND @lv_endda.
            CLEAR:<fs_output>-icon,<fs_output>-message.
          ENDIF.
        ELSE.
          CLEAR:<fs_output>-icon,<fs_output>-message.
        ENDIF.

      ENDIF.
    ENDIF.
  ENDLOOP.

  CALL METHOD lr_grid->refresh_table_display
    EXPORTING
      is_stable      = ls_stable
      i_soft_refresh = 'X'
    EXCEPTIONS
      finished       = 1.
ENDFORM.
*&---------------------------------------------------------------------*
*& Form frm_auth_chk
*&---------------------------------------------------------------------*
*& text
*&---------------------------------------------------------------------*
*& -->  p1        text
*& <--  p2        text
*&---------------------------------------------------------------------*
FORM frm_auth_chk.
  AUTHORITY-CHECK OBJECT 'M_BEST_WRK'
    ID 'WERKS' FIELD p_werks
    ID 'ACTVT' DUMMY.

  IF sy-subrc <> 0.
    MESSAGE s000 WITH '没有工厂' p_werks '的操作权限' DISPLAY LIKE 'E'.
    STOP.
  ENDIF.
ENDFORM.
FORM frm_call_sm30.

  DATA:gs_vimsellist LIKE vimsellist,
       gt_vimsellist LIKE TABLE OF gs_vimsellist.

  gs_vimsellist-viewfield  = 'WERKS'.
  gs_vimsellist-operator   = 'EQ'.
  gs_vimsellist-value      = p_werks.
  APPEND gs_vimsellist TO gt_vimsellist.


  CALL FUNCTION 'VIEW_MAINTENANCE_CALL'
    EXPORTING
      action                       = 'U'
      view_name                    = 'ZPPA0010_A'
    TABLES
      dba_sellist                  = gt_vimsellist
    EXCEPTIONS
      client_reference             = 1
      foreign_lock                 = 2
      invalid_action               = 3
      no_clientindependent_auth    = 4
      no_database_function         = 5
      no_editor_function           = 6
      no_show_auth                 = 7
      no_tvdir_entry               = 8
      no_upd_auth                  = 9
      only_show_allowed            = 10
      system_failure               = 11
      unknown_field_in_dba_sellist = 12
      view_not_found               = 13
      maintenance_prohibited       = 14
      OTHERS                       = 15.
  IF sy-subrc <> 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
            WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  ENDIF.
ENDFORM.
*&---------------------------------------------------------------------*
*& Form frm_get_date
*&---------------------------------------------------------------------*
*& text
*&---------------------------------------------------------------------*
*& -->  p1        text
*& <--  p2        text
*&---------------------------------------------------------------------*
FORM frm_get_date .
  CALL FUNCTION 'FI_PERIOD_DETERMINE'
    EXPORTING
      i_budat = p_budat
      i_bukrs = '3000'
    IMPORTING
      e_gjahr = lv_gjahr
      e_monat = lv_monat.

  lv_poper = lv_monat.

  CALL FUNCTION 'FIRST_DAY_IN_PERIOD_GET'
    EXPORTING
      i_gjahr        = lv_gjahr
      i_periv        = 'Y4'
      i_poper        = lv_poper
    IMPORTING
      e_date         = lv_begda
    EXCEPTIONS
      input_false    = 1
      t009_notfound  = 2
      t009b_notfound = 3
      OTHERS         = 4.

  CALL FUNCTION 'LAST_DAY_IN_PERIOD_GET'
    EXPORTING
      i_gjahr        = lv_gjahr
      i_periv        = 'Y4'
      i_poper        = lv_poper
    IMPORTING
      e_date         = lv_endda
    EXCEPTIONS
      input_false    = 1
      t009_notfound  = 2
      t009b_notfound = 3
      OTHERS         = 4.
ENDFORM.
*&---------------------------------------------------------------------*
*& Form frm_change_date
*&---------------------------------------------------------------------*
*& 更改过账日期
*&---------------------------------------------------------------------*
*& -->  p1        text
*& <--  p2        text
*&---------------------------------------------------------------------*
FORM frm_change_date .
  "弹出可以填写字段的函数方法
  DATA : lt_sval TYPE  TABLE  OF  sval,
         ls_sval LIKE  LINE  OF  lt_sval.
  DATA:l_returncode TYPE string .

  "过账日期
  CLEAR ls_sval .
  ls_sval-tabname = 'BKPF' .  "表名
  ls_sval-fieldname = 'BUDAT' . "字段名
  ls_sval-field_obl = 'X' .          "是否为必填
  APPEND ls_sval TO lt_sval.


  CALL FUNCTION 'POPUP_GET_VALUES'
    EXPORTING
*     NO_VALUE_CHECK  = ' '
      popup_title     = '请填写'
*     START_COLUMN    = '5'
*     START_ROW       = '5'
    IMPORTING
      returncode      = l_returncode
    TABLES
      fields          = lt_sval
    EXCEPTIONS
      error_in_fields = 1
      OTHERS          = 2.

  LOOP AT lt_sval INTO DATA(lw_sval) WHERE tabname = 'BKPF' AND fieldname = 'BUDAT'.
    p_budat = lw_sval-value.
    CLEAR lw_sval.
    EXIT.
  ENDLOOP.
  REFRESH lt_sval.



  PERFORM frm_get_date."重新获取日期

  "更新投料数据
  LOOP AT itab_data.
    SELECT SUM( CASE bwart
      WHEN '262' THEN menge * -1
      ELSE menge
      END
      ) AS bdmng
     INTO @itab_data-bdmng
     FROM nsdm_e_mseg
      WHERE bwart IN ('261','262')
        AND werks = @itab_data-werks
        AND lgort = @itab_data-lgort
        AND matnr = @itab_data-matnr
        AND aufnr = @itab_data-aufnr
        AND budat_mkpf BETWEEN @lv_begda AND @lv_endda.
    MODIFY itab_data.
    CLEAR itab_data.
  ENDLOOP.

ENDFORM.



*&---------------------------------------------------------------------*
*& Form FRM_DOWN_TEMPLATE
*&---------------------------------------------------------------------*
*& text
*&---------------------------------------------------------------------*
*& -->  p1        text
*& <--  p2        text
*&---------------------------------------------------------------------*
FORM frm_down_template .
  DATA: lo_objdata LIKE wwwdatatab,
        p_name     TYPE string,
        p_path     TYPE string,
        p_fullname TYPE string,
        p_dest     TYPE rlgrap-filename,
        li_rc      TYPE sy-subrc,
        lv_objid   TYPE w3objid,
        ls_str     TYPE string.

  lv_objid = 'ZPPA0011'.
  ls_str = 'ZPPA0011_内部订单消耗领料登记模板.xlsx'.

  CALL METHOD cl_gui_frontend_services=>file_save_dialog
    EXPORTING
      window_title      = '选择下载路径'
      default_extension = 'XLSX'
      default_file_name = ls_str
    CHANGING
      filename          = p_name
      path              = p_path
      fullpath          = p_fullname.

  IF p_fullname IS INITIAL.
    STOP.
  ENDIF.

  SELECT SINGLE relid objid FROM wwwdata
       INTO CORRESPONDING FIELDS OF  lo_objdata
       WHERE srtf2 = 0
         AND relid = 'MI'
         AND objid = lv_objid.
  IF sy-subrc <> 0.
    MESSAGE '下载模板失败!' TYPE 'S' DISPLAY LIKE 'E'.
    STOP.
  ENDIF.

  p_dest = p_fullname.
  CALL FUNCTION 'DOWNLOAD_WEB_OBJECT'
    EXPORTING
      key         = lo_objdata
      destination = p_dest
    IMPORTING
      rc          = li_rc.
  IF li_rc = 0.
    MESSAGE '模版下载成功' TYPE 'S'.
  ELSE.
    MESSAGE '模版下载失败' TYPE 'S' DISPLAY LIKE 'E'.
    STOP.
  ENDIF.
ENDFORM.


*&---------------------------------------------------------------------*
*& Form FRM_GET_FILE
*&---------------------------------------------------------------------*
*& text
*&---------------------------------------------------------------------*
FORM frm_get_file  USING  p_file.
  CALL FUNCTION 'WS_FILENAME_GET'
    EXPORTING
      def_filename     = p_file
      mask             = ',*.xlsx,*.XLSX,*.XLS,*.xls,*.txt,*.TXT.'
*'',*.xls,*.XLS.'如果读入txt文件,在后边就需要用函数
      mode             = 'O'
      title            = 'File Name'
    IMPORTING
      filename         = p_file
    EXCEPTIONS
      inv_winsys       = 1
      no_batch         = 2
      selection_cancel = 3
      selection_error  = 4
      OTHERS           = 5.

ENDFORM.
*&---------------------------------------------------------------------*
*& Form frm_get_from_excel
*&---------------------------------------------------------------------*
*& text
*&---------------------------------------------------------------------*
*& -->  p1        text
*& <--  p2        text
*&---------------------------------------------------------------------*
FORM frm_get_from_excel .
  TYPE-POOLS: truxs.
  DATA: p_text_data TYPE truxs_t_text_data,
        pp_file     TYPE string,
        i_file      TYPE ibipparms-path.


  pp_file = p_file.

  CALL FUNCTION 'GUI_UPLOAD'
    EXPORTING
      filename                = pp_file
      filetype                = 'ASC'
      has_field_separator     = 'X'
      read_by_line            = 'X'
    TABLES
      data_tab                = p_text_data
    EXCEPTIONS
      file_open_error         = 1
      file_read_error         = 2
      no_batch                = 3
      gui_refuse_filetransfer = 4
      invalid_type            = 5
      no_authority            = 6
      unknown_error           = 7
      bad_data_format         = 8
      header_not_allowed      = 9
      separator_not_allowed   = 10
      header_too_long         = 11
      unknown_dp_error        = 12
      access_denied           = 13
      dp_out_of_memory        = 14
      disk_full               = 15
      dp_timeout              = 16
      OTHERS                  = 17.
  IF sy-subrc <> 0.
    CASE sy-subrc.
      WHEN 1.MESSAGE 'FILE_OPEN_ERROR ' TYPE 'E'.
      WHEN 2.MESSAGE 'FILE_READ_ERROR ' TYPE 'E'.
      WHEN 3.MESSAGE 'NO_BATCH' TYPE 'E'.
      WHEN 4.MESSAGE 'GUI_REFUSE_FILETRANSFER  ' TYPE 'E'.
      WHEN 5.MESSAGE 'INVALID_TYPE ' TYPE 'E'.
      WHEN 6.MESSAGE ' NO_AUTHORITY' TYPE 'E'.
      WHEN 7.MESSAGE 'UNKNOWN_ERROR' TYPE 'E'.
      WHEN 8.MESSAGE 'BAD_DATA_FORMAT ' TYPE 'E'.
      WHEN 9.MESSAGE 'HEADER_NOT_ALLOWED' TYPE 'E'.
      WHEN 10.MESSAGE 'SEPARATOR_NOT_ALLOWED' TYPE 'E'.
      WHEN 11.MESSAGE 'HEADER_TOO_LONG ' TYPE 'E'.
      WHEN 12.MESSAGE 'UNKNOWN_DP_ERROR' TYPE 'E'.
      WHEN 13.MESSAGE ' ACCESS_DENIED ' TYPE 'E'.
      WHEN 14.MESSAGE 'DP_OUT_OF_MEMORY ' TYPE 'E'.
      WHEN 15.MESSAGE 'DISK_FULL  ' TYPE 'E'.
      WHEN 16.MESSAGE 'DP_TIMEOUT' TYPE 'E'.
      WHEN 17.MESSAGE ' OTHERS  ' TYPE 'E'.
      WHEN OTHERS.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDCASE.
  ENDIF.

  CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'
    EXPORTING
*     I_FIELD_SEPERATOR    =
*     I_LINE_HEADER        =
      i_tab_raw_data       = p_text_data
      i_filename           = p_file
    TABLES
      i_tab_converted_data = itab_sdata
    EXCEPTIONS
      conversion_failed    = 1
      OTHERS               = 2.
  IF sy-subrc <> 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
            WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  ENDIF.
  DELETE itab_sdata INDEX 1.
*
  LOOP AT itab_sdata.
    MOVE-CORRESPONDING itab_sdata TO itab_data.
    "物料代码补零
    CALL FUNCTION 'CONVERSION_EXIT_MATN1_INPUT'
      EXPORTING
        input        = itab_data-matnr
      IMPORTING
        output       = itab_data-matnr
      EXCEPTIONS
        length_error = 1
        OTHERS       = 2.
    IF sy-subrc <> 0.
*       Implement suitable error handling here
    ENDIF.
    "物料描述
    SELECT SINGLE maktx
      FROM makt
      INTO @itab_data-maktx
      WHERE matnr = @itab_data-matnr.

    "获取内部订单描述、公司代码、工厂代码
    SELECT SINGLE ktext,bukrs
      FROM coas
      INTO ( @itab_data-ktext, @itab_data-bukrs )
      WHERE aufnr = @itab_data-aufnr.

    "判断内部订单的公司与库存工厂对公司是否一致
    SELECT SINGLE t001k~bukrs,t001~butxt,t001w~name1
      FROM t001 INNER JOIN t001k ON t001~bukrs = t001k~bukrs
                INNER JOIN t001w ON t001w~bwkey = t001k~bwkey
      INTO @DATA(lw_t001)
      WHERE t001w~werks = @itab_data-werks.

    IF lw_t001-bukrs <> itab_data-bukrs.
      itab_data-icon = icon_red_light.
      itab_data-type = 'E'.
      itab_data-message = '内部订单对应公司与库存工厂所属公司不一致'.
    ELSE.
      itab_data-name1 = lw_t001-name1.
      itab_data-butxt = lw_t001-butxt.
    ENDIF.

    SELECT SUM( CASE bwart
      WHEN '262' THEN menge * -1
      ELSE menge
      END
      ) AS bdmng
     INTO @itab_data-bdmng
     FROM nsdm_e_mseg
      WHERE bwart IN ('261','262')
        AND werks = @itab_data-werks
        AND lgort = @itab_data-lgort
        AND matnr = @itab_data-matnr
        AND aufnr = @itab_data-aufnr
        AND budat_mkpf BETWEEN @lv_begda AND @lv_endda.

    "更新库存
    SELECT SINGLE labst
      FROM mard
      INTO @itab_data-labst
      WHERE matnr = @itab_data-matnr
        AND werks = @itab_data-werks
        AND lgort = @itab_data-lgort.

    itab_data-sel  = 'X'.
    itab_data-icon = icon_light_out.
    APPEND itab_data.
    CLEAR: itab_sdata,itab_data .
  ENDLOOP.
  REFRESH itab_sdata[].
ENDFORM.
*&---------------------------------------------------------------------*
*& Form frm_get_from_mb52
*&---------------------------------------------------------------------*
*& text
*&---------------------------------------------------------------------*
*& -->  p1        text
*& <--  p2        text
*&---------------------------------------------------------------------*
FORM frm_get_from_database .
  DATA: lv_va TYPE slis_vari.   " Tcode MB51对应程序变式,将变式清空
  FIELD-SYMBOLS: <lt_pay_data> TYPE ANY TABLE,
                 <ls_data>.
  DATA lr_pay_data  TYPE REF TO data.

  IF p_aufnr IS NOT INITIAL.
    "获取内部订单描述、公司代码、工厂代码
    SELECT SINGLE ktext,bukrs
      FROM coas
      INTO @DATA(lw_coas)
      WHERE aufnr = @p_aufnr
        AND autyp = '01'.
    IF lw_coas IS INITIAL.
      MESSAGE '输入的订单号不是内部订单号!' TYPE 'I'.
      EXIT.
    ELSE.
      "判断内部订单的公司与库存工厂对公司是否一致
      SELECT SINGLE t001k~bukrs,t001~butxt,t001w~name1
        FROM t001 INNER JOIN t001k ON t001~bukrs = t001k~bukrs
                  INNER JOIN t001w ON t001w~bwkey = t001k~bwkey
        INTO @DATA(lw_t001)
        WHERE t001w~werks = @p_werks.
    ENDIF.
  ELSE.
      "判断内部订单的公司与库存工厂对公司是否一致
      SELECT SINGLE t001k~bukrs,t001~butxt,t001w~name1
        FROM t001 INNER JOIN t001k ON t001~bukrs = t001k~bukrs
                  INNER JOIN t001w ON t001w~bwkey = t001k~bwkey
        INTO @lw_t001
        WHERE t001w~werks = @p_werks.
  ENDIF.


  lv_va = '/YT01'.

  RANGES:s_werks FOR resb-werks.

  "工厂
  s_werks-low = p_werks.
  s_werks-option = 'EQ'.
  s_werks-sign   = 'I'.
  APPEND s_werks.

  REFRESH:itab_data.

  "设置执行时不显示,只获取ALV数据
  cl_salv_bs_runtime_info=>set(
      display = abap_false
      metadata = abap_false
      data  = abap_true ).
  "MB52的程序
  SUBMIT rm07mlbs
    WITH matnr IN s_matnr
    WITH werks IN s_werks
    WITH lgort IN s_lgort
    WITH negativ = ''
    WITH pa_sond = 'X'
    WITH xmchb = 'X'
    WITH nozero = 'X'"0库存标识
    WITH novalues = ''
    WITH pa_hsq = ''
    WITH pa_flt = 'X'
    WITH p_vari = lv_va
      AND RETURN.

  TRY ."可以获取MB52
      cl_salv_bs_runtime_info=>get_data_ref(
        IMPORTING r_data = lr_pay_data ).

      ASSIGN lr_pay_data->* TO <lt_pay_data>.

    CATCH  cx_salv_bs_sc_runtime_info.
      MESSAGE '无法获取ALV数据'  TYPE  'E'.
  ENDTRY.
  cl_salv_bs_runtime_info=>clear_all( ).

  IF <lt_pay_data> IS ASSIGNED.
    LOOP AT <lt_pay_data> ASSIGNING <ls_data>.
      MOVE-CORRESPONDING <ls_data> TO itab_data.
      IF lw_coas IS NOT INITIAL.
        itab_data-aufnr = p_aufnr.
        itab_data-ktext = lw_coas-ktext.
      ENDIF.
      itab_data-bukrs = lw_t001-bukrs.
      itab_data-butxt = lw_t001-butxt.
      APPEND itab_data.
      CLEAR:  itab_data.
    ENDLOOP.
    CLEAR: lw_coas,lw_t001.
  ENDIF.
ENDFORM.

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/1271791.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

护眼灯对眼睛有好处吗?考公护眼台灯推荐

根据国家卫健委发布的最新数据&#xff0c;目前我国儿童青少年近视率已经达到了相当高的水平。其中&#xff0c;小学生的视力问题占比接近40%&#xff0c;高中生和大学生的近视率则超过70%并且逐年上升。可以说10个学生里面就有7个学生入手一副眼镜。 为了避免这一现象的加深&a…

【Java】文件I/O-字节流转换成字符流

上文中我们讲了Reader&#xff0c;Writer&#xff0c;InputStream&#xff0c;OutputStream这四种流的基本用法&#x1f522; 【Java】文件I/O-文件内容操作-输入输出流-Reader/Writer/InputStream/OutputStream四种流 其中InputStream和OutputStream两个类涉及到的都是byte&…

Small Data Transmission(一) overview

在R16之前,RRC Inactive 不支持数据传输,UE在RRC inactive状态有data要传输时,就要通过RRC resume过程,转换到RRC connected mode才能进行数据传输。 有时候UE要传输的数据包可能会很小,且发送频率也很低,如果每次发送数据都要进行上述过程,就会增加不必要的功耗和信令…

会泽一村民上山放羊吸烟引发森林火灾,AI科技急需关注

2023年4月&#xff0c;会泽县古城街道厂沟村委会望香台山林中发生了一场由疏忽引发的森林火灾。张某某在放羊时未完全熄灭烟头&#xff0c;导致7.33公顷的林地和草地被焚毁&#xff0c;直接经济损失高达29.097万元。这一事件再次凸显了日常生活中的安全隐患。 在这一背景下&…

基于 Gin 的 HTTP 代理 Demo(2)

一周后勘误&#xff1a; 我这里实现的严格来说还是 HTTP 代理&#xff0c;只不过是通过隧道的方式传输非 HTTP 的流量&#xff0c;这里是 HTTPS 流量。尽管它可以传输 HTTPS 流量&#xff0c;它也不算是 HTTPS 代理。 上次写了 基于 Gin 的 HTTP 代理 Demo 之后&#xff0c;对…

如何搭建外网可访问的Serv-U FTP服务器,轻松远程共享文件!

目录 1. 前言 2. 本地FTP搭建 2.1 Serv-U下载和安装 2.2 Serv-U共享网页测试 2.3 Cpolar下载和安装 3. 本地FTP发布 3.1 Cpolar云端设置 3.2 Cpolar本地设置 4. 公网访问测试 5. 总结 1. 前言 科技日益发展的今天&#xff0c;移动电子设备似乎成了我们生活的主角&am…

【算法每日一练]-图论(保姆级教程篇9 最小生成树 ,并查集篇)#道路修建 #兽径管理

目录 题目&#xff1a;道路修建 思路&#xff1a; 题目&#xff1a;兽径管理 思路&#xff1a; 题目&#xff1a;道路修建 思路&#xff1a; “让这些点全部连在一起的最小代价”很明显是最小生成树。绝对不能kruskal&#xff0c;存边一定会超内存。所以只能prim。 但是…

明基|书客|松下护眼台灯值不值得买?爆款多维度测评揭晓!

随着近视率越来越高的现象&#xff0c;护眼台灯逐渐成为大多数家庭的日常所需&#xff0c;许多护眼台灯品牌为了降低价格吸引消费者而不惜大程度上降低材料品质&#xff0c;导致台灯寿命减短&#xff0c;光线变差等问题频发&#xff0c;这也让广大对于如何选择一款好的护眼台灯…

职业测评链接

职业测评链接&#xff1a; https://www.16personalities.com/ch?utm_sourceresults-turbulent-campaigner&amp%3Butm_mediumemail&amp%3Butm_campaignch&amp%3Butm_contentlogo-0

性能测试线上监控

如果你的产品出现了一个线上问题&#xff0c;你会是怎么样的反应&#xff1f; 也许会跟下面这张图一样。 哇&#xff01;有一个线上bug&#xff0c;好慌呀&#xff01;&#xff01; 咦&#xff0c;问题似乎自动解决了&#xff1f;渐渐冷静。 不对&#xff01;&#xff01;&a…

2023-11-30 AIGC-让图片动起来的主流 AI 工具

摘要&#xff1a; 2023-11-30 AIGC-让图片动起来的主流 AI 工具 让图片动起来的主流 AI 工具 一、数字人播报 1、HeyGen 2、D-ID 3、SadTalker 二、图片生成视频 1、Runway Gen-2 2、Pika Labs 3、Genmo 三、伪3D动态效果 1、LeiaPix 2、剪映手机版 四、角色动画 Animated …

样品实验K-KAT348羧酸铋催化剂TDS说明书

样品实验K-KAT348羧酸铋催化剂TDS说明书 50克 100克 200克

【Axure教程】用中继器制作多选树

“多选树”可能指的是一种用户界面元素&#xff0c;用于展示层级结构并允许用户选择多个节点。这在软件应用程序中常用于设置、文件浏览器等场景。 Axure里面虽然自带了一个树元件&#xff0c;但是并没有多选的功能&#xff0c;所以今天就教大家如何用中继器制作一个多选树的基…

【动态规划】01第 N 个泰波那契数(easy)

题目链接 &#xff1a;leetcode第 N 个泰波那契数 目录 题目解析&#xff1a; 算法原理 1.状态表示 2.状态转移方程 3.初始化 4.填表顺序 5.返回值 编写代码 题目解析&#xff1a; 题目让我们求第n个数的泰波那契数。 由题可得&#xff1a; 我们可以把它改写为&#…

唯品会年度特卖大会㊙内购清单㊙

唯品会年度特卖大会㊙内购清单㊙ 内部员工亲友专享&#xff0c;实实在在省钱&#xff0c;❌抢完不补! 今晚8点开抢&#xff0c;提前收藏>> https://t.vip.com/Im3KlTnDSJ8 2023年唯品会年度特卖大会热门会场推荐 1.唯品会年度特卖大会 限时加码!瓜分百万津贴!抢海量…

【UE】简单的警觉系统

效果 步骤 1. 新建一个空白工程&#xff0c;添加第三人称游戏内容包 2. 打开第三人称角色蓝图“BP_ThirdPersonCharacter” 选中弹簧臂组件&#xff0c;将目标臂长度设置为600&#xff0c;z轴方向的插槽偏移设置为100 3. 将“BP_ThirdPersonCharacter”移入场景&#xff0c;该…

学习笔记三十六:通过Ingress-nginx实现灰度发布

通过Ingress-nginx实现灰度发布 灰度发布原理将新版本灰度给部分用户切一定比例的流量给新版本 部署两个版本的服务以 nginx 为例&#xff0c;先部署一个 v1 版本:部署一个 v2 版本再创建一个 Ingress&#xff0c;对外暴露服务&#xff0c;指向 v1 版本的服务:访问验证 基于 He…

C语言——多种方式打印出1000之内的所有的“水仙花数”

所谓水仙花数,是指一个3位数,其各位数字立方和等于该数本身。水仙花数是指一个三位数&#xff0c;它的每个位上的数字的立方和等于它本身。例如&#xff0c;153是一个水仙花数&#xff0c;因为1^3 5^3 3^3 153。 方法一 #define _CRT_SECURE_NO_WARNINGS 1#include <std…

git报错invalid object xxx和unable to read tree xxxxxx

电脑出问题了&#xff0c;导致git仓库像是被损坏了一样&#xff0c;执行git status就会报错unable to read ree&#xff0c;无法正常提交代码至仓库&#xff0c;原因是本地代码仓库.git文件损坏了&#xff0c;无法找到正确的提交历史和路径。 找到了一个解决办法&#xff1a; …

TSINGSEE青犀AI视频智能分析系统的视频接入能力解析

视频智能分析技术是一种先进的人工智能技术&#xff0c;它能够对视频内容进行自动化的分析和理解。这种技术的主要特点包括实时性、自动化、准确性、可解释性等。 1&#xff09;实时性。视频智能分析技术能够在短时间内对大量的视频数据进行快速处理和分析&#xff0c;从而提供…