以下是一个测试数型账表的例子:
[Description("车辆关锁关联表")]
public class TruckLockReportService : SysReportBaseService
{
public override void Initialize()
{
this.ReportProperty.ReportType = ReportType.REPORTTYPE_TREE;
this.IsCreateTempTableByPlugin = false;
}
public override List
{
//属性报表添加数据源
List
StringBuilder sb = new StringBuilder();
sb.Append("select FID,Fname from T_TruckInfo_L where FLocaleID=2052");
DynamicObjectCollection DOCL = DBUtils.ExecuteDynamicObject(this.Context, sb.ToString());
for (int i = 0; i < DOCL.Count; i++)
{
TreeNode rootNode = new TreeNode()
{
id = DOCL[i]["FID"].ToString(),
text = DOCL[i]["FName"].ToString()
};
nodelist.Add(rootNode);
}
return nodelist;
//return base.GetTreeNodes(filter);
}
public override Kingdee.BOS.Core.Report.ReportHeader GetReportHeaders(Kingdee.BOS.Core.Report.IRptParams filter)
{
ReportHeader header = new ReportHeader();
header.AddChild("FNUMBER", new LocaleValue("调度编码", this.Context.UserLocale.LCID));
header.AddChild("FTYPE", new LocaleValue("类型", this.Context.UserLocale.LCID));
header.AddChild("FDOCUMENTSTATUS", new LocaleValue("状态", this.Context.UserLocale.LCID));
return header;
}
public override ReportTitles GetReportTitles(IRptParams filter)
{
return base.GetReportTitles(filter);
}
protected override string BuilderSelectFieldSQL(IRptParams filter)
{
//return "select Field1、Field2"
string sqlstr = "select FID,FNUMBER,FDOCUMENTSTATUS,FFORBIDSTATUS,FMODIFIERID,FCREATORID,FCREATEDATE,FMODIFYDATE,FREMARK,FCOMBO,FTYPE,FPRICE,FAMOUNT ";
return sqlstr;
}
///构建from where语句
protected override string BuilderFromWhereSQL(IRptParams filter)
{
//return " from tc join td on tc.f1=td.f2 where tc.f3='demo' "
string Cdtstr = " from T_LockInfo";
if (((TreeRptParams)filter).CurrentGroupID != null && ((TreeRptParams)filter).CurrentGroupID.ToString() != "-1")
{
Cdtstr += " where FID in (select FLOCKID from t_LocksOfTruck where Fid =" + ((TreeRptParams)filter).CurrentGroupID.ToString() + " )";
}
return Cdtstr;
}
///构建order by语句
protected override string BuilderTempTableOrderBySQL(IRptParams filter)
{
return " fID ASC";
}
public override void BuilderReportSqlAndTempTable(IRptParams filter, string tableName)
{
//FID,FNUMBER,FDOCUMENTSTATUS,FFORBIDSTATUS,FMODIFIERID,FCREATORID,FCREATEDATE,FMODIFYDATE,FREMARK,FCOMBO,FTYPE,FPRICE,FAMOUNT
base.BuilderReportSqlAndTempTable(filter, tableName);
}
}
已经重载了GetTreeNodes方法,左侧的树形也已经出来了,但是左侧树状是个无效的控件,点击“全部”旁边“-”不能收起,并且鼠标滑过树状项,也没有背景的变化(其他一些分组的树状控件会有背景色变化);点击树状项也没用;
仿佛这个控件无效了一样,所以就在 报表插件做如下处理。enables设置为TRUE,还是无效!!
[Description("车辆关锁关联插件")]
public class TruckLockReport : AbstractSysReportPlugIn
{
public override void OnInitialize(Kingdee.BOS.Core.DynamicForm.PlugIn.Args.InitializeEventArgs e)
{
this.View.GetControl
base.OnInitialize(e);
}
public override void TreeLoadData(Kingdee.BOS.Core.DynamicForm.PlugIn.Args.TreeLoadDataArgs e)
{
base.TreeLoadData(e);
}
public override void TreeNodeClick(Kingdee.BOS.Core.DynamicForm.PlugIn.Args.TreeNodeArgs e)
{
this.View.ShowMessage(e.Key +"---"+e.NodeId );
base.TreeNodeClick(e);
}
求高手指教,怎么让数型账表生效?????
推荐阅读