Browse Source

Merge branch 'dev_DY_CC' of http://dev.ccwin-in.com:3000/BoXu.Zheng/WZC2 into dev_DY_CC

dev_DY_CC
赵新宇 1 year ago
parent
commit
a9a222b989
  1. 3
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/MaterialRequests/AssembleRequests/AssembleRequestAutoMapperProfile.cs
  2. 31
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/MaterialRequests/CoatingMaterialRequests/CoatingMaterialRequestAppService.cs
  3. 5
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/MaterialRequests/CoatingMaterialRequests/CoatingMaterialRequestAutoMapperProfile.cs
  4. 1
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/MaterialRequests/InjectionRequests/InjectionRequestAppService.cs
  5. 8
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/MaterialRequests/AssembleRequests/AssembleRequest.cs
  6. 48
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/MaterialRequests/AssembleRequests/AssembleRequestDetail.cs
  7. 75
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/MaterialRequests/AssembleRequests/AssembleRequestManager.cs
  8. 3
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/MaterialRequests/AssembleRequests/IAssembleRequestManager.cs
  9. 20
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/MaterialRequests/CoatingMaterialRequests/CoatingMaterialRequest.cs
  10. 44
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/MaterialRequests/CoatingMaterialRequests/CoatingMaterialRequestDetail.cs
  11. 238
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/MaterialRequests/CoatingMaterialRequests/CoatingMaterialRequestManager.cs
  12. 3
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/MaterialRequests/CoatingMaterialRequests/ICoatingMaterialRequestManager.cs
  13. 1
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/MaterialRequests/InjectionRequests/IInjectionRequestManager.cs
  14. 2
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/MaterialRequests/InjectionRequests/InjectionRequestDetail.cs
  15. 76
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/MaterialRequests/InjectionRequests/InjectionRequestManager.cs
  16. 3
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Requests/MaterialRequests/AssembleRequests/AssembleRequestDbContextModelCreatingExtensions.cs
  17. 5
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Requests/MaterialRequests/CoatingMaterialRequestDbContextModelCreatingExtensions.cs
  18. 4
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/AssembleRequestEventHandler.cs
  19. 6
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/CoatingMaterialRequestEventHandler.cs
  20. 2
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/Note/CoatingIssueNoteEventHandler.cs

3
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/MaterialRequests/AssembleRequests/AssembleRequestAutoMapperProfile.cs

@ -29,7 +29,6 @@ public partial class StoreApplicationAutoMapperProfile : Profile
CreateMap<AssembleRequestImportInput, AssembleRequest>() CreateMap<AssembleRequestImportInput, AssembleRequest>()
.IgnoreAuditedObjectProperties() .IgnoreAuditedObjectProperties()
.ForMember(x => x.Type, y => y.MapFrom(t => t.Type.ToString())) .ForMember(x => x.Type, y => y.MapFrom(t => t.Type.ToString()))
.Ignore(x => x.ProdLine)
.Ignore(x => x.UseOnTheWayLocation) .Ignore(x => x.UseOnTheWayLocation)
.Ignore(x => x.Details) .Ignore(x => x.Details)
.Ignore(x => x.Remark) .Ignore(x => x.Remark)
@ -50,8 +49,6 @@ public partial class StoreApplicationAutoMapperProfile : Profile
.Ignore(x => x.ToLocationGroup) .Ignore(x => x.ToLocationGroup)
.Ignore(x => x.ItemName).Ignore(x => x.ItemDesc1).Ignore(x => x.ItemDesc2) .Ignore(x => x.ItemName).Ignore(x => x.ItemDesc1).Ignore(x => x.ItemDesc2)
.Ignore(x => x.ProdLine) .Ignore(x => x.ProdLine)
.Ignore(x => x.WorkStation)
.Ignore(x => x.ExpiredTime)
.Ignore(x => x.IssuedQty) .Ignore(x => x.IssuedQty)
.Ignore(x => x.ReceivedQty) .Ignore(x => x.ReceivedQty)
.Ignore(x => x.ToBeIssuedQty) .Ignore(x => x.ToBeIssuedQty)

31
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/MaterialRequests/CoatingMaterialRequests/CoatingMaterialRequestAppService.cs

@ -161,15 +161,6 @@ public class CoatingMaterialRequestAppService : SfsStoreRequestAppServiceBase<Co
} }
} }
//检验备料计划是否存在要料请求
if (!string.IsNullOrWhiteSpace(input.PreparationPlanNumber))
{
var exist = await CheckExistByPreparationPlanAsync(input.PreparationPlanNumber).ConfigureAwait(false);
if (exist.Count > 0)
{
throw new UserFriendlyException($"{input.PreparationPlanNumber} 备料计划已存在要料申请");
}
}
foreach (var item in input.Details) //赋值生产线 foreach (var item in input.Details) //赋值生产线
{ {
@ -268,15 +259,7 @@ public class CoatingMaterialRequestAppService : SfsStoreRequestAppServiceBase<Co
} }
} }
//检验备料计划是否存在要料请求
if (!string.IsNullOrWhiteSpace(input.PreparationPlanNumber))
{
var exist = await CheckExistByPreparationPlanAsync(input.PreparationPlanNumber).ConfigureAwait(false);
if (exist.Count > 0)
{
throw new UserFriendlyException($"{input.PreparationPlanNumber} 备料计划已存在要料申请");
}
}
foreach (var detailInput in input.Details) //赋值生产线 foreach (var detailInput in input.Details) //赋值生产线
{ {
@ -339,18 +322,6 @@ public class CoatingMaterialRequestAppService : SfsStoreRequestAppServiceBase<Co
return dto; return dto;
} }
/// <summary>
/// 检验备料计划是否存在要料请求
/// </summary>
/// <param name="preparationPlanNumber"></param>
/// <returns></returns>
private async Task<List<CoatingMaterialRequest>> CheckExistByPreparationPlanAsync(string preparationPlanNumber)
{
var entities = await _repository.GetListAsync(c => c.PreparationPlanNumber == preparationPlanNumber)
.ConfigureAwait(false);
return entities;
}
/// <summary> /// <summary>
/// 根据类型获取叫料请求 /// 根据类型获取叫料请求
/// </summary> /// </summary>

5
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/MaterialRequests/CoatingMaterialRequests/CoatingMaterialRequestAutoMapperProfile.cs

@ -28,9 +28,6 @@ public partial class StoreApplicationAutoMapperProfile : Profile
CreateMap<CoatingMaterialRequestImportInput, CoatingMaterialRequest>() CreateMap<CoatingMaterialRequestImportInput, CoatingMaterialRequest>()
.IgnoreAuditedObjectProperties() .IgnoreAuditedObjectProperties()
.ForMember(x => x.Type, y => y.MapFrom(t => t.Type.ToString())) .ForMember(x => x.Type, y => y.MapFrom(t => t.Type.ToString()))
.Ignore(x => x.PreparationPlanNumber)
.Ignore(x => x.ProdLine)
.Ignore(x => x.Workshop)
.Ignore(x => x.UseOnTheWayLocation) .Ignore(x => x.UseOnTheWayLocation)
.Ignore(x => x.Details) .Ignore(x => x.Details)
.Ignore(x => x.Remark) .Ignore(x => x.Remark)
@ -51,8 +48,6 @@ public partial class StoreApplicationAutoMapperProfile : Profile
.Ignore(x => x.ToLocationGroup) .Ignore(x => x.ToLocationGroup)
.Ignore(x => x.ItemName).Ignore(x => x.ItemDesc1).Ignore(x => x.ItemDesc2) .Ignore(x => x.ItemName).Ignore(x => x.ItemDesc1).Ignore(x => x.ItemDesc2)
.Ignore(x => x.ProdLine) .Ignore(x => x.ProdLine)
.Ignore(x => x.WorkStation)
.Ignore(x => x.ExpiredTime)
.Ignore(x => x.IssuedQty) .Ignore(x => x.IssuedQty)
.Ignore(x => x.ReceivedQty) .Ignore(x => x.ReceivedQty)
.Ignore(x => x.ToBeIssuedQty) .Ignore(x => x.ToBeIssuedQty)

1
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/MaterialRequests/InjectionRequests/InjectionRequestAppService.cs

@ -186,6 +186,7 @@ public class InjectionRequestAppService : SfsStoreRequestAppServiceBase<Injectio
detail.ItemDesc2 = itemBasicDto.Desc2; detail.ItemDesc2 = itemBasicDto.Desc2;
detail.ItemName = itemBasicDto.Name; detail.ItemName = itemBasicDto.Name;
detail.Uom = itemBasicDto.BasicUom; detail.Uom = itemBasicDto.BasicUom;
detail.StdPackQty = itemBasicDto.StdPackQty;
} }
} }

8
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/MaterialRequests/AssembleRequests/AssembleRequest.cs

@ -5,7 +5,7 @@ using Win_in.Sfs.Shared.Domain.Entities;
namespace Win_in.Sfs.Wms.Store.Domain; namespace Win_in.Sfs.Wms.Store.Domain;
/// <summary> /// <summary>
/// 装配申请 /// 装配叫料申请
/// </summary> /// </summary>
public class AssembleRequest : SfsStoreRequestAggregateRootBase<AssembleRequestDetail> public class AssembleRequest : SfsStoreRequestAggregateRootBase<AssembleRequestDetail>
{ {
@ -16,12 +16,6 @@ public class AssembleRequest : SfsStoreRequestAggregateRootBase<AssembleRequestD
[IgnoreUpdate] [IgnoreUpdate]
public string Type { get; set; } public string Type { get; set; }
/// <summary>
/// 生产线
/// </summary>
[IgnoreUpdate]
public string ProdLine { get; set; }
/// <summary> /// <summary>
/// 使用在途库 /// 使用在途库
/// </summary> /// </summary>

48
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/MaterialRequests/AssembleRequests/AssembleRequestDetail.cs

@ -1,4 +1,5 @@
using System; using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema; using System.ComponentModel.DataAnnotations.Schema;
using Win_in.Sfs.Shared.Domain; using Win_in.Sfs.Shared.Domain;
using Win_in.Sfs.Shared.Domain.Shared; using Win_in.Sfs.Shared.Domain.Shared;
@ -6,60 +7,51 @@ using Win_in.Sfs.Shared.Domain.Shared;
namespace Win_in.Sfs.Wms.Store.Domain; namespace Win_in.Sfs.Wms.Store.Domain;
/// <summary> /// <summary>
/// 装配申请明细 /// 装配叫料申请明细
/// </summary> /// </summary>
public class AssembleRequestDetail : SfsStoreDetailWithQtyEntityBase, IHasToLocation public class AssembleRequestDetail : SfsStoreDetailWithQtyEntityBase, IHasToLocation
{ {
#region 目标库位信息
/// <summary> /// <summary>
/// 到库位 /// 目标库位
/// </summary> /// </summary>
[Display(Name = "目标库位")]
[StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")]
public string ToLocationCode { get; set; } public string ToLocationCode { get; set; }
/// <summary> /// <summary>
/// 库区 /// 目标库区
/// </summary> /// </summary>
[Display(Name = "目标库区")]
public string ToLocationArea { get; set; } public string ToLocationArea { get; set; }
/// <summary> /// <summary>
/// 库位组 /// 目标库位组
/// </summary> /// </summary>
[Display(Name = "目标库位组")]
public string ToLocationGroup { get; set; } public string ToLocationGroup { get; set; }
/// <summary> /// <summary>
/// 到ERP库 /// 目标ERP储
/// </summary> /// </summary>
[Display(Name = "目标ERP储位")]
public string ToLocationErpCode { get; set; } public string ToLocationErpCode { get; set; }
/// <summary> /// <summary>
/// 仓库 /// 目标仓库
/// </summary> /// </summary>
[Display(Name = "目标仓库")]
public string ToWarehouseCode { get; set; } public string ToWarehouseCode { get; set; }
/// <summary> #endregion
/// 来源库区
/// </summary>
public string FromLocationArea { get; set; }
// /// <summary>
// /// 在途库库位
// /// </summary>
// public string OnTheWayLocationCode { get; set; }
/// <summary> /// <summary>
/// 生产线 /// 生产线
/// </summary> /// </summary>
public string ProdLine { get; set; } public string ProdLine { get; set; }
/// <summary>
/// 工作中心
/// </summary>
public string WorkStation { get; set; }
/// <summary>
/// 过期时间
/// </summary>
public DateTime ExpiredTime { get; set; }
/// <summary> /// <summary>
/// 已发数量 /// 已发数量
/// </summary> /// </summary>
@ -102,4 +94,10 @@ public class AssembleRequestDetail : SfsStoreDetailWithQtyEntityBase, IHasToLoca
/// 推荐类型 /// 推荐类型
/// </summary> /// </summary>
public EnumRecommendType RecommendType { get; set; } public EnumRecommendType RecommendType { get; set; }
/// <summary>
/// 需求箱数量
/// </summary>
[Display(Name = "需求箱数量")]
public decimal BoxQty { get; set; }
} }

75
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/MaterialRequests/AssembleRequests/AssembleRequestManager.cs

@ -14,23 +14,21 @@ public class AssembleRequestManager
, IAssembleRequestManager , IAssembleRequestManager
{ {
private readonly IAssembleRequestRepository _repository; private readonly IAssembleRequestRepository _repository;
private readonly IIssueJobRepository _issueJobRepository;
public AssembleRequestManager( public AssembleRequestManager(
IAssembleRequestRepository repository IAssembleRequestRepository repository
, IIssueJobRepository issueJobRepository
) : base(repository) ) : base(repository)
{ {
_repository = repository; _repository = repository;
_issueJobRepository = issueJobRepository;
}
}
#region 东阳V2 #region 东阳V2
#endregion #endregion
/// <summary> /// <summary>
/// 创建 /// 创建
/// </summary> /// </summary>
@ -49,73 +47,6 @@ public class AssembleRequestManager
return entity; return entity;
} }
public virtual async Task UpdateDetailsAsync(AssembleRequest newEntity)
{
var oldEntity = await Repository.FindAsync(newEntity.Id, true).ConfigureAwait(false);
if(oldEntity!=null)
{
foreach (var newDetail in newEntity.Details)
{
oldEntity.ReplaceDetail(newDetail.Id, newDetail);
}
foreach (var detail in oldEntity.Details)
{
SetMaterialRequestDetailStatus(detail);
}
await SetMaterialRequestStatusAsync(oldEntity).ConfigureAwait(false);
await Repository.UpdateAsync(oldEntity).ConfigureAwait(false);
}
}
private void SetMaterialRequestDetailStatus(AssembleRequestDetail detail)
{
if (detail.ReceivedQty >= detail.Qty)//执行的时候 实际收料 多余 要料数
{
detail.Status = EnumStatus.Close;
}
else
{
detail.Status = EnumStatus.Open;
}
}
private async Task SetMaterialRequestStatusAsync(AssembleRequest materialRequest)
{
if (materialRequest.Details.All(p => p.Status == EnumStatus.Close))
{
materialRequest.RequestStatus = EnumRequestStatus.Completed;
}
else
{
var issueJobs = await _issueJobRepository.GetListAsync(t => t.MaterialRequestNumber == materialRequest.Number).ConfigureAwait(false);
if (issueJobs.Count > 0)
{
if (issueJobs.All(t => t.JobStatus is EnumJobStatus.Done or EnumJobStatus.Closed or EnumJobStatus.Cancelled))
{
if (materialRequest.Details.All(p => p.ReceivedQty >= p.Qty))
{
materialRequest.RequestStatus = EnumRequestStatus.Completed;
}
else
{
materialRequest.RequestStatus = EnumRequestStatus.Partial;
}
}
else
{
materialRequest.RequestStatus = EnumRequestStatus.Partial;
}
}
else
{
materialRequest.RequestStatus = EnumRequestStatus.Partial;
}
}
}
public virtual async Task CompleteAsync(string number) public virtual async Task CompleteAsync(string number)
{ {

3
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/MaterialRequests/AssembleRequests/IAssembleRequestManager.cs

@ -7,9 +7,6 @@ using Win_in.Sfs.Shared.Domain;
public interface IAssembleRequestManager : ISfsStoreRequestManager<AssembleRequest, AssembleRequestDetail>, public interface IAssembleRequestManager : ISfsStoreRequestManager<AssembleRequest, AssembleRequestDetail>,
IBulkImportService<AssembleRequest> IBulkImportService<AssembleRequest>
{ {
Task UpdateDetailsAsync(AssembleRequest entity);
Task CompleteAsync(string number); Task CompleteAsync(string number);
Task<AssembleRequest> CreateBynNumberAsync(AssembleRequest entity); Task<AssembleRequest> CreateBynNumberAsync(AssembleRequest entity);

20
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/MaterialRequests/CoatingMaterialRequests/CoatingMaterialRequest.cs

@ -6,7 +6,7 @@ using Win_in.Sfs.Wms.Store.Domain;
namespace Win_in.Sfs.Wms.Store.Requests.MaterialRequests; namespace Win_in.Sfs.Wms.Store.Requests.MaterialRequests;
/// <summary> /// <summary>
/// 喷涂料申请 /// 喷涂料申请
/// </summary> /// </summary>
public class CoatingMaterialRequest : SfsStoreRequestAggregateRootBase<CoatingMaterialRequestDetail> public class CoatingMaterialRequest : SfsStoreRequestAggregateRootBase<CoatingMaterialRequestDetail>
{ {
@ -17,24 +17,6 @@ public class CoatingMaterialRequest : SfsStoreRequestAggregateRootBase<CoatingMa
[IgnoreUpdate] [IgnoreUpdate]
public string Type { get; set; } public string Type { get; set; }
/// <summary>
/// 喷涂要料计划单号
/// </summary>
[IgnoreUpdate]
public string PreparationPlanNumber { get; set; }
/// <summary>
/// 生产线
/// </summary>
[IgnoreUpdate]
public string ProdLine { get; set; }
/// <summary>
/// 车间
/// </summary>
[IgnoreUpdate]
public string Workshop { get; set; }
/// <summary> /// <summary>
/// 使用在途库 /// 使用在途库
/// </summary> /// </summary>

44
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/MaterialRequests/CoatingMaterialRequests/CoatingMaterialRequestDetail.cs

@ -1,4 +1,5 @@
using System; using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema; using System.ComponentModel.DataAnnotations.Schema;
using Win_in.Sfs.Shared.Domain; using Win_in.Sfs.Shared.Domain;
using Win_in.Sfs.Shared.Domain.Shared; using Win_in.Sfs.Shared.Domain.Shared;
@ -9,56 +10,46 @@ namespace Win_in.Sfs.Wms.Store.Requests.MaterialRequests;
public class CoatingMaterialRequestDetail : SfsStoreDetailWithQtyEntityBase, IHasToLocation public class CoatingMaterialRequestDetail : SfsStoreDetailWithQtyEntityBase, IHasToLocation
{ {
#region 目标库位信息
/// <summary> /// <summary>
/// 到库位 /// 目标库位
/// </summary> /// </summary>
[Display(Name = "目标库位")]
[StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")]
public string ToLocationCode { get; set; } public string ToLocationCode { get; set; }
/// <summary> /// <summary>
/// 库区 /// 目标库区
/// </summary> /// </summary>
[Display(Name = "目标库区")]
public string ToLocationArea { get; set; } public string ToLocationArea { get; set; }
/// <summary> /// <summary>
/// 库位组 /// 目标库位组
/// </summary> /// </summary>
[Display(Name = "目标库位组")]
public string ToLocationGroup { get; set; } public string ToLocationGroup { get; set; }
/// <summary> /// <summary>
/// 到ERP库 /// 目标ERP储
/// </summary> /// </summary>
[Display(Name = "目标ERP储位")]
public string ToLocationErpCode { get; set; } public string ToLocationErpCode { get; set; }
/// <summary> /// <summary>
/// 仓库 /// 目标仓库
/// </summary> /// </summary>
[Display(Name = "目标仓库")]
public string ToWarehouseCode { get; set; } public string ToWarehouseCode { get; set; }
/// <summary> #endregion
/// 来源库区
/// </summary>
public string FromLocationArea { get; set; }
// /// <summary>
// /// 在途库库位
// /// </summary>
// public string OnTheWayLocationCode { get; set; }
/// <summary> /// <summary>
/// 生产线 /// 生产线
/// </summary> /// </summary>
public string ProdLine { get; set; } public string ProdLine { get; set; }
/// <summary>
/// 工作中心
/// </summary>
public string WorkStation { get; set; }
/// <summary>
/// 过期时间
/// </summary>
public DateTime ExpiredTime { get; set; }
/// <summary> /// <summary>
/// 已发数量 /// 已发数量
/// </summary> /// </summary>
@ -102,4 +93,9 @@ public class CoatingMaterialRequestDetail : SfsStoreDetailWithQtyEntityBase, IHa
/// </summary> /// </summary>
public EnumRecommendType RecommendType { get; set; } public EnumRecommendType RecommendType { get; set; }
/// <summary>
/// 需求箱数量
/// </summary>
[Display(Name = "需求箱数量")]
public decimal BoxQty { get; set; }
} }

238
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/MaterialRequests/CoatingMaterialRequests/CoatingMaterialRequestManager.cs

@ -16,7 +16,7 @@ public class CoatingMaterialRequestManager
, ICoatingMaterialRequestManager , ICoatingMaterialRequestManager
{ {
private readonly ICoatingMaterialRequestRepository _repository; private readonly ICoatingMaterialRequestRepository _repository;
private readonly ICoatingIssueJobRepository _issueJobRepository;
public CoatingMaterialRequestManager( public CoatingMaterialRequestManager(
ICoatingMaterialRequestRepository repository ICoatingMaterialRequestRepository repository
@ -24,7 +24,7 @@ public class CoatingMaterialRequestManager
) : base(repository) ) : base(repository)
{ {
_repository = repository; _repository = repository;
_issueJobRepository = issueJobRepository;
} }
/// <summary> /// <summary>
@ -45,74 +45,6 @@ public class CoatingMaterialRequestManager
return entity; return entity;
} }
public virtual async Task UpdateDetailsAsync(CoatingMaterialRequest newEntity)
{
var oldEntity = await Repository.FindAsync(newEntity.Id, true).ConfigureAwait(false);
if (oldEntity != null)
{
foreach (var newDetail in newEntity.Details)
{
oldEntity.ReplaceDetail(newDetail.Id, newDetail);
}
foreach (var detail in oldEntity.Details)
{
SetMaterialRequestDetailStatus(detail);
}
await SetMaterialRequestStatus(oldEntity).ConfigureAwait(false);
await Repository.UpdateAsync(oldEntity).ConfigureAwait(false);
}
}
private void SetMaterialRequestDetailStatus(CoatingMaterialRequestDetail detail)
{
if (detail.ReceivedQty >= detail.Qty)//执行的时候 实际收料 多余 要料数
{
detail.Status = EnumStatus.Close;
}
else
{
detail.Status = EnumStatus.Open;
}
}
private async Task SetMaterialRequestStatus(CoatingMaterialRequest materialRequest)
{
if (materialRequest.Details.All(p => p.Status == EnumStatus.Close))
{
materialRequest.RequestStatus = EnumRequestStatus.Completed;
}
else
{
var issueJobs = await _issueJobRepository.GetListAsync(t => t.MaterialRequestNumber == materialRequest.Number).ConfigureAwait(false);
if (issueJobs.Count > 0)
{
if (issueJobs.All(t => t.JobStatus is EnumJobStatus.Done or EnumJobStatus.Closed or EnumJobStatus.Cancelled))
{
if (materialRequest.Details.All(p => p.ReceivedQty >= p.Qty))
{
materialRequest.RequestStatus = EnumRequestStatus.Completed;
}
else
{
materialRequest.RequestStatus = EnumRequestStatus.Partial;
}
}
else
{
materialRequest.RequestStatus = EnumRequestStatus.Partial;
}
}
else
{
materialRequest.RequestStatus = EnumRequestStatus.Partial;
}
}
}
public virtual async Task CompleteAsync(string number) public virtual async Task CompleteAsync(string number)
{ {
var entity = await GetByNumberAsync(number).ConfigureAwait(false); var entity = await GetByNumberAsync(number).ConfigureAwait(false);
@ -122,89 +54,6 @@ public class CoatingMaterialRequestManager
} }
} }
#region 公有
/*
// /// <summary>
// /// 处理
// /// </summary>
// /// <returns></returns>
// public virtual async Task<bool> Handle(Guid id)
// {
// var entity =await Repository.GetAsync(id);
// if (entity == null)
// {
// return false;
// }
// entity.Handle();
// await Repository.UpdateAsync(entity);
//
// await HandledPublishAsync(entity);
// return true;
// }
//
// private async Task HandledPublishAsync(MaterialRequest entity)
// {
// //发布,以生成发料任务
// var eto = BuildMaterialRequestHandledETO(entity);
// await DistributedEventBus.PublishAsync(eto);
// }
//
// /// <summary>
// /// 关闭
// /// </summary>
// /// <returns></returns>
// public virtual async Task<bool> Close(Guid id)
// {
// var entity = await Repository.GetAsync(id);
// if (entity == null)
// {
// return false;
// }
// entity.Close();
// await Repository.UpdateAsync(entity);
//
// //发布,以关闭发料任务
// var eto = BuildMaterialRequestClosedETO(entity);
// await DistributedEventBus.PublishAsync(eto);
// return true;
// }
//
// /// <summary>
// /// 打开
// /// </summary>
// /// <returns></returns>
// public virtual async Task<bool> Open(Guid id)
// {
// var entity = await Repository.GetAsync(id);
// if (entity == null)
// {
// return false;
// }
// entity.Open();
//
// await Repository.UpdateAsync(entity);
//
// //发布,以打开发料任务
// var eto = BuildMaterialRequestOpenedETO(entity);
// await DistributedEventBus.PublishAsync(eto);
// return true;
// }
public virtual async Task<MaterialRequest> CreateAndHandleAsync(MaterialRequest entity)
{
await base.CreateAsync(entity);
await base.HandleAsync(entity.Id);
return entity;
}
*/
#endregion
#region Import #region Import
/// <summary> /// <summary>
@ -222,88 +71,5 @@ public class CoatingMaterialRequestManager
#endregion #endregion
/*
#region 私有
private MaterialRequestOpenedETO BuildMaterialRequestOpenedETO(MaterialRequest materialRequest)
{
var materialRequestETO = new MaterialRequestOpenedETO()
{
Number = materialRequest.Number,
Workshop = materialRequest.Workshop,
Status = materialRequest.Status,
Details = BuildMaterialRequestDetailETO(materialRequest.Details)
};
return materialRequestETO;
} }
private MaterialRequestClosedETO BuildMaterialRequestClosedETO(MaterialRequest materialRequest)
{
var materialRequestETO = new MaterialRequestClosedETO()
{
Company = materialRequest.Company,
Number = materialRequest.Number
};
return materialRequestETO;
}
private MaterialRequestHandledETO BuildMaterialRequestHandledETO(MaterialRequest materialRequest)
{
var materialRequestETO = new MaterialRequestHandledETO()
{
Company = materialRequest.Company,
Number = materialRequest.Number,
Workshop = materialRequest.Workshop,
Status = materialRequest.Status,
Details = BuildMaterialRequestDetailETO(materialRequest.Details)
};
return materialRequestETO;
}
private List<MaterialRequestDetailETO> BuildMaterialRequestDetailETO(List<MaterialRequestDetail> materialRequestDetail)
{
var list = new List<MaterialRequestDetailETO>();
foreach (var detail in materialRequestDetail)
{
var materialRequestDetailETO = new MaterialRequestDetailETO()
{
Number = detail.Number,
Item = detail.Item,
ItemCode = detail.ItemCode,
Qty = detail.Qty,
ToLocationCode = detail.ToLocationCode,
ProdLine = detail.ProdLine,
WorkStation = detail.WorkStation,
ExpiredTime = detail.ExpiredTime,
Status = detail.Status
};
list.Add(materialRequestDetailETO);
}
return list;
}
#endregion
*/
}
///// <summary>
///// 为了解决补料时 无法拿到订阅错误信息
///// </summary>
///// <param name="entity"></param>
///// <param name="flag"></param>
///// <returns></returns>
//public virtual async Task<MaterialRequest> CreateAndHandleAsync(MaterialRequest entity, bool flag)
//{
// await entity.Handle();
// foreach (var detail in entity.Details)
// {
// detail.Status = EnumStoreStatus.Handle;
// }
// await base.CreateAsync(entity);
// //发布,以打开发料任务??
// //var eto = BuildMaterialRequestHandledETO(entity);
// //await DistributedEventBus.PublishAsync(eto);
// return entity;
//}

3
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/MaterialRequests/CoatingMaterialRequests/ICoatingMaterialRequestManager.cs

@ -8,9 +8,6 @@ using Win_in.Sfs.Shared.Domain;
public interface ICoatingMaterialRequestManager : ISfsStoreRequestManager<CoatingMaterialRequest, CoatingMaterialRequestDetail>, public interface ICoatingMaterialRequestManager : ISfsStoreRequestManager<CoatingMaterialRequest, CoatingMaterialRequestDetail>,
IBulkImportService<CoatingMaterialRequest> IBulkImportService<CoatingMaterialRequest>
{ {
// Task<MaterialRequest> CreateAndHandleAsync(MaterialRequest entity);
Task UpdateDetailsAsync(CoatingMaterialRequest entity);
Task CompleteAsync(string number); Task CompleteAsync(string number);
Task<CoatingMaterialRequest> CreateBynNumberAsync(CoatingMaterialRequest entity); Task<CoatingMaterialRequest> CreateBynNumberAsync(CoatingMaterialRequest entity);

1
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/MaterialRequests/InjectionRequests/IInjectionRequestManager.cs

@ -6,7 +6,6 @@ namespace Win_in.Sfs.Wms.Store.Domain;
public interface IInjectionRequestManager : ISfsStoreRequestManager<InjectionRequest, InjectionRequestDetail>, public interface IInjectionRequestManager : ISfsStoreRequestManager<InjectionRequest, InjectionRequestDetail>,
IBulkImportService<InjectionRequest> IBulkImportService<InjectionRequest>
{ {
Task UpdateDetailsAsync(InjectionRequest entity);
Task CompleteAsync(string number); Task CompleteAsync(string number);

2
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/MaterialRequests/InjectionRequests/InjectionRequestDetail.cs

@ -7,7 +7,7 @@ using Win_in.Sfs.Shared.Domain.Shared;
namespace Win_in.Sfs.Wms.Store.Domain; namespace Win_in.Sfs.Wms.Store.Domain;
/// <summary> /// <summary>
/// 注塑申请明细 /// 注塑叫料申请明细
/// </summary> /// </summary>
public class InjectionRequestDetail : SfsStoreDetailWithQtyEntityBase, IHasToLocation public class InjectionRequestDetail : SfsStoreDetailWithQtyEntityBase, IHasToLocation
{ {

76
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/MaterialRequests/InjectionRequests/InjectionRequestManager.cs

@ -11,18 +11,17 @@ public class InjectionRequestManager
, IInjectionRequestManager , IInjectionRequestManager
{ {
private readonly IInjectionRequestRepository _repository; private readonly IInjectionRequestRepository _repository;
private readonly IIssueJobRepository _issueJobRepository; private readonly IInjectionJobRepository _injectionJobRepository;
public InjectionRequestManager( public InjectionRequestManager(
IInjectionRequestRepository repository IInjectionRequestRepository repository
, IIssueJobRepository issueJobRepository , IInjectionJobRepository injectionJobRepository
) : base(repository) ) : base(repository)
{ {
_repository = repository; _repository = repository;
_issueJobRepository = issueJobRepository; _injectionJobRepository = injectionJobRepository;
} }
#region 东阳V2 #region 东阳V2
#endregion #endregion
@ -48,75 +47,6 @@ public class InjectionRequestManager
return entity; return entity;
} }
public virtual async Task UpdateDetailsAsync(InjectionRequest newEntity)
{
var oldEntity = await Repository.FindAsync(newEntity.Id).ConfigureAwait(false);
if (oldEntity != null)
{
foreach (var newDetail in newEntity.Details)
{
oldEntity.ReplaceDetail(newDetail.Id, newDetail);
}
foreach (var detail in oldEntity.Details)
{
SetMaterialRequestDetailStatus(detail);
}
await SetMaterialRequestStatusAsync(oldEntity).ConfigureAwait(false);
await Repository.UpdateAsync(oldEntity).ConfigureAwait(false);
}
}
private void SetMaterialRequestDetailStatus(InjectionRequestDetail detail)
{
if (detail.ReceivedQty >= detail.Qty) //执行的时候 实际收料 多余 要料数
{
detail.Status = EnumStatus.Close;
}
else
{
detail.Status = EnumStatus.Open;
}
}
private async Task SetMaterialRequestStatusAsync(InjectionRequest materialRequest)
{
if (materialRequest.Details.All(p => p.Status == EnumStatus.Close))
{
materialRequest.RequestStatus = EnumRequestStatus.Completed;
}
else
{
var issueJobs = await _issueJobRepository
.GetListAsync(t => t.MaterialRequestNumber == materialRequest.Number).ConfigureAwait(false);
if (issueJobs.Count > 0)
{
if (issueJobs.All(t =>
t.JobStatus is EnumJobStatus.Done or EnumJobStatus.Closed or EnumJobStatus.Cancelled))
{
if (materialRequest.Details.All(p => p.ReceivedQty >= p.Qty))
{
materialRequest.RequestStatus = EnumRequestStatus.Completed;
}
else
{
materialRequest.RequestStatus = EnumRequestStatus.Partial;
}
}
else
{
materialRequest.RequestStatus = EnumRequestStatus.Partial;
}
}
else
{
materialRequest.RequestStatus = EnumRequestStatus.Partial;
}
}
}
public virtual async Task CompleteAsync(string number) public virtual async Task CompleteAsync(string number)
{ {
var entity = await GetByNumberAsync(number).ConfigureAwait(false); var entity = await GetByNumberAsync(number).ConfigureAwait(false);

3
be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Requests/MaterialRequests/AssembleRequests/AssembleRequestDbContextModelCreatingExtensions.cs

@ -20,7 +20,6 @@ public static class AssembleRequestDbContextModelCreatingExtensions
//Properties //Properties
b.Property(q => q.Type).HasMaxLength(SfsPropertyConst.CodeLength); b.Property(q => q.Type).HasMaxLength(SfsPropertyConst.CodeLength);
b.Property(q => q.ProdLine).HasMaxLength(SfsPropertyConst.CodeLength);
b.Property(q => q.RequestStatus).HasMaxLength(SfsPropertyConst.NameLength).HasConversion<string>(); b.Property(q => q.RequestStatus).HasMaxLength(SfsPropertyConst.NameLength).HasConversion<string>();
//Relations //Relations
@ -46,9 +45,7 @@ public static class AssembleRequestDbContextModelCreatingExtensions
b.Property(q => q.ToWarehouseCode).IsRequired().HasMaxLength(SfsPropertyConst.CodeLength); b.Property(q => q.ToWarehouseCode).IsRequired().HasMaxLength(SfsPropertyConst.CodeLength);
b.Property(q => q.ToLocationArea).IsRequired().HasMaxLength(SfsPropertyConst.CodeLength); b.Property(q => q.ToLocationArea).IsRequired().HasMaxLength(SfsPropertyConst.CodeLength);
b.Property(q => q.ToLocationGroup).IsRequired().HasMaxLength(SfsPropertyConst.CodeLength); b.Property(q => q.ToLocationGroup).IsRequired().HasMaxLength(SfsPropertyConst.CodeLength);
b.Property(q => q.ExpiredTime).IsRequired();
b.Property(q => q.ProdLine).HasMaxLength(SfsPropertyConst.CodeLength); b.Property(q => q.ProdLine).HasMaxLength(SfsPropertyConst.CodeLength);
b.Property(q => q.WorkStation).HasMaxLength(SfsPropertyConst.CodeLength);
b.Property(q => q.IssuedQty).HasPrecision(18, 6); b.Property(q => q.IssuedQty).HasPrecision(18, 6);
b.Property(q => q.ReceivedQty).HasPrecision(18, 6); b.Property(q => q.ReceivedQty).HasPrecision(18, 6);
b.Property(q => q.Status).HasMaxLength(SfsPropertyConst.NameLength).HasConversion<string>(); b.Property(q => q.Status).HasMaxLength(SfsPropertyConst.NameLength).HasConversion<string>();

5
be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Requests/MaterialRequests/CoatingMaterialRequestDbContextModelCreatingExtensions.cs

@ -20,9 +20,6 @@ public static class CoatingMaterialRequestDbContextModelCreatingExtensions
//Properties //Properties
b.Property(q => q.Type).HasMaxLength(SfsPropertyConst.CodeLength); b.Property(q => q.Type).HasMaxLength(SfsPropertyConst.CodeLength);
b.Property(q => q.PreparationPlanNumber).HasMaxLength(SfsPropertyConst.CodeLength);
b.Property(q => q.ProdLine).HasMaxLength(SfsPropertyConst.CodeLength);
b.Property(q => q.Workshop).HasMaxLength(SfsPropertyConst.CodeLength);
b.Property(q => q.RequestStatus).HasMaxLength(SfsPropertyConst.NameLength).HasConversion<string>(); b.Property(q => q.RequestStatus).HasMaxLength(SfsPropertyConst.NameLength).HasConversion<string>();
//Relations //Relations
@ -48,9 +45,7 @@ public static class CoatingMaterialRequestDbContextModelCreatingExtensions
b.Property(q => q.ToWarehouseCode).IsRequired().HasMaxLength(SfsPropertyConst.CodeLength); b.Property(q => q.ToWarehouseCode).IsRequired().HasMaxLength(SfsPropertyConst.CodeLength);
b.Property(q => q.ToLocationArea).IsRequired().HasMaxLength(SfsPropertyConst.CodeLength); b.Property(q => q.ToLocationArea).IsRequired().HasMaxLength(SfsPropertyConst.CodeLength);
b.Property(q => q.ToLocationGroup).IsRequired().HasMaxLength(SfsPropertyConst.CodeLength); b.Property(q => q.ToLocationGroup).IsRequired().HasMaxLength(SfsPropertyConst.CodeLength);
b.Property(q => q.ExpiredTime).IsRequired();
b.Property(q => q.ProdLine).HasMaxLength(SfsPropertyConst.CodeLength); b.Property(q => q.ProdLine).HasMaxLength(SfsPropertyConst.CodeLength);
b.Property(q => q.WorkStation).HasMaxLength(SfsPropertyConst.CodeLength);
b.Property(q => q.IssuedQty).HasPrecision(18, 6); b.Property(q => q.IssuedQty).HasPrecision(18, 6);
b.Property(q => q.ReceivedQty).HasPrecision(18, 6); b.Property(q => q.ReceivedQty).HasPrecision(18, 6);
b.Property(q => q.Status).HasMaxLength(SfsPropertyConst.NameLength).HasConversion<string>(); b.Property(q => q.Status).HasMaxLength(SfsPropertyConst.NameLength).HasConversion<string>();

4
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/AssembleRequestEventHandler.cs

@ -209,7 +209,7 @@ public class AssembleRequestEventHandler
ItemCode = assembleRequestDetail.ItemCode, ItemCode = assembleRequestDetail.ItemCode,
Qty = assembleRequestDetail.ToBeIssuedQty, Qty = assembleRequestDetail.ToBeIssuedQty,
LocationTypes = transactionType.OutLocationTypes, LocationTypes = transactionType.OutLocationTypes,
LocationAreas = new List<string> { assembleRequestDetail.FromLocationArea },
Statuses = transactionType.OutInventoryStatuses, Statuses = transactionType.OutInventoryStatuses,
}; };
//获取推荐库存 //获取推荐库存
@ -246,8 +246,6 @@ public class AssembleRequestEventHandler
var detail = ObjectMapper.Map<BalanceDTO, AssembleJobDetailInput>(balance); var detail = ObjectMapper.Map<BalanceDTO, AssembleJobDetailInput>(balance);
detail.RequestLocationCode = assembleRequestDetail.ToLocationCode; detail.RequestLocationCode = assembleRequestDetail.ToLocationCode;
detail.WorkStation = assembleRequestDetail.WorkStation;
detail.ExpiredTime = assembleRequestDetail.ExpiredTime;
detail.PositionCode = assembleRequestDetail.PositionCode; detail.PositionCode = assembleRequestDetail.PositionCode;
detail.RecommendType = assembleRequestDetail.RecommendType; detail.RecommendType = assembleRequestDetail.RecommendType;

6
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/CoatingMaterialRequestEventHandler.cs

@ -209,7 +209,7 @@ public class CoatingMaterialRequestEventHandler
ItemCode = CoatingMaterialRequestDetail.ItemCode, ItemCode = CoatingMaterialRequestDetail.ItemCode,
Qty = CoatingMaterialRequestDetail.ToBeIssuedQty, Qty = CoatingMaterialRequestDetail.ToBeIssuedQty,
LocationTypes = transactionType.OutLocationTypes, LocationTypes = transactionType.OutLocationTypes,
LocationAreas = new List<string> { CoatingMaterialRequestDetail.FromLocationArea },
Statuses = transactionType.OutInventoryStatuses, Statuses = transactionType.OutInventoryStatuses,
}; };
//获取推荐库存 //获取推荐库存
@ -231,7 +231,7 @@ public class CoatingMaterialRequestEventHandler
jobDetails.Add(detail); jobDetails.Add(detail);
CoatingMaterialRequestDetail.IssuedQty += recommend.Qty; CoatingMaterialRequestDetail.IssuedQty += recommend.Qty;
await _CoatingMaterialRequestManager.UpdateDetailsAsync(CoatingMaterialRequest).ConfigureAwait(false);
} }
} }
@ -244,8 +244,6 @@ public class CoatingMaterialRequestEventHandler
var detail = ObjectMapper.Map<BalanceDTO, CoatingIssueJobDetailInput>(balance); var detail = ObjectMapper.Map<BalanceDTO, CoatingIssueJobDetailInput>(balance);
detail.RequestLocationCode = CoatingMaterialRequestDetail.ToLocationCode; detail.RequestLocationCode = CoatingMaterialRequestDetail.ToLocationCode;
detail.WorkStation = CoatingMaterialRequestDetail.WorkStation;
detail.ExpiredTime = CoatingMaterialRequestDetail.ExpiredTime;
detail.PositionCode = CoatingMaterialRequestDetail.PositionCode; detail.PositionCode = CoatingMaterialRequestDetail.PositionCode;
detail.RecommendType = CoatingMaterialRequestDetail.RecommendType; detail.RecommendType = CoatingMaterialRequestDetail.RecommendType;

2
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/Note/CoatingIssueNoteEventHandler.cs

@ -94,7 +94,7 @@ public class CoatingIssueNoteEventHandler
} }
} }
await _materialRequestManager.UpdateDetailsAsync(materialRequest).ConfigureAwait(false);
} }
} }
} }

Loading…
Cancel
Save