using MESClassLibrary.BLL.Log; using MESClassLibrary.EFModel; using MESClassLibrary.Model; using System; using System.Collections.Generic; using System.Linq; using System.Reflection; using System.Text; namespace MESClassLibrary.BLL.Record247 { public class Record247BLL { BBMPTEntities ef = new BBMPTEntities(); BasicBLL db = new BasicBLL(); /// /// 查询全部信息分页 /// /// public string SearchInfoAll(string page, string pagesize, string StartTime, string EndTime, string BoxNo, string PartNo2, string PartNo1, string OrderNo) { try { string jsonStr = "[]"; int total = 0;//总行数 DateTime stime = Convert.ToDateTime(StartTime + " 00:00:00"); DateTime etime = Convert.ToDateTime(EndTime + " 23:59:59"); List list = ef.tb_Record_247.Where(p => p.CreateTime1 >= stime && p.CreateTime1 <= etime && p.Flag == 1).ToList(); if (!String.IsNullOrEmpty(BoxNo)) { list = list.Where(p => p.BoxNo != null && p.BoxNo.Contains(BoxNo)).ToList(); } if (!String.IsNullOrEmpty(PartNo2)) { list = list.Where(p => p.PartNo2 != null && p.PartNo2.Contains(PartNo2)).ToList(); } if (!String.IsNullOrEmpty(PartNo1)) { list = list.Where(p => p.PartNo1 != null && p.PartNo1.Contains(PartNo1)).ToList(); } if (!String.IsNullOrEmpty(OrderNo)) { list = list.Where(p => p.OrderNo != null && p.OrderNo.Contains(OrderNo)).ToList(); } if (list.Count > 0) { total = list.Count; int Skipcount = (Convert.ToInt32(page) - 1) * Convert.ToInt32(pagesize); list = list.OrderBy(p => p.CreateTime1).Skip(Skipcount).Take(Convert.ToInt32(pagesize)).ToList(); JsonDataModel md = new JsonDataModel(); md.total = total.ToString(); md.rows = list; jsonStr = JSONTools.ScriptSerialize(md); } return jsonStr; } catch (Exception ex) { LogErrBLL.AddInfo(ex.ToString(), MethodBase.GetCurrentMethod()); return null; } } } }