单据转换.常见问题.选单列表显示数量大于实际数量

栏目:云星空知识作者:金蝶来源:金蝶云社区发布:2024-09-16浏览:1

单据转换.常见问题.选单列表显示数量大于实际数量

【场景】单据转换.选单.列表显示数量大于实际数量 【原因】一般为多个无关联实体的联查,导致的笛卡尔积 【案例】 (0)数据准备 ![image.webp](/download/010089eabf194fa1431fafba3b3f8a869cc1.webp) (1)转换规则逻辑,将文本下推到下游;当且仅当另一个单据体存在整数大于10时才可推 ![image.webp](/download/01007aa8ffaa54d1484992b1d73becd8d704.webp) ![image.webp](/download/0100fa1e2bdb5a35472aa58b481c8f938525.webp) (2)效果选单出现充分分录 ![image.webp](/download/0100c5498192d87f4a6b8f36eb4a6dddeab2.webp) 【分析过程】利用APM抓执行sql ![image.webp](/download/0100dfc47863d0d24ad3b954c623a238815e.webp) ```sql SELECT * FROM ( SELECT t0.FBILLNO AS FBILLNO, t0.FDOCUMENTSTATUS AS FDOCUMENTSTATUS, t1.F_BHR_TEXT AS F_BHR_TEXT, t0.FID AS FID, t1.FENTRYID AS t1_FENTRYID , ROW_NUMBER() OVER (ORDER BY t0.FID, t1.FENTRYID) AS fidentityid FROM BHR_t_Cust100040 t0 LEFT JOIN BHR_t_Cust_Entry100227 t1 ON t0.FID = t1.FID LEFT JOIN BHR_t_Cust_Entry100231 t3 ON t0.FID = t3.FID WHERE t3.F_BHR_INTEGER > 10 ) TLIST WHERE fidentityid >= 1 AND fidentityid <= 200 ``` 因为使用了选单条件字段条件所以,会联查多一个单据体,导致单据体1的M行*单据体2的N行,笛卡尔积 【方案】调整sql条件为子查询 ```sql EXISTS ( SELECT 1 FROM BHR_t_Cust_Entry100231 WHERE BHR_t_Cust_Entry100231.FID = FID AND BHR_t_Cust_Entry100231.F_BHR_Integer >0) ``` ![image.webp](/download/0100590176d0743f47cd911621d86894275a.webp) ```sql SELECT * FROM ( SELECT t0.FBILLNO AS FBILLNO, t0.FDOCUMENTSTATUS AS FDOCUMENTSTATUS, t1.F_BHR_TEXT AS F_BHR_TEXT, t0.FID AS FID, t1.FENTRYID AS t1_FENTRYID , ROW_NUMBER() OVER (ORDER BY t0.FID, t1.FENTRYID) AS fidentityid FROM BHR_t_Cust100040 t0 LEFT JOIN BHR_t_Cust_Entry100227 t1 ON t0.FID = t1.FID WHERE EXISTS ( SELECT 1 FROM BHR_t_Cust_Entry100231 WHERE BHR_t_Cust_Entry100231.FID = t0.FID AND BHR_t_Cust_Entry100231.F_BHR_Integer > 10 ) ) TLIST WHERE fidentityid >= 1 AND fidentityid <= 200 ``` ![image.webp](/download/010092dee4db414742d28b37fd18fc81ac70.webp)

单据转换.常见问题.选单列表显示数量大于实际数量

【场景】单据转换.选单.列表显示数量大于实际数量【原因】一般为多个无关联实体的联查,导致的笛卡尔积【案例】(0)数据准备![image.webp](/...
点击下载文档
确认删除?
回到顶部
客服QQ
  • 客服QQ点击这里给我发消息