Browse Source

修改 盘点

集成Redis
郑勃旭 2 years ago
parent
commit
f9650e8d5f
  1. 1
      be/Modules/Shared/src/Win_in.Sfs.Shared.Application/SfsCrudWithDetailsAppServiceBase.cs
  2. 8
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/CountNotes/Inputs/CountNoteImportInput.cs
  3. 9
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/CountAdjustNotes/CountAdjustNoteAutoMapperProfile.cs
  4. 51
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/CountNotes/CountNoteAppService.cs
  5. 1
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/CountNotes/CountNoteAutoMapperProfile.cs
  6. 18
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/CountAdjustRequests/CountAdjustRequestAppService.cs
  7. 2
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Plans/CountPlanAutoMapperProfile.cs

1
be/Modules/Shared/src/Win_in.Sfs.Shared.Application/SfsCrudWithDetailsAppServiceBase.cs

@ -512,7 +512,6 @@ public abstract class SfsCrudWithDetailsAppServiceBase<TEntity, TEntityDto, TReq
/// <summary>
/// 导入数据具体实现,可重写
/// </summary>
//[UnitOfWork]
protected virtual async Task<SfsImportResult> ImportInternalAsync(SfsImportRequestInput requestInput, byte[] inputFileBytes)
{
IList<TImportInput> modelList = null;

8
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/CountNotes/Inputs/CountNoteImportInput.cs

@ -1,4 +1,5 @@
using System.ComponentModel.DataAnnotations;
using Win_in.Sfs.Shared.Domain.Shared;
namespace Win_in.Sfs.Wms.Store.Application.Contracts;
@ -39,6 +40,13 @@ public class CountNoteImportInput : SfsStoreImportInputBase
[Required(ErrorMessage = "{0}是必填项", AllowEmptyStrings = true)]
public string PackingCode { get; set; }
/// <summary>
/// 库存状态
/// </summary>
[Display(Name = "库存状态")]
[Required(ErrorMessage = "{0}是必填项", AllowEmptyStrings = true)]
public EnumInventoryStatus Status { get; set; }
/// <summary>
/// 托码
/// </summary>

9
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/CountAdjustNotes/CountAdjustNoteAutoMapperProfile.cs

@ -21,5 +21,14 @@ public partial class StoreApplicationAutoMapperProfile : Profile
.Ignore(x => x.TenantId)
.Ignore(x => x.Number)
.Ignore(x => x.Id);
CreateMap<CountAdjustNoteEditInput, CountAdjustNote>()
.IgnoreAuditedObjectProperties()
.Ignore(x => x.TenantId)
.Ignore(x => x.Number)
.Ignore(x => x.Id)
.Ignore(x => x.ExtraProperties)
.Ignore(x => x.Remark)
;
}
}

51
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/CountNotes/CountNoteAppService.cs

@ -7,6 +7,8 @@ using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using Volo.Abp;
using Volo.Abp.Domain.Repositories;
using Win_in.Sfs.Basedata.Application.Contracts;
using Win_in.Sfs.Shared.Application.Contracts;
using Win_in.Sfs.Shared.Domain;
using Win_in.Sfs.Shared.Domain.Shared;
using Win_in.Sfs.Wms.Store.Application.Contracts;
@ -27,14 +29,18 @@ public class CountNoteAppService :
{
private readonly ICountNoteManager _countNoteManager;
private readonly ICountPlanAppService _countPlanAppService;
private readonly ILocationAppService _locationAppService;
private readonly IItemBasicAppService _itemBasicAppService;
public CountNoteAppService(
ICountNoteRepository repository,
ICountNoteManager countNoteManager, ICountPlanAppService countPlanAppService) : base(repository)
ICountNoteManager countNoteManager, ICountPlanAppService countPlanAppService, ILocationAppService locationAppService, IItemBasicAppService itemBasicAppService) : base(repository)
{
_countNoteManager = countNoteManager;
_countPlanAppService = countPlanAppService;
_locationAppService = locationAppService;
_itemBasicAppService = itemBasicAppService;
}
#region 东阳
@ -44,20 +50,25 @@ public class CountNoteAppService :
/// </summary>
/// <param name="dictionary"></param>
/// <returns></returns>
protected async override Task<Dictionary<CountNote, EntityState>> ImportProcessingEntityAsync(Dictionary<CountNote, EntityState> dictionary)
protected override async Task<Dictionary<CountNote, EntityState>> ImportProcessingEntityAsync(Dictionary<CountNote, EntityState> dictionary)
{
var addList = dictionary.Where(p => p.Value == EntityState.Added).Select(p => p.Key);
var dataList = dictionary.Select(p => p.Key);//查询所有的导入盘点数据
var resultDictionary = new Dictionary<CountNote, EntityState>();
foreach (var countNote in addList)
var allCountPlanNumbersList= dataList.GroupBy(p => p.CountPlanNumber).Select(p => p.Key).ToList();
//特殊处理 因为盘点记录可以重复导入 所以每次导入前删除调原有记录
foreach (var countPlanNumber in allCountPlanNumbersList)
{
var countPlanDto=await _countPlanAppService.GetByNumberAsync(countNote.CountPlanNumber).ConfigureAwait(false);
var countPlanDto = await _countPlanAppService.GetByNumberAsync(countPlanNumber).ConfigureAwait(false);
if (countPlanDto.RequestType != CountPlanRequestType.Import)
{
throw new UserFriendlyException("非Excel盘点执行方式不能使用导入");
}
//特殊处理 因为盘点记录可以重复导入 所以每次导入前删除调原有记录
//_repository.DeleteAsync(p=>p.CountPlanNumber==CountPlan)
await _repository.DeleteAsync(p => p.CountPlanNumber == countPlanNumber).ConfigureAwait(false);
}
foreach (var countNote in dataList)
{
countNote.Worker = CurrentUser.GetUserName();
countNote.CreatorId = CurrentUser.Id;
countNote.BeginTime= DateTime.Now;
@ -65,13 +76,29 @@ public class CountNoteAppService :
countNote.EndTime=DateTime.Now;
countNote.Stage = EnumCountStage.Audit;
//foreach (var detail in purchaseReturnRequest.Details)
//{
//}
foreach (var detail in countNote.Details)
{
var locationDto= await _locationAppService.GetByCodeAsync(detail.LocationCode).ConfigureAwait(false);
var itemcBasicDto=await _itemBasicAppService.GetByCodeAsync(detail.ItemCode).ConfigureAwait(false);
detail.CountLabel =Guid.NewGuid().ToString();
detail.LocationArea = locationDto.AreaCode;
detail.LocationGroup= locationDto.LocationGroupCode;
detail.LocationErpCode= locationDto.ErpLocationCode;
detail.WarehouseCode= locationDto.WarehouseCode;
detail.ItemCode = itemcBasicDto.Code;
detail.ItemDesc1 = itemcBasicDto.Desc1;
detail.ItemDesc2 = itemcBasicDto.Desc2;
detail.ItemName= itemcBasicDto.Name;
detail.Uom = itemcBasicDto.BasicUom;
}
resultDictionary.Add(countNote,EntityState.Added);
}
return dictionary;
return resultDictionary;
}
#endregion

1
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/CountNotes/CountNoteAutoMapperProfile.cs

@ -69,7 +69,6 @@ public partial class StoreApplicationAutoMapperProfile : Profile
.Ignore(x => x.Adjusted)
.Ignore(X => X.StdPackQty)
.Ignore(x => x.ItemName).Ignore(x => x.ItemDesc1).Ignore(x => x.ItemDesc2)
.Ignore(x => x.Status)
.Ignore(x => x.SupplierBatch)
.Ignore(x => x.ArriveDate)
.Ignore(x => x.ProduceDate)

18
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/CountAdjustRequests/CountAdjustRequestAppService.cs

@ -25,22 +25,4 @@ public abstract class CountAdjustRequestAppService :
{
_countAdjustRequestManager = countAdjustRequestManager;
}
/// <summary>
/// 【创建】盘点调整申请
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost("")]
//[Authorize(CountAdjustRequestPermissions.Create)]
public override async Task<CountAdjustRequestDTO> CreateAsync(CountAdjustRequestEditInput input)
{
var entity = ObjectMapper.Map<CountAdjustRequestEditInput, CountAdjustRequest>(input);
await _countAdjustRequestManager.CreateAsync(entity).ConfigureAwait(false);
var dto = ObjectMapper.Map<CountAdjustRequest, CountAdjustRequestDTO>(entity);
return dto;
}
}

2
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Plans/CountPlanAutoMapperProfile.cs

@ -52,13 +52,11 @@ public partial class StoreEventAutoMapperProfile : Profile
//盘点计划映射到盘点记录
CreateMap<CountPlan, CountNote>()
.ForMember(x => x.CountPlanNumber, y => y.MapFrom(d => d.Number))
.Ignore(x => x.Adjusted)
;
CreateMap<CountPlanDetail, CountNoteDetail>()
.ForMember(x => x.CountPlanNumber, y => y.MapFrom(d => d.Number))
.Ignore(x => x.Adjusted)
;

Loading…
Cancel
Save