コード例 #1
0
        public DTOProcessActionResult TakeProcessAction(DTOProcessAction processAction)
        {
            Logger.Add(LogType.Verbose, $"TakeProcessAction call received: action = {processAction.Type}, {processAction.GroupID} / {processAction.ApplicationID}");
            ProcessActionResult processActionResult = ProcessManager.Instance.TakeProcessAction(processAction.GroupID, processAction.ApplicationID, processAction.Type);

            return(new DTOProcessActionResult(processActionResult));
        }
コード例 #2
0
        /// <summary>
        /// Convert to process action.
        /// </summary>
        /// <param name="actionLower">The action lower.</param>
        /// <returns>ProcessActionResult.</returns>
        public static ProcessActionResult ConvertToProcAction(string actionLower)
        {
            actionLower = actionLower.ToLower();

            // 2014.09.22 victor.huang:Fixed the bug after changed the button text
            ProcessActionResult _action = ConvertHelper.ToEnumType <ProcessActionResult>(actionLower, ProcessActionResult.Unknown);

            switch (actionLower)
            {
            case "resubmit":
                _action = ProcessActionResult.Resubmit;
                break;

            case "submit":
                _action = ProcessActionResult.Approve;
                break;

            case "decline":
                _action = ProcessActionResult.Decline;
                break;

            case "return":
                _action = ProcessActionResult.Return;
                break;

            case "confirm":
                _action = ProcessActionResult.Confirm;
                break;
            }

            return(_action);
        }
コード例 #3
0
        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));
        }
コード例 #4
0
        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());
        }
コード例 #5
0
 public DTOProcessActionResult(ProcessActionResult processActionResult)
 {
     Type         = processActionResult.Type;
     ErrorMessage = processActionResult.ErrorMessage;
     Status       = processActionResult.Status != null ? new DTOProcessStatus(processActionResult.Status) : null;
 }
コード例 #6
0
        public IHttpActionResult ProcessClosureLegalReview(ClosureLegalReview entity)
        {
            int procInstID = entity.ProcInstID.Value;


            string account = ClientCookie.UserCode;
            //评论信息
            string comments = entity.Comments;

            // To-Do K2 action
            ProcessActionResult _action = BPMHelper.ConvertToProcAction(entity.Action);


            string op = string.Empty;
            var    _listDataFields = new List <ProcessDataField>();

            switch (entity.Action)
            {
            case "Submit":

                break;

            case "Return":
                op = ProjectCommentAction.Return;
                break;

            case "ReSubmit":
                op = ProjectCommentAction.ReSubmit;
                var legalAccount = entity.LegalAccount;
                _listDataFields.Add(new ProcessDataField("dest_Legal", legalAccount));    //entity.   Legal
                break;
            }

            ClosureLegalReview.Update(entity);
            var result = false;

            if (_listDataFields.Count > 0)
            {
                result = K2FxContext.Current.ApprovalProcess(entity.SN, account, _action.ToString(), comments, _listDataFields);
            }
            else
            {
                result = K2FxContext.Current.ApprovalProcess(entity.SN, account, _action.ToString(), comments);
            }

            if (result)
            {
                switch (entity.Action)
                {
                case ProjectAction.Recall:
                    ProjectInfo.Reset(entity.ProjectId, FlowCode.Closure_LegalReview, ProjectStatus.Recalled);
                    break;

                case ProjectAction.Return:
                    ProjectInfo.Reset(entity.ProjectId, FlowCode.Closure_LegalReview);
                    break;

                case ProjectAction.Decline:
                    ProjectInfo.Reject(entity.ProjectId, FlowCode.Closure_LegalReview);
                    break;

                case ProjectAction.ReSubmit:
                    ProjectInfo.FinishNode(entity.ProjectId, FlowCode.Closure_LegalReview, NodeCode.Closure_LegalReview_Input);
                    break;

                default:
                    ProjectInfo.FinishNode(entity.ProjectId, FlowCode.Closure_LegalReview, NodeCode.Closure_LegalReview_Input);
                    break;
                }
            }
            SaveCommers(entity, _action.ToString(), ProjectCommentStatus.Submit);
            return(Ok());
        }