码迷,mamicode.com
首页 > 其他好文 > 详细

EBS Report开发案例

时间:2017-08-26 15:58:30      阅读:171      评论:0      收藏:0      [点我收藏+]

标签:init   errbuf   nan   his   span   esc   _id   rip   oop   

1.写包:
包头:

CREATE OR REPLACE PACKAGE CUX_FINANCE_DEBUG_REPORT IS

  /* ===============================================================
  *    PROCEDURE NAME: MAIN
  *    AUTHOR      :   LWW
  *    DATE        :   2017-03-08
  *    PURPOSE     :   CUX:财务侦错报告
  *    PARAMETER   :
  *
  *    RETURN      :
  *    UPDATE HISTORY
  *    VERSION    DATE         NAME            DESCRIPTION
  *    --------  ----------  ---------------  --------------------
  *     V1.0     2017-03-08   LWW            CREATION
    ===============================================================*/
  PROCEDURE MAIN
  (
    ERRBUF             OUT VARCHAR2,
    RETCODE            OUT NUMBER,
    p_organization_id in NUMBER
    --p_error_code       varchar2,
  );

END CUX_FINANCE_DEBUG_REPORT;

包体:

CREATE OR REPLACE PACKAGE BODY CUX_FINANCE_DEBUG_REPORT IS

  /* ===============================================================
  *    PROCEDURE NAME: MAIN
  *    AUTHOR      :   LWW
  *    DATE        :   2017-03-08
  *    PURPOSE     :   CUX:财务侦错报告
  *    PARAMETER   :
  *
  *    RETURN      :
  *    UPDATE HISTORY
  *    VERSION    DATE         NAME            DESCRIPTION
  *    --------  ----------  ---------------  --------------------
  *     V1.0     2017-03-08   LWW            CREATION
    ===============================================================*/
  PROCEDURE MAIN
  (
    ERRBUF             OUT VARCHAR2,
    RETCODE            OUT NUMBER,
    p_organization_id  in NUMBER
    --p_error_code       varchar2,
  ) AS
  /*strWhere varchar2;
  
  
  if p_error_code is not null then
    strWhere :=‘and TABLE_TEMP.错误代码=‘||p_error_code;
  end if;*/
  
      CURSOR CUR_ALL IS
         SELECT TABLE_TEMP.组织ID,
       ORG.ORGANIZATION_NAME AS 组织,
       TABLE_TEMP.错误代码,
       TABLE_TEMP.报错描述,
       TABLE_TEMP.单据类型,
       TABLE_TEMP.单据编号,
       TABLE_TEMP.单据日期 AS 单据日期,
       TABLE_TEMP.制单人
FROM (
        --6.‘领料单‘
        SELECT A.ORGANIZATION_ID AS 组织ID,
                6 AS 错误代码,
                领料单已发放,已超过1天未过账,请查核! AS 报错描述,
                工单领料 AS 单据类型,
                A.REQUISITION_NUMBER AS 单据编号,
                A.CREATION_DATE AS 单据日期,
                CUX_PUBLIC_PKG.GET_PERSON_NAME(A.CREATE_PERSON_ID) AS 制单人
          FROM CUX_WIP_STOCK_REQ_HEADERS A
         WHERE A.REQUISITION_STATUS = RELEASE
           AND A.REQUISITION_TYPE = JOBS_P
           AND (SYSDATE - A.CREATION_DATE) >= 1
        UNION ALL
        --7.‘退料单‘
        SELECT B.ORGANIZATION_ID AS 组织ID,
               7 AS 错误代码,
               退料单已发放,已超过1天未过账,请查核! AS 报错描述,
               工单领料 AS 单据类型,
               B.REQUISITION_NUMBER AS 单据编号,
               B.CREATION_DATE AS 单据日期,
               CUX_PUBLIC_PKG.GET_PERSON_NAME(B.CREATE_PERSON_ID) AS 制单人
          FROM CUX_WIP_STOCK_REQ_HEADERS B
         WHERE B.REQUISITION_STATUS = RELEASE
           AND B.REQUISITION_TYPE = JOBS_B
           AND (SYSDATE - B.CREATION_DATE) >= 1
        UNION ALL
        --8.‘超领单‘
        SELECT C.ORGANIZATION_ID AS 组织ID,
               8 AS 错误代码,
               超领单已发放,已超过1天未过账,请查核! AS 报错描述,
               工单领料 AS 单据类型,
               C.REQUISITION_NUMBER AS 单据编号,
               C.CREATION_DATE AS 单据日期,
               CUX_PUBLIC_PKG.GET_PERSON_NAME(C.CREATE_PERSON_ID) AS 制单人
          FROM CUX_WIP_STOCK_REQ_HEADERS C
         WHERE C.REQUISITION_STATUS = RELEASE
           AND C.REQUISITION_TYPE = PUSH_P
           AND (SYSDATE - C.CREATION_DATE) >= 1
        UNION ALL
        --9.‘完工入库‘
        SELECT D.ORGANIZATION_ID AS 组织ID,
               9 AS 错误代码,
               完工入库单已申请,已超过1天未过账,请查核! AS 报错描述,
               工单入库 AS 单据类型,
               D.TRANSACTION_NUM AS 单据编号,
               D.CREATION_DATE AS 单据日期,
               CUX_PUBLIC_PKG.GET_EMPLOYEE_NAME(D.CREATED_BY) AS 制单人
          FROM CUX_BUWWIP_MOVE_TRANS_HEADERS D
         WHERE D.TRANSACTION_STATUS = RELEASED
           AND D.TRANSACTION_TYPE = WIP_COMP
           AND (SYSDATE - D.CREATION_DATE) >= 1
        UNION ALL
        --10.‘完工退回‘
        SELECT E.ORGANIZATION_ID AS 组织ID,
               10 AS 错误代码,
               完工退回单已申请,已超过1天未过账,请查核! AS 报错描述,
               工单入库 AS 单据类型,
               E.TRANSACTION_NUM AS 单据编号,
               E.CREATION_DATE AS 单据日期,
               CUX_PUBLIC_PKG.GET_EMPLOYEE_NAME(E.CREATED_BY) AS 制单人
          FROM CUX_BUWWIP_MOVE_TRANS_HEADERS E
         WHERE E.TRANSACTION_STATUS = RELEASED
           AND E.TRANSACTION_TYPE = WIP_COMP_F
           AND (SYSDATE - E.CREATION_DATE) >= 1
        UNION ALL
        --11.‘已完工,但尚未报工‘
        SELECT TABLE11.ORGANIZATION_ID AS 组织ID,
               11 AS 错误代码,
               工单已完工,但尚未报工,请查核! AS 报错描述,
               工单控制 AS 单据类型,
               TABLE11.WIP_ENTITY_NAME AS 单据编号,
               TABLE11.SCHEDULED_START_DATE AS 单据日期,
               CUX_PUBLIC_PKG.GET_EMPLOYEE_NAME(TABLE11.CREATED_BY) AS 制单人
          FROM (SELECT A.ORGANIZATION_ID,
                       A.WIP_ENTITY_NAME,
                       SUM(C.QUANTITY_COMPLETED) AS BG_SUM,
                       B.SCHEDULED_START_DATE,
                       A.CREATED_BY
                  FROM WIP_ENTITIES A
                 INNER JOIN WIP_DISCRETE_JOBS B
                    ON B.WIP_ENTITY_ID = A.WIP_ENTITY_ID
                 INNER JOIN WIP_OPERATIONS C
                    ON C.WIP_ENTITY_ID = A.WIP_ENTITY_ID
                 WHERE B.STATUS_TYPE = 4 AND B.CLASS_CODE<>M4-试制
                 GROUP BY A.ORGANIZATION_ID,
                          A.WIP_ENTITY_NAME,
                          B.SCHEDULED_START_DATE,
                          A.CREATED_BY) TABLE11
         WHERE TABLE11.BG_SUM = 0
        UNION ALL
        --12‘已有完工入库,但尚未领料‘
        SELECT TABLE12.ORGANIZATION_ID AS 组织ID,
               12 AS 错误代码,
               工单已有完工入库,但尚未领料,请查核! AS 报错描述,
               工单控制 AS 单据类型,
               TABLE12.WIP_ENTITY_NAME AS 单据编号,
               TABLE12.SCHEDULED_START_DATE AS 单据日期,
               CUX_PUBLIC_PKG.GET_EMPLOYEE_NAME(TABLE12.CREATED_BY) AS 制单人
          FROM (SELECT A.ORGANIZATION_ID,
                       A.WIP_ENTITY_NAME,
                       B.QUANTITY_COMPLETED,
                       SUM(C.QUANTITY_ISSUED) AS LL_SUM,
                       B.SCHEDULED_START_DATE,
                       A.CREATED_BY
                  FROM WIP_ENTITIES A
                 INNER JOIN WIP_DISCRETE_JOBS B
                    ON B.WIP_ENTITY_ID = A.WIP_ENTITY_ID
                 INNER JOIN WIP_REQUIREMENT_OPERATIONS C
                    ON C.WIP_ENTITY_ID = A.WIP_ENTITY_ID
                 GROUP BY A.ORGANIZATION_ID,
                          A.WIP_ENTITY_NAME,
                          B.QUANTITY_COMPLETED,
                          B.SCHEDULED_START_DATE,
                          A.CREATED_BY) TABLE12
         WHERE TABLE12.QUANTITY_COMPLETED > 0
           AND TABLE12.LL_SUM = 0
        UNION ALL
        --13‘已完工,已领料,已报工,状态需切换‘
        SELECT TABLE13.ORGANIZATION_ID AS 组织ID,
               13 AS 错误代码,
               工单已完工入库,已充分领料并报工,请及时将工单【状态】修改为"完工-不计费"! AS 报错描述,
               工单控制 AS 单据类型,
               TABLE13.WIP_ENTITY_NAME AS 单据编号,
               TABLE13.SCHEDULED_START_DATE AS 单据日期,
               CUX_PUBLIC_PKG.GET_EMPLOYEE_NAME(TABLE13.CREATED_BY) AS 制单人
          FROM (SELECT A.ORGANIZATION_ID,
                       A.WIP_ENTITY_NAME,
                       SUM(C.QUANTITY_COMPLETED) AS BG_SUM,
                       SUM(D.QUANTITY_ISSUED) AS LL_SUM,
                       B.SCHEDULED_START_DATE,
                       A.CREATED_BY
                  FROM WIP_ENTITIES A
                 INNER JOIN WIP_DISCRETE_JOBS B
                    ON B.WIP_ENTITY_ID = A.WIP_ENTITY_ID
                 INNER JOIN WIP_OPERATIONS C
                    ON C.WIP_ENTITY_ID = A.WIP_ENTITY_ID
                 INNER JOIN WIP_REQUIREMENT_OPERATIONS D
                    ON D.WIP_ENTITY_ID = A.WIP_ENTITY_ID
                 WHERE B.STATUS_TYPE = 4
                 GROUP BY A.ORGANIZATION_ID,
                          A.WIP_ENTITY_NAME,
                          B.SCHEDULED_START_DATE,
                          A.CREATED_BY) TABLE13
         WHERE TABLE13.LL_SUM <> 0
           AND TABLE13.BG_SUM <> 0
        /*UNION ALL
        --14‘报工数量<>转移数量‘--某些工单导入EBS成功,但移动事务处理没有产生记录
        SELECT TABLE14.ORGANIZATION_ID AS 组织ID,
               ‘14‘ AS 错误代码,
               ‘工单对应工序‘ || TABLE14.OPERATION_SEQ_NUM_S || ‘的报工数量不等于转移数量,请查核!‘ AS 报错提示,
               ‘工单控制‘ AS 单据类型,
               TABLE14.WIP_ENTITY_NAME AS 单据编号,
               TABLE14.SCHEDULED_START_DATE AS 单据日期
          FROM (SELECT DISTINCT A.ORGANIZATION_ID,A.WIP_ENTITY_ID,
                                A.WIP_ENTITY_NAME,
                                D.OPERATION_SEQ_NUM_S,
                                C.QUANTITY_COMPLETED AS BG_SUM, --报工数量(取报工界面上的总报工数)
                                B.SCHEDULED_START_DATE,
                                (SELECT NVL(SUM(E.TRANSACTION_QUANTITY), 0)
                                   FROM WIP_ENTITIES D
                                  INNER JOIN WIP_MOVE_TRANSACTIONS E
                                     ON E.WIP_ENTITY_ID = D.WIP_ENTITY_ID
                                  WHERE D.WIP_ENTITY_NAME = A.WIP_ENTITY_NAME
                                    --AND E.FM_INTRAOPERATION_STEP_TYPE = 1
                                    --AND E.TO_INTRAOPERATION_STEP_TYPE = 3
                                    AND E.FM_OPERATION_SEQ_NUM =
                                        D.OPERATION_SEQ_NUM_S) AS ZY_SUM --转移数量
                  FROM WIP_ENTITIES A
                 INNER JOIN CUX_WIP_MOVE_RESOURCES D ON A.WIP_ENTITY_ID=D.WIP_ENTITY_ID
                 INNER JOIN WIP_DISCRETE_JOBS B
                    ON B.WIP_ENTITY_ID = A.WIP_ENTITY_ID
                 INNER JOIN WIP_OPERATIONS C
                    ON C.WIP_ENTITY_ID = A.WIP_ENTITY_ID AND C.OPERATION_SEQ_NUM=D.OPERATION_SEQ_NUM_S
                ) TABLE14
         WHERE TABLE14.BG_SUM <> TABLE14.ZY_SUM*/
  ) TABLE_TEMP
 INNER JOIN ORG_ORGANIZATION_DEFINITIONS ORG ON TABLE_TEMP.组织ID = ORG.ORGANIZATION_ID
 where ORG.ORGANIZATION_ID=p_organization_id;

 BEGIN 
    ERRBUF  := OK;
    RETCODE := 0;
    FND_FILE.PUT_LINE(FND_FILE.OUTPUT,
                      <?xml version = ‘‘‘ || 1.0 || ‘‘‘ encoding =  || ‘‘‘UTF-8 || ‘‘‘?>);
    FND_FILE.PUT_LINE(FND_FILE.OUTPUT,<G1>);
    --FND_FILE.PUT_LINE(FND_FILE.OUTPUT, ‘<TIME>‘ || TO_CHAR(SYSDATE,‘YYYY-MM-DD hh24:mi:ss‘) || ‘</TIME>‘);
    FOR CUR_ROW IN CUR_ALL LOOP
          FND_FILE.PUT_LINE(FND_FILE.OUTPUT,<G_LINES>);
          FND_FILE.PUT_LINE(FND_FILE.OUTPUT,<organization_code> || CUR_ROW.组织ID|| </organization_code>);
          FND_FILE.PUT_LINE(FND_FILE.OUTPUT,<organization_name> || CUR_ROW.组织|| </organization_name>);
          FND_FILE.PUT_LINE(FND_FILE.OUTPUT,<error_code> || CUR_ROW.错误代码 ||</error_code>);
          FND_FILE.PUT_LINE(FND_FILE.OUTPUT,<error_content> || CUR_ROW.报错描述 ||</error_content>);
          FND_FILE.PUT_LINE(FND_FILE.OUTPUT,<doc_type> || CUR_ROW.单据类型 ||</doc_type>);
          FND_FILE.PUT_LINE(FND_FILE.OUTPUT,<doc_number> || CUR_ROW.单据编号 ||</doc_number>);
          FND_FILE.PUT_LINE(FND_FILE.OUTPUT,<doc_date> || TO_CHAR(CUR_ROW.单据日期,YYYY-MM-DD) ||</doc_date>);
          FND_FILE.PUT_LINE(FND_FILE.OUTPUT,<doc_man> || CUR_ROW.制单人 ||</doc_man>);
          FND_FILE.PUT_LINE(FND_FILE.OUTPUT,</G_LINES>);
      END LOOP;
    FND_FILE.PUT_LINE(FND_FILE.OUTPUT,</G1>);
    
    fnd_file.put_line(fnd_file.LOG,
                      **************************************************************);
    fnd_file.put_line(fnd_file.LOG,
                      程序开始运行   ||
                      TO_CHAR(SYSDATE, yyyy-mm-dd hh24:mi:ss));
    fnd_file.put_line(fnd_file.LOG, p_organization_id== ||  p_organization_id);

  EXCEPTION
    WHEN OTHERS THEN
      RETCODE := 2;
      ERRBUF := 异常:||SQLERRM||代码行:||DBMS_UTILITY.FORMAT_ERROR_BACKTRACE;
      FND_FILE.PUT_LINE(FND_FILE.LOG,ERRBUF);
  END MAIN;

END CUX_FINANCE_DEBUG_REPORT;

2.建模板(可拿原有的rtf模板,在它的基础上修改)

链接:http://pan.baidu.com/s/1hrDMiLe 密码:k8ug

3.定义可执行程序
技术分享

4.定义并发程序

技术分享

5.上传rtf模板

技术分享

6.跑报表请求

EBS Report开发案例

标签:init   errbuf   nan   his   span   esc   _id   rip   oop   

原文地址:http://www.cnblogs.com/doraemon45/p/7435402.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!