using System; using BP.En; namespace BP.WF.Data { /// /// 流程监控 /// public class MonitorAttr { #region 基本属性 /// /// 工作ID /// public const string WorkID = "WorkID"; /// /// 工作流 /// public const string FK_Flow = "FK_Flow"; /// /// 流程状态 /// public const string WFState = "WFState"; /// /// 流程状态(简单) /// public const string WFSta = "WFSta"; /// /// 标题 /// public const string Title = "Title"; /// /// 发起人 /// public const string Starter = "Starter"; /// /// 产生时间 /// public const string RDT = "RDT"; /// /// 完成时间 /// public const string CDT = "CDT"; /// /// 得分 /// public const string Cent = "Cent"; /// /// 当前工作到的节点. /// public const string FK_Node = "FK_Node"; /// /// 当前工作角色 /// public const string FK_Station = "FK_Station"; /// /// 部门 /// public const string FK_Dept = "FK_Dept"; /// /// 流程ID /// public const string FID = "FID"; /// /// 是否启用 /// public const string IsEnable = "IsEnable"; /// /// 流程名称 /// public const string FlowName = "FlowName"; /// /// 发起人名称 /// public const string StarterName = "StarterName"; /// /// 节点名称 /// public const string NodeName = "NodeName"; /// /// 部门名称 /// public const string DeptName = "DeptName"; /// /// 流程类别 /// public const string FK_Emp = "FK_Emp"; /// /// 优先级 /// public const string PRI = "PRI"; /// /// 流程应完成时间 /// public const string SDTOfFlow = "SDTOfFlow"; /// /// 节点应完成时间 /// public const string SDTOfNode = "SDTOfNode"; /// /// 父流程ID /// public const string PWorkID = "PWorkID"; /// /// 父流程编号 /// public const string PFlowNo = "PFlowNo"; /// /// 父流程节点 /// public const string PNodeID = "PNodeID"; /// /// 子流程的调用人. /// public const string PEmp = "PEmp"; /// /// 客户编号(对于客户发起的流程有效) /// public const string GuestNo = "GuestNo"; /// /// 客户名称 /// public const string GuestName = "GuestName"; /// /// 单据编号 /// public const string BillNo = "BillNo"; /// /// 备注 /// public const string FlowNote = "FlowNote"; /// /// 待办人员 /// public const string TodoEmps = "TodoEmps"; /// /// 待办人员数量 /// public const string TodoEmpsNum = "TodoEmpsNum"; /// /// 任务状态 /// public const string TaskSta = "TaskSta"; /// /// 临时存放的参数 /// public const string AtPara = "AtPara"; /// /// 参与人 /// public const string Emps = "Emps"; /// /// GUID /// public const string GUID = "GUID"; #endregion } /// /// 流程监控 /// public class Monitor : Entity { #region 基本属性 public override UAC HisUAC { get { UAC uac = new UAC(); uac.Readonly(); return uac; } } /// /// 主键 /// public override string PK { get { return MonitorAttr.WorkID; } } /// /// 工作流程编号 /// public string FK_Flow { get { return this.GetValStrByKey(MonitorAttr.FK_Flow); } set { SetValByKey(MonitorAttr.FK_Flow,value); } } /// /// BillNo /// public string BillNo { get { return this.GetValStrByKey(MonitorAttr.BillNo); } set { SetValByKey(MonitorAttr.BillNo, value); } } /// /// 流程名称 /// public string FlowName { get { return this.GetValStrByKey(MonitorAttr.FlowName); } set { SetValByKey(MonitorAttr.FlowName, value); } } /// /// 优先级 /// public int PRI { get { return this.GetValIntByKey(MonitorAttr.PRI); } set { SetValByKey(MonitorAttr.PRI, value); } } /// /// 待办人员数量 /// public int TodoEmpsNum { get { return this.GetValIntByKey(MonitorAttr.TodoEmpsNum); } set { SetValByKey(MonitorAttr.TodoEmpsNum, value); } } /// /// 待办人员列表 /// public string TodoEmps { get { return this.GetValStrByKey(MonitorAttr.TodoEmps); } set { SetValByKey(MonitorAttr.TodoEmps, value); } } /// /// 参与人 /// public string Emps { get { return this.GetValStrByKey(MonitorAttr.Emps); } set { SetValByKey(MonitorAttr.Emps, value); } } /// /// 状态 /// public TaskSta TaskSta { get { return (TaskSta)this.GetValIntByKey(MonitorAttr.TaskSta); } set { SetValByKey(MonitorAttr.TaskSta, (int)value); } } /// /// 类别编号 /// public string FK_Emp { get { return this.GetValStrByKey(MonitorAttr.FK_Emp); } set { SetValByKey(MonitorAttr.FK_Emp, value); } } /// /// 部门编号 /// public string FK_Dept { get { return this.GetValStrByKey(MonitorAttr.FK_Dept); } set { SetValByKey(MonitorAttr.FK_Dept,value); } } /// /// 标题 /// public string Title { get { return this.GetValStrByKey(MonitorAttr.Title); } set { SetValByKey(MonitorAttr.Title,value); } } /// /// 客户编号 /// public string GuestNo { get { return this.GetValStrByKey(MonitorAttr.GuestNo); } set { SetValByKey(MonitorAttr.GuestNo, value); } } /// /// 客户名称 /// public string GuestName { get { return this.GetValStrByKey(MonitorAttr.GuestName); } set { SetValByKey(MonitorAttr.GuestName, value); } } /// /// 产生时间 /// public string RDT { get { return this.GetValStrByKey(MonitorAttr.RDT); } set { SetValByKey(MonitorAttr.RDT,value); } } /// /// 节点应完成时间 /// public string SDTOfNode { get { return this.GetValStrByKey(MonitorAttr.SDTOfNode); } set { SetValByKey(MonitorAttr.SDTOfNode, value); } } /// /// 流程应完成时间 /// public string SDTOfFlow { get { return this.GetValStrByKey(MonitorAttr.SDTOfFlow); } set { SetValByKey(MonitorAttr.SDTOfFlow, value); } } /// /// 流程ID /// public Int64 WorkID { get { return this.GetValInt64ByKey(MonitorAttr.WorkID); } set { SetValByKey(MonitorAttr.WorkID,value); } } /// /// 主线程ID /// public Int64 FID { get { return this.GetValInt64ByKey(MonitorAttr.FID); } set { SetValByKey(MonitorAttr.FID, value); } } /// /// 父节点流程编号. /// public Int64 PWorkID { get { return this.GetValInt64ByKey(MonitorAttr.PWorkID); } set { SetValByKey(MonitorAttr.PWorkID, value); } } /// /// 父流程调用的节点 /// public int PNodeID { get { return this.GetValIntByKey(MonitorAttr.PNodeID); } set { SetValByKey(MonitorAttr.PNodeID, value); } } /// /// PFlowNo /// public string PFlowNo { get { return this.GetValStrByKey(MonitorAttr.PFlowNo); } set { SetValByKey(MonitorAttr.PFlowNo, value); } } /// /// 吊起子流程的人员 /// public string PEmp { get { return this.GetValStrByKey(MonitorAttr.PEmp); } set { SetValByKey(MonitorAttr.PEmp, value); } } /// /// 发起人 /// public string Starter { get { return this.GetValStrByKey(MonitorAttr.Starter); } set { SetValByKey(MonitorAttr.Starter, value); } } /// /// 发起人名称 /// public string StarterName { get { return this.GetValStrByKey(MonitorAttr.StarterName); } set { this.SetValByKey(MonitorAttr.StarterName, value); } } /// /// 发起人部门名称 /// public string DeptName { get { return this.GetValStrByKey(MonitorAttr.DeptName); } set { this.SetValByKey(MonitorAttr.DeptName, value); } } /// /// 当前节点名称 /// public string NodeName { get { return this.GetValStrByKey(MonitorAttr.NodeName); } set { this.SetValByKey(MonitorAttr.NodeName, value); } } /// /// 当前工作到的节点 /// public int FK_Node { get { return this.GetValIntByKey(MonitorAttr.FK_Node); } set { SetValByKey(MonitorAttr.FK_Node, value); } } /// /// 工作流程状态 /// public WFState WFState { get { return (WFState)this.GetValIntByKey(MonitorAttr.WFState); } set { if (value == WF.WFState.Complete) SetValByKey(MonitorAttr.WFSta, (int)WFSta.Complete); else if (value == WF.WFState.Delete) SetValByKey(MonitorAttr.WFSta, (int)WFSta.Etc); else SetValByKey(MonitorAttr.WFSta, (int)WFSta.Runing); SetValByKey(MonitorAttr.WFState, (int)value); } } /// /// 状态(简单) /// public WFSta WFSta { get { return (WFSta)this.GetValIntByKey(MonitorAttr.WFSta); } set { SetValByKey(MonitorAttr.WFSta, (int)value); } } public string WFStateText { get { BP.WF.WFState ws = (WFState)this.WFState; switch(ws) { case WF.WFState.Complete: return "已完成"; case WF.WFState.Runing: return "在运行"; case WF.WFState.Hungup: return "挂起"; case WF.WFState.Askfor: return "加签"; default: return "未判断"; } } } /// /// GUID /// public string GUID { get { return this.GetValStrByKey(MonitorAttr.GUID); } set { SetValByKey(MonitorAttr.GUID, value); } } #endregion #region 参数属性. #endregion 参数属性. #region 构造函数 /// /// 工作实例 /// public Monitor() { } public Monitor(Int64 workId) { QueryObject qo = new QueryObject(this); qo.AddWhere(MonitorAttr.WorkID, workId); if (qo.DoQuery() == 0) throw new Exception("工作 WF_GenerWorkFlow [" + workId + "]不存在。"); } /// /// 执行修复 /// public void DoRepair() { } /// /// 重写基类方法 /// public override Map EnMap { get { if (this._enMap != null) return this._enMap; Map map = new Map("WF_EmpWorks", "流程监控"); map.setEnType(EnType.View); map.AddTBIntPK(MonitorAttr.WorkID, 0, "工作ID", true, true); map.AddTBInt(MonitorAttr.FID, 0, "FID", false, false); map.AddTBString(MonitorAttr.Title, null, "流程标题", true, false, 0, 300, 10,true); map.AddTBString(MonitorAttr.FK_Emp, null, "当前处理人员", true, false, 0, 50, 10); map.AddDDLEntities(MonitorAttr.FK_Flow, null, "流程", new Flows(), false); map.AddDDLEntities(MonitorAttr.FK_Dept, null, "发起部门", new BP.Port.Depts(), false); map.AddTBString(MonitorAttr.Starter, null, "发起人编号", true, false, 0, 30, 10); map.AddTBString(MonitorAttr.StarterName, null, "名称", true, false, 0, 30, 10); map.AddTBString(MonitorAttr.NodeName, null, "停留节点", true, false, 0, 100, 10); map.AddTBString(MonitorAttr.TodoEmps, null, "处理人", true, false, 0, 100, 10); map.AddTBStringDoc(MonitorAttr.FlowNote, null, "备注", true, false,true); map.AddTBInt(MonitorAttr.FK_Node, 0, "FK_Node", false, false); //map.AddTBString(MonitorAttr.WorkerDept, null, "工作人员部门编号", // false, false, 0, 30, 10); //查询条件. map.AddSearchAttr(MonitorAttr.FK_Dept); map.AddSearchAttr(MonitorAttr.FK_Flow); ////增加隐藏的查询条件. //SearchNormal search = new SearchNormal(MonitorAttr.WorkerDept, "部门", // MonitorAttr.WorkerDept, "=", BP.Web.WebUser.FK_Dept, 0, true); //map.SearchNormals.Add(search); RefMethod rm = new RefMethod(); rm.Title = "流程轨迹"; rm.ClassMethodName = this.ToString() + ".DoTrack"; rm.Icon = "../../WF/Img/FileType/doc.gif"; map.AddRefMethod(rm); rm = new RefMethod(); rm.Icon = "../../WF/Img/Btn/CC.gif"; rm.Title = "移交"; rm.ClassMethodName = this.ToString() + ".DoShift"; rm.HisAttrs.AddDDLEntities("ToEmp", null, "移交给:", new BP.WF.Data.MyDeptEmps(),true); rm.HisAttrs.AddTBString("Note", null, "移交原因", true, false, 0, 300, 100); map.AddRefMethod(rm); rm = new RefMethod(); rm.Icon = "../../WF/Img/Btn/Delete.gif"; rm.Title = "删除"; rm.Warning = "您确定要删除该流程吗?"; rm.ClassMethodName = this.ToString() + ".DoDelete"; map.AddRefMethod(rm); rm = new RefMethod(); rm.Icon = "../../WF/Img/Btn/Back.png"; rm.Title = "回滚"; rm.IsForEns = false; rm.ClassMethodName = this.ToString() + ".DoComeBack"; rm.HisAttrs.AddTBInt("NodeID", 0, "回滚到节点", true, false); rm.HisAttrs.AddTBString("Note", null, "回滚原因", true, false, 0, 300, 100); map.AddRefMethod(rm); this._enMap = map; return this._enMap; } } #endregion #region 执行功能. public string DoTrack() { return "../../WFRpt.htm?WorkID=" + this.WorkID + "&FID=" + this.FID + "&FK_Flow=" + this.FK_Flow; } /// /// 执行移交 /// /// /// /// public string DoShift(string ToEmp, string Note) { if (BP.WF.Dev2Interface.Flow_IsCanViewTruck(this.FK_Flow, this.WorkID) == false) return "您没有操作该流程数据的权限."; try { BP.WF.Dev2Interface.Node_Shift( this.WorkID,ToEmp, Note); return "移交成功"; } catch(Exception ex) { return "移交失败@" + ex.Message; } } /// /// 执行删除 /// /// public string DoDelete() { if (BP.WF.Dev2Interface.Flow_IsCanViewTruck(this.FK_Flow, this.WorkID) == false) return "您没有操作该流程数据的权限."; try { BP.WF.Dev2Interface.Flow_DoDeleteFlowByReal( this.WorkID,true); return "删除成功"; } catch (Exception ex) { return "删除失败@" + ex.Message; } } /// /// 回滚 /// /// 节点ID /// 回滚原因 /// 回滚的结果 public string DoComeBack(int nodeid, string note) { BP.WF.Template.FlowSheet fl = new BP.WF.Template.FlowSheet(this.FK_Flow); return fl.DoRebackFlowData(this.WorkID, nodeid, note); } #endregion } /// /// 流程监控s /// public class Monitors : Entities { #region 方法 /// /// 得到它的 Entity /// public override Entity GetNewEntity { get { return new Monitor(); } } /// /// 流程监控集合 /// public Monitors(){} #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((Monitor)this[i]); } return list; } #endregion 为了适应自动翻译成java的需要,把实体转换成List. } }