Browse Source

生产退库加物料库位关系校验

dev_DY_CC
刘云峰 12 months ago
parent
commit
6240b94135
  1. 9
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/ProductionReturnNotes/ProductionReturnNoteAppService.cs

9
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/ProductionReturnNotes/ProductionReturnNoteAppService.cs

@ -46,6 +46,15 @@ public class ProductionReturnNoteAppService :
//[Authorize(ProductionReturnNotePermissions.Create)] //[Authorize(ProductionReturnNotePermissions.Create)]
public override async Task<ProductionReturnNoteDTO> CreateAsync(ProductionReturnNoteEditInput input) public override async Task<ProductionReturnNoteDTO> CreateAsync(ProductionReturnNoteEditInput input)
{ {
//校验物料和库存关系
foreach (var item in input.Details)
{
var obj = await _itemStoreRelationAppService.GetFirstAsync(item.ItemCode, item.ToLocationCode).ConfigureAwait(false);
if (obj == null)
{
throw new UserFriendlyException($"物料{item.ItemCode}不能存在目标库位{item.ToLocationCode},物料库存关系表不存在!");
}
}
var entity = ObjectMapper.Map<ProductionReturnNoteEditInput, ProductionReturnNote>(input); var entity = ObjectMapper.Map<ProductionReturnNoteEditInput, ProductionReturnNote>(input);
await _ProductionReturnNoteManager.CreateAsync(entity).ConfigureAwait(false); await _ProductionReturnNoteManager.CreateAsync(entity).ConfigureAwait(false);
var dto = ObjectMapper.Map<ProductionReturnNote, ProductionReturnNoteDTO>(entity); var dto = ObjectMapper.Map<ProductionReturnNote, ProductionReturnNoteDTO>(entity);

Loading…
Cancel
Save