You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

40 lines
1.3 KiB

using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Threading.Tasks;
using Volo.Abp.Domain.Services;
using Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Mes;
namespace Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg;
public class IssueNoteManager : DomainService, IIssueNoteManager
{
private readonly IIssueRepository _repository;
public IssueNoteManager(IIssueRepository repository)
{
_repository = repository;
}
public async Task<List<IssueNote>> GetToBeProcessedListAsync()
{
var issues = await _repository.GetListAsync(p => p.IsReceive == 1.ToString(CultureInfo.InvariantCulture) && p.WmsState == 0).ConfigureAwait(false);
return issues;
}
public virtual async Task PostListAsync(List<IssueNote> entities)
{
await _repository.InsertManyAsync(entities).ConfigureAwait(false);
}
public virtual async Task UpdateProcessedListAsync(List<IssueNote> entities)
{
var ids = entities.Select(p => p.DeliverNumber);
var issues = await _repository.GetListAsync(p => ids.Contains(p.DeliverNumber)).ConfigureAwait(false);
issues.ForEach(p =>
{
p.WmsState = 1;
p.WmsDate = DateTime.Now;
});
await _repository.UpdateManyAsync(issues).ConfigureAwait(false);
}
}