/// <summary> /// 重写流程结束方法 /// </summary> public override Pkurg.PWorldBPM.FinallyDisposeServices.ExecuteResultInfo DoServiceEvent(int k2_workflowId, SerializableDictionary <string, string> dataFields) { Logger.logger.DebugFormat("Params:{0},{1}", k2_workflowId, dataFields.Keys.Count); foreach (KeyValuePair <string, string> item in dataFields) { Logger.logger.DebugFormat("df:{0}-{1}", item.Key, item.Value); } Pkurg.PWorldBPM.FinallyDisposeServices.ExecuteResultInfo info = new ExecuteResultInfo(); try { //根据流程ID获取FormId JC_TenderSpecialItemInfo companyInfo = Pkurg.PWorldBPM.Business.BIZ.JC.JC_TenderSpecialItem.GetJC_TenderSpecialItemInfoByWfId(k2_workflowId.ToString()); string jcFormCode = companyInfo.FormID; string jcFormName = companyInfo.Title; string StartUserName = companyInfo.UserName; //判断是否审批通过,存储0,1表示通过与不通过 string resultString = dataFields["IsPass"]; //这部分是根据自己的流程来判定的,现在只是通过流程ID得到FormId来进行判断结束 Logger.logger.DebugFormat("Proc:{0},{1}", jcFormCode, resultString); JC_TenderSpecialItemInfo model = new JC_TenderSpecialItemInfo(); model.FormID = jcFormCode; model.IsApproval = resultString; //两个文件名字最好不能起的一样,尤其是增删改查操作的时候文件名不能一样 Pkurg.PWorldBPM.Business.BIZ.JC.JC_TenderSpecialItem.UpdateJC_TenderSpecialItemInfoInfoByModel(model); //流程结束之后授权给集团招采部门所有人 //得到各参数的值:AuthorizedByUserCode:授权人编号;AuthorizedByUserName:授权人姓名;ProId:流程ID;ProcName:流程编号;AuthorizedUserCode:被授权部门编号;AuthorizedUserName:被授权部门名称 DataTable dt = Pkurg.PWorldBPM.Business.Controls.WF_WorkFlowInstances.GetWorkFlowInstanceByFormID(jcFormCode); DataRow dataRow = dt.Rows[0]; string AuthorizedByUserCode = dataRow["CreateByUserCode"].ToString(); string AuthorizedByUserName = dataRow["CreateByUserName"].ToString(); string ProId = jcFormCode; string ProcName = jcFormName; //得到子公司的招采部的编号以及名称 Pkurg.PWorld.Entities.Department deptInfo = new Pkurg.PWorld.Business.Permission.BFPmsUserRoleDepartment().GetDeptByCurrentDeptCodeAndOtherDeptName(companyInfo.StartDeptId, "招标采购部"); //授权给所在公司的招标采购部 InsertAuthorizationToJCGroup(AuthorizedByUserCode, AuthorizedByUserName, ProId, ProcName, deptInfo.DepartCode); //授权给集团的采购管理部 InsertAuthorizationToJCGroup(AuthorizedByUserCode, AuthorizedByUserName, ProId, ProcName, CGDeptCode); info.IsSuccess = true; } catch (Exception ex) { info.ExecException = ex.StackTrace; info.IsSuccess = false; } Logger.logger.DebugFormat("Result:{0}", info.IsSuccess); Logger.logger.DebugFormat("Result-e:{0}", info.ExecException); return(info); }
/// <summary> /// 重写流程结束方法 /// </summary> public override Pkurg.PWorldBPM.FinallyDisposeServices.ExecuteResultInfo DoServiceEvent(int k2_workflowId, SerializableDictionary <string, string> dataFields) { Logger.logger.DebugFormat("Params:{0},{1}", k2_workflowId, dataFields.Keys.Count); foreach (KeyValuePair <string, string> item in dataFields) { Logger.logger.DebugFormat("df:{0}-{1}", item.Key, item.Value); } Pkurg.PWorldBPM.FinallyDisposeServices.ExecuteResultInfo info = new ExecuteResultInfo(); try { //根据流程ID获取FormId JC_ProjectTenderCityCompanyInfo companyInfo = Pkurg.PWorldBPM.Business.BIZ.JC.JC_ProjectTenderCityCompany.GetJC_ProjectTenderCityCompanyInfoByWfId(k2_workflowId.ToString()); string jcFormCode = companyInfo.FormID; string jcFormName = companyInfo.Title; string StartUserName = companyInfo.UserName; //判断是否审批通过,存储0,1表示通过与不通过 string resultString = dataFields["IsPass"]; //添加判断在招标委员会的节点上,如果时间过去两天,还有人没有审批, //则根据相关的字段给数据库插入“同意”字段,并且时间为截至时间[三个表关联] //条件=招标委员会意见/集团招标委员会意见,同时时间=2天,option.value=null //option.value="同意" 时间=当前时间 //方法 insertinto:加意见 //instanceid //先得到节点,再把节点上的datefield的人分隔开,再挨个判断他有没有意见,没有意见的再插入 //if (dataFields["IsPass"] == "1") //{ // string currentActiveName = ""; // string persons=""; // if (dataFields["IsReportToResource"] == "0") // { // persons = dataFields["GroupTenderCommitteeManager"]; // currentActiveName = "集团招标委员会意见"; // } // else // { // persons = dataFields["TenderCommitteeManager"]; // currentActiveName = "招标委员会意见"; // } // //把上面节点的datefield的人分隔开,再挨个判断他有没有意见,没有意见的再插入 // foreach (string person in persons.Split(',')) // { // //定义三个变量得到 // //loginName, wfInstanceId, currentActiveName // string LoginName = person.ToLower().Replace("k2:founder\\",""); // string WFInstanceId = k2_workflowId.ToString(); // //判断他有没有意见 // if ( !string.IsNullOrEmpty( LoginName)) // { // //给表中插入数据,并且option字段值默认为“默认同意” // Pkurg.PWorldBPM.Business.BIZ.JC.JC_ProjectTenderCityCompany.InsertWF_Approval_RecordByInstanceID(currentActiveName, LoginName, WFInstanceId); // } // } //} //添加判断在招标委员会主任的节点上,如果时间过去两天,还有人没有审批, //则根据相关的字段给数据库插入“同意”字段,并且时间为截至时间[三个表关联] //条件=招标委员会主任意见/集团招标委员会主任意见,同时时间=2天,option.value=null //option.value="同意" 时间=当前时间 //instanceid //if (dataFields["IsPass"] == "1") //{ // string currentActiveName = ""; // string person = ""; // person = dataFields["TenderCommitteeChairman"]; // currentActiveName = "招标委员会主任意见"; // //定义三个变量得到 // //loginName, wfInstanceId, currentActiveName // string LoginName = person.ToLower().Replace("k2:founder\\", ""); // string WFInstanceId = k2_workflowId.ToString(); // //给表中插入数据,并且option字段值默认为“默认同意” // Pkurg.PWorldBPM.Business.BIZ.JC.JC_ProjectTenderCityCompany.InsertWF_Approval_RecordByInstanceID(currentActiveName, LoginName, WFInstanceId); //} //这部分是根据自己的流程来判定的,现在只是通过流程ID得到FormId来进行判断结束 Logger.logger.DebugFormat("Proc:{0},{1}", jcFormCode, resultString); JC_ProjectTenderCityCompanyInfo model = new JC_ProjectTenderCityCompanyInfo(); model.FormID = jcFormCode; model.IsApproval = resultString; //两个文件名字最好不能起的一样,尤其是增删改查操作的时候文件名不能一样 Pkurg.PWorldBPM.Business.BIZ.JC.JC_ProjectTenderCityCompany.UpdateJC_ProjectTenderCityCompanyInfoByModel(model); //流程结束之后授权给集团招采部门所有人 //得到各参数的值:AuthorizedByUserCode:授权人编号;AuthorizedByUserName:授权人姓名;ProId:流程ID;ProcName:流程编号;AuthorizedUserCode:被授权部门编号;AuthorizedUserName:被授权部门名称 DataTable dt = Pkurg.PWorldBPM.Business.Controls.WF_WorkFlowInstances.GetWorkFlowInstanceByFormID(jcFormCode); DataRow dataRow = dt.Rows[0]; string AuthorizedByUserCode = dataRow["CreateByUserCode"].ToString(); string AuthorizedByUserName = dataRow["CreateByUserName"].ToString(); string ProId = jcFormCode; string ProcName = jcFormName; //得到子公司的招采部的编号以及名称 Pkurg.PWorld.Entities.Department deptInfo = new Pkurg.PWorld.Business.Permission.BFPmsUserRoleDepartment().GetDeptByCurrentDeptCodeAndOtherDeptName(companyInfo.StartDeptId, "招标采购部"); //授权给所在公司的招标采购部 InsertAuthorizationToJCGroup(AuthorizedByUserCode, AuthorizedByUserName, ProId, ProcName, deptInfo.DepartCode); //授权给集团的采购管理部 InsertAuthorizationToJCGroup(AuthorizedByUserCode, AuthorizedByUserName, ProId, ProcName, CGDeptCode); //发送邮件通知已经授权 //MailService mailService = new MailService(); //bool eResult = mailService.SendEmailCustom("","",""); //bool eResult = mailService.SendEmailCustom(string toUsers; string title;string body); info.IsSuccess = true; } catch (Exception ex) { info.ExecException = ex.StackTrace; info.IsSuccess = false; } Logger.logger.DebugFormat("Result:{0}", info.IsSuccess); Logger.logger.DebugFormat("Result-e:{0}", info.ExecException); return(info); }