Files
WMS-Api/src/WMS.Web.Repositories/ChangeBoxRecordRepositories.cs
18942506660 918e4d203b 调整列表
2023-10-26 15:41:59 +08:00

73 lines
2.3 KiB
C#

using AutoMapper;
using Microsoft.EntityFrameworkCore.Storage;
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
using WMS.Web.Core.Dto;
using WMS.Web.Core.Dto.ChangeBoxRecord;
using WMS.Web.Domain.Entitys;
using WMS.Web.Domain.Infrastructure;
using WMS.Web.Repositories.Configuration;
namespace WMS.Web.Repositories
{
public class ChangeBoxRecordRepositories : IChangeBoxRecordRepositories
{
private readonly IMapper _mapper;
private readonly IServiceProvider _serviceProvider;
private readonly RepositoryDbContext _context;
public ChangeBoxRecordRepositories(RepositoryDbContext context, IMapper mapper, IServiceProvider serviceProvider)
{
_context = context;
_mapper = mapper;
_serviceProvider = serviceProvider;
}
/// <summary>
/// 新增
/// </summary>
/// <param name="entity"></param>
/// <param name="isTransaction"></param>
/// <returns></returns>
public async Task<ChangeBoxRecord> Add(ChangeBoxRecord entity, bool isTransaction = true)
{
IDbContextTransaction _transaction = null;
if (isTransaction)
_transaction = _context.Database.BeginTransaction();
try
{
await _context.ChangeBoxRecord.AddAsync(entity);
await _context.SaveChangesAsync();
//if (string.IsNullOrEmpty(entity.OutSourcFeedNo))
//{
// entity.GenerateNo();
// await _context.SaveChangesAsync();
//}
if (_transaction != null)
_transaction.Commit();
return entity;
}
catch (Exception ex)
{
if (_transaction != null)
_transaction.Rollback();
return null;
}
}
/// <summary>
/// 列表
/// </summary>
/// <param name="dto"></param>
/// <returns></returns>
public Task<(List<ChangeBoxRecordQueryInfoResponse> list, int total)> GetListAsync(ChangeBoxRecordQueryRequest dto)
{
throw new NotImplementedException();
}
}
}