美文网首页
Siebel异常(SBL-DAT-00421)

Siebel异常(SBL-DAT-00421)

作者: DreamOver | 来源:发表于2015-12-06 00:53 被阅读395次

这周系统的一个功能抛出了异常,一些数据没有按照既定逻辑处理。检查日志,显示:An invalid assignment error has occurred. Please try again or ask your systems administrator to check your application configuration if the problem persists.(SBL-DAT-00421)。
之前没有遇到过这个错误代码,网上能查到的资料也不多,查了半天才弄明白怎么回事。

查到资料中出现SBL-DAT-00421的原因都是输入的日期数据与系统设定的日期数据格式不对,所以数据写不进去,从而抛出异常。
在Oracle Community里看到一个解答,写得挺到位:SBL-DAT-00421 occurs when the values passed in to the web service call do not match the validation restrictions on the fields.中文大意是说通过Web Service传输的数据不符合要写入字段的验证规则。

受到Error when setting Due Date based on UserValue这个问答的启发,我们很快找到了问题所在:我们的系统里,有一个字段表示“一个月后的时间”,我们以前是这样写的:

            var endDate = new Date();
            sWaEDtime = ((endDate.getMonth() + 2) + "/" 
                       + (endDate.getDate()+1) + "/"
                       + endDate.getFullYear() + " "
                       + endDate.getHours() + ":" 
                       + endDate.getMinutes() + ":" 
                       + endDate.getSeconds());

很明显,当时间来到12月1日0点时,sWaEDtime 的值将是 13/1/2015 00:00:00,而几个月之前开发人员在写这段代码时忘了考虑年末的情况。
这是个相对容易解决的问题,只需将代码稍微修改如下:

            var endDate = new Date();
            endDate.setMonth(endDate.getMonth() + 1);
            sWaEDtime = ((endDate.getMonth() + 2) + "/" 
                       + (endDate.getDate()+1) + "/"
                       + endDate.getFullYear() + " "
                       + endDate.getHours() + ":" 
                       + endDate.getMinutes() + ":" 
                       + endDate.getSeconds());

这里用到了SetMonth()方法设置日期对象的月份,当月份超出12个月的范围时将月份自动向后递推,并自动将年份递推。

相关文章

网友评论

      本文标题:Siebel异常(SBL-DAT-00421)

      本文链接:https://www.haomeiwen.com/subject/ujzshttx.html