public JsonResult LoadDispatchDeliverPlansCountByCarNo(string strCarNo) { string strErrText; PlanSystem plan = new PlanSystem(); List<DeliverPlan> listPlan = plan.LoadDispatchDeliverPlans(string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, strCarNo, LoginAccountId, LoginStaffName, out strErrText); if (listPlan == null) { throw new Exception(strErrText); } return Json(listPlan.Count, JsonRequestBehavior.AllowGet); }
public JsonResult LoadDispatchDeliverPlansGrid(string sidx, string sord, int page, int rows, string organId, string customerName, string shipmentNo, string deliveryNo, string receiverName, string destCountry, string destProvince, string destCity, string warehouse, string arrivalTime, string carNo) { //读取数据 string strErrText; PlanSystem plan = new PlanSystem(); List<DeliverPlan> listPlan = plan.LoadDispatchDeliverPlans(organId, customerName, shipmentNo, deliveryNo, receiverName, destCountry, destProvince, destCity, warehouse, arrivalTime, carNo, LoginAccountId, LoginStaffName, out strErrText); if (listPlan == null) { throw new Exception(strErrText); } //提取当前页面数据 int nTotalRows = listPlan.Count; int nPageIndex = page; int nPageSize = rows; int nTotalPages = nTotalRows / nPageSize; if (nTotalRows % nPageSize > 0) nTotalPages++; string sortExpression = (sidx ?? "CreateTime") + " " + (sord ?? "ASC"); var data = listPlan.OrderBy(sortExpression).Skip((nPageIndex - 1) * nPageSize).Take(nPageSize).ToList(); //生成表格数据 var ret = new { total = nTotalPages, page = nPageIndex, records = nTotalRows, rows = ( from p in data select new { id = p.Id, cell = new string[] { p.Id.ToString(), p.PlanNo, p.CustomerName, p.ShipmentNo, p.DeliveryNo, p.ReceiverName, p.ReceiverCity, p.Warehouse, p.ArrivalTime, p.PlanType, p.BalanceTunnages.ToString("#0.######"), p.BalancePiles.ToString("#0.######"), p.CreateTime.ToString("yyyy-MM-dd"), p.ReceiveType, p.CarNo, p.Remark } }).ToArray(), userdata = new { PlanNo = InnoSoft.LS.Resources.Labels.Total, BalanceTunnages = data.Sum(s => s.BalanceTunnages), BalancePiles = data.Sum(s => s.BalancePiles) } }; return Json(ret, JsonRequestBehavior.AllowGet); }