This commit is contained in:
tongfei
2023-10-26 14:40:18 +08:00
10 changed files with 201 additions and 1 deletions

View File

@@ -1,10 +1,14 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
using System.Threading.Tasks;
using WMS.Web.Domain.Entitys;
namespace WMS.Web.Domain.Infrastructure namespace WMS.Web.Domain.Infrastructure
{ {
public interface IChangeBoxRecordRepositories public interface IChangeBoxRecordRepositories
{ {
// 新增
Task<ChangeBoxRecord> Add(ChangeBoxRecord entity, bool isTransaction = true);
} }
} }

View File

@@ -1,10 +1,14 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
using System.Threading.Tasks;
using WMS.Web.Domain.Entitys;
namespace WMS.Web.Domain.Infrastructure namespace WMS.Web.Domain.Infrastructure
{ {
public interface IMoveBoxRecordRepositories public interface IMoveBoxRecordRepositories
{ {
// 新增
Task<MoveBoxRecord> Add(MoveBoxRecord entity, bool isTransaction = true);
} }
} }

View File

@@ -1,10 +1,14 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
using System.Threading.Tasks;
using WMS.Web.Domain.Entitys;
namespace WMS.Web.Domain.Infrastructure namespace WMS.Web.Domain.Infrastructure
{ {
public interface IOutStockRepositories public interface IOutStockRepositories
{ {
// 新增
Task<OutStock> Add(OutStock entity, bool isTransaction = true);
} }
} }

View File

@@ -1,10 +1,14 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
using System.Threading.Tasks;
using WMS.Web.Domain.Entitys;
namespace WMS.Web.Domain.Infrastructure namespace WMS.Web.Domain.Infrastructure
{ {
public interface IOutStockTaskRepositories public interface IOutStockTaskRepositories
{ {
// 新增
Task<OutStockTask> Add(OutStockTask entity, bool isTransaction = true);
} }
} }

View File

@@ -1,10 +1,14 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
using System.Threading.Tasks;
using WMS.Web.Domain.Entitys;
namespace WMS.Web.Domain.Infrastructure namespace WMS.Web.Domain.Infrastructure
{ {
public interface ITakeStockRepositories public interface ITakeStockRepositories
{ {
// 新增
Task<TakeStock> Add(TakeStock entity, bool isTransaction = true);
} }
} }

View File

@@ -1,13 +1,16 @@
using AutoMapper; using AutoMapper;
using Microsoft.EntityFrameworkCore.Storage;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
using System.Threading.Tasks;
using WMS.Web.Domain.Entitys;
using WMS.Web.Domain.Infrastructure; using WMS.Web.Domain.Infrastructure;
using WMS.Web.Repositories.Configuration; using WMS.Web.Repositories.Configuration;
namespace WMS.Web.Repositories namespace WMS.Web.Repositories
{ {
public class ChangeBoxRecordRepositories: IChangeBoxRecordRepositories public class ChangeBoxRecordRepositories : IChangeBoxRecordRepositories
{ {
private readonly IMapper _mapper; private readonly IMapper _mapper;
private readonly IServiceProvider _serviceProvider; private readonly IServiceProvider _serviceProvider;
@@ -20,5 +23,34 @@ namespace WMS.Web.Repositories
_mapper = mapper; _mapper = mapper;
_serviceProvider = serviceProvider; _serviceProvider = serviceProvider;
} }
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;
}
}
} }
} }

View File

@@ -1,7 +1,10 @@
using AutoMapper; using AutoMapper;
using Microsoft.EntityFrameworkCore.Storage;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
using System.Threading.Tasks;
using WMS.Web.Domain.Entitys;
using WMS.Web.Domain.Infrastructure; using WMS.Web.Domain.Infrastructure;
using WMS.Web.Repositories.Configuration; using WMS.Web.Repositories.Configuration;
@@ -20,5 +23,39 @@ namespace WMS.Web.Repositories
_mapper = mapper; _mapper = mapper;
_serviceProvider = serviceProvider; _serviceProvider = serviceProvider;
} }
/// <summary>
/// 新增
/// </summary>
/// <param name="entity"></param>
/// <param name="isTransaction"></param>
/// <returns></returns>
public async Task<MoveBoxRecord> Add(MoveBoxRecord entity, bool isTransaction = true)
{
IDbContextTransaction _transaction = null;
if (isTransaction)
_transaction = _context.Database.BeginTransaction();
try
{
await _context.MoveBoxRecord.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;
}
}
} }
} }

View File

@@ -1,7 +1,10 @@
using AutoMapper; using AutoMapper;
using Microsoft.EntityFrameworkCore.Storage;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
using System.Threading.Tasks;
using WMS.Web.Domain.Entitys;
using WMS.Web.Domain.Infrastructure; using WMS.Web.Domain.Infrastructure;
using WMS.Web.Repositories.Configuration; using WMS.Web.Repositories.Configuration;
@@ -20,5 +23,39 @@ namespace WMS.Web.Repositories
_mapper = mapper; _mapper = mapper;
_serviceProvider = serviceProvider; _serviceProvider = serviceProvider;
} }
/// <summary>
/// 新增
/// </summary>
/// <param name="entity"></param>
/// <param name="isTransaction"></param>
/// <returns></returns>
public async Task<OutStock> Add(OutStock entity, bool isTransaction = true)
{
IDbContextTransaction _transaction = null;
if (isTransaction)
_transaction = _context.Database.BeginTransaction();
try
{
await _context.OutStock.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;
}
}
} }
} }

View File

@@ -1,7 +1,10 @@
using AutoMapper; using AutoMapper;
using Microsoft.EntityFrameworkCore.Storage;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
using System.Threading.Tasks;
using WMS.Web.Domain.Entitys;
using WMS.Web.Domain.Infrastructure; using WMS.Web.Domain.Infrastructure;
using WMS.Web.Repositories.Configuration; using WMS.Web.Repositories.Configuration;
@@ -20,5 +23,39 @@ namespace WMS.Web.Repositories
_mapper = mapper; _mapper = mapper;
_serviceProvider = serviceProvider; _serviceProvider = serviceProvider;
} }
/// <summary>
/// 新增
/// </summary>
/// <param name="entity"></param>
/// <param name="isTransaction"></param>
/// <returns></returns>
public async Task<OutStockTask> Add(OutStockTask entity, bool isTransaction = true)
{
IDbContextTransaction _transaction = null;
if (isTransaction)
_transaction = _context.Database.BeginTransaction();
try
{
await _context.OutStockTask.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;
}
}
} }
} }

View File

@@ -1,7 +1,10 @@
using AutoMapper; using AutoMapper;
using Microsoft.EntityFrameworkCore.Storage;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
using System.Threading.Tasks;
using WMS.Web.Domain.Entitys;
using WMS.Web.Domain.Infrastructure; using WMS.Web.Domain.Infrastructure;
using WMS.Web.Repositories.Configuration; using WMS.Web.Repositories.Configuration;
@@ -20,5 +23,39 @@ namespace WMS.Web.Repositories
_mapper = mapper; _mapper = mapper;
_serviceProvider = serviceProvider; _serviceProvider = serviceProvider;
} }
/// <summary>
/// 新增
/// </summary>
/// <param name="entity"></param>
/// <param name="isTransaction"></param>
/// <returns></returns>
public async Task<TakeStock> Add(TakeStock entity, bool isTransaction = true)
{
IDbContextTransaction _transaction = null;
if (isTransaction)
_transaction = _context.Database.BeginTransaction();
try
{
await _context.TakeStock.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;
}
}
} }
} }