出入库回退上下架
This commit is contained in:
@@ -16,11 +16,7 @@ namespace WMS.Web.Domain.Entitys
|
||||
/// <summary>
|
||||
/// ID
|
||||
/// </summary>
|
||||
public int Id { get; set; }
|
||||
/// <summary>
|
||||
/// 所属箱号ID
|
||||
/// </summary>
|
||||
public int BoxId { get; set; }
|
||||
public int Id { get; set; }
|
||||
/// <summary>
|
||||
/// 类型:1为入库回退下架,2为出库回退上架
|
||||
/// </summary>
|
||||
@@ -39,5 +35,15 @@ namespace WMS.Web.Domain.Entitys
|
||||
/// </summary>
|
||||
[NotMapped]
|
||||
public List<BackRecordDetails> Details = new List<BackRecordDetails>();
|
||||
|
||||
/// <summary>
|
||||
/// 创建
|
||||
/// </summary>
|
||||
/// <param name="creatorId"></param>
|
||||
public void Create(int creatorId)
|
||||
{
|
||||
this.CreatorId = creatorId;
|
||||
this.CreateTime = DateTime.Now;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,6 +21,10 @@ namespace WMS.Web.Domain.Entitys
|
||||
/// </summary>
|
||||
public int Fid { get; set; }
|
||||
/// <summary>
|
||||
/// 所属箱号ID
|
||||
/// </summary>
|
||||
public int BoxId { get; set; }
|
||||
/// <summary>
|
||||
/// 物料ID
|
||||
/// </summary>
|
||||
public int MaterialId { get; set; }
|
||||
|
||||
24
src/WMS.Web.Domain/IService/IBackRecordService.cs
Normal file
24
src/WMS.Web.Domain/IService/IBackRecordService.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using WMS.Web.Core.Dto.BackRecord;
|
||||
using WMS.Web.Core.Dto.Login;
|
||||
using WMS.Web.Core.Internal.Results;
|
||||
|
||||
namespace WMS.Web.Domain.IService
|
||||
{
|
||||
/// <summary>
|
||||
/// 出入库回退上下架:服务接口
|
||||
/// </summary>
|
||||
public interface IBackRecordService
|
||||
{
|
||||
/// <summary>
|
||||
/// 回退上下架
|
||||
/// </summary>
|
||||
/// <param name="dto"></param>
|
||||
/// <param name="loginInfo"></param>
|
||||
/// <returns></returns>
|
||||
Task<Result> BackShelf(SaveBackRecordRequest dto, LoginInDto loginInfo);
|
||||
}
|
||||
}
|
||||
@@ -4,6 +4,7 @@ using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using WMS.Web.Core.Dto;
|
||||
using WMS.Web.Core.Internal.Results;
|
||||
using WMS.Web.Domain.Entitys;
|
||||
|
||||
namespace WMS.Web.Domain.Infrastructure
|
||||
{
|
||||
@@ -18,5 +19,13 @@ namespace WMS.Web.Domain.Infrastructure
|
||||
/// <param name="dto"></param>
|
||||
/// <returns></returns>
|
||||
Task<ResultPagedList<BackRecordQueryResponse>> GetPagedList(BackRecordQueryRequest dto);
|
||||
|
||||
/// <summary>
|
||||
/// 新增
|
||||
/// </summary>
|
||||
/// <param name="entity"></param>
|
||||
/// <param name="isTransaction"></param>
|
||||
/// <returns></returns>
|
||||
Task<BackRecord> Add(BackRecord entity, bool isTransaction = true);
|
||||
}
|
||||
}
|
||||
|
||||
17
src/WMS.Web.Domain/Mappers/BackRecordMapper.cs
Normal file
17
src/WMS.Web.Domain/Mappers/BackRecordMapper.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
using AutoMapper;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using WMS.Web.Core.Dto.BackRecord;
|
||||
using WMS.Web.Domain.Entitys;
|
||||
|
||||
namespace WMS.Web.Domain.Mappers
|
||||
{
|
||||
public class BackRecordMapper : Profile
|
||||
{
|
||||
public BackRecordMapper()
|
||||
{
|
||||
CreateMap<SaveBackRecordDetailsRequest, BackRecordDetails>().ReverseMap();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -13,7 +13,7 @@ using WMS.Web.Domain.Options;
|
||||
namespace WMS.Web.Domain.QuartzJob
|
||||
{
|
||||
/// <summary>
|
||||
/// erp入库单-获取定时任务
|
||||
/// erp入库任务单-获取定时任务
|
||||
/// </summary>
|
||||
public class InStockOrderQuartzJob : IJob
|
||||
{
|
||||
|
||||
66
src/WMS.Web.Domain/Services/BackRecordService.cs
Normal file
66
src/WMS.Web.Domain/Services/BackRecordService.cs
Normal file
@@ -0,0 +1,66 @@
|
||||
using AutoMapper;
|
||||
using Microsoft.EntityFrameworkCore.Storage;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using WMS.Web.Core.Dto.BackRecord;
|
||||
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
|
||||
{
|
||||
/// <summary>
|
||||
/// 出入库回退上下架:服务接口
|
||||
/// </summary>
|
||||
public class BackRecordService: IBackRecordService
|
||||
{
|
||||
private readonly IMapper _mapper;
|
||||
private readonly ILoginService _loginService;
|
||||
public readonly ITransactionRepositories _transactionRepositories;
|
||||
private readonly IBackRecordRepositories _backRecordRepositories;
|
||||
public BackRecordService(IMapper mapper, ILoginService loginService,
|
||||
ITransactionRepositories transactionRepositories,
|
||||
IBackRecordRepositories backRecordRepositories)
|
||||
{
|
||||
_mapper = mapper;
|
||||
_loginService = loginService;
|
||||
_transactionRepositories = transactionRepositories;
|
||||
_backRecordRepositories = backRecordRepositories;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 回退上下架
|
||||
/// </summary>
|
||||
/// <param name="dto"></param>
|
||||
/// <param name="loginInfo"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<Result> BackShelf(SaveBackRecordRequest dto, LoginInDto loginInfo)
|
||||
{
|
||||
IDbContextTransaction _transaction = _transactionRepositories.GetTransaction();
|
||||
bool isRollback = false;
|
||||
bool isTransaction = false;
|
||||
|
||||
var entity = new BackRecord();
|
||||
entity.Type = (BackRecordType)dto.Type;
|
||||
entity.Details = _mapper.Map<List<BackRecordDetails>>(dto.Details);
|
||||
entity.Create(loginInfo.UserInfo.StaffId);
|
||||
entity = await _backRecordRepositories.Add(entity, isTransaction);
|
||||
|
||||
//提交事务
|
||||
var isSuccess = _transactionRepositories.CommitTransaction(isRollback, _transaction);
|
||||
if (!isSuccess)
|
||||
return Result.ReFailure(ResultCodes.DateWriteError);
|
||||
|
||||
if (entity != null)
|
||||
return Result.ReSuccess();
|
||||
else
|
||||
return Result.ReFailure(ResultCodes.DateWriteError);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user