Ejemplo n.º 1
0
        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("获取失败")));
            }
        }
Ejemplo n.º 2
0
        public ActionResult Index()
        {
            List <BaseParkinfo> parings = ParkingServices.QueryParkingByVillageIds(GetLoginUserVillages.Select(p => p.VID).ToList());

            ViewBag.StartTime = DateTime.Now.AddDays(-7).Date.AddSeconds(1).ToString("yyyy-MM-dd HH:mm:ss").Replace(" ", "T");
            ViewBag.EndTime   = DateTime.Now.Date.AddDays(1).AddSeconds(-1).ToString("yyyy-MM-dd HH:mm:ss").Replace(" ", "T");
            return(View(parings));
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 获得所有车场
        /// </summary>
        /// <returns></returns>
        public JsonResult GetParks()
        {
            JsonResult json = new JsonResult();

            try
            {
                json.Data = ParkingServices.QueryParkingByVillageIds(base.GetLoginUserVillages.Select(u => u.VID).ToList());
            }
            catch (Exception ex)
            { }
            return(json);
        }
Ejemplo n.º 4
0
        public string GetPrakAreaTreeData()
        {
            try
            {
                StringBuilder       strAreaTree = new StringBuilder();
                List <BaseParkinfo> parkings    = ParkingServices.QueryParkingByVillageIds(GetLoginUserVillages.Select(p => p.VID).ToList());
                if (parkings.Count == 0)
                {
                    return(string.Empty);
                }

                List <ParkArea> parkAreas = ParkAreaServices.GetParkAreaByParkingIds(parkings.Select(p => p.PKID).ToList());

                strAreaTree.Append("[");
                int index = 1;
                foreach (var item in GetLoginUserVillages)
                {
                    BaseCompany company = GetLoginUserRoleCompany.FirstOrDefault(p => p.CPID == item.CPID);
                    if (company == null)
                    {
                        continue;
                    }

                    string text = string.Format("{0}【{1}】", item.VName, company.CPName);
                    strAreaTree.Append("{\"id\":\"" + item.VID + "\",");
                    strAreaTree.Append("\"iconCls\":\"my-village-icon\",");
                    strAreaTree.Append("\"attributes\":{\"type\":0},");
                    strAreaTree.Append("\"text\":\"" + text + "\"");
                    GetParkingTreeData(parkings, parkAreas, item.VID, strAreaTree);
                    strAreaTree.Append("}");
                    if (index != GetLoginUserVillages.Count)
                    {
                        strAreaTree.Append(",");
                    }
                    index++;
                }

                strAreaTree.Append("]");
                return(strAreaTree.ToString());
            }
            catch (Exception ex)
            {
                ExceptionsServices.AddExceptions(ex, "构建车场区域树失败");
                return(string.Empty);
            }
        }
Ejemplo n.º 5
0
        public string GetParkingTreeData()
        {
            try
            {
                StringBuilder strParkingTree = new StringBuilder();
                if (GetLoginUserVillages.Count == 0)
                {
                    return(strParkingTree.ToString());
                }

                List <BaseParkinfo> parkings = ParkingServices.QueryParkingByVillageIds(GetLoginUserVillages.Select(p => p.VID).ToList());
                strParkingTree.Append("[");
                int index = 1;
                foreach (var obj in GetLoginUserRoleCompany)
                {
                    //List<BaseVillage> childVillages = GetLoginUserVillages.Where(p => p.CPID == obj.CPID).ToList();
                    //if (childVillages.Count == 0) continue;

                    //List<BaseParkinfo> childParkings = parkings.Where(p => childVillages.Select(o => o.VID).Contains(p.VID)).ToList();
                    //if (childParkings.Count == 0) continue;
                    //if (index != 1)
                    //{
                    //    strParkingTree.Append(",");
                    //}
                    if (index != 1)
                    {
                        strParkingTree.Append(",");
                    }
                    strParkingTree.Append("{\"id\":\"" + obj.CPID + "\",");
                    strParkingTree.Append("\"iconCls\":\"my-company-icon\",");
                    strParkingTree.Append("\"attributes\":{\"type\":0},");
                    strParkingTree.Append("\"text\":\"" + obj.CPName + "\"");
                    GetVillageTreeData(obj.CPID, parkings, strParkingTree);
                    strParkingTree.Append("}");
                    index++;
                }
                strParkingTree.Append("]");
                return(strParkingTree.ToString());
            }
            catch (Exception ex)
            {
                ExceptionsServices.AddExceptions(ex, "构建车场树异常");
                return(string.Empty);
            }
        }
Ejemplo n.º 6
0
        /// <summary>
        /// 访客信息
        /// </summary>
        /// <param name="parkingid"></param>
        /// <param name="cardtype"></param>
        /// <param name="platenumber"></param>
        /// <param name="addr"></param>
        /// <param name="mobile"></param>
        /// <param name="pageindex"></param>
        /// <param name="pagesize"></param>
        public void Params_ParkVisitorInfo()
        {
            int page = string.IsNullOrEmpty(Request.Params["page"]) ? 0 : int.Parse(Request.Params["page"]);
            int rows = string.IsNullOrEmpty(Request.Params["rows"]) ? 0 : int.Parse(Request.Params["rows"]);
            VisitorReportCondition paras = new VisitorReportCondition();

            if (string.IsNullOrWhiteSpace(Request.Params["ParkingId"]) || Request.Params["ParkingId"].ToString() == "-1")
            {
                List <BaseParkinfo> parkings = ParkingServices.QueryParkingByVillageIds(base.GetLoginUserVillages.Select(u => u.VID).ToList());
                if (parkings.Count > 0)
                {
                    paras.ParkingIds = parkings.Select(p => p.PKID).ToList();
                }
            }
            else
            {
                paras.ParkingIds = new List <string>()
                {
                    Request.Params["ParkingId"].ToString()
                };
            }
            paras.PlateNumber  = Request.Params["PlateNumber"].ToString();
            paras.MoblieOrName = Request.Params["MoblieOrName"].ToString();
            paras.BeginTime    = DateTime.Parse(Request.Params["BeginTime"].ToString());
            paras.EndTime      = DateTime.Parse(Request.Params["EndTime"].ToString());
            if (!string.IsNullOrWhiteSpace(Request.Params["VisitorSource"]) && Request.Params["VisitorSource"].ToString() != "-1")
            {
                paras.VisitorSource = int.Parse(Request.Params["VisitorSource"].ToString());
            }

            if (!string.IsNullOrWhiteSpace(Request.Params["VisitorState"]) && Request.Params["VisitorState"].ToString() != "-1")
            {
                paras.VisitorState = int.Parse(Request.Params["VisitorState"].ToString());
            }
            System.Web.HttpContext.Current.Session["VisitorReportCondition"] = paras;
            System.Web.HttpContext.Current.Session["QueryParams"]            = new InParams
            {
                PageIndex  = page,
                PageSize   = rows,
                ReportType = ReportType.ParkVisitorInfo
            };
        }
Ejemplo n.º 7
0
        public string GetOnlyParkingTreeData()
        {
            try
            {
                StringBuilder strParkingTree = new StringBuilder();
                if (GetLoginUserVillages.Count == 0)
                {
                    return(strParkingTree.ToString());
                }

                List <BaseParkinfo> parkings = ParkingServices.QueryParkingByVillageIds(GetLoginUserVillages.Select(p => p.VID).ToList());
                strParkingTree.Append("[");
                int index = 1;
                foreach (var item in parkings)
                {
                    strParkingTree.Append("{");
                    strParkingTree.AppendFormat("\"id\":\"{0}\"", item.PKID);
                    strParkingTree.Append(",\"iconCls\":\"my-parking-icon\"");
                    strParkingTree.AppendFormat(",\"text\":\"{0}\"", item.PKName);
                    strParkingTree.Append(",\"attributes\":{\"type\":1}");
                    strParkingTree.Append("}");
                    if (index != parkings.Count())
                    {
                        strParkingTree.Append(",");
                    }
                    index++;
                }
                strParkingTree.Append("]");
                return(strParkingTree.ToString());
            }
            catch (Exception ex)
            {
                ExceptionsServices.AddExceptions(ex, "构建车场树异常");
                return(string.Empty);
            }
        }
Ejemplo n.º 8
0
        /// <summary>
        /// 获得首页数据
        /// </summary>
        /// <returns></returns>
        public static HomeResult GetHomeData(List <string> villages)
        {
            HomeResult homeresult = new HomeResult();

            try
            {
                IStatistics              factory           = StatisticsFactory.GetFactory();
                DateTime                 dtNow             = DateTime.Now;
                DateTime                 StartTime         = dtNow.Date.AddDays(-14);
                DateTime                 EndTime           = dtNow;
                List <BaseParkinfo>      parkinfos         = ParkingServices.QueryParkingByVillageIds(villages);
                List <Statistics_Gather> gatherlistdaily15 = null;
                if (parkinfos != null && parkinfos.Count > 0)
                {
                    gatherlistdaily15 = factory.GetStatisticsGroupByDay(parkinfos.Select(u => u.PKID).ToList(), StartTime, EndTime);
                }
                //如果少于15天,则补足15天
                if (gatherlistdaily15 != null)
                {
                    if (gatherlistdaily15.Count <= 15)
                    {
                        for (int i = 0; i < 15; i++)
                        {
                            var v = gatherlistdaily15.Find(u => u.KeyName == dtNow.AddDays(-i).ToString("yyyy-MM-dd"));
                            if (v == null)
                            {
                                gatherlistdaily15.Add(new Statistics_Gather {
                                    KeyName = dtNow.AddDays(-i).ToString("MM-dd"), GatherTime = dtNow.AddDays(-i)
                                });
                            }
                            else
                            {
                                v.KeyName = dtNow.AddDays(-i).ToString("MM-dd");
                            }
                        }
                    }
                }
                else
                {
                    for (int i = 0; i < 15; i++)
                    {
                        gatherlistdaily15.Add(new Statistics_Gather {
                            KeyName = dtNow.AddDays(-i).ToString("MM-dd"), GatherTime = dtNow.AddDays(-i)
                        });
                    }
                }
                gatherlistdaily15 = gatherlistdaily15.OrderBy(u => u.KeyName).ToList();

                homeresult.GatherDaily30 = gatherlistdaily15;
                int vipcard   = gatherlistdaily15.Select(u => u.VIPCard).Sum();
                int stordcard = gatherlistdaily15.Select(u => u.StordCard).Sum();
                int monthcard = gatherlistdaily15.Select(u => u.MonthCard).Sum();
                int jobcard   = gatherlistdaily15.Select(u => u.JobCard).Sum();
                int tempcard  = gatherlistdaily15.Select(u => u.TempCard).Sum();

                int sumnormal = gatherlistdaily15.Select(u => u.ReleaseType_Normal).Sum();
                int sumcatch  = gatherlistdaily15.Select(u => u.ReleaseType_Catch).Sum();
                int sumfree   = gatherlistdaily15.Select(u => u.ReleaseType_Free).Sum();
                int sumcharge = gatherlistdaily15.Select(u => u.ReleaseType_Charge).Sum();
                //进场类型
                homeresult.EntranceCardType.Add(new KeyValue {
                    KeyName = "贵宾卡", Key_Value = vipcard, KeyValue2 = vipcard
                });
                homeresult.EntranceCardType.Add(new KeyValue {
                    KeyName = "储值卡", Key_Value = stordcard, KeyValue2 = stordcard
                });
                homeresult.EntranceCardType.Add(new KeyValue {
                    KeyName = "月卡", Key_Value = monthcard, KeyValue2 = monthcard
                });
                homeresult.EntranceCardType.Add(new KeyValue {
                    KeyName = "临时卡", Key_Value = tempcard, KeyValue2 = tempcard
                });
                homeresult.EntranceCardType.Add(new KeyValue {
                    KeyName = "工作卡", Key_Value = jobcard, KeyValue2 = jobcard
                });
                //放行类型
                homeresult.ReleaseType.Add(new KeyValue {
                    KeyName = "正常放行", Key_Value = sumnormal, KeyValue2 = sumnormal
                });
                homeresult.ReleaseType.Add(new KeyValue {
                    KeyName = "免费放行", Key_Value = sumfree, KeyValue2 = sumfree
                });
                homeresult.ReleaseType.Add(new KeyValue {
                    KeyName = "收费放行", Key_Value = sumcharge, KeyValue2 = sumcharge
                });
                homeresult.ReleaseType.Add(new KeyValue {
                    KeyName = "异常放行", Key_Value = sumcatch, KeyValue2 = sumcatch
                });

                List <Statistics_Gather> gathertop5 = null;
                if (parkinfos != null && parkinfos.Count > 0)
                {
                    gathertop5 = factory.GetParkingTempTop5(parkinfos.Select(u => u.PKID).ToList(), StartTime, EndTime);
                }
                List <KeyValue> parkingtop5 = new List <KeyValue> ();

                if (gathertop5 != null)
                {
                    foreach (var v in gathertop5)
                    {
                        parkingtop5.Add(new KeyValue
                        {
                            Key_Value = v.TempCard,
                            KeyName   = v.ParkingName
                        });
                    }

                    int num = gathertop5.Count;
                    if (num < 5)
                    {
                        for (int i = 0; i < 5 - num; i++)
                        {
                            parkingtop5.Add(new KeyValue
                            {
                                KeyName   = "",
                                Key_Value = 0
                            });
                        }
                    }
                }
                else
                {
                    if (gathertop5.Count < 5)
                    {
                        int n = gathertop5.Count;
                        for (int i = 0; i < 5 - n; i++)
                        {
                            parkingtop5.Add(new KeyValue
                            {
                                KeyName   = "",
                                Key_Value = 0
                            });
                        }
                    }
                }
                homeresult.ParkTempTop5 = parkingtop5.OrderBy(u => u.Key_Value).ToList();
                StartTime = DateTime.Parse(dtNow.ToString("yyyy-MM-01")).AddMonths(-5);
                List <Statistics_Gather> gatherlistmonth12 = null;
                if (parkinfos != null && parkinfos.Count > 0)
                {
                    gatherlistmonth12 = factory.GetStatisticsGroupByMonth(parkinfos.Select(u => u.PKID).ToList(), StartTime, EndTime);
                }

                if (gatherlistmonth12 != null)
                {
                    if (gatherlistmonth12.Count < 6)
                    {
                        for (int i = 0; i < 6; i++)
                        {
                            var v = gatherlistmonth12.Find(u => u.KeyName == dtNow.AddMonths(-i).ToString("yyyy-MM"));
                            if (v == null)
                            {
                                gatherlistmonth12.Add(new Statistics_Gather {
                                    KeyName = DateTime.Parse(dtNow.ToString("yyyy-MM")).AddMonths(-i).ToString("yyyy-MM"), GatherTime = DateTime.Parse(dtNow.ToString("yyyy-MM-01")).AddMonths(-i)
                                });
                            }
                        }
                    }
                }
                else
                {
                    for (int i = 0; i < 6; i++)
                    {
                        gatherlistmonth12.Add(new Statistics_Gather {
                            KeyName = DateTime.Parse(dtNow.ToString("yyyy-MM")).AddMonths(-i).ToString("yyyy-MM"), GatherTime = DateTime.Parse(dtNow.ToString("yyyy-MM-01")).AddMonths(-i)
                        });
                    }
                }
                homeresult.GatherMonth12 = gatherlistmonth12.OrderBy(u => u.KeyName).ToList();
            }
            catch (Exception ex)
            {
                Common.Services.TxtLogServices.WriteTxtLog("打开首页异常 异常信息:", ex.Message);
            }
            return(homeresult);
        }
Ejemplo n.º 9
0
        public ActionResult GetAduitMonthlyCarApplyData()
        {
            try
            {
                List <string> parkingIds = new List <string>();
                if (!string.IsNullOrEmpty(Request.Params["parkingId"]))
                {
                    parkingIds.Add(Request.Params["parkingId"].ToString());
                }
                else
                {
                    List <BaseParkinfo> parings = ParkingServices.QueryParkingByVillageIds(GetLoginUserVillages.Select(p => p.VID).ToList());
                    parkingIds = parings.Select(p => p.PKID).ToList();
                }
                if (parkingIds.Count == 0)
                {
                    throw new MyException("获取车场编号失败");
                }

                string applyInfo = Request.Params["applyInfo"];

                DateTime startTime = DateTime.Parse(Request.Params["starttime"]);
                DateTime endTime   = DateTime.Parse(Request.Params["endtime"]);

                MonthlyCarApplyStatus?status = null;
                int intStatus = 0;
                if (!string.IsNullOrWhiteSpace(Request.Params["status"]) && int.TryParse(Request.Params["status"].ToString(), out intStatus))
                {
                    status = (MonthlyCarApplyStatus)intStatus;
                }
                int page = string.IsNullOrEmpty(Request.Params["page"]) ? 0 : int.Parse(Request.Params["page"]);
                int rows = 15;

                int total = 0;
                List <ParkMonthlyCarApply> models = ParkMonthlyCarApplyServices.QueryPage(parkingIds, applyInfo, status, startTime, endTime, rows, page, out total);

                var result = from p in models
                             select new
                {
                    ID             = p.ID,
                    RecordID       = p.RecordID,
                    PKID           = p.PKID,
                    CarTypeID      = p.CarTypeID,
                    CarModelID     = p.CarModelID,
                    ApplyName      = p.ApplyName,
                    ApplyMoblie    = p.ApplyMoblie,
                    PlateNo        = GetNullToEmpty(p.PlateNo),
                    PKLot          = GetNullToEmpty(p.PKLot),
                    FamilyAddress  = GetNullToEmpty(p.FamilyAddress),
                    ApplyRemark    = GetNullToEmpty(p.ApplyRemark),
                    ApplyStatus    = (int)p.ApplyStatus,
                    ApplyStatusDes = p.ApplyStatus.GetDescription(),
                    AuditRemark    = GetNullToEmpty(p.AuditRemark),
                    ApplyDateTime  = p.ApplyDateTime.ToString("yyyy-MM-dd HH:mm:ss"),
                    CarTypeName    = p.CarTypeName,
                    CarModelName   = p.CarModelName,
                    PKName         = p.PKName,
                };

                return(Json(MyResult.Success("", result)));
            }
            catch (Exception ex)
            {
                ExceptionsServices.AddExceptionToDbAndTxt("AdminAduitCarApply", "获取月租车申请信息失败", ex, LogFrom.WeiXin);
                return(Json(MyResult.Error("获取月租车申请信息失败")));
            }
        }
Ejemplo n.º 10
0
        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 = "审核失败" }));
            }
        }