示例#1
0
        private CWGLPayMoneyLogDto GetChangeModel(CWGLPayMoney model)
        {
            var ret = model.MapTo <CWGLPayMoneyLogDto>();

            ret.Mode_Name = Enum.GetName(typeof(MoneyMode), model.Mode);
            return(ret);
        }
示例#2
0
        public async Task <InitWorkFlowOutput> Create(CreateCWGLPayMoneyInput input)
        {
            var id       = Guid.NewGuid();
            var newmodel = new CWGLPayMoney()
            {
                Id           = id,
                UserName     = input.UserName,
                CustomerName = input.CustomerName,
                Money        = input.Money,
                Mode         = input.Mode,
                BankName     = input.BankName,
                CardNumber   = input.CardNumber,
                BankOpenName = input.BankOpenName,
                Note         = input.Note,
                Nummber      = input.Nummber,
                ContractNum  = input.ContractNum
            };

            newmodel.Status = 0;
            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
                });
            }
            return(new InitWorkFlowOutput()
            {
                InStanceId = newmodel.Id.ToString()
            });
        }
示例#3
0
        public async Task Update(UpdateCWGLPayMoneyInput 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 CWGLPayMoney();
                if (input.IsUpdateForChange)
                {
                    logModel = dbmodel.DeepClone <CWGLPayMoney>();
                }
                dbmodel.UserName         = input.UserName;
                dbmodel.CustomerName     = input.CustomerName;
                dbmodel.Money            = input.Money;
                dbmodel.Mode             = input.Mode;
                dbmodel.BankName         = input.BankName;
                dbmodel.CardNumber       = input.CardNumber;
                dbmodel.BankOpenName     = input.BankOpenName;
                dbmodel.Note             = input.Note;
                dbmodel.Nummber          = input.Nummber;
                dbmodel.ContractNum      = input.ContractNum;
                dbmodel.FlowNumber       = input.FlowNumber;
                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, "该数据不存在。");
            }
        }