Exemplo n.º 1
0
        public void GenerateConsInvtCheckingTask(bool isScheduled = false)
        {
            var rmgInfo = ReimageInfo.Search(e => e.ProjectId.Equals(ProjectId)).AsNoTracking().FirstOrDefault();

            if (rmgInfo == null)
            {
                throw new Exception("Could not find the Reimage Info, please check it!");
            }
            var taskUrl = string.Format(@"/Reimage/Main#/ConsInvtChecking?projectId={0}", ProjectId);
            var task    = rmgInfo.GenerateTaskWork(WorkflowCode, WorkflowCode, WorkflowCode, taskUrl);

            task.ActivityName = NodeCode.Start;
            task.ActionName   = SetTaskActionName(ProjectId);

            if (!isScheduled)
            {
                TaskWork.Add(task);
            }
            else
            {
                var gbMemo = ReimageGBMemo.GetGBMemo(ProjectId);
                if (gbMemo != null && gbMemo.ConstCompletionDate.HasValue)
                {
                    ScheduleLog.GenerateTaskSchedule(gbMemo.ConstCompletionDate.Value.AddDays(60), task, ClientCookie.UserCode, ProjectId, FlowCode.Reimage_ConsInvtChecking, rmgInfo.USCode);
                }
            }
        }
Exemplo n.º 2
0
        public void GenerateConsInvtCheckingTask(bool isScheduled = false)
        {
            if (CheckIfNeedGenerateConsInvtCheckingTask())
            {
                var taskUrl        = string.Format("/MajorLease/Main#/ConsInvtChecking?projectId={0}", ProjectId);
                var majorLeaseInfo = MajorLeaseInfo.Search(e => e.ProjectId.Equals(ProjectId)).AsNoTracking().FirstOrDefault();
                if (majorLeaseInfo == null)
                {
                    throw new Exception("Could not find the Major Lease Info, please check it!");
                }
                var task = majorLeaseInfo.GenerateTaskWork(WorkflowCode, WorkflowCode, WorkflowCode, taskUrl);
                task.ActivityName = NodeCode.Start;
                task.ActionName   = SetTaskActionName(ProjectId);
                task.CreateTime   = DateTime.Now;

                if (!isScheduled)
                {
                    TaskWork.Add(task);
                }
                else
                {
                    var consInfoRepos = new MajorLeaseConsInfo();
                    var consInfo      = consInfoRepos.GetConsInfo(ProjectId);
                    //到达Cons Info中的工程完工时间后60天 发出任务
                    if (consInfo.ReinBasicInfo != null &&
                        consInfo.ReinBasicInfo.ConsCompletionDate.HasValue)
                    {
                        ScheduleLog.GenerateTaskSchedule(consInfo.ReinBasicInfo.ConsCompletionDate.Value.AddDays(60), task, ClientCookie.UserCode, ProjectId, WorkflowCode, majorLeaseInfo.USCode);
                    }
                }
            }
        }
Exemplo n.º 3
0
        public void GenerateReopenTask(string projectId)
        {
            var taskWork = new TaskWork();

            taskWork.SourceCode        = FlowCode.TempClosure;
            taskWork.SourceNameENUS    = taskWork.SourceCode;
            taskWork.SourceNameZHCN    = taskWork.SourceCode;
            taskWork.Status            = TaskWorkStatus.UnFinish;
            taskWork.StatusNameZHCN    = "任务";
            taskWork.StatusNameENUS    = "任务";
            taskWork.RefID             = projectId;
            taskWork.Id                = Guid.NewGuid();
            taskWork.CreateTime        = DateTime.Now;
            taskWork.CreateUserAccount = ClientCookie.UserCode;

            var tempClosure = TempClosureInfo.FirstOrDefault(i => i.ProjectId == projectId);

            if (tempClosure == null)
            {
                return;
            }

            taskWork.Title            = TaskWork.BuildTitle(projectId, tempClosure.StoreNameZHCN, tempClosure.StoreNameENUS);
            taskWork.TypeCode         = FlowCode.TempClosure_ReopenMemo;
            taskWork.TypeNameENUS     = "ReopenMemo";
            taskWork.TypeNameZHCN     = "ReopenMemo";
            taskWork.ReceiverAccount  = tempClosure.AssetActorAccount;
            taskWork.ReceiverNameENUS = tempClosure.AssetActorNameENUS;
            taskWork.ReceiverNameZHCN = tempClosure.AssetActorNameZHCN;
            taskWork.Url          = string.Format(@"/TempClosure/Main#/ReopenMemo?projectId={0}", projectId);
            taskWork.StoreCode    = tempClosure.USCode;
            taskWork.ActivityName = "Start";

            //Re-open Date 前7天发出任务
            ScheduleLog.GenerateTaskSchedule(tempClosure.ActualReopenDate.AddDays(-7), taskWork, ClientCookie.UserCode, projectId, FlowCode.TempClosure_ReopenMemo, tempClosure.USCode);
        }
Exemplo n.º 4
0
        public void GenerateClourseMemoTask(string projectId)
        {
            if (!TaskWork.Any(t => t.RefID == projectId && t.TypeCode == FlowCode.Closure_Memo))
            {
                var taskWork = new TaskWork();
                taskWork.SourceCode     = FlowCode.Closure;
                taskWork.SourceNameENUS = taskWork.SourceCode;
                taskWork.SourceNameZHCN = "关店流程";
                taskWork.Status         = TaskWorkStatus.UnFinish;
                taskWork.StatusNameZHCN = "任务";
                taskWork.StatusNameENUS = "任务";
                taskWork.RefID          = projectId;
                taskWork.Id             = Guid.NewGuid();
                taskWork.CreateTime     = DateTime.Now;

                var closureInfo = ClosureInfo.GetByProjectId(projectId);

                taskWork.Title            = TaskWork.BuildTitle(projectId, closureInfo.StoreNameZHCN, closureInfo.StoreNameENUS);
                taskWork.TypeCode         = FlowCode.Closure_Memo;
                taskWork.TypeNameENUS     = "Closure Memo";
                taskWork.TypeNameZHCN     = "Closure Memo";
                taskWork.ReceiverAccount  = closureInfo.AssetActorAccount;
                taskWork.ReceiverNameENUS = closureInfo.AssetActorNameENUS;
                taskWork.ReceiverNameZHCN = closureInfo.AssetActorNameZHCN;
                taskWork.Url          = string.Format(@"/Closure/Main#/ClosureMemo?projectId={0}", projectId);
                taskWork.ActivityName = "Start";
                taskWork.StoreCode    = closureInfo.USCode;

                //TaskWork.Add(taskWork);
                //关店前7天发起Memo流程
                if (closureInfo.ActualCloseDate.HasValue)
                {
                    ScheduleLog.GenerateTaskSchedule(closureInfo.ActualCloseDate.Value.AddDays(-7), taskWork, ClientCookie.UserCode, projectId, FlowCode.Closure_Memo, closureInfo.USCode);
                }
            }
        }
Exemplo n.º 5
0
        public override void Finish(TaskWorkStatus status, TaskWork task)
        {
            using (var scope = new TransactionScope())
            {
                switch (status)
                {
                case TaskWorkStatus.K2ProcessApproved:
                    var imgInfo = ReimageInfo.Search(e => e.ProjectId.Equals(ProjectId)).FirstOrDefault();
                    ProjectInfo.FinishNode(ProjectId, FlowCode.Reimage_GBMemo, NodeCode.Finish, ProjectStatus.Finished);
                    if (IsInOperation)
                    {
                        ProjectInfo.FinishNode(ProjectId, FlowCode.Reimage_ReopenMemo, NodeCode.Finish, ProjectStatus.Finished);
                        ProjectInfo.FinishNode(ProjectId, FlowCode.Reimage_TempClosureMemo, NodeCode.Finish, ProjectStatus.Finished);
                    }
                    else
                    {
                        var taskUrlReopen = string.Format(@"/Reimage/Main#/ReopenMemo?projectId={0}", ProjectId);
                        var taskReopen    = imgInfo.GenerateTaskWork(FlowCode.Reimage_ReopenMemo, "Reopen Memo", "Reopen Memo", taskUrlReopen);
                        taskReopen.ActivityName = NodeCode.Start;
                        taskReopen.ActionName   = SetTaskActionName(ProjectId);
                        //TaskWork.Add(taskReopen);
                        if (rmgInfo.ReopenDate.HasValue)
                        {
                            ScheduleLog.GenerateTaskSchedule(rmgInfo.ReopenDate.Value.AddDays(-7), taskReopen, ClientCookie.UserCode, ProjectId, FlowCode.Reimage_ReopenMemo, rmgInfo.USCode);
                        }
                        ProjectInfo.Reset(ProjectId, FlowCode.Reimage_ReopenMemo);

                        var taskUrlClosure = string.Format(@"/Reimage/Main#/TempClosureMemo?projectId={0}", ProjectId);
                        var taskClosure    = imgInfo.GenerateTaskWork(FlowCode.Reimage_TempClosureMemo, "TempClosure Memo", "TempClosure Memo", taskUrlClosure);
                        taskClosure.ActivityName = NodeCode.Start;
                        taskClosure.ActionName   = SetTaskActionName(ProjectId);
                        TaskWork.Add(taskClosure);
                        ProjectInfo.Reset(ProjectId, FlowCode.Reimage_TempClosureMemo);
                    }

                    var consCheckingTask = TaskWork.FirstOrDefault(e => e.RefID == ProjectId && e.TypeCode == FlowCode.Reimage_ConsInvtChecking && e.Status == TaskWorkStatus.UnFinish);
                    var checkingProj     = ProjectInfo.FirstOrDefault(e => e.ProjectId == ProjectId && e.FlowCode == FlowCode.Reimage_ConsInvtChecking);
                    if (consCheckingTask == null && checkingProj != null &&
                        checkingProj.Status != ProjectStatus.Finished)
                    {
                        var consInvtChecking = new ReimageConsInvtChecking();
                        consInvtChecking.ProjectId = task.RefID;
                        consInvtChecking.GenerateConsInvtCheckingTask(true);
                    }

                    ProjectInfo.CompleteMainIfEnable(ProjectId);
                    var pmTaskUrl = string.Format(@"/Reimage/Main#/GBMemo/Process/Notify?projectId={0}", ProjectId);
                    var pmTask    = imgInfo.GenerateTaskWork(WorkflowCode, "Reimage GBMemo", "Reimage GBMemo", pmTaskUrl);
                    pmTask.ActivityName = "Notify";
                    pmTask.ActionName   = "Notify";
                    TaskWork.Add(pmTask);

                    GenerateSiteInfoTask();
                    break;

                case TaskWorkStatus.K2ProcessDeclined:
                    ProjectInfo.UpdateProjectStatus(ProjectId, FlowCode.Reimage, ProjectStatus.Rejected);
                    ProjectInfo.UpdateProjectStatus(ProjectId, FlowCode.Reimage_GBMemo, ProjectStatus.Rejected);
                    break;
                }
                scope.Complete();
            }
        }
Exemplo n.º 6
0
        public void GenerateConsInvtCheckingTask(string projectId)
        {
            //if (!TaskWork.Any(t => t.RefID == projectId && t.TypeCode == FlowCode.Closure_ConsInvtChecking && t.Status == TaskWorkStatus.UnFinish))
            //{
            //    var taskWork = new TaskWork();
            //    taskWork.SourceCode = FlowCode.Closure;
            //    taskWork.SourceNameENUS = taskWork.SourceCode;
            //    taskWork.SourceNameZHCN = "对帐流程";
            //    taskWork.Status = TaskWorkStatus.UnFinish;
            //    taskWork.StatusNameZHCN = "任务";
            //    taskWork.StatusNameENUS = "任务";
            //    taskWork.RefID = projectId;
            //    taskWork.Id = Guid.NewGuid();
            //    taskWork.CreateTime = DateTime.Now;

            //    var closureInfo = ClosureInfo.GetByProjectId(projectId);

            //    taskWork.Title = TaskWork.BuildTitle(projectId, closureInfo.StoreNameZHCN, closureInfo.StoreNameENUS);
            //    taskWork.TypeCode = WorkflowCode;
            //    taskWork.TypeNameENUS = WorkflowCode;
            //    taskWork.TypeNameZHCN = WorkflowCode;
            //    taskWork.ReceiverAccount = closureInfo.PMAccount;
            //    taskWork.ReceiverNameENUS = closureInfo.PMNameENUS;
            //    taskWork.ReceiverNameZHCN = closureInfo.PMNameZHCN;
            //    taskWork.Url = string.Format(@"/Closure/Main#/ConsInvtChecking?projectId={0}", projectId);
            //    taskWork.StoreCode = closureInfo.USCode;
            //    taskWork.ActivityName = "Start";

            //    TaskWork.Add(taskWork);
            //}

            var taskWork = new TaskWork();

            taskWork.SourceCode     = FlowCode.Closure;
            taskWork.SourceNameENUS = taskWork.SourceCode;
            taskWork.SourceNameZHCN = "对帐流程";
            taskWork.Status         = TaskWorkStatus.UnFinish;
            taskWork.StatusNameZHCN = "任务";
            taskWork.StatusNameENUS = "任务";
            taskWork.RefID          = projectId;
            taskWork.Id             = Guid.NewGuid();
            taskWork.CreateTime     = DateTime.Now;

            var closureInfo = ClosureInfo.GetByProjectId(projectId);

            taskWork.Title            = TaskWork.BuildTitle(projectId, closureInfo.StoreNameZHCN, closureInfo.StoreNameENUS);
            taskWork.TypeCode         = WorkflowCode;
            taskWork.TypeNameENUS     = "ConsInvtChecking";
            taskWork.TypeNameZHCN     = "ConsInvtChecking";
            taskWork.ReceiverAccount  = closureInfo.PMAccount;
            taskWork.ReceiverNameENUS = closureInfo.PMNameENUS;
            taskWork.ReceiverNameZHCN = closureInfo.PMNameZHCN;
            taskWork.Url          = string.Format(@"/Closure/Main#/ConsInvtChecking?projectId={0}", projectId);
            taskWork.StoreCode    = closureInfo.USCode;
            taskWork.ActivityName = "Start";

            //关店后60天发起对账流程
            if (closureInfo.ActualCloseDate.HasValue)
            {
                ScheduleLog.GenerateTaskSchedule(closureInfo.ActualCloseDate.Value.AddDays(60), taskWork, ClientCookie.UserCode, projectId, WorkflowCode, closureInfo.USCode);
            }
        }