Example #1
0
        /// <summary>
        /// 查询车辆当前信息和最近指令信息
        /// </summary>
        public VehicleOilControlInfoVMList SearchVehicleOilControlInfo(SearchVehicleOilControlInfoParam param)
        {
            EMGpsTypeService gpsTypeSve = new EMGpsTypeService();
            List<EMGpsType> gpsTypeList = gpsTypeSve.GetByPeripheralList(new List<PeripheralEnum>() { PeripheralEnum.Relay });
            List<ulong> gpsTypeIDList = gpsTypeList.Select(o => o.GPSTypeID).ToList();
           
            int rowCount;
            VehicleDAL veDal = new VehicleDAL();
            List<EMVehicleOilInfo> veOilList = veDal.GetVehicleOil(param.VehicleCodes, gpsTypeIDList, param.RowIndex, param.PageSize, out  rowCount, Param_OffLineTime);
            if (rowCount == 0)
                return null;
            IList<VehicleOilControlInfoVM> ltVM = NewBuildVM(veOilList);
           
            //PositioningWCFService positioningWCFServ = new PositioningWCFService();
            //positioningWCFServ.GetLoaction(ltVM);   //获取地址

            return new VehicleOilControlInfoVMList()
            {
                List = ltVM.ToList(),
                RowCount = rowCount
            };
        }
        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;
        }