盘点单
This commit is contained in:
@@ -35,11 +35,6 @@ namespace WMS.Web.Domain.Entitys
|
||||
[Column("CreatorId")]
|
||||
public int CreatorId { get; set; }
|
||||
/// <summary>
|
||||
/// 公司ID
|
||||
/// </summary>
|
||||
[Column("CompanyId")]
|
||||
public int CompanyId { get; set; }
|
||||
/// <summary>
|
||||
/// 同步成功或者失败 null 就是未同步
|
||||
/// </summary>
|
||||
[Column("SuccessSync")]
|
||||
@@ -48,5 +43,14 @@ namespace WMS.Web.Domain.Entitys
|
||||
/// 明细
|
||||
/// </summary>
|
||||
public List<TakeStockDetails> Details = new List<TakeStockDetails>();
|
||||
/// <summary>
|
||||
/// 创建
|
||||
/// </summary>
|
||||
/// <param name="creatorId"></param>
|
||||
public void Create(int creatorId)
|
||||
{
|
||||
this.CreatorId = creatorId;
|
||||
this.Date = DateTime.Now;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ namespace WMS.Web.Domain.Entitys
|
||||
[Column("Fid")]
|
||||
public int Fid { get; set; }
|
||||
/// <summary>
|
||||
/// 单据头Id
|
||||
/// 箱Id
|
||||
/// </summary>
|
||||
[Column("BoxId")]
|
||||
public int BoxId { get; set; }
|
||||
|
||||
19
src/WMS.Web.Domain/IService/ITakeStockService.cs
Normal file
19
src/WMS.Web.Domain/IService/ITakeStockService.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using WMS.Web.Core.Dto.Login;
|
||||
using WMS.Web.Core.Dto.TakeStock;
|
||||
using WMS.Web.Core.Internal.Results;
|
||||
|
||||
namespace WMS.Web.Domain.IService
|
||||
{
|
||||
/// <summary>
|
||||
/// 盘点单服务
|
||||
/// </summary>
|
||||
public interface ITakeStockService
|
||||
{
|
||||
//保存
|
||||
Task<Result> Save(List<SaveTakeStockRequest> dto, LoginInDto loginInfo);
|
||||
}
|
||||
}
|
||||
@@ -13,7 +13,7 @@ namespace WMS.Web.Domain.Infrastructure
|
||||
// 新增
|
||||
Task<ChangeBoxRecord> Add(ChangeBoxRecord entity, bool isTransaction = true);
|
||||
|
||||
// 获取销售列表
|
||||
// 获取列表
|
||||
Task<(List<ChangeBoxRecordQueryInfoResponse> list,int total)> GetListAsync(ChangeBoxRecordQueryRequest dto);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ namespace WMS.Web.Domain.Infrastructure
|
||||
{
|
||||
// 新增
|
||||
Task<MoveBoxRecord> Add(MoveBoxRecord entity, bool isTransaction = true);
|
||||
// 获取销售列表
|
||||
// 获取列表
|
||||
Task<(List<MoveBoxRecordQueryInfoResponse> list, int total)> GetListAsync(MoveBoxRecordQueryRequest dto);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using WMS.Web.Core.Dto.TakeStock;
|
||||
using WMS.Web.Domain.Entitys;
|
||||
|
||||
namespace WMS.Web.Domain.Infrastructure
|
||||
@@ -10,5 +11,7 @@ namespace WMS.Web.Domain.Infrastructure
|
||||
{
|
||||
// 新增
|
||||
Task<TakeStock> Add(TakeStock entity, bool isTransaction = true);
|
||||
// 获取列表
|
||||
Task<(List<TakeStockQueryInfoResponse> list, int total)> GetListAsync(TakeStockQueryRequest dto);
|
||||
}
|
||||
}
|
||||
|
||||
18
src/WMS.Web.Domain/Mappers/MoveBoxRecordMapper.cs
Normal file
18
src/WMS.Web.Domain/Mappers/MoveBoxRecordMapper.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
using AutoMapper;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using WMS.Web.Core.Dto.ChangeBoxRecord;
|
||||
using WMS.Web.Core.Dto.MoveBoxRecord;
|
||||
using WMS.Web.Domain.Entitys;
|
||||
|
||||
namespace WMS.Web.Domain.Mappers
|
||||
{
|
||||
public class MoveBoxRecordMapper : Profile
|
||||
{
|
||||
public MoveBoxRecordMapper()
|
||||
{
|
||||
CreateMap<SaveMoveBoxRecordRequest, MoveBoxRecord>();
|
||||
}
|
||||
}
|
||||
}
|
||||
17
src/WMS.Web.Domain/Mappers/TakeStockMapper.cs
Normal file
17
src/WMS.Web.Domain/Mappers/TakeStockMapper.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
using AutoMapper;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using WMS.Web.Core.Dto.TakeStock;
|
||||
using WMS.Web.Domain.Entitys;
|
||||
|
||||
namespace WMS.Web.Domain.Mappers
|
||||
{
|
||||
public class TakeStockMapper:Profile
|
||||
{
|
||||
public TakeStockMapper()
|
||||
{
|
||||
CreateMap<SaveTakeStockRequest, TakeStockDetails>();
|
||||
}
|
||||
}
|
||||
}
|
||||
65
src/WMS.Web.Domain/Services/TakeStockService.cs
Normal file
65
src/WMS.Web.Domain/Services/TakeStockService.cs
Normal file
@@ -0,0 +1,65 @@
|
||||
using AutoMapper;
|
||||
using Microsoft.EntityFrameworkCore.Storage;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using WMS.Web.Core.Dto.Login;
|
||||
using WMS.Web.Core.Dto.TakeStock;
|
||||
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 TakeStockService : ITakeStockService
|
||||
{
|
||||
private readonly IMapper _mapper;
|
||||
private readonly ILoginService _loginService;
|
||||
public readonly ITransactionRepositories _transactionRepositories;
|
||||
private readonly ITakeStockRepositories _takeStockRepositories;
|
||||
public TakeStockService(IMapper mapper, ILoginService loginService,
|
||||
ITransactionRepositories transactionRepositories,
|
||||
ITakeStockRepositories takeStockRepositories)
|
||||
{
|
||||
_mapper = mapper;
|
||||
_loginService = loginService;
|
||||
_transactionRepositories = transactionRepositories;
|
||||
_takeStockRepositories = takeStockRepositories;
|
||||
}
|
||||
/// <summary>
|
||||
/// 保存
|
||||
/// </summary>
|
||||
/// <param name="dto"></param>
|
||||
/// <param name="loginInfo"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<Result> Save(List<SaveTakeStockRequest> dto, LoginInDto loginInfo)
|
||||
{
|
||||
TakeStock entity = new TakeStock();
|
||||
entity.Details = _mapper.Map<List<TakeStockDetails>>(dto);
|
||||
entity.Create(loginInfo.UserInfo.StaffId);
|
||||
|
||||
//需要填写序列号
|
||||
//需要修改库存
|
||||
|
||||
IDbContextTransaction _transaction = _transactionRepositories.GetTransaction();
|
||||
bool isRollback = false;
|
||||
bool isSuccess = true;
|
||||
entity = await _takeStockRepositories.Add(entity, true);
|
||||
if (entity == null) isRollback = true;
|
||||
|
||||
//提交事务
|
||||
isSuccess = _transactionRepositories.CommitTransaction(isRollback, _transaction);
|
||||
if (!isSuccess)
|
||||
return Result.ReFailure(ResultCodes.DateWriteError);
|
||||
|
||||
return Result.ReSuccess();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user