/// <summary> /// 待自提订单数量 /// </summary> /// <param name="userId">自提点管理员</param> /// <returns>待自提订单数量</returns> public ResultDTO <int> GetSelfTakeManagerExt(Guid userId) { try { // 返回 是否管理员,待自提订单数量 if (userId == Guid.Empty) { return new ResultDTO <int> { Data = 0, ResultCode = 1, Message = "管理员用户ID非法." } } ; var managerInfo = (from p in AppStsManager.ObjectSet() join r in AppSelfTakeStation.ObjectSet() on p.SelfTakeStationId equals r.Id where p.UserId == userId && p.IsDel == false && r.IsDel == false select p.SelfTakeStationId ).Distinct(); if (!managerInfo.Any()) { LogHelper.Info(string.Format("该用户不是自提点管理员或没有与自提点绑定,userId:{0}", userId)); return(new ResultDTO <int> { Data = 0, ResultCode = -1, Message = "抱歉,您暂时没有权限查看此信息" }); } IQueryable <CommodityOrder> query = CommodityOrder.ObjectSet().Where(n => (n.State == 1 || n.State == 11) && n.IsDel != 1 && n.IsDel != 3); var commodityorderListCount = (from r in managerInfo join t in AppOrderPickUp.ObjectSet() on r equals t.SelfTakeStationId join p in query on t.Id equals p.Id select t.Id).Count(); if (commodityorderListCount != 0) { return(new ResultDTO <int> { Data = commodityorderListCount, ResultCode = 0, Message = "sucess" }); } else { return new ResultDTO <int> { Data = 0, ResultCode = -2, Message = "订单数量为0" } }; } catch (Exception ex) { LogHelper.Error(string.Format("BTPUserSV.GetSelfTakeManagerExt获取待自提订单数量异常。userId:{0},ex:{1}", userId, ex)); return(new ResultDTO <int> { Data = 0, ResultCode = -3, Message = "Exception" }); } }
/// <summary> /// 下订单页获取自提点信息 /// </summary> /// <param name="search">查询类</param> /// <returns>结果</returns> public Jinher.AMP.BTP.Deploy.CustomDTO.AppSelfTakeStationDefaultInfoDTO GetAppSelfTakeStationDefaultExt(Jinher.AMP.BTP.Deploy.CustomDTO.AppSelfTakeStationSearchDTO search) { var result = new AppSelfTakeStationDefaultInfoDTO(); if (search == null) { return(null); } if (search.SearchType == 1) { if (search.Id == Guid.Empty) { return(null); } var station = AppSelfTakeStation.ObjectSet() .Where(t => t.Id == search.Id && !t.IsDel) .FirstOrDefault(); if (station == null) { return(null); } result.StationId = station.Id; result.StationName = station.Name; result.DelayDay = station.DelayDay; result.MaxBookDay = station.MaxBookDay; result.StationPhone = station.Phone; if (!string.IsNullOrWhiteSpace(station.Province)) { result.StationAddressDetails = ProvinceCityHelper.GetAreaNameByCode(station.Province) + ProvinceCityHelper.GetAreaNameByCode(station.City) + ProvinceCityHelper.GetAreaNameByCode(station.District) + station.Address; } var officeTime = AppStsOfficeTime.ObjectSet().Where(t => t.SelfTakeStationId == station.Id).ToList(); if (officeTime.Any()) { result.StationTimeList = new List <AppStationOfficeTime>(); foreach (var appStsOfficeTime in officeTime) { var officeTimeModel = new AppStationOfficeTime(); officeTimeModel.StartTime = appStsOfficeTime.StartTime; officeTimeModel.EndTime = appStsOfficeTime.EndTime; officeTimeModel.WeekDays = appStsOfficeTime.WeekDays; result.StationTimeList.Add(officeTimeModel); } } } else if (search.SearchType == 2) { if (search.EsAppId == Guid.Empty) { return(null); } var _userId = this.ContextDTO.LoginUserID; var pickUpOrder = AppOrderPickUp.ObjectSet() .Where(t => t.AppId == search.EsAppId && t.UserId == _userId).OrderByDescending(t => t.SubTime) .FirstOrDefault(); if (pickUpOrder == null) { return(null); } var station = AppSelfTakeStation.ObjectSet() .Where(t => t.Id == pickUpOrder.SelfTakeStationId && t.AppId == pickUpOrder.AppId && !t.IsDel) .FirstOrDefault(); if (station == null) { return(null); } result.StationId = station.Id; result.StationName = station.Name; result.DelayDay = station.DelayDay; result.MaxBookDay = station.MaxBookDay; result.StationPhone = station.Phone; result.PickUpName = pickUpOrder.Name; result.PickUpPhone = pickUpOrder.Phone; if (!string.IsNullOrWhiteSpace(station.Province)) { result.StationAddressDetails = ProvinceCityHelper.GetAreaNameByCode(station.Province) + ProvinceCityHelper.GetAreaNameByCode(station.City) + ProvinceCityHelper.GetAreaNameByCode(station.District) + station.Address; } var officeTime = AppStsOfficeTime.ObjectSet().Where(t => t.SelfTakeStationId == station.Id).ToList(); if (officeTime.Any()) { result.StationTimeList = new List <AppStationOfficeTime>(); foreach (var appStsOfficeTime in officeTime) { var officeTimeModel = new AppStationOfficeTime(); officeTimeModel.StartTime = appStsOfficeTime.StartTime; officeTimeModel.EndTime = appStsOfficeTime.EndTime; officeTimeModel.WeekDays = appStsOfficeTime.WeekDays; result.StationTimeList.Add(officeTimeModel); } } } else { return(null); } result.StationTimeShowList = AppSelfTakeSV.DealScrollTime(result.StationTimeList, result.DelayDay, result.MaxBookDay); return(result); }