示例#1
0
        public void Confirm()
        {
            var tempClosureInfo = TempClosureInfo.Get(this.ProjectId);
            var url             = "/TempClosure/Main#/ClosureMemo?projectId=" + this.ProjectId;
            var title           = TaskWork.BuildTitle(this.ProjectId, tempClosureInfo.StoreNameZHCN, tempClosureInfo.StoreNameENUS);

            TaskWork.Finish(t => t.ReceiverAccount == ClientCookie.UserCode && t.RefID == this.ProjectId && t.Status == TaskWorkStatus.UnFinish && t.TypeCode == FlowCode.TempClosure_ClosurePackage);
            ProjectInfo.FinishNode(ProjectId, FlowCode.TempClosure_ClosurePackage, NodeCode.TempClosure_ClosurePackage_Upload, ProjectStatus.Finished);
        }
示例#2
0
        public void ExecuteProcess(string employeeCode, string sn, string actionName, string comment, List <ProcessDataField> dataField = null)
        {
            using (var scope = new TransactionScope())
            {
                Save(actionName);
                switch (actionName)
                {
                case ProjectAction.ReSubmit:
                    ProjectInfo.FinishNode(ProjectId, FlowCode.Rebuild_ConsInvtChecking, NodeCode.Rebuild_ConsInvtChecking_Downlod);
                    ProjectInfo.FinishNode(ProjectId, FlowCode.Rebuild_ConsInvtChecking, NodeCode.Rebuild_ConsInvtChecking_Input);
                    ProjectInfo.FinishNode(ProjectId, FlowCode.Rebuild_ConsInvtChecking, NodeCode.Rebuild_ConsInvtChecking_Upload);
                    break;

                case ProjectAction.Return:
                case ProjectAction.Recall:
                    ProjectInfo.Reset(ProjectId, WorkflowCode, GetProjectStatus(actionName));
                    break;

                case ProjectAction.Decline:
                    ProjectInfo.Reject(ProjectId, WorkflowCode);
                    break;

                //case ProjectAction.Approve:
                //    ProjectInfo.FinishNode(ProjectId, WorkflowCode, NodeCode.Rebuild_ConsInvtChecking_Confirm, GetProjectStatus(actionName));
                //    break;
                default:
                    ProjectInfo.FinishNode(ProjectId, WorkflowCode, NodeCode.Rebuild_ConsInvtChecking_Upload, GetProjectStatus(actionName));
                    break;
                }

                if (actionName == ProjectAction.Return)
                {
                    TaskWork.Finish(e => e.RefID == ProjectId &&
                                    e.TypeCode == WorkflowCode &&
                                    e.Status == TaskWorkStatus.UnFinish &&
                                    e.K2SN != sn);
                }
                scope.Complete();
            }
            K2FxContext.Current.ApprovalProcess(sn, employeeCode, actionName, comment);
        }
示例#3
0
        public void Return(string comment, string SerialNumber)
        {
            TaskWork.Finish(e => e.RefID == ProjectId &&
                            e.TypeCode == WorkflowCode &&
                            e.Status == TaskWorkStatus.UnFinish);

            K2FxContext.Current.ApprovalProcess(SerialNumber, ClientCookie.UserCode, "Return", comment);
            using (TransactionScope tranScope = new TransactionScope())
            {
                ProjectInfo.Reset(this.ProjectId, this.WorkflowCode);
                ProjectComment.AddComment(
                    ProjectCommentAction.Return,
                    comment,
                    this.Id,
                    this.TableName,
                    FlowCode.Renewal,
                    this.ProcInstId,
                    ProjectCommentStatus.Submit
                    );
                tranScope.Complete();
            }
        }
示例#4
0
        public void Return(string comment, string SerialNumber)
        {
            TaskWork.Finish(e => e.RefID == ProjectId &&
                            e.TypeCode == WorkflowCode &&
                            e.Status == TaskWorkStatus.UnFinish);
            //&& e.K2SN != SerialNumber);

            K2FxContext.Current.ApprovalProcess(SerialNumber, ClientCookie.UserCode, "Return", comment);
            using (TransactionScope tranScope = new TransactionScope())
            {
                ProjectInfo.Reset(this.ProjectId, this.WorkflowCode, ProjectStatus.UnFinish);
                var SavedComment = ProjectComment.GetSavedComment(this.Id, this.TableName, ClientCookie.UserCode);
                if (SavedComment != null)
                {
                    SavedComment.Status     = ProjectCommentStatus.Submit;
                    SavedComment.Action     = ProjectCommentAction.Return;
                    SavedComment.Content    = comment;
                    SavedComment.CreateTime = DateTime.Now;
                    SavedComment.Update();
                }
                else
                {
                    ProjectComment.AddComment(
                        ProjectCommentAction.Return,
                        comment,
                        this.Id,
                        this.TableName,
                        FlowCode.TempClosure,
                        this.ProcInstId,
                        ProjectCommentStatus.Submit
                        );
                }


                tranScope.Complete();
            }
        }
示例#5
0
 public override void Finish(TaskWorkStatus status, TaskWork task)
 {
     switch (status)
     {
     case TaskWorkStatus.K2ProcessApproved:
     {
         ProjectInfo.FinishNode(ProjectId, this.WorkflowCode, NodeCode.Finish);
         ProjectInfo.FinishNode(ProjectId, FlowCode.Renewal_LLNegotiation, NodeCode.Renewal_LLNegotiation_ConfirmLetter);
         if (!ProjectInfo.IsFlowStarted(ProjectId, FlowCode.Renewal_ConsInfo))
         {
             var info = RenewalInfo.Get(task.RefID);
             if (ProjectInfo.IsFlowFinished(ProjectId, FlowCode.Renewal_LLNegotiation))
             {
                 ProjectProgress.SetProgress(ProjectId, "30%");
                 if (info.NeedProjectCostEst)
                 {
                     if (!ProjectInfo.IsFlowStarted(ProjectId, FlowCode.Renewal_ConsInfo))
                     {
                         info.GenerateSubmitTask(FlowCode.Renewal_ConsInfo);
                     }
                 }
                 else
                 {
                     ProjectInfo.FinishNode(ProjectId, FlowCode.Renewal_ConsInfo, NodeCode.Finish, ProjectStatus.Finished);
                     if (!ProjectInfo.IsFlowStarted(ProjectId, FlowCode.Renewal_Tool))
                     {
                         info.GenerateSubmitTask(FlowCode.Renewal_Tool);
                     }
                 }
             }
         }
         TaskWork.Finish(t => t.TypeCode == this.WorkflowCode && t.RefID == this.ProjectId && t.Status == TaskWorkStatus.UnFinish);
     }
     break;
     }
 }
示例#6
0
        public void UpdateFromProjectList()
        {
            using (TransactionScope tranScope = new TransactionScope())
            {
                var oldInfo  = RenewalInfo.Get(this.ProjectId);
                var consInfo = RenewalConsInfo.Get(this.ProjectId);
                var analysis = RenewalAnalysis.Get(this.ProjectId);
                analysis.LeaseTenureAndTerm = string.Format("{0} years,from {1:yyyy-MM-dd} to {2:yyyy-MM-dd}", this.RenewalYears, this.NewLeaseStartDate, this.NewLeaseEndDate);
                analysis.Update();
                if (oldInfo.NeedProjectCostEst != this.NeedProjectCostEst)
                {
                    consInfo.HasReinvenstment = this.NeedProjectCostEst;
                    consInfo.Update();
                    if (ProjectInfo.IsFlowFinished(this.ProjectId, FlowCode.Renewal_Letter) &&
                        ProjectInfo.IsFlowFinished(this.ProjectId, FlowCode.Renewal_LLNegotiation))
                    {
                        if (!this.NeedProjectCostEst)
                        {
                            TaskWork.Cancel(e => e.RefID == this.ProjectId && e.Status == TaskWorkStatus.UnFinish && e.TypeCode == FlowCode.Renewal_ConsInfo);
                            ProjectInfo.FinishProject(this.ProjectId, FlowCode.Renewal_ConsInfo);
                            if (!ProjectInfo.IsFlowFinished(this.ProjectId, FlowCode.Renewal_Tool))
                            {
                                if (!TaskWork.Any(e => e.RefID == this.ProjectId && e.Status == TaskWorkStatus.UnFinish && e.TypeCode == FlowCode.Renewal_Tool))
                                {
                                    GenerateSubmitTask(FlowCode.Renewal_Tool);
                                }
                            }
                        }
                        else
                        {
                            ProjectInfo.Reset(this.ProjectId, FlowCode.Renewal_ConsInfo);

                            GenerateSubmitTask(FlowCode.Renewal_ConsInfo);
                            if (!ProjectInfo.IsFlowFinished(this.ProjectId, FlowCode.Renewal_Tool))
                            {
                                TaskWork.Cancel(e => e.RefID == this.ProjectId && e.TypeCode == FlowCode.Renewal_Tool && e.Status == TaskWorkStatus.UnFinish);
                                ProjectInfo.Reset(this.ProjectId, FlowCode.Renewal_Tool);
                            }
                        }
                    }
                }

                if (oldInfo.RenewalYears != this.RenewalYears)
                {
                    if (ProjectInfo.IsFlowFinished(ProjectId, FlowCode.Renewal_Analysis))
                    {
                        if (this.RenewalYears <= 2)
                        {
                            TaskWork.Finish(e => e.RefID == this.ProjectId && e.Status == TaskWorkStatus.UnFinish && e.TypeCode == FlowCode.Renewal_ClearanceReport);
                            ProjectInfo.FinishProject(this.ProjectId, FlowCode.Renewal_ClearanceReport);
                        }
                        else
                        {
                            if (!TaskWork.Any(e => e.RefID == ProjectId && e.TypeCode == FlowCode.Renewal_ClearanceReport && e.Status == TaskWorkStatus.UnFinish))
                            {
                                GenerateSubmitTask(FlowCode.Renewal_ClearanceReport);
                            }
                        }
                    }
                }
                this.Update();
                tranScope.Complete();
            }
        }
示例#7
0
        public override void Finish(TaskWorkStatus status, TaskWork task)
        {
            RenewalInfo info = RenewalInfo.Get(this.ProjectId);

            switch (status)
            {
            case TaskWorkStatus.K2ProcessApproved:
                //var toolUploadTask = TaskWork.FirstOrDefault(t => t.RefID == ProjectId
                //        && t.TypeCode == FlowCode.Renewal_Tool
                //        && t.ReceiverAccount == info.AssetActorAccount
                //        && t.ActivityName == "AssetActor"
                //        && t.Status == TaskWorkStatus.Cancel);
                //if (toolUploadTask != null)
                //{
                //    toolUploadTask.Status = TaskWorkStatus.UnFinish;
                //    toolUploadTask.Update();
                //}
                //else if (!ProjectInfo.IsFlowStarted(this.ProjectId, FlowCode.Renewal_Tool))
                //{
                //    info.GenerateSubmitTask(FlowCode.Renewal_Tool);
                //}
                var  tool = RenewalTool.Get(ProjectId);
                Guid entityId;
                var  toolProj = ProjectInfo.FirstOrDefault(e => e.Status == ProjectStatus.Finished && e.ProjectId == ProjectId && e.FlowCode == FlowCode.Renewal_Tool);
                if (toolProj != null)
                {
                    NoticeToActor(info.AssetActorAccount, info.USCode);
                    tool.Edit();
                    entityId = tool.NewEntityId;
                }
                else
                {
                    entityId = tool.Id;
                    ProjectInfo.Reset(this.ProjectId, FlowCode.Renewal_Tool);
                    info.GenerateSubmitTask(FlowCode.Renewal_Tool);
                }


                var entity = RenewalToolWriteOffAndReinCost.FirstOrDefault(w => w.ToolId == entityId);
                if (entity == null)
                {
                    entity        = new RenewalToolWriteOffAndReinCost();
                    entity.Id     = Guid.NewGuid();
                    entity.ToolId = tool.Id;
                    entity.Add();
                }
                var writeOffAmount = WriteOffAmount.GetByConsInfoId(this.Id);
                var reinCost       = ReinvestmentCost.GetByConsInfoId(this.Id);
                if (writeOffAmount != null)
                {
                    entity.REWriteOff   = DataConverter.ToDecimal(writeOffAmount.REWriteOff);
                    entity.LHIWriteOff  = DataConverter.ToDecimal(writeOffAmount.LHIWriteOff);
                    entity.ESSDWriteOff = DataConverter.ToDecimal(writeOffAmount.ESSDWriteOff);
                }
                else
                {
                    entity.REWriteOff   = 0;
                    entity.LHIWriteOff  = 0;
                    entity.ESSDWriteOff = 0;
                }
                if (reinCost != null)
                {
                    entity.RECost   = DataConverter.ToDecimal(reinCost.RECostNorm);
                    entity.LHICost  = DataConverter.ToDecimal(reinCost.LHINorm);
                    entity.ESSDCost = DataConverter.ToDecimal(reinCost.ESSDNorm);
                }
                else
                {
                    entity.RECost   = 0;
                    entity.LHICost  = 0;
                    entity.ESSDCost = 0;
                }
                Log4netHelper.WriteInfo(JsonConvert.SerializeObject(new { desc = "renewal tool info:", entityId, tool, writeOffAmount, reinCost, Id }));
                entity.Update();
                if (HasReinvenstment)
                {
                    ProjectInfo.FinishNode(this.ProjectId, this.WorkflowCode, NodeCode.Renewal_ConsInfo_Approval);
                }

                break;

            case TaskWorkStatus.K2ProcessDeclined:
                break;
            }
            task.Finish();
        }