diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/MaterialRequests/AssembleRequests/AssembleRequestAutoMapperProfile.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/MaterialRequests/AssembleRequests/AssembleRequestAutoMapperProfile.cs index 182f8a6ed..41423325d 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/MaterialRequests/AssembleRequests/AssembleRequestAutoMapperProfile.cs +++ b/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() .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) diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/MaterialRequests/CoatingMaterialRequests/CoatingMaterialRequestAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/MaterialRequests/CoatingMaterialRequests/CoatingMaterialRequestAppService.cs index 3acfc1ae7..a36dc70e0 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/MaterialRequests/CoatingMaterialRequests/CoatingMaterialRequestAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/MaterialRequests/CoatingMaterialRequests/CoatingMaterialRequestAppService.cs @@ -160,16 +160,7 @@ public class CoatingMaterialRequestAppService : SfsStoreRequestAppServiceBase 0) - { - throw new UserFriendlyException($"{input.PreparationPlanNumber} 备料计划已存在要料申请"); - } - } + foreach (var item in input.Details) //赋值生产线 { @@ -268,15 +259,7 @@ public class CoatingMaterialRequestAppService : SfsStoreRequestAppServiceBase 0) - { - throw new UserFriendlyException($"{input.PreparationPlanNumber} 备料计划已存在要料申请"); - } - } + foreach (var detailInput in input.Details) //赋值生产线 { @@ -337,19 +320,7 @@ public class CoatingMaterialRequestAppService : SfsStoreRequestAppServiceBase - /// 检验备料计划是否存在要料请求 - /// - /// - /// - private async Task> CheckExistByPreparationPlanAsync(string preparationPlanNumber) - { - var entities = await _repository.GetListAsync(c => c.PreparationPlanNumber == preparationPlanNumber) - .ConfigureAwait(false); - return entities; - } + } /// /// 根据类型获取叫料请求 diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/MaterialRequests/CoatingMaterialRequests/CoatingMaterialRequestAutoMapperProfile.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/MaterialRequests/CoatingMaterialRequests/CoatingMaterialRequestAutoMapperProfile.cs index 360416b97..9e6aa8499 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/MaterialRequests/CoatingMaterialRequests/CoatingMaterialRequestAutoMapperProfile.cs +++ b/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() .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) diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/MaterialRequests/InjectionRequests/InjectionRequestAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/MaterialRequests/InjectionRequests/InjectionRequestAppService.cs index d253e27db..cbd5ae7b0 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/MaterialRequests/InjectionRequests/InjectionRequestAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/MaterialRequests/InjectionRequests/InjectionRequestAppService.cs @@ -186,6 +186,7 @@ public class InjectionRequestAppService : SfsStoreRequestAppServiceBase -/// 装配申请 +/// 装配叫料申请 /// public class AssembleRequest : SfsStoreRequestAggregateRootBase { @@ -14,13 +14,7 @@ public class AssembleRequest : SfsStoreRequestAggregateRootBase [Display(Name = "叫料类型")] [IgnoreUpdate] - public string Type { get; set; } - - /// - /// 生产线 - /// - [IgnoreUpdate] - public string ProdLine { get; set; } + public string Type { get; set; } /// /// 使用在途库 diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/MaterialRequests/AssembleRequests/AssembleRequestDetail.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/MaterialRequests/AssembleRequests/AssembleRequestDetail.cs index 97c0a711d..e6524a217 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/MaterialRequests/AssembleRequests/AssembleRequestDetail.cs +++ b/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; /// -/// 装配申请明细 +/// 装配叫料申请明细 /// public class AssembleRequestDetail : SfsStoreDetailWithQtyEntityBase, IHasToLocation { + + #region 目标库位信息 + /// - /// 到库位 + /// 目标库位 /// + [Display(Name = "目标库位")] + [StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")] public string ToLocationCode { get; set; } /// - /// 到库区 + /// 目标库区 /// + [Display(Name = "目标库区")] public string ToLocationArea { get; set; } /// - /// 到库位组 + /// 目标库位组 /// + [Display(Name = "目标库位组")] public string ToLocationGroup { get; set; } /// - /// 到ERP库位 + /// 目标ERP储位 /// + [Display(Name = "目标ERP储位")] public string ToLocationErpCode { get; set; } /// - /// 到仓库 + /// 目标仓库 /// + [Display(Name = "目标仓库")] public string ToWarehouseCode { get; set; } - /// - /// 来源库区 - /// - public string FromLocationArea { get; set; } - - // /// - // /// 在途库库位 - // /// - // public string OnTheWayLocationCode { get; set; } + #endregion /// /// 生产线 /// public string ProdLine { get; set; } - /// - /// 工作中心 - /// - public string WorkStation { get; set; } - - /// - /// 过期时间 - /// - public DateTime ExpiredTime { get; set; } - /// /// 已发数量 /// @@ -102,4 +94,10 @@ public class AssembleRequestDetail : SfsStoreDetailWithQtyEntityBase, IHasToLoca /// 推荐类型 /// public EnumRecommendType RecommendType { get; set; } + + /// + /// 需求箱数量 + /// + [Display(Name = "需求箱数量")] + public decimal BoxQty { get; set; } } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/MaterialRequests/AssembleRequests/AssembleRequestManager.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/MaterialRequests/AssembleRequests/AssembleRequestManager.cs index 94040930d..7d9d76b1f 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/MaterialRequests/AssembleRequests/AssembleRequestManager.cs +++ b/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 - /// /// 创建 /// @@ -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); diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/MaterialRequests/AssembleRequests/IAssembleRequestManager.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/MaterialRequests/AssembleRequests/IAssembleRequestManager.cs index 653efecd3..ce48dbfd9 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/MaterialRequests/AssembleRequests/IAssembleRequestManager.cs +++ b/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, IBulkImportService -{ - - Task UpdateDetailsAsync(AssembleRequest entity); - +{ Task CompleteAsync(string number); Task CreateBynNumberAsync(AssembleRequest entity); diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/MaterialRequests/CoatingMaterialRequests/CoatingMaterialRequest.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/MaterialRequests/CoatingMaterialRequests/CoatingMaterialRequest.cs index cd89d4c7a..0fb1bb36d 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/MaterialRequests/CoatingMaterialRequests/CoatingMaterialRequest.cs +++ b/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; /// -/// 喷涂要料申请 +/// 喷涂叫料申请 /// public class CoatingMaterialRequest : SfsStoreRequestAggregateRootBase { @@ -15,25 +15,7 @@ public class CoatingMaterialRequest : SfsStoreRequestAggregateRootBase [Display(Name = "叫料类型")] [IgnoreUpdate] - public string Type { get; set; } - - /// - /// 喷涂要料计划单号 - /// - [IgnoreUpdate] - public string PreparationPlanNumber { get; set; } - - /// - /// 生产线 - /// - [IgnoreUpdate] - public string ProdLine { get; set; } - - /// - /// 车间 - /// - [IgnoreUpdate] - public string Workshop { get; set; } + public string Type { get; set; } /// /// 使用在途库 diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/MaterialRequests/CoatingMaterialRequests/CoatingMaterialRequestDetail.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/MaterialRequests/CoatingMaterialRequests/CoatingMaterialRequestDetail.cs index 2b197b158..68cf75e44 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/MaterialRequests/CoatingMaterialRequests/CoatingMaterialRequestDetail.cs +++ b/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 目标库位信息 + /// - /// 到库位 + /// 目标库位 /// + [Display(Name = "目标库位")] + [StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")] public string ToLocationCode { get; set; } /// - /// 到库区 + /// 目标库区 /// + [Display(Name = "目标库区")] public string ToLocationArea { get; set; } /// - /// 到库位组 + /// 目标库位组 /// + [Display(Name = "目标库位组")] public string ToLocationGroup { get; set; } /// - /// 到ERP库位 + /// 目标ERP储位 /// + [Display(Name = "目标ERP储位")] public string ToLocationErpCode { get; set; } /// - /// 到仓库 + /// 目标仓库 /// + [Display(Name = "目标仓库")] public string ToWarehouseCode { get; set; } - /// - /// 来源库区 - /// - public string FromLocationArea { get; set; } - - // /// - // /// 在途库库位 - // /// - // public string OnTheWayLocationCode { get; set; } + #endregion /// /// 生产线 /// public string ProdLine { get; set; } - /// - /// 工作中心 - /// - public string WorkStation { get; set; } - - /// - /// 过期时间 - /// - public DateTime ExpiredTime { get; set; } - /// /// 已发数量 /// @@ -102,4 +93,9 @@ public class CoatingMaterialRequestDetail : SfsStoreDetailWithQtyEntityBase, IHa /// public EnumRecommendType RecommendType { get; set; } + /// + /// 需求箱数量 + /// + [Display(Name = "需求箱数量")] + public decimal BoxQty { get; set; } } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/MaterialRequests/CoatingMaterialRequests/CoatingMaterialRequestManager.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/MaterialRequests/CoatingMaterialRequests/CoatingMaterialRequestManager.cs index 894d94c18..cde7e5cb9 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/MaterialRequests/CoatingMaterialRequests/CoatingMaterialRequestManager.cs +++ b/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; + } /// @@ -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 公有 - - /* - // /// - // /// 处理 - // /// - // /// - // public virtual async Task 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); - // } - // - // /// - // /// 关闭 - // /// - // /// - // public virtual async Task 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; - // } - // - // /// - // /// 打开 - // /// - // /// - // public virtual async Task 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 CreateAndHandleAsync(MaterialRequest entity) - { - - await base.CreateAsync(entity); - - await base.HandleAsync(entity.Id); - - return entity; - } - */ - - - #endregion - + #region Import /// @@ -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 BuildMaterialRequestDetailETO(List materialRequestDetail) - { - var list = new List(); - 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 - */ + } -///// -///// 为了解决补料时 无法拿到订阅错误信息 -///// -///// -///// -///// -//public virtual async Task 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; -//} diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/MaterialRequests/CoatingMaterialRequests/ICoatingMaterialRequestManager.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/MaterialRequests/CoatingMaterialRequests/ICoatingMaterialRequestManager.cs index 5a0606363..6e85da61a 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/MaterialRequests/CoatingMaterialRequests/ICoatingMaterialRequestManager.cs +++ b/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, IBulkImportService -{ - // Task CreateAndHandleAsync(MaterialRequest entity); - Task UpdateDetailsAsync(CoatingMaterialRequest entity); - +{ Task CompleteAsync(string number); Task CreateBynNumberAsync(CoatingMaterialRequest entity); diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/MaterialRequests/InjectionRequests/IInjectionRequestManager.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/MaterialRequests/InjectionRequests/IInjectionRequestManager.cs index 551903daa..efa9c5dd5 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/MaterialRequests/InjectionRequests/IInjectionRequestManager.cs +++ b/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, IBulkImportService -{ - Task UpdateDetailsAsync(InjectionRequest entity); +{ Task CompleteAsync(string number); diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/MaterialRequests/InjectionRequests/InjectionRequestDetail.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/MaterialRequests/InjectionRequests/InjectionRequestDetail.cs index 220f3254c..e1cfa692d 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/MaterialRequests/InjectionRequests/InjectionRequestDetail.cs +++ b/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; /// -/// 注塑申请明细 +/// 注塑叫料申请明细 /// public class InjectionRequestDetail : SfsStoreDetailWithQtyEntityBase, IHasToLocation { diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/MaterialRequests/InjectionRequests/InjectionRequestManager.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/MaterialRequests/InjectionRequests/InjectionRequestManager.cs index cff1683fa..5c09a2626 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/MaterialRequests/InjectionRequests/InjectionRequestManager.cs +++ b/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); diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Requests/MaterialRequests/AssembleRequests/AssembleRequestDbContextModelCreatingExtensions.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Requests/MaterialRequests/AssembleRequests/AssembleRequestDbContextModelCreatingExtensions.cs index 8d53f0ac3..1d6944096 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Requests/MaterialRequests/AssembleRequests/AssembleRequestDbContextModelCreatingExtensions.cs +++ b/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(); //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(); diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Requests/MaterialRequests/CoatingMaterialRequestDbContextModelCreatingExtensions.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Requests/MaterialRequests/CoatingMaterialRequestDbContextModelCreatingExtensions.cs index ac89a7de5..3b69edce7 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Requests/MaterialRequests/CoatingMaterialRequestDbContextModelCreatingExtensions.cs +++ b/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(); //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(); diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/AssembleRequestEventHandler.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/AssembleRequestEventHandler.cs index 796227276..102ac62a2 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/AssembleRequestEventHandler.cs +++ b/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 { assembleRequestDetail.FromLocationArea }, + Statuses = transactionType.OutInventoryStatuses, }; //获取推荐库存 @@ -245,9 +245,7 @@ public class AssembleRequestEventHandler //ProductionLineDTO prodLine = await _productionLineAppService.GetByLocationGroupCodeAsync(toLocationGroupCode).ConfigureAwait(false); var detail = ObjectMapper.Map(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; diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/CoatingMaterialRequestEventHandler.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/CoatingMaterialRequestEventHandler.cs index 287ebabf2..d11d7ac96 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/CoatingMaterialRequestEventHandler.cs +++ b/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 { 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(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; diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/Note/CoatingIssueNoteEventHandler.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/Note/CoatingIssueNoteEventHandler.cs index f41206079..d0b3ae53f 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/Note/CoatingIssueNoteEventHandler.cs +++ b/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); + } } }