• ERP查询Q报表开发代码


    一,按照一般ERP开发流程可参考ERP开发流程,直到下载程序。

    当我们的查询页签存在栏位需要判断或者特殊处理时,在global中的自定义模组变数下添加,例如:

    复制代码
     1 #add-point:自定義模組變數-客製(Module Variable) name="global.variable_customerization"
     2 
     3 DEFINE g_first_flag           LIKE type_t.num5
     4 PRIVATE TYPE type_master      RECORD
     5    startdate               LIKE type_t.dat, 
     6    enddate                 LIKE type_t.dat
     7 END RECORD
     8 DEFINE g_master            type_master 
     9 
    10 #end add-point
    复制代码

    init下是对页面初始化,在页面资产初始化可以对栏位赋初值,设置下拉框等

    复制代码
       #add-point:畫面資料初始化 name="init.init"
       LET g_first_flag = TRUE
       LET g_master.startdate = ''
       LET g_master.enddate = ''
       ## CALL cpmq700_cre_tmp_table()
       #end add-point
    
    #或者
    
       #add-point:畫面資料初始化 name="init.init"
       CALL cl_set_combo_scc_part('b_imaaud001','18006','1,2')    #b_imaaud001代表那个页面栏位,18006是下拉框代码
       LET g_first_flag = TRUE
       #end add-point
    复制代码

     ui_dialog下搜索DIALOG ATTRIBUTES,里面添加栏位的逻辑。可参考filter下的栏位逻辑。

    复制代码
    CONSTRUCT BY NAME g_wc ON imaastus,imaa001,imaal003,imaal004,imaa009,imaa003,imaa010,imaa004,imaaud001,imaaud006
             
                BEFORE CONSTRUCT
                
                ON ACTION controlp INFIELD imaastus
                   
                ON ACTION controlp INFIELD imaa001          
                   INITIALIZE g_qryparam.* TO NULL
                   LET g_qryparam.state = 'c'
                   LET g_qryparam.reqry = FALSE
                   CALL q_imaa001()                           #呼叫開窗
                   DISPLAY g_qryparam.return1 TO imaa001      #顯示到畫面上
                   NEXT FIELD imaa001                         #返回原欄位
                   
                ON ACTION controlp INFIELD imaal003
                   
                ON ACTION controlp INFIELD imaal004
                   
                ON ACTION controlp INFIELD imaa009          
                   INITIALIZE g_qryparam.* TO NULL
                   LET g_qryparam.state = 'c'
                   LET g_qryparam.reqry = FALSE
                   CALL q_rtax001()                           #呼叫開窗
                   DISPLAY g_qryparam.return1 TO imaa009      #顯示到畫面上
                   NEXT FIELD imaa009                         #返回原欄位
                
                ON ACTION controlp INFIELD imaa003          
                   INITIALIZE g_qryparam.* TO NULL
                   LET g_qryparam.state = 'c'
                   LET g_qryparam.reqry = FALSE
                   CALL q_imca001_1()                         #呼叫開窗
                   DISPLAY g_qryparam.return1 TO imaa003      #顯示到畫面上
                   NEXT FIELD imaa003                         #返回原欄位
                
                ON ACTION controlp INFIELD imaa010          
                   INITIALIZE g_qryparam.* TO NULL
                   LET g_qryparam.state = 'c'
                   LET g_qryparam.reqry = FALSE
                   CALL q_imaa010_1()                           #呼叫開窗
                   DISPLAY g_qryparam.return1 TO imaa010      #顯示到畫面上
                   NEXT FIELD imaa010                         #返回原欄位
                
                ON ACTION controlp INFIELD imaa004
                         
                ON ACTION controlp INFIELD imaaud001
                                     
                ON ACTION controlp INFIELD imaaud006
             
             END CONSTRUCT
    复制代码

    ui_dialog下搜索accept,对判断点击后变量赋值

               LET g_first_flag = FALSE

    b_fill下搜索b_fill.array_clear,在里面添加调用函数的逻辑

    复制代码
       IF g_first_flag THEN
          RETURN
       ELSE
          LET ls_wc = cl_replace_str(ls_wc,'1=2','1=1')
          CALL cimq200_b_fill_sc(ls_wc)
          RETURN
       END IF
    复制代码

    写自己的方法

    复制代码
    PRIVATE FUNCTION cimq200_b_fill_sc(p_wc)
    DEFINE p_wc                STRING
    DEFINE l_sql               STRING
    
       CALL g_imaa_d.clear()
       LET g_cnt = l_ac
       IF g_cnt = 0 THEN
          LET g_cnt = 1
       END IF
       LET l_ac = 1
    
       LET l_sql = " SELECT 0 imaaseq,imaastus,imaa001,imaal003, ",
                   " imaal004,imaa009,rtaxl003,imaa003, ",
                   " a.oocql004,imaa004,imaa010,b.oocql004 oocql010,imaa006,imaaud001, ",
                   " imaaud004,imaaud006,imaaud011 ",
                   "   FROM imaa_t ",
                   "   LEFT JOIN imaal_t ON imaa001=imaal001 AND imaaent=imaalent AND imaal002 = '",g_dlang,"'",
                   "   LEFT JOIN rtaxl_t ON imaa009=rtaxl001 AND imaaent=rtaxlent AND rtaxl002 = '",g_dlang,"'",
                   "   LEFT JOIN oocql_t a ON imaa003=a.oocql002 AND imaaent=a.oocqlent AND a.oocql001 = '200' AND a.oocql003 = '",g_dlang,"'",
                   "   LEFT JOIN oocql_t b ON imaa010=b.oocql002 AND imaaent=b.oocqlent AND b.oocql001 = '210' AND b.oocql003 = '",g_dlang,"'",
                   "  WHERE imaaent = ",g_enterprise,
                   "    AND ",p_wc CLIPPED
       DISPLAY l_sql            
       PREPARE cimq200_b_fill_cs_pre FROM l_sql
       DECLARE cimq200_b_fill_cs_cur CURSOR FOR cimq200_b_fill_cs_pre
       FOREACH cimq200_b_fill_cs_cur INTO g_imaa_d[l_ac].*
       
          #加项次
          LET g_imaa_d[l_ac].imaaseq=l_ac
          #料件属性显示汉字代替
          CASE g_imaa_d[l_ac].imaaud001
             WHEN 1
                LET g_imaa_d[l_ac].imaaud001 = '五金'
             WHEN 2
                LET g_imaa_d[l_ac].imaaud001 = '注塑'
          END CASE
          #料件是否关键物料
          CASE g_imaa_d[l_ac].imaaud006
             WHEN 'Y'
                LET g_imaa_d[l_ac].imaaud006 = ''
             WHEN 'N'
                LET g_imaa_d[l_ac].imaaud006 = ''
          END CASE
          LET l_ac = l_ac + 1
       
       END FOREACH
                   
       
       
       CALL g_imaa_d.deleteElement(g_imaa_d.getLength())
     
       #add-point:陣列長度調整 name="b_fill.array_deleteElement"
    
       #end add-point
     
       LET g_error_show = 0
     
       LET g_detail_cnt = g_imaa_d.getLength()
       LET l_ac = g_cnt
       LET g_cnt = 0
     
    
       #調整單身index指標,避免翻頁後指到空白筆數
       CALL cimq200_detail_index_setting()
     
       #重新計算單身筆數並呈現
    #  CALL cimq200_detail_action_trans()   #(ver:36) mark
     
       LET l_ac = 1
       IF g_imaa_d.getLength() > 0 THEN
          CALL cimq200_b_fill2()
       END IF
     
       CALL cimq200_detail_action_trans()   #(ver:36)
       
    
    END FUNCTION
    复制代码

     

  • 相关阅读:
    JAVA面试题多线程&并发篇(一)
    Etcd教程 — 第五章 Etcd之etcdctl的使用
    共n级台阶,每次可以上1级或2级台阶,有多少种上法?
    LeetCode 面试题 03.03. 堆盘子
    《MySQL实战45讲》——学习笔记18 “索引失效、函数/隐式转换“【建议收藏】
    深度学习-ONNX模型
    深入探究 Next.js 中的 getServerSideProps 和 getStaticProps 用法及区别
    AutoSAR配置与实践(深入篇)8.1 BSW的WatchDog功能(上)
    jvm attach实现一种简单更新rancher上测试环境代码的方法
    Mac上的utools无法找到本地搜索插件
  • 原文地址:https://www.cnblogs.com/sanmulx/p/17526882.html