• sql_update_2017/11/1


    create or replace procedure yuchuli_update is
    begin
        -----2、更新数据  
        declare
            ----0-17已建会的,除了企业名称(qymc)和地税企业名称(sjqymc)以外的字段都要更新 ---17mins
            cursor dsjh is
                SELECT qyxx.qybm, qyxx.zzjgdm
                  FROM gh_qyxx qyxx, gh_qyghgx qyghgx
                 where qyxx.qybm = qyghgx.qybm
                   and qyghgx.jhzt in ('0',
                                       '1',
                                       '2',
                                       '3',
                                       '4',
                                       '5',
                                       '6',
                                       '7',
                                       '8',
                                       '9',
                                       '10',
                                       '11',
                                       '12',
                                       '13',
                                       '14',
                                       '15',
                                       '16',
                                       '17')
                   and qyxx.zzjgdm is not null
                   and isxz = '0';
            ---------未建会的要更新税务登记状态、个税人数、单位名称
            cursor dsnojh is
                select qy.*,
                       CASE
                           WHEN hs.cjhszt = '0' THEN
                            '0'
                           else
                            '1'
                       end as cjhszt
                  from (SELECT qyxx.qybm, qyxx.zzjgdm, qyxx.sjqymc
                          FROM gh_qyxx qyxx, gh_qyghgx qyghgx
                         where qyxx.qybm = qyghgx.qybm
                           and qyghgx.jhzt in ('18',
                                               '19',
                                               '20',
                                               '21',
                                               '22',
                                               '23',
                                               '24',
                                               '25',
                                               '28')
                           and qyxx.zzjgdm is not null
                           and isxz = '0') qy
                  left join gh_hs hs
                    on qy.qybm = hs.qybm;
            ------匹配三级办数据
            cursor sanjiban is
                select qy.*, dt_enter.*
                  from dt_jczdb_enterprise dt_enter,
                       (select t.* ,qyghgx.GHDM,
                               qyghgx.GHMC,
                               qyghgx.GHLX,
                               qyghgx.ZHLX,
                               qyghgx.QYGHRS,
                               qyghgx.JHZT,
                               qyghgx.JHSJ,
                               qyghgx.SHSJ,
                               qyghgx.JFLCBL,
                               qyghgx.GHDM1,
                               qyghgx.BL1,
                               qyghgx.GHDM2,
                               qyghgx.BL2,
                               qyghgx.GHDM3,
                               qyghgx.BL3,
                               qyghgx.GHDM4,
                               qyghgx.BL4,
                               qyghgx.GHDM5,
                               qyghgx.BL5,
                               qyghgx.GHDM6,
                               qyghgx.BL6,
                               qyghgx.QYJC,
                               qyghgx.sffq
                          from GH_QYXX t
                          left join GH_QYGHGX qyghgx
                            on t.qybm = qyghgx.qybm
                           and t.zzjgdm is not null
                           and (t.isxz = '0' or t.isxz is null)) qy
                 where qy.zzjgdm = dt_enter.code
                    or qy.tyshxydm = dt_enter.code;
            tempCount varchar(1); ---取上级工会
            ghdm1     varchar2(10);
            ghdm2     varchar2(10);
            ghdm3     varchar2(10);
            ghdm4     varchar2(10);
            ghdm5     varchar2(10);
            ghdm6     varchar2(10);
            qycj      varchar2(1);
            --------建会状态为:X-暂不代收-个体工商户 ,但税务登记类型不是个体工商户,建会状态恢复成正常状态
            --------------一级状态保留原状态信息:独立工会/联合工/未建会;二级状态:一级如果是独立工会/联合工会,
            --------------则二级状态为应代收-工会经费;一级如果是未建会,则二级是:应代收-工会经费(筹建中)
            cursor nogtgsh is
                select t.* ,qyghgx.GHDM,
                       qyghgx.GHMC,
                       qyghgx.GHLX,
                       qyghgx.ZHLX,
                       qyghgx.QYGHRS,
                       qyghgx.JHZT,
                       qyghgx.JHSJ,
                       qyghgx.SHSJ,
                       qyghgx.JFLCBL,
                       qyghgx.GHDM1,
                       qyghgx.BL1,
                       qyghgx.GHDM2,
                       qyghgx.BL2,
                       qyghgx.GHDM3,
                       qyghgx.BL3,
                       qyghgx.GHDM4,
                       qyghgx.BL4,
                       qyghgx.GHDM5,
                       qyghgx.BL5,
                       qyghgx.GHDM6,
                       qyghgx.BL6,
                       qyghgx.QYJC,
                       qyghgx.sffq
                  from GH_QYXX t
                  left join GH_QYGHGX qyghgx
                    on t.qybm = qyghgx.qybm
                 where t.qybm = qyghgx.qybm
                   and qyghgx.jhzt in ('8', '17', '25')
                   and t.djzclxdm != '410';
        
            --------登记注册类型为:个体工商户的,则企业信息一级标记:独立工会/联合工会/未建会(保持原企业不变),二级将暂不代收,三类:个体工商户
            cursor gtgsh is
                select t.* ,qyghgx.GHDM,
                       qyghgx.GHMC,
                       qyghgx.GHLX,
                       qyghgx.ZHLX,
                       qyghgx.QYGHRS,
                       qyghgx.JHZT,
                       qyghgx.JHSJ,
                       qyghgx.SHSJ,
                       qyghgx.JFLCBL,
                       qyghgx.GHDM1,
                       qyghgx.BL1,
                       qyghgx.GHDM2,
                       qyghgx.BL2,
                       qyghgx.GHDM3,
                       qyghgx.BL3,
                       qyghgx.GHDM4,
                       qyghgx.BL4,
                       qyghgx.GHDM5,
                       qyghgx.BL5,
                       qyghgx.GHDM6,
                       qyghgx.BL6,
                       qyghgx.QYJC,
                       qyghgx.sffq
                  from GH_QYXX t
                  left join GH_QYGHGX qyghgx
                    on t.qybm = qyghgx.qybm
                 where t.qybm = qyghgx.qybm
                   and t.djzclxdm = '410'
                   and t.istc = '0';
        
        begin
            for rc in dsjh loop
                for dsqyxx_session in (select *
                                         from gh_dsqyxx
                                        where qybm = rc.qybm
                                          and rownum = 1) loop
                    update gh_qyxx
                       set jydz       = dsqyxx_session.jydz, ----经营地址
                           jydzyb     = dsqyxx_session.jydzyb, ---经营地址邮编
                           zcdz       = dsqyxx_session.zcdz, ---注册地址
                           ZCDZYB     = dsqyxx_session.zcdzyb, ---注册地址邮编
                           JYDZLXDM   = dsqyxx_session.jydzlxdm, ---经营地址联系电话
                           GJBZHYDM   = dsqyxx_session.gjbzhydm, ---国家标准行业代码
                           DJZCLXDM   = dsqyxx_session.djzclxdm, ---登记注册类型代码
                           SWJGZZJGDM = CASE
                                            WHEN dsqyxx_session.zgswsdm is not null THEN
                                             dsqyxx_session.zgswsdm
                                            else
                                             dsqyxx_session.zgswjdm
                                        end,
                           SCJXDM     = dsqyxx_session.scjxdm, ---所属街乡代码
                           NSRZTMC    = dsqyxx_session.nsrzt, ---纳税人状态
                           gsrs       = dsqyxx_session.zgrs, ---职工人数
                           KYDJRQ     = dsqyxx_session.kydjrq, ---税务登记日期
                           SWDJLXMC   = dsqyxx_session.swdjlxmc, ---税务登记种类
                           NSRSBH     = dsqyxx_session.nsrsbh ---纳税人识别号
                     where zzjgdm = rc.zzjgdm; ---组织机构代码
                end loop;
            end loop;
        
            ---------未建会的且未核实的更新全部,未建会已核实的除去企业名称(qymc)字段,其他都更新
            for rc in dsnojh loop
                for dsqyxx_session in (select *
                                         from gh_dsqyxx
                                        where qybm = rc.qybm
                                          and rownum = 1) loop
                
                    if (rc.cjhszt = '1') then
                        if (dsqyxx_session.nsrmc != rc.sjqymc) then
                            insert into GH_XTXX
                                (ID,
                                 TITLE,
                                 CONTENT,
                                 YGLXID,
                                 TYPE,
                                 CJSJ,
                                 CZRYDM,
                                 YWLX,
                                 QYGHDM)
                            values
                                (SEQ_XTXX.Nextval,
                                 '地税中企业名称更改' , '在地税系统中,企业名称原先是' || rc.sjqymc ||
                                 ',现在是' || dsqyxx_session.nsrmc,
                                 '0',
                                 '0',
                                 sysdate,
                                 '系统后台' , '0',
                                 rc.qybm);
                        end if;
                        update gh_qyxx
                           set sjqymc     = dsqyxx_session.nsrmc, ---地税企业名称
                               jydz       = dsqyxx_session.jydz, ----经营地址
                               jydzyb     = dsqyxx_session.jydzyb, ---经营地址邮编
                               zcdz       = dsqyxx_session.zcdz, ---注册地址
                               ZCDZYB     = dsqyxx_session.zcdzyb, ---注册地址邮编
                               JYDZLXDM   = dsqyxx_session.jydzlxdm, ---经营地址联系电话
                               GJBZHYDM   = dsqyxx_session.gjbzhydm, ---国家标准行业代码
                               DJZCLXDM   = dsqyxx_session.djzclxdm, ---登记注册类型代码
                               SWJGZZJGDM = CASE
                                                WHEN dsqyxx_session.zgswsdm is not null THEN
                                                 dsqyxx_session.zgswsdm
                                                else
                                                 dsqyxx_session.zgswjdm
                                            end,
                               SCJXDM     = dsqyxx_session.scjxdm, ---所属街乡代码
                               NSRZTMC    = dsqyxx_session.nsrzt, ---纳税人状态
                               gsrs       = dsqyxx_session.zgrs, ---职工人数
                               KYDJRQ     = dsqyxx_session.kydjrq, ---税务登记日期
                               SWDJLXMC   = dsqyxx_session.swdjlxmc, ---税务登记种类
                               NSRSBH     = dsqyxx_session.nsrsbh ---纳税人识别号
                         where zzjgdm = rc.zzjgdm; ---组织机构代码
                    else
                        update gh_qyxx
                           set qymc       = dsqyxx_session.nsrmc, ---企业名称
                               sjqymc     = dsqyxx_session.nsrmc, ---地税企业名称
                               jydz       = dsqyxx_session.jydz, ----经营地址
                               jydzyb     = dsqyxx_session.jydzyb, ---经营地址邮编
                               zcdz       = dsqyxx_session.zcdz, ---注册地址
                               ZCDZYB     = dsqyxx_session.zcdzyb, ---注册地址邮编
                               JYDZLXDM   = dsqyxx_session.jydzlxdm, ---经营地址联系电话
                               GJBZHYDM   = dsqyxx_session.gjbzhydm, ---国家标准行业代码
                               DJZCLXDM   = dsqyxx_session.djzclxdm, ---登记注册类型代码
                               SWJGZZJGDM = CASE
                                                WHEN dsqyxx_session.zgswsdm is not null THEN
                                                 dsqyxx_session.zgswsdm
                                                else
                                                 dsqyxx_session.zgswjdm
                                            end,
                               SCJXDM     = dsqyxx_session.scjxdm, ---所属街乡代码
                               NSRZTMC    = dsqyxx_session.nsrzt, ---纳税人状态
                               gsrs       = dsqyxx_session.zgrs, ---职工人数
                               KYDJRQ     = dsqyxx_session.kydjrq, ---税务登记日期
                               SWDJLXMC   = dsqyxx_session.swdjlxmc, ---税务登记种类
                               NSRSBH     = dsqyxx_session.nsrsbh ---纳税人识别号
                         where zzjgdm = rc.zzjgdm; ---组织机构代码
                    end if;
                end loop;
            end loop;
        
            --三级办更新数据信息
            for rc in sanjiban loop
                ---初始化值
                tempCount := '1';
                ghdm1     := '0';
                ghdm2     := '0';
                ghdm3     := '0';
                ghdm4     := '0';
                ghdm5     := '0';
                ghdm6     := '0';
                qycj      := '1';
                for a in (select * from table(split(rc.recursive_org, ','))) loop
                    if (tempCount = '1') then
                        select nvl(max(swds_id), '0')
                          into ghdm1
                          from dt_street
                         where jczdb_id = a.column_value;
                        qycj := '2';
                    elsif (tempCount = '2') then
                        select nvl(max(swds_id), '0')
                          into ghdm2
                          from dt_street
                         where jczdb_id = a.column_value;
                        qycj := '3';
                    elsif (tempCount = '3') then
                        select nvl(max(swds_id), '0')
                          into ghdm3
                          from dt_street
                         where jczdb_id = a.column_value;
                        qycj := '4';
                    elsif (tempCount = '4') then
                        select nvl(max(swds_id), '0')
                          into ghdm4
                          from dt_street
                         where jczdb_id = a.column_value;
                        qycj := '5';
                    elsif (tempCount = '5') then
                        select nvl(max(swds_id), '0')
                          into ghdm5
                          from dt_street
                         where jczdb_id = a.column_value;
                        qycj := '6';
                    elsif (tempCount = '6') then
                        select nvl(max(swds_id), '0')
                          into ghdm6
                          from dt_street
                         where jczdb_id = a.column_value;
                        qycj := '7';
                    end if;
                    tempCount := tempCount + 1;
                end loop;
            
                --同样为已建会单位,将“会员人数”更新至系统中
                --三级办为已建会,系统中为未建会将“建会状态(独立、联合)、上级工会、会员人数”更新至系统中
                ------10 独立工会-应代收-工会经费   0联合工会-应代收-工会经费
                if (rc.jhzt in ('0',
                                '1',
                                '2',
                                '3',
                                '4',
                                '5',
                                '6',
                                '7',
                                '8',
                                '9',
                                '10',
                                '11',
                                '12',
                                '13',
                                '14',
                                '15',
                                '16',
                                '17')) then
                    update gh_qyghgx
                       set qyghrs = rc.num_member
                     where qybm = rc.qybm;
                elsif (rc.jhzt in
                      ('18', '19', '20', '21', '22', '23', '24', '28')) then
                    update gh_qyghgx
                       set qyghrs = rc.num_member,
                           jhzt   = CASE
                                        WHEN rc.org_type = '201' THEN
                                         '10'
                                        else
                                         '0'
                                    end,
                           ghdm1  = ghdm1,
                           ghdm2  = ghdm2,
                           ghdm3  = ghdm3,
                           ghdm4  = ghdm4,
                           ghdm5  = ghdm5,
                           ghdm6  = ghdm6,
                           qyjc   = qycj, SFWZY = '1' ----分配业务使用,当未建会改为已建会时此字段设置为1
                     where qybm = rc.qybm;
                
                    ----记录修改建会状态的变更记录
                    ---增加变更历史表数据
                    insert into GH_QYBG_LS
                        (ID,
                         YWLSDM,
                         QYBM,
                         BGXXZ,
                         BGXJZ,
                         SPZT,
                         CZRYDM,
                         CZSJ,
                         BGXDM,
                         GHDM,
                         GHMC,
                         GHLX,
                         ZHLX,
                         QYGHRS,
                         JHZT,
                         JHSJ,
                         SHSJ,
                         JFLCBL,
                         GHDM1,
                         BL1,
                         GHDM2,
                         BL2,
                         GHDM3,
                         BL3,
                         GHDM4,
                         BL4,
                         GHDM5,
                         BL5,
                         GHDM6,
                         BL6,
                         QYJC,
                         DRRQ,
                         QYMC,
                         SJJYDZ,
                         LXR,
                         LXDH,
                         KHH,
                         KHZH,
                         KHMC,
                         JSJDM,
                         TYSHXYDM,
                         DJZCLXDM,
                         ZZJGDM,
                         JYDZ,
                         JYDZYB,
                         ZCDZ,
                         ZCDZYB,
                         JYDZLXDM,
                         SWJGZZJGDM,
                         SCJXDM,
                         NSRZTMC,
                         GJBZHYDM,
                         KYDJRQ,
                         SWDJLXMC,
                         SJQYMC,
                         SJJYDZYB,
                         QYZT,
                         QYFR,
                         JHH,
                         XEZFH,
                         GSRS,
                         SSGLYDM,
                         ISTC,
                         NSRSBH,
                         XGRQ,
                         SFFQ)
                    values
                        (SEQ_YWLS.NEXTVAL,
                         SEQ_YWLS.NEXTVAL,
                         rc.QYBM,
                         CASE WHEN rc.org_type = '201' THEN '10' else '0' end,
                         rc.jhzt,
                         '0',
                         '预处理',
                         sysdate,
                         'jhzt',
                         rc.GHDM,
                         rc.GHMC,
                         rc.GHLX,
                         rc.ZHLX,
                         rc.QYGHRS,
                         rc.JHZT,
                         rc.JHSJ,
                         rc.SHSJ,
                         rc.JFLCBL,
                         rc.GHDM1,
                         rc.BL1,
                         rc.GHDM2,
                         rc.BL2,
                         rc.GHDM3,
                         rc.BL3,
                         rc.GHDM4,
                         rc.BL4,
                         rc.GHDM5,
                         rc.BL5,
                         rc.GHDM6,
                         rc.BL6,
                         rc.QYJC,
                         rc.DRRQ,
                         rc.QYMC,
                         rc.SJJYDZ,
                         rc.LXR,
                         rc.LXDH,
                         rc.KHH,
                         rc.KHZH,
                         rc.KHMC,
                         rc.JSJDM,
                         rc.TYSHXYDM,
                         rc.DJZCLXDM,
                         rc.ZZJGDM,
                         rc.JYDZ,
                         rc.JYDZYB,
                         rc.ZCDZ,
                         rc.ZCDZYB,
                         rc.JYDZLXDM,
                         rc.SWJGZZJGDM,
                         rc.SCJXDM,
                         rc.NSRZTMC,
                         rc.GJBZHYDM,
                         rc.KYDJRQ,
                         rc.SWDJLXMC,
                         rc.SJQYMC,
                         rc.SJJYDZYB,
                         rc.QYZT,
                         rc.QYFR,
                         rc.JHH,
                         rc.XEZFH,
                         rc.GSRS,
                         rc.SSGLYDM,
                         rc.ISTC,
                         rc.NSRSBH,
                         rc.XGRQ,
                         rc.SFFQ);
                end if;
            end loop;
        
            --------建会状态为:X-暂不代收-个体工商户 ,但税务登记类型不是个体工商户,建会状态恢复成正常状态
            --------------一级状态保留原状态信息:独立工会/联合工/未建会;二级状态:一级如果是独立工会/联合工会,
            --------------则二级状态为应代收-工会经费;一级如果是未建会,则二级是:应代收-工会经费(筹建中)
            ------8为联合工会-暂不代收-个体工商户,17独立工会-暂不代收-个体工商户,25为未建会-暂不代收-个体工商户
            ------0联合工会-应代收-工会经费        10独立工会-应代收-工会经费      18未建会-应代收-工会经费(筹建中
            for rc in nogtgsh loop
                if (rc.jhzt = '8') then
                    update gh_qyghgx set jhzt = '0' where qybm = rc.qybm;
                    -----增加变更历史表数据
                    insert into GH_QYBG_LS
                        (ID,
                         YWLSDM,
                         QYBM,
                         BGXXZ,
                         BGXJZ,
                         SPZT,
                         CZRYDM,
                         CZSJ,
                         BGXDM,
                         GHDM,
                         GHMC,
                         GHLX,
                         ZHLX,
                         QYGHRS,
                         JHZT,
                         JHSJ,
                         SHSJ,
                         JFLCBL,
                         GHDM1,
                         BL1,
                         GHDM2,
                         BL2,
                         GHDM3,
                         BL3,
                         GHDM4,
                         BL4,
                         GHDM5,
                         BL5,
                         GHDM6,
                         BL6,
                         QYJC,
                         DRRQ,
                         QYMC,
                         SJJYDZ,
                         LXR,
                         LXDH,
                         KHH,
                         KHZH,
                         KHMC,
                         JSJDM,
                         TYSHXYDM,
                         DJZCLXDM,
                         ZZJGDM,
                         JYDZ,
                         JYDZYB,
                         ZCDZ,
                         ZCDZYB,
                         JYDZLXDM,
                         SWJGZZJGDM,
                         SCJXDM,
                         NSRZTMC,
                         GJBZHYDM,
                         KYDJRQ,
                         SWDJLXMC,
                         SJQYMC,
                         SJJYDZYB,
                         QYZT,
                         QYFR,
                         JHH,
                         XEZFH,
                         GSRS,
                         SSGLYDM,
                         ISTC,
                         NSRSBH,
                         XGRQ,
                         SFFQ)
                    values
                        (SEQ_YWLS.NEXTVAL,
                         SEQ_YWLS.NEXTVAL,
                         rc.QYBM,
                         '0',
                         rc.jhzt,
                         '0',
                         '预处理',
                         sysdate,
                         'jhzt',
                         rc.GHDM,
                         rc.GHMC,
                         rc.GHLX,
                         rc.ZHLX,
                         rc.QYGHRS,
                         rc.JHZT,
                         rc.JHSJ,
                         rc.SHSJ,
                         rc.JFLCBL,
                         rc.GHDM1,
                         rc.BL1,
                         rc.GHDM2,
                         rc.BL2,
                         rc.GHDM3,
                         rc.BL3,
                         rc.GHDM4,
                         rc.BL4,
                         rc.GHDM5,
                         rc.BL5,
                         rc.GHDM6,
                         rc.BL6,
                         rc.QYJC,
                         rc.DRRQ,
                         rc.QYMC,
                         rc.SJJYDZ,
                         rc.LXR,
                         rc.LXDH,
                         rc.KHH,
                         rc.KHZH,
                         rc.KHMC,
                         rc.JSJDM,
                         rc.TYSHXYDM,
                         rc.DJZCLXDM,
                         rc.ZZJGDM,
                         rc.JYDZ,
                         rc.JYDZYB,
                         rc.ZCDZ,
                         rc.ZCDZYB,
                         rc.JYDZLXDM,
                         rc.SWJGZZJGDM,
                         rc.SCJXDM,
                         rc.NSRZTMC,
                         rc.GJBZHYDM,
                         rc.KYDJRQ,
                         rc.SWDJLXMC,
                         rc.SJQYMC,
                         rc.SJJYDZYB,
                         rc.QYZT,
                         rc.QYFR,
                         rc.JHH,
                         rc.XEZFH,
                         rc.GSRS,
                         rc.SSGLYDM,
                         rc.ISTC,
                         rc.NSRSBH,
                         rc.XGRQ,
                         rc.SFFQ);
                elsif (rc.jhzt = '17') then
                    update gh_qyghgx set jhzt = '10' where qybm = rc.qybm;
                    -----增加变更历史表数据
                    insert into GH_QYBG_LS
                        (ID,
                         YWLSDM,
                         QYBM,
                         BGXXZ,
                         BGXJZ,
                         SPZT,
                         CZRYDM,
                         CZSJ,
                         BGXDM,
                         GHDM,
                         GHMC,
                         GHLX,
                         ZHLX,
                         QYGHRS,
                         JHZT,
                         JHSJ,
                         SHSJ,
                         JFLCBL,
                         GHDM1,
                         BL1,
                         GHDM2,
                         BL2,
                         GHDM3,
                         BL3,
                         GHDM4,
                         BL4,
                         GHDM5,
                         BL5,
                         GHDM6,
                         BL6,
                         QYJC,
                         DRRQ,
                         QYMC,
                         SJJYDZ,
                         LXR,
                         LXDH,
                         KHH,
                         KHZH,
                         KHMC,
                         JSJDM,
                         TYSHXYDM,
                         DJZCLXDM,
                         ZZJGDM,
                         JYDZ,
                         JYDZYB,
                         ZCDZ,
                         ZCDZYB,
                         JYDZLXDM,
                         SWJGZZJGDM,
                         SCJXDM,
                         NSRZTMC,
                         GJBZHYDM,
                         KYDJRQ,
                         SWDJLXMC,
                         SJQYMC,
                         SJJYDZYB,
                         QYZT,
                         QYFR,
                         JHH,
                         XEZFH,
                         GSRS,
                         SSGLYDM,
                         ISTC,
                         NSRSBH,
                         XGRQ,
                         SFFQ)
                    values
                        (SEQ_YWLS.NEXTVAL,
                         SEQ_YWLS.NEXTVAL,
                         rc.QYBM,
                         '0',
                         rc.jhzt,
                         '0',
                         '预处理',
                         sysdate,
                         'jhzt',
                         rc.GHDM,
                         rc.GHMC,
                         rc.GHLX,
                         rc.ZHLX,
                         rc.QYGHRS,
                         rc.JHZT,
                         rc.JHSJ,
                         rc.SHSJ,
                         rc.JFLCBL,
                         rc.GHDM1,
                         rc.BL1,
                         rc.GHDM2,
                         rc.BL2,
                         rc.GHDM3,
                         rc.BL3,
                         rc.GHDM4,
                         rc.BL4,
                         rc.GHDM5,
                         rc.BL5,
                         rc.GHDM6,
                         rc.BL6,
                         rc.QYJC,
                         rc.DRRQ,
                         rc.QYMC,
                         rc.SJJYDZ,
                         rc.LXR,
                         rc.LXDH,
                         rc.KHH,
                         rc.KHZH,
                         rc.KHMC,
                         rc.JSJDM,
                         rc.TYSHXYDM,
                         rc.DJZCLXDM,
                         rc.ZZJGDM,
                         rc.JYDZ,
                         rc.JYDZYB,
                         rc.ZCDZ,
                         rc.ZCDZYB,
                         rc.JYDZLXDM,
                         rc.SWJGZZJGDM,
                         rc.SCJXDM,
                         rc.NSRZTMC,
                         rc.GJBZHYDM,
                         rc.KYDJRQ,
                         rc.SWDJLXMC,
                         rc.SJQYMC,
                         rc.SJJYDZYB,
                         rc.QYZT,
                         rc.QYFR,
                         rc.JHH,
                         rc.XEZFH,
                         rc.GSRS,
                         rc.SSGLYDM,
                         rc.ISTC,
                         rc.NSRSBH,
                         rc.XGRQ,
                         rc.SFFQ);
                elsif (rc.jhzt = '25') then
                    update gh_qyghgx set jhzt = '18' where qybm = rc.qybm;
                    -----增加变更历史表数据
                    insert into GH_QYBG_LS
                        (ID,
                         YWLSDM,
                         QYBM,
                         BGXXZ,
                         BGXJZ,
                         SPZT,
                         CZRYDM,
                         CZSJ,
                         BGXDM,
                         GHDM,
                         GHMC,
                         GHLX,
                         ZHLX,
                         QYGHRS,
                         JHZT,
                         JHSJ,
                         SHSJ,
                         JFLCBL,
                         GHDM1,
                         BL1,
                         GHDM2,
                         BL2,
                         GHDM3,
                         BL3,
                         GHDM4,
                         BL4,
                         GHDM5,
                         BL5,
                         GHDM6,
                         BL6,
                         QYJC,
                         DRRQ,
                         QYMC,
                         SJJYDZ,
                         LXR,
                         LXDH,
                         KHH,
                         KHZH,
                         KHMC,
                         JSJDM,
                         TYSHXYDM,
                         DJZCLXDM,
                         ZZJGDM,
                         JYDZ,
                         JYDZYB,
                         ZCDZ,
                         ZCDZYB,
                         JYDZLXDM,
                         SWJGZZJGDM,
                         SCJXDM,
                         NSRZTMC,
                         GJBZHYDM,
                         KYDJRQ,
                         SWDJLXMC,
                         SJQYMC,
                         SJJYDZYB,
                         QYZT,
                         QYFR,
                         JHH,
                         XEZFH,
                         GSRS,
                         SSGLYDM,
                         ISTC,
                         NSRSBH,
                         XGRQ,
                         SFFQ)
                    values
                        (SEQ_YWLS.NEXTVAL,
                         SEQ_YWLS.NEXTVAL,
                         rc.QYBM,
                         '0',
                         rc.jhzt,
                         '0',
                         '预处理',
                         sysdate,
                         'jhzt',
                         rc.GHDM,
                         rc.GHMC,
                         rc.GHLX,
                         rc.ZHLX,
                         rc.QYGHRS,
                         rc.JHZT,
                         rc.JHSJ,
                         rc.SHSJ,
                         rc.JFLCBL,
                         rc.GHDM1,
                         rc.BL1,
                         rc.GHDM2,
                         rc.BL2,
                         rc.GHDM3,
                         rc.BL3,
                         rc.GHDM4,
                         rc.BL4,
                         rc.GHDM5,
                         rc.BL5,
                         rc.GHDM6,
                         rc.BL6,
                         rc.QYJC,
                         rc.DRRQ,
                         rc.QYMC,
                         rc.SJJYDZ,
                         rc.LXR,
                         rc.LXDH,
                         rc.KHH,
                         rc.KHZH,
                         rc.KHMC,
                         rc.JSJDM,
                         rc.TYSHXYDM,
                         rc.DJZCLXDM,
                         rc.ZZJGDM,
                         rc.JYDZ,
                         rc.JYDZYB,
                         rc.ZCDZ,
                         rc.ZCDZYB,
                         rc.JYDZLXDM,
                         rc.SWJGZZJGDM,
                         rc.SCJXDM,
                         rc.NSRZTMC,
                         rc.GJBZHYDM,
                         rc.KYDJRQ,
                         rc.SWDJLXMC,
                         rc.SJQYMC,
                         rc.SJJYDZYB,
                         rc.QYZT,
                         rc.QYFR,
                         rc.JHH,
                         rc.XEZFH,
                         rc.GSRS,
                         rc.SSGLYDM,
                         rc.ISTC,
                         rc.NSRSBH,
                         rc.XGRQ,
                         rc.SFFQ);
                end if;
            end loop;
        
            --------登记注册类型为:个体工商户的,则企业信息一级标记:独立工会/联合工会/未建会(保持原企业不变),二级将暂不代收,三类:个体工商户
            ------8为联合工会-暂不代收-个体工商户,17独立工会-暂不代收-个体工商户,25为未建会-暂不代收-个体工商户
            for rc in gtgsh loop
                ---联合工会
                if (rc.jhzt in ('0', '1', '2', '3', '4', '5', '6', '7')) then
                    update gh_qyghgx set jhzt = '8' where qybm = rc.qybm;
                    -----增加变更历史表数据
                    insert into GH_QYBG_LS
                        (ID,
                         YWLSDM,
                         QYBM,
                         BGXXZ,
                         BGXJZ,
                         SPZT,
                         CZRYDM,
                         CZSJ,
                         BGXDM,
                         GHDM,
                         GHMC,
                         GHLX,
                         ZHLX,
                         QYGHRS,
                         JHZT,
                         JHSJ,
                         SHSJ,
                         JFLCBL,
                         GHDM1,
                         BL1,
                         GHDM2,
                         BL2,
                         GHDM3,
                         BL3,
                         GHDM4,
                         BL4,
                         GHDM5,
                         BL5,
                         GHDM6,
                         BL6,
                         QYJC,
                         DRRQ,
                         QYMC,
                         SJJYDZ,
                         LXR,
                         LXDH,
                         KHH,
                         KHZH,
                         KHMC,
                         JSJDM,
                         TYSHXYDM,
                         DJZCLXDM,
                         ZZJGDM,
                         JYDZ,
                         JYDZYB,
                         ZCDZ,
                         ZCDZYB,
                         JYDZLXDM,
                         SWJGZZJGDM,
                         SCJXDM,
                         NSRZTMC,
                         GJBZHYDM,
                         KYDJRQ,
                         SWDJLXMC,
                         SJQYMC,
                         SJJYDZYB,
                         QYZT,
                         QYFR,
                         JHH,
                         XEZFH,
                         GSRS,
                         SSGLYDM,
                         ISTC,
                         NSRSBH,
                         XGRQ,
                         SFFQ)
                    values
                        (SEQ_YWLS.NEXTVAL,
                         SEQ_YWLS.NEXTVAL,
                         rc.QYBM,
                         '8',
                         rc.jhzt,
                         '0',
                         '预处理',
                         sysdate,
                         'jhzt',
                         rc.GHDM,
                         rc.GHMC,
                         rc.GHLX,
                         rc.ZHLX,
                         rc.QYGHRS,
                         rc.JHZT,
                         rc.JHSJ,
                         rc.SHSJ,
                         rc.JFLCBL,
                         rc.GHDM1,
                         rc.BL1,
                         rc.GHDM2,
                         rc.BL2,
                         rc.GHDM3,
                         rc.BL3,
                         rc.GHDM4,
                         rc.BL4,
                         rc.GHDM5,
                         rc.BL5,
                         rc.GHDM6,
                         rc.BL6,
                         rc.QYJC,
                         rc.DRRQ,
                         rc.QYMC,
                         rc.SJJYDZ,
                         rc.LXR,
                         rc.LXDH,
                         rc.KHH,
                         rc.KHZH,
                         rc.KHMC,
                         rc.JSJDM,
                         rc.TYSHXYDM,
                         rc.DJZCLXDM,
                         rc.ZZJGDM,
                         rc.JYDZ,
                         rc.JYDZYB,
                         rc.ZCDZ,
                         rc.ZCDZYB,
                         rc.JYDZLXDM,
                         rc.SWJGZZJGDM,
                         rc.SCJXDM,
                         rc.NSRZTMC,
                         rc.GJBZHYDM,
                         rc.KYDJRQ,
                         rc.SWDJLXMC,
                         rc.SJQYMC,
                         rc.SJJYDZYB,
                         rc.QYZT,
                         rc.QYFR,
                         rc.JHH,
                         rc.XEZFH,
                         rc.GSRS,
                         rc.SSGLYDM,
                         rc.ISTC,
                         rc.NSRSBH,
                         rc.XGRQ,
                         rc.SFFQ);
                elsif (rc.jhzt in
                      ('9', '10', '11', '12', '13', '14', '15', '16')) then
                    --独立工会
                    update gh_qyghgx set jhzt = '17' where qybm = rc.qybm;
                    -----增加变更历史表数据
                    insert into GH_QYBG_LS
                        (ID,
                         YWLSDM,
                         QYBM,
                         BGXXZ,
                         BGXJZ,
                         SPZT,
                         CZRYDM,
                         CZSJ,
                         BGXDM,
                         GHDM,
                         GHMC,
                         GHLX,
                         ZHLX,
                         QYGHRS,
                         JHZT,
                         JHSJ,
                         SHSJ,
                         JFLCBL,
                         GHDM1,
                         BL1,
                         GHDM2,
                         BL2,
                         GHDM3,
                         BL3,
                         GHDM4,
                         BL4,
                         GHDM5,
                         BL5,
                         GHDM6,
                         BL6,
                         QYJC,
                         DRRQ,
                         QYMC,
                         SJJYDZ,
                         LXR,
                         LXDH,
                         KHH,
                         KHZH,
                         KHMC,
                         JSJDM,
                         TYSHXYDM,
                         DJZCLXDM,
                         ZZJGDM,
                         JYDZ,
                         JYDZYB,
                         ZCDZ,
                         ZCDZYB,
                         JYDZLXDM,
                         SWJGZZJGDM,
                         SCJXDM,
                         NSRZTMC,
                         GJBZHYDM,
                         KYDJRQ,
                         SWDJLXMC,
                         SJQYMC,
                         SJJYDZYB,
                         QYZT,
                         QYFR,
                         JHH,
                         XEZFH,
                         GSRS,
                         SSGLYDM,
                         ISTC,
                         NSRSBH,
                         XGRQ,
                         SFFQ)
                    values
                        (SEQ_YWLS.NEXTVAL,
                         SEQ_YWLS.NEXTVAL,
                         rc.QYBM,
                         '17',
                         rc.jhzt,
                         '0',
                         '预处理',
                         sysdate,
                         'jhzt',
                         rc.GHDM,
                         rc.GHMC,
                         rc.GHLX,
                         rc.ZHLX,
                         rc.QYGHRS,
                         rc.JHZT,
                         rc.JHSJ,
                         rc.SHSJ,
                         rc.JFLCBL,
                         rc.GHDM1,
                         rc.BL1,
                         rc.GHDM2,
                         rc.BL2,
                         rc.GHDM3,
                         rc.BL3,
                         rc.GHDM4,
                         rc.BL4,
                         rc.GHDM5,
                         rc.BL5,
                         rc.GHDM6,
                         rc.BL6,
                         rc.QYJC,
                         rc.DRRQ,
                         rc.QYMC,
                         rc.SJJYDZ,
                         rc.LXR,
                         rc.LXDH,
                         rc.KHH,
                         rc.KHZH,
                         rc.KHMC,
                         rc.JSJDM,
                         rc.TYSHXYDM,
                         rc.DJZCLXDM,
                         rc.ZZJGDM,
                         rc.JYDZ,
                         rc.JYDZYB,
                         rc.ZCDZ,
                         rc.ZCDZYB,
                         rc.JYDZLXDM,
                         rc.SWJGZZJGDM,
                         rc.SCJXDM,
                         rc.NSRZTMC,
                         rc.GJBZHYDM,
                         rc.KYDJRQ,
                         rc.SWDJLXMC,
                         rc.SJQYMC,
                         rc.SJJYDZYB,
                         rc.QYZT,
                         rc.QYFR,
                         rc.JHH,
                         rc.XEZFH,
                         rc.GSRS,
                         rc.SSGLYDM,
                         rc.ISTC,
                         rc.NSRSBH,
                         rc.XGRQ,
                         rc.SFFQ);
                elsif (rc.jhzt in
                      ('18', '19', '20', '21', '22', '23', '24', '28')) then
                    ---未建会
                    update gh_qyghgx set jhzt = '25' where qybm = rc.qybm;
                    -----增加变更历史表数据
                    insert into GH_QYBG_LS
                        (ID,
                         YWLSDM,
                         QYBM,
                         BGXXZ,
                         BGXJZ,
                         SPZT,
                         CZRYDM,
                         CZSJ,
                         BGXDM,
                         GHDM,
                         GHMC,
                         GHLX,
                         ZHLX,
                         QYGHRS,
                         JHZT,
                         JHSJ,
                         SHSJ,
                         JFLCBL,
                         GHDM1,
                         BL1,
                         GHDM2,
                         BL2,
                         GHDM3,
                         BL3,
                         GHDM4,
                         BL4,
                         GHDM5,
                         BL5,
                         GHDM6,
                         BL6,
                         QYJC,
                         DRRQ,
                         QYMC,
                         SJJYDZ,
                         LXR,
                         LXDH,
                         KHH,
                         KHZH,
                         KHMC,
                         JSJDM,
                         TYSHXYDM,
                         DJZCLXDM,
                         ZZJGDM,
                         JYDZ,
                         JYDZYB,
                         ZCDZ,
                         ZCDZYB,
                         JYDZLXDM,
                         SWJGZZJGDM,
                         SCJXDM,
                         NSRZTMC,
                         GJBZHYDM,
                         KYDJRQ,
                         SWDJLXMC,
                         SJQYMC,
                         SJJYDZYB,
                         QYZT,
                         QYFR,
                         JHH,
                         XEZFH,
                         GSRS,
                         SSGLYDM,
                         ISTC,
                         NSRSBH,
                         XGRQ,
                         SFFQ)
                    values
                        (SEQ_YWLS.NEXTVAL,
                         SEQ_YWLS.NEXTVAL,
                         rc.QYBM,
                         '25',
                         rc.jhzt,
                         '0',
                         '预处理',
                         sysdate,
                         'jhzt',
                         rc.GHDM,
                         rc.GHMC,
                         rc.GHLX,
                         rc.ZHLX,
                         rc.QYGHRS,
                         rc.JHZT,
                         rc.JHSJ,
                         rc.SHSJ,
                         rc.JFLCBL,
                         rc.GHDM1,
                         rc.BL1,
                         rc.GHDM2,
                         rc.BL2,
                         rc.GHDM3,
                         rc.BL3,
                         rc.GHDM4,
                         rc.BL4,
                         rc.GHDM5,
                         rc.BL5,
                         rc.GHDM6,
                         rc.BL6,
                         rc.QYJC,
                         rc.DRRQ,
                         rc.QYMC,
                         rc.SJJYDZ,
                         rc.LXR,
                         rc.LXDH,
                         rc.KHH,
                         rc.KHZH,
                         rc.KHMC,
                         rc.JSJDM,
                         rc.TYSHXYDM,
                         rc.DJZCLXDM,
                         rc.ZZJGDM,
                         rc.JYDZ,
                         rc.JYDZYB,
                         rc.ZCDZ,
                         rc.ZCDZYB,
                         rc.JYDZLXDM,
                         rc.SWJGZZJGDM,
                         rc.SCJXDM,
                         rc.NSRZTMC,
                         rc.GJBZHYDM,
                         rc.KYDJRQ,
                         rc.SWDJLXMC,
                         rc.SJQYMC,
                         rc.SJJYDZYB,
                         rc.QYZT,
                         rc.QYFR,
                         rc.JHH,
                         rc.XEZFH,
                         rc.GSRS,
                         rc.SSGLYDM,
                         rc.ISTC,
                         rc.NSRSBH,
                         rc.XGRQ,
                         rc.SFFQ);
                end if;
            end loop;
            insert into YUCHULI_MARK values (SYS_GUID(), 'update', sysdate);
            commit;
        end;

    end yuchuli_update;

  • 相关阅读:
    在ASP.NET页面中推荐使用覆写(Override)而不是事件处理(Event Handler)[转帖]
    box2dweb资料
    两个游戏开发相关的工具
    django中实现图片上传
    html5和webgame开发
    我的js游戏小引擎 —— 可使用canvas模式或DOM模式
    如何处理网络游戏网络延迟问题
    iphone5和ios6 对html5、web app带来的影响
    矩阵变化和坐标
    连连看游戏demo
  • 原文地址:https://www.cnblogs.com/523823-wu/p/7768214.html
Copyright © 2020-2023  润新知