public async Task <InitWorkFlowOutput> Create(CreateDocmentInput input) { var model = input.MapTo <DocmentList>(); model.Id = Guid.NewGuid(); model.UserId = AbpSession.UserId.Value; model.No = DateTime.Now.ToString("yyyyMMddHHmmss"); 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.CreateAsync(new CreateFileRelationsInput() { BusinessId = model.Id.ToString(), BusinessType = (int)AbpFileBusinessType.档案附件, Files = fileList }); } if (input.QrCodeId.HasValue) { var qrcodeModel = new QrCode() { Id = input.QrCodeId.Value, Type = QrCodeType.档案 }; _qrCodeManager.UpdateType(qrcodeModel); model.QrCodeId = input.QrCodeId; } else { model.QrCodeId = _qrCodeManager.GetCreateId(QrCodeType.档案); } _docmentRepository.Insert(model); //创建流转记录 _docmentFlowingRepository.Insert(new DocmentFlowing() { DocmentId = model.Id, IsOut = false, Des = "创建了该资料" }); return(new InitWorkFlowOutput() { InStanceId = model.Id.ToString() }); }
public async Task <EmployeeReceiptOutput> Create(CreateEmployeeReceiptInput input) { if (input.DocProperty == ReceiptDocProperty.Electronic && input.FileList.Count() == 0) { throw new UserFriendlyException((int)ErrorCode.DataAccessErr, "请上传正文。"); } var newmodel = new EmployeeReceipt() { Title = input.Title, DocReceiveDep = input.DocReceiveDep, DocReceiveNo = input.DocReceiveNo, DocType = input.DocType, DocProperty = input.DocProperty, Rank = input.Rank, EmergencyDegree = input.EmergencyDegree, ReportMatters = input.ReportMatters, Remark = input.Remark, IsPrintQrcode = input.IsPrintQrcode, QrCodeId = _qrCodeManager.GetCreateId(QrCodeType.公文), Opinion = ""//拟办意见为空 }; var lastNumber = Convert.ToInt32(_repository.GetAll().OrderByDescending(x => x.ReceiptNo).FirstOrDefault()?.ReceiptNo); Interlocked.Increment(ref lastNumber); newmodel.ReceiptNo = lastNumber; 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 = newmodel.Id.ToString(), BusinessType = (int)AbpFileBusinessType.收文附件, Files = fileList }); } return(new EmployeeReceiptOutput() { InStanceId = newmodel.Id.ToString(), QrCodeId = newmodel.QrCodeId.Value }); }