first commit
This commit is contained in:
@@ -0,0 +1,49 @@
|
||||
using JSMachine.WMS.App.Dto;
|
||||
using JSMachine.WMS.App.IService;
|
||||
using JSMachine.WMS.Domain.Entity;
|
||||
using JSMachine.WMS.Domain.IRepository;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace JSMachine.WMS.App.ServiceImpl
|
||||
{
|
||||
public class ElevatorCountService : BaseService<ElevatorCountDto, ElevatorCount>, IElevatorCountService
|
||||
{
|
||||
public ElevatorCountService(IBaseRepository<ElevatorCount> baseRepository) : base(baseRepository)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 计数自增
|
||||
/// </summary>
|
||||
/// <param name="elevatorNo"></param>
|
||||
/// <param name="channel"></param>
|
||||
/// <returns></returns>
|
||||
public async Task IncrementCount(int elevatorNo, int channel)
|
||||
{
|
||||
ElevatorCountDto elevatorCount = await GetSingalByExpression(p =>
|
||||
p.CreationTime >= DateTime.Now.Date &&
|
||||
p.ElevatorNo == elevatorNo &&
|
||||
p.ElevatorChannel == channel);
|
||||
if (elevatorCount == null)
|
||||
{
|
||||
elevatorCount = new()
|
||||
{
|
||||
ElevatorNo = elevatorNo,
|
||||
ElevatorChannel = channel,
|
||||
Count = 1
|
||||
};
|
||||
|
||||
await Add(elevatorCount);
|
||||
}
|
||||
else
|
||||
{
|
||||
elevatorCount.Count++;
|
||||
await EditSingal(elevatorCount);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user