public void FinishTest() { var taskWork = TaskWork.FirstOrDefault(e => e.Id == new Guid("6bae9906-8608-49a2-8faa-0bbd5eaa43ee")); var wfEntity = BaseWFEntity.GetWorkflowEntity("MajorLease15030405", FlowCode.MajorLease_ConsInfo); wfEntity.Finish(TaskWorkStatus.K2ProcessApproved, taskWork); }
public IHttpActionResult PostClosureConsInvtChecking(ClosureConsInvtChecking entity) { //ClosureInfo closure = new ClosureInfo(); //closure = closure.GetByProjectId(entity.ProjectId.Value); var task = TaskWork.FirstOrDefault( e => e.ReceiverAccount == ClientCookie.UserCode && e.Status == 0 && e.SourceCode == FlowCode.Closure && e.TypeCode == FlowCode.Closure_ConsInvtChecking && e.RefID == entity.ProjectId); task.Finish(); // Start K2 Process string _procCode = WFConsInvtChecking.ProcessCode; List <ProcessDataField> _listDataFields = new List <ProcessDataField>(); var _diff = CalDiff(entity);; /* * Total Variance <= +-5% : 1 +-5% < Total Variance <= +- 10% : 2 * Total Variance > +- 10% : 3 */ var closureEntity = ClosureInfo.GetByProjectId(entity.ProjectId); _listDataFields.Add(new ProcessDataField("flag_DiffRangeType", _diff)); //传偏差值范围 1, 2, 3 //_listDataFields.Add(new ProcessDataField("dest_Creator", ClientCookie.UserCode)); _listDataFields.Add(new ProcessDataField("dest_Creator", entity.CreateUserAccount)); // 发起人也变成工程PM,不是actor _listDataFields.Add(new ProcessDataField("dest_EngPM", entity.PMSupervisor)); _listDataFields.Add(new ProcessDataField("dest_Fin", entity.FinControllerAccount)); _listDataFields.Add(new ProcessDataField("dest_VPGM", entity.VPGMAccount)); _listDataFields.Add(new ProcessDataField("dest_Group1", entity.FinanceAccount + ";" + entity.PMSupervisor)); _listDataFields.Add(new ProcessDataField("ProcessCode", _procCode)); //_listDataFields.Add(new ProcessDataField("dest_Receiver", "")); 知会人 //将 WFConsInvtChecking 的任务传给K2 var taskJson = Newtonsoft.Json.JsonConvert.SerializeObject(task); _listDataFields.Add(new ProcessDataField("ProjectTaskInfo", taskJson)); int _procInstID = K2FxContext.Current.StartProcess(_procCode, ClientCookie.UserCode, _listDataFields); if (_procInstID > 0) { // 更新 ConsInvtChecking 表的ProcInstId entity.ProcInstID = _procInstID; ClosureConsInvtChecking.Update(entity); SaveCommers(entity, ProjectAction.Submit, ProjectCommentStatus.Submit); ProjectInfo.FinishNode(entity.ProjectId, FlowCode.Closure_ConsInvtChecking, NodeCode.Closure_ConsInvtChecking_ResultUpload); } return(Ok()); }
public WFTempClosurePackage(TempClosurePackage entity) : base(entity) { var approvers = ApproveDialogUser.GetApproveDialogUser(entity.Id.ToString()); var task = TaskWork.FirstOrDefault(t => t.RefID == entity.ProjectId && t.TypeCode == FlowCode.TempClosure_ClosurePackage); K2Param.AddDataField("dest_Creator", Entity.CreateUserAccount); K2Param.AddDataField("dest_MRMgrs", string.Concat(approvers.MarketMgrCode, ";", !string.IsNullOrEmpty(approvers.RegionalMgrCode) ? approvers.RegionalMgrCode : "")); K2Param.AddDataField("dest_GMApprovers", string.Concat(approvers.MDDCode, ";", approvers.GMCode, ";", approvers.FCCode)); K2Param.AddDataField("dest_VPGM", approvers.VPGMCode); //K2Param.AddDataField("dest_DevVP", Entity.DevVP); Cary: 没有这个环节了。2014-9-11 K2Param.AddDataField("ProcessCode", ProcessCode); K2Param.AddDataField("ProjectTaskInfo", JsonConvert.SerializeObject(task)); }
public WFTempClosurePackage(TempClosurePackage entity, ApproveUsers approvers) : base(entity) { var task = TaskWork.FirstOrDefault(t => t.RefID == entity.ProjectId && t.TypeCode == FlowCode.TempClosure_ClosurePackage); string destMRMgrs = approvers.MarketMgr.Code; if (approvers.RegionalMgr != null) { destMRMgrs += ";" + approvers.RegionalMgr.Code; } K2Param.AddDataField("dest_Creator", entity.CreateUserAccount); K2Param.AddDataField("dest_MRMgrs", destMRMgrs); K2Param.AddDataField("dest_GMApprovers", string.Concat(approvers.MDD.Code, ";", approvers.GM.Code, ";", approvers.FC.Code)); K2Param.AddDataField("dest_VPGM", approvers.VPGM.Code); //K2Param.AddDataField("dest_DevVP", Entity.DevVP); Cary: 没有这个环节了。2014-9-11 K2Param.AddDataField("ProcessCode", ProcessCode); K2Param.AddDataField("ProjectTaskInfo", JsonConvert.SerializeObject(task)); }
public IHttpActionResult PostExcutiveSummary(ClosureExecutiveSummary entity) { var task = TaskWork.FirstOrDefault( e => e.ReceiverAccount == ClientCookie.UserCode && e.Status == 0 && e.SourceCode == FlowCode.Closure && e.TypeCode == FlowCode.Closure_ExecutiveSummary && e.RefID == entity.ProjectId); if (task != null) { task.Status = TaskWorkStatus.K2ProcessApproved; task.Url = SiteInfo.GetProjectViewPageUrl(FlowCode.Closure_ExecutiveSummary, task.RefID); task.FinishTime = DateTime.Now; var ProcInstID = entity.StartProcess(task); task.ProcInstID = ProcInstID; entity.ProcInstID = ProcInstID; entity.Update(); TaskWork.Update(task); ProjectInfo.FinishNode(entity.ProjectId, FlowCode.Closure_ExecutiveSummary, NodeCode.Closure_ExecutiveSummary_Input); } return(Ok()); }