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

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

下面展示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.

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

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈qq邮箱809451989@qq.com,一经查实,立即删除!

相关文章

[NOIP2016 普及组] 回文日期

枚举好题&#xff0c;直接枚举答案 看看在不在范围内就行了 注意二月份 92200229是合法的~ 82200228也是合法的&#xff01; #include<bits/stdc.h> using namespace std;map<int,int>mp;int main() {mp[1] mp[3] mp[5] mp[7] mp[8] mp[10] mp[12] 31;mp[…

MMdetection3.0 问题

MMdetection3.0 问题 希望各位路过的大佬指教一下&#xff1a; 问题&#xff1a; 1、NWPU-VHR-10有标注的数据一共650张&#xff0c;我将其分为了455张训练集&#xff0c;195张验证集。 2、然后使用MMdetection3.0框架中的Faster-rcnn网络进行训练&#xff0c;设置训练参数b…

微信小程序体验版提交审核,提示接口未配置在app.json文件且无权限

在火狐浏览器 打开微信公众平台 发布小程序 弹窗一闪而过 是因为 放开这里就可以了

selenium元素定位方法之xpath

什么是xpath&#xff1f; XPath是XML的路径语言&#xff0c;通俗一点讲就是通过元素的路径来查找到这个标签元素XPath使用路径表达式在XML文档中进行导航 普通语法 注意&#xff01; 1.xpath中的值用引号引起来时&#xff0c;在代码中要注意区分&#xff0c;内单外双&#xf…

Intellij IDEA 的安装和使用以及配置

IDE有很多种&#xff0c;常见的Eclipse、MyEclipse、Intellij IDEA、JBuilder、NetBeans等。但是这些IDE中目前比较火的是Intellij IDEA&#xff08;以下简称IDEA&#xff09;&#xff0c;被众多Java程序员视为最好用的Java集成开发环境&#xff0c;今天的主题就是IDEA为开发工…

【Qt基础之QPalette实例电子时钟】

# 简介 借助`QLCDNumber`实现电子时钟,可以随意拖拽到桌面任意位置,鼠标右键进行关闭,用于实践`QPalette`类、`QTimer`的使用以及`mousePressEvent`\`mouseMoveEvent`\`mouseDoubleClickEvent`事件处理函数的使用。可在此基础上扩展其他应用,参看Qt帮助手册。 # QPalette …

homeassistant 随笔

1.使用mushroom-strategy自动生成ui&#xff0c;隐藏中文ares&#xff0c;名字为区域的拼音&#xff0c;例如显示厨房则真实名字为chu_fang 隐藏图片中的工作室 代码为&#xff1a;

ACM程序设计课内实验(2) 排序问题

基础知识‘ sort函数 C中的sort函数是库中的一个函数&#xff0c;用于对容器中的元素进行排序。它的原型如下&#xff1a; template <class RandomAccessIterator, class Compare> void sort (RandomAccessIterator first, RandomAccessIterator last, Compare comp);参数…

代码随想录算法训练营第四十八天【动态规划part09】 | 198.打家劫舍、213.打家劫舍II、337.打家劫舍III

198.打家劫舍 题目链接&#xff1a; 力扣&#xff08;LeetCode&#xff09;官网 - 全球极客挚爱的技术成长平台 求解思路&#xff1a; 当前房屋偷与不偷取决于前一个房屋是否被偷了 动规五部曲 确定dp数组及其下标含义&#xff1a;考虑下标i&#xff08;包括i&#xff09…

用户注册这样玩,保你平安

前言 基本上每个系统系统都包含用户注册、发送验证码等基本操作。在前些年&#xff0c;我还记得我在逛 csdn、贴吧、网易新闻等网站的时候是可以不登陆也能浏览完网页内容的&#xff0c;但是近几年这些网站已经改成了不登陆不让用&#xff0c;浏览网页时不时提醒你要进行登录&…

finebi 新手入门案例

finebi 新手入门案例 连锁超市销售数据分析 步骤&#xff1a; 准备公共数据新建分析主题处理数据在数据中分析在图形中分析数据大屏 准备公共数据 点击公共数据 点击新建文件夹 修改文件夹名称 上传数据 鼠标悬停在文件夹上&#xff0c;右侧出现 鼠标悬停在文件夹上&#x…

ESP32-Web-Server编程- 通过 Highcharts 创建图表(Chart)实时显示设备信息

ESP32-Web-Server编程- 通过 Highcharts 创建图表&#xff08;Chart&#xff09;实时显示设备信息 概述 上节讲述了通过 Server-Sent Events&#xff08;以下简称 SSE&#xff09; 实现在网页实时更新 ESP32 Web 服务器的传感器数据&#xff0c;并通过表格显示传感器的数据。…

Python中的Slice函数:灵活而强大的序列切片技术

更多资料获取 &#x1f4da; 个人网站&#xff1a;ipengtao.com Python中的Slice函数是一种强大且灵活的序列切片技术&#xff0c;用于从字符串、列表、元组等序列类型中提取子集。本文将深入研究Slice函数的功能和用法&#xff0c;提供详细的示例代码和解释&#xff0c;帮助读…

学习k8s的介绍(一)

一、kubernetes及Docker相关介绍 1、kubernetes是什么 1-1、简称为k8s或kube&#xff0c;是一个可移植、可扩展的开源平台&#xff0c;用于管理容器化的工作负载和服务&#xff0c;可促进声明式配置和自动化。 声明式配置语法&#xff1a; kubectl create/apply/delete -f xx…

酷狗音乐app 评论signature

文章目录 声明目标加密参数定位翻页逻辑代码实现 声明 本文章中所有内容仅供学习交流&#xff0c;严禁用于商业用途和非法用途&#xff0c;否则由此产生的一切后果均与作者无关&#xff0c;若有侵权&#xff0c;请私信我立即删除&#xff01; 目标 复制curl转python # -*- c…

下载MySQL JDBC驱动的方法

说明 java代码通过JDBC访问MySQL数据库&#xff0c;需要MySQL JDBC驱动。 例如&#xff0c;下面这段代码&#xff0c;因为找不到JDBC驱动&#xff0c;所以执行会报异常&#xff1a; package com.thb;public class JDBCDemo {public static void main(String[] args) throws …

特征变换1

编译工具&#xff1a;PyCharm 有些编译工具不用写print可以直接将数据打印出来&#xff0c;pycharm需要写print才会打印出来。 概念 1.特征类型 特征的类型&#xff1a;“离散型”和“连续型” 机器学习算法对特征的类型是有要求的&#xff0c;不是任意类型的特征都可以随意…

Mybatisplus同时向两张表里插入数据[事务的一致性]

一、需求&#xff1a;把靶器官的数据&#xff0c;单独拿出来作为一个从表&#xff0c;以List的方式接收这段数据&#xff1b; 此时分析&#xff0c;是需要有两个实体的&#xff0c;一个是主表的实体&#xff0c;一个是从表的实体&#xff0c;并在主表实体新增一个List 字段来接…

Vue - Vue配置proxy代理,开发、测试、生产环境

1、新建三个环境的配置文件 在src同级目录也就是根目录下新建文件&#xff1a;.env.development&#xff08;开发环境&#xff09;、.env.test&#xff08;测试环境&#xff09;、.env.production文件&#xff08;生产环境&#xff09; 2、三个环境的配置文件 开发环境 .env…

木鸟途家美团......订民宿选哪个?看完让你不纠结

近日&#xff0c;中国旅游研究院在报告中提到&#xff0c;截至2023年6月&#xff0c;我国在线旅行预订用户规模达4.54亿&#xff0c;占网民整体的42.1%。民宿预订平台作为重要的组成部分&#xff0c;正在被更多人了解使用。当前民宿行业第一梯队木鸟、途家、美团三家&#xff0…