|
|
@ -1,6 +1,8 @@ |
|
|
|
using System; |
|
|
|
using System.Collections.Generic; |
|
|
|
using System.Linq; |
|
|
|
using System.Threading.Tasks; |
|
|
|
using DocumentFormat.OpenXml.Math; |
|
|
|
using Win_in.Sfs.Shared.Domain.Shared; |
|
|
|
using Win_in.Sfs.Shared.Event; |
|
|
|
using static Win_in.Sfs.Wms.Store.Domain.Shared.StoreSettings; |
|
|
@ -12,12 +14,15 @@ public class MaterialRequestManager |
|
|
|
, IMaterialRequestManager |
|
|
|
{ |
|
|
|
private readonly IMaterialRequestRepository _repository; |
|
|
|
private readonly IIssueJobRepository _issueJobRepository; |
|
|
|
|
|
|
|
public MaterialRequestManager( |
|
|
|
IMaterialRequestRepository repository |
|
|
|
, IIssueJobRepository issueJobRepository |
|
|
|
) : base(repository) |
|
|
|
{ |
|
|
|
_repository = repository; |
|
|
|
_issueJobRepository = issueJobRepository; |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
@ -133,7 +138,7 @@ public class MaterialRequestManager |
|
|
|
SetMaterialRequestDetailStatus(detail); |
|
|
|
} |
|
|
|
|
|
|
|
SetMaterialRequestStatus(oldEntity); |
|
|
|
await SetMaterialRequestStatus(oldEntity).ConfigureAwait(false); |
|
|
|
|
|
|
|
await Repository.UpdateAsync(oldEntity).ConfigureAwait(false); |
|
|
|
} |
|
|
@ -157,11 +162,15 @@ public class MaterialRequestManager |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
private void SetMaterialRequestStatus(MaterialRequest materialRequest) |
|
|
|
private async Task SetMaterialRequestStatus(MaterialRequest materialRequest) |
|
|
|
{ |
|
|
|
if (materialRequest.Details.All(p => p.Status == EnumStatus.Close)) |
|
|
|
{ |
|
|
|
materialRequest.RequestStatus = EnumRequestStatus.Completed; |
|
|
|
var issueJobs = await _issueJobRepository.GetListAsync(t => t.MaterialRequestNumber == materialRequest.Number).ConfigureAwait(false); |
|
|
|
if (issueJobs.All(t => t.JobStatus == EnumJobStatus.Done)) |
|
|
|
{ |
|
|
|
materialRequest.RequestStatus = EnumRequestStatus.Completed; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|