生成-物料收发明细
This commit is contained in:
@@ -2491,6 +2491,51 @@
|
|||||||
单位
|
单位
|
||||||
</summary>
|
</summary>
|
||||||
</member>
|
</member>
|
||||||
|
<member name="T:WMS.Web.Core.Dto.Inventory.InventoryInOutDetailsGenerateDto">
|
||||||
|
<summary>
|
||||||
|
物料收发明细-生成dto
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:WMS.Web.Core.Dto.Inventory.InventoryInOutDetailsGenerateDto.StockCode">
|
||||||
|
<summary>
|
||||||
|
仓库编码
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:WMS.Web.Core.Dto.Inventory.InventoryInOutDetailsGenerateDto.SubStockId">
|
||||||
|
<summary>
|
||||||
|
仓位ID
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:WMS.Web.Core.Dto.Inventory.InventoryInOutDetailsGenerateDto.BoxId">
|
||||||
|
<summary>
|
||||||
|
箱ID
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:WMS.Web.Core.Dto.Inventory.InventoryInOutDetailsGenerateDto.MaterialId">
|
||||||
|
<summary>
|
||||||
|
物料ID
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:WMS.Web.Core.Dto.Inventory.InventoryInOutDetailsGenerateDto.OrderType">
|
||||||
|
<summary>
|
||||||
|
单据类型
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:WMS.Web.Core.Dto.Inventory.InventoryInOutDetailsGenerateDto.OrderBillNo">
|
||||||
|
<summary>
|
||||||
|
单据编号
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:WMS.Web.Core.Dto.Inventory.InventoryInOutDetailsGenerateDto.Qty">
|
||||||
|
<summary>
|
||||||
|
数量:出入库
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:WMS.Web.Core.Dto.Inventory.InventoryInOutDetailsGenerateDto.InventoryInOutType">
|
||||||
|
<summary>
|
||||||
|
类型:1为入库,2为出库
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
<member name="T:WMS.Web.Core.Dto.Inventory.InventoryInOutDetailsQueryRequest">
|
<member name="T:WMS.Web.Core.Dto.Inventory.InventoryInOutDetailsQueryRequest">
|
||||||
<summary>
|
<summary>
|
||||||
物料收发明细-查询请求
|
物料收发明细-查询请求
|
||||||
|
|||||||
@@ -823,6 +823,16 @@
|
|||||||
仓库编码
|
仓库编码
|
||||||
</summary>
|
</summary>
|
||||||
</member>
|
</member>
|
||||||
|
<member name="P:WMS.Web.Domain.Entitys.InventoryInOutDetails.SubStockId">
|
||||||
|
<summary>
|
||||||
|
仓位ID
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:WMS.Web.Domain.Entitys.InventoryInOutDetails.BoxId">
|
||||||
|
<summary>
|
||||||
|
箱ID
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
<member name="P:WMS.Web.Domain.Entitys.InventoryInOutDetails.OrderType">
|
<member name="P:WMS.Web.Domain.Entitys.InventoryInOutDetails.OrderType">
|
||||||
<summary>
|
<summary>
|
||||||
单据类型
|
单据类型
|
||||||
@@ -1901,6 +1911,15 @@
|
|||||||
<param name="isTransaction"></param>
|
<param name="isTransaction"></param>
|
||||||
<returns></returns>
|
<returns></returns>
|
||||||
</member>
|
</member>
|
||||||
|
<member name="M:WMS.Web.Domain.Infrastructure.IInventoryDetailsRepositories.GetListBy(System.Collections.Generic.List{System.Int32},System.Collections.Generic.List{System.String},System.Collections.Generic.List{System.Int32})">
|
||||||
|
<summary>
|
||||||
|
列表-根据物料和仓库和仓位
|
||||||
|
</summary>
|
||||||
|
<param name="materialIds"></param>
|
||||||
|
<param name="stockCodes"></param>
|
||||||
|
<param name="subStockIds"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
<member name="T:WMS.Web.Domain.Infrastructure.IInventoryInOutDetailsRepositories">
|
<member name="T:WMS.Web.Domain.Infrastructure.IInventoryInOutDetailsRepositories">
|
||||||
<summary>
|
<summary>
|
||||||
物料收发明细-仓储接口
|
物料收发明细-仓储接口
|
||||||
@@ -2259,6 +2278,19 @@
|
|||||||
<param name="loginInfo"></param>
|
<param name="loginInfo"></param>
|
||||||
<returns></returns>
|
<returns></returns>
|
||||||
</member>
|
</member>
|
||||||
|
<member name="T:WMS.Web.Domain.IService.IInventoryInOutDetailsService">
|
||||||
|
<summary>
|
||||||
|
物料收发明细:服务接口
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="M:WMS.Web.Domain.IService.IInventoryInOutDetailsService.GenerateInOrOutDetails(System.Collections.Generic.List{WMS.Web.Core.Dto.Inventory.InventoryInOutDetailsGenerateDto},System.Boolean)">
|
||||||
|
<summary>
|
||||||
|
生成:物料收发明细
|
||||||
|
</summary>
|
||||||
|
<param name="dtos"></param>
|
||||||
|
<param name="isTransaction"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
<member name="T:WMS.Web.Domain.IService.IOutStockService">
|
<member name="T:WMS.Web.Domain.IService.IOutStockService">
|
||||||
<summary>
|
<summary>
|
||||||
出库服务
|
出库服务
|
||||||
@@ -3385,6 +3417,19 @@
|
|||||||
<param name="loginInfo"></param>
|
<param name="loginInfo"></param>
|
||||||
<returns></returns>
|
<returns></returns>
|
||||||
</member>
|
</member>
|
||||||
|
<member name="T:WMS.Web.Domain.Services.InventoryInOutDetailsService">
|
||||||
|
<summary>
|
||||||
|
物料收发明细:服务
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="M:WMS.Web.Domain.Services.InventoryInOutDetailsService.GenerateInOrOutDetails(System.Collections.Generic.List{WMS.Web.Core.Dto.Inventory.InventoryInOutDetailsGenerateDto},System.Boolean)">
|
||||||
|
<summary>
|
||||||
|
生成:物料收发明细
|
||||||
|
</summary>
|
||||||
|
<param name="dtos"></param>
|
||||||
|
<param name="isTransaction"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
<member name="T:WMS.Web.Domain.Services.OutStockService">
|
<member name="T:WMS.Web.Domain.Services.OutStockService">
|
||||||
<summary>
|
<summary>
|
||||||
出库服务
|
出库服务
|
||||||
|
|||||||
@@ -0,0 +1,55 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace WMS.Web.Core.Dto.Inventory
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 物料收发明细-生成dto
|
||||||
|
/// </summary>
|
||||||
|
public class InventoryInOutDetailsGenerateDto
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 仓库编码
|
||||||
|
/// </summary>
|
||||||
|
public string StockCode { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 仓位ID
|
||||||
|
/// </summary>
|
||||||
|
public int SubStockId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 箱ID
|
||||||
|
/// </summary>
|
||||||
|
public int BoxId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 物料ID
|
||||||
|
/// </summary>
|
||||||
|
public int MaterialId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 单据类型
|
||||||
|
/// </summary>
|
||||||
|
public int OrderType { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 单据编号
|
||||||
|
/// </summary>
|
||||||
|
public string OrderBillNo { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 数量:出入库
|
||||||
|
/// </summary>
|
||||||
|
public decimal Qty { get; set; }
|
||||||
|
///// <summary>
|
||||||
|
///// 结存
|
||||||
|
///// </summary>
|
||||||
|
//public decimal SurplusQty { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 类型:1为入库,2为出库
|
||||||
|
/// </summary>
|
||||||
|
public int InventoryInOutType { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -31,6 +31,16 @@ namespace WMS.Web.Domain.Entitys
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public string StockCode { get; set; }
|
public string StockCode { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 仓位ID
|
||||||
|
/// </summary>
|
||||||
|
public int SubStockId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 箱ID
|
||||||
|
/// </summary>
|
||||||
|
public int BoxId { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 单据类型
|
/// 单据类型
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
23
src/WMS.Web.Domain/IService/IInventoryInOutDetailsService.cs
Normal file
23
src/WMS.Web.Domain/IService/IInventoryInOutDetailsService.cs
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using WMS.Web.Core.Dto.Inventory;
|
||||||
|
using WMS.Web.Core.Internal.Results;
|
||||||
|
|
||||||
|
namespace WMS.Web.Domain.IService
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 物料收发明细:服务接口
|
||||||
|
/// </summary>
|
||||||
|
public interface IInventoryInOutDetailsService
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 生成:物料收发明细
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="dtos"></param>
|
||||||
|
/// <param name="isTransaction"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task<Result> GenerateInOrOutDetails(List<InventoryInOutDetailsGenerateDto> dtos, bool isTransaction);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -35,5 +35,14 @@ namespace WMS.Web.Domain.Infrastructure
|
|||||||
/// <param name="isTransaction"></param>
|
/// <param name="isTransaction"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task<bool> UpdateRange(List<InventoryDetails> entitys, bool isTransaction = true);
|
Task<bool> UpdateRange(List<InventoryDetails> entitys, bool isTransaction = true);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 列表-根据物料和仓库和仓位
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="materialIds"></param>
|
||||||
|
/// <param name="stockCodes"></param>
|
||||||
|
/// <param name="subStockIds"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task<List<InventoryDetails>> GetListBy(List<int> materialIds, List<string> stockCodes, List<int> subStockIds);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,7 +36,14 @@ namespace WMS.Web.Domain.Mappers
|
|||||||
//箱库存映射
|
//箱库存映射
|
||||||
CreateMap<BoxInventoryGenerateDto, BoxInventory>();
|
CreateMap<BoxInventoryGenerateDto, BoxInventory>();
|
||||||
CreateMap<BoxInventoryGenerateDetailsDto, BoxInventoryDetails>();
|
CreateMap<BoxInventoryGenerateDetailsDto, BoxInventoryDetails>();
|
||||||
|
|
||||||
|
//物料收发明细-映射
|
||||||
|
CreateMap<InventoryInOutDetailsGenerateDto, InventoryInOutDetails>()
|
||||||
|
.ForMember(x => x.OrderType, ops => ops.MapFrom(x => x.OrderType))
|
||||||
|
.ForMember(x => x.Type, ops => ops.MapFrom(x => x.InventoryInOutType));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
78
src/WMS.Web.Domain/Services/InventoryInOutDetailsService.cs
Normal file
78
src/WMS.Web.Domain/Services/InventoryInOutDetailsService.cs
Normal file
@@ -0,0 +1,78 @@
|
|||||||
|
using AutoMapper;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using WMS.Web.Core.Dto.Inventory;
|
||||||
|
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.Values;
|
||||||
|
|
||||||
|
namespace WMS.Web.Domain.Services
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 物料收发明细:服务
|
||||||
|
/// </summary>
|
||||||
|
public class InventoryInOutDetailsService: IInventoryInOutDetailsService
|
||||||
|
{
|
||||||
|
private readonly IMapper _mapper;
|
||||||
|
private readonly IBoxRepositories _boxRepositories;
|
||||||
|
private readonly ISerialNumbersRepositories _serialNumbersRepositories;
|
||||||
|
private readonly IInventoryDetailsRepositories _inventoryDetailsRepositories;
|
||||||
|
private readonly IInventoryInOutDetailsRepositories _inventoryInOutDetailsRepositories;
|
||||||
|
public InventoryInOutDetailsService(IMapper mapper, IBoxRepositories boxRepositories,
|
||||||
|
ISerialNumbersRepositories serialNumbersRepositories,
|
||||||
|
IInventoryDetailsRepositories inventoryDetailsRepositories,
|
||||||
|
IInventoryInOutDetailsRepositories inventoryInOutDetailsRepositories)
|
||||||
|
{
|
||||||
|
_mapper = mapper;
|
||||||
|
_boxRepositories = boxRepositories;
|
||||||
|
_inventoryDetailsRepositories = inventoryDetailsRepositories;
|
||||||
|
_serialNumbersRepositories = serialNumbersRepositories;
|
||||||
|
_inventoryInOutDetailsRepositories = inventoryInOutDetailsRepositories;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 生成:物料收发明细
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="dtos"></param>
|
||||||
|
/// <param name="isTransaction"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public async Task<Result> GenerateInOrOutDetails(List<InventoryInOutDetailsGenerateDto> dtos,bool isTransaction)
|
||||||
|
{
|
||||||
|
//找到物料对应的即时库存明细
|
||||||
|
var materialIds = dtos.Select(x => x.MaterialId).ToList();
|
||||||
|
var stockCodes = dtos.GroupBy(x => x.StockCode).Select(x => x.Key).ToList();
|
||||||
|
var subStockIds = dtos.GroupBy(x => x.SubStockId).Select(x => x.Key).ToList();
|
||||||
|
var inventoryDetails=await _inventoryDetailsRepositories.GetListBy(materialIds, stockCodes, subStockIds);
|
||||||
|
|
||||||
|
//1.创建要新增的对象
|
||||||
|
var add_entitys = new List<InventoryInOutDetails>();
|
||||||
|
|
||||||
|
//2.遍历:box库存来源数据明细
|
||||||
|
foreach (var dto in dtos)
|
||||||
|
{
|
||||||
|
//2.1当前的即时库存明细
|
||||||
|
var currentDetail= inventoryDetails.Where(x => x.MaterialId == dto.MaterialId && x.StockCode == dto.StockCode && x.SubStockId == dto.SubStockId).FirstOrDefault();
|
||||||
|
|
||||||
|
//2.2组装物料收发明细实体
|
||||||
|
var entity = _mapper.Map<InventoryInOutDetails>(dto);
|
||||||
|
entity.SurplusQty = currentDetail == null ? 0 : currentDetail.Qty;
|
||||||
|
add_entitys.Add(entity);
|
||||||
|
}
|
||||||
|
|
||||||
|
var isSuccess = true;
|
||||||
|
if (add_entitys.Count != 0)
|
||||||
|
{
|
||||||
|
isSuccess = await _inventoryInOutDetailsRepositories.AddRange(add_entitys, isTransaction);
|
||||||
|
if(!isSuccess)
|
||||||
|
return Result.ReFailure(ResultCodes.InventoryInOutDetailsWriteError);
|
||||||
|
}
|
||||||
|
|
||||||
|
return Result.ReSuccess();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -51,6 +51,7 @@ namespace WMS.Web.Domain.Values
|
|||||||
public static ValueTuple<int, string> BoxInventoryMaterialNoDataError = (800041, "箱物料库存数据不存在,请稍候再试!");
|
public static ValueTuple<int, string> BoxInventoryMaterialNoDataError = (800041, "箱物料库存数据不存在,请稍候再试!");
|
||||||
public static ValueTuple<int, string> BoxInventoryNoInventoryError = (800012, "箱库存物料数量不足,请核对后再试!");
|
public static ValueTuple<int, string> BoxInventoryNoInventoryError = (800012, "箱库存物料数量不足,请核对后再试!");
|
||||||
public static ValueTuple<int, string> BoxInventoryHaveInventoryError = (800013, "该箱库存已经存在,请核对后再试!");
|
public static ValueTuple<int, string> BoxInventoryHaveInventoryError = (800013, "该箱库存已经存在,请核对后再试!");
|
||||||
|
public static ValueTuple<int, string> InventoryInOutDetailsWriteError = (800014, "写入物料收发明细失败!");
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -293,6 +293,8 @@ namespace WMS.Web.Repositories.DependencyInjection
|
|||||||
Services.AddTransient<IOutStockTaskService, OutStockTaskService>();
|
Services.AddTransient<IOutStockTaskService, OutStockTaskService>();
|
||||||
Services.AddTransient<ISerialNumberService, SerialNumberService>();
|
Services.AddTransient<ISerialNumberService, SerialNumberService>();
|
||||||
Services.AddTransient<IBoxInventoryService, BoxInventoryService>();
|
Services.AddTransient<IBoxInventoryService, BoxInventoryService>();
|
||||||
|
Services.AddTransient<IInventoryInOutDetailsService, InventoryInOutDetailsService>();
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -168,5 +168,19 @@ namespace WMS.Web.Repositories
|
|||||||
{
|
{
|
||||||
return await GetPagedList(dto);
|
return await GetPagedList(dto);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 列表-根据物料和仓库和仓位
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="materialIds"></param>
|
||||||
|
/// <param name="stockCodes"></param>
|
||||||
|
/// <param name="subStockIds"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public async Task<List<InventoryDetails>> GetListBy(List<int> materialIds, List<string> stockCodes, List<int> subStockIds)
|
||||||
|
{
|
||||||
|
return await _context.InventoryDetails.Where(x => materialIds.Contains(x.MaterialId) &&
|
||||||
|
stockCodes.Contains(x.StockCode) &&
|
||||||
|
subStockIds.Contains(x.SubStockId) ).ToListAsync();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user