using System;
using System.Collections;
using BP.DA;
using BP.En;
using BP.En;
using BP.Port;
//using BP.ZHZS.Base;
namespace BP.WF.Template
{
///
/// 可退回的节点属性
///
public class NodeReturnAttr
{
///
/// 节点
///
public const string FK_Node = "FK_Node";
///
/// 退回到
///
public const string ReturnTo = "ReturnTo";
}
///
/// 可退回的节点
/// 节点的退回到有两部分组成.
/// 记录了从一个节点到其他的多个节点.
/// 也记录了到这个节点的其他的节点.
///
public class NodeReturn : EntityMM
{
#region 基本属性
///
/// UI界面上的访问控制
///
public override UAC HisUAC
{
get
{
UAC uac = new UAC();
uac.OpenForSysAdmin();
return uac;
}
}
///
///退回到
///
public int ReturnTo
{
get
{
return this.GetValIntByKey(NodeReturnAttr.ReturnTo);
}
set
{
this.SetValByKey(NodeReturnAttr.ReturnTo, value);
}
}
///
/// 工作流程
///
public int FK_Node
{
get
{
return this.GetValIntByKey(NodeReturnAttr.FK_Node);
}
set
{
this.SetValByKey(NodeReturnAttr.FK_Node, value);
}
}
#endregion
#region 构造方法
///
/// 可退回的节点
///
public NodeReturn() { }
///
/// 重写基类方法
///
public override Map EnMap
{
get
{
if (this._enMap != null)
return this._enMap;
Map map = new Map("WF_NodeReturn", "可退回的节点");
map.AddTBIntPK(NodeReturnAttr.FK_Node, 0, "节点", true, true);
map.AddTBIntPK(NodeReturnAttr.ReturnTo, 0, "退回到", true, true);
// map.AddTBString(NodeReturnAttr.Dots, null, "轨迹信息", true, true,0,300,0,false);
this._enMap = map;
return this._enMap;
}
}
#endregion
}
///
/// 可退回的节点
///
public class NodeReturns : EntitiesMM
{
///
/// 他的退回到
///
public Nodes HisNodes
{
get
{
Nodes ens = new Nodes();
foreach (NodeReturn ns in this)
{
ens.AddEntity(new Node(ns.ReturnTo));
}
return ens;
}
}
///
/// 可退回的节点
///
public NodeReturns() { }
///
/// 可退回的节点
///
/// 节点ID
public NodeReturns(int NodeID)
{
QueryObject qo = new QueryObject(this);
qo.AddWhere(NodeReturnAttr.FK_Node, NodeID);
qo.DoQuery();
}
///
/// 可退回的节点
///
/// NodeNo
public NodeReturns(string NodeNo)
{
QueryObject qo = new QueryObject(this);
qo.AddWhere(NodeReturnAttr.ReturnTo, NodeNo);
qo.DoQuery();
}
///
/// 得到它的 Entity
///
public override Entity GetNewEntity
{
get
{
return new NodeReturn();
}
}
///
/// 可退回的节点s
///
/// 可退回的节点
///
public Nodes GetHisNodes(Nodes sts)
{
Nodes nds = new Nodes();
Nodes tmp = new Nodes();
foreach (Node st in sts)
{
tmp = this.GetHisNodes(st.No);
foreach (Node nd in tmp)
{
if (nds.Contains(nd))
continue;
nds.AddEntity(nd);
}
}
return nds;
}
///
/// 可退回的节点
///
/// 退回到编号
/// 节点s
public Nodes GetHisNodes(string NodeNo)
{
QueryObject qo = new QueryObject(this);
qo.AddWhere(NodeReturnAttr.ReturnTo, NodeNo);
qo.DoQuery();
Nodes ens = new Nodes();
foreach (NodeReturn en in this)
{
ens.AddEntity(new Node(en.FK_Node));
}
return ens;
}
///
/// 转向此节点的集合的Nodes
///
/// 此节点的ID
/// 转向此节点的集合的Nodes (FromNodes)
public Nodes GetHisNodes(int nodeID)
{
QueryObject qo = new QueryObject(this);
qo.AddWhere(NodeReturnAttr.FK_Node, nodeID);
qo.DoQuery();
Nodes ens = new Nodes();
foreach (NodeReturn en in this)
{
ens.AddEntity(new Node(en.ReturnTo));
}
return ens;
}
#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((NodeReturn)this[i]);
}
return list;
}
#endregion 为了适应自动翻译成java的需要,把实体转换成List.
}
}