Browse Source

添加盘点功能

dev_DY_CC
lvzb 1 year ago
parent
commit
22514ee223
  1. 8
      be/DataExchange/Iac/Win_in.Sfs.Wms.DataExchange.Iac.QadAgent/Properties/launchSettings.json
  2. 28
      be/Modules/Shared/src/Win_in.Sfs.Shared.Domain.Shared/Enums/Store/EnumInventoryMode.cs
  3. 6
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/CountJobs/DTOs/CountJobDTO.cs
  4. 3
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/CountJobs/ICountJobAppService.cs
  5. 6
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/CountJobs/Inputs/CountJobEditInput.cs
  6. 5
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/CountNotes/DTOs/CountNoteDTO.cs
  7. 6
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Plans/CountPlans/DTOs/CountPlanDTO.cs
  8. 1
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Plans/CountPlans/ICountPlanAppService.cs
  9. 6
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Plans/CountPlans/Inputs/CountPlanEditInput.cs
  10. 6
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Plans/CountPlans/Inputs/CountPlanImportInput.cs
  11. 26
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/CountJobs/CountJobAppService.cs
  12. 3
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/CountJobs/CountJobAutoMapperProfile.cs
  13. 14
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/CountNotes/CountNoteAutoMapperProfile.cs
  14. 10
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Plans/CountPlans/CountPlanAppService.cs
  15. 14
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Jobs/CountJobs/CountJob.cs
  16. 4
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Jobs/CountJobs/CountJobDependentDetail.cs
  17. 11
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Jobs/CountJobs/CountJobDetail.cs
  18. 60
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Jobs/CountJobs/CountJobManager.cs
  19. 2
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Jobs/CountJobs/ICountJobManager.cs
  20. 9
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/CountNotes/CountNote.cs
  21. 58
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/CountNotes/CountNoteDependentDetail.cs
  22. 61
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/CountNotes/CountNoteDetail.cs
  23. 49
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/CountNotes/CountNoteManager.cs
  24. 9
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Plans/CountPlans/CountPlan.cs
  25. 18
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Plans/CountPlans/CountPlanManager.cs
  26. 2
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Plans/CountPlans/ICountPlanManager.cs
  27. 1
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Jobs/CountJobs/CountJobDbContextModelCreatingExtensions.cs
  28. 34
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Notes/CountNotes/CountNoteDbContextModelCreatingExtensions.cs
  29. 2
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/StoreEntityFrameworkCoreModule.cs
  30. 16
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Jobs/CountJobAutoMapperProfile.cs
  31. 3
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Plans/CountPlanAutoMapperProfile.cs
  32. 11
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Jobs/CountJobEventHandler.cs
  33. 19
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/CountPlanEventHandler.cs

8
be/DataExchange/Iac/Win_in.Sfs.Wms.DataExchange.Iac.QadAgent/Properties/launchSettings.json

@ -0,0 +1,8 @@
{
"profiles": {
"WSL": {
"commandName": "WSL2",
"distributionName": ""
}
}
}

28
be/Modules/Shared/src/Win_in.Sfs.Shared.Domain.Shared/Enums/Store/EnumInventoryMode.cs

@ -0,0 +1,28 @@
using System.ComponentModel.DataAnnotations;
namespace Win_in.Sfs.Shared.Domain.Shared;
/// <summary>
/// 盘点模式
/// </summary>
public enum EnumInventoryMode
{
/// <summary>
/// 未定义
/// </summary>
[Display(Name = "未定义")]
None = 0,
/// <summary>
/// 箱码
/// </summary>
[Display(Name = "箱码")]
ByPackingCode = 1,
/// <summary>
/// 无箱码
/// </summary>
[Display(Name = "无箱码")]
ByErpItemCode = 2,
}

6
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/CountJobs/DTOs/CountJobDTO.cs

@ -30,6 +30,12 @@ public class CountJobDTO : SfsJobDTOBase<CountJobDetailDTO>
[Display(Name = "盘点方式")]
public EnumCountMethod CountMethod { get; set; }
/// <summary>
/// 盘点模式
/// </summary>
[Display(Name = "盘点模式")]
public EnumInventoryMode InventoryMode { get; set; }
/// <summary>
/// 类型
/// </summary>

3
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/CountJobs/ICountJobAppService.cs

@ -1,5 +1,6 @@
using System.Collections.Generic;
using System.Threading.Tasks;
using Win_in.Sfs.Wms.Store.Domain;
namespace Win_in.Sfs.Wms.Store.Application.Contracts;
@ -12,4 +13,6 @@ public interface ICountJobAppService
Task CancelByCountPlanAsync(string countPlanNumber);
Task CloseByCountPlanAsync(string countPlanNumber);
Task<List<CountJob>> GetCountJobDependentDetailByPlanNumber(string countPlanNumber,int inventoryStage);
Task<List<CountJobDTO>> ResetStatusByNumberAsync(List<string> numbers);
}

6
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/CountJobs/Inputs/CountJobEditInput.cs

@ -8,6 +8,12 @@ namespace Win_in.Sfs.Wms.Store.Application.Contracts;
public class CountJobEditInput : SfsJobCreateUpdateInputBase, ISfsJobCreateInput<CountJobDetailInput>
{
#region Base
/// <summary>
/// 盘点模式
/// </summary>
[Display(Name = "盘点模式")]
public EnumInventoryMode InventoryMode { get; set; }
/// <summary>
/// 盘点方式
/// </summary>

5
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/CountNotes/DTOs/CountNoteDTO.cs

@ -16,7 +16,10 @@ public class CountNoteDTO : SfsStoreDTOBase<CountNoteDetailDTO>, IHasNumber
/// </summary>
[Display(Name = "盘点计划单号")]
public string CountPlanNumber { get; set; }
/// <summary>
/// 盘点任务单号
/// </summary>
public string CountJobNumber { get; set; }
/// <summary>
/// 类型
/// </summary>

6
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Plans/CountPlans/DTOs/CountPlanDTO.cs

@ -58,6 +58,12 @@ public class CountPlanDTO : SfsStoreRequestDTOBase<CountPlanDetailDTO>
[Display(Name = "盘点方式")]
public EnumCountMethod CountMethod { get; set; }
/// <summary>
/// 盘点模式
/// </summary>
[Display(Name = "盘点模式")]
public EnumInventoryMode InventoryMode { get; set; }
/// <summary>
/// 盘点的零件集合
/// </summary>

1
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Plans/CountPlans/ICountPlanAppService.cs

@ -32,4 +32,5 @@ public interface ICountPlanAppService
Task ChangeStageAsync(Guid id, EnumCountStage stage);
Task ChangeStageAsync(Guid id, List<string> detailIdList, EnumCountStage stage);
Task ResetStatusByNumberAsync(string number);
}

6
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Plans/CountPlans/Inputs/CountPlanEditInput.cs

@ -58,6 +58,12 @@ public class CountPlanEditInput : SfsStoreRequestCreateOrUpdateInputBase, IHasNu
[Display(Name = "盘点方式")]
public EnumCountMethod CountMethod { get; set; }
/// <summary>
/// 盘点模式
/// </summary>
[Display(Name = "盘点模式")]
public EnumInventoryMode InventoryMode { get; set; }
/// <summary>
/// 类型
/// </summary>

6
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Plans/CountPlans/Inputs/CountPlanImportInput.cs

@ -51,4 +51,10 @@ public class CountPlanImportInput : SfsStoreImportInputBase
[Required(ErrorMessage = "{0}是必填项")]
public EnumCountMethod CountMethod { get; set; }
/// <summary>
/// 盘点模式
/// </summary>
[Display(Name = "盘点模式")]
public EnumInventoryMode InventoryMode { get; set; }
}

26
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/CountJobs/CountJobAppService.cs

@ -52,6 +52,20 @@ public class CountJobAppService
return dtoList;
}
/// <summary>
/// 根据选择的任务号码重置盘点任务
/// </summary>
/// <param name="numbers"></param>
/// <returns></returns>
[HttpPost("reset-status-by-number")]
public virtual async Task<List<CountJobDTO>> ResetStatusByNumberAsync(List<string> numbers)
{
var entityList= await _countJobManager.ResetStatusByNumberAsync(numbers).ConfigureAwait(false);
var dtoList = ObjectMapper.Map<List<CountJob>, List<CountJobDTO>>(entityList);
return dtoList;
}
public override async Task<CountJobDTO> CompleteAsync(Guid id, CountJobDTO dto)
{
var input = new CountJobCheckInput
@ -98,7 +112,19 @@ public class CountJobAppService
}
}
}
[HttpPost("get-countjob-dependent-detail-by-plannumber")]
public virtual async Task<List<CountJob>> GetCountJobDependentDetailByPlanNumber(string countPlanNumber, int inventoryStage)
{
var entities = await _repository.GetListAsync(p => p.JobStatus == EnumJobStatus.Done && p.CountPlanNumber == countPlanNumber && p.InventoryStage == inventoryStage, true).ConfigureAwait(false);
for (int i = entities.Count - 1; i >= 0; i--)
{
var entitie = entities[i];
entitie.DepDetails.RemoveAll(r => r.InventoryStage != inventoryStage);
entitie.Details.RemoveAll(r => r.InventoryStage != inventoryStage);
}
return entities;
}
//[HttpPost("handle-count-job-async")]
//public virtual async Task HandleCountJobAsync(Guid guid, CountJobDTO dto)
//{

3
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/CountJobs/CountJobAutoMapperProfile.cs

@ -77,7 +77,8 @@ public partial class StoreApplicationAutoMapperProfile : Profile
CreateMap<CountJobDetailDTO, CountJobDetail>()
;
CreateMap<CountJobDependentDetailDTO, CountJobDependentDetail>()
.ReverseMap();
CreateMap<CountJobDetailInput, CountJobDetail>()
.IgnoreAuditedObjectProperties()
.Ignore(x => x.MasterID)

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

@ -45,26 +45,16 @@ public partial class StoreApplicationAutoMapperProfile : Profile
.Ignore(x => x.Number);
CreateMap<CountNoteImportInput, CountNoteDetail>()
.ForMember(x => x.FirstCountQty, y => y.MapFrom(t => t.FirstCountQty))
.ForMember(x => x.FirstCountTime, y => y.MapFrom(t => DateTime.Now))
.ForMember(x => x.DetailStatus, y => y.MapFrom(t => EnumCountStatus.New))
.ForMember(x => x.FinalCountQty, y => y.MapFrom(t => t.FirstCountQty))
.Ignore(x => x.FirstCountOperator)
.Ignore(x => x.FirstCountDescription)
.Ignore(x => x.LocationArea)
.Ignore(x => x.LocationGroup)
.Ignore(x => x.LocationErpCode)
.Ignore(x => x.WarehouseCode)
.Ignore(x => x.Uom)
.Ignore(x => x.CountLabel)
.Ignore(x => x.RepeatCountQty)
.Ignore(x => x.RepeatCountTime)
.Ignore(x => x.RepeatCountOperator)
.Ignore(x => x.RepeatCountDescription)
.Ignore(x => x.AuditCountQty)
.Ignore(x => x.AuditCountTime)
.Ignore(x => x.AuditCountOperator)
.Ignore(x => x.AuditCountDescription)
.Ignore(x => x.Stage)
.Ignore(x => x.Adjusted)
.Ignore(X => X.StdPackQty)

10
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Plans/CountPlans/CountPlanAppService.cs

@ -131,6 +131,16 @@ public class CountPlanAppService :
await _countPlanManager.CompleteAsync(id, type).ConfigureAwait(false);
}
// <summary>
// 更新计划状态
// </summary>
// <param name="id"></param>
// <returns></returns>
[HttpPost("reset-by-number")]
public virtual async Task ResetStatusByNumberAsync(string number)
{
await _countPlanManager.ResetStatusByNumberAsync(number).ConfigureAwait(false);
}
[HttpPost("check-status")]
public virtual async Task CheckStatusAsync(string number)
{

14
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Jobs/CountJobs/CountJob.cs

@ -26,11 +26,22 @@ public class CountJob : SfsJobAggregateRootBase<CountJobDetail>
[IgnoreUpdate]
public EnumCountStage CountStage { get; set; }
/// <summary>
/// 盘点次数
/// </summary>
public int InventoryStage { get; set; }
/// <summary>
/// 盘点方式
/// </summary>
public EnumCountMethod CountMethod { get; set; }
/// <summary>
/// 盘点模式
/// </summary>
public EnumInventoryMode InventoryMode { get; set; }
/// <summary>
/// 类型
/// </summary>
@ -65,7 +76,6 @@ public class CountJob : SfsJobAggregateRootBase<CountJobDetail>
/// <summary>
/// 任务从表明细(记录每次扫得明细)
/// </summary>
[IgnoreUpdate]
public List<CountJobDependentDetail> DepDetails { get; set; } = new List<CountJobDependentDetail>();
/// <summary>
@ -86,7 +96,7 @@ public class CountJob : SfsJobAggregateRootBase<CountJobDetail>
detail.ExpireDate = expireDate;
detail.LocationCode = locationCode;
detail.CountQty = qty;
detail.CountQty = detail.CountQty+qty;
detail.CountTime = time;
detail.CountOperator = oper;
detail.CountDescription = desc;

4
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Jobs/CountJobs/CountJobDependentDetail.cs

@ -7,6 +7,10 @@ namespace Win_in.Sfs.Wms.Store.Domain;
public class CountJobDependentDetail : SfsJobDetailEntityBase, IHasCountResult, IHasInventoryQty
{
/// <summary>
/// 盘点次数
/// </summary>
public int InventoryStage { get; set; }
/// <summary>
/// 盘点标签
/// </summary>

11
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Jobs/CountJobs/CountJobDetail.cs

@ -6,7 +6,10 @@ namespace Win_in.Sfs.Wms.Store.Domain;
public class CountJobDetail : SfsJobDetailEntityBase, IHasCountResult, IHasInventoryQty
{
/// <summary>
/// 盘点计划单号
/// </summary>
public string CountPlanNumber { get; set; }
/// <summary>
/// 盘点标签
/// </summary>
@ -17,6 +20,12 @@ public class CountJobDetail : SfsJobDetailEntityBase, IHasCountResult, IHasInven
/// </summary>
public decimal InventoryQty { get; set; }
/// <summary>
/// 盘点次数
/// </summary>
public int InventoryStage { get; set; }
/// <summary>
/// 计量单位
/// </summary>

60
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Jobs/CountJobs/CountJobManager.cs

@ -9,6 +9,7 @@ using Volo.Abp.Users;
using Volo.Abp.Validation;
using Win_in.Sfs.Shared.Domain;
using Win_in.Sfs.Shared.Domain.Shared;
using Win_in.Sfs.Shared.Event;
using Win_in.Sfs.Wms.Inventory.Application.Contracts;
namespace Win_in.Sfs.Wms.Store.Domain;
@ -16,17 +17,48 @@ namespace Win_in.Sfs.Wms.Store.Domain;
public class CountJobManager : SfsJobManagerBase<CountJob, CountJobDetail>, ICountJobManager
{
private readonly IBalanceAppService _balanceAppService;
private readonly ICountJobRepository _repository;
private readonly ICountNoteRepository _noteRepository;
public CountJobManager(
ICountJobRepository repository,
IBalanceAppService balanceAppService
ICountJobRepository repository,
IBalanceAppService balanceAppService,
ICountNoteRepository noteRepository
) : base(repository)
{
_noteRepository = noteRepository;
_balanceAppService = balanceAppService;
_repository = repository;
}
/// <summary>
/// 根据选择的任务号码重置盘点任务
/// </summary>
/// <param name="numbers"></param>
/// <returns></returns>
/// <exception cref="UserFriendlyException"></exception>
public virtual async Task<List<CountJob>> ResetStatusByNumberAsync(List<string> numbers)
{
var joblist = await _repository.GetListAsync(r => numbers.Contains(r.Number)).ConfigureAwait(false);
var planNumbers = joblist.Select(r => r.CountPlanNumber).Distinct();
if (planNumbers.Count() > 1)
{
throw new UserFriendlyException($"所选任务属于多个盘点计划,无法重盘!");
}
foreach (var job in joblist)
{
var note = await _noteRepository.FindAsync(r => r.CountJobNumber == job.Number).ConfigureAwait(false);
if (note != null && note.Adjusted == true)
{
throw new UserFriendlyException($"任务号 【{job.Number}】生成的记录【{note.Number}】已经进行了调整,无法重盘");
}
job.JobStatus = EnumJobStatus.Open;
}
await _repository.UpdateManyAsync(joblist).ConfigureAwait(false);
await LocalEventBus.PublishAsync(new SfsSubmittedEntityEventData<List<CountJob>>(joblist), false).ConfigureAwait(false);
return joblist;
}
/// <summary>
/// 执行任务
/// </summary>
@ -41,7 +73,15 @@ public class CountJobManager : SfsJobManagerBase<CountJob, CountJobDetail>, ICou
//entity.ConcurrencyStamp = input.ConcurrencyStamp;
await SetDetailsAsync(input, entity).ConfigureAwait(false);
return await base.CompleteAsync(entity, user).ConfigureAwait(false);
// return await base.CompleteAsync(entity, user).ConfigureAwait(false);
entity.CompleteUserId = user.Id;
entity.CompleteUserName = user.Name;
entity.CompleteTime = Clock.Now;
await PublishCompletedAsync(entity).ConfigureAwait(false);
return await _repository.UpdateAsync(entity).ConfigureAwait(false);
}
/// <summary>
@ -96,11 +136,19 @@ public class CountJobManager : SfsJobManagerBase<CountJob, CountJobDetail>, ICou
}
else
{
await entity.SetDetail(detail.Id, detail.SupplierBatch, detail.ArriveDate, detail.ProduceDate, detail.ExpireDate, detail.LocationCode, detail.CountQty, detail.CountTime, detail.CountOperator, detail.CountDescription)
.ConfigureAwait(false);
}
}
foreach (var depDetail in input.DepDetails)
{
var jobDepDetail = ObjectMapper.Map<CountJobDependentDetail, CountJobDependentDetail>(depDetail);
var number = entity.Number;
jobDepDetail.SetIdAndNumber(GuidGenerator, entity.Id, number);
jobDepDetail.CountLabel = GuidGenerator.Create().ToString();
entity.DepDetails.Add(jobDepDetail);
}
}
public override void CheckDetails(CountJob entity, AbpValidationResult result)

2
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Jobs/CountJobs/ICountJobManager.cs

@ -12,5 +12,5 @@ public interface ICountJobManager : IJobManager<CountJob>
Task UpdateManyAsync(IList<CountJob> countJobs);
Task<List<CountJob>> CreateWithConditionAsync(CountPlan entity, List<string> partCondition, List<string> locCondition, List<EnumInventoryStatus> statusList);
Task<List<CountJob>> ResetStatusByNumberAsync(List<string> numbers);
}

9
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/CountNotes/CountNote.cs

@ -17,6 +17,11 @@ public class CountNote : SfsStoreAggregateRootBase<CountNoteDetail>
/// </summary>
public string CountPlanNumber { get; set; }
/// <summary>
/// 盘点任务单号
/// </summary>
public string CountJobNumber { get; set; }
/// <summary>
/// 类型
/// </summary>
@ -56,6 +61,10 @@ public class CountNote : SfsStoreAggregateRootBase<CountNoteDetail>
/// 明细列表
/// </summary>
public override List<CountNoteDetail> Details { get; set; } = new List<CountNoteDetail>();
/// <summary>
/// 记录从表明细(记录每次扫得明细)
/// </summary>
public List<CountNoteDependentDetail> DepDetails { get; set; } = new List<CountNoteDependentDetail>();
public virtual async Task GenerateAdjustRequestAsync()
{

58
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/CountNotes/CountNoteDependentDetail.cs

@ -0,0 +1,58 @@
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Win_in.Sfs.Shared.Domain;
namespace Win_in.Sfs.Wms.Store.Domain;
public class CountNoteDependentDetail : SfsStoreDetailWithLotPackingLocationStatusEntityBase, IHasCountResult, IHasInventoryQty
{
/// <summary>
/// 盘点标签
/// </summary>
public string CountLabel { get; set; }
/// <summary>
/// 库存数量
/// </summary>
public decimal InventoryQty { get; set; }
/// <summary>
/// 计量单位
/// </summary>
[Display(Name = "计量单位")]
public string Uom { get; set; }
/// <summary>
/// 库存库位
/// </summary>
public string InventoryLocationCode { get; set; }
/// <summary>
/// 盘点数量(每次扫得数量)
/// </summary>
public decimal CountQty { get; set; }
/// <summary>
/// 盘点时间
/// </summary>
public DateTime? CountTime { get; set; }
/// <summary>
/// 盘点操作员
/// </summary>
public string CountOperator { get; set; }
/// <summary>
/// 盘点描述
/// </summary>
public string CountDescription { get; set; }
/// <summary>
/// 标包数量
/// </summary>
[Display(Name = "标包数量")]
[Column(TypeName = "decimal(18,6)")]
public decimal StdPackQty { get; set; }
}

61
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/CountNotes/CountNoteDetail.cs

@ -10,7 +10,6 @@ namespace Win_in.Sfs.Wms.Store.Domain;
/// 盘点计划明细
/// </summary>
public class CountNoteDetail : SfsStoreDetailWithLotPackingLocationStatusEntityBase
, IHasCountDetail
, IHasStdPack
{
/// <summary>
@ -34,66 +33,6 @@ public class CountNoteDetail : SfsStoreDetailWithLotPackingLocationStatusEntityB
/// </summary>
public decimal InventoryQty { get; set; }
/// <summary>
/// 初盘数量
/// </summary>
public decimal FirstCountQty { get; set; }
/// <summary>
/// 初盘时间
/// </summary>
public DateTime? FirstCountTime { get; set; }
/// <summary>
/// 初盘操作员
/// </summary>
public string FirstCountOperator { get; set; }
/// <summary>
/// 初盘描述
/// </summary>
public string FirstCountDescription { get; set; }
/// <summary>
/// 重盘数量
/// </summary>
public decimal RepeatCountQty { get; set; }
/// <summary>
/// 重盘时间
/// </summary>
public DateTime? RepeatCountTime { get; set; }
/// <summary>
/// 重盘操作员
/// </summary>
public string RepeatCountOperator { get; set; }
/// <summary>
/// 重盘描述
/// </summary>
public string RepeatCountDescription { get; set; }
/// <summary>
/// 监盘数量
/// </summary>
public decimal AuditCountQty { get; set; }
/// <summary>
/// 监盘时间
/// </summary>
public DateTime? AuditCountTime { get; set; }
/// <summary>
/// 监盘操作员
/// </summary>
public string AuditCountOperator { get; set; }
/// <summary>
/// 监盘描述
/// </summary>
public string AuditCountDescription { get; set; }
/// <summary>
/// 最终盘点数量
/// </summary>

49
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/CountNotes/CountNoteManager.cs

@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Volo.Abp;
using Volo.Abp.Uow;
using Win_in.Sfs.Shared.Domain.Shared;
namespace Win_in.Sfs.Wms.Store.Domain;
@ -26,6 +27,48 @@ public class CountNoteManager : SfsStoreManagerBase<CountNote, CountNoteDetail>,
_repository = repository;
_countPlanRepository = countPlanRepository;
}
/// <summary>
/// 创建
/// </summary>
/// <param name="entity"></param>
/// <returns></returns>
[UnitOfWork]
public override async Task<CountNote> CreateAsync(CountNote entity)
{
entity.SetIdAndNumberWithDetails(GuidGenerator, await GenerateNumberAsync(typeof(CountNote).Name, entity.ActiveDate).ConfigureAwait(false));
foreach (var item in entity.DepDetails)
{
item.SetIdAndNumber(GuidGenerator,entity.Id,entity.Number);
}
await PublishCreatedAsync(entity).ConfigureAwait(false);
await Repository.InsertAsync(entity).ConfigureAwait(false);
return entity;
}
/// <summary>
/// 批量创建
/// </summary>
/// <param name="entities"></param>
/// <returns></returns>
[UnitOfWork]
public override async Task<List<CountNote>> CreateManyAsync(List<CountNote> entities)
{
List<CountNote> deleteItems = new List<CountNote>();
foreach (var entity in entities)
{
var deleteentity=await Repository.GetAsync(r=>r.CountJobNumber== entity.CountJobNumber).ConfigureAwait(false);
deleteItems.Add(deleteentity);
entity.SetIdAndNumberWithDetails(GuidGenerator, await GenerateNumberAsync(typeof(CountNote).Name, entity.ActiveDate).ConfigureAwait(false));
}
//先删除之前得记录
await Repository.DeleteManyAsync(deleteItems).ConfigureAwait(false);
await Repository.InsertManyAsync(entities).ConfigureAwait(false);
await PublishCreatedAsync(entities).ConfigureAwait(false);
return entities;
}
/// <summary>
/// 开始调整库存
@ -157,11 +200,7 @@ public class CountNoteManager : SfsStoreManagerBase<CountNote, CountNoteDetail>,
detail.ExpireDate = detail.ProduceDate.AddDays(validateDays);
detail.CountLabel = Guid.NewGuid().ToString();
detail.FirstCountQty = detail.FirstCountQty;
detail.FirstCountTime = DateTime.Now;
detail.FirstCountOperator = note.Worker;
detail.FinalCountQty = detail.FirstCountQty;
detail.FinalCountQty = detail.FinalCountQty;
detail.DetailStatus = EnumCountStatus.New;
detail.Stage = EnumCountStage.First;
detail.Adjusted = false;

9
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Plans/CountPlans/CountPlan.cs

@ -24,6 +24,11 @@ public class CountPlan : SfsStoreRequestAggregateRootBase<CountPlanDetail>
/// </summary>
public EnumCountStage Stage { get; set; }
/// <summary>
/// 盘点次数
/// </summary>
public int InventoryStage { get; set; }
/// <summary>
/// 盘点执行形式
/// </summary>
@ -33,6 +38,10 @@ public class CountPlan : SfsStoreRequestAggregateRootBase<CountPlanDetail>
/// 盘点方式
/// </summary>
public EnumCountMethod CountMethod { get; set; }
/// <summary>
/// 盘点模式
/// </summary>
public EnumInventoryMode InventoryMode { get; set; }
/// <summary>
/// 描述

18
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Plans/CountPlans/CountPlanManager.cs

@ -284,7 +284,21 @@ public class CountPlanManager : SfsStoreRequestManagerBase<CountPlan, CountPlanD
entity.SetDetails(type);
await base.CompleteAsync(entity).ConfigureAwait(false);
}
/// <summary>
/// 根据plannumber更新主表状态和子表状态
/// </summary>
/// <param name="number"></param>
/// <returns></returns>
public virtual async Task ResetStatusByNumberAsync(string number)
{
var entity = await Repository.GetAsync(r=>r.Number==number).ConfigureAwait(false);
entity.RequestStatus = EnumRequestStatus.Handling;
entity.Details.ForEach(p=>
{
p.DetailStatus = EnumCountStatus.New;
});
}
/// <summary>
/// job执行后更新计划
/// </summary>
@ -334,7 +348,7 @@ public class CountPlanManager : SfsStoreRequestManagerBase<CountPlan, CountPlanD
entity.AddDetail(entityDetail);
entityDetail.FinalCountQty = planDetail.FinalCountQty; //赋值终盘数量
entityDetail.DetailStatus = EnumCountStatus.Completed; //赋值明细状态已完成
// entityDetail.DetailStatus = EnumCountStatus.Completed; //赋值明细状态已完成
}
await Repository.UpdateAsync(entity).ConfigureAwait(false);

2
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Plans/CountPlans/ICountPlanManager.cs

@ -21,5 +21,5 @@ public interface ICountPlanManager : ISfsStoreRequestManager<CountPlan, CountPla
/// </summary>
/// <returns></returns>
Task CompleteByJobAsync(CountPlan entity);
Task ResetStatusByNumberAsync(string number);
}

1
be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Jobs/CountJobs/CountJobDbContextModelCreatingExtensions.cs

@ -42,6 +42,7 @@ public static class CountJobDbContextModelCreatingExtensions
b.ConfigureByConvention();
//Configure Sfs base properties
b.ConfigureSfsBase();
//Configure Job base properties
b.ConfigureJobDetail();
//Properties

34
be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Notes/CountNotes/CountNoteDbContextModelCreatingExtensions.cs

@ -27,6 +27,7 @@ public static class CountNoteDbContextModelCreatingExtensions
//Relations
b.HasMany(q => q.Details).WithOne().HasForeignKey(d => d.MasterID).IsRequired();
b.HasMany(q => q.DepDetails).WithOne().HasForeignKey(d => d.MasterID).IsRequired();
//Indexes
b.HasIndex(q => new { q.Number }).IsUnique();
@ -47,15 +48,6 @@ public static class CountNoteDbContextModelCreatingExtensions
//Properties
b.Property(q => q.CountPlanNumber).HasMaxLength(SfsPropertyConst.CodeLength);
b.Property(q => q.CountLabel).IsRequired().HasMaxLength(SfsPropertyConst.CodeLength);
b.Property(q => q.FirstCountQty).HasPrecision(18, 6);
b.Property(q => q.FirstCountOperator).HasMaxLength(SfsPropertyConst.CodeLength);
b.Property(q => q.FirstCountDescription).HasMaxLength(SfsPropertyConst.CodeLength);
b.Property(q => q.RepeatCountQty).HasPrecision(18, 6);
b.Property(q => q.RepeatCountOperator).HasMaxLength(SfsPropertyConst.CodeLength);
b.Property(q => q.RepeatCountDescription).HasMaxLength(SfsPropertyConst.CodeLength);
b.Property(q => q.AuditCountQty).HasPrecision(18, 6);
b.Property(q => q.AuditCountOperator).HasMaxLength(SfsPropertyConst.CodeLength);
b.Property(q => q.AuditCountDescription).HasMaxLength(SfsPropertyConst.CodeLength);
b.Property(q => q.FinalCountQty).HasPrecision(18, 6);
b.Property(q => q.DetailStatus).HasMaxLength(SfsPropertyConst.NameLength).HasConversion<string>();
b.Property(q => q.Stage).HasMaxLength(SfsPropertyConst.NameLength).HasConversion<string>();
@ -65,5 +57,29 @@ public static class CountNoteDbContextModelCreatingExtensions
//Indexes
b.HasIndex(q => new { q.Number, q.CountLabel }).IsUnique();
});
builder.Entity<CountNoteDependentDetail>(b =>
{
//Configure table & schema name
b.ToTable(options.TablePrefix + nameof(CountNoteDependentDetail), options.Schema);
//Configure ABP properties
b.ConfigureByConvention();
//Configure Sfs base properties
b.ConfigureSfsStoreBase();
//Configure Sfs store detail properties
b.ConfigureSfsStoreDetailBase();
b.ConfigureStoreDetailWithLotPackingLocationStatus();
//Properties
b.Property(q => q.CountLabel).IsRequired().HasMaxLength(SfsPropertyConst.CodeLength);
b.Property(q => q.InventoryLocationCode).HasMaxLength(SfsPropertyConst.CodeLength);
b.Property(q => q.CountOperator).HasMaxLength(SfsPropertyConst.CodeLength);
b.Property(q => q.CountDescription).HasMaxLength(SfsPropertyConst.CodeLength);
//Relations
//None
//Indexes
//b.HasIndex(q => new { q.PackingCode }).IsUnique();
});
}
}

2
be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/StoreEntityFrameworkCoreModule.cs

@ -296,7 +296,7 @@ public class StoreEntityFrameworkCoreModule : AbpModule
options.Entity<PurchaseReceiptNote>(orderOptions =>
orderOptions.DefaultWithDetailsFunc = query => query.Include(o => o.Details));
options.Entity<CountNote>(orderOptions =>
orderOptions.DefaultWithDetailsFunc = query => query.Include(o => o.Details));
orderOptions.DefaultWithDetailsFunc = query => query.Include(o => o.Details).Include(o => o.DepDetails));
options.Entity<InspectNote>(orderOptions =>
orderOptions.DefaultWithDetailsFunc = query => query.Include(o => o.Details)
.Include(o => o.SummaryDetails));

16
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Jobs/CountJobAutoMapperProfile.cs

@ -1,5 +1,6 @@
using AutoMapper;
using Volo.Abp.AutoMapper;
using Win_in.Sfs.Shared.Domain.Shared;
using Win_in.Sfs.Wms.Store.Application.Contracts;
using Win_in.Sfs.Wms.Store.Domain;
@ -106,6 +107,8 @@ public partial class StoreEventAutoMapperProfile : Profile
// .ForMember(x => x.Item, y => y.MapFrom(d => new Item(d.ItemName, d.ItemDesc1, d.ItemDesc2)))
// .ForMember(x => x.Batch, y => y.MapFrom(d => new Batch(d.SupplierBatch, d.ArriveDate, d.ProduceDate, d.ExpireDate)))
.ForMember(x => x.InventoryLocationCode, y => y.MapFrom(d => d.LocationCode))
.ForMember(x => x.CountPlanNumber, y => y.MapFrom(d => d.Number))
.Ignore(x=>x.InventoryStage)
.Ignore(x => x.MasterID)
.Ignore(x => x.Number)
.Ignore(x => x.Id)
@ -116,5 +119,18 @@ public partial class StoreEventAutoMapperProfile : Profile
.Ignore(x => x.CountDescription)
;
CreateMap<CountJob, CountNote>()
.ForMember(x => x.Stage, y => y.MapFrom(d => d.CountStage))
.ForMember(x => x.BeginTime, y => y.MapFrom(d => d.CreationTime))
.ForMember(x => x.EndTime, y => y.MapFrom(d => d.CompleteTime))
.ForMember(x => x.CountJobNumber, y => y.MapFrom(d => d.Number))
.Ignore(x => x.Adjusted)
.Ignore(x => x.ActiveDate);
CreateMap<CountJobDetail, CountNoteDetail>()
.ForMember(x => x.FinalCountQty, y => y.MapFrom(d => d.CountQty))
.ForMember(x => x.DetailStatus, y => y.MapFrom(d => EnumCountStatus.New))
.Ignore(x => x.Stage)
.Ignore(x => x.Adjusted);
CreateMap<CountJobDependentDetail, CountNoteDependentDetail>();
}
}

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

@ -53,12 +53,15 @@ public partial class StoreEventAutoMapperProfile : Profile
CreateMap<CountPlan, CountNote>()
.ForMember(x => x.CountPlanNumber, y => y.MapFrom(d => d.Number))
.Ignore(x => x.Adjusted)
.Ignore(x=>x.DepDetails)
.Ignore(x=>x.CountJobNumber)
;
CreateMap<CountPlanDetail, CountNoteDetail>()
.ForMember(x => x.CountPlanNumber, y => y.MapFrom(d => d.Number))
.Ignore(x => x.Adjusted)
;
CreateMap<CountJobDependentDetail, CountNoteDependentDetail>();
}
}

11
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Jobs/CountJobEventHandler.cs

@ -1,4 +1,5 @@
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Volo.Abp;
using Volo.Abp.EventBus;
@ -13,6 +14,7 @@ namespace Win_in.Sfs.Wms.Store.Event.BusinessJob;
public class CountJobEventHandler :
StoreEventHandlerBase
, ILocalEventHandler<SfsCompletedEntityEventData<CountJob>>
,ILocalEventHandler<SfsSubmittedEntityEventData<List<CountJob>>>
{
private readonly ICountPlanAppService _countPlanAppService;
private readonly ICountNoteAppService _countNoteAppService;
@ -42,6 +44,15 @@ public class CountJobEventHandler :
}
}
[UnitOfWork]
public virtual async Task HandleEventAsync(SfsSubmittedEntityEventData<List<CountJob>> eventData)
{
var entity = eventData.Entity.First();
if (!string.IsNullOrEmpty(entity.CountPlanNumber))
{
await _countPlanAppService.ResetStatusByNumberAsync(entity.CountPlanNumber).ConfigureAwait(false);
}
}
private async Task<CountPlanEditInput> BuildCountPlanJobUpdateDTO(CountJob entity)
{
var countPlanUpdateInput = ObjectMapper.Map<CountJob, CountPlanEditInput>(entity);

19
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/CountPlanEventHandler.cs

@ -106,13 +106,18 @@ public class CountPlanEventHandler
var entity = eventData.Entity;
await ThawEqualBalancesAsync(entity).ConfigureAwait(false);
var jobs= await _countJobAppService.GetCountJobDependentDetailByPlanNumber(entity.Number,entity.InventoryStage).ConfigureAwait(false);
//创建盘点记录
var countNote = BuildCountNote(entity);
if (countNote.Details.Count > 0)
List<CountNote> notes = new List<CountNote>();
foreach (var job in jobs)
{
var countNote = ObjectMapper.Map<CountJob, CountNote>(job);
notes.Add(countNote);
}
if (notes.Count > 0)
{
await _countNoteManager.CreateAsync(countNote).ConfigureAwait(false);
await _countNoteManager.CreateManyAsync(notes).ConfigureAwait(false);
}
await _countJobAppService.CloseByCountPlanAsync(entity.Number).ConfigureAwait(false);
@ -126,16 +131,18 @@ public class CountPlanEventHandler
/// </summary>
/// <param name="countPlan"></param>
/// <returns></returns>
private CountNote BuildCountNote(CountPlan countPlan)
private CountNote BuildCountNote(CountPlan countPlan,List<CountJobDependentDetail> depDetail)
{
var countNote = ObjectMapper.Map<CountPlan, CountNote>(countPlan);
countNote.Details = new List<CountNoteDetail>();
foreach (var countPlanDetail in countPlan.Details.Where(p => p.DetailStatus == EnumCountStatus.Completed))
{
var countNoteDetail = ObjectMapper.Map<CountPlanDetail, CountNoteDetail>(countPlanDetail);
countNote.Details.Add(countNoteDetail);
}
var depDetails = ObjectMapper.Map<List<CountJobDependentDetail>, List<CountNoteDependentDetail>>(depDetail);
countNote.DepDetails.AddRange(depDetails);
return countNote;
}

Loading…
Cancel
Save