Exemplo n.º 1
0
 /// <summary>
 /// 写入唯一的一条记录
 /// </summary>
 /// <param name="obj"></param>
 public static void AddOne(PayNotifyResult obj)
 {
     try
     {
         if (CurrentRepository.IsExist(o => o.PaySN == obj.PaySN))
         {
             return;
         }
         if (Add(obj).Successed)
         {
             Log.WriteInfo("支付成功");
         }
         else
         {
             Log.WriteInfo("支付失败");
         }
     }
     catch (Exception ex)
     {
         Log.WriteError("支付异常", ex);
     }
 }
Exemplo n.º 2
0
        public static BillHistoryInfo GetBillDetailsHistory(string storeId, string machineSn, string paySn, int companyId, bool inTestMode)
        {
            var order = CurrentRepository.Find(o => o.CustomOrderSn == paySn && o.StoreId == storeId && o.CompanyId == companyId && o.IsTest == inTestMode);

            if (order == null)
            {
                throw new PosException("未找到该订单!");
            }
            var isRefundOrder = CurrentRepository.IsExist(o => o.StoreId == storeId && o.CompanyId == companyId && o.ReFundOrderCustomOrderSn == paySn);
            var query         = (from a in SaleDetailService.CurrentRepository.Entities
                                 where a.PaySN == order.PaySN && a.CompanyId == companyId
                                 select a).ToList();
            List <BillDetails> bills = new List <BillDetails>();

            foreach (var item in query)
            {
                BillDetails bill;
                if (!string.IsNullOrEmpty(item.ProductCode))
                {
                    var b = ProductRecordService.CurrentRepository.Entities.FirstOrDefault(o => o.ProductCode == item.ProductCode && o.CompanyId == companyId);
                    bill = new BillDetails()
                    {
                        ActualPrice     = item.ActualPrice,
                        Barcode         = item.ScanBarcode,
                        Number          = item.PurchaseNumber,
                        Size            = b.Size,
                        Title           = b.Title,
                        SysPrice        = b.SysPrice,
                        Total           = item.Total,
                        Unit            = b.Unit,
                        ProductCode     = b.ProductCode,
                        SalesClassifyId = item.SalesClassifyId//SalesClassifyId08-03新增 为增加客户端显示角标
                    };
                }
                else
                {
                    var b = BundlingService.CurrentRepository.Entities.FirstOrDefault(o => o.NewBarcode == item.Barcode && o.CompanyId == companyId);
                    bill = new BillDetails()
                    {
                        ActualPrice = item.ActualPrice,
                        Barcode     = item.ScanBarcode,
                        Number      = item.PurchaseNumber,
                        Brand       = "",
                        Size        = "",
                        Title       = b.Title,
                        SysPrice    = b.SysPrices,
                        Total       = item.Total,
                        Unit        = "件",
                        ProductCode = "捆绑商品无货号"
                    };
                }
                if (bill != null)
                {
                    bills.Add(bill);
                }
            }

            var Pays     = ConsumptionPaymentService.CurrentRepository.Entities.Where(o => o.PaySN == order.PaySN);
            var apicodes = order.ApiCode.Split(",".ToArray(), StringSplitOptions.RemoveEmptyEntries).Select(o => Convert.ToInt32(o));
            var payments = BaseGeneralService <ApiLibrary, LocalCeDbContext> .CurrentRepository.Entities.Where(o => o.CompanyId == companyId && apicodes.Contains(o.ApiCode)).ToList();

            var title = string.Empty;

            switch (payments.Count)
            {
            case 0:
                title = "未知支付方式";
                break;

            case 1:
                title = payments.FirstOrDefault().Title;
                break;

            default:
                title = "多方付";
                break;
            }
            var cashier = SysStoreUserInfoService.Find(o => o.UID == order.CreateUID && o.CompanyId == companyId);
            var saleman = SysStoreUserInfoService.Find(o => o.UID == order.Salesman && o.CompanyId == companyId);
            //查询抹零信息
            var wipeZero = WipeZeroService.Find(o => o.PaySN == paySn && o.CompanyId == companyId);

            var received = 0m;
            var change   = 0m;

            if (Pays.Count() > 0)
            {
                received = Pays.Sum(o => o.Received);
                change   = Pays.Sum(o => o.Change);
            }
            return(new BillHistoryInfo()
            {
                Details = bills,
                PreferentialAmount = order.PreferentialPrice,
                TotalAmount = order.TotalAmount,
                Payment = title,
                PaySn = order.CustomOrderSn,
                ProductCount = order.ProductCount,
                CashierId = cashier == null ? "未知" : cashier.UserCode,
                CashierName = cashier == null ? "未知" : cashier.FullName,
                Change = change,
                MachineSn = order.MachineSN,
                StoreId = order.StoreId,
                OrderTime = order.CreateDT,
                Received = received,
                OrderStatus = order.State,
                OrderType = order.Type,
                WipeZeroAfterTotalAmount = order.Receive,
                SaleManName = (saleman != null ? saleman.FullName : string.Empty),
                SaleManUserCode = (saleman != null ? saleman.UserCode : string.Empty),
                ReturnDT = order.ReturnDT,
                WipeZero = wipeZero == null ? 0m : wipeZero.Number,
                OrderDiscount = order.OrderDiscount,
                IsRefundOrder = isRefundOrder,
                OldOrderSN = order.ReFundOrderCustomOrderSn
            });
        }
Exemplo n.º 3
0
        public static bool HasRegister(string storeId, string machineSN, string deviceSn, DeviceType type, int companyId, bool verfyState = true)
        {
            var deviceType = (short)type;

            return(CurrentRepository.IsExist(o => o.MachineSN == machineSN && ((o.State == 1 && verfyState) || !verfyState) && o.StoreId == storeId && o.Type == deviceType && o.DeviceSN == deviceSn && o.CompanyId == companyId));
        }
Exemplo n.º 4
0
 public static bool IsExist(Expression <Func <TEntity, bool> > whereLambda)
 {
     return(CurrentRepository.IsExist(whereLambda));
 }
 /// <summary>
 /// 用于POS端启动加速
 /// </summary>
 public static void InitForStart()
 {
     CurrentRepository.IsExist(o => true);
 }