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. 7
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/MaterialRequests/AssembleRequests/AssembleRequestAutoMapperProfile.cs
  2. 35
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/MaterialRequests/CoatingMaterialRequests/CoatingMaterialRequestAppService.cs
  3. 9
      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. 10
      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. 77
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/MaterialRequests/AssembleRequests/AssembleRequestManager.cs
  8. 5
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/MaterialRequests/AssembleRequests/IAssembleRequestManager.cs
  9. 22
      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. 244
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/MaterialRequests/CoatingMaterialRequests/CoatingMaterialRequestManager.cs
  12. 5
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/MaterialRequests/CoatingMaterialRequests/ICoatingMaterialRequestManager.cs
  13. 3
      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. 78
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/MaterialRequests/InjectionRequests/InjectionRequestManager.cs
  16. 9
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Requests/MaterialRequests/AssembleRequests/AssembleRequestDbContextModelCreatingExtensions.cs
  17. 11
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Requests/MaterialRequests/CoatingMaterialRequestDbContextModelCreatingExtensions.cs
  18. 6
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/AssembleRequestEventHandler.cs
  19. 8
      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

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

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

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

@ -160,16 +160,7 @@ public class CoatingMaterialRequestAppService : SfsStoreRequestAppServiceBase<Co
throw new UserFriendlyException($"{item.ItemCode} 物料的需求量必须大于 0");
}
}
//检验备料计划是否存在要料请求
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) //赋值生产线
{
@ -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) //赋值生产线
{
@ -337,19 +320,7 @@ public class CoatingMaterialRequestAppService : SfsStoreRequestAppServiceBase<Co
var dto = await CreateAndHandleAsync(materialRequestCreateInput).ConfigureAwait(false);
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>
/// 根据类型获取叫料请求

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

@ -27,10 +27,7 @@ public partial class StoreApplicationAutoMapperProfile : Profile
CreateMap<CoatingMaterialRequestImportInput, CoatingMaterialRequest>()
.IgnoreAuditedObjectProperties()
.ForMember(x => x.Type, y => y.MapFrom(t => t.Type.ToString()))
.Ignore(x => x.PreparationPlanNumber)
.Ignore(x => x.ProdLine)
.Ignore(x => x.Workshop)
.ForMember(x => x.Type, y => y.MapFrom(t => t.Type.ToString()))
.Ignore(x => x.UseOnTheWayLocation)
.Ignore(x => x.Details)
.Ignore(x => x.Remark)
@ -50,9 +47,7 @@ public partial class StoreApplicationAutoMapperProfile : Profile
.Ignore(x => x.ToLocationArea)
.Ignore(x => x.ToLocationGroup)
.Ignore(x => x.ItemName).Ignore(x => x.ItemDesc1).Ignore(x => x.ItemDesc2)
.Ignore(x => x.ProdLine)
.Ignore(x => x.WorkStation)
.Ignore(x => x.ExpiredTime)
.Ignore(x => x.ProdLine)
.Ignore(x => x.IssuedQty)
.Ignore(x => x.ReceivedQty)
.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.ItemName = itemBasicDto.Name;
detail.Uom = itemBasicDto.BasicUom;
detail.StdPackQty = itemBasicDto.StdPackQty;
}
}

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

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

@ -14,23 +14,21 @@ public class AssembleRequestManager
, IAssembleRequestManager
{
private readonly IAssembleRequestRepository _repository;
private readonly IIssueJobRepository _issueJobRepository;
public AssembleRequestManager(
IAssembleRequestRepository repository
, IIssueJobRepository issueJobRepository
) : base(repository)
{
_repository = repository;
_issueJobRepository = issueJobRepository;
}
#region 东阳V2
#endregion
/// <summary>
/// 创建
/// </summary>
@ -49,74 +47,7 @@ public class AssembleRequestManager
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)
{
var entity = await GetByNumberAsync(number).ConfigureAwait(false);

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

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

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

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

@ -16,7 +16,7 @@ public class CoatingMaterialRequestManager
, ICoatingMaterialRequestManager
{
private readonly ICoatingMaterialRequestRepository _repository;
private readonly ICoatingIssueJobRepository _issueJobRepository;
public CoatingMaterialRequestManager(
ICoatingMaterialRequestRepository repository
@ -24,7 +24,7 @@ public class CoatingMaterialRequestManager
) : base(repository)
{
_repository = repository;
_issueJobRepository = issueJobRepository;
}
/// <summary>
@ -44,75 +44,7 @@ public class CoatingMaterialRequestManager
await _repository.InsertAsync(entity).ConfigureAwait(false);
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)
{
var entity = await GetByNumberAsync(number).ConfigureAwait(false);
@ -121,90 +53,7 @@ public class CoatingMaterialRequestManager
await CompleteAsync(entity).ConfigureAwait(false);
}
}
#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
/// <summary>
@ -221,89 +70,6 @@ public class CoatingMaterialRequestManager
}
#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;
//}

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

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

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

@ -5,8 +5,7 @@ namespace Win_in.Sfs.Wms.Store.Domain;
public interface IInjectionRequestManager : ISfsStoreRequestManager<InjectionRequest, InjectionRequestDetail>,
IBulkImportService<InjectionRequest>
{
Task UpdateDetailsAsync(InjectionRequest entity);
{
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;
/// <summary>
/// 注塑申请明细
/// 注塑叫料申请明细
/// </summary>
public class InjectionRequestDetail : SfsStoreDetailWithQtyEntityBase, IHasToLocation
{

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

@ -11,18 +11,17 @@ public class InjectionRequestManager
, IInjectionRequestManager
{
private readonly IInjectionRequestRepository _repository;
private readonly IIssueJobRepository _issueJobRepository;
private readonly IInjectionJobRepository _injectionJobRepository;
public InjectionRequestManager(
IInjectionRequestRepository repository
, IIssueJobRepository issueJobRepository
, IInjectionJobRepository injectionJobRepository
) : base(repository)
{
_repository = repository;
_issueJobRepository = issueJobRepository;
_injectionJobRepository = injectionJobRepository;
}
#region 东阳V2
#endregion
@ -47,76 +46,7 @@ public class InjectionRequestManager
await _repository.InsertAsync(entity).ConfigureAwait(false);
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)
{
var entity = await GetByNumberAsync(number).ConfigureAwait(false);

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

@ -19,8 +19,7 @@ public static class AssembleRequestDbContextModelCreatingExtensions
b.ConfigureSfsStoreBase();
//Properties
b.Property(q => q.Type).HasMaxLength(SfsPropertyConst.CodeLength);
b.Property(q => q.ProdLine).HasMaxLength(SfsPropertyConst.CodeLength);
b.Property(q => q.Type).HasMaxLength(SfsPropertyConst.CodeLength);
b.Property(q => q.RequestStatus).HasMaxLength(SfsPropertyConst.NameLength).HasConversion<string>();
//Relations
@ -45,10 +44,8 @@ public static class AssembleRequestDbContextModelCreatingExtensions
b.Property(q => q.ToLocationErpCode).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.ToLocationGroup).IsRequired().HasMaxLength(SfsPropertyConst.CodeLength);
b.Property(q => q.ExpiredTime).IsRequired();
b.Property(q => q.ProdLine).HasMaxLength(SfsPropertyConst.CodeLength);
b.Property(q => q.WorkStation).HasMaxLength(SfsPropertyConst.CodeLength);
b.Property(q => q.ToLocationGroup).IsRequired().HasMaxLength(SfsPropertyConst.CodeLength);
b.Property(q => q.ProdLine).HasMaxLength(SfsPropertyConst.CodeLength);
b.Property(q => q.IssuedQty).HasPrecision(18, 6);
b.Property(q => q.ReceivedQty).HasPrecision(18, 6);
b.Property(q => q.Status).HasMaxLength(SfsPropertyConst.NameLength).HasConversion<string>();

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

@ -19,10 +19,7 @@ public static class CoatingMaterialRequestDbContextModelCreatingExtensions
b.ConfigureSfsStoreBase();
//Properties
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.Type).HasMaxLength(SfsPropertyConst.CodeLength);
b.Property(q => q.RequestStatus).HasMaxLength(SfsPropertyConst.NameLength).HasConversion<string>();
//Relations
@ -47,10 +44,8 @@ public static class CoatingMaterialRequestDbContextModelCreatingExtensions
b.Property(q => q.ToLocationErpCode).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.ToLocationGroup).IsRequired().HasMaxLength(SfsPropertyConst.CodeLength);
b.Property(q => q.ExpiredTime).IsRequired();
b.Property(q => q.ProdLine).HasMaxLength(SfsPropertyConst.CodeLength);
b.Property(q => q.WorkStation).HasMaxLength(SfsPropertyConst.CodeLength);
b.Property(q => q.ToLocationGroup).IsRequired().HasMaxLength(SfsPropertyConst.CodeLength);
b.Property(q => q.ProdLine).HasMaxLength(SfsPropertyConst.CodeLength);
b.Property(q => q.IssuedQty).HasPrecision(18, 6);
b.Property(q => q.ReceivedQty).HasPrecision(18, 6);
b.Property(q => q.Status).HasMaxLength(SfsPropertyConst.NameLength).HasConversion<string>();

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

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

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

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