Exemplo n.º 1
0
        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()
            });
        }
Exemplo n.º 2
0
        /// <summary>
        /// 修改一个EmployeeReceipt
        /// </summary>
        /// <param name="input">实体</param>
        /// <returns></returns>
        public async Task UpdateCopyFor(UpdateEmployeeReceiptInput 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.CopyForType  = input.CopyForType;
                dbmodel.TaskType     = input.TaskType;
                dbmodel.CopyForUsers = input.CopyForUsers;
                await _repository.UpdateAsync(dbmodel);

                if (dbmodel.QrCodeId.HasValue)
                {
                    var qrcodeModel = _qrCodeManager.Get(dbmodel.QrCodeId.Value);
                    if (qrcodeModel.Type == QrCodeType.公文)
                    {
                        qrcodeModel.Type = QrCodeType.档案;
                        _qrCodeManager.UpdateType(qrcodeModel);
                    }
                }
            }
            else
            {
                throw new UserFriendlyException((int)ErrorCode.DataAccessErr, "该数据不存在。");
            }
        }