using System; using System.Data; using BP.DA; using BP.En; using BP.WF; using BP.Port; using BP.En; using System.Collections.Generic; using BP.Web; namespace BP.WF { /// /// 工作人员集合 /// public class GenerWorkerListAttr { #region 基本属性 /// /// 工作节点 /// public const string WorkID = "WorkID"; /// /// 处罚单据编号 /// public const string FK_Node = "FK_Node"; /// /// 流程 /// public const string FK_Flow = "FK_Flow"; /// /// 征管软件是不是罚款 /// public const string FK_Emp = "FK_Emp"; /// /// 使用的角色 /// public const string UseStation_del = "UseStation"; /// /// 使用的部门 /// public const string FK_Dept = "FK_Dept"; /// /// 部门名称 /// public const string FK_DeptT = "FK_DeptT"; /// /// 应该完成时间 /// public const string SDT = "SDT"; /// /// 警告日期 /// public const string DTOfWarning = "DTOfWarning"; /// /// 记录时间 /// public const string RDT = "RDT"; /// /// 完成时间 /// public const string CDT = "CDT"; /// /// 是否可用 /// public const string IsEnable = "IsEnable"; /// /// IsPass /// public const string IsPass = "IsPass"; /// /// 流程ID /// public const string FID = "FID"; /// /// 人员名称 /// public const string FK_EmpText = "FK_EmpText"; /// /// 节点名称 /// public const string FK_NodeText = "FK_NodeText"; /// /// 发送人 /// public const string Sender = "Sender"; /// /// 谁执行它? /// public const string WhoExeIt = "WhoExeIt"; /// /// 优先级 /// public const string PRI = "PRI"; /// /// 是否读取? /// public const string IsRead = "IsRead"; /// /// 催办次数 /// public const string PressTimes = "PressTimes"; /// /// 备注 /// public const string Tag = "Tag"; /// /// 参数 /// public const string Paras = "Paras"; /// /// 挂起时间 /// public const string DTOfHungup = "DTOfHungup"; /// /// 解除挂起时间 /// public const string DTOfUnHungup = "DTOfUnHungup"; /// /// 挂起次数 /// public const string HungupTimes = "HungupTimes"; /// /// 外部用户编号 /// public const string GuestNo = "GuestNo"; /// /// 外部用户名称 /// public const string GuestName = "GuestName"; #endregion /// /// 分组标记 /// public const string GroupMark = "GroupMark"; /// /// 表单IDs /// public const string FrmIDs = "FrmIDs"; /// /// 是否会签? /// public const string IsHuiQian = "IsHuiQian"; /// /// 顺序号 /// public const string Idx = "Idx"; /// /// 岗位编号 /// public const string StaNo = "StaNo"; } /// /// 工作者列表 /// public class GenerWorkerList : Entity { #region 参数属性. /// /// 是否会签 /// public bool IsHuiQian { get { return this.GetParaBoolen(GenerWorkerListAttr.IsHuiQian); } set { this.SetPara(GenerWorkerListAttr.IsHuiQian, value); } } /// /// 分组标记 /// public string GroupMark { get { return this.GetParaString(GenerWorkerListAttr.GroupMark); } set { this.SetPara(GenerWorkerListAttr.GroupMark, value); } } /// /// 表单ID(对于动态表单树有效.) /// public string FrmIDs { get { return this.GetParaString(GenerWorkerListAttr.FrmIDs); } set { this.SetPara(GenerWorkerListAttr.FrmIDs, value); } } #endregion 参数属性. #region 基本属性 /// /// 谁来执行它 /// public int WhoExeIt { get { return this.GetValIntByKey(GenerWorkerListAttr.WhoExeIt); } set { SetValByKey(GenerWorkerListAttr.WhoExeIt, value); } } public int PressTimes { get { return this.GetParaInt(GenerWorkerListAttr.PressTimes); } set { SetPara(GenerWorkerListAttr.PressTimes, value); } } /// /// 优先级 /// public int PRI { get { return this.GetValIntByKey(GenerWorkerListAttr.PRI); } set { SetValByKey(GenerWorkerListAttr.PRI, value); } } /// /// Idx /// public int Idx { get { return this.GetValIntByKey(GenerWorkerListAttr.Idx); } set { SetValByKey(GenerWorkerListAttr.Idx, value); } } /// /// WorkID /// public override string PK { get { return "WorkID,FK_Emp,FK_Node"; } } /// /// 是否可用(在分配工作时有效) /// public bool IsEnable { get { return this.GetValBooleanByKey(GenerWorkerListAttr.IsEnable); } set { this.SetValByKey(GenerWorkerListAttr.IsEnable, value); } } /// /// 是否通过(对审核的会签节点有效) /// public bool IsPass { get { return this.GetValBooleanByKey(GenerWorkerListAttr.IsPass); } set { this.SetValByKey(GenerWorkerListAttr.IsPass, value); } } /// /// 0=未处理. /// 1=已经通过. /// -2= 标志该节点是干流程人员处理的节点,目的为了让分流节点的人员可以看到待办. /// public int IsPassInt { get { return this.GetValIntByKey(GenerWorkerListAttr.IsPass); } set { this.SetValByKey(GenerWorkerListAttr.IsPass,value); } } public bool IsRead { get { return this.GetValBooleanByKey(GenerWorkerListAttr.IsRead); } set { this.SetValByKey(GenerWorkerListAttr.IsRead, value); } } /// /// WorkID /// public Int64 WorkID { get { return this.GetValInt64ByKey(GenerWorkerListAttr.WorkID); } set { this.SetValByKey(GenerWorkerListAttr.WorkID, value); } } /// /// Node /// public int FK_Node { get { return this.GetValIntByKey(GenerWorkerListAttr.FK_Node); } set { this.SetValByKey(GenerWorkerListAttr.FK_Node, value); } } /// /// 部门名称 /// public string DeptName { get { return this.GetParaString(GenerWorkerListAttr.FK_DeptT); } set { this.SetPara(GenerWorkerListAttr.FK_DeptT, value); } } public string StaName { get { return this.GetParaString("StaName"); } set { this.SetPara("StaName", value); } } public string FK_Dept { get { return this.GetValStrByKey(GenerWorkerListAttr.FK_Dept); } set { this.SetValByKey(GenerWorkerListAttr.FK_Dept, value); } } /// /// 发送人 /// public string Sender { get { return this.GetValStrByKey(GenerWorkerListAttr.Sender); } set { this.SetValByKey(GenerWorkerListAttr.Sender, value); } } /// /// 节点名称 /// public string FK_NodeText { get { return this.GetValStrByKey(GenerWorkerListAttr.FK_NodeText); } set { this.SetValByKey(GenerWorkerListAttr.FK_NodeText, value); } } /// /// 流程ID /// public Int64 FID { get { return this.GetValInt64ByKey(GenerWorkerListAttr.FID); } set { this.SetValByKey(GenerWorkerListAttr.FID, value); } } /// /// 工作人员 /// public Emp HisEmp { get { return new Emp(this.FK_Emp); } } /// /// 发送日期 /// public string RDT { get { return this.GetValStringByKey(GenerWorkerListAttr.RDT); } set { //this.SetValByKey(GenerWorkerListAttr.RDT, value); this.SetValByKey(GenerWorkerListAttr.RDT, DataType.CurrentDateTimess); } } /// /// 完成时间 /// public string CDT { get { return this.GetValStringByKey(GenerWorkerListAttr.CDT); } set { this.SetValByKey(GenerWorkerListAttr.CDT, value); } } /// /// 应该完成日期 /// public string SDT { get { return this.GetValStringByKey(GenerWorkerListAttr.SDT); } set { this.SetValByKey(GenerWorkerListAttr.SDT, value); } } /// /// 警告日期 /// public string DTOfWarning { get { return this.GetValStringByKey(GenerWorkerListAttr.DTOfWarning); } set { this.SetValByKey(GenerWorkerListAttr.DTOfWarning, value); } } /// /// 人员 /// public string FK_Emp { get { return this.GetValStringByKey(GenerWorkerListAttr.FK_Emp); } set { this.SetValByKey(GenerWorkerListAttr.FK_Emp, value); } } /// /// 人员名称 /// public string FK_EmpText { get { return this.GetValStrByKey(GenerWorkerListAttr.FK_EmpText); } set { this.SetValByKey(GenerWorkerListAttr.FK_EmpText, value); } } /// /// 流程编号 /// public string FK_Flow { get { return this.GetValStringByKey(GenerWorkerListAttr.FK_Flow); } set { this.SetValByKey(GenerWorkerListAttr.FK_Flow, value); } } public string GuestNo { get { return this.GetValStringByKey(GenerWorkerListAttr.GuestNo); } set { this.SetValByKey(GenerWorkerListAttr.GuestNo, value); } } public string GuestName { get { return this.GetValStringByKey(GenerWorkerListAttr.GuestName); } set { this.SetValByKey(GenerWorkerListAttr.GuestName, value); } } #endregion #region 挂起属性 /// /// 挂起时间 /// public string DTOfHungup { get { return this.GetValStringByKey(GenerWorkerListAttr.DTOfHungup); } set { this.SetValByKey(GenerWorkerListAttr.DTOfHungup, value); } } /// /// 解除挂起时间 /// public string DTOfUnHungup { get { return this.GetValStringByKey(GenerWorkerListAttr.DTOfUnHungup); } set { this.SetValByKey(GenerWorkerListAttr.DTOfUnHungup, value); } } /// /// 挂起次数 /// public int HungupTimes { get { return this.GetParaInt(GenerWorkerListAttr.HungupTimes); } set { this.SetPara(GenerWorkerListAttr.HungupTimes, value); } } #endregion #region 构造函数 /// /// 主键 /// public override string PKField { get { return "WorkID,FK_Emp,FK_Node"; } } /// /// 工作者 /// public GenerWorkerList() { } public GenerWorkerList(Int64 workid, int nodeID, string empNo) { this.WorkID = workid; this.FK_Node = nodeID; this.FK_Emp = empNo; this.Retrieve(); } /// /// 重写基类方法 /// public override Map EnMap { get { if (this._enMap != null) return this._enMap; Map map = new Map("WF_GenerWorkerlist", "工作者"); map.IndexField = GenerWorkerListAttr.WorkID; //三个主键: WorkID,FK_Emp,FK_Node map.AddTBIntPK(GenerWorkerListAttr.WorkID, 0, "工作ID", true, true); map.AddTBStringPK(GenerWorkerListAttr.FK_Emp, null, "人员", true, false, 0, 100, 100); map.AddTBIntPK(GenerWorkerListAttr.FK_Node, 0, "节点ID", true, false); //干流程WorkID. map.AddTBInt(GenerWorkerListAttr.FID, 0, "流程ID", true, false); map.AddTBString(GenerWorkerListAttr.FK_EmpText, null, "人员名称", true, false, 0, 30, 100); map.AddTBString(GenerWorkerListAttr.FK_NodeText, null, "节点名称", true, false, 0, 100, 100); map.AddTBString(GenerWorkerListAttr.FK_Flow, null, "流程", true, false, 0, 5, 100); //为tianyu集团,处理工作的岗位编号. map.AddTBString(GenerWorkerListAttr.StaNo, null, "岗位编号", true, false, 0, 100, 100); //为tianyu集团,处理工作的部门编号. map.AddTBString(GenerWorkerListAttr.FK_Dept, null, "部门", true, false, 0, 100, 100); //如果是流程属性来控制的就按流程属性来计算。 map.AddTBDateTime(GenerWorkerListAttr.SDT, "应完成日期", false, false); map.AddTBDateTime(GenerWorkerListAttr.DTOfWarning, "警告日期", false, false); map.AddTBDateTime(GenerWorkerListAttr.RDT, "记录时间(接受工作日期)", false, false); //完成日期. map.AddTBDateTime(GenerWorkerListAttr.CDT, "完成时间", false, false); //用于分配工作. map.AddTBInt(GenerWorkerListAttr.IsEnable, 1, "是否可用", true, true); //add for 上海 2012-11-30 map.AddTBInt(GenerWorkerListAttr.IsRead, 0, "是否读取", true, true); //是否通过? 0=未通过 1=已经完成 , xxx标识其他状态. map.AddTBInt(GenerWorkerListAttr.IsPass, 0, "是否通过(对合流节点有效)", false, false); // 谁执行它? 0=手工执行,1=机器执行。2=混合执行. map.AddTBInt(GenerWorkerListAttr.WhoExeIt, 0, "谁执行它", false, false); //发送人. 2011-11-12 为天津用户增加。 map.AddTBString(GenerWorkerListAttr.Sender, null, "发送人", true, false, 0, 200, 100); //优先级,2012-06-15 为青岛用户增加。 map.AddTBInt(GenerWorkFlowAttr.PRI, 1, "优先级", true, true); // 挂起 map.AddTBDateTime(GenerWorkerListAttr.DTOfHungup,null, "挂起时间", false, false); map.AddTBDateTime(GenerWorkerListAttr.DTOfUnHungup,null, "预计解除挂起时间", false, false); //外部用户. 203-08-30 map.AddTBString(GenerWorkerListAttr.GuestNo, null, "外部用户编号", true, false, 0, 30, 100); map.AddTBString(GenerWorkerListAttr.GuestName, null, "外部用户名称", true, false, 0, 100, 100); map.AddTBInt(GenerWorkerListAttr.Idx, 1, "Idx", true, true); //参数标记 2014-04-05. map.AddTBAtParas(4000); this._enMap = map; return this._enMap; } } #endregion #region 重写基类的方法. protected override bool beforeInsert() { if (this.FID != 0) { if (this.FID == this.WorkID) this.FID = 0; } if (this.FK_Emp == "Guest") { this.FK_EmpText = BP.Web.GuestUser.Name; this.GuestName = this.FK_EmpText; this.GuestNo = BP.Web.GuestUser.No; } if (DataType.IsNullOrEmpty(this.FK_Dept)) this.FK_Dept = WebUser.FK_Dept; if (DataType.IsNullOrEmpty(this.DeptName)) this.DeptName = WebUser.FK_DeptName; //增加记录日期. this.SetValByKey(GenerWorkerListAttr.RDT, DataType.CurrentDateTimess); return base.beforeInsert(); } protected override bool beforeUpdate() { if (DataType.IsNullOrEmpty(this.FK_Dept)) this.FK_Dept = WebUser.FK_Dept; if (DataType.IsNullOrEmpty(this.DeptName)) this.DeptName = WebUser.FK_DeptName; return base.beforeUpdate(); } #endregion 重写基类的方法. } /// /// 工作人员集合 /// public class GenerWorkerLists : Entities { #region 方法 /// /// 得到它的 Entity /// public override Entity GetNewEntity { get { return new GenerWorkerList(); } } /// /// GenerWorkerList /// public GenerWorkerLists() { } public GenerWorkerLists(Int64 workId) { QueryObject qo = new QueryObject(this); qo.AddWhere(GenerWorkerListAttr.WorkID, workId); qo.addOrderBy(GenerWorkerListAttr.RDT); qo.DoQuery(); return; } /// /// /// /// /// public GenerWorkerLists(Int64 workId, int nodeId) { QueryObject qo = new QueryObject(this); qo.AddWhere(GenerWorkerListAttr.WorkID, workId); qo.addAnd(); qo.AddWhere(GenerWorkerListAttr.FK_Node, nodeId); qo.DoQuery(); return; } public GenerWorkerLists(Int64 workId, int nodeId,string FK_Emp) { QueryObject qo = new QueryObject(this); qo.AddWhere(GenerWorkerListAttr.WorkID, workId); qo.addAnd(); qo.AddWhere(GenerWorkerListAttr.FK_Node, nodeId); qo.addAnd(); qo.AddWhere(GenerWorkerListAttr.FK_Emp, FK_Emp); qo.DoQuery(); return; } /// /// 构造工作人员集合 /// /// 工作ID /// 节点ID /// 是否包含为分配的人员 public GenerWorkerLists(Int64 workId, int nodeId, bool isWithEmpExts) { QueryObject qo = new QueryObject(this); qo.addLeftBracket(); qo.AddWhere(GenerWorkerListAttr.WorkID, workId); qo.addOr(); qo.AddWhere(GenerWorkerListAttr.FID, workId); qo.addRightBracket(); qo.addAnd(); qo.AddWhere(GenerWorkerListAttr.FK_Node, nodeId); int i = qo.DoQuery(); if (isWithEmpExts == false) return; if (i == 0) throw new Exception("@系统错误,工作人员丢失请与管理员联系。NodeID=" + nodeId + " WorkID=" + workId); RememberMe rm = new RememberMe(); rm.FK_Emp = BP.Web.WebUser.No; rm.FK_Node = nodeId; if (rm.RetrieveFromDBSources() == 0) return; GenerWorkerList wl = (GenerWorkerList)this[0]; string[] myEmpStrs = rm.Emps.Split('@'); foreach (string emp in myEmpStrs) { if (emp==null || emp=="") continue; if (this.GetCountByKey(GenerWorkerListAttr.FK_Emp, emp) >= 1) continue; GenerWorkerList mywl = new GenerWorkerList(); mywl.Copy(wl); mywl.IsEnable = false; mywl.FK_Emp = emp; WF.Port.WFEmp myEmp = new BP.WF.Port.WFEmp(emp); mywl.FK_EmpText = myEmp.Name; try { mywl.Insert(); } catch { mywl.Update(); continue; } this.AddEntity(mywl); } return; } /// /// 工作者 /// /// 工作者ID /// 流程编号 public GenerWorkerLists(Int64 workId, string flowNo) { if (workId == 0) return; Flow fl = new Flow(flowNo); QueryObject qo = new QueryObject(this); qo.AddWhere(GenerWorkerListAttr.WorkID, workId); qo.addAnd(); qo.AddWhere(GenerWorkerListAttr.FK_Flow, flowNo); qo.DoQuery(); } #endregion #region 为了适应自动翻译成java的需要,把实体转换成List. /// /// 转化成 java list,C#不能调用. /// /// List public System.Collections.Generic.IList ToJavaList() { return (System.Collections.Generic.IList)this; } /// /// 转化成list 为了翻译成java的需要 /// /// 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((BP.WF.GenerWorkerList)this[i]); } return list; } #endregion 为了适应自动翻译成java的需要,把实体转换成List. } }