Beispiel #1
0
        public async Task <SubProject> ChangeStageCode(SubProject subProject, TaskItemAssignment assignment)
        {
            if (subProject == null)
            {
                return(null);
            }
            // 如果完成就不做事情;如果subProject为空则返回
            if (subProject.IsFinished)
            {
                return(subProject);
            }
            // 修改状态码
            CurrentUnitOfWork.DisableFilter(AbpDataFilters.MayHaveTenant);
            var procedureStepTaskItem = _repositoryProcedureStepTaskItem.Get(assignment.ProcedureStepTaskItemId);
            var stageCodes            = subProject.StageCode.Split(SubProject.StageCodeSplitString);

            stageCodes[3 + procedureStepTaskItem.SortId] = ((int)TaskItemState.Finished).ToString();
            subProject.StageCode = LinkStageCode(stageCodes);
            // 插入状态表记录状态
            InsertStageLog(subProject, assignment);
            // 如果构件工序走完,则修改IsFinished=true
            if (IsSubProjectFinished(subProject))
            {
                subProject.IsFinished = true;
            }
            return(await Repository.UpdateAsync(subProject));
        }
Beispiel #2
0
        /// <summary>
        /// 插入状态改变表
        /// </summary>
        /// <param name="subProject"></param>
        /// <param name="assignment"></param>
        /// <exception cref="UserFriendlyException"></exception>
        public void InsertStageLog(SubProject subProject, TaskItemAssignment assignment = null)
        {
            subProject.Pedestal = _repositoryPedestal.GetAll().FirstOrDefault(v => v.SubProjectId == subProject.Id);
            var log = new SubProjectStageLog
            {
                StageCode    = subProject.StageCode,
                SubProjectId = subProject.Id,
            };

            // 没台座说明是新构件
            if (subProject.Pedestal != null)
            {
                log.PedestalId = subProject.Pedestal.Id;
            }
            // 有台座没任务,本操作是上存梁台
            if (assignment != null)
            {
                log.TaskItemAssignmentId = assignment.Id;
            }
            _repositoryStageLog.Insert(log);
        }