public void Statistics_DailyGather(string PKID, DateTime start, DateTime end) { try { IParking iparking = ParkingFactory.GetFactory(); string strerror = string.Empty; var parking = iparking.QueryParkingByParkingID(PKID); List <ParkGate> gatelist = ParkGateServices.QueryByParkingId(PKID); try { var p = iparking.QueryParkingByParkingID(PKID); new DailyGatherServices().Statistics_DailyByHour(p, start, end); } catch (Exception ex) { Common.Services.TxtLogServices.WriteTxtLog("按时统计异常 异常信息:{0}", ex.Message); } //按通道统计时数据 try { new GateGatherServices().Statistics_DailyByGate(gatelist, parking, start, end); } catch (Exception ex) { Common.Services.TxtLogServices.WriteTxtLog("按通道统计异常 异常信息:{0}", ex.Message); } } catch (Exception ex) { Common.Services.TxtLogServices.WriteTxtLog("按日统计异常 异常信息:{0}", ex.Message); } }
private string GetCompanyId(string pid, string bid, string gid) { try { if (!string.IsNullOrWhiteSpace(gid)) { ParkGate gate = ParkGateServices.QueryByRecordId(gid); if (gate != null) { bid = gate.BoxID; } } if (!string.IsNullOrWhiteSpace(pid)) { BaseCompany company = CompanyServices.QueryByParkingId(pid); if (company != null) { return(company.CPID); } } if (!string.IsNullOrWhiteSpace(bid)) { BaseCompany company = CompanyServices.QueryByBoxID(bid); if (company != null) { return(company.CPID); } } } catch (Exception ex) { ExceptionsServices.AddExceptionToDbAndTxt("QRCodeParkPayment", "GetCompanyId方法处理异常", ex, LogFrom.WeiXin); } return(string.Empty); }
public JsonResult SaveEdit(ParkGate model) { try { bool result = false; if (string.IsNullOrWhiteSpace(model.GateID)) { result = ParkGateServices.Add(model); if (!result) { throw new MyException("添加失败"); } return(Json(MyResult.Success())); } else { result = ParkGateServices.Update(model); if (!result) { throw new MyException("修改失败"); } return(Json(MyResult.Success())); } } catch (MyException ex) { return(Json(MyResult.Error(ex.Message))); } catch (Exception ex) { ExceptionsServices.AddExceptions(ex, "保存通道信息失败"); return(Json(MyResult.Error("保存通道信息失败"))); } }
public JsonResult QueryRemotelyOpenGateData() { try { List <string> parkingIds = new List <string>(); if (!string.IsNullOrWhiteSpace(Request.Params["parkingId"])) { parkingIds.Add(Request.Params["parkingId"]); } else { List <BaseParkinfo> parkings = ParkingServices.QueryParkingByVillageIds(GetLoginUserVillages.Select(p => p.VID).ToList()); if (parkings.Count > 0) { parkingIds.AddRange(parkings.Select(p => p.PKID)); } } string areaId = Request.Params["areaId"]; string boxId = Request.Params["boxId"]; int page = string.IsNullOrEmpty(Request.Params["page"]) ? 0 : int.Parse(Request.Params["page"]); int rows = 15; int recordTotalCount = 0; List <RemotelyOpenGateView> models = ParkGateServices.QueryRemotelyOpenGate(parkingIds, areaId, boxId, page, rows, out recordTotalCount); return(Json(MyResult.Success("", models))); } catch (Exception ex) { ExceptionsServices.AddExceptions(ex, "微信获取远程开闸数据失败"); return(Json(MyResult.Error("获取失败"))); } }
public JsonResult DownloadQRCode(string gateId, int size) { try { List <int> dics = new List <int>(); dics.Add(258); dics.Add(344); dics.Add(430); dics.Add(860); dics.Add(1280); List <string> imgs = new List <string>(); ParkGate gate = ParkGateServices.QueryByRecordId(gateId); if (gate == null) { throw new MyException("获取通道信息失败"); } BaseCompany company = CompanyServices.QueryByBoxID(gate.BoxID); if (company == null) { throw new MyException("获取单位信息失败"); } ParkBox box = ParkBoxServices.QueryByRecordId(gate.BoxID); if (box == null) { throw new MyException("获取岗亭信息失败"); } ParkArea area = ParkAreaServices.QueryByRecordId(box.AreaID); if (area == null) { throw new MyException("获取区域信息失败"); } BaseParkinfo parking = ParkingServices.QueryParkingByParkingID(area.PKID); if (parking == null) { throw new MyException("获取车场信息失败"); } string content = string.Format("{0}/qrl/scio_ix_pid={1}^io={2}", SystemDefaultConfig.SystemDomain, parking.PKID, gate.GateID); foreach (var item in dics) { string parkingName = string.Format("{0}_{1}_{2}_{3}_{4}", parking.PKName, area.AreaName, box.BoxName, gate.GateName, item); string result = QRCodeServices.GenerateQRCode(company.CPID, content, item, parkingName); imgs.Add(item.ToString() + "|" + result); } return(Json(MyResult.Success("", imgs))); } catch (MyException ex) { return(Json(MyResult.Error(ex.Message))); } catch (Exception ex) { ExceptionsServices.AddExceptions(ex, "下载二维码失败"); return(Json(MyResult.Error("下载二维码失败"))); } }
/// <summary> /// 进通道 /// </summary> /// <returns></returns> public JsonResult GetEntranceGates() { string parkingid = Request.Params["parkingid"]; JsonResult json = new JsonResult(); try { json.Data = ParkGateServices.QueryByParkingIdAndIoState(parkingid, IoState.GoIn); } catch { } return(json); }
/// <summary> /// 获得车场所有通道 /// </summary> /// <returns></returns> public JsonResult GetGates() { string parkingid = Request.Params["parkingid"]; JsonResult json = new JsonResult(); try { json.Data = ParkGateServices.QueryByParkingId(parkingid); } catch { } return(json); }
public void Statistics_DailyGather(DateTime start, DateTime end) { try { IParking iparking = ParkingFactory.GetFactory(); string strerror = string.Empty; List <BaseParkinfo> parks = iparking.QueryParkingAll(); if (parks == null || parks.Count == 0) { return; } end = end.Date.AddHours(23).AddMinutes(59); //循环车场 foreach (BaseParkinfo p in parks) { //如果在线上统计,则本地就不统计 if (p.IsOnLineGathe == YesOrNo.Yes) { continue; } List <ParkGate> gatelist = ParkGateServices.QueryByParkingId(p.PKID); TimeSpan ts = end - start; //统计近8天的数据 for (int i = ts.Days; i >= 0; i--) { try { new DailyGatherServices().Statistics_DailyByHour(p, end, i); } catch (Exception ex) { Common.Services.TxtLogServices.WriteTxtLog("按时统计异常 异常信息:{0}", ex.Message); } //按通道统计时数据 try { new GateGatherServices().Statistics_DailyByGate(gatelist, p, end, i); } catch (Exception ex) { Common.Services.TxtLogServices.WriteTxtLog("按通道统计异常 异常信息:{0}", ex.Message); } } } } catch (Exception ex) { Common.Services.TxtLogServices.WriteTxtLog("按日统计异常 异常信息:{0}", ex.Message); } }
public JsonResult GetParkGateData() { JsonResult json = new JsonResult(); try { if (string.IsNullOrEmpty(Request.Params["boxId"])) { return(json); } json.Data = ParkGateServices.QueryByParkBoxRecordId(Request.Params["boxId"].ToString()); } catch (Exception ex) { ExceptionsServices.AddExceptions(ex, "获取通道数据失败"); } return(json); }
private string GetParkingId(string pid, string bid, string gid) { try { if (!string.IsNullOrWhiteSpace(pid)) { return(pid); } if (!string.IsNullOrWhiteSpace(bid)) { ParkBox box = ParkBoxServices.QueryByRecordId(bid); if (box != null) { ParkArea area = ParkAreaServices.QueryByRecordId(box.AreaID); if (area != null) { return(area.PKID); } } } if (!string.IsNullOrWhiteSpace(gid)) { ParkGate gate = ParkGateServices.QueryByRecordId(gid); if (gate != null) { ParkBox box = ParkBoxServices.QueryByRecordId(gate.BoxID); if (box != null) { ParkArea area = ParkAreaServices.QueryByRecordId(box.AreaID); if (area != null) { return(area.PKID); } } } } } catch (Exception ex) { ExceptionsServices.AddExceptionToDbAndTxt("QRCodeParkPayment", "GetParkingId方法处理异常", ex, LogFrom.WeiXin); } return(string.Empty); }
public JsonResult Delete(string recordId) { try { bool result = ParkGateServices.Delete(recordId); if (!result) { throw new MyException("删除失败"); } return(Json(MyResult.Success())); } catch (MyException ex) { return(Json(MyResult.Error(ex.Message))); } catch (Exception ex) { ExceptionsServices.AddExceptions(ex, "通道管理删除通道信息失败"); return(Json(MyResult.Error("删除通道信息失败"))); } }
public string GetGateDataByAreaIds(string areaIds) { StringBuilder strTree = new StringBuilder(); strTree.Append("["); strTree.Append("{\"id\":\"-1\","); strTree.Append("\"text\":\"所有\",\"selected\":true"); strTree.Append("}"); if (!string.IsNullOrWhiteSpace(areaIds)) { List <string> areaIdlist = areaIds.Split(',').ToList(); List <ParkGate> gates = ParkGateServices.QueryByParkAreaRecordIds(areaIdlist).ToList(); foreach (var item in gates) { strTree.Append(",{\"id\":\"" + item.GateID + "\","); strTree.Append("\"text\":\"" + item.GateName + "\""); strTree.Append("}"); } } strTree.Append("]"); return(strTree.ToString()); }
public ActionResult TollRelease(decimal waitPay, string recordId, string carModelId) { try { string errorMsg = string.Empty; ParkIORecord model = ParkIORecordServices.GetIORecord(recordId, out errorMsg); if (!string.IsNullOrWhiteSpace(errorMsg)) { throw new MyException("获取该入场记录失败"); } if (model == null) { throw new MyException("找不到该入场记录"); } if (model.IsExit) { throw new MyException("该车辆已经出场"); } DateTime outTime = DateTime.Now; List <ParkGate> parkGates = ParkGateServices.QueryByParkAreaRecordIds(new List <string>() { model.AreaID }); ParkGate outGate = parkGates.FirstOrDefault(p => p.IoState == IoState.GoOut); if (outGate == null) { throw new MyException("获取出口通道失败"); } ResultAgs billResult = RateProcesser.GetRateResult(model, outGate, outTime, carModelId); if (!string.IsNullOrWhiteSpace(billResult.ValidFailMsg)) { throw new MyException(billResult.ValidFailMsg); } if (billResult.Rate == null) { throw new MyException("计算停车费失败"); } if (waitPay != billResult.Rate.UnPayAmount) { throw new MyException("缴费金额与实际金额不匹配,请重新选择入场记录"); } bool result = CentralFeeServices.Payment(recordId, model.ParkingID, billResult, GetLoginUser.RecordID); if (!result) { throw new MyException("缴费失败"); } return(Json(MyResult.Success())); } catch (MyException ex) { return(Json(MyResult.Error(ex.Message))); } catch (Exception ex) { ExceptionsServices.AddExceptions(ex, "提交收费失败"); return(Json(MyResult.Error("缴费失败"))); } }
public ActionResult QueryWaitPayDetail(string recordId, string carModelId) { try { string errorMsg = string.Empty; ParkIORecord model = ParkIORecordServices.GetIORecord(recordId, out errorMsg); if (!string.IsNullOrWhiteSpace(errorMsg)) { throw new MyException("获取该入场记录失败"); } if (model == null) { throw new MyException("找不到该入场记录"); } if (model.IsExit) { throw new MyException("该车辆已经出场"); } DateTime outTime = DateTime.Now; List <ParkGate> parkGates = ParkGateServices.QueryByParkAreaRecordIds(new List <string>() { model.AreaID }); ParkGate outGate = parkGates.FirstOrDefault(p => p.IoState == IoState.GoOut); if (outGate == null) { throw new MyException("获取出口通道失败"); } ResultAgs billResult = RateProcesser.GetRateResult(model, outGate, outTime, carModelId); if (!string.IsNullOrWhiteSpace(billResult.ValidFailMsg)) { throw new MyException(billResult.ValidFailMsg); } if (billResult.Rate == null) { throw new MyException("计算停车费失败"); } List <ParkIORecord> records = new List <ParkIORecord>() { model }; var result = from p in records select new { RecordID = p.RecordID, EntranceImageUrl = GetImagePath(p.EntranceImage, true, false), EntrancePlateImageUrl = GetImagePath(p.EntranceImage, false, false), PlateNumber = p.PlateNumber, EntranceTime = p.EntranceTime.ToString("yyyy-MM-dd HH:mm:ss"), OutTime = outTime.ToString("yyyy-MM-dd HH:mm:ss"), TotalDuration = p.EntranceTime.GetParkingDuration(outTime), TotalFee = billResult.Rate.Amount.ToString("0.0"), PaySuccess = billResult.Rate.OnlinePayAmount.ToString("0.0"), WaitPay = billResult.Rate.UnPayAmount.ToString("0.0"), DiscountAmount = billResult.Rate.DiscountAmount.ToString("0.0") }; return(Json(MyResult.Success(string.Empty, result))); } catch (MyException ex) { return(Json(MyResult.Error(ex.Message))); } catch (Exception ex) { ExceptionsServices.AddExceptions(ex, "中央缴费获取待支付记录失败"); return(Json(MyResult.Error("取待支付记录失败"))); } }
public ActionResult Passed(string recordId) { try { List <BaseVillage> villages = VillageServices.QueryVillageByEmployeeMobilePhone(WeiXinUser.MobilePhone); List <EnumContext> parkContexts = new List <EnumContext>(); if (villages.Count > 0) { List <BaseParkinfo> parkings = ParkingServices.QueryParkingByVillageIds(villages.Select(p => p.VID).ToList()); foreach (var item in parkings) { EnumContext model = new EnumContext(); model.Description = item.PKName; model.EnumString = item.PKID; parkContexts.Add(model); } } ViewBag.ParkContexts = parkContexts; ParkMonthlyCarApply monthlyCarApply = ParkMonthlyCarApplyServices.QueryByRecordID(recordId); if (monthlyCarApply == null) { throw new MyException("申请信息不存在"); } List <ParkArea> areas = ParkAreaServices.GetParkAreaByParkingId(monthlyCarApply.PKID); List <EnumContext> areaContexts = new List <EnumContext>(); foreach (var item in areas) { EnumContext model = new EnumContext(); model.Description = item.AreaName; model.EnumString = item.AreaID; areaContexts.Add(model); } ViewBag.AreaContexts = areaContexts; List <EnumContext> gateContexts = new List <EnumContext>(); foreach (var item in areaContexts) { List <ParkGate> gates = ParkGateServices.QueryByParkAreaRecordIds(new List <string>() { item.EnumString }); foreach (var gate in gates) { EnumContext model = new EnumContext(); model.Description = gate.GateName; model.EnumString = string.Format("{0}|{1}", gate.GateID, item.EnumString); gateContexts.Add(model); } } ViewBag.GateContexts = gateContexts; return(View(monthlyCarApply)); } catch (Exception ex) { ExceptionsServices.AddExceptionToDbAndTxt("AdminAduitCarApply", "查看月租车申请详情失败", ex, LogFrom.WeiXin); return(RedirectToAction("Index", "AdminAduitCarApply", new { RemindUserContent = "审核失败" })); } }
protected override void ProcessRule(InputAgs args, ResultAgs rst) { if (args.GateInfo == null) { return; } List <ParkGateIOTime> parkGateIOTimes = ParkGateServices.QueryGateIOTime(args.GateInfo.GateID); if (parkGateIOTimes == null || parkGateIOTimes.Count <= 0) { return; } bool isSpeacildate = false; foreach (var item in parkGateIOTimes) { if (item.EndTime == "23:59") { item.EndTime = "23:59:59"; } if (item.RuleType == 0) { continue; } if (item.RuleDate != args.Plateinfo.TriggerTime.Date)//先检查特殊日期 { continue; } isSpeacildate = true; if (args.Plateinfo.TriggerTime.TimeOfDay > item.StartTime.ToTimeSpan() && args.Plateinfo.TriggerTime.TimeOfDay < item.EndTime.ToTimeSpan()) { if (item.InOutState == 1) { rst.ResCode = ResultCode.NoPermissionsInOut; rst.ValidMsg = "通道进出时段限制"; return; } } else//时段外 如果时段内是允许进的,时段外就不允许进 { if (item.InOutState == 0) { rst.ResCode = ResultCode.NoPermissionsInOut; rst.ValidMsg = "通道进出时段限制"; return; } } } if (isSpeacildate) { return; } foreach (var item in parkGateIOTimes)//再检查星期 { if (item.RuleType == 1) { continue; } if ((int)args.Plateinfo.TriggerTime.DayOfWeek != item.WeekIndex) { continue; } isSpeacildate = true; if (args.Plateinfo.TriggerTime.TimeOfDay > item.StartTime.ToTimeSpan() && args.Plateinfo.TriggerTime.TimeOfDay < item.EndTime.ToTimeSpan()) { if (item.InOutState == 1) { rst.ResCode = ResultCode.NoPermissionsInOut; rst.ValidMsg = "通道进出时段限制"; return; } } else//时段外 如果时段内是允许进的,时段外就不允许进 { if (item.InOutState == 0) { rst.ResCode = ResultCode.NoPermissionsInOut; rst.ValidMsg = "通道进出时段限制"; return; } } } }