Merge branch 'master' of https://codeup.aliyun.com/62ce7bca487c500c27f70a79/OPS/WMS-Api
This commit is contained in:
@@ -25,6 +25,16 @@ namespace WMS.Web.Domain.Entitys
|
||||
[Column("MaterialId")]
|
||||
public int MaterialId { get; set; }
|
||||
/// <summary>
|
||||
/// 仓库Id
|
||||
/// </summary>
|
||||
[Column("StockId")]
|
||||
public int StockId { get; set; }
|
||||
/// <summary>
|
||||
/// 序列号
|
||||
/// </summary>
|
||||
[Column("SerialNumber")]
|
||||
public string SerialNumber { get; set; }
|
||||
/// <summary>
|
||||
/// 原箱子ID
|
||||
/// </summary>
|
||||
[Column("SrcBoxId")]
|
||||
@@ -54,5 +64,14 @@ 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,11 +31,6 @@ namespace WMS.Web.Domain.Entitys
|
||||
[Column("BoxId")]
|
||||
public int BoxId { get; set; }
|
||||
/// <summary>
|
||||
/// 序号
|
||||
/// </summary>
|
||||
[Column("Seq")]
|
||||
public int Seq { get; set; }
|
||||
/// <summary>
|
||||
/// 物料ID
|
||||
/// </summary>
|
||||
[Column("MaterialId")]
|
||||
|
||||
20
src/WMS.Web.Domain/IService/IChangeMoveBoxService.cs
Normal file
20
src/WMS.Web.Domain/IService/IChangeMoveBoxService.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using WMS.Web.Core.Dto.ChangeBoxRecord;
|
||||
using WMS.Web.Core.Dto.Login;
|
||||
using WMS.Web.Core.Internal.Results;
|
||||
using WMS.Web.Domain.Services;
|
||||
|
||||
namespace WMS.Web.Domain.IService
|
||||
{
|
||||
/// <summary>
|
||||
/// 改箱 移箱服务
|
||||
/// </summary>
|
||||
public interface IChangeMoveBoxService
|
||||
{
|
||||
Task<Result> Save(SaveChangeBoxRecordRequest dto, LoginInDto loginInfo);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
using Microsoft.EntityFrameworkCore.Storage;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace WMS.Web.Domain.Infrastructure
|
||||
{
|
||||
public interface ITransactionRepositories
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取事务 用来处理即时库存
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
IDbContextTransaction GetTransaction();
|
||||
|
||||
/// <summary>
|
||||
/// 获取事务 用来处理即时库存
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
bool CommitTransaction(bool isRollback, IDbContextTransaction transaction);
|
||||
}
|
||||
}
|
||||
20
src/WMS.Web.Domain/Mappers/ChangeBoxRecordMapper.cs
Normal file
20
src/WMS.Web.Domain/Mappers/ChangeBoxRecordMapper.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
using AutoMapper;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using WMS.Web.Core.Dto.ChangeBoxRecord;
|
||||
using WMS.Web.Domain.Entitys;
|
||||
|
||||
namespace WMS.Web.Domain.Mappers
|
||||
{
|
||||
/// <summary>
|
||||
/// 改箱
|
||||
/// </summary>
|
||||
public class ChangeBoxRecordMapper : Profile
|
||||
{
|
||||
public ChangeBoxRecordMapper()
|
||||
{
|
||||
CreateMap<SaveChangeBoxRecordRequest, ChangeBoxRecord>();
|
||||
}
|
||||
}
|
||||
}
|
||||
56
src/WMS.Web.Domain/Services/ChangeMoveBoxService.cs
Normal file
56
src/WMS.Web.Domain/Services/ChangeMoveBoxService.cs
Normal file
@@ -0,0 +1,56 @@
|
||||
using AutoMapper;
|
||||
using Microsoft.EntityFrameworkCore.Storage;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using WMS.Web.Core.Dto.ChangeBoxRecord;
|
||||
using WMS.Web.Core.Dto.Login;
|
||||
using WMS.Web.Core.Internal.Results;
|
||||
using WMS.Web.Domain.Entitys;
|
||||
using WMS.Web.Domain.Infrastructure;
|
||||
using WMS.Web.Domain.IService;
|
||||
using WMS.Web.Domain.IService.Public;
|
||||
using WMS.Web.Domain.Values;
|
||||
|
||||
namespace WMS.Web.Domain.Services
|
||||
{
|
||||
///改箱 移箱服务
|
||||
public class ChangeMoveBoxService : IChangeMoveBoxService
|
||||
{
|
||||
private readonly IMapper _mapper;
|
||||
private readonly ILoginService _loginService;
|
||||
private readonly IChangeBoxRecordRepositories _changeBoxRecordRepositories;
|
||||
public readonly ITransactionRepositories _transactionRepositories;
|
||||
public ChangeMoveBoxService(IMapper mapper, ILoginService loginService,
|
||||
IChangeBoxRecordRepositories changeBoxRecordRepositories, ITransactionRepositories transactionRepositories)
|
||||
{
|
||||
_mapper = mapper;
|
||||
_loginService = loginService;
|
||||
_changeBoxRecordRepositories = changeBoxRecordRepositories;
|
||||
_transactionRepositories = transactionRepositories;
|
||||
}
|
||||
|
||||
public async Task<Result> Save(SaveChangeBoxRecordRequest dto, LoginInDto loginInfo)
|
||||
{
|
||||
var entity = _mapper.Map<ChangeBoxRecord>(dto);
|
||||
entity.Create(loginInfo.UserInfo.StaffId);
|
||||
|
||||
//需要填写序列号
|
||||
//需要修改库存
|
||||
|
||||
IDbContextTransaction _transaction = _transactionRepositories.GetTransaction();
|
||||
bool isRollback = false;
|
||||
bool isSuccess = true;
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -16,5 +16,9 @@ namespace WMS.Web.Domain.Values
|
||||
/// 无效
|
||||
/// </summary>
|
||||
public static ValueTuple<int, string> Token_Invalid_Error = (401, "验证Token无效,请重新登录");
|
||||
/// <summary>
|
||||
/// 数据操作失败
|
||||
/// </summary>
|
||||
public static ValueTuple<int, string> DateWriteError = (40004, "数据操作失败");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user