Merge branch 'master' of https://codeup.aliyun.com/62ce7bca487c500c27f70a79/OPS/WMS-Api
This commit is contained in:
@@ -36,6 +36,11 @@ namespace WMS.Web.Domain.Entitys
|
||||
[Column("DestSubStockId")]
|
||||
public int DestSubStockId { get; set; }
|
||||
/// <summary>
|
||||
/// 数量
|
||||
/// </summary>
|
||||
[Column("Qty")]
|
||||
public decimal Qty { get; set; }
|
||||
/// <summary>
|
||||
/// 类型:1-整箱移货上级,2-整箱移货下级
|
||||
/// </summary>
|
||||
[Column("Type")]
|
||||
@@ -50,5 +55,15 @@ namespace WMS.Web.Domain.Entitys
|
||||
/// </summary>
|
||||
[Column("CreateTime")]
|
||||
public DateTime CreateTime { get; set; } = DateTime.Now;
|
||||
|
||||
/// <summary>
|
||||
/// 创建
|
||||
/// </summary>
|
||||
/// <param name="creatorId"></param>
|
||||
public void Create(int creatorId)
|
||||
{
|
||||
this.CreatorId = creatorId;
|
||||
this.CreateTime = DateTime.Now;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using WMS.Web.Core.Dto.ChangeBoxRecord;
|
||||
using WMS.Web.Core.Dto.Login;
|
||||
using WMS.Web.Core.Dto.MoveBoxRecord;
|
||||
using WMS.Web.Core.Internal.Results;
|
||||
using WMS.Web.Domain.Services;
|
||||
|
||||
@@ -15,6 +16,10 @@ namespace WMS.Web.Domain.IService
|
||||
/// </summary>
|
||||
public interface IChangeMoveBoxService
|
||||
{
|
||||
Task<Result> Save(SaveChangeBoxRecordRequest dto, LoginInDto loginInfo);
|
||||
//改箱保存
|
||||
Task<Result> ChangeBoxSave(SaveChangeBoxRecordRequest dto, LoginInDto loginInfo);
|
||||
//移箱保存
|
||||
Task<Result> MoveBoxSave(SaveMoveBoxRecordRequest dto, LoginInDto loginInfo);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using WMS.Web.Core.Dto.ChangeBoxRecord;
|
||||
using WMS.Web.Core.Dto.Login;
|
||||
using WMS.Web.Core.Dto.MoveBoxRecord;
|
||||
using WMS.Web.Core.Internal.Results;
|
||||
using WMS.Web.Domain.Entitys;
|
||||
using WMS.Web.Domain.Infrastructure;
|
||||
@@ -22,16 +23,24 @@ namespace WMS.Web.Domain.Services
|
||||
private readonly ILoginService _loginService;
|
||||
private readonly IChangeBoxRecordRepositories _changeBoxRecordRepositories;
|
||||
public readonly ITransactionRepositories _transactionRepositories;
|
||||
private readonly IMoveBoxRecordRepositories _moveBoxRecordRepositories;
|
||||
public ChangeMoveBoxService(IMapper mapper, ILoginService loginService,
|
||||
IChangeBoxRecordRepositories changeBoxRecordRepositories, ITransactionRepositories transactionRepositories)
|
||||
IChangeBoxRecordRepositories changeBoxRecordRepositories, ITransactionRepositories transactionRepositories,
|
||||
IMoveBoxRecordRepositories moveBoxRecordRepositories)
|
||||
{
|
||||
_mapper = mapper;
|
||||
_loginService = loginService;
|
||||
_changeBoxRecordRepositories = changeBoxRecordRepositories;
|
||||
_transactionRepositories = transactionRepositories;
|
||||
_moveBoxRecordRepositories = moveBoxRecordRepositories;
|
||||
}
|
||||
|
||||
public async Task<Result> Save(SaveChangeBoxRecordRequest dto, LoginInDto loginInfo)
|
||||
/// <summary>
|
||||
/// 改箱保存
|
||||
/// </summary>
|
||||
/// <param name="dto"></param>
|
||||
/// <param name="loginInfo"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<Result> ChangeBoxSave(SaveChangeBoxRecordRequest dto, LoginInDto loginInfo)
|
||||
{
|
||||
var entity = _mapper.Map<ChangeBoxRecord>(dto);
|
||||
entity.Create(loginInfo.UserInfo.StaffId);
|
||||
@@ -45,6 +54,33 @@ namespace WMS.Web.Domain.Services
|
||||
entity = await _changeBoxRecordRepositories.Add(entity, true);
|
||||
if (entity == null) isRollback = true;
|
||||
|
||||
//提交事务
|
||||
isSuccess = _transactionRepositories.CommitTransaction(isRollback, _transaction);
|
||||
if (!isSuccess)
|
||||
return Result.ReFailure(ResultCodes.DateWriteError);
|
||||
|
||||
return Result.ReSuccess();
|
||||
}
|
||||
/// <summary>
|
||||
/// 移箱保存
|
||||
/// </summary>
|
||||
/// <param name="dto"></param>
|
||||
/// <param name="loginInfo"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<Result> MoveBoxSave(SaveMoveBoxRecordRequest dto, LoginInDto loginInfo)
|
||||
{
|
||||
var entity = _mapper.Map<MoveBoxRecord>(dto);
|
||||
entity.Create(loginInfo.UserInfo.StaffId);
|
||||
|
||||
//需要填写规格型号
|
||||
//需要修改库存
|
||||
|
||||
IDbContextTransaction _transaction = _transactionRepositories.GetTransaction();
|
||||
bool isRollback = false;
|
||||
bool isSuccess = true;
|
||||
entity = await _moveBoxRecordRepositories.Add(entity, true);
|
||||
if (entity == null) isRollback = true;
|
||||
|
||||
//提交事务
|
||||
isSuccess = _transactionRepositories.CommitTransaction(isRollback, _transaction);
|
||||
if (!isSuccess)
|
||||
|
||||
Reference in New Issue
Block a user