软件版本:金蝶KIS旗舰版4.0
操作系统:windows2008
数据库版本:sql server2008
问题描述:客户帐套里面,如果按照商品品牌来过滤采购订单,系统会提示报错,跟踪之后发现查询代码如下:
Select top 20000 v1.FTranType as FTranType,v1.FCheckerID as FCheckerID,v1.FInterID as FInterID,
u1.FEntryID as FEntryID,v1.Fdate as Fdate,v1.FBillNo as FBillNo,v1.FChangeDate as FChangeDate,
v1.FVersionNo as FVersionNo,
case when v1.FCheckerID>0 then 'Y' when v1.FCheckerID<0 then 'Y' else '' end as FCheck,
CASE WHEN v1.FStatus = 3 OR v1.FClosed = 1 THEN 'Y' ELSE '' END as FClose,
case when v1.FCancellation=1 then 'Y' else '' end as FCancellation, 0 As FBOSCloseFlag
from POOrder v1 INNER JOIN POOrderEntry u1 ON v1.FInterID = u1.FInterID AND u1.FInterID <>0
where 1=1 AND (ISNULL(t1032.FName,'') = 'test')
AND (v1.FChangeMark=0 AND ( Isnull(v1.FClassTypeID,0)<>1007101)
AND ((v1.FDate>='2016-02-01' AND v1.FDate<'2016-03-01') AND v1.FCancellation = 0))
而在正常帐套里面的代码应该是:
Select top 20000 v1.FTranType as FTranType,v1.FCheckerID as FCheckerID,v1.FInterID as FInterID,
u1.FEntryID as FEntryID,v1.Fdate as Fdate,v1.FBillNo as FBillNo,v1.FChangeDate as FChangeDate,
v1.FVersionNo as FVersionNo,
case when v1.FCheckerID>0 then 'Y' when v1.FCheckerID<0 then 'Y' else '' end as FCheck,
CASE WHEN v1.FStatus = 3 OR v1.FClosed = 1 THEN 'Y' ELSE '' END as FClose,
case when v1.FCancellation=1 then 'Y' else '' end as FCancellation, 0 As FBOSCloseFlag
from POOrder v1 INNER JOIN POOrderEntry u1 ON v1.FInterID = u1.FInterID AND u1.FInterID <>0
LEFT OUTER JOIN t_Item t1032 ON u1.FComBrandID = t1032.FItemID AND t1032.FItemID<>0
where 1=1 AND ( ISNULL(t1032.FName,'') = '可口可乐')
AND (v1.FChangeMark=0 AND ( Isnull(v1.FClassTypeID,0)<>1007101) AND (v1.FCancellation = 0))
可以看到,明显少了一个数据表。
其次:如果客户帐套里面不按照品牌过滤,而只是在序时簿里面想显示品牌字段,系统显示的结果会看到有很多行,但是数据全部是空白的,具体可以参考附件截图:
1.png(57.44KB)
推荐阅读