public static AccountCheckingDAO GetUserAccountInfos(string uid, string machineSn)
        {
            var startTime = PosCheckingLocalService.GetLastPosChecking();
            //入款
            var depositMoney = CurrentRepository
                               .FindList(o => o.MachineSN == machineSn && o.CreateDT >= startTime && o.CreateUID == uid && o.Type == 1).ToList()
                               .Select(o => (decimal?)o.Amount).Sum() ?? 0;
            //出款
            var takeOutMoney = CurrentRepository
                               .FindList(o => o.MachineSN == machineSn && o.CreateDT >= startTime && o.CreateUID == uid && o.Type == 0).ToList()
                               .Select(o => (decimal?)o.Amount).Sum() ?? 0;
            //退货
            var returnSales = SalesReturnsLocalService.GetReturnSalesForBJ(startTime, uid, machineSn);

            return(new AccountCheckingDAO()
            {
                DepositMoney = depositMoney,
                TakeOutMoney = takeOutMoney,
                TotalSales = SaleOrdersLocalService.GetTotalSales(startTime, uid, machineSn),                                                      //销售总额
                ChangingSales = SaleOrdersLocalService.GetChangingSales(startTime, uid, machineSn),                                                //换货补价
                AllPayWayStatistics = ConsumptionPaymentLocalService.GetOnePayWayAmount(startTime, uid, machineSn),                                //所有支付方式统计
                SurplusCash = depositMoney - takeOutMoney + ConsumptionPaymentLocalService.GetCashPayWay(startTime, uid, machineSn) - returnSales, //当前现金
                ReturnSales = returnSales
            });
        }
예제 #2
0
        public override IEnumerable <dynamic> Export(string storeId, string entityType)
        {
            var date = DateTime.Now.Date;
            var list = CurrentRepository.FindList(o => o.State != 2 && o.EndDate >= date);

            list.Each(o => { o.StoreId = o.StoreId.TrimStart(','); });
            return(list);
        }
 /// <summary>
 /// 获取支付方式
 /// </summary>
 /// <param name="ids">支付方式多个ApiCode</param>
 /// <returns></returns>
 public static List <ApiLibrary> GetPayWays(IEnumerable <int> ids)
 {
     if (ids != null)
     {
         return(CurrentRepository.FindList(o => ids.Contains(o.ApiCode)).ToList());
     }
     return(null);
 }
예제 #4
0
        public static List <ProductInfo> GetSeries(int CategorySN)
        {
            var ids = ProductCategoryLocalService.FindAllChild(CategorySN);

            ids.Add(CategorySN);
            var result = CurrentRepository.FindList(o => ids.Contains(o.CategorySN)).ToList();

            return(result);
        }
예제 #5
0
        public static List <int> FindAllChild(int sn, int deep = -1)
        {
            var categories = CurrentRepository.FindList(o => o.CategoryPSN == sn && (o.Grade == deep || deep == -1));
            var temp       = categories.Select(o => o.CategorySN).ToList();
            var result     = temp;

            foreach (var item in categories)
            {
                result = result.Concat(FindAllChild(item.CategorySN, ++item.Grade)).ToList();
            }
            return(result);
        }
예제 #6
0
        /// <summary>
        /// 批发商
        /// </summary>
        /// <returns></returns>
        public static List <Supplier> GetWholesalerList()
        {
            int compid = CommonService.CompanyId;
            var list   = Pharos.Utility.DataCache.Get <List <Supplier> >("allwholesalers" + compid);

            if (list == null)
            {
                list = CurrentRepository.FindList(o => o.BusinessType == 2 && o.CompanyId == compid).ToList();
                Pharos.Utility.DataCache.Set("allwholesalers" + compid, list, 3);
            }
            return(list);
        }
예제 #7
0
 public override IEnumerable<ProductCategory> Download(string storeId, string entityType)
 {
     var entity = WarehouseService.Find(o => o.StoreId == storeId);
     var CategorySN = new List<int>();
     if (entity != null)
     {
         try
         {
             CategorySN = entity.CategorySN.Split(",".ToArray(), StringSplitOptions.RemoveEmptyEntries).Select(o => Convert.ToInt32(o)).ToList();
         }
         catch
         {
         }
     }
     var sources = CurrentRepository.FindList(o => CategorySN.Contains(o.CategorySN) && o.Grade == 1).ToList();
     sources = sources.Concat(GetCategory(CategorySN, 2)).ToList();
     return sources;
 }
예제 #8
0
        public static IEnumerable <ProductBrand> GetAllProductBrands(short?state = 1)
        {
            var list = Pharos.Utility.DataCache.Get <List <ProductBrand> >("allbrands");

            if (list == null)
            {
                if (state.HasValue)
                {
                    list = CurrentRepository.FindList(o => o.State == state && o.CompanyId == CommonService.CompanyId).ToList();
                }
                else
                {
                    list = CurrentRepository.FindList(o => o.CompanyId == CommonService.CompanyId).ToList();
                }
                //Pharos.Utility.DataCache.Set("allbrands", list, 3);
            }
            return(list);
        }
        public static List <GiftDAO> GetGiftList(string commodityId)
        {
            var            result   = CurrentRepository.FindList(o => o.CommodityId == commodityId).ToList();
            List <GiftDAO> giftList = new List <GiftDAO>();
            var            series   = result.Where(o => o.BlendType == 4);

            foreach (var item in series)
            {
                var sn    = Convert.ToInt32(item.BarcodeOrCategorySN);
                var gifts = ProductInfoLocalService.GetSeries(sn).Select(o => new GiftDAO()
                {
                    GiftId      = commodityId,
                    Barcode     = o.Barcode,
                    Number      = 1,
                    SysPrice    = o.SysPrice,
                    Title       = o.Title,
                    AddMoney    = 0,
                    StoreNumber = o.StockNumber
                });
                giftList = giftList.Concat(gifts).ToList();
            }
            var products = result.Where(o => o.BlendType == 3);

            foreach (var item in products)
            {
                var product = ProductInfoLocalService.Find(o => o.Barcode == item.BarcodeOrCategorySN);
                if (product != null)
                {
                    giftList.Add(new GiftDAO()
                    {
                        Title       = product.Title,
                        SysPrice    = product.SysPrice,
                        Number      = 1,
                        Barcode     = product.Barcode,
                        GiftId      = commodityId,
                        AddMoney    = 0,
                        StoreNumber = product.StockNumber
                    });
                }
            }
            return(giftList);
        }
        public static SalesStatistics GetChangingSalesStatistics(DateTime startTime, int mode, string machineSn = "", string uid = "")
        {
            if (mode == 2)
            {
                startTime = new DateTime(startTime.Year, startTime.Month, 1);
            }
            var endDate = (mode == 1 ? startTime.AddDays(1) : startTime.AddMonths(1));

            var result = new SalesStatistics()
            {
                Title = "换货合计"
            };

            var list = CurrentRepository.FindList(o => o.CreateDT >= startTime && o.CreateDT <= endDate && (o.CreateUID == uid || string.IsNullOrEmpty(uid)) && (o.MachineSN == machineSn || string.IsNullOrEmpty(machineSn)) && o.Type == 1)
                       .Select(o => (decimal?)o.TotalAmount).ToList().Distinct();

            result.Amount = list.Sum() ?? 0;
            result.Count  = list.Count();
            return(result);
        }
예제 #11
0
        private IEnumerable<ProductCategory> GetCategory(List<int> categories, int deep)
        {
            var result = new List<ProductCategory>();
            try
            {
                result = CurrentRepository.FindList(o => categories.Contains(o.CategoryPSN) && o.Grade == deep).ToList();
                var ids = result.Select(o => o.CategorySN).ToList();

                if (ids.Count == 0)
                {
                    return result;
                }
                else
                {
                    var arr = GetCategory(ids, ++deep);
                    result = result.Concat(arr).ToList();
                }
            }
            catch { }
            return result;
        }
        public static SalesStatistics GetSalesStatistics(DateTime date, int mode, string machineSn, int type = 1, string uid = "")
        {
            if (mode == 2)
            {
                date = new DateTime(date.Year, date.Month, 1);
            }
            var endDate = (mode == 1 ? date.AddDays(1) : date.AddMonths(1));
            var list    = CurrentRepository.FindList(o => (o.MachineSN == machineSn || string.IsNullOrEmpty(machineSn)) && o.CreateDT >= date && o.CreateDT <= endDate && o.CreateUID == uid && o.Type == type).ToList();
            var result  = new SalesStatistics();

            if (type == 1)
            {
                result.Title = "入款合计";
            }
            else
            {
                result.Title = "出款合计";
            }
            result.Amount = list.Select(o => o.Amount).Sum();
            result.Count  = list.Count;
            return(result);
        }
예제 #13
0
 /// <summary>
 /// 获得地址列表
 /// </summary>
 /// <param name="userId"></param>
 /// <returns></returns>
 public IQueryable <MailingAddress> FindList(int userId)
 {
     return(CurrentRepository.FindList(m => m.UserId == userId.ToString()));
 }
예제 #14
0
        public override IEnumerable <CommodityPromotion> Download(string storeId, string entityType)
        {
            var date = DateTime.Now.Date;

            return(CurrentRepository.FindList(o => o.State != 2 && o.EndDate >= date).ToList());
        }
예제 #15
0
        public static List <SysDataDictionary> GetBrandClassify()
        {
            var query = CurrentRepository.FindList(o => o.DicPSN == (int)DicType.品牌分类 && o.Status && o.CompanyId == CommonService.CompanyId).OrderBy(o => o.SortOrder);

            return(query.ToList());
        }
예제 #16
0
 public static IEnumerable <Supplier> GetAllSupplier()
 {
     return(CurrentRepository.FindList(o => true).ToList());
 }
예제 #17
0
 public override IEnumerable <SysStoreUserInfo> Download(string storeId, string entityType)
 {
     return(CurrentRepository.FindList(o => true).ToList());
 }
 /// <summary>
 /// 换货补价
 /// </summary>
 /// <param name="startTime"></param>
 /// <param name="endTime"></param>
 /// <param name="uid"></param>
 /// <param name="machineSn"></param>
 /// <returns></returns>
 public static decimal GetChangingSales(DateTime startTime, string uid, string machineSn)
 {
     return(CurrentRepository.FindList(o => o.CreateDT >= startTime && o.CreateUID == uid && o.MachineSN == machineSn && o.Type == 1)
            .Select(o => (decimal?)o.TotalAmount).ToList()
            .Sum() ?? 0);
 }
예제 #19
0
 /// <summary>
 /// 查找数据列表
 /// </summary>
 /// <returns></returns>
 public override IQueryable <ExchangeClass> FindList()
 {
     return(CurrentRepository.FindList(ex => ex.Status > 0, "id", false));
 }
예제 #20
0
 public static List <TEntity> FindList(Expression <Func <TEntity, bool> > whereLambda, int takeNum = 0, params string[] includeParams)
 {
     return(CurrentRepository.FindList(whereLambda, takeNum, includeParams).ToList());
 }
예제 #21
0
        public static IEnumerable <string> GetEffectiveId(string storeId)
        {
            var ids = CommodityPromotionService.GetEffectiveId(storeId).ToList();

            return(CurrentRepository.FindList(o => ids.Contains(o.CommodityId)).Select(o => o.GiftId).ToList());
        }
예제 #22
0
 public override IEnumerable <dynamic> Export(string storeId, string entityType)
 {
     return(CurrentRepository.FindList(o => o.Status == 1));
 }
예제 #23
0
 /// <summary>
 /// 查找首页轮播列表
 /// </summary>
 /// <returns></returns>
 public IQueryable <Slide> Find(int sign)
 {
     return(CurrentRepository.FindList(s => s.Sign == sign && s.Status == 1, "weight", false));
 }
        public override IEnumerable <FreeGiftPurchaseList> Download(string storeId, string entityType)
        {
            var ids = FreeGiftPurchaseDataSyncService.GetEffectiveId(storeId).ToList();

            return(CurrentRepository.FindList(o => ids.Contains(o.GiftId)).ToList());
        }
        public override IEnumerable <CommodityDiscount> Download(string storeId, string entityType)
        {
            var ids = CommodityPromotionService.GetEffectiveId(storeId).ToList();

            return(CurrentRepository.FindList(o => ids.Contains(o.CommodityId)).ToList());
        }
예제 #26
0
        public static IEnumerable <Notice> GetNotices()
        {
            var date = DateTime.Now.Date;

            return(CurrentRepository.FindList(o => o.ExpirationDate > date).ToList());
        }