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.
57 lines
2.0 KiB
57 lines
2.0 KiB
using MESClassLibrary.BLL.Log;
|
|
using MESClassLibrary.EFModel;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Reflection;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace MESClassLibrary.BLL.Show
|
|
{
|
|
public class AnalysisBLL
|
|
{
|
|
BBMPTEntities dbe = new BBMPTEntities();
|
|
BasicBLL<tb_InspectResult> db = new BasicBLL<tb_InspectResult>();
|
|
|
|
public List<tb_InspectResult> SearchInfo(string ProductName)
|
|
{
|
|
List<tb_InspectResult> list = new List<tb_InspectResult>();
|
|
try
|
|
{
|
|
|
|
DateTime date = DateTime.Now;
|
|
//DateTime date = Convert.ToDateTime("2019-07-08 10:00:00");
|
|
string nowTime = date.ToString("yyyy-MM-dd");
|
|
DateTime startTime = Convert.ToDateTime(nowTime + " 08:00:00");//班次开始时间
|
|
DateTime endTime = Convert.ToDateTime(nowTime + " 19:59:59");//班次结束时间
|
|
|
|
var info = dbe.tb_InspectResult.Where(p => p.productInfo.Contains(ProductName));
|
|
if (DateTime.Compare(date, startTime) < 0)
|
|
{
|
|
//昨天夜班
|
|
list = info.Where(p => p.createTime > endTime.AddDays(-1) && p.createTime < startTime).ToList();
|
|
}
|
|
|
|
if (DateTime.Compare(date, endTime) > 0)
|
|
{
|
|
//今天夜班
|
|
list = info.Where(p => p.createTime > endTime && p.createTime <= date).ToList();
|
|
}
|
|
|
|
if (DateTime.Compare(date, startTime) >= 0 && DateTime.Compare(date, endTime) <= 0)
|
|
{
|
|
//今天白班
|
|
list = info.Where(p => p.createTime >= startTime && p.createTime <= endTime).ToList();
|
|
}
|
|
|
|
return list;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
LogErrBLL.AddInfo(ex.ToString(), MethodBase.GetCurrentMethod());
|
|
return list;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|