コード例 #1
0
        public async Task <InitWorkFlowOutput> Create(CreateCuringProcurementEditInput input)
        {
            var exit_Flag = _repository.GetAll().Any(r => r.MainId == input.MainId && r.Status != -1);

            if (exit_Flag)
            {
                throw new UserFriendlyException((int)ErrorCode.DataAccessErr, "存在未完成的固化采购整改");
            }
            var ret      = new InitWorkFlowOutput();
            var newmodel = new CuringProcurementEdit()
            {
                MainId         = input.MainId,
                Code           = input.Code,
                NeedMember     = input.NeedMember,
                Type           = input.Type,
                ExecuteSummary = input.ExecuteSummary,
                Remark         = input.Remark,
                Status         = input.Status
            };
            await _repository.InsertAsync(newmodel);

            foreach (var item in input.Plans)
            {
                var entity = item.MapTo <CuringProcurementPlan>();
                entity.Id           = Guid.NewGuid();
                entity.MainId       = newmodel.Id;
                entity.BusinessType = (int)CuringProcurementType.固化采购调整;
                _curingProcurementPlanRepository.Insert(entity);

                if (item.FileList != null)
                {
                    var fileList = new List <AbpFileListInput>();
                    foreach (var ite in item.FileList)
                    {
                        fileList.Add(new AbpFileListInput()
                        {
                            Id = ite.Id, Sort = ite.Sort
                        });
                    }
                    await _abpFileRelationAppService.UpdateAsync(new CreateFileRelationsInput()
                    {
                        BusinessId   = entity.Id.ToString(),
                        BusinessType = (int)AbpFileBusinessType.固化采购计划整改附件,
                        Files        = fileList
                    });
                }
            }
            ret.InStanceId = newmodel.Id.ToString();
            return(ret);
        }
コード例 #2
0
        public async Task Update(OATenderCashInputDto input)
        {
            var ret = _oaTenderCashRepository.Get(input.Id.Value);

            ret = input.MapTo(ret);
            var fileList = new List <AbpFileListInput>();

            if (input.FileList != null)
            {
                foreach (var item in input.FileList)
                {
                    fileList.Add(new AbpFileListInput()
                    {
                        Id = item.Id, Sort = item.Sort
                    });
                }
            }
            await _abpFileRelationAppService.UpdateAsync(new CreateFileRelationsInput()
            {
                BusinessId   = input.Id.ToString(),
                BusinessType = (int)AbpFileBusinessType.OA投标文件申请附件,
                Files        = fileList
            });

            _oaTenderCashRepository.Update(ret);
        }
コード例 #3
0
        public async Task Update(SupplyUpdateInput input)
        {
            var supply = await _supplyRepository.GetAsync(input.Id);

            input.MapTo(supply);
            var fileList = new List <AbpFileListInput>();

            if (input.FileList != null)
            {
                foreach (var item in input.FileList)
                {
                    fileList.Add(new AbpFileListInput()
                    {
                        Id = item.Id, Sort = item.Sort
                    });
                }
            }
            await _abpFileRelationAppService.UpdateAsync(new CreateFileRelationsInput()
            {
                BusinessId   = input.Id.ToString(),
                BusinessType = (int)AbpFileBusinessType.固定资产附件,
                Files        = fileList
            });

            await _supplyRepository.UpdateAsync(supply);
        }
コード例 #4
0
        public async Task Update(OABidSelfAuditUpdateInput input)
        {
            Debug.Assert(input.Id != null, "input Id should be set.");

            var oABidSelfAudit = await _oABidSelfAuditRepository.GetAsync(input.Id);

            input.MapTo(oABidSelfAudit);

            var fileList = new List <AbpFileListInput>();

            if (input.FileList != null)
            {
                foreach (var item in input.FileList)
                {
                    fileList.Add(new AbpFileListInput()
                    {
                        Id = item.Id, Sort = item.Sort
                    });
                }
            }

            await _abpFileRelationAppService.UpdateAsync(new CreateFileRelationsInput()
            {
                BusinessId   = input.Id.ToString(),
                BusinessType = (int)AbpFileBusinessType.OA投标资格自审申请附件,
                Files        = fileList
            });

            await _oABidSelfAuditRepository.UpdateAsync(oABidSelfAudit);
        }
コード例 #5
0
        /// <summary>
        /// 添加一个TrainUserExperience
        /// </summary>
        /// <param name="input">实体</param>
        /// <returns></returns>

        public async Task Create(CreateTrainUserExperienceInput input)
        {
            var dbmodel = await _repository.FirstOrDefaultAsync(x => x.TrainId == input.TrainId && x.Type == input.ExperienceType && x.UserId == AbpSession.UserId.Value);

            if (dbmodel != null)
            {
                dbmodel.Experience   = input.Experience;
                dbmodel.CreationTime = DateTime.Now;
                await _repository.UpdateAsync(dbmodel);

                var fileList = new List <AbpFileListInput>();
                if (input.FileList != null)
                {
                    foreach (var item in input.FileList)
                    {
                        fileList.Add(new AbpFileListInput()
                        {
                            Id = item.Id, Sort = item.Sort
                        });
                    }
                }
                await _abpFileRelationAppService.UpdateAsync(new CreateFileRelationsInput()
                {
                    BusinessId   = dbmodel.Id.ToString(),
                    BusinessType = (int)AbpFileBusinessType.培训心得,
                    Files        = fileList
                });

                return;
            }
            var id       = Guid.NewGuid();
            var newmodel = new TrainUserExperience()
            {
                Id         = id,
                UserId     = AbpSession.UserId.Value,
                TrainId    = input.TrainId,
                IsUse      = false,
                Type       = input.ExperienceType,
                Experience = input.Experience
            };
            await _repository.InsertAsync(newmodel);

            if (input.FileList != null)
            {
                var fileList = new List <AbpFileListInput>();
                foreach (var item in input.FileList)
                {
                    fileList.Add(new AbpFileListInput()
                    {
                        Id = item.Id, Sort = item.Sort
                    });
                }
                await _abpFileRelationAppService.CreateAsync(new CreateFileRelationsInput()
                {
                    BusinessId   = id.ToString(),
                    BusinessType = (int)AbpFileBusinessType.培训心得,
                    Files        = fileList
                });
            }
        }
コード例 #6
0
        public async Task Update(CreateSupplyRepairDto input)
        {
            var repair = _supplyRepairRepository.Get(input.Id.Value);
            repair.Des = input.Des;
            if (input.FileList != null)
            {
                var fileList = new List<AbpFileListInput>();
                foreach (var item in input.FileList)
                {
                    fileList.Add(new AbpFileListInput() { Id = item.Id, Sort = item.Sort });
                }
                await _abpFileRelationAppService.UpdateAsync(new CreateFileRelationsInput()
                {
                    BusinessId = repair.Id.ToString(),
                    BusinessType = (int)AbpFileBusinessType.申请用品维修附件,
                    Files = fileList
                });
            }
            repair.RepairEndTime = input.RepairEndTime;
            repair.CheckRemark = input.CheckRemark;
            repair.ScrapReason = input.ScrapReason;
            repair.RepairResult = input.RepairResult;

            await _supplyRepairRepository.UpdateAsync(repair);
        }
コード例 #7
0
        public async Task <InitWorkFlowOutput> Create(CreateCuringProcurementInput input)
        {
            var ret      = new InitWorkFlowOutput();
            var newmodel = new CuringProcurement()
            {
                Id             = Guid.NewGuid(),
                Code           = input.Code,
                NeedMember     = input.NeedMember,
                Type           = input.Type,
                ExecuteSummary = input.ExecuteSummary,
                Remark         = input.Remark,
            };
            await _repository.InsertAsync(newmodel);

            foreach (var item in input.Plans)
            {
                var entity = item.MapTo <CuringProcurementPlan>();
                entity.Id           = Guid.NewGuid();
                entity.MainId       = newmodel.Id;
                entity.BusinessType = (int)CuringProcurementType.固化采购;
                _curingProcurementPlanRepository.Insert(entity);
                if (item.FileList != null)
                {
                    var fileList = new List <AbpFileListInput>();
                    foreach (var ite in item.FileList)
                    {
                        fileList.Add(new AbpFileListInput()
                        {
                            Id = ite.Id, Sort = ite.Sort
                        });
                    }
                    await _abpFileRelationAppService.UpdateAsync(new CreateFileRelationsInput()
                    {
                        BusinessId   = entity.Id.ToString(),
                        BusinessType = (int)AbpFileBusinessType.固化采购计划附件,
                        Files        = fileList
                    });
                }
            }


            ret.InStanceId = newmodel.Id.ToString();
            return(ret);
        }
コード例 #8
0
        public async Task Update(UpdateCWGLoanInput input)
        {
            if (input.Id != Guid.Empty)
            {
                var dbmodel = await _repository.FirstOrDefaultAsync(x => x.Id == input.Id);

                if (dbmodel == null)
                {
                    throw new UserFriendlyException((int)ErrorCode.DataAccessErr, "该数据不存在。");
                }
                var logModel = new CWGLoan();
                if (input.IsUpdateForChange)
                {
                    logModel = dbmodel.DeepClone <CWGLoan>();
                }
                dbmodel.Money            = input.Money;
                dbmodel.Remark           = input.Remark;
                input.FACData.BusinessId = input.Id.ToString();
                await _repository.UpdateAsync(dbmodel);

                var fileList = new List <AbpFileListInput>();
                if (input.FileList != null)
                {
                    foreach (var item in input.FileList)
                    {
                        fileList.Add(new AbpFileListInput()
                        {
                            Id = item.Id, Sort = item.Sort
                        });
                    }
                }
                await _abpFileRelationAppService.UpdateAsync(new CreateFileRelationsInput()
                {
                    BusinessId   = input.Id.ToString(),
                    BusinessType = (int)AbpFileBusinessType.贷款申请,
                    Files        = fileList
                });

                var groupId = Guid.NewGuid();
                input.FACData.GroupId = groupId;
                if (input.IsUpdateForChange)
                {
                    var flowModel = _workFlowCacheManager.GetWorkFlowModelFromCache(input.FlowId);
                    if (flowModel == null)
                    {
                        throw new UserFriendlyException((int)ErrorCode.DataAccessErr, "流程不存在");
                    }
                    var logs = GetChangeModel(logModel).GetColumnAllLogs(GetChangeModel(dbmodel));
                    await _projectAuditManager.InsertAsync(logs, input.Id.ToString(), flowModel.TitleField.Table, groupId);
                }
            }
            else
            {
                throw new UserFriendlyException((int)ErrorCode.DataAccessErr, "该数据不存在。");
            }
        }
コード例 #9
0
        /// <summary>
        /// 修改一个LegalAdviser
        /// </summary>
        /// <param name="input">实体</param>
        /// <returns></returns>
        public async Task Update(UpdateLegalAdviserInput input)
        {
            if (input.Id != Guid.Empty)
            {
                var dbmodel = await _repository.FirstOrDefaultAsync(x => x.Id == input.Id);

                if (dbmodel == null)
                {
                    throw new UserFriendlyException((int)ErrorCode.DataAccessErr, "该数据不存在。");
                }
                //dbmodel.UserId = input.UserId;
                dbmodel.Name        = input.Name;
                dbmodel.Function    = input.Function;
                dbmodel.ScaleNum    = input.ScaleNum;
                dbmodel.Address     = input.Address;
                dbmodel.Head        = input.Head;
                dbmodel.Tel         = input.Tel;
                dbmodel.BankNum     = input.BankNum;
                dbmodel.BankName    = input.BankName;
                dbmodel.BankDeposit = input.BankDeposit;

                await _repository.UpdateAsync(dbmodel);

                var userModel = await _userRepository.GetAsync(dbmodel.UserId);

                userModel.Name         = input.Name;
                userModel.PhoneNumber  = input.Tel;
                userModel.EmailAddress = input.EmailAddress;


                var fileList = new List <AbpFileListInput>();
                if (input.FileList != null)
                {
                    foreach (var item in input.FileList)
                    {
                        fileList.Add(new AbpFileListInput()
                        {
                            Id = item.Id, Sort = item.Sort
                        });
                    }
                }
                await _abpFileRelationAppService.UpdateAsync(new CreateFileRelationsInput()
                {
                    BusinessId   = input.Id.ToString(),
                    BusinessType = (int)AbpFileBusinessType.人力资源法律顾问合同,
                    Files        = fileList
                });
            }
            else
            {
                throw new UserFriendlyException((int)ErrorCode.DataAccessErr, "该数据不存在。");
            }
        }
コード例 #10
0
        /// <summary>
        /// 修改一个SupplySupplier
        /// </summary>
        /// <param name="input">实体</param>
        /// <returns></returns>
        public async Task Update(SupplySupplierUpdateInput input)
        {
            if (input.Id != Guid.Empty)
            {
                var dbmodel = await _repository.FirstOrDefaultAsync(x => x.Id == input.Id);

                if (dbmodel == null)
                {
                    throw new UserFriendlyException((int)ErrorCode.DataAccessErr, "该数据不存在。");
                }
                if (_repository.GetAll().Any(x => x.Name == input.Name && x.Id != input.Id))
                {
                    throw new UserFriendlyException((int)ErrorCode.DataAccessErr, "该供应商已存在。");
                }
                dbmodel.Type            = input.Type;
                dbmodel.Name            = input.Name;
                dbmodel.MainBusiness    = input.MainBusiness;
                dbmodel.Address         = input.Address;
                dbmodel.LegalPerson     = input.LegalPerson;
                dbmodel.LegalPersonTel  = input.LegalPersonTel;
                dbmodel.SalesContact    = input.SalesContact;
                dbmodel.SalesContactTel = input.SalesContactTel;
                dbmodel.Remark          = input.Remark;
                dbmodel.Email           = input.Email;
                var fileList = new List <AbpFileListInput>();
                if (input.FileList != null)
                {
                    foreach (var item in input.FileList)
                    {
                        fileList.Add(new AbpFileListInput()
                        {
                            Id = item.Id, Sort = item.Sort
                        });
                    }
                }
                await _abpFileRelationAppService.UpdateAsync(new CreateFileRelationsInput()
                {
                    BusinessId   = input.Id.ToString(),
                    BusinessType = (int)AbpFileBusinessType.供应商合同,
                    Files        = fileList
                });

                await _repository.UpdateAsync(dbmodel);
            }
            else
            {
                throw new UserFriendlyException((int)ErrorCode.DataAccessErr, "该数据不存在。");
            }
        }
コード例 #11
0
        public async Task Update(OAMeetingUpdateInput input)
        {
            Debug.Assert(input.Id != null, "input Id should be set.");

            var oAMeeting = await _oAMeetingRepository.GetAsync(input.Id);

            input.MapTo(oAMeeting);
            var fileList = new List <AbpFileListInput>();

            if (input.FileList != null)
            {
                foreach (var item in input.FileList)
                {
                    fileList.Add(new AbpFileListInput()
                    {
                        Id = item.Id, Sort = item.Sort
                    });
                }
            }
            await _abpFileRelationAppService.UpdateAsync(new CreateFileRelationsInput()
            {
                BusinessId   = input.Id.ToString(),
                BusinessType = (int)AbpFileBusinessType.OA会议附件,
                Files        = fileList
            });


            var userHostInfo = await UserManager.GetUserByIdAsync(input.HostUser);

            var notuser = await UserManager.GetUserByIdAsync(input.NoteUser);

            await _oAMeetingUserRepository.DeleteAsync(r => r.OAMeetingId == oAMeeting.Id);

            var manager = Abp.AbpBootstrapper.Create <Abp.Modules.AbpModule>().IocManager.IocContainer.Resolve <WorkFlowOrganizationUnitsManager>();
            var users   = manager.GetAllUsers(input.ParticipateUser);

            foreach (var user in users)
            {
                var entity = new OAMeetingUser();
                entity.Id          = Guid.NewGuid();
                entity.OAMeetingId = oAMeeting.Id;
                entity.UserId      = user.Id;
                await _oAMeetingUserRepository.InsertAsync(entity);
            }
            oAMeeting.NotifyUsers = oAMeeting.ParticipateUser + ",u_" + userHostInfo.Id + ",u_" + notuser.Id;

            await _oAMeetingRepository.UpdateAsync(oAMeeting);
        }
コード例 #12
0
        /// <summary>
        /// 修改一个XZGLMoney
        /// </summary>
        /// <param name="input">实体</param>
        /// <returns></returns>
        public async Task Update(UpdateXZGLMoneyInput input)
        {
            if (input.Id != Guid.Empty)
            {
                var dbmodel = await _repository.FirstOrDefaultAsync(x => x.Id == input.Id);

                if (dbmodel == null)
                {
                    throw new UserFriendlyException((int)ErrorCode.CodeValErr, "该数据不存在!");
                }
                var type = _dictionaryRepository.GetAll().FirstOrDefault(x => !x.IsDeleted && x.Id == input.Type);
                dbmodel.TypeName  = type?.Title;
                dbmodel.Type      = input.Type;
                dbmodel.Name      = input.Name;
                dbmodel.Money     = input.Money;
                dbmodel.MoneyTime = input.MoneyTime;
                dbmodel.Remark    = input.Remark;
                dbmodel.UserId    = input.UserId;
                if (input.MoneyTime != null && dbmodel.Status == Enums.XZGLPropertyStatus.未缴)
                {
                    dbmodel.Status = Enums.XZGLPropertyStatus.已缴;
                }

                await _repository.UpdateAsync(dbmodel);

                var fileList = new List <AbpFileListInput>();
                if (input.FileList != null)
                {
                    foreach (var item in input.FileList)
                    {
                        fileList.Add(new AbpFileListInput()
                        {
                            Id = item.Id, Sort = item.Sort
                        });
                    }
                }
                await _abpFileRelationAppService.UpdateAsync(new CreateFileRelationsInput()
                {
                    BusinessId   = input.Id.ToString(),
                    BusinessType = (int)AbpFileBusinessType.费用管理,
                    Files        = fileList
                });
            }
            else
            {
                throw new UserFriendlyException((int)ErrorCode.CodeValErr, "该数据不存在!");
            }
        }
コード例 #13
0
        /// <summary>
        /// 修改一个Lecturer
        /// </summary>
        /// <param name="input">实体</param>
        /// <returns></returns>
        public async Task Update(UpdateLecturerInput input)
        {
            if (input.Id != Guid.Empty)
            {
                var dbmodel = await _repository.FirstOrDefaultAsync(x => x.Id == input.Id);

                if (dbmodel == null)
                {
                    throw new UserFriendlyException((int)ErrorCode.CodeValErr, "该数据不存在!");
                }

                dbmodel.Name         = input.Name;
                dbmodel.TeachSubsidy = input.TeachSubsidy;
                dbmodel.Tel          = input.Tel;
                dbmodel.Email        = input.Email;
                dbmodel.BankId       = input.BankId;
                dbmodel.Bank         = input.Bank;
                dbmodel.OpenBank     = input.OpenBank;
                dbmodel.Introduction = input.Introduction;

                await _repository.UpdateAsync(dbmodel);

                var fileList = new List <AbpFileListInput>();
                if (input.FileList != null)
                {
                    foreach (var item in input.FileList)
                    {
                        fileList.Add(new AbpFileListInput()
                        {
                            Id = item.Id, Sort = item.Sort
                        });
                    }
                }
                await _abpFileRelationAppService.UpdateAsync(new CreateFileRelationsInput()
                {
                    BusinessId   = input.Id.ToString(),
                    BusinessType = (int)AbpFileBusinessType.提案附件,
                    Files        = fileList
                });
            }
            else
            {
                throw new UserFriendlyException((int)ErrorCode.CodeValErr, "该数据不存在!");
            }
        }
コード例 #14
0
        /// <summary>
        /// 修改一个MeetingUserBeforeTask
        /// </summary>
        /// <param name="input">实体</param>
        /// <returns></returns>
        public async Task Update(UpdateMeetingUserBeforeTaskInput input)
        {
            var model = await _repository.GetAsync(input.InStanceId);

            if (model.TaskType == 1 || model.TaskType == 3 || model.TaskType == 5 || model.TaskType == 7)
            {
            }
            if (model.TaskType == 2 || model.TaskType == 3 || model.TaskType == 6 || model.TaskType == 7)
            {
                var updateFiles = input.FileList.Where(r => r.Id.HasValue);
                foreach (var item in updateFiles)
                {
                    var updateFileModel = await _meetingFileRepository.GetAsync(item.Id.Value);

                    updateFileModel.FileName = item.Name;
                    updateFileModel.UserId   = item.UserId;
                    var fileList = new List <AbpFileListInput>();
                    foreach (var entity in item.FileList)
                    {
                        fileList.Add(new AbpFileListInput()
                        {
                            Id = entity.Id, Sort = entity.Sort
                        });
                    }
                    await _abpFileRelationAppService.UpdateAsync(new CreateFileRelationsInput()
                    {
                        BusinessId   = item.Id.Value.ToString(),
                        BusinessType = (int)AbpFileBusinessType.会议资料,
                        Files        = fileList
                    });
                }
            }
            if (model.TaskType == 4 || model.TaskType == 6 || model.TaskType == 7)
            {
                var updateLogs = input.LogList.Where(r => r.Id.HasValue);
                foreach (var item in updateLogs)
                {
                    var updateLogModel = await _meetingLogisticsRelationRepository.GetAsync(item.Id.Value);

                    updateLogModel.Remark = item.Remark;
                    updateLogModel.UserId = item.UserId;
                }
            }
        }
コード例 #15
0
        /// <summary>
        /// 修改一个CWGLCredential
        /// </summary>
        /// <param name="input">实体</param>
        /// <returns></returns>
        public async Task Update(UpdateCWGLCredentialInput input)
        {
            if (input.Id != Guid.Empty)
            {
                var dbmodel = await _repository.FirstOrDefaultAsync(x => x.Id == input.Id);

                if (dbmodel == null)
                {
                    throw new UserFriendlyException((int)ErrorCode.DataAccessErr, "该数据不存在。");
                }
                dbmodel.Name         = input.Name;
                dbmodel.Cause        = input.Cause;
                dbmodel.Money        = input.Money;
                dbmodel.Mode         = input.Mode;
                dbmodel.BankName     = input.BankName;
                dbmodel.CardNumber   = input.CardNumber;
                dbmodel.BankOpenName = input.BankOpenName;
                dbmodel.Nummber      = input.Nummber;

                await _repository.UpdateAsync(dbmodel);

                var fileList = new List <AbpFileListInput>();
                if (input.FileList != null)
                {
                    foreach (var item in input.FileList)
                    {
                        fileList.Add(new AbpFileListInput()
                        {
                            Id = item.Id, Sort = item.Sort
                        });
                    }
                }
                await _abpFileRelationAppService.UpdateAsync(new CreateFileRelationsInput()
                {
                    BusinessId   = input.Id.ToString(),
                    BusinessType = (int)AbpFileBusinessType.凭据,
                    Files        = fileList
                });
            }
            else
            {
                throw new UserFriendlyException((int)ErrorCode.DataAccessErr, "该数据不存在。");
            }
        }
コード例 #16
0
        /// <summary>
        /// 修改一个QuestionLibrary
        /// </summary>
        /// <param name="input">实体</param>
        /// <returns></returns>
        public async Task Update(UpdateQuestionLibraryInput input)
        {
            if (input.Id != Guid.Empty)
            {
                var dbmodel = await _repository.FirstOrDefaultAsync(x => x.Id == input.Id);

                if (dbmodel == null)
                {
                    throw new UserFriendlyException((int)ErrorCode.DataAccessErr, "该数据不存在。");
                }
                if (_repository.GetAll().Any(x => x.Title == input.Title && x.Id != input.Id))
                {
                    throw new UserFriendlyException((int)ErrorCode.DataAccessErr, "该题库已存在。");
                }

                dbmodel.Title  = input.Title;
                dbmodel.TypeId = input.TypeId;
                dbmodel.Remark = input.Remark;
                var fileList = new List <AbpFileListInput>();
                if (input.FileList != null)
                {
                    foreach (var item in input.FileList)
                    {
                        fileList.Add(new AbpFileListInput()
                        {
                            Id = item.Id, Sort = item.Sort
                        });
                    }
                }
                await _abpFileRelationAppService.UpdateAsync(new CreateFileRelationsInput()
                {
                    BusinessId   = input.Id.ToString(),
                    BusinessType = (int)AbpFileBusinessType.人力资源题库,
                    Files        = fileList
                });

                await _repository.UpdateAsync(dbmodel);
            }
            else
            {
                throw new UserFriendlyException((int)ErrorCode.DataAccessErr, "该数据不存在。");
            }
        }
コード例 #17
0
        public async Task Update(OATaskUpdateInput input)
        {
            Debug.Assert(input.Id != null, "input Id should be set.");

            var oATask = await _oATaskRepository.GetAsync(input.Id);

            input.MapTo(oATask);
            var fileList = new List <AbpFileListInput>();

            if (input.FileList != null)
            {
                foreach (var item in input.FileList)
                {
                    fileList.Add(new AbpFileListInput()
                    {
                        Id = item.Id, Sort = item.Sort
                    });
                }
            }
            await _abpFileRelationAppService.UpdateAsync(new CreateFileRelationsInput()
            {
                BusinessId   = input.Id.ToString(),
                BusinessType = (int)AbpFileBusinessType.OA任务附件,
                Files        = fileList
            });

            var manager = Abp.AbpBootstrapper.Create <Abp.Modules.AbpModule>().IocManager.IocContainer.Resolve <WorkFlowOrganizationUnitsManager>();
            var users   = manager.GetAllUsers(input.ExecutorUser);
            await _oATaskUserRepository.DeleteAsync(r => r.OATaskId == input.Id);

            foreach (var item in users)
            {
                var entity = new OATaskUser();
                entity.Id       = Guid.NewGuid();
                entity.OATaskId = input.Id;
                entity.UserId   = item.Id;
                await _oATaskUserRepository.InsertAsync(entity);
            }
            oATask.ValUser1    = "u_" + oATask.ValUser;
            oATask.NotifyUsers = oATask.ExecutorUser + ",u_" + oATask.ValUser;
            await _oATaskRepository.UpdateAsync(oATask);
        }
コード例 #18
0
        public async Task Update(OAFixedAssetsPurchaseUpdateInput input)
        {
            Debug.Assert(input.Id != null, "input Id should be set.");

            var oAFixedAssetsPurchase = await _oAFixedAssetsPurchaseRepository.GetAsync(input.Id);

            input.MapTo(oAFixedAssetsPurchase);
            var fileList = new List <AbpFileListInput>();

            if (input.FileList != null)
            {
                foreach (var item in input.FileList)
                {
                    fileList.Add(new AbpFileListInput()
                    {
                        Id = item.Id, Sort = item.Sort
                    });
                }
            }
            await _abpFileRelationAppService.UpdateAsync(new CreateFileRelationsInput()
            {
                BusinessId   = input.Id.ToString(),
                BusinessType = (int)AbpFileBusinessType.固定资产采购申请附件,
                Files        = fileList
            });

            await _oAFixedAssetsPurchaseRepository.UpdateAsync(oAFixedAssetsPurchase);

            var oAFixedAssets = _oAFixedAssetsRepository.GetAll().Where(r => r.PurchaseId == input.Id);
            await oAFixedAssets.ForEachAsync(r => _oAFixedAssetsRepository.Delete(r));

            foreach (var item in input.FixedAssetss)
            {
                var entity = item.MapTo <OAFixedAssets>();
                entity.Id                = Guid.NewGuid();
                entity.PurchaseId        = input.Id;
                entity.PostingDate       = DateTime.Now;
                entity.BuyDate           = DateTime.Now;
                entity.DateOfManufacture = DateTime.Now;
                await _oAFixedAssetsRepository.InsertAsync(entity);
            }
        }
コード例 #19
0
        public async Task Update(OAContractUpdateInput input)
        {
            Debug.Assert(input.Id != null, "input Id should be set.");

            var oAContract = await _oAContractRepository.GetAsync(input.Id);

            input.MapTo(oAContract);

            var fileList = new List <AbpFileListInput>();

            if (input.FileList != null)
            {
                foreach (var item in input.FileList)
                {
                    fileList.Add(new AbpFileListInput()
                    {
                        Id = item.Id, Sort = item.Sort
                    });
                }
            }
            await _abpFileRelationAppService.UpdateAsync(new CreateFileRelationsInput()
            {
                BusinessId   = input.Id.ToString(),
                BusinessType = (int)AbpFileBusinessType.OA合同附件,
                Files        = fileList
            });



            await _oAContractRepository.UpdateAsync(oAContract);

            var customer = await _oaCustomerRepository.FirstOrDefaultAsync(r => r.OAContractId == input.Id);

            if (customer != null)
            {
                customer.Name    = input.UnitA;
                customer.Phone   = input.UnitAContractTel;
                customer.Address = input.UnitAContractAddress;
                customer.Contact = input.UnitAContract;
            }
            await _oaCustomerRepository.UpdateAsync(customer);
        }
コード例 #20
0
 /// <summary>
 /// 更新员工档案信息
 /// </summary>
 /// <param name="input"></param>
 /// <returns></returns>
 public async Task Update(EmployeeDocmentFileInput input)
 {
     if (input.FileList != null)
     {
         var fileList = new List <AbpFileListInput>();
         foreach (var ite in input.FileList)
         {
             fileList.Add(new AbpFileListInput()
             {
                 Id = ite.Id, Sort = ite.Sort
             });
         }
         await _abpFileRelationAppService.UpdateAsync(new CreateFileRelationsInput()
         {
             BusinessId   = input.BusinessId.ToString(),
             BusinessType = (int)input.Type,
             Files        = fileList
         });
     }
 }
コード例 #21
0
        /// <summary>
        /// 修改一个ProjectFileAdditional
        /// </summary>
        /// <param name="input">实体</param>
        /// <returns></returns>
        public async Task Update(UpdateProjectFileAdditionalInput input)
        {
            if (input.Id != Guid.Empty)
            {
                var dbmodel = await _repository.FirstOrDefaultAsync(x => x.Id == input.Id);

                if (dbmodel == null)
                {
                    throw new UserFriendlyException((int)ErrorCode.DataAccessErr, "该数据不存在。");
                }
                dbmodel.FileTypeName    = input.FileTypeName;
                dbmodel.ProjectBaseId   = input.ProjectBaseId;
                dbmodel.PaperFileNumber = input.PaperFileNumber;
                dbmodel.IsPaperFile     = input.IsPaperFile;
                dbmodel.IsNeedReturn    = input.IsNeedReturn;
                var fileList = new List <AbpFileListInput>();
                if (input.FileList != null)
                {
                    foreach (var item in input.FileList)
                    {
                        fileList.Add(new AbpFileListInput()
                        {
                            Id = item.Id, Sort = item.Sort
                        });
                    }
                }
                await _abpFileRelationAppService.UpdateAsync(new CreateFileRelationsInput()
                {
                    BusinessId   = input.Id.ToString(),
                    BusinessType = (int)AbpFileBusinessType.补充资料附件,
                    Files        = fileList
                });

                await _repository.UpdateAsync(dbmodel);
            }
            else
            {
                throw new UserFriendlyException((int)ErrorCode.DataAccessErr, "该数据不存在。");
            }
        }
コード例 #22
0
        /// <summary>
        /// 修改一个MeetingUser
        /// </summary>
        /// <param name="input">实体</param>
        /// <returns></returns>
        public async Task Update(UpdateMeetingUserInput input)
        {
            if (input.InStanceId != Guid.Empty)
            {
                var dbmodel = await _repository.FirstOrDefaultAsync(x => x.Id == input.InStanceId);

                if (dbmodel == null)
                {
                    throw new UserFriendlyException((int)ErrorCode.CodeValErr, "该数据不存在!");
                }
                dbmodel.ReturnReceiptStatus = input.ReturnReceiptStatus;
                if (input.ReturnReceiptStatus == ReturnReceiptStatus.确定参会)
                {
                    dbmodel.ConfirmData = DateTime.Now;
                }
                else if (input.ReturnReceiptStatus == ReturnReceiptStatus.申请请假)
                {
                    dbmodel.AskForLeaveRemark = input.AskForLeaveRemark;
                    var fileList = new List <AbpFileListInput>();
                    foreach (var entity in input.FileList)
                    {
                        fileList.Add(new AbpFileListInput()
                        {
                            Id = entity.Id, Sort = entity.Sort
                        });
                    }
                    await _abpFileRelationAppService.UpdateAsync(new CreateFileRelationsInput()
                    {
                        BusinessId   = dbmodel.Id.ToString(),
                        BusinessType = (int)AbpFileBusinessType.会议请假申请附件,
                        Files        = fileList
                    });
                }
                await _repository.UpdateAsync(dbmodel);
            }
            else
            {
                throw new UserFriendlyException((int)ErrorCode.CodeValErr, "该数据不存在!");
            }
        }
コード例 #23
0
        /// <summary>
        /// 更新归档申请
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        public async Task Update(UpdateDocmentInput input)
        {
            var model     = _docmentRepository.Get(input.Id);
            var old_Model = model.DeepClone();

            model = input.MapTo(model);
            if (input.FileList != null)
            {
                var fileList = new List <AbpFileListInput>();
                foreach (var ite in input.FileList)
                {
                    fileList.Add(new AbpFileListInput()
                    {
                        Id = ite.Id, Sort = ite.Sort
                    });
                }
                await _abpFileRelationAppService.UpdateAsync(new CreateFileRelationsInput()
                {
                    BusinessId   = model.Id.ToString(),
                    BusinessType = (int)AbpFileBusinessType.档案附件,
                    Files        = fileList
                });
            }
            await _docmentRepository.UpdateAsync(model);

            if (input.IsUpdateForChange)
            {
                var flowModel = _workFlowCacheManager.GetWorkFlowModelFromCache(input.FlowId);
                if (flowModel == null)
                {
                    throw new UserFriendlyException((int)ErrorCode.DataAccessErr, "流程不存在");
                }
                var logs = GetChangeModel(old_Model).GetColumnAllLogs(GetChangeModel(model));
                await _projectAuditManager.InsertAsync(logs, input.Id.ToString(), flowModel.TitleField.Table);
            }
        }
コード例 #24
0
        /// <summary>
        /// 修改一个XZGLCarBorrow
        /// </summary>
        /// <param name="input">实体</param>
        /// <returns></returns>
        public async Task Update(UpdateXZGLCarBorrowInput input)
        {
            if (input.InStanceId != Guid.Empty)
            {
                var dbmodel = _repository.FirstOrDefault(x => x.Id == input.InStanceId);
                if (dbmodel == null)
                {
                    throw new UserFriendlyException((int)ErrorCode.CodeValErr, "该数据不存在!");
                }
                var logModel = new XZGLCarBorrowLogDto();
                if (input.IsUpdateForChange)
                {
                    logModel             = dbmodel.MapTo <XZGLCarBorrowLogDto>();
                    logModel.CarTypeName = dbmodel.CarType.ToString();
                    logModel.CarUser     = _carUserRepository.GetAll().Where(x => x.CarBorrowId == dbmodel.Id).Select(x => new XZGLCarUserLogDto()
                    {
                        Id       = x.Id,
                        Name     = x.Name,
                        Address  = x.Address,
                        Tel      = x.Tel,
                        CarMoney = x.CarMoney,
                        OrderNum = x.OrderNum,
                        CarType  = x.CarType,
                        CarNum   = x.CarNum
                    }).ToList();
                    logModel.CarInfo = (from a in _carInfoRepository.GetAll()
                                        join b in _usersRepository.GetAll() on a.UserId equals b.Id
                                        where a.CarBorrowId == dbmodel.Id
                                        select new XZGLCarInfoLogDto()
                    {
                        Id = a.CarNum,
                        UserName = b.Name,
                        CarNum = a.CarNum,
                    }).ToList();
                    var carUserInfo = _carUserInfoRepository.FirstOrDefault(x => x.CarBorrowId == dbmodel.Id);
                    if (carUserInfo != null)
                    {
                        logModel.CarUserInfo = carUserInfo.MapTo <XZGLCarUserInfoLogDto>();
                    }
                    logModel.Workouts = input.OldWorkouts;
                }
                dbmodel.UserId          = input.UserId;
                dbmodel.Tel             = input.Tel;
                dbmodel.StartTime       = input.StartTime;
                dbmodel.EndTime         = input.EndTime;
                dbmodel.CarType         = input.CarType;
                dbmodel.Note            = input.Note;
                dbmodel.Remark          = input.Remark;
                dbmodel.CompanyRemark   = input.CompanyRemark;
                dbmodel.SupplierId      = input.SupplierId;
                dbmodel.SupplierTel     = input.SupplierTel;
                dbmodel.SupplierRemark  = input.SupplierRemark;
                dbmodel.CarRemark       = input.CarRemark;
                dbmodel.Consumption     = input.Consumption;
                dbmodel.CarReturnRemark = input.CarReturnRemark;
                dbmodel.OtherRemark     = input.OtherRemark;
                dbmodel.UserCarRemark   = input.UserCarRemark;
                dbmodel.IsCompanyCar    = input.IsCompanyCar;
                dbmodel.IsCompanyRent   = input.IsCompanyRent;
                dbmodel.IsUserRent      = input.IsUserRent;
                await UpdateCarInfo(dbmodel.Id, input.CarInfo);
                await UpdateCarUser(dbmodel.Id, input.CarUser);
                await UpdateCarUserInfo(dbmodel.Id, input.CarUserInfo);
                await UpdateCarWorkOut(dbmodel.Id, input.RelationWorkOut);

                _repository.Update(dbmodel);

                var fileList = new List <AbpFileListInput>();
                if (input.FileList != null)
                {
                    foreach (var item in input.FileList)
                    {
                        fileList.Add(new AbpFileListInput()
                        {
                            Id = item.Id, Sort = item.Sort
                        });
                    }
                }
                await _abpFileRelationAppService.UpdateAsync(new CreateFileRelationsInput()
                {
                    BusinessId   = dbmodel.Id.ToString(),
                    BusinessType = (int)AbpFileBusinessType.用车,
                    Files        = fileList
                });

                if (input.IsUpdateForChange)
                {
                    var new_Model = dbmodel.MapTo <XZGLCarBorrowLogDto>();
                    new_Model.CarTypeName = input.CarType.ToString();
                    new_Model.CarUser     = input.CarUser.Select(x => new XZGLCarUserLogDto()
                    {
                        Id       = x.Id,
                        Name     = x.Name,
                        Address  = x.Address,
                        Tel      = x.Tel,
                        CarMoney = x.CarMoney,
                        OrderNum = x.OrderNum,
                        CarType  = x.CarType,
                        CarNum   = x.CarNum
                    }).ToList();
                    new_Model.Workouts = input.NewWorkouts;
                    new_Model.CarInfo  = (from a in input.CarInfo
                                          join b in _usersRepository.GetAll() on a.UserId equals b.Id
                                          join c in _carRepository.GetAll() on a.CarId equals c.Id
                                          select new XZGLCarInfoLogDto()
                    {
                        Id = c.CarNum,
                        UserName = b.Name,
                        CarNum = c.CarNum,
                    }).ToList();
                    var carUserInfo = input.CarUserInfo;
                    if (carUserInfo != null)
                    {
                        new_Model.CarUserInfo = carUserInfo.MapTo <XZGLCarUserInfoLogDto>();
                    }

                    var flowModel = _workFlowCacheManager.GetWorkFlowModelFromCache(input.FlowId);
                    if (flowModel == null)
                    {
                        throw new UserFriendlyException((int)ErrorCode.CodeValErr, "流程不存在");
                    }
                    var files = _abpFileRelationAppService.GetList(new GetAbpFilesInput()
                    {
                        BusinessId = logModel.Id.ToString(), BusinessType = (int)AbpFileBusinessType.用车
                    });
                    if (files.Count > 0)
                    {
                        logModel.Files = files.Select(r => new AbpFileChangeDto {
                            Id = r.Id, FileName = r.FileName
                        }).ToList();
                    }

                    if (input.FileList.Count > 0)
                    {
                        new_Model.Files = input.FileList.Select(r => new AbpFileChangeDto {
                            FileName = r.FileName, Id = r.Id
                        }).ToList();
                    }
                    var logs = logModel.GetColumnAllLogs(new_Model);
                    await _projectAuditManager.InsertAsync(logs, input.InStanceId.ToString(), flowModel.TitleField.Table);
                }
            }
            else
            {
                throw new UserFriendlyException((int)ErrorCode.CodeValErr, "该数据不存在!");
            }
        }
コード例 #25
0
        /// <summary>
        /// 修改一个EmployeeResume
        /// </summary>
        /// <param name="input">实体</param>
        /// <returns></returns>
        public async Task Update(UpdateEmployeeResumeInput input)
        {
            if (input.Id != Guid.Empty)
            {
                var model = await _repository.FirstOrDefaultAsync(x => x.Id == input.Id);

                if (model == null)
                {
                    throw new UserFriendlyException((int)ErrorCode.DataAccessErr, "该数据不存在。");
                }

                model.Name           = input.Name;
                model.Sex            = input.Sex;
                model.Email          = input.Email;
                model.Age            = input.Age;
                model.Position       = input.Position;
                model.Phone          = input.Phone;
                model.Address        = input.Address;
                model.Salary         = input.Salary;
                model.StartingSalary = input.StartingSalary;
                model.IsFace         = input.IsFace;
                model.Remark         = input.Remark;
                model.Experience     = input.Experience;

                if (input.WorkExperience != null && input.WorkExperience.Count > 0)
                {
                    var ids = input.WorkExperience.Select(ite => ite.Id).ToList();
                    _workExperienceRepository.Delete(ite => ite.EmployeeId == model.Id && !ids.Contains(ite.Id));
                    foreach (var w in input.WorkExperience)
                    {
                        if (w.Id.HasValue)
                        {
                            var wmodel = _workExperienceRepository.Get(w.Id.Value);

                            ObjectMapper.Map(w, wmodel);
                            _workExperienceRepository.Update(wmodel);
                        }
                        else
                        {
                            var wmodel = w.MapTo <WorkExperience>();
                            wmodel.EmployeeId = model.Id;
                            _workExperienceRepository.Insert(wmodel);
                        }
                    }
                }
                if (input.EducationExperience != null && input.EducationExperience.Count > 0)
                {
                    var ids = input.EducationExperience.Select(ite => ite.Id).ToList();
                    _educationExperienceRepository.Delete(ite => ite.EmployeeId == model.Id && !ids.Contains(ite.Id));
                    foreach (var e in input.EducationExperience)
                    {
                        if (e.Id.HasValue)
                        {
                            var edumodel = _educationExperienceRepository.Get(e.Id.Value);
                            ObjectMapper.Map(e, edumodel);
                            _educationExperienceRepository.Update(edumodel);
                        }
                        else
                        {
                            var edumodel = e.MapTo <EducationExperience>();
                            edumodel.EmployeeId = model.Id;
                            _educationExperienceRepository.Insert(edumodel);
                        }
                    }
                }
                if (input.ProjecExperience != null && input.ProjecExperience.Count > 0)
                {
                    var ids = input.ProjecExperience.Select(ite => ite.Id).ToList();
                    _projecExperienceRepository.Delete(ite => ite.EmployeeId == model.Id && !ids.Contains(ite.Id));
                    foreach (var e in input.ProjecExperience)
                    {
                        if (e.Id.HasValue)
                        {
                            var expmodel = _projecExperienceRepository.Get(e.Id.Value);
                            ObjectMapper.Map(e, expmodel);
                            _projecExperienceRepository.Update(expmodel);
                        }
                        else
                        {
                            var expmodel = e.MapTo <EmployeeProjecExperience>();
                            expmodel.EmployeeId = model.Id;
                            _projecExperienceRepository.Insert(expmodel);
                        }
                    }
                }
                var fileList = new List <AbpFileListInput>();
                if (input.FileList != null)
                {
                    foreach (var item in input.FileList)
                    {
                        fileList.Add(new AbpFileListInput()
                        {
                            Id = item.Id, Sort = item.Sort
                        });
                    }
                }
                await _abpFileRelationAppService.UpdateAsync(new CreateFileRelationsInput()
                {
                    BusinessId   = input.Id.ToString(),
                    BusinessType = (int)AbpFileBusinessType.人力资源招聘人才库,
                    Files        = fileList
                });

                await _repository.UpdateAsync(model);
            }
            else
            {
                throw new UserFriendlyException((int)ErrorCode.DataAccessErr, "该数据不存在。");
            }
        }
コード例 #26
0
        public async Task CreateOrUpdateFinishResultAsync(CreateUpdateProjectAuditInput input)
        {
            foreach (var item in input.Results)
            {
                if (input.Action == 1)//
                {
                    if (item.CjzFile == null)
                    {
                        throw new UserFriendlyException((int)ErrorCode.DataAccessErr, "CJZ文件不能为空");
                    }
                    if (item.Files == null || item.Files.Count == 0)
                    {
                        throw new UserFriendlyException((int)ErrorCode.DataAccessErr, "评审文件不能为空");
                    }
                }
                else if (input.Action == 2)//汇总时判断是否事项负责人,是负责人才需要上传汇总
                {
                    var allot = _projectPersentFinishAllotRepository.FirstOrDefault(item.AllotId);
                    if (allot != null && allot.IsMain)
                    {
                        var member = _projectAuditMemberRepository.FirstOrDefault(ite => ite.Id == allot.AuditMembeId);
                        if (member != null && member.UserId == AbpSession.UserId.Value)
                        {
                            if (item.CjzFile == null)
                            {
                                throw new UserFriendlyException((int)ErrorCode.DataAccessErr, "CJZ汇总文件不能为空");
                            }
                            if (item.Files == null || item.Files.Count == 0)
                            {
                                throw new UserFriendlyException((int)ErrorCode.DataAccessErr, "评审汇总文件不能为空");
                            }
                        }
                    }
                }
                else
                {
                    throw new UserFriendlyException((int)ErrorCode.DataAccessErr, "【Action】参数错误");
                }
                if (item.Id.HasValue)
                {
                    var entity = await _projectPersentFinishResultRepository.FirstOrDefaultAsync(r => r.ProjectId == input.ProjectBaseId && r.AllotId == item.AllotId && r.ResultType == input.Action);

                    if (entity == null)
                    {
                        throw new UserFriendlyException((int)ErrorCode.DataAccessErr, "事务评审结果数据异常");
                    }
                    entity.AuditAmount = item.AuditAmount;
                    entity.SurePersent = item.SurePersent;
                    var cjzFileNews = new List <AbpFileListInput>();
                    if (item.CjzFile != null)
                    {
                        cjzFileNews.Add(new AbpFileListInput()
                        {
                            Id = item.CjzFile.Id, Sort = item.CjzFile.Sort
                        });
                    }

                    await _abpFileRelationAppService.UpdateAsync(new CreateFileRelationsInput()
                    {
                        BusinessId = entity.Id.ToString(), BusinessType = input.Action == 1 ? (int)AbpFileBusinessType.工程评审CJZ结果 : (int)AbpFileBusinessType.评审事项汇总CJZ结果, Files = cjzFileNews
                    });

                    await _abpFileRelationAppService.UpdateAsync(new CreateFileRelationsInput()
                    {
                        BusinessId = entity.Id.ToString(), BusinessType = input.Action == 1 ? (int)AbpFileBusinessType.工程评审结果 : (int)AbpFileBusinessType.评审事项汇总结果, Files = item.Files
                    });

                    entity.Remark = item.Remark;
                    await _projectPersentFinishResultRepository.UpdateAsync(entity);
                }
                else
                {
                    var entity = new ProjectPersentFinishResult()
                    {
                        Id          = Guid.NewGuid(),
                        AllotId     = item.AllotId,
                        AuditAmount = item.AuditAmount,
                        SurePersent = item.SurePersent,
                        //CJZFiles = Newtonsoft.Json.JsonConvert.SerializeObject(item.CjzFile),
                        //Files = Newtonsoft.Json.JsonConvert.SerializeObject(item.Files),
                        ProjectId  = input.ProjectBaseId,
                        Remark     = item.Remark,
                        ResultType = input.Action,
                        UserId     = AbpSession.UserId.Value
                    };
                    if (item.CjzFile != null)
                    {
                        await _abpFileRelationAppService.CreateAsync(new CreateFileRelationsInput()
                        {
                            BusinessId = entity.Id.ToString(), BusinessType = input.Action == 1 ? (int)AbpFileBusinessType.工程评审CJZ结果 : (int)AbpFileBusinessType.评审事项汇总CJZ结果, Files = new List <AbpFileListInput>()
                            {
                                item.CjzFile
                            }
                        });
                    }
                    await _abpFileRelationAppService.CreateAsync(new CreateFileRelationsInput()
                    {
                        BusinessId = entity.Id.ToString(), BusinessType = input.Action == 1 ? (int)AbpFileBusinessType.工程评审结果 : (int)AbpFileBusinessType.评审事项汇总结果, Files = item.Files
                    });

                    await _projectPersentFinishResultRepository.InsertAsync(entity);
                }
            }
        }
コード例 #27
0
        /// <summary>
        /// 修改一个Employees_Sign
        /// </summary>
        /// <param name="input">实体</param>
        /// <returns></returns>
        public async Task Update(UpdateEmployees_SignInput input)
        {
            if (input.Id != Guid.Empty)
            {
                var dbmodel = await _repository.FirstOrDefaultAsync(x => x.Id == input.Id);

                if (dbmodel == null)
                {
                    throw new UserFriendlyException((int)ErrorCode.CodeValErr, "该数据不存在!");
                }
                if (_repository.GetAll().Any(x => x.UserId == input.UserId && x.Id != input.Id))
                {
                    throw new UserFriendlyException((int)ErrorCode.DataAccessErr, "员工已存在签名。");
                }
                var old_Model       = dbmodel.DeepClone();
                var old_changeModel = GetChangeModel(old_Model);
                var fileData        = await _abpFileRelationAppService.GetListAsync(new GetAbpFilesInput()
                {
                    BusinessId = input.Id.ToString(), BusinessType = (int)AbpFileBusinessType.员工签名图片
                });

                old_changeModel.Files = fileData.Select(r => new AbpFileChangeDto {
                    Id = r.Id, FileName = r.FileName
                }).ToList();

                dbmodel.UserId   = input.UserId;
                dbmodel.SignType = input.SignType;
                dbmodel.Status   = input.Status;

                await _repository.UpdateAsync(dbmodel);

                var fileList = new List <AbpFileListInput>();
                if (input.FileList != null)
                {
                    foreach (var item in input.FileList)
                    {
                        fileList.Add(new AbpFileListInput()
                        {
                            Id = item.Id, Sort = item.Sort
                        });
                    }
                }
                await _abpFileRelationAppService.UpdateAsync(new CreateFileRelationsInput()
                {
                    BusinessId   = input.Id.ToString(),
                    BusinessType = (int)AbpFileBusinessType.员工签名图片,
                    Files        = fileList
                });

                var new_changeModel = GetChangeModel(dbmodel);
                new_changeModel.Files = input.FileList.Select(r => new AbpFileChangeDto {
                    Id = r.Id, FileName = r.FileName
                }).ToList();

                var logs = old_changeModel.GetColumnAllLogs(new_changeModel);
                await _projectAuditManager.InsertAsync(logs, input.Id.ToString(), typeof(Employees_SignAppService).ToString());
            }
            else
            {
                throw new UserFriendlyException((int)ErrorCode.CodeValErr, "该数据不存在!");
            }
        }
コード例 #28
0
        /// <summary>
        /// 修改一个EmployeeReceipt
        /// </summary>
        /// <param name="input">实体</param>
        /// <returns></returns>
        public async Task Update(UpdateEmployeeReceiptInput input)
        {
            if (input.Id != Guid.Empty)
            {
                if (input.DocProperty == ReceiptDocProperty.Electronic && input.FileList.Count() == 0)
                {
                    throw new UserFriendlyException((int)ErrorCode.DataAccessErr, "请上传正文。");
                }
                var dbmodel = await _repository.FirstOrDefaultAsync(x => x.Id == input.Id);

                if (dbmodel == null)
                {
                    throw new UserFriendlyException((int)ErrorCode.DataAccessErr, "该数据不存在。");
                }
                var logModel = new EmployeeReceipt();
                if (input.IsUpdateForChange)
                {
                    logModel = dbmodel.DeepClone <EmployeeReceipt>();
                }
                dbmodel.Opinion         = input.Opinion;
                dbmodel.Title           = input.Title;
                dbmodel.Remark          = input.Remark;
                dbmodel.Rank            = input.Rank;
                dbmodel.IsPrintQrcode   = input.IsPrintQrcode;
                dbmodel.DocReceiveNo    = input.DocReceiveNo;
                dbmodel.DocReceiveDep   = input.DocReceiveDep;
                dbmodel.CopyForType     = input.CopyForType;
                dbmodel.TaskType        = input.TaskType;
                dbmodel.DocType         = input.DocType;
                dbmodel.CopyForUsers    = input.CopyForUsers;
                dbmodel.EmergencyDegree = input.EmergencyDegree;
                await _repository.UpdateAsync(dbmodel);

                var fileList = new List <AbpFileListInput>();
                if (input.FileList != null)
                {
                    foreach (var item in input.FileList)
                    {
                        fileList.Add(new AbpFileListInput()
                        {
                            Id = item.Id, Sort = item.Sort
                        });
                    }
                }
                await _abpFileRelationAppService.UpdateAsync(new CreateFileRelationsInput()
                {
                    BusinessId   = input.Id.ToString(),
                    BusinessType = (int)AbpFileBusinessType.收文附件,
                    Files        = fileList,
                });

                if (input.IsUpdateForChange)
                {
                    var flowModel = _workFlowCacheManager.GetWorkFlowModelFromCache(input.FlowId);
                    if (flowModel == null)
                    {
                        throw new UserFriendlyException((int)ErrorCode.DataAccessErr, "流程不存在");
                    }
                    var files = input.OldFileList.Select(r => new AbpFileChangeDto {
                        FileName = r.FileName, Id = r.Id
                    }).ToList();
                    var newfiles = input.FileList.Select(r => new AbpFileChangeDto {
                        FileName = r.FileName, Id = r.Id
                    }).ToList();
                    var logs = GetChangeModel(logModel, files).GetColumnAllLogs(GetChangeModel(dbmodel, newfiles));
                    await _projectAuditManager.InsertAsync(logs, input.Id.ToString(), flowModel.TitleField.Table);

                    _workFlowTaskManager.CreateNoticeForTask(input.FlowId, input.Id.ToString(), "收文变更", dbmodel.Title);
                }
            }
            else
            {
                throw new UserFriendlyException((int)ErrorCode.DataAccessErr, "该数据不存在。");
            }
        }
コード例 #29
0
        /// <summary>
        /// 修改一个Train
        /// </summary>
        /// <param name="input">实体</param>
        /// <returns></returns>
        public async Task Update(UpdateTrainInput input)
        {
            if (input.Id != Guid.Empty)
            {
                if (input.StartTime < DateTime.Now)
                {
                    throw new UserFriendlyException((int)ErrorCode.CodeValErr, "开始时间不得小于当前时间。");
                }
                if (input.StartTime >= input.EndTime)
                {
                    throw new UserFriendlyException((int)ErrorCode.CodeValErr, "开始时间不得大于等于结束时间。");
                }
                if (input.IsTips && input.TipsTime <= 0)
                {
                    throw new UserFriendlyException((int)ErrorCode.CodeValErr, "提醒时间必填。");
                }
                var dbmodel = await _repository.FirstOrDefaultAsync(x => x.Id == input.Id);

                if (dbmodel == null)
                {
                    throw new UserFriendlyException((int)ErrorCode.DataAccessErr, "该数据不存在!");
                }
                var logModel = new Train();
                if (input.IsUpdateForChange)
                {
                    logModel = dbmodel.DeepClone <Train>();
                }
                if (input.MeetingRoomId.HasValue)
                {
                    _eventBus.Trigger(new MeetingRoomUseInfoByEvent()
                    {
                        BusinessId    = dbmodel.Id,
                        BusinessType  = 1,
                        StartTime     = input.StartTime,
                        EndTime       = input.EndTime,
                        Status        = 0,
                        BusinessName  = input.Title,
                        MeetingRoomId = input.MeetingRoomId.Value,
                        IsDelete      = false
                    });
                }
                if (dbmodel.MeetingRoomId.HasValue && dbmodel.MeetingRoomId != input.MeetingRoomId)
                {
                    _eventBus.Trigger(new MeetingRoomUseInfoByEvent()
                    {
                        BusinessId    = dbmodel.Id,
                        BusinessType  = 1,
                        StartTime     = dbmodel.StartTime,
                        EndTime       = dbmodel.EndTime,
                        Status        = 0,
                        BusinessName  = dbmodel.Title,
                        MeetingRoomId = dbmodel.MeetingRoomId.Value,
                        IsDelete      = true
                    });
                }
                dbmodel.Title            = input.Title;
                dbmodel.Type             = input.Type;
                dbmodel.Address          = input.Address;
                dbmodel.StartTime        = input.StartTime;
                dbmodel.EndTime          = input.EndTime;
                dbmodel.InitiatorId      = input.InitiatorId;
                dbmodel.Introduction     = input.Introduction;
                dbmodel.JoinUser         = input.JoinUser;
                dbmodel.CommentScore     = input.CommentScore;
                dbmodel.ExperienceScore  = input.ExperienceScore;
                dbmodel.LecturerUser     = input.LecturerUser;
                dbmodel.IsExperience     = input.IsExperience;
                dbmodel.JoinScore        = input.JoinScore;
                dbmodel.MeetingRoomId    = input.MeetingRoomId;
                dbmodel.Traffic          = input.Traffic;
                dbmodel.Eat              = input.Eat;
                dbmodel.Accommodation    = input.Accommodation;
                dbmodel.ProjectionSystem = input.ProjectionSystem;
                dbmodel.Whiteboard       = input.Whiteboard;
                dbmodel.SoundSystem      = input.SoundSystem;
                dbmodel.IsTips           = input.IsTips;
                dbmodel.TipsTime         = input.TipsTime;
                dbmodel.TipsUnit         = input.TipsUnit;
                await _repository.UpdateAsync(dbmodel);


                var fileList = new List <AbpFileListInput>();
                if (input.FileList != null)
                {
                    foreach (var item in input.FileList)
                    {
                        fileList.Add(new AbpFileListInput()
                        {
                            Id = item.Id, Sort = item.Sort
                        });
                    }
                }
                await _abpFileRelationAppService.UpdateAsync(new CreateFileRelationsInput()
                {
                    BusinessId   = input.Id.ToString(),
                    BusinessType = (int)AbpFileBusinessType.培训,
                    Files        = fileList
                });

                if (input.IsUpdateForChange)
                {
                    var flowModel = _workFlowCacheManager.GetWorkFlowModelFromCache(input.FlowId);
                    if (flowModel == null)
                    {
                        throw new UserFriendlyException((int)ErrorCode.DataAccessErr, "流程不存在");
                    }
                    var logs = GetChangeModel(logModel).GetColumnAllLogs(GetChangeModel(dbmodel));
                    await _projectAuditManager.InsertAsync(logs, input.Id.ToString(), flowModel.TitleField.Table);
                }
            }
            else
            {
                throw new UserFriendlyException((int)ErrorCode.DataAccessErr, "该数据不存在!");
            }
        }
コード例 #30
0
        public async Task Update(UpdateCWGLTravelReimbursementInput input)
        {
            if (input.Id != Guid.Empty)
            {
                var dbmodel = await _repository.FirstOrDefaultAsync(x => x.Id == input.Id);

                if (dbmodel == null)
                {
                    throw new UserFriendlyException((int)ErrorCode.DataAccessErr, "该数据不存在。");
                }
                var logModel = new CWGLTravelReimbursement();
                if (input.IsUpdateForChange)
                {
                    logModel = dbmodel.DeepClone();
                }

                dbmodel.Money            = input.Money;
                dbmodel.Note             = input.Note;
                dbmodel.Nummber          = input.Nummber;
                dbmodel.BorrowMoneyId    = input.BorrowMoneyId;
                dbmodel.WorkoutId        = input.WorkoutId;
                input.FACData.BusinessId = input.Id.ToString();
                var totalFee = 0m;
                foreach (var item in input.DetailList)
                {
                    totalFee = totalFee + item.Fare ?? 0 + item.Accommodation ?? 0 + item.Other ?? 0;
                }
                if (input.BorrowMoneyId.HasValue)
                {
                    var entityBorro = await _cWGLBorrowMonetrepository.GetAsync(input.BorrowMoneyId.Value);

                    if (entityBorro.Money == totalFee)
                    {
                        dbmodel.ResultType = (int)RefundResultType.无退无报;
                    }
                    else if (entityBorro.Money > totalFee)
                    {
                        dbmodel.ResultType = (int)RefundResultType.财务应收款;
                    }
                    else
                    {
                        dbmodel.ResultType = (int)RefundResultType.财务应付款;
                    }
                    dbmodel.Money = Math.Abs(entityBorro.Money - totalFee);
                }
                else
                {
                    dbmodel.Money      = totalFee;
                    dbmodel.ResultType = (int)RefundResultType.财务应付款;
                }


                await _repository.UpdateAsync(dbmodel);

                var details = await _detailRepository.GetAll().Where(r => r.TravelReimbursementId == dbmodel.Id).ToListAsync();

                var old_Details = new List <CWGLTravelReimbursementDetailLogDto>();
                var old_Model   = new CWGLTravelReimbursementLogDto()
                {
                    Id = logModel.Id, Money = logModel.Money, Note = logModel.Note, Nummber = logModel.Nummber
                };
                foreach (var item in details)
                {
                    old_Details.Add(item.MapTo <CWGLTravelReimbursementDetailLogDto>());
                }
                old_Model.Detail = old_Details;
                var new_Detail = new List <CWGLTravelReimbursementDetailLogDto>();
                foreach (var item in input.DetailList)
                {
                    var entity = new CWGLTravelReimbursementDetailLogDto()
                    {
                        Accommodation = item.Accommodation,
                        Address       = item.Address,
                        BeginTime     = item.BeginTime,
                        Day           = item.Day,
                        EndTime       = item.EndTime,
                        Fare          = item.Fare,
                        Id            = item.Id ?? Guid.Empty,
                        Other         = item.Other,
                        Vehicle       = item.Vehicle
                    };
                    new_Detail.Add(entity);
                }
                var new_Model = new CWGLTravelReimbursementLogDto()
                {
                    Id = dbmodel.Id, Money = dbmodel.Money, Note = dbmodel.Note, Nummber = dbmodel.Nummber, Detail = new_Detail
                };
                var add_details = input.DetailList.Where(r => !r.Id.HasValue);
                foreach (var item in add_details)
                {
                    var entity = item.MapTo <CWGLTravelReimbursementDetail>();
                    entity.Id = Guid.NewGuid();
                    entity.TravelReimbursementId = dbmodel.Id;
                    await _detailRepository.InsertAsync(entity);
                }
                var update_details = input.DetailList.Where(r => r.Id.HasValue);
                foreach (var item in update_details)
                {
                    var db_detail = await _detailRepository.GetAsync(item.Id.Value);

                    item.MapTo(db_detail);
                }
                var less_detailIds = details.Select(r => r.Id).Except(input.DetailList.Where(r => r.Id.HasValue).Select(r => r.Id.Value)).ToList();
                var less_details   = details.Where(r => less_detailIds.Contains(r.Id));
                foreach (var item in less_details)
                {
                    await _detailRepository.DeleteAsync(item);
                }

                var fileList = new List <AbpFileListInput>();
                if (input.FileList != null)
                {
                    foreach (var item in input.FileList)
                    {
                        fileList.Add(new AbpFileListInput()
                        {
                            Id = item.Id, Sort = item.Sort
                        });
                    }
                }
                await _abpFileRelationAppService.UpdateAsync(new CreateFileRelationsInput()
                {
                    BusinessId   = input.Id.ToString(),
                    BusinessType = (int)AbpFileBusinessType.差旅费报销,
                    Files        = fileList
                });

                var groupId = Guid.NewGuid();
                input.FACData.GroupId = groupId;
                if (input.IsUpdateForChange)
                {
                    var flowModel = _workFlowCacheManager.GetWorkFlowModelFromCache(input.FlowId);
                    if (flowModel == null)
                    {
                        throw new UserFriendlyException((int)ErrorCode.DataAccessErr, "流程不存在");
                    }
                    var files = _abpFileRelationAppService.GetList(new GetAbpFilesInput()
                    {
                        BusinessId = old_Model.Id.ToString(), BusinessType = (int)AbpFileBusinessType.差旅费报销
                    });
                    if (files.Count > 0)
                    {
                        old_Model.Files = files.Select(r => new AbpFileChangeDto {
                            Id = r.Id, FileName = r.FileName
                        }).ToList();
                    }

                    if (input.FileList.Count > 0)
                    {
                        new_Model.Files = input.FileList.Select(r => new AbpFileChangeDto {
                            FileName = r.FileName, Id = r.Id
                        }).ToList();
                    }

                    var logs = old_Model.GetColumnAllLogs(new_Model);
                    await _projectAuditManager.InsertAsync(logs, input.Id.ToString(), flowModel.TitleField.Table, groupId);
                }
            }
            else
            {
                throw new UserFriendlyException((int)ErrorCode.DataAccessErr, "该数据不存在。");
            }
        }