using System;
using System.Data;
using BP.DA;
using BP.Sys;
using BP.En;
namespace BP.WF.Data
{
///
/// 我参与的流程
///
public class MyFlowAttr
{
#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_FlowSort = "FK_FlowSort";
///
/// 优先级
///
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 MyJoinFlow : Entity
{
#region 基本属性
public override UAC HisUAC
{
get
{
UAC uac = new UAC();
//uac.LoadRightFromCCGPM(this);
//return uac;
uac.Readonly();
uac.IsExp = true;
return uac;
}
}
///
/// 主键
///
public override string PK
{
get
{
return MyFlowAttr.WorkID;
}
}
///
/// 备注
///
public string FlowNote
{
get
{
return this.GetValStrByKey(MyFlowAttr.FlowNote);
}
set
{
SetValByKey(MyFlowAttr.FlowNote, value);
}
}
///
/// 工作流程编号
///
public string FlowNo
{
get
{
return this.GetValStrByKey(MyFlowAttr.FK_Flow);
}
set
{
SetValByKey(MyFlowAttr.FK_Flow, value);
}
}
///
/// BillNo
///
public string BillNo
{
get
{
return this.GetValStrByKey(MyFlowAttr.BillNo);
}
set
{
SetValByKey(MyFlowAttr.BillNo, value);
}
}
///
/// 流程名称
///
public string FlowName
{
get
{
return this.GetValStrByKey(MyFlowAttr.FlowName);
}
set
{
SetValByKey(MyFlowAttr.FlowName, value);
}
}
///
/// 优先级
///
public int PRI
{
get
{
return this.GetValIntByKey(MyFlowAttr.PRI);
}
set
{
SetValByKey(MyFlowAttr.PRI, value);
}
}
///
/// 待办人员数量
///
public int TodoEmpsNum
{
get
{
return this.GetValIntByKey(MyFlowAttr.TodoEmpsNum);
}
set
{
SetValByKey(MyFlowAttr.TodoEmpsNum, value);
}
}
///
/// 待办人员列表
///
public string TodoEmps
{
get
{
return this.GetValStrByKey(MyFlowAttr.TodoEmps);
}
set
{
SetValByKey(MyFlowAttr.TodoEmps, value);
}
}
///
/// 参与人
///
public string Emps
{
get
{
return this.GetValStrByKey(MyFlowAttr.Emps);
}
set
{
SetValByKey(MyFlowAttr.Emps, value);
}
}
///
/// 状态
///
public TaskSta TaskSta
{
get
{
return (TaskSta)this.GetValIntByKey(MyFlowAttr.TaskSta);
}
set
{
SetValByKey(MyFlowAttr.TaskSta, (int)value);
}
}
///
/// 类别编号
///
public string FlowSortNo
{
get
{
return this.GetValStrByKey(MyFlowAttr.FK_FlowSort);
}
set
{
SetValByKey(MyFlowAttr.FK_FlowSort, value);
}
}
///
/// 部门编号
///
public string DeptNo
{
get
{
return this.GetValStrByKey(MyFlowAttr.FK_Dept);
}
set
{
SetValByKey(MyFlowAttr.FK_Dept, value);
}
}
///
/// 标题
///
public string Title
{
get
{
return this.GetValStrByKey(MyFlowAttr.Title);
}
set
{
SetValByKey(MyFlowAttr.Title, value);
}
}
///
/// 客户编号
///
public string GuestNo
{
get
{
return this.GetValStrByKey(MyFlowAttr.GuestNo);
}
set
{
SetValByKey(MyFlowAttr.GuestNo, value);
}
}
///
/// 客户名称
///
public string GuestName
{
get
{
return this.GetValStrByKey(MyFlowAttr.GuestName);
}
set
{
SetValByKey(MyFlowAttr.GuestName, value);
}
}
///
/// 产生时间
///
public string RDT
{
get
{
return this.GetValStrByKey(MyFlowAttr.RDT);
}
set
{
SetValByKey(MyFlowAttr.RDT, value);
}
}
///
/// 节点应完成时间
///
public string SDTOfNode
{
get
{
return this.GetValStrByKey(MyFlowAttr.SDTOfNode);
}
set
{
SetValByKey(MyFlowAttr.SDTOfNode, value);
}
}
///
/// 流程应完成时间
///
public string SDTOfFlow
{
get
{
return this.GetValStrByKey(MyFlowAttr.SDTOfFlow);
}
set
{
SetValByKey(MyFlowAttr.SDTOfFlow, value);
}
}
///
/// 流程ID
///
public Int64 WorkID
{
get
{
return this.GetValInt64ByKey(MyFlowAttr.WorkID);
}
set
{
SetValByKey(MyFlowAttr.WorkID, value);
}
}
///
/// 主线程ID
///
public Int64 FID
{
get
{
return this.GetValInt64ByKey(MyFlowAttr.FID);
}
set
{
SetValByKey(MyFlowAttr.FID, value);
}
}
///
/// 父节点流程编号.
///
public Int64 PWorkID
{
get
{
return this.GetValInt64ByKey(MyFlowAttr.PWorkID);
}
set
{
SetValByKey(MyFlowAttr.PWorkID, value);
}
}
///
/// 父流程调用的节点
///
public int PNodeID
{
get
{
return this.GetValIntByKey(MyFlowAttr.PNodeID);
}
set
{
SetValByKey(MyFlowAttr.PNodeID, value);
}
}
///
/// PFlowNo
///
public string PFlowNo
{
get
{
return this.GetValStrByKey(MyFlowAttr.PFlowNo);
}
set
{
SetValByKey(MyFlowAttr.PFlowNo, value);
}
}
///
/// 吊起子流程的人员
///
public string PEmp
{
get
{
return this.GetValStrByKey(MyFlowAttr.PEmp);
}
set
{
SetValByKey(MyFlowAttr.PEmp, value);
}
}
///
/// 发起人
///
public string Starter
{
get
{
return this.GetValStrByKey(MyFlowAttr.Starter);
}
set
{
SetValByKey(MyFlowAttr.Starter, value);
}
}
///
/// 发起人名称
///
public string StarterName
{
get
{
return this.GetValStrByKey(MyFlowAttr.StarterName);
}
set
{
this.SetValByKey(MyFlowAttr.StarterName, value);
}
}
///
/// 发起人部门名称
///
public string DeptName
{
get
{
return this.GetValStrByKey(MyFlowAttr.DeptName);
}
set
{
this.SetValByKey(MyFlowAttr.DeptName, value);
}
}
///
/// 当前节点名称
///
public string NodeName
{
get
{
return this.GetValStrByKey(MyFlowAttr.NodeName);
}
set
{
this.SetValByKey(MyFlowAttr.NodeName, value);
}
}
///
/// 当前工作到的节点
///
public int NodeID
{
get
{
return this.GetValIntByKey(MyFlowAttr.FK_Node);
}
set
{
SetValByKey(MyFlowAttr.FK_Node, value);
}
}
///
/// 工作流程状态
///
public WFState WFState
{
get
{
return (WFState)this.GetValIntByKey(MyFlowAttr.WFState);
}
set
{
if (value == BP.WF.WFState.Complete)
SetValByKey(MyFlowAttr.WFSta, (int)WFSta.Complete);
else if (value == BP.WF.WFState.Delete)
SetValByKey(MyFlowAttr.WFSta, (int)WFSta.Etc);
else
SetValByKey(MyFlowAttr.WFSta, (int)WFSta.Runing);
SetValByKey(MyFlowAttr.WFState, (int)value);
}
}
///
/// 状态(简单)
///
public WFSta WFSta
{
get
{
return (WFSta)this.GetValIntByKey(MyFlowAttr.WFSta);
}
set
{
SetValByKey(MyFlowAttr.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(MyFlowAttr.GUID);
}
set
{
SetValByKey(MyFlowAttr.GUID, value);
}
}
#endregion
#region 参数属性.
public string Paras_ToNodes
{
get
{
return this.GetParaString("ToNodes");
}
set
{
this.SetPara("ToNodes", value);
}
}
///
/// 加签信息
///
public string Paras_AskForReply
{
get
{
return this.GetParaString("AskForReply");
}
set
{
this.SetPara("AskForReply", value);
}
}
#endregion 参数属性.
#region 构造函数
///
/// 产生的工作流程
///
public MyJoinFlow()
{
}
public MyJoinFlow(Int64 workId)
{
QueryObject qo = new QueryObject(this);
qo.AddWhere(MyFlowAttr.WorkID, workId);
if (qo.DoQuery() == 0)
throw new Exception("工作 MyFlow [" + workId + "]不存在。");
}
///
/// 执行修复
///
public void DoRepair()
{
}
///
/// 重写基类方法
///
public override Map EnMap
{
get
{
if (this._enMap != null)
return this._enMap;
Map map = new Map("WF_GenerWorkFlow", "我审批的流程");
map.setEnType(EnType.View);
#region 基本字段.
map.AddTBIntPK(MyFlowAttr.WorkID, 0, "WorkID", false, false);
map.AddTBInt(MyFlowAttr.FID, 0, "FID", false, false);
map.AddTBInt(MyFlowAttr.PWorkID, 0, "PWorkID", false, false);
map.AddTBString(MyFlowAttr.Title, null, "流程标题", true, false, 0, 300, 150, true);
map.AddDDLEntities(MyFlowAttr.FK_Flow, null, "流程名称", new Flows(), false);
map.AddTBString(MyFlowAttr.BillNo, null, "单据编号", true, false, 0, 100, 50);
map.AddTBString(MyFlowAttr.StarterName, null, "发起人", true, false, 0, 30, 40);
map.AddTBDateTime(MyFlowAttr.RDT, "发起日期", true, true);
map.AddDDLSysEnum(MyFlowAttr.WFSta, 0, "状态", true, false, MyFlowAttr.WFSta, "@0=运行中@1=已完成@2=其他");
//map.AddDDLSysEnum(MyFlowAttr.TSpan, 0, "时间段", true, false, MyFlowAttr.TSpan, "@0=本周@1=上周@2=两周以前@3=三周以前@4=更早");
map.AddTBString(MyFlowAttr.NodeName, null, "当前节点", true, false, 0, 100, 100, true);
map.AddTBString(MyStartFlowAttr.TodoEmps, null, "当前处理人", true, false, 0, 100, 100, true);
map.AddTBString(MyFlowAttr.Emps, null, "参与人", false, false, 0, 4000, 10, true);
map.AddTBStringDoc(MyFlowAttr.FlowNote, null, "备注", true, false, true);
map.AddTBDateTime(GenerWorkFlowAttr.SDTOfNode, "节点应完成时间", true, true);
//隐藏字段.
map.AddTBInt(MyFlowAttr.FK_Node, 0, "FK_Node", false, false);
//查询关键字.
map.AddTBSKeyWords(4000);
#endregion 基本字段.
#region 查询条件.
map.DTSearchKey = GenerWorkFlowAttr.SDTOfNode;
map.DTSearchLabel = "节点应完成时间";
map.DTSearchWay = DTSearchWay.ByDate;
map.AddSearchAttr(MyFlowAttr.WFSta);
map.AddHidden(MyStartFlowAttr.FID, "=", "0");
//map.ItIsShowSearchKey = false;
//增加隐藏的查询条件. 我参与的流程.
SearchNormal search = new SearchNormal(MyFlowAttr.Emps, "人员",
MyFlowAttr.Emps, " LIKE ", "%" + BP.Web.WebUser.No + "%", 0, true);
map.SearchNormals.Add(search);
#endregion 查询条件.
#region 相关功能.
RefMethod rm = new RefMethod();
/* rm.Title = "轨迹";
rm.ClassMethodName = this.ToString() + ".DoTrack";
rm.RefMethodType = RefMethodType.LinkeWinOpen;
rm.Icon = "../../WF/Img/Track.png";
rm.ItIsForEns = true;
map.AddRefMethod(rm);*/
rm = new RefMethod();
rm.Title = "表单";
rm.ClassMethodName = this.ToString() + ".DoOpenLastForm";
rm.Icon = "../../WF/Img/Form.png";
rm.RefMethodType = RefMethodType.LinkeWinOpen;
rm.ItIsForEns = true;
map.AddRefMethod(rm);
#endregion 相关功能.
this._enMap = map;
return this._enMap;
}
}
#endregion
#region 执行诊断
public string DoTrack()
{
//PubClass.WinOpen(Glo.CCFlowAppPath + "WF/WFRpt.htm?WorkID=" + this.WorkID + "&FID=" + this.FID + "&FK_Flow=" + this.FlowNo, 900, 800);
return "/WF/WFRpt.htm?CurrTab=Truck&WorkID=" + this.WorkID + "&FID=" + this.FID + "&FK_Flow=" + this.FlowNo + "&FK_Node=" + this.NodeID;
}
///
/// 打开最后一个节点表单
///
///
public string DoOpenLastForm()
{
Paras pss = new Paras();
pss.SQL = "SELECT MYPK FROM ND" + int.Parse(this.FlowNo) + "Track WHERE ActionType=" + BP.Difference.SystemConfig.AppCenterDBVarStr + "ActionType AND WorkID=" + BP.Difference.SystemConfig.AppCenterDBVarStr + "WorkID ORDER BY RDT DESC";
pss.Add("ActionType", (int)BP.WF.ActionType.Forward);
pss.Add("WorkID", this.WorkID);
DataTable dt = DBAccess.RunSQLReturnTable(pss);
if (dt != null && dt.Rows.Count > 0)
{
string myPk = dt.Rows[0][0].ToString();
return "/WF/MyView.htm?WorkID=" + this.WorkID + "&FK_Flow=" + this.FlowNo + "&FK_Node=" + this.NodeID + "&DoType=View&MyPK=" + myPk + "&PWorkID=" + this.PWorkID;
}
Node nd = new Node(this.NodeID);
return "/WF/CCForm/FrmGener.htm?WorkID=" + this.WorkID + "&FK_Flow=" + this.FlowNo + "&FK_MapData=" + nd.NodeFrmID + "&ReadOnly=1&IsEdit=0";
}
#endregion
}
///
/// 我参与的流程s
///
public class MyJoinFlows : Entities
{
#region 方法
///
/// 得到它的 Entity
///
public override Entity GetNewEntity
{
get
{
return new MyJoinFlow();
}
}
///
/// 我参与的流程集合
///
public MyJoinFlows() { }
#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((MyJoinFlow)this[i]);
}
return list;
}
#endregion 为了适应自动翻译成java的需要,把实体转换成List.
}
}