Esempio n. 1
0
        public ActionResult GetData(int page = 1, int rows = 10, string sort = "Id", string order = "asc", string filterRules = "")
        {
            var filters    = JsonConvert.DeserializeObject <IEnumerable <filterRule> >(filterRules);
            int totalCount = 0;
            //int pagenum = offset / limit +1;

            var scheduledetails = _scheduleDetailService.Query(new ScheduleDetailQuery().Withfilter(filters)).Include(s => s.ComponentSKU).Include(s => s.ParentSKU).Include(s => s.ProductionSchedule).Include(s => s.Shift).Include(s => s.Station).OrderBy(n => n.OrderBy(sort, order)).SelectPage(page, rows, out totalCount);

            var datarows = scheduledetails.Select(n => new { ComponentSKUSku = (n.ComponentSKU == null?"": n.ComponentSKU.Sku), ParentSKUSku = (n.ParentSKU == null?"": n.ParentSKU.Sku), ProductionScheduleScheduleNo = (n.ProductionSchedule == null?"": n.ProductionSchedule.ScheduleNo), ShiftName = (n.Shift == null?"": n.Shift.Name), StationStationNo = (n.Station == null?"": n.Station.StationNo), Id = n.Id, ScheduleNo = n.ScheduleNo, WorkNo = n.WorkNo, ParentSKUId = n.ParentSKUId, ComponentSKUId = n.ComponentSKUId, GraphSKU = n.GraphSKU, GraphVer = n.GraphVer, ConsumeQty = n.ConsumeQty, StockQty = n.StockQty, RequirementQty = n.RequirementQty, ScheduleProductionQty = n.ScheduleProductionQty, ActualProductionQty = n.ActualProductionQty, StationId = n.StationId, ShiftId = n.ShiftId, Operator = n.Operator, Status = n.Status, AltProdctionDate1 = n.AltProdctionDate1, ActualProdctionDate1 = n.ActualProdctionDate1, AltProdctionDate2 = n.AltProdctionDate2, ActualProdctionDate2 = n.ActualProdctionDate2, AltProdctionDate3 = n.AltProdctionDate3, ActualProdctionDate3 = n.ActualProdctionDate3, AltConsumeTime = n.AltConsumeTime, ActualConsumeTime = n.ActualConsumeTime, Remark1 = n.Remark1, Remark2 = n.Remark2, ProductionScheduleId = n.ProductionScheduleId }).ToList();
            var pagelist = new { total = totalCount, rows = datarows };

            return(Json(pagelist, JsonRequestBehavior.AllowGet));
        }