using BP.DA; using BP.En; using System; using System.Collections.Generic; using System.Data; using System.Linq; using System.Text; using System.Threading.Tasks; namespace BP.WF { public class WorkOptAttr { #region 基本属性 /// /// 状态 /// public const string NodeID = "NodeID"; // public const string ToNodeID = "ToNodeID"; /// /// H /// public const string WorkID = "WorkID"; public const string EmpNo = "EmpNo"; /// /// 发送到人员 /// public const string SendEmps = "SendEmps"; /// /// 发送到部门 /// public const string SendDepts = "SendDepts"; /// /// 发送到角色. /// public const string SendStations = "SendStations"; /// /// 发送内容 /// public const string SendNote = "SendNote"; /// /// 抄送到人员 /// public const string CCEmps = "CCEmps"; /// /// 抄送到部门 /// public const string CCDepts = "CCDepts"; /// /// 抄送到角色. /// public const string CCStations = "CCStations"; /// /// 抄送内容 /// public const string CCNote = "CCNote"; public const string FlowNo = "FlowNo"; #endregion public const string Title = "Title"; public const string NodeName = "NodeName"; public const string ToNodeName = "ToNodeName"; public const string TodoEmps = "TodoEmps"; public const string SenderName = "SenderName"; public const string SendRDT = "SendRDT"; public const string SendSDT = "SendSDT"; /// /// 发起人 /// public const string StarterName = "StarterName"; /// /// 发起日期 /// public const string StartRDT = "StartRDT"; } /// /// 退回轨迹 /// public class WorkOpt : EntityMyPK { #region 基本属性 /// /// 工作ID /// public Int64 WorkID { get { return this.GetValInt64ByKey(WorkOptAttr.WorkID); } set { SetValByKey(WorkOptAttr.WorkID, value); } } /// /// 退回到节点 /// public int NodeID { get { return this.GetValIntByKey(WorkOptAttr.NodeID); } set { SetValByKey(WorkOptAttr.NodeID, value); } } public int ToNodeID { get { return this.GetValIntByKey(WorkOptAttr.ToNodeID); } set { SetValByKey(WorkOptAttr.ToNodeID, value); } } public string FlowNo { get { return this.GetValStrByKey(WorkOptAttr.FlowNo); } set { SetValByKey(WorkOptAttr.FlowNo, value); } } public string SendNote { get { return this.GetValStrByKey(WorkOptAttr.SendNote); } set { SetValByKey(WorkOptAttr.SendNote, value); } } public string EmpNo { get { return this.GetValStrByKey(WorkOptAttr.EmpNo); } set { SetValByKey(WorkOptAttr.EmpNo, value); } } /// /// 退回人 /// public string SendEmps { get { return this.GetValStringByKey(WorkOptAttr.SendEmps); } set { SetValByKey(WorkOptAttr.SendEmps, value); } } public string SendDepts { get { return this.GetValStringByKey(WorkOptAttr.SendDepts); } set { SetValByKey(WorkOptAttr.SendDepts, value); } } public string SendStas { get { return this.GetValStringByKey(WorkOptAttr.SendStations); } set { SetValByKey(WorkOptAttr.SendStations, value); } } public string CCEmps { get { return this.GetValStringByKey(WorkOptAttr.CCEmps); } set { SetValByKey(WorkOptAttr.CCEmps, value); } } public string CCDepts { get { return this.GetValStringByKey(WorkOptAttr.CCDepts); } set { SetValByKey(WorkOptAttr.CCDepts, value); } } public string CCStations { get { return this.GetValStringByKey(WorkOptAttr.CCStations); } set { SetValByKey(WorkOptAttr.CCStations, value); } } public string CCNote { get { return this.GetValStringByKey(WorkOptAttr.CCNote); } set { SetValByKey(WorkOptAttr.CCNote, value); } } public string SendRDT { get { return this.GetValStrByKey(WorkOptAttr.SendRDT); } set { SetValByKey(WorkOptAttr.SendRDT, value); } } public string StarterName { get { return this.GetValStrByKey(WorkOptAttr.StarterName); } set { SetValByKey(WorkOptAttr.StarterName, value); } } public string StartRDT { get { return this.GetValStrByKey(WorkOptAttr.StartRDT); } set { SetValByKey(WorkOptAttr.StartRDT, value); } } #endregion #region 构造函数 public WorkOpt() { } /// /// 退回轨迹 /// public WorkOpt(string mypk) { this.MyPK = mypk; this.Retrieve(); } /// /// 重写基类方法 /// public override Map EnMap { get { if (this._enMap != null) return this._enMap; Map map = new Map("WF_WorkOpt", "工作处理器"); map.AddMyPK(); map.AddTBInt(WorkOptAttr.WorkID, 0, "工作ID", false, true); map.AddTBInt(WorkOptAttr.NodeID, 0, "节点ID", false, true); map.AddTBInt(WorkOptAttr.ToNodeID, 0, "到达的节点ID", false, true); map.AddTBString(WorkOptAttr.EmpNo, null, "操作员", true, true, 0, 100, 10); map.AddTBString(WorkOptAttr.FlowNo, null, "FlowNo", false, false, 0, 10, 10); map.AddGroupAttr("发送"); map.AddTBString(WorkOptAttr.SendEmps, null, "发送到人员", true, true, 0, 500, 10, true); map.AddTBString(WorkOptAttr.SendEmps + "T", null, "发送到人员", false, false, 0, 500, 10, true); map.AddTBString(WorkOptAttr.SendDepts, null, "发送到部门", true, true, 0, 500, 10, true); map.AddTBString(WorkOptAttr.SendDepts + "T", null, "发送到部门", false, false, 0, 500, 10, true); map.AddTBString(WorkOptAttr.SendStations, null, "发送到角色", true, true, 0, 100, 10, true); map.AddTBString(WorkOptAttr.SendStations + "T", null, "发送到角色", false, false, 0, 500, 10, true); map.AddTBStringDoc(WorkOptAttr.SendNote, null, "小纸条", true, true, true); map.AddGroupAttr("抄送"); map.AddTBString(WorkOptAttr.CCEmps, null, "抄送到人员", true, true, 0, 100, 10, true); map.AddTBString(WorkOptAttr.CCEmps + "T", null, "抄送到人员", false, false, 0, 500, 10, true); map.AddTBString(WorkOptAttr.CCDepts, null, "抄送到部门", true, true, 0, 100, 10, true); map.AddTBString(WorkOptAttr.CCDepts + "T", null, "抄送到部门", false, false, 0, 500, 10, true); map.AddTBString(WorkOptAttr.CCStations, null, "抄送到角色", true, true, 0, 100, 10, true); map.AddTBString(WorkOptAttr.CCStations + "T", null, "抄送到部门", false, false, 0, 500, 10, true); map.AddTBStringDoc(WorkOptAttr.CCNote, null, "抄送说明", true, true, true); map.AddGroupAttr("工作信息"); map.AddTBString(WorkOptAttr.Title, null, "标题", true, true, 0, 200, 10, true); map.AddTBString(WorkOptAttr.NodeName, null, "当前节点", true, true, 0, 500, 10, false, null); map.AddTBString(WorkOptAttr.ToNodeName, null, "到达节点", true, true, 0, 500, 10, false, null); map.AddTBString(WorkOptAttr.StarterName, null, "发起人", true, true, 0, 200, 10, false, null); map.AddTBDateTime(WorkOptAttr.StartRDT, null, "发起日期", true, true); map.AddTBInt(WorkOptAttr.ToNodeID, 0, "到达节点ID", false, false); map.AddTBString(WorkOptAttr.TodoEmps, null, "当前处理人", true, true, 0, 200, 10, true); map.AddTBString(WorkOptAttr.SenderName, null, "发送人", true, true, 0, 100, 10); map.AddTBString(WorkOptAttr.SendRDT, null, "发送日期", true, true, 0, 100, 10); map.AddTBString(WorkOptAttr.SendSDT, null, "限期", true, true, 0, 100, 10); map.AddTBInt(WorkOptAttr.WorkID, 0, "工作ID", true, true); this._enMap = map; return this._enMap; } } #endregion protected override bool beforeUpdateInsertAction() { if (BP.DA.DataType.IsNullOrEmpty(this.StartRDT) == true) { this.StarterName = BP.Web.WebUser.DeptName + "\\" + BP.Web.WebUser.Name; this.StartRDT = BP.DA.DataType.CurrentDateTime; } return base.beforeUpdateInsertAction(); } /// /// 获取手动抄送时抄送人信息 /// /// public DataTable GenerCCers() { DataTable dt = new DataTable(); dt.Columns.Add(new DataColumn("No", typeof(string))); dt.Columns.Add(new DataColumn("Name", typeof(string))); DataTable mydt = new DataTable(); DataRow dr = null; string sql = ""; //抄送到人员 if (DataType.IsNullOrEmpty(this.CCEmps) == false) { string[] empNos = this.CCEmps.Split(','); string[] empNames = this.GetValStrByKey(WorkOptAttr.CCEmps + "T").Split(','); for (int i = 0; i < empNos.Length; i++) { dr = dt.NewRow(); dr["No"] = empNos[i]; dr["Name"] = empNames[i]; dt.Rows.Add(dr); } } //抄送到部门 if (DataType.IsNullOrEmpty(this.CCDepts) == false) { sql = "SELECT " + BP.Sys.Base.Glo.UserNo + ",Name FROM Port_Emp A, Port_DeptEmp B WHERE A." + BP.Sys.Base.Glo.UserNoWhitOutAS + "= B.FK_Emp AND B.FK_Dept IN(" + BP.Port.Glo.GenerWhereInSQL(this.CCDepts) + ")"; mydt = DBAccess.RunSQLReturnTable(sql); foreach (DataRow mydr in mydt.Rows) { dr = dt.NewRow(); dr["No"] = mydr["No"]; dr["Name"] = mydr["Name"]; dt.Rows.Add(dr); } } //抄送到岗位 if (DataType.IsNullOrEmpty(this.CCStations) == false) { sql = "SELECT " + BP.Sys.Base.Glo.UserNo + ",Name FROM Port_Emp A, Port_DeptEmpStation B WHERE A.No= B.FK_Emp AND B.FK_Station IN("+ BP.Port.Glo.GenerWhereInSQL(this.CCStations) + ")"; mydt = DBAccess.RunSQLReturnTable(sql); foreach (DataRow mydr in mydt.Rows) { dr = dt.NewRow(); dr["No"] = mydr["No"]; dr["Name"] = mydr["Name"]; dt.Rows.Add(dr); } } //将dt中的重复数据过滤掉 DataView myDataView = new DataView(dt); //此处可加任意数据项组合 string[] strComuns = { "No", "Name" }; return myDataView.ToTable(true, strComuns); } } /// /// 退回轨迹s /// public class WorkOpts : Entities { #region 构造 /// /// 退回轨迹s /// public WorkOpts() { } /// /// 得到它的 Entity /// public override Entity GetNewEntity { get { return new WorkOpt(); } } #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((WorkOpt)this[i]); } return list; } #endregion 为了适应自动翻译成java的需要,把实体转换成List. } }