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));
        }
示例#2
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());
        }
示例#3
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());
        }