新增
This commit is contained in:
@@ -1,10 +1,14 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using WMS.Web.Domain.Entitys;
|
||||
|
||||
namespace WMS.Web.Domain.Infrastructure
|
||||
{
|
||||
public interface IChangeBoxRecordRepositories
|
||||
{
|
||||
// 新增
|
||||
Task<ChangeBoxRecord> Add(ChangeBoxRecord entity, bool isTransaction = true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +1,14 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using WMS.Web.Domain.Entitys;
|
||||
|
||||
namespace WMS.Web.Domain.Infrastructure
|
||||
{
|
||||
public interface IMoveBoxRecordRepositories
|
||||
{
|
||||
// 新增
|
||||
Task<MoveBoxRecord> Add(MoveBoxRecord entity, bool isTransaction = true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +1,14 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using WMS.Web.Domain.Entitys;
|
||||
|
||||
namespace WMS.Web.Domain.Infrastructure
|
||||
{
|
||||
public interface IOutStockRepositories
|
||||
{
|
||||
// 新增
|
||||
Task<OutStock> Add(OutStock entity, bool isTransaction = true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +1,14 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using WMS.Web.Domain.Entitys;
|
||||
|
||||
namespace WMS.Web.Domain.Infrastructure
|
||||
{
|
||||
public interface IOutStockTaskRepositories
|
||||
{
|
||||
// 新增
|
||||
Task<OutStockTask> Add(OutStockTask entity, bool isTransaction = true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +1,14 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using WMS.Web.Domain.Entitys;
|
||||
|
||||
namespace WMS.Web.Domain.Infrastructure
|
||||
{
|
||||
public interface ITakeStockRepositories
|
||||
{
|
||||
// 新增
|
||||
Task<TakeStock> Add(TakeStock entity, bool isTransaction = true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,13 +1,16 @@
|
||||
using AutoMapper;
|
||||
using Microsoft.EntityFrameworkCore.Storage;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using WMS.Web.Domain.Entitys;
|
||||
using WMS.Web.Domain.Infrastructure;
|
||||
using WMS.Web.Repositories.Configuration;
|
||||
|
||||
namespace WMS.Web.Repositories
|
||||
{
|
||||
public class ChangeBoxRecordRepositories: IChangeBoxRecordRepositories
|
||||
public class ChangeBoxRecordRepositories : IChangeBoxRecordRepositories
|
||||
{
|
||||
private readonly IMapper _mapper;
|
||||
private readonly IServiceProvider _serviceProvider;
|
||||
@@ -20,5 +23,34 @@ namespace WMS.Web.Repositories
|
||||
_mapper = mapper;
|
||||
_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;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
using AutoMapper;
|
||||
using Microsoft.EntityFrameworkCore.Storage;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using WMS.Web.Domain.Entitys;
|
||||
using WMS.Web.Domain.Infrastructure;
|
||||
using WMS.Web.Repositories.Configuration;
|
||||
|
||||
@@ -20,5 +23,39 @@ namespace WMS.Web.Repositories
|
||||
_mapper = mapper;
|
||||
_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;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
using AutoMapper;
|
||||
using Microsoft.EntityFrameworkCore.Storage;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using WMS.Web.Domain.Entitys;
|
||||
using WMS.Web.Domain.Infrastructure;
|
||||
using WMS.Web.Repositories.Configuration;
|
||||
|
||||
@@ -20,5 +23,39 @@ namespace WMS.Web.Repositories
|
||||
_mapper = mapper;
|
||||
_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;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
using AutoMapper;
|
||||
using Microsoft.EntityFrameworkCore.Storage;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using WMS.Web.Domain.Entitys;
|
||||
using WMS.Web.Domain.Infrastructure;
|
||||
using WMS.Web.Repositories.Configuration;
|
||||
|
||||
@@ -20,5 +23,39 @@ namespace WMS.Web.Repositories
|
||||
_mapper = mapper;
|
||||
_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;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
using AutoMapper;
|
||||
using Microsoft.EntityFrameworkCore.Storage;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using WMS.Web.Domain.Entitys;
|
||||
using WMS.Web.Domain.Infrastructure;
|
||||
using WMS.Web.Repositories.Configuration;
|
||||
|
||||
@@ -20,5 +23,39 @@ namespace WMS.Web.Repositories
|
||||
_mapper = mapper;
|
||||
_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;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user