public ActionResult SearchOffOilElectricity(string vehicleCodes, string userCode, string tenantCode) { List<Guid> codes = new List<Guid>(); if (!string.IsNullOrEmpty(vehicleCodes)) { string[] codeArray = vehicleCodes.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); int length = codeArray.Count(); for (int i = 0; i < length; i++) { codes.Add(new Guid(codeArray[i])); } } if (codes.Count <= 0) { WebManagerWCFService webManagerWCFService = new WebManagerWCFService(); IList<EMVehicle> modelList = webManagerWCFService.GetVehicleList(userCode, tenantCode); foreach (EMVehicle model in modelList) { codes.Add(model.VehicleCode); } } SearchVehicleOilControlInfoParam param = new SearchVehicleOilControlInfoParam() { VehicleCodes = codes, RowIndex = RowIndex, PageSize = PageSize }; VehicleOilControlInfoVMList oilControlInfoVMList = _ISysSettingWCFService.SearchVehicleOilControlInfo(param); if (oilControlInfoVMList != null) { var query = from u in oilControlInfoVMList.List select new { cell = new string[]{ "",//操作列 GetVehicleInfo(u), u.LastSendCommandTimeStr, u.CommandStateStr, "",//历史指令列 u.VehicleCode.ToString(), u.LicenceNumber, u.IsEnable?"1":"0", !string.IsNullOrEmpty(u.GPSCode) && u.OilState.HasValue && u.OilState==1?"1":"0",//是否显示断油断电按键 !string.IsNullOrEmpty(u.GPSCode) && u.OilState.HasValue && u.OilState==0?"1":"0"//是否显示供油供电按键 } }; var result = new { total = oilControlInfoVMList.RowCount / Convert.ToInt32(PageSize) + 1, page = GridPageIndex, records = oilControlInfoVMList.RowCount, rows = query }; return Json(result, JsonRequestBehavior.AllowGet); } return null; }