核算维度明细账查询时出错
金蝶云社区-逐浪
逐浪
0人赞赏了该文章 1,589次浏览 未经作者许可,禁止转载编辑于2015年06月19日 15:22:19

金蝶K3Cloud5.0 打过5-28补丁 联系QQ:1744881734
查询出现异常。Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.

create table TMP58889792165311E5BA190050568 (FACCTID int,FFLEX5 int,FFLEX9 int,FF100004 int,
FBeginBalanceFor decimal(23,10),FDebitFor decimal(23,10),
FCreditFor decimal(23,10),FEndBalanceFor decimal(23,10),FBeginBalance decimal(23,10),
FDebit decimal(23,10),FCredit decimal(23,10),FEndBalance decimal(23,10))

Insert Into TMP58889792165311E5BA190050568(
FACCTID,FFLEX5,FFLEX9,FF100004,FBeginBalanceFor,FDebitFor,
FCreditFor,FEndBalanceFor,FBeginBalance,FDebit,FCredit,FEndBalance)
Select ISNULL(n.FACCTID,0) FACCTID,m.FFLEX5,m.FFLEX9,m.FF100004,
ISNULL(n.FBeginBalanceFor,0) FBeginBalanceFor,
ISNULL(n.FDebitFor,0) FDebitFor,ISNULL(n.FCreditFor,0) FCreditFor,
ISNULL(n.FEndBalanceFor,0) FEndBalanceFor,ISNULL(n.FBeginBalance,0) FBeginBalance,
ISNULL(n.FDebit,0) FDebit,ISNULL(n.FCredit,0) FCredit,ISNULL(n.FEndBalance,0) FEndBalance
from ( select
FF100004.FID as FF100004,FF100004.FNUMBER as FF100004_NUMBER,FF100004_L.FNAME as FF100004_NAME,FFLEX5.FDEPTID as FFLEX5,FFLEX5.FNUMBER as FFLEX5_NUMBER,FFLEX5_L.FNAME as FFLEX5_NAME,FFLEX9.FEXPID as FFLEX9,FFLEX9.FNUMBER as FFLEX9_NUMBER,FFLEX9_L.FNAME as FFLEX9_NAME from
(select TO_CHAR(min(FID)) as FID,TO_CHAR(FNUMBER) as FNUMBER,TO_CHAR(FDocumentStatus) as FDocumentStatus,TO_CHAR(FForbidStatus) as FForbidStatus from PS_t_Cust_Entry100015
where (FDocumentStatus!='A' and FDocumentStatus!='Z')
group by FNUMBER,FDocumentStatus,FForbidStatus
) as FF100004, (select TO_CHAR(FID) as FID,TO_CHAR(FNAME) as FNAME,TO_NUMBER(FLOCALEID) as FLOCALEID from PS_t_Cust_Entry100015_L
) as FF100004_L, (select TO_CHAR(min(FDEPTID)) as FDEPTID,TO_CHAR(FNUMBER) as FNUMBER,TO_CHAR(FDocumentStatus) as FDocumentStatus,TO_CHAR(FForbidStatus) as FForbidStatus from T_BD_DEPARTMENT
where (FDocumentStatus!='A' and FDocumentStatus!='Z')
group by FNUMBER,FDocumentStatus,FForbidStatus
) as FFLEX5, (select TO_CHAR(FDEPTID) as FDEPTID,TO_CHAR(FNAME) as FNAME,TO_NUMBER(FLOCALEID) as FLOCALEID from T_BD_DEPARTMENT_L
) as FFLEX5_L, (select TO_CHAR(min(FEXPID)) as FEXPID,TO_CHAR(FNUMBER) as FNUMBER,TO_CHAR(FDocumentStatus) as FDocumentStatus,TO_CHAR(FForbidStatus) as FForbidStatus from T_BD_EXPENSE
where (FDocumentStatus!='A' and FDocumentStatus!='Z')

group by FNUMBER,FDocumentStatus,FForbidStatus
) as FFLEX9, (select TO_CHAR(FEXPID) as FEXPID,TO_CHAR(FNAME) as FNAME,TO_NUMBER(FLOCALEID) as FLOCALEID from T_BD_EXPENSE_L
) as FFLEX9_L where
(FF100004.FDocumentStatus!='A' and FF100004.FDocumentStatus!='Z')
and (FFLEX5.FDocumentStatus!='A' and FFLEX5.FDocumentStatus!='Z')
and (FFLEX9.FDocumentStatus!='A' and FFLEX9.FDocumentStatus!='Z')

and FF100004.FID=FF100004_L.FID and FF100004_L.FLOCALEID=2052 and FFLEX5.FDEPTID=FFLEX5_L.FDEPTID and FFLEX5_L.FLOCALEID=2052 and FFLEX9.FEXPID=FFLEX9_L.FEXPID and FFLEX9_L.FLOCALEID=2052
) m
left join (
Select FACCTID,FFLEX5,FFLEX9,FF100004,
Sum(FBeginBalanceFor) FBeginBalanceFor,Sum(FDebitFor) FDebitFor,Sum(FCreditFor) FCreditFor,Sum(FEndBalanceFor) FEndBalanceFor,
Sum(FBeginBalance) FBeginBalance,Sum(FDebit) FDebit,Sum(FCredit) FCredit,Sum(FEndBalance) FEndBalance
from (
select FACCTID,FFLEX5,FFLEX9,FF100004,
FBeginBalanceFor,FDebitFor,FCreditFor,FEndBalanceFor,FBeginBalance,FDebit,FCredit,FEndBalance from (
Select b.FACCOUNTID as FACCTID,FFLEX5,FFLEX9,FF100004,
ISNULL(Sum(ABS(b.FBeginBalanceFor)),0) FBeginBalanceFor,ISNULL(Sum(ABS(b.FDebitFor)),0) FDebitFor,ISNULL(Sum(ABS(b.FCreditFor)),0) FCreditFor,
ISNULL(Sum(ABS(b.FEndBalanceFor)),0) FEndBalanceFor,ISNULL(Sum(ABS(b.FBeginBalance)),0) FBeginBalance,
ISNULL(Sum(ABS(b.FDebit)),0) FDebit, ISNULL(Sum(ABS(b.FCredit)),0) FCredit,ISNULL(Sum(ABS(b.FEndBalance)),0) FEndBalance
From T_BD_FLEXITEMDETAILV f left join T_GL_BALANCE b on b.FDetailID=f.FID
left join T_BD_ACCOUNT a on b.FACCOUNTID=a.FACCTID
where b.FACCOUNTBOOKID=238201 and b.FDetailID<>0
and (FYear*100+FPeriod >=201501 and FYear*100+FPeriod <=201505)
AND b.FCurrencyID=1
and a.FNUMBER = '6601.01'
AND a.FFORBIDSTATUS='A'
Group by b.FACCOUNTID,f.FID,FFLEX5,FFLEX9,FF100004
) tbl
union
select FACCTID,FFLEX5,FFLEX9,FF100004,
FBeginBalanceFor,FDebitFor,FCreditFor,FEndBalanceFor,FBeginBalance,FDebit,FCredit,FEndBalance from (
Select e.FACCOUNTID as FACCTID,FFLEX5,FFLEX9,FF100004,
0 as FBeginBalanceFor,
ISNULL(Sum(ABS((case e.FDC when 1 then e.FAMOUNTFOR else 0 end))),0) as FDebitFor,
ISNULL(Sum(ABS((case e.FDC when -1 then e.FAMOUNTFOR else 0 end))),0) as FCreditFor,
0 as FEndBalanceFor,0 as FBeginBalance,
ISNULL(Sum(ABS((case e.FDC when 1 then e.FAMOUNT else 0 end))),0) as FDebit,
ISNULL(Sum(ABS((case e.FDC when -1 then e.FAMOUNT else 0 end))),0) as FCredit,
0 as FEndBalance
From T_BD_FLEXITEMDETAILV f left join T_GL_VOUCHERENTRY e on e.FDetailID=f.FID
inner join T_GL_VOUCHER v on v.FVOUCHERID=e.FVOUCHERID
left join T_BD_ACCOUNT a on e.FACCOUNTID=a.FACCTID
where v.FACCOUNTBOOKID=238201
and (FYear*100+FPeriod >=201501 and FYear*100+FPeriod <=201505)
AND e.FCurrencyID=1
and a.FNUMBER = '6601.01'
AND a.FFORBIDSTATUS='A'
Group by e.FACCOUNTID,FFLEX5,FFLEX9,FF100004
) tbl
) a where a.FACCTID!=0
Group by FACCTID,FFLEX5,FFLEX9,FF100004
) n
on m.FFLEX5=n.FFLEX5 and m.FFLEX9=n.FFLEX9 and m.FF100004=n.FF100004
order by m.FFLEX5,m.FFLEX9,m.FF100004

delete from TMP58889792165311E5BA190050568 where FDebitFor=0 and FCreditFor=0

at Kingdee.BOS.App.Data.Sql.SqlDatabase.ExecuteBatch(List`1 sqlArray, Int32 batchSize, Int32 commandTimeout)
at Kingdee.BOS.App.Data.DBUtils.ExecuteBatch(Context ctx, List`1 sqlArray, Int32 batchSize)
at Kingdee.K3.FIN.GL.App.Report.SubledgerForAcctItemsService.ComplexDetailDeal(String tmpTbl, String pagingDetailSql, List`1 dyCol)
at Kingdee.K3.FIN.GL.App.Report.SubledgerForAcctItemsService.PagingDeal(IRptParams filter)
at Kingdee.BOS.Core.Report.PlugIn.AbstractSysReportServicePlugIn.GetListAndReportData(IRptParams filter)
at Kingdee.BOS.Model.Report.MoveReportModel.GetData(Int32 start, Int32 rows)
at Kingdee.BOS.Web.Report.SysReportView.GetListData()
at Kingdee.BOS.Web.Report.SysReportView.<>c__DisplayClass36.b__32()