using BP.DA; using BP.Port; using BP.En; using BP.Sys; namespace BP.WF.Rpt { /// /// 报表定义 /// public class RptDfineAttr : EntityNoNameAttr { /// /// 查询的物理表 /// public const string PTable = "PTable"; /// /// 备注 /// public const string Note = "Note"; /// /// 流程编号 /// public const string FK_Flow = "FK_Flow"; /// /// 部门查询权限控制规则 /// public const string MyDeptRole = "MyDeptRole"; } /// /// 报表定义 /// public class RptDfine : EntityNoName { #region 属性 /// /// 本部门流程查询权限定义 /// public int MyDeptRole { get { return this.GetValIntByKey(RptDfineAttr.MyDeptRole); } set { this.SetValByKey(RptDfineAttr.MyDeptRole, value); } } #endregion #region 构造方法 public override UAC HisUAC { get { UAC uac = new UAC(); if (BP.Web.WebUser.IsAdmin) { uac.IsUpdate = true; uac.IsDelete = false; uac.IsView = true; uac.IsInsert = false; } else { uac.IsView = false; } return uac; } } /// /// 报表定义 /// public RptDfine() { } /// /// 报表定义 /// /// 映射编号 public RptDfine(string no) { this.No = no; this.Retrieve(); } /// /// EnMap /// public override Map EnMap { get { if (this._enMap != null) return this._enMap; Map map = new Map("WF_Flow", "报表定义"); map.CodeStruct = "4"; #region 基本属性. map.AddTBStringPK(RptDfineAttr.No, null, "编号", true, false, 1, 200, 20); map.AddTBString(RptDfineAttr.Name, null, "流程名称", true, false, 0, 500, 20); map.AddDDLSysEnum(RptDfineAttr.MyDeptRole, 0, "本部门发起的流程", true, true, RptDfineAttr.MyDeptRole, "@0=仅部门领导可以查看@1=部门下所有的人都可以查看@2=本部门里指定角色的人可以查看", true); //map.AddTBString(RptDfineAttr.PTable, null, "物理表", true, false, 0, 500, 20); //map.AddTBString(RptDfineAttr.Note, null, "备注", true, false, 0, 500, 20); #endregion 基本属性. #region 绑定的关联关系. map.AttrsOfOneVSM.Add(new RptStations(), new Stations(), RptStationAttr.FK_Rpt, RptStationAttr.FK_Station, DeptAttr.Name, DeptAttr.No, "角色权限"); map.AttrsOfOneVSM.Add(new RptDepts(), new Depts(), RptDeptAttr.FK_Rpt, RptDeptAttr.FK_Dept, DeptAttr.Name, DeptAttr.No, "部门权限"); map.AttrsOfOneVSM.Add(new RptEmps(), new Emps(), RptEmpAttr.FK_Rpt, RptEmpAttr.FK_Emp, DeptAttr.Name, DeptAttr.No, "人员权限"); #endregion #region 我发起的流程. map.AddGroupMethod("我发起的流程"); RefMethod rm = new RefMethod(); rm = new RefMethod(); rm.Title = "设置显示的列"; rm.Icon = "../../WF/Admin/RptDfine/Img/SelectCols.png"; rm.ClassMethodName = this.ToString() + ".DoColsChoseOf_MyStartFlow()"; rm.RefMethodType = RefMethodType.RightFrameOpen; map.AddRefMethod(rm); rm = new RefMethod(); rm.Title = "设置显示列次序"; rm.Icon = "../../WF/Admin/RptDfine/Img/Order.png"; rm.ClassMethodName = this.ToString() + ".DoColsOrder_MyStartFlow()"; rm.RefMethodType = RefMethodType.RightFrameOpen; map.AddRefMethod(rm); rm = new RefMethod(); rm.Title = "设置查询条件"; rm.Icon = "../../WF/Admin/RptDfine/Img/SearchCond.png"; rm.ClassMethodName = this.ToString() + ".DoSearchCond_MyStartFlow()"; rm.RefMethodType = RefMethodType.RightFrameOpen; map.AddRefMethod(rm); rm = new RefMethod(); rm.Title = "设置导出模板"; rm.Icon = "../../WF/Img/Guide.png"; rm.ClassMethodName = this.ToString() + ".DoRptExportTemplate_MyStartFlow()"; rm.RefMethodType = RefMethodType.RightFrameOpen; rm.Visable = false; map.AddRefMethod(rm); rm = new RefMethod(); rm.Title = "执行查询"; rm.Icon = "../../WF/Admin/CCBPMDesigner/Img/Search.png"; rm.ClassMethodName = this.ToString() + ".DoSearch_MyStartFlow()"; rm.RefMethodType = RefMethodType.RightFrameOpen; map.AddRefMethod(rm); rm = new RefMethod(); rm.Title = "执行分析"; rm.Icon = "../../WF/Admin/CCBPMDesigner/Img/Group.png"; rm.ClassMethodName = this.ToString() + ".DoGroup_MyStartFlow()"; rm.RefMethodType = RefMethodType.RightFrameOpen; map.AddRefMethod(rm); rm = new RefMethod(); rm.Title = "恢复设置"; rm.Icon = "../../WF/Admin/RptDfine/Img/Reset.png"; rm.Warning = "您确定要执行吗?如果确定,以前配置将清空。"; rm.ClassMethodName = this.ToString() + ".DoReset_MyStartFlow()"; rm.RefMethodType = RefMethodType.Func; map.AddRefMethod(rm); #endregion 我发起的流程. #region 我审批的流程. map.AddGroupMethod("我审批的流程"); rm = new RefMethod(); rm.Title = "设置显示的列"; rm.Icon = "../../WF/Admin/RptDfine/Img/SelectCols.png"; rm.ClassMethodName = this.ToString() + ".DoColsChoseOf_MyJoinFlow()"; rm.RefMethodType = RefMethodType.RightFrameOpen; map.AddRefMethod(rm); rm = new RefMethod(); rm.Title = "设置显示列次序"; rm.Icon = "../../WF/Admin/RptDfine/Img/Order.png"; rm.ClassMethodName = this.ToString() + ".DoColsOrder_MyJoinFlow()"; rm.RefMethodType = RefMethodType.RightFrameOpen; map.AddRefMethod(rm); rm = new RefMethod(); rm.Title = "设置查询条件"; rm.Icon = "../../WF/Admin/RptDfine/Img/SearchCond.png"; rm.ClassMethodName = this.ToString() + ".DoSearchCond_MyJoinFlow()"; rm.RefMethodType = RefMethodType.RightFrameOpen; map.AddRefMethod(rm); //rm = new RefMethod(); //rm.Title = "设置导出模板"; //rm.Icon = "../../WF/Img/Guide.png"; //rm.ClassMethodName = this.ToString() + ".DoRptExportTemplate_MyJoinFlow()"; //rm.RefMethodType = RefMethodType.RightFrameOpen; //rm.GroupName = "我参与的流程"; //map.AddRefMethod(rm); rm = new RefMethod(); rm.Title = "执行查询"; rm.Icon = "../../WF/Admin/CCBPMDesigner/Img/Search.png"; rm.ClassMethodName = this.ToString() + ".DoSearch_MyJoinFlow()"; rm.RefMethodType = RefMethodType.RightFrameOpen; map.AddRefMethod(rm); rm = new RefMethod(); rm.Title = "执行分析"; rm.Icon = "../../WF/Admin/CCBPMDesigner/Img/Group.png"; rm.ClassMethodName = this.ToString() + ".DoGroup_MyJoinFlow()"; rm.RefMethodType = RefMethodType.RightFrameOpen; map.AddRefMethod(rm); rm = new RefMethod(); rm.Title = "恢复设置"; rm.Icon = "../../WF/Admin/RptDfine/Img/Reset.png"; rm.Warning = "您确定要执行吗?"; rm.ClassMethodName = this.ToString() + ".DoReset_MyJoinFlow()"; rm.RefMethodType = RefMethodType.Func; map.AddRefMethod(rm); #endregion 我发起的流程. #region 我部门发起的流程. map.AddGroupMethod("本部门发起的流程"); rm = new RefMethod(); rm.Title = "设置显示的列"; rm.Icon = "../../WF/Admin/RptDfine/Img/SelectCols.png"; rm.ClassMethodName = this.ToString() + ".DoColsChoseOf_MyDeptFlow()"; rm.RefMethodType = RefMethodType.RightFrameOpen; map.AddRefMethod(rm); rm = new RefMethod(); rm.Title = "设置显示列次序"; rm.Icon = "../../WF/Admin/RptDfine/Img/Order.png"; rm.ClassMethodName = this.ToString() + ".DoColsOrder_MyDeptFlow()"; rm.RefMethodType = RefMethodType.RightFrameOpen; map.AddRefMethod(rm); rm = new RefMethod(); rm.Title = "设置查询条件"; rm.Icon = "../../WF/Admin/RptDfine/Img/SearchCond.png"; rm.ClassMethodName = this.ToString() + ".DoSearchCond_MyDeptFlow()"; rm.RefMethodType = RefMethodType.RightFrameOpen; map.AddRefMethod(rm); rm = new RefMethod(); rm.Title = "设置导出模板"; rm.Icon = "../../WF/Img/Guide.png"; rm.ClassMethodName = this.ToString() + ".DoRptExportTemplate_MyDeptFlow()"; rm.RefMethodType = RefMethodType.RightFrameOpen; rm.Visable = false; map.AddRefMethod(rm); rm = new RefMethod(); rm.Title = "执行查询"; rm.Icon = "../../WF/Admin/CCBPMDesigner/Img/Search.png"; rm.ClassMethodName = this.ToString() + ".DoSearch_MyDeptFlow()"; rm.RefMethodType = RefMethodType.RightFrameOpen; map.AddRefMethod(rm); rm = new RefMethod(); rm.Title = "执行分析"; rm.Icon = "../../WF/Admin/CCBPMDesigner/Img/Group.png"; rm.ClassMethodName = this.ToString() + ".DoGroup_MyDeptFlow()"; rm.RefMethodType = RefMethodType.RightFrameOpen; map.AddRefMethod(rm); rm = new RefMethod(); rm.Title = "恢复设置"; rm.Icon = "../../WF/Admin/RptDfine/Img/Reset.png"; rm.Warning = "您确定要执行吗?"; rm.ClassMethodName = this.ToString() + ".DoReset_MyDeptFlow()"; rm.RefMethodType = RefMethodType.Func; map.AddRefMethod(rm); #endregion 我部门发起的流程. #region 高级查询. map.AddGroupMethod("高级查询"); rm = new RefMethod(); rm.Title = "设置显示的列"; rm.Icon = "../../WF/Admin/RptDfine/Img/SelectCols.png"; rm.ClassMethodName = this.ToString() + ".DoColsChoseOf_AdminerFlow()"; rm.RefMethodType = RefMethodType.RightFrameOpen; map.AddRefMethod(rm); rm = new RefMethod(); rm.Title = "设置显示列次序"; rm.Icon = "../../WF/Admin/RptDfine/Img/Order.png"; rm.ClassMethodName = this.ToString() + ".DoColsOrder_AdminerFlow()"; rm.RefMethodType = RefMethodType.RightFrameOpen; map.AddRefMethod(rm); rm = new RefMethod(); rm.Title = "设置查询条件"; rm.Icon = "../../WF/Admin/RptDfine/Img/SearchCond.png"; rm.ClassMethodName = this.ToString() + ".DoSearchCond_AdminerFlow()"; rm.RefMethodType = RefMethodType.RightFrameOpen; map.AddRefMethod(rm); rm = new RefMethod(); rm.Title = "设置导出模板"; rm.Icon = "../../WF/Img/Guide.png"; rm.ClassMethodName = this.ToString() + ".DoRptExportTemplate_AdminerFlow()"; rm.RefMethodType = RefMethodType.RightFrameOpen; rm.Visable=false; map.AddRefMethod(rm); rm = new RefMethod(); rm.Title = "执行查询"; rm.Icon = "../../WF/Admin/CCBPMDesigner/Img/Search.png"; rm.ClassMethodName = this.ToString() + ".DoSearch_AdminerFlow()"; rm.RefMethodType = RefMethodType.RightFrameOpen; map.AddRefMethod(rm); rm = new RefMethod(); rm.Title = "执行分析"; rm.Icon = "../../WF/Admin/CCBPMDesigner/Img/Group.png"; rm.ClassMethodName = this.ToString() + ".DoGroup_AdminerFlow()"; rm.RefMethodType = RefMethodType.RightFrameOpen; map.AddRefMethod(rm); rm = new RefMethod(); rm.Title = "查询权限"; rm.Icon = "../../WF/Admin/CCBPMDesigner/Img/Search.png"; rm.ClassMethodName = this.ToString() + ".DoReset_AdminerFlowRight()"; rm.RefMethodType = RefMethodType.RightFrameOpen; map.AddRefMethod(rm); rm = new RefMethod(); rm.Title = "恢复设置"; rm.Icon = "../../WF/Admin/RptDfine/Img/Reset.png"; rm.Warning = "您确定要执行吗?"; rm.ClassMethodName = this.ToString() + ".DoReset_AdminerFlow()"; rm.RefMethodType = RefMethodType.Func; map.AddRefMethod(rm); #endregion 高级查询. this._enMap = map; return this._enMap; } } #endregion #region 通用方法. /// /// 选择的列 /// /// /// public string DoColsChose(string rptMark) { return "../../Admin/RptDfine/S2ColsChose.htm?FK_Flow=" + this.No + "&RptNo=ND" + int.Parse(this.No) +"Rpt"+ rptMark ; } /// /// 列的次序 /// /// /// public string DoColsOrder(string rptMark) { return "../../Admin/RptDfine/S3ColsLabel.htm?FK_Flow=" + this.No + "&RptNo=ND" + int.Parse(this.No) +"Rpt"+ rptMark ; } /// /// 查询条件设置 /// /// /// public string DoSearchCond(string rptMark) { return "../../Admin/RptDfine/S5SearchCond.htm?FK_Flow=" + this.No + "&RptNo=ND" + int.Parse(this.No) +"Rpt" + rptMark ; } /// /// 导出模版设置 /// /// /// public string DoRptExportTemplate(string rptMark) { return "../../Admin/RptDfine/S8_RptExportTemplate.htm?FK_Flow=" + this.No + "&RptNo=ND" + int.Parse(this.No)+"Rpt" + rptMark; } public static string PublicFiels = ",OID,FK_Dept,FK_DeptName,FlowStarter,Title,FlowStartRDT,FlowEmps,WFState,WFSta,"; public void InitBaseAttr(MapData md) { // string keys = ",OID,FK_Dept,FlowStarter,WFState,Title,FlowStarter,FlowStartRDT,FlowEmps,FlowDaySpan,FlowEnder,FlowEnderRDT,FK_NY,FlowEndNode,WFSta,"; //必须的字段. /// string keys = ",OID,FK_Dept,FlowStarter,Title,FlowStartRDT,FlowEmps,"; //string keys = ",OID,Title,WFSta,"; //查询出来所有的字段. MapAttrs attrs = new MapAttrs("ND" + int.Parse(this.No) + "Rpt"); attrs.Delete(MapAttrAttr.FK_MapData, md.No); // 删除已经有的字段。 foreach (MapAttr attr in attrs) { if (PublicFiels.Contains("," + attr.KeyOfEn + ",") == false) continue; attr.FrmID =md.No; attr.setUIIsEnable(false); attr.Idx = 0; #region 判断特殊的字段. switch (attr.KeyOfEn) { case GERptAttr.WFSta: attr.UIBindKey = "WFSta"; attr.setUIContralType(UIContralType.DDL); attr.setLGType(FieldTypeS.Enum); attr.setUIVisible(false); attr.DefVal = "0"; attr.setMaxLen(100); attr.setUIVisible(true); attr.Update(); break; case GERptAttr.FK_Dept: attr.UIBindKey = ""; //attr.UIBindKey = "BP.Port.Depts"; attr.setUIContralType(UIContralType.TB); attr.setLGType(FieldTypeS.Normal); attr.setUIVisible(false); attr.DefVal = ""; attr.setMaxLen(100); attr.setUIVisible(false); attr.Update(); break; case GERptAttr.FK_DeptName: attr.UIBindKey = ""; //attr.UIBindKey = "BP.Port.Depts"; attr.setUIContralType(UIContralType.TB); attr.setLGType(FieldTypeS.Normal); attr.setUIVisible(false); attr.DefVal = ""; attr.setMaxLen(100); attr.setUIVisible(false); break; case GERptAttr.FK_NY: attr.UIBindKey = "BP.Pub.NYs"; attr.setUIContralType(UIContralType.DDL); attr.setLGType(FieldTypeS.FK); attr.setUIVisible(true); attr.setUIIsEnable(false); //attr.GroupID = groupID; attr.Update(); break; case GERptAttr.Title: attr.UIWidth = 120; attr.setUIVisible(true); attr.Idx = 0; break; case GERptAttr.FlowStarter: attr.setUIIsEnable(false); attr.setUIVisible(false); attr.UIBindKey = ""; //attr.UIBindKey = "BP.Port.Depts"; attr.setUIContralType(UIContralType.TB); attr.setLGType(FieldTypeS.Normal); break; case GERptAttr.FlowEmps: attr.setUIIsEnable(false); attr.setUIVisible(false); attr.UIBindKey = ""; //attr.UIBindKey = "BP.Port.Depts"; attr.setUIContralType(UIContralType.TB); attr.setLGType(FieldTypeS.Normal); break; case GERptAttr.WFState: attr.setUIIsEnable(false); attr.setUIVisible(false); attr.UIBindKey = ""; //attr.UIBindKey = "BP.Port.Depts"; attr.setUIContralType(UIContralType.TB); attr.setLGType(FieldTypeS.Normal); attr.setMyDataType(BP.DA.DataType.AppInt); break; case GERptAttr.FlowEndNode: //attr.setLGType(FieldTypeS.FK); //attr.UIBindKey = "BP.WF.Template.NodeExts"; //attr.setUIContralType(UIContralType.DDL); break; case "FK_Emp": break; default: break; } #endregion attr.Insert(); } } /// /// 重置设置. /// public string DoReset(string rptMark) { MapData md = new MapData(); md.No = "ND" + int.Parse(this.No) + "Rpt" + rptMark; if (md.RetrieveFromDBSources() == 0) { if (rptMark.Equals("My")) md.Name = "我发起的流程"; if (rptMark.Equals("MyJoin")) md.Name = "我审批的流程"; if (rptMark.Equals("MyDept")) md.Name = "本部门发起的流程"; if (rptMark.Equals("Adminer")) md.Name = "高级查询"; md.Insert(); } md.ItIsSearchKey = true; //按关键查询. md.DTSearchWay = DTSearchWay.None; //按日期查询. md.DTSearchKey = ""; //设置查询条件. switch (rptMark) { case "My": case "MyJoin": case "MyDept": //md.RptSearchKeys = "*WFSta*FK_NY*"; //查询条件. break; case "Adminer": // md.RptSearchKeys = "*WFSta*FK_NY*"; //查询条件. break; default: break; } Flow fl = new Flow(this.No); md.PTable = fl.PTable; md.Update(); this.InitBaseAttr(md); //删除该数据的Search 的缓存. string sql = "DELETE FROM Sys_UserRegedit WHERE MyPK LIKE '%ND"+int.Parse(this.No)+"Rpt%'"; DBAccess.RunSQL(sql); return "标记为: "+rptMark + "的报表,重置成功..."; } #endregion #region 我发起的流程 /// /// 设置选择的列 /// /// public string DoColsChoseOf_MyStartFlow() { return this.DoColsChose("My"); } /// /// 列的次序 /// /// public string DoColsOrder_MyStartFlow() { return DoColsOrder("My"); } /// /// 查询条件 /// /// public string DoSearchCond_MyStartFlow() { return DoSearchCond("My"); } /// /// 导出模版. /// /// public string DoRptExportTemplate_MyStartFlow() { return DoRptExportTemplate("My"); } /// /// 重置 /// /// public string DoReset_MyStartFlow() { return DoReset("My"); } /// /// 查询 /// /// public string DoSearch_MyStartFlow() { return "../../RptDfine/Search.htm?SearchType=My&FK_Flow=" + this.No; } /// /// 分析 /// /// public string DoGroup_MyStartFlow() { return "../../RptDfine/Group.htm?GroupType=My&FK_Flow=" + this.No; } #endregion #region 我参与的流程 /// /// 设置选择的列 /// /// public string DoColsChoseOf_MyJoinFlow() { return this.DoColsChose("MyJoin"); } /// /// 列的次序 /// /// public string DoColsOrder_MyJoinFlow() { return DoColsOrder("MyJoin"); } /// /// 查询条件 /// /// public string DoSearchCond_MyJoinFlow() { return DoSearchCond("MyJoin"); } /// /// 导出模版. /// /// public string DoRptExportTemplate_MyJoinFlow() { return DoRptExportTemplate("MyJoin"); } /// /// 重置 /// /// public string DoReset_MyJoinFlow() { return DoReset("MyJoin"); } /// /// 查询 /// /// public string DoSearch_MyJoinFlow() { return "../../RptDfine/Search.htm?SearchType=MyJoin&FK_Flow=" + this.No; } public string DoGroup_MyJoinFlow() { return "../../RptDfine/Group.htm?GroupType=MyJoin&FK_Flow=" + this.No; } #endregion 我审批的流程 #region 本部门发起的流程 /// /// 设置选择的列 /// /// public string DoColsChoseOf_MyDeptFlow() { return this.DoColsChose("MyDept"); } /// /// 列的次序 /// /// public string DoColsOrder_MyDeptFlow() { return DoColsOrder("MyDept"); } /// /// 查询条件 /// /// public string DoSearchCond_MyDeptFlow() { return DoSearchCond("MyDept"); } /// /// 导出模版. /// /// public string DoRptExportTemplate_MyDeptFlow() { return DoRptExportTemplate("MyDept"); } /// /// 重置 /// /// public string DoReset_MyDeptFlow() { return DoReset("MyDept"); } /// /// 查询 /// /// public string DoSearch_MyDeptFlow() { return "../../RptDfine/Search.htm?SearchType=MyDept&FK_Flow=" + this.No; } /// /// 分析 /// /// public string DoGroup_MyDeptFlow() { return "../../RptDfine/Group.htm?GroupType=MyDept&FK_Flow=" + this.No; } #endregion 本部门发起的流程 #region 高级查询 /// /// 设置选择的列 /// /// public string DoColsChoseOf_AdminerFlow() { return this.DoColsChose("Adminer"); } /// /// 列的次序 /// /// public string DoColsOrder_AdminerFlow() { return DoColsOrder("Adminer"); } /// /// 查询条件 /// /// public string DoSearchCond_AdminerFlow() { return DoSearchCond("Adminer"); } /// /// 导出模版. /// /// public string DoRptExportTemplate_AdminerFlow() { return DoRptExportTemplate("Adminer"); } /// /// 重置 /// /// public string DoReset_AdminerFlow() { return DoReset("Adminer"); } /// /// 查询 /// /// public string DoSearch_AdminerFlow() { return "../../RptDfine/Search.htm?SearchType=Adminer&FK_Flow=" + this.No; } /// /// 分析 /// /// public string DoGroup_AdminerFlow() { return "../../RptDfine/Group.htm?GroupType=Adminer&FK_Flow=" + this.No; } public string DoReset_AdminerFlowRight() { return "../../Admin/RptDfine/AdvSearchRight.htm?FK_Flow=" + this.No; } #endregion 高级查询 } /// /// 报表定义s /// public class RptDfines : EntitiesNoName { #region 构造 /// /// 报表定义s /// public RptDfines() { } /// /// 得到它的 Entity /// public override Entity GetNewEntity { get { return new RptDfine(); } } #endregion #region 为了适应自动翻译成java的需要,把实体转换成List. /// /// 转化成 java list,C#不能调用. /// /// List public System.Collections.Generic.IList ToJavaList() { return (System.Collections.Generic.IList)this; } /// /// 转化成list /// /// List public System.Collections.Generic.List Tolist() { System.Collections.Generic.List list = new System.Collections.Generic.List(); for (int i = 0; i < this.Count; i++) { list.Add((RptDfine)this[i]); } return list; } #endregion 为了适应自动翻译成java的需要,把实体转换成List. } }