You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
65 lines
1.8 KiB
C#
65 lines
1.8 KiB
C#
using Chloe;
|
|
using DB.Entity;
|
|
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
using Tool;
|
|
|
|
namespace DB.Service
|
|
{
|
|
public class ReadBufLogService
|
|
{
|
|
|
|
public PagedList<ReadBufLog> GetPagedList(int pageIndex, int pageSize, string category,DateTime beDateTime,DateTime endTime)
|
|
{
|
|
|
|
|
|
PagingResult<ReadBufLog> pagePagingResult;
|
|
using (var dbContext = DbFactory.GetContext)
|
|
{
|
|
pagePagingResult = dbContext.Query<ReadBufLog>()
|
|
//.Where(x=>x.CreateTime>=beDateTime)
|
|
//.Where(x=>x.CreateTime<=endTime)
|
|
.Where(x=>x.Category==category)
|
|
.OrderByDesc(x => x.ID)
|
|
.Paging(pageIndex, pageSize);
|
|
|
|
}
|
|
|
|
|
|
PagedList<ReadBufLog> paged =
|
|
new PagedList<ReadBufLog>(pagePagingResult.DataList,
|
|
pagePagingResult.Totals.ToInt(), pageIndex, pageSize);
|
|
|
|
return paged;
|
|
|
|
}
|
|
|
|
public void Insert(string category, string barCode)
|
|
{
|
|
using (var dbContext = DbFactory.GetContext)
|
|
{
|
|
var entity= dbContext.Query<ReadBufLog>()
|
|
.Where(x => x.Category == category)
|
|
.Where(x => x.BarCode == barCode)
|
|
|
|
.OrderBy(x => x.ID)
|
|
.Select(x => x.BarCode).FirstOrDefault();
|
|
if (string.IsNullOrEmpty(entity))
|
|
{
|
|
ReadBufLog log = new ReadBufLog();
|
|
log.CreateTime=DateTime.Now;
|
|
log.ID = SnowflakeFactory.NewId;
|
|
log.Category = category;
|
|
log.BarCode = barCode;
|
|
dbContext.Insert(log);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|