业务流程.常见问题.选单慢及过滤缩小范围
【场景】选单慢问题
【结论】通常为选单的sql查询过慢,检查下是否可以通过过滤条件减少查询数据范围从而提升性能(最好增加的过滤条件字段为索引字段)
【分析方案】
(0)根据APM抓取选单列表打开列表取数sql
[APM](https://wenku.my7c.com/article/145480274074763008?lang=zh-CN)
通常情况下生成的sql在数据库中执行就是慢的
![image.webp](/download/01009152aaa22c8940659c4dc605a91f8c9d.webp)
(1)尝试利用单据转换规则的字段映射选单过滤
对应逻辑如果当前单据已经输入了这个值,则会使用这个值过滤选单列表,大幅减少可选数据范围从而提升查询速度
![image.webp](/download/0100dec9ef3c6d26450c932833eafec0b59b.webp)
(2)部分客户的数据规模很大,可以通过操作校验+二开插件强制校验选单时字段已录入的逻辑
操作校验
![image.webp](/download/0100c3baad8de6c64d96ba8935cc920fb96b.webp)
二开插件调用选单的操作校验(C# 和 python,其中python的校验异常消息不支持,仅能在python中强指定)
C# 插件: [二开案例.单据插件.执行操作的校验器](https://wenku.my7c.com/article/238316028416101376?lang=zh-CN&productLineId=1&isKnowledge=2)
```python
import clr
clr.AddReference("mscorlib")
clr.AddReference("System.Data")
#增加引用自定义组件
clr.AddReference("Kingdee.BOS.ServiceHelper")
clr.AddReference("Kingdee.BOS.Core")
from System import *
from System.Collections.Generic import *
from System.Data import *
#导入组件的命名空间
from Kingdee.BOS.ServiceHelper import *
from Kingdee.BOS.Core.Validation import *
def BeforeDoOperation(e):
if e.Operation.FormOperation.Operation == 'Draw':
objType = this.View.Model.DataObject.GetType();
objs = Array.CreateInstance(objType,1);
objs[0] = this.View.Model.DataObject;
result = BusinessDataServiceHelper.Validate(this.View.Context, this.View.BusinessInfo, objs, e.Operation.FormOperation.Operation, Enum_TimingPoint.Other);
if(result.IsSuccess == False):
this.View.ShowMessage('不满足选单操作的校验');
e.Cancel = True;
```
【效果】对应字段录入后才可以选单
![20240403 1655.webp](/download/01002499adb5503f41b8ba460178b265541d.webp)
业务流程.常见问题.选单慢及过滤缩小范围
【场景】选单慢问题【结论】通常为选单的sql查询过慢,检查下是否可以通过过滤条件减少查询数据范围从而提升性能(最好增加的过滤条件字段...
点击下载文档
本文2024-09-16 18:09:40发表“云星空知识”栏目。
本文链接:https://wenku.my7c.com/article/kingdee-k3cloud-20339.html
您需要登录后才可以发表评论, 登录登录 或者 注册
最新文档
热门文章