You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

349 lines
10 KiB
C#

using System;
using System.Collections;
using BP.DA;
using BP.En;
using BP.Port;
namespace BP.WF.Template
{
/// <summary>
/// 选择接受人属性
/// </summary>
public class SelectCallerAttr
{
/// <summary>
/// 节点
/// </summary>
public const string FK_Node = "FK_Node";
/// <summary>
/// 到人员
/// </summary>
public const string FK_Emp = "FK_Emp";
/// <summary>
/// 操作员名称
/// </summary>
public const string EmpName = "EmpName";
/// <summary>
/// 部门编号
/// </summary>
public const string FK_Dept = "FK_Dept";
/// <summary>
/// 部门名称
/// </summary>
public const string DeptName = "DeptName";
/// <summary>
/// 记录人
/// </summary>
public const string Callers = "Callers";
/// <summary>
/// 顺序号
/// </summary>
public const string Idx = "Idx";
/// <summary>
/// 维度标记
/// </summary>
public const string Tag = "Tag";
}
/// <summary>
/// 选择接受人
/// 节点的到人员有两部分组成.
/// 记录了从一个节点到其他的多个节点.
/// 也记录了到这个节点的其他的节点.
/// </summary>
public class SelectCaller : EntityMyPK
{
#region 基本属性
/// <summary>
/// UI界面上的访问控制
/// </summary>
public override UAC HisUAC
{
get
{
UAC uac = new UAC();
uac.OpenAll();
return uac;
}
}
/// <summary>
///节点
/// </summary>
public int NodeID
{
get
{
return this.GetValIntByKey(SelectCallerAttr.FK_Node);
}
set
{
this.SetValByKey(SelectCallerAttr.FK_Node, value);
}
}
/// <summary>
/// 到人员
/// </summary>
public string EmpNo
{
get
{
return this.GetValStringByKey(SelectCallerAttr.FK_Emp);
}
set
{
this.SetValByKey(SelectCallerAttr.FK_Emp, value);
}
}
/// <summary>
/// 标记
/// </summary>
public string Tag
{
get
{
return this.GetValStringByKey(SelectCallerAttr.Tag);
}
set
{
this.SetValByKey(SelectCallerAttr.Tag, value);
}
}
/// <summary>
/// 人员名称
/// </summary>
public string EmpName
{
get
{
string s= this.GetValStringByKey(SelectCallerAttr.EmpName);
if (DataType.IsNullOrEmpty(s) == true)
s = this.EmpNo;
return s;
}
set
{
this.SetValByKey(SelectCallerAttr.EmpName, value);
}
}
/// <summary>
/// 部门名称
/// </summary>
public string DeptName
{
get
{
return this.GetValStringByKey(SelectCallerAttr.DeptName);
}
set
{
this.SetValByKey(SelectCallerAttr.DeptName, value);
}
}
/// <summary>
/// 接收人
/// </summary>
public string Callers
{
get
{
return this.GetValStringByKey(SelectCallerAttr.Callers);
}
set
{
this.SetValByKey(SelectCallerAttr.Callers, value);
}
}
/// <summary>
/// 顺序号
/// </summary>
public int Idx
{
get
{
return this.GetValIntByKey(SelectCallerAttr.Idx);
}
set
{
this.SetValByKey(SelectCallerAttr.Idx, value);
}
}
/// <summary>
/// 工作应完成日期(计划)
/// </summary>
public string DeptNo
{
get
{
return this.GetValStringByKey(SelectCallerAttr.FK_Dept);
}
set
{
this.SetValByKey(SelectCallerAttr.FK_Dept, value);
}
}
#endregion
#region 构造方法
/// <summary>
/// 选择接受人
/// </summary>
public SelectCaller()
{
}
public SelectCaller(string mypk)
{
this.setMyPK(mypk);
this.Retrieve();
}
/// <summary>
/// 重写基类方法
/// </summary>
public override Map EnMap
{
get
{
if (this._enMap != null)
return this._enMap;
Map map = new Map("WF_SelectCallers", "选择常用联系人");
map.AddMyPK();
map.AddTBInt(SelectCallerAttr.FK_Node, 0, "接受人节点", true, false);
map.AddTBString(SelectCallerAttr.FK_Emp, null, "FK_Emp", true, false, 0, 100, 10);
map.AddTBString(SelectCallerAttr.EmpName, null, "接收人名称", true, false, 0, 60, 10);
map.AddTBString(SelectCallerAttr.FK_Dept, null, "部门编号", true, false, 0, 400, 10);
map.AddTBString(SelectCallerAttr.DeptName, null, "部门名称", true, false, 0, 400, 10);
map.AddTBString(SelectCallerAttr.Callers, null, "被选择", true, false, 0, 100, 10);
map.AddTBString(SelectCallerAttr.Tag, null, "Tag", true, false, 0, 100, 10);
map.AddTBInt(SelectCallerAttr.Idx, 0, "顺序号(可以用于流程队列审核模式)", true, false);
/*
* add 2015-1-12.
* 为了解决多维度的人员问题.
* 在分流点向下发送时, 一个人可以分配两次任务,但是这个任务需要一个维度来区分。
* 这个维度,有可能是一个类别,批次。
*/
map.AddTBString(SelectCallerAttr.Tag, null, "维度信息Tag", true, false, 0, 200, 10);
this._enMap = map;
return this._enMap;
}
}
#endregion
protected override bool beforeInsert()
{
return base.beforeInsert();
}
protected override bool beforeUpdateInsertAction()
{
if (this.DeptName.Length == 0)
{
bool isHavePathName = DBAccess.IsExitsTableCol("Port_Dept", "NameOfpath");
if (isHavePathName == true)
{
this.DeptName = DBAccess.RunSQLReturnStringIsNull("select a.NameOfPath from port_dept a,Port_Emp b where a.No=b.fk_dept and b.no='" + this.EmpNo + "'", "无");
if (this.DeptName == "无")
this.DeptName = DBAccess.RunSQLReturnStringIsNull("select a.name from port_dept a,Port_Emp b where a.No=b.fk_dept and b.no='" + this.EmpNo + "'", "无");
}
else
this.DeptName = DBAccess.RunSQLReturnStringIsNull("select a.name from port_dept a,Port_Emp b where a.No=b.fk_dept and b.no='" + this.EmpNo + "'", "无");
}
this.Callers = BP.Web.WebUser.No;
return base.beforeUpdateInsertAction();
}
}
/// <summary>
/// 选择接受人
/// </summary>
public class SelectCallers : EntitiesMyPK
{
/// <summary>
/// 他的到人员
/// </summary>
public Emps HisEmps
{
get
{
Emps ens = new Emps();
foreach (SelectCaller ns in this)
{
ens.AddEntity(new Emp(ns.EmpNo));
}
return ens;
}
}
/// <summary>
/// 他的工作节点
/// </summary>
public Nodes HisNodes
{
get
{
Nodes ens = new Nodes();
foreach (SelectCaller ns in this)
{
ens.AddEntity(new Node(ns.NodeID));
}
return ens;
}
}
/// <summary>
/// 选择接受人
/// </summary>
public SelectCallers() { }
/// <summary>
/// 查询出来选择的人员
/// </summary>
/// <param name="fk_flow"></param>
/// <param name="workid"></param>
public SelectCallers(Int64 FK_Emp)
{
BP.En.QueryObject qo = new QueryObject(this);
qo.AddWhere(SelectCallerAttr.FK_Emp, FK_Emp);
qo.addOrderByDesc(SelectCallerAttr.FK_Node,SelectCallerAttr.Idx);
qo.DoQuery();
}
/// <summary>
/// 得到它的 Entity
/// </summary>
public override Entity GetNewEntity
{
get
{
return new SelectCaller();
}
}
#region 为了适应自动翻译成java的需要,把实体转换成List.
/// <summary>
/// 转化成 java list,C#不能调用.
/// </summary>
/// <returns>List</returns>
public System.Collections.Generic.IList<SelectCaller> ToJavaList()
{
return (System.Collections.Generic.IList<SelectCaller>)this;
}
/// <summary>
/// 转化成list
/// </summary>
/// <returns>List</returns>
public System.Collections.Generic.List<SelectCaller> Tolist()
{
System.Collections.Generic.List<SelectCaller> list = new System.Collections.Generic.List<SelectCaller>();
for (int i = 0; i < this.Count; i++)
{
list.Add((SelectCaller)this[i]);
}
return list;
}
#endregion 为了适应自动翻译成java的需要,把实体转换成List.
}
}