public ActionResult SaveSMSQuery(ulong smsID, string customerName, string telphone, string vehicleCodes, string LicenceNumbers)
        {
            if (string.IsNullOrEmpty(customerName))
            {
                return Json(new
                {
                    result = 0,
                    data = "请输入姓名!"
                });
            }

            if (string.IsNullOrEmpty(telphone))
            {
                return Json(new
                {
                    result = 0,
                    data = "请输入手机号码!"
                });
            }

            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)
            {
                return Json(new
                {
                    result = 0,
                    data = "请选择查询车辆!"
                });
            }
            List<string> licenceList = new List<string>();
            if (!string.IsNullOrEmpty(LicenceNumbers))
            {
                string[] licenceArray = LicenceNumbers.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
                int length = licenceArray.Count();
                for (int i = 0; i < length; i++)
                {
                    licenceList.Add(licenceArray[i]);
                }
            }
            if (licenceList.Count <= 0)
            {
                return Json(new
                {
                    result = 0,
                    data = "请选择查询车辆!"
                });
            }
            WebManagerWCFService webManagerService = new WebManagerWCFService();

            List<string> msgList = new List<string>();
            for (int i = 0; i < codes.Count; i++)
            {
                List<ulong> smsIDList = webManagerService.GetSmsQuerySmsIDList(SessionUserInfo.SelectedUser.TenantCode, codes[i].ToString());
                if (smsIDList.Count > 5 || smsIDList.Count == 5 && !smsIDList.Contains(smsID))
                {
                    msgList.Add(licenceList[i]);
                }
            }
            if (msgList.Count > 0)
            {
                return Json(new
                {
                    result = 0,
                    data = string.Format("操作失败,以下车辆已被关注5次\r\n{0}\r\n请重新选择车辆", string.Join(",", msgList.ToArray()))
                });
            }

            SmsQueryVehicleParam param = new SmsQueryVehicleParam();
            param.smsid = smsID;
            param.CustomerName = customerName;
            param.TenantCode = SessionUserInfo.TenantCode;
            param.vehicleCodelist = codes;
            param.Telphone = telphone;
            param.LicenceNumberlist = licenceList;

            ResultContent DBresult = _ISysSettingWCFService.UpdateSMSQuery(param);

            return Json(new
            {
                result = DBresult.Result ? 1 : 0,
                data = DBresult.Message
            });
        }
        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;
        }
Example #3
0
 public ActionResult ModifySMSQuery(ulong smsID)
 {
     WebManagerWCFService service = new WebManagerWCFService();
     EMSMSQueryVehicle entity = service.GetSMSQuery(smsID);
     ViewData["Telphone"] = entity.CustomerTelephone;
     ViewData["CustomerName"] = entity.CustomerName;
     ViewData["smsID"] = entity.sms_vehicle_set_id;
     ViewData["VehicleCodes"] = entity.VehicleList.Replace('、', ',');
     ViewData["LicenseNumbers"] = entity.LicenseNumberDesc.Replace('、', ',');
     return View("EndCustomer/ModifySMSQuery");
 }