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.

38 lines
1.0 KiB

2 years ago
using System;
2 years ago
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
2 years ago
using Microsoft.EntityFrameworkCore;
2 years ago
using Volo.Abp.Domain.Services;
namespace Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.EOS;
public class PlanManager : DomainService, IPlanManager
{
private readonly IPlanRepository _repository;
public PlanManager(IPlanRepository repository)
{
_repository = repository;
}
public virtual async Task<List<Plan>> GetToBeProcessedListAsync()
{
var plans = await _repository.GetListAsync(p => p.WmsState == 0).ConfigureAwait(false);
2 years ago
2 years ago
return plans;
}
public virtual async Task UpdateProcessedListAsync(List<Plan> entities)
{
var ids = entities.Select(p => p.Id);
var plans = await _repository.GetListAsync(p => ids.Contains(p.Id)).ConfigureAwait(false);
plans.ForEach(p =>
{
p.WmsState = 1;
p.WmsDate = Clock.Now;
});
2 years ago
await _repository.BulkUpdateAsync(plans).ConfigureAwait(false);
2 years ago
}
}