public IHttpActionResult ProcessClosureWOCheckList(ClosureWOCheckList entity) { int procInstID = entity.ProcInstID.Value; string actionLower = entity.Action.ToLower(); string account = ClientCookie.UserCode; //评论信息 string comments = entity.Comments; // To-Do K2 action ProcessActionResult _action = BPMHelper.ConvertToProcAction(actionLower); if (actionLower.Equals(ProjectAction.Return, StringComparison.CurrentCultureIgnoreCase)) { TaskWork.Finish(e => e.RefID == entity.ProjectId && e.TypeCode == FlowCode.Closure_WOCheckList && e.Status == TaskWorkStatus.UnFinish && e.K2SN != entity.SN); } if (actionLower == "resubmit") { List <ProcessDataField> _listDataFields = new List <ProcessDataField>(); _listDataFields.Add(new ProcessDataField("dest_PMSupervisor", entity.PMSupervisorAccount)); // 工程PM直属上级 _listDataFields.Add(new ProcessDataField("dest_MCCLApprovers", string.Join(";", entity.MCCLApproverAccount, entity.MCCLITApproverAccount, entity.MCCLMCCLEqApproverAccount))); // MCCL Approvers K2FxContext.Current.ApprovalProcess(entity.SN, account, _action.ToString(), comments, _listDataFields); entity.Save(); _db.Entry(entity).State = EntityState.Modified; _db.SaveChanges(); } else { K2FxContext.Current.ApprovalProcess(entity.SN, account, _action.ToString(), comments); } if (actionLower == "submit") { } else if (actionLower == "resubmit") { ProjectInfo.FinishNode(entity.ProjectId, FlowCode.Closure_WOCheckList, NodeCode.Closure_WOCheckList_ClosingCost); } //ProjectInfo.UpdateProjectStatus(entity.ProjectId, FlowCode.Closure_WOCheckList, entity.GetProjectStatus(entity.Action)); SaveCommers(entity, _action.ToString(), ProjectCommentStatus.Submit); return(Ok(entity.Status)); }
public IHttpActionResult ProcessClosureConsInvtChecking(ClosureConsInvtChecking entity) { int procInstID = entity.ProcInstID.Value; string actionLower = entity.Action.ToLower(); string account = ClientCookie.UserCode; //评论信息 string comments = entity.Comments; // To-Do K2 action ProcessActionResult _action = BPMHelper.ConvertToProcAction(actionLower); List <ProcessDataField> _listDataFields = new List <ProcessDataField>(); if (entity.Action == "ReSubmit") { var _diff = CalDiff(entity); _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)); K2FxContext.Current.ApprovalProcess(entity.SN, account, _action.ToString(), comments, _listDataFields); } else { K2FxContext.Current.ApprovalProcess(entity.SN, account, _action.ToString(), comments); } if (actionLower.Equals(ProjectAction.Return, StringComparison.CurrentCultureIgnoreCase)) { TaskWork.Finish(e => e.RefID == entity.ProjectId && e.TypeCode == FlowCode.Closure_ConsInvtChecking && e.Status == TaskWorkStatus.UnFinish && e.K2SN != entity.SN); } if (actionLower == "resubmit") { ProjectInfo.FinishNode(entity.ProjectId, FlowCode.Closure_ConsInvtChecking, NodeCode.Closure_ConsInvtChecking_WriteOffData); } else if (actionLower == "return") { //ProjectInfo.Reset(entity.ProjectId, FlowCode.Closure_ConsInvtChecking); } SaveCommers(entity, _action.ToString(), ProjectCommentStatus.Submit); return(Ok()); }
public IHttpActionResult ReturnTask(WorkflowStepInfo info) { var task = TaskWork.GetTaskBySN(info.SN); if (task == null || task.Status != TaskWorkStatus.UnFinish) { return(Ok()); } var entityId = new Guid(info.EntityID); string projectId = string.Empty; switch (info.WorkflowName) { case FlowCode.Closure_ClosurePackage: var closurePackage = ClosurePackage.Get(entityId); projectId = closurePackage.ProjectId; break; case FlowCode.TempClosure_ClosurePackage: var tempClosurePackage = TempClosurePackage.Get(entityId); projectId = tempClosurePackage.ProjectId; break; case FlowCode.MajorLease_Package: var majorLeasePackage = MajorLeaseChangePackage.Get(entityId); projectId = majorLeasePackage.ProjectId; break; case FlowCode.Rebuild_Package: var rebuildPackage = RebuildPackage.Get(entityId); projectId = rebuildPackage.ProjectId; break; case FlowCode.Renewal_Package: var renewalPackage = RenewalPackage.Get(entityId); projectId = renewalPackage.ProjectId; break; case FlowCode.Reimage_Package: var reimagePackage = RenewalPackage.Get(entityId); projectId = reimagePackage.ProjectId; break; default: break; } if (!string.IsNullOrEmpty(projectId)) { TaskWork.Finish(e => e.RefID == projectId && e.TypeCode == info.WorkflowName && e.Status == TaskWorkStatus.UnFinish && e.ActivityName != "Originator"); } return(Ok()); }
public bool Add(MaterTrack materTrack) { using (TransactionScope tranScope = new TransactionScope()) { materTrack.Id = Guid.NewGuid(); materTrack.CreateTime = DateTime.Now; MaterTrack.Add(materTrack); var project = ProjectInfo.Get(materTrack.WorkflowId, materTrack.WorkflowType); var store = StoreBasicInfo.FirstOrDefault(s => s.StoreCode == project.USCode); var Codes = materTrack.NodeType.Split('_'); var url = string.Format("/{0}/Main#/{1}/Process/View?projectId={2}", Codes[0], Codes[1], materTrack.WorkflowId); //if (Codes[0] == "Closure") //临时改动 只针对Closure,因为Closure 用的还是老的URL //{ // url = string.Format("/{0}/Main#/{0}/{1}/Process/View?projectId={2}", Codes[0], Codes[1], materTrack.WorkflowId); //} var title = TaskWork.BuildTitle(materTrack.WorkflowId, store.NameZHCN, store.NameENUS); switch (materTrack.TrackType) { case MaterTrackType.Rep: { var actor = ProjectUsers.FirstOrDefault(pu => pu.ProjectId == materTrack.WorkflowId && pu.RoleCode == ProjectUserRoleCode.AssetActor); TaskWork.SendTask(materTrack.WorkflowId, title, project.USCode, url, actor, materTrack.WorkflowType, materTrack.NodeType, "Start_MaterTrack_Rep"); } break; case MaterTrackType.Feedback: { var legal = ProjectUsers.FirstOrDefault(pu => pu.ProjectId == materTrack.WorkflowId && pu.RoleCode == ProjectUserRoleCode.Legal); TaskWork.Finish(t => t.RefID == materTrack.WorkflowId && t.SourceCode == materTrack.WorkflowType && t.TypeCode == materTrack.NodeType && t.ActivityName == "Start_MaterTrack_Rep" && t.Status == TaskWorkStatus.UnFinish); if (TaskWork.Count(t => t.RefID == materTrack.WorkflowId && t.SourceCode == materTrack.WorkflowType && t.TypeCode == materTrack.NodeType && t.ActivityName == "Start_MaterTrack_Feedback" && t.Status == TaskWorkStatus.UnFinish) == 0) { TaskWork.SendTask(materTrack.WorkflowId, title, project.USCode, url, legal, materTrack.WorkflowType, materTrack.NodeType, "Start_MaterTrack_Feedback"); } } break; case MaterTrackType.Reply: { var actor = ProjectUsers.FirstOrDefault(pu => pu.ProjectId == materTrack.WorkflowId && pu.RoleCode == ProjectUserRoleCode.AssetActor); TaskWork.Finish(t => t.RefID == materTrack.WorkflowId && t.SourceCode == materTrack.WorkflowType && t.TypeCode == materTrack.NodeType && t.ActivityName == "Start_MaterTrack_Feedback" && t.Status == TaskWorkStatus.UnFinish); if (TaskWork.Count(t => t.RefID == materTrack.WorkflowId && t.SourceCode == materTrack.WorkflowType && t.TypeCode == materTrack.NodeType && t.ActivityName == "Start_MaterTrack_Rep" && t.Status == TaskWorkStatus.UnFinish) == 0) { TaskWork.SendTask(materTrack.WorkflowId, title, project.USCode, url, actor, materTrack.WorkflowType, materTrack.NodeType, "Start_MaterTrack_Rep"); } } break; } tranScope.Complete(); return(true); } }
public IHttpActionResult Submit(StoreSTLocation store) { using (var scope = new TransactionScope()) { //store.Save(); Mapper.CreateMap <StoreSTLocation, StoreSTLocationHistory>(); var history = Mapper.Map <StoreSTLocationHistory>(store); var his = StoreSTLocationHistory.FirstOrDefault(e => e.RefId == store.ProjectIdentifier); var project = ProjectInfo.Get(store.ProjectIdentifier); if (his == null) { history.Id = Guid.NewGuid(); history.RefId = store.ProjectIdentifier; } else { history.Id = his.Id; history.RefId = store.ProjectIdentifier; } history.Save(); if (store.EstimatedVsActualConstruction != null) { store.EstimatedVsActualConstruction.Save(); } TaskWork.Finish(t => t.ReceiverAccount == ClientCookie.UserCode && t.TypeCode == FlowCode.Renewal_SiteInfo && t.RefID == project.ProjectId); ProjectInfo.FinishNode(project.ProjectId, FlowCode.Renewal_SiteInfo, NodeCode.Finish, ProjectStatus.Finished); ProjectInfo.CompleteMainIfEnable(project.ProjectId); if (ProjectInfo.IsFlowFinished(project.ProjectId, FlowCode.Renewal_ContractInfo)) { ProjectProgress.SetProgress(project.ProjectId, "100%"); } scope.Complete(); } return(Ok()); }
public bool Finish(string WorkFlowId, string WorkFlowType, string NodeType) { TaskWork.Finish(t => t.RefID == WorkFlowId && t.SourceCode == WorkFlowType && t.TypeCode == NodeType && t.ActivityName.Contains("Start_MaterTrack") && t.Status == TaskWorkStatus.UnFinish); return(true); }