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.
 
 
 
 
 
 

44 lines
1.3 KiB

using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Volo.Abp.Domain.Services;
namespace Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.EOS;
public class ShipManager : DomainService, IShipManager
{
private readonly IShipRepository _repository;
public ShipManager(IShipRepository repository)
{
_repository = repository;
}
public virtual async Task<List<Ship>> GetToBeProcessedListAsync()
{
var plans = await _repository.GetListAsync(p => p.WmsState == 0).ConfigureAwait(false);
return plans;
}
public virtual async Task<bool> CheckIsHistoryShip(string shipBillNo)
{
var result = false;
var plans = await _repository.GetListAsync(p => p.WmsState == 1 && p.ShipBillNo == shipBillNo).ConfigureAwait(false);
if (plans.Count > 0)
{
result = true;
}
return result;
}
public virtual async Task UpdateProcessedListAsync(List<Ship> 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;
});
await _repository.UpdateManyAsync(plans).ConfigureAwait(false);
}
}