public JsonResult LoadReprintShipmentBillsGrid(string sidx, string sord, int page, int rows, string startTime, string endTime, string shipmentBillNo, string customerName, string carNo) { //读取数据 string strErrText; DeliverSystem deliver = new DeliverSystem(); List<ShipmentBill> listShipmentBill = deliver.LoadShipmentBillsByConditions(startTime, endTime, shipmentBillNo, customerName, carNo, LoginAccountId, LoginStaffName, out strErrText); if (listShipmentBill == null) { throw new Exception(strErrText); } //提取当前页面数据 int nTotalRows = listShipmentBill.Count; int nPageIndex = page; int nPageSize = rows; int nTotalPages = nTotalRows / nPageSize; if (nTotalRows % nPageSize > 0) nTotalPages++; string sortExpression = (sidx ?? "BillNo") + " " + (sord ?? "ASC"); var data = listShipmentBill.OrderBy(sortExpression).Skip((nPageIndex - 1) * nPageSize).Take(nPageSize).ToList(); //生成表格数据 var ret = new { total = nTotalPages, page = nPageIndex, records = nTotalRows, rows = ( from b in data select new { id = b.Id, cell = new string[] { b.Id.ToString(), b.BillNo, b.CustomerName, b.DeliveryNo, b.ReceiverName, b.CarNo, b.TrailerNo, b.PlanType, b.TotalPackages.ToString(), b.TotalTunnages.ToString("#0.######"), b.TotalPiles.ToString("#0.######"), b.TotalTenThousands.ToString("#0.######") } }).ToArray() }; return Json(ret, JsonRequestBehavior.AllowGet); }