using Infrastructure; using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Http; using Newtonsoft.Json.Linq; using System; using System.Collections.Generic; using System.Linq; using System.Linq.Expressions; using WebRepository; namespace WebApp { /// <summary> /// 堆垛机监控 /// </summary> public partial class STKMonitorApp { private IUnitWork _unitWork; public STKMonitorApp(IUnitWork unitWork) { _unitWork = unitWork; } public TableData GetRowApp(int Roadway) { TableData tab = new TableData(); try { if (Roadway == 5) { var list = (from location in _unitWork.Find<Location>(null) where location.Roadway == Roadway && (location.Code.Contains("EA") || location.Code.Contains("EB")) group location by new { location.Row, location.Roadway } into loc select new { loc.Key.Row, loc.Key.Roadway }).ToList(); tab.data = list; } else if (Roadway == 6) { var list = (from location in _unitWork.Find<Location>(null) where location.Roadway == 5 && (location.Code.Contains("EC") || location.Code.Contains("ED")) group location by new { location.Row, location.Roadway } into loc select new { loc.Key.Row, loc.Key.Roadway }).ToList(); tab.data = list; } else { var list = (from location in _unitWork.Find<Location>(null) where location.Roadway == Roadway group location by new { location.Row, location.Roadway } into loc select new { loc.Key.Row, loc.Key.Roadway }).ToList(); tab.data = list; } tab.code = 200; } catch (Exception ex) { tab.code = 300; tab.msg = ex.Message; } return tab; } } }