Пример #1
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);
                    }
                }
            }
        }
Пример #2
0
        private bool CheckIfNeedGenerateConsInvtCheckingTask()
        {
            var isNeed = false;

            var consInfoRepos = new MajorLeaseConsInfo();
            var consInfo      = consInfoRepos.GetConsInfo(ProjectId);

            if (consInfo != null && consInfo.ReinvenstmentType == 3)
            {
                isNeed = true;
            }

            return(isNeed);
        }