单档——状态码显示设置,状态码更改链表更新

范例(cxmt631),状态码显示设置(某状态下不显示某些状态码,即有些状态是不可直接更改的为另一种状态的),更改完状态码后同步更新数据表的指定字段;

1)在cxmt631_statechange 中的statechange.before_menu 下,置入程序:

    
      #add-point:menu前 name="statechange.before_menu"
 
      CASE g_xmabuc_m.xmabucstus
           WHEN "X"
                 CALL cl_set_act_visible("report,factory,Load,pass,valid",FALSE)
           WHEN "01"
                 CALL cl_set_act_visible("Loading,pass",FALSE)
           WHEN "02"
                 CALL cl_set_act_visible("pass",FALSE)
           WHEN "03"
                CALL cl_set_act_visible("report",FALSE)
           WHEN "04"
              CALL cl_set_act_visible("factory,report",FALSE)
      END CASE
      #end add-point
      
        

以上的report、factory等,为功能编号,具体见azzi850;

01、02、03、04、X,为状态码编码;

2)每一个状态更改时都同时更新数据表的相关字段,同样是在cxmt631_statechange 下:

ON ACTION invalid
         IF cl_auth_chk_act("invalid") THEN
            LET lc_state = "X"
            #add-point:action控制 name="statechange.invalid"
            update xmabuc_t set xmabuc004 = lc_state where xmabucdocno = g_xmabuc_m.xmabucdocno and xmabucent = g_enterprise
            if not cl_null(g_xmabuc_m.xmabuc009) then
                update xmen_t set xmenua003 = lc_state where xmenent = g_enterprise and xmendocno = g_xmabuc_m.xmabuc009
            end if
            #end add-point
         END IF
         EXIT MENU
      ON ACTION report
         IF cl_auth_chk_act("report") THEN
            LET lc_state = "01"
            #add-point:action控制 name="statechange.report"
            update xmabuc_t set xmabuc004 = lc_state where xmabucdocno = g_xmabuc_m.xmabucdocno and xmabucent = g_enterprise
            if not cl_null(g_xmabuc_m.xmabuc009) then
                update xmen_t set xmenua003 = lc_state where xmenent = g_enterprise and xmendocno = g_xmabuc_m.xmabuc009
            end if
            #end add-point
         END IF
         EXIT MENU

      ON ACTION factory
         IF cl_auth_chk_act("factory") THEN
            LET lc_state = "02"
            #add-point:action控制 name="statechange.factory"
            update xmabuc_t set xmabuc004 = lc_state where xmabucdocno = g_xmabuc_m.xmabucdocno and xmabucent = g_enterprise
            if not cl_null(g_xmabuc_m.xmabuc009) then
                update xmen_t set xmenua003 = lc_state where xmenent = g_enterprise and xmendocno = g_xmabuc_m.xmabuc009
            end if
            #end add-point
         END IF
         EXIT MENU

      ON ACTION loading
         IF cl_auth_chk_act("loading") THEN
            LET lc_state = "03"
            #add-point:action控制 name="statechange.loading"
            update xmabuc_t set xmabuc004 = lc_state where xmabucdocno = g_xmabuc_m.xmabucdocno and xmabucent = g_enterprise
            if not cl_null(g_xmabuc_m.xmabuc009) then
                update xmen_t set xmenua003 = lc_state where xmenent = g_enterprise and xmendocno = g_xmabuc_m.xmabuc009
            end if
            #end add-point
         END IF
         EXIT MENU

      ON ACTION pass
         IF cl_auth_chk_act("pass") THEN
            LET lc_state = "04"
            #add-point:action控制 name="statechange.pass"
            update xmabuc_t set xmabuc004 = lc_state where xmabucdocno = g_xmabuc_m.xmabucdocno and xmabucent = g_enterprise
            if not cl_null(g_xmabuc_m.xmabuc009) then
                update xmen_t set xmenua003 = lc_state where xmenent = g_enterprise and xmendocno = g_xmabuc_m.xmabuc009
            end if
            #end add-point
         END IF
         EXIT MENU

  

原文地址:https://www.cnblogs.com/xiaoli9627/p/6841139.html