Esempio n. 1
0
        public async Task <Guid> InsertRegistration(ProjectWorkTask task, ProjectRegistration registration, List <GetAbpFilesOutput> files)
        {
            var taskId     = Guid.NewGuid();
            var instanceId = Guid.NewGuid();

            task.Id           = taskId;
            task.CreationTime = DateTime.Now;
            task.InstanceId   = instanceId;
            await _projectWorkTaskRepository.InsertAsync(task);

            registration.Id             = instanceId;
            registration.TaskId         = taskId;
            registration.RecieveUserId  = 0;
            registration.IsRead         = false;
            registration.IsSendEmail    = false;
            registration.IsSendSms      = false;
            registration.IsSendWx       = false;
            registration.IsSendDispatch = false;
            registration.CreationTime   = DateTime.Now;
            await _projectRegistrationRepository.InsertAsync(registration);

            var fileList = new List <AbpFileListInput>();

            foreach (var filemodel in files)
            {
                var fileone = new AbpFileListInput()
                {
                    Id = filemodel.Id, Sort = filemodel.Sort
                };
                fileList.Add(fileone);
            }

            await _abpFileRelationAppService.CreateAsync(new CreateFileRelationsInput()
            {
                BusinessId   = instanceId.ToString(),
                BusinessType = (int)AbpFileBusinessType.工作联系附件,
                Files        = fileList
            });

            return(instanceId);
        }
Esempio n. 2
0
        public async Task UpdateWorkSummaryAsync(UpdateWorkSummaryInput input)
        {
            var model = await _repository.GetAsync(input.Id);

            var fileList = new List <AbpFileListInput>();

            foreach (var item in input.Files)
            {
                var fileone = new AbpFileListInput()
                {
                    Id = item
                };
                fileList.Add(fileone);
            }

            _abpFileRelationAppService.Create(new CreateFileRelationsInput()
            {
                BusinessId   = input.Id.ToString(),
                BusinessType = (int)AbpFileBusinessType.转正业绩资料,
                Files        = fileList
            });
        }
Esempio n. 3
0
        public async Task WriteWorkLog(WorkLogInput input)
        {
            long userId = AbpSession.UserId.Value;


            if (input.StepId.HasValue)
            {
                var taskModel = await _workFlowTaskRepository.FirstOrDefaultAsync(r => r.InstanceID == input.ProjectId.Value.ToString() && r.StepID == input.StepId.Value);

                if (taskModel != null)
                {
                    input.StepName = taskModel.StepName;
                }
            }

            var logId = await _workTaskManager.InsertWorkLog(new ProjectWorkTask
            {
                UserId    = userId,
                ProjectId = input.ProjectId,
                Title     = string.Format("{0}-{1}", input.Title, input.WorkTime.ToString("yyyyMMdd")),
                StepId    = input.StepId,
                StepName  = input.StepName
            }, new ProjectWorkLog
            {
                UserId    = userId,
                ProjectId = input.ProjectId,
                Title     = string.Format("{0}-{1}", input.Title, input.WorkTime.ToString("yyyyMMdd")),
                Content   = input.Content,
                WorkTime  = input.WorkTime,
                LogType   = input.LogType,
                //Files = Newtonsoft.Json.JsonConvert.SerializeObject(input.Files),
                StepId   = input.StepId,
                StepName = input.StepName
            });


            var fileList = new List <AbpFileListInput>();

            foreach (var filemodel in input.Files)
            {
                var fileone = new AbpFileListInput()
                {
                    Id = filemodel.Id, Sort = filemodel.Sort
                };
                fileList.Add(fileone);
            }

            await _abpFileRelationAppService.CreateAsync(new CreateFileRelationsInput()
            {
                BusinessId   = logId.ToString(),
                BusinessType = (int)AbpFileBusinessType.工作底稿附件,
                Files        = fileList
            });

            var noticeService = Abp.AbpBootstrapper.Create <Abp.Modules.AbpModule>().IocManager.IocContainer.Resolve <IProjectNoticeAppService>();
            var noticeInput   = new NoticePublishInputForWorkSpaceInput();

            noticeInput.ProjectId = input.ProjectId.Value;
            noticeInput.Content   = $"发布工作底稿,详情在项目查询工作室查看";
            noticeInput.UserType  = 1;
            var projectName = from p in _singleProjectInfoRepository.GetAll()
                              where p.Id == input.ProjectId
                              select p.SingleProjectName;

            if (projectName.Any())
            {
                noticeInput.Title = $"项目:{projectName.FirstOrDefault()} 发布工作底稿";
                await noticeService.CreateProjectWorkSpaceNotice(noticeInput);

                await CurrentUnitOfWork.SaveChangesAsync();
            }
            else
            {
                throw new UserFriendlyException((int)ErrorCode.DataAccessErr, "获取项目数据异常");
            }
        }
Esempio n. 4
0
        private async Task UpdateAsync(CreateOrUpdateProjectResultInput input)
        {
            if (input.AuditAmount.HasValue == false || input.AuditAmount.Value <= 0)
            {
                throw new UserFriendlyException((int)ErrorCode.DataAccessErr, "审定金额不能为空或小于0.");
            }
            var entity = await _projectAuditMemberResultRepository.GetAsync(input.Id.Value);

            entity.AuditAmount = input.AuditAmount;
            entity.Remark      = input.Remark;
            var businessType1 = 0;
            var businessType2 = 0;

            if (input.AuditRoleId == (int)AuditRoleEnum.项目负责人)
            {
                businessType1 = (int)AbpFileBusinessType.项目负责人汇总CJZ结果;
                businessType2 = (int)AbpFileBusinessType.项目负责人汇总结果;
            }
            else if (input.AuditRoleId == (int)AuditRoleEnum.核人)
            {
                businessType1 = (int)AbpFileBusinessType.核CJZ结果;
                businessType2 = (int)AbpFileBusinessType.核结果;
            }
            else if (input.AuditRoleId == (int)AuditRoleEnum.财务评审)
            {
                businessType2 = (int)AbpFileBusinessType.财务评审;
            }
            else if (input.AuditRoleId == (int)AuditRoleEnum.财务初审)
            {
                businessType2 = (int)AbpFileBusinessType.财务初审;
            }
            else if (input.AuditRoleId == (int)AuditRoleEnum.核人二)
            {
                businessType1 = (int)AbpFileBusinessType.二级复核CJZ结果;
                businessType2 = (int)AbpFileBusinessType.二级复核结果;
            }
            else if (input.AuditRoleId == (int)AuditRoleEnum.核人三)
            {
                businessType1 = (int)AbpFileBusinessType.级复核CJZ结果;
                businessType2 = (int)AbpFileBusinessType.级复核结果;
                var singemodele = await _singleProjectInfoRepository.GetAsync(input.ProjectBaseId);

                singemodele.AuditAmount = input.AuditAmount;
            }
            else if (input.AuditRoleId == (int)AuditRoleEnum.联系人一)
            {
                businessType1 = (int)AbpFileBusinessType.联系人初审结果汇总CJZ;
                businessType2 = (int)AbpFileBusinessType.联系人初审结果汇总;
            }

            var cjzFileNews = new List <AbpFileListInput>();

            if (input.CjzFile != null)
            {
                cjzFileNews.Add(new AbpFileListInput()
                {
                    Id = input.CjzFile.Id, Sort = input.CjzFile.Sort
                });
            }
            await _abpFileRelationAppService.UpdateAsync(new CreateFileRelationsInput()
            {
                BusinessId   = entity.Id.ToString(),
                BusinessType = businessType1,
                Files        = cjzFileNews
            });

            var fileList = new List <AbpFileListInput>();

            foreach (var filemodel in input.Files)
            {
                var fileone = new AbpFileListInput()
                {
                    Id = filemodel.Id, Sort = filemodel.Sort
                };
                fileList.Add(fileone);
            }

            await _abpFileRelationAppService.UpdateAsync(new CreateFileRelationsInput()
            {
                BusinessId   = entity.Id.ToString(),
                BusinessType = businessType2,
                Files        = fileList
            });


            await _projectAuditMemberResultRepository.UpdateAsync(entity);
        }
Esempio n. 5
0
        private async Task <Guid> CreateAsync(CreateOrUpdateProjectResultInput input)
        {
            if (input.AuditAmount.HasValue == false || input.AuditAmount.Value <= 0)
            {
                throw new UserFriendlyException((int)ErrorCode.DataAccessErr, "审定金额不能为空或小于0.");
            }
            // var projectModel = _projectBaseRepository.GetAsync(input.ProjectBaseId);
            var memberModel = await _projectAuditMemberRepository.GetAll().FirstOrDefaultAsync(r => r.ProjectBaseId == input.ProjectBaseId && r.UserAuditRole == input.AuditRoleId && r.UserId == AbpSession.UserId.Value);

            if (memberModel == null)
            {
                throw new UserFriendlyException((int)ErrorCode.DataAccessErr, "评审人员数据异常");
            }
            var entity = new ProjectAuditMemberResult();

            entity.Id  = Guid.NewGuid();
            entity.Pid = memberModel.Id;

            entity.AuditAmount = input.AuditAmount;
            var businessType1 = 0;
            var businessType2 = 0;

            if (input.AuditRoleId == (int)AuditRoleEnum.项目负责人)
            {
                businessType1 = (int)AbpFileBusinessType.项目负责人汇总CJZ结果;
                businessType2 = (int)AbpFileBusinessType.项目负责人汇总结果;
            }
            else if (input.AuditRoleId == (int)AuditRoleEnum.核人)
            {
                businessType1 = (int)AbpFileBusinessType.核CJZ结果;
                businessType2 = (int)AbpFileBusinessType.核结果;
            }
            else if (input.AuditRoleId == (int)AuditRoleEnum.财务评审)
            {
                businessType2 = (int)AbpFileBusinessType.财务评审;
            }
            else if (input.AuditRoleId == (int)AuditRoleEnum.财务初审)
            {
                businessType2 = (int)AbpFileBusinessType.财务初审;
            }
            else if (input.AuditRoleId == (int)AuditRoleEnum.核人二)
            {
                businessType1 = (int)AbpFileBusinessType.二级复核CJZ结果;
                businessType2 = (int)AbpFileBusinessType.二级复核结果;
            }
            else if (input.AuditRoleId == (int)AuditRoleEnum.核人三)
            {
                businessType1 = (int)AbpFileBusinessType.级复核CJZ结果;
                businessType2 = (int)AbpFileBusinessType.级复核结果;
                var singemodele = await _singleProjectInfoRepository.GetAsync(input.ProjectBaseId);

                singemodele.AuditAmount = input.AuditAmount;
            }
            else if (input.AuditRoleId == (int)AuditRoleEnum.联系人一)
            {
                businessType1 = (int)AbpFileBusinessType.联系人初审结果汇总CJZ;
                businessType2 = (int)AbpFileBusinessType.联系人初审结果汇总;
            }
            if (input.CjzFile != null)
            {
                await _abpFileRelationAppService.CreateAsync(new CreateFileRelationsInput()
                {
                    BusinessId   = entity.Id.ToString(),
                    BusinessType = businessType1,
                    Files        = new List <AbpFileListInput>()
                    {
                        new AbpFileListInput()
                        {
                            Id = input.CjzFile.Id, Sort = input.CjzFile.Sort
                        }
                    }
                });
            }
            var fileList = new List <AbpFileListInput>();

            if (input.Files == null || input.Files.Count == 0)
            {
                throw new UserFriendlyException((int)ErrorCode.DataAccessErr, "请上传评审附件。");
            }
            foreach (var filemodel in input.Files)
            {
                var fileone = new AbpFileListInput()
                {
                    Id = filemodel.Id, Sort = filemodel.Sort
                };
                fileList.Add(fileone);
            }

            await _abpFileRelationAppService.CreateAsync(new CreateFileRelationsInput()
            {
                BusinessId   = entity.Id.ToString(),
                BusinessType = businessType2,
                Files        = fileList
            });

            //entity.Files = Newtonsoft.Json.JsonConvert.SerializeObject(input.Files);
            //entity.CJZFiles = Newtonsoft.Json.JsonConvert.SerializeObject(input.CjzFile);
            entity.Remark = input.Remark;
            await _projectAuditMemberResultRepository.InsertAsync(entity);

            return(entity.Id);
        }