SUMSEN

Oracle&Sql爱好者,用友NC管理员

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::

直接修改客商的银行账号。

这时候32459408010125337在bd_custbank被删除,新增一个32459408010125337 2 

同时在银行账户表bd_accbank变成两个

但是新增的账号32459408010125337 2 没有单位名称

从PL/SQL Developer查询看到

 2012.8.2更新同步bd_bankacc和bd_custbank的写法

create or replace trigger C_ACCBANK_SPACE
before insert or update on bd_accbank  
  for each row
declare
  -- local variables here
  
begin 
 if regexp_like(:new.bankacc,'[[:space:]]') or
    regexp_like(:new.combineaccnum,'[[:space:]]') or
    regexp_like(:new.unitname,'[[:space:]]') 
     then
    raise_application_error(-20001,'注意:银行账号、联行号或单位名称中有空格!');
 else
   update bd_custbank
   set account=:new.bankacc,
       accname=:new.bankname
       where pk_accbank=:new.pk_accbank;
  end if;     
  
end ;

 8.3号更新:客商增加时的校验,末端不能带字母或数字

select custname from bd_cubasdoc where regexp_like(substr(custname,-2),'[[:xdigit:]]')

 

8.6号更新:感谢NC群Atobe丶thailan  493682419的帮助,不允许修改客商标题的银行账号不再需要我的那个S_UPDATE_CUSTBANK触发器了,使用编辑公式搞定了

具体在客商单据模板的银行账号编辑公式:

$Error->iif(isempty(geccolvalue(bd_cusbank,pk_cusbank,pk_custbank,pk_custbank))=N,,"不允许这里修改");
有点小问题是不能弹出错误对话框

 

8.8号更新:感谢NC群Atobe丶thailan  493682419的帮助,通过在银行账号的编辑公式输入:currtypecode->iif(pk_custbank = pk_cubasdoc,"CNY","")

这样一旦修改客商已有的银行账号,此时pk_custbank = pk_cubasdoc,公式会将币种代码设为null,不能保存,只好取消,问题解决,这个思路很好(唯一的小遗憾是如果有人较劲,选择美元代码,无法)

 

 更新上面的选择美元户trigger

 

 

create or replace trigger bd_cus1
  before insert or update  on   bd_custbank
  for each row
declare
  -- local variables here
begin
  if :new.pk_currtype<>'00010000000000000001' 
    then
 raise_application_error(-20001,'请取消!');   
 end if;
end; 

 8.9号更新,已经完成,并且实施在正式环境中:

 “

我们对客商做了继续的简化和安全性操作1,在客商银行账号处,不可以修改已有的银行账号,否则系统提示“币种代码或币种名称”为空,要修改必须到开户银行 2,客商增行的时候“币种和币种名称”自动出现,不需要手工选择了

核心代码,在客商单据模板的银行账号编辑公式:

currtypecode->iif(pk_custbank = pk_cubasdoc,"CNY","");
currtypename->iif(pk_custbank = pk_cubasdoc,"人民币","");
pk_currtype->"00010000000000000001"

 1,客商表体里的币种代码和币种名称都是假象,后台表也只有pk_currtype,因此这里把pk_currtype录入时候默认人民币代码“00010000000000000001”,并且隐藏这个显示。

2,将币种代码和币种名称设为必输项,上面的公式可以保证在新录入的时候自动显示CNY和人民币,并且在修改已有行账号时候币种代码和名称变为null,不能保存成功。

 下面是备份的编辑公式,别出错了:

1 币种代码
currtypename->getColValue(bd_currtype,currtypename,pk_currtype ,pk_currtype) ;
2 银行账号
accaddr->iif(pk_accbank == NULL || pk_accbank == "", accaddr, getColValue(bd_accbank,address,pk_accbank,pk_accbank) );
memo->iif(pk_accbank = NULL || pk_accbank == "", memo, getColValue(bd_accbank,memo,pk_accbank,pk_accbank));
pk_currtype->iif(pk_accbank == NULL || pk_accbank == "", pk_currtype, getColValue(bd_accbank,pk_currtype,pk_accbank,pk_accbank) );
currtypecode->getColValue(bd_currtype ,currtypecode ,pk_currtype ,pk_currtype ) ;
currtypename->getColValue(bd_currtype ,currtypename ,pk_currtype ,pk_currtype ) ;

 

posted on 2012-05-30 09:15  sumsen  阅读(2686)  评论(0编辑  收藏  举报