Esempio n. 1
0
        public PageResult <InventoryResult> CheckedInventory(string storeId, string machineSn, int companyId, string deviceSn, IEnumerable <int> categorySns, string keyword, decimal price, int pageSize, int pageIndex)
        {
            var dataAdapter = DataAdapterFactory.Factory(MachinesSettings.Mode, storeId, machineSn, companyId, deviceSn);
            var result      = dataAdapter.CheckedInventory(categorySns, keyword, price, pageSize, pageIndex);

            return(result);
        }
Esempio n. 2
0
        /// <summary>
        /// 获取活动
        /// </summary>
        /// <param name="storeId"></param>
        /// <param name="machineSn"></param>
        /// <param name="companyId"></param>
        /// <returns></returns>
        public IEnumerable <Activity> Activities(string storeId, string machineSn, int companyId, string deviceSn)
        {
            var dataAdapter = DataAdapterFactory.Factory(MachinesSettings.Mode, storeId, machineSn, companyId, deviceSn);
            var result      = dataAdapter.Activities();

            return(result);
        }
Esempio n. 3
0
        /// <summary>
        /// 获取满足条件的用户信息
        /// </summary>
        /// <param name="storeId"></param>
        /// <param name="machineSn"></param>
        /// <param name="companyId"></param>
        /// <param name="storeOperateAuth"></param>
        /// <returns></returns>
        public static IEnumerable <UserInfo> GetAuthUsers(string storeId, string machineSn, int companyId, StoreOperateAuth storeOperateAuth)
        {
            var dataAdapter = DataAdapterFactory.Factory(MachinesSettings.Mode, storeId, machineSn, companyId, DataAdapterFactory.DEFUALT);
            var users       = dataAdapter.GetStoreUsers(storeOperateAuth);

            return(users);
        }
Esempio n. 4
0
        public DayReportResult DayMonthReport(string storeId, string machineSn, int companyId, DateTime from, DateTime to, Range range, string deviceSn)
        {
            var dataAdapter = DataAdapterFactory.Factory(MachinesSettings.Mode, storeId, machineSn, companyId, deviceSn);
            var result      = dataAdapter.DayMonthReport(from, to, range);

            return(result);
        }
Esempio n. 5
0
        /// <summary>
        /// 获取分类树
        /// </summary>
        /// <param name="storeId"></param>
        /// <param name="machineSn"></param>
        /// <returns></returns>
        public Category GetCategoryTree(string storeId, string machineSn, int companyId, string deviceSn)
        {
            var dataAdapter = DataAdapterFactory.Factory(MachinesSettings.Mode, storeId, machineSn, companyId, deviceSn);
            var categories  = dataAdapter.GetStoreCategory();
            var result      = Category.CategoryTreeFactory(categories, true, "全部");

            return(result);
        }
Esempio n. 6
0
 internal void SetMarketingRecordNumber(string storeId, string machineSn, int companyId)
 {
     if (MarketingQuotaMode != Pharos.ObjectModels.DTOs.MarketingQuotaMode.NotLimit)
     {
         var defualtDataAdapter = DataAdapterFactory.Factory(MachinesSettings.Mode, storeId, machineSn, companyId, DataAdapterFactory.DEFUALT);
         defualtDataAdapter.SaveMarketingRecord(Id, 1m);
     }
 }
Esempio n. 7
0
 /// <summary>
 /// 设备注册
 /// </summary>
 /// <param name="storeId">门店ID</param>
 /// <param name="machineSn">POS机编号</param>
 /// <param name="deviceSn">POS机唯一标识</param>
 /// <param name="type">POS机类型(PC = 1,PAD = 2,Mobile = 3)</param>
 public static void RegisterDevice(string storeId, string machineSn, int companyId, string deviceSn, DeviceType type)
 {
     if (!HasRegister(storeId, machineSn, companyId, deviceSn, type, false))
     {
         var dataAdapter = DataAdapterFactory.Factory(MachinesSettings.Mode, storeId, machineSn, companyId, DataAdapterFactory.DEFUALT);
         dataAdapter.RegisterDevice(deviceSn, type);
     }
 }
Esempio n. 8
0
        public object AddMember([FromBody] AddMemberRequest requestParams)
        {
            var dataAdapter = DataAdapterFactory.Factory(MachinesSettings.Mode, requestParams.StoreId, requestParams.MachineSn, requestParams.CID, requestParams.DeviceSn);

            if (string.IsNullOrEmpty(requestParams.MemberNo))
            {
                var strStoreId = ("000" + requestParams.StoreId);
                strStoreId = strStoreId.Substring(strStoreId.Length - 2, 2);
                var    gangoutai = new int[] { 33, 34, 35 };
                string old       = dataAdapter.GetLastMemberNo();
                var    num       = "";
                if (!string.IsNullOrEmpty(old))
                {
                    num = old.Substring(old.Length - 6);
                }

                MemberNo mn = new MemberNo(requestParams.CID, requestParams.StoreId, num);

                if (gangoutai.Contains(requestParams.ProvinceID))
                {
                    requestParams.MemberNo = string.Format("2{0}{1}{2}", requestParams.CID.ToString("0000000"), strStoreId, mn.ToString());
                }
                else
                {
                    requestParams.MemberNo = string.Format("1{0}{1}{2}", requestParams.CID.ToString("0000000"), strStoreId, mn.ToString());
                }
            }
            if (string.IsNullOrEmpty(requestParams.CardNo))
            {
                throw new PosException("绑定会员卡号不能为空!");
            }
            if (string.IsNullOrEmpty(requestParams.RealName))
            {
                throw new PosException("姓名不能为空!");
            }
            if (string.IsNullOrEmpty(requestParams.MobilePhone))
            {
                throw new PosException("手机不能为空!");
            }
            dataAdapter.AddMember(new MemberDto()
            {
                Address         = requestParams.Address,
                Birthday        = requestParams.Birthday,
                CurrentCityId   = requestParams.CurrentCityId,
                Email           = requestParams.Email,
                MemberNo        = requestParams.MemberNo,
                Weixin          = requestParams.Weixin,
                Zhifubao        = requestParams.Zhifubao,
                MobilePhone     = requestParams.MobilePhone,
                RealName        = requestParams.RealName,
                Sex             = requestParams.Sex,
                ProvinceID      = requestParams.ProvinceID,
                CurrentCountyId = requestParams.CurrentCountyId,
                CardNo          = requestParams.CardNo,
                YaJin           = requestParams.YaJin
            });
            return(null);
        }
Esempio n. 9
0
        /// <summary>
        /// 刷新支付可用状态
        /// </summary>
        /// <param name="storeId">门店</param>
        /// <param name="companyToken">CID</param>
        public virtual void RefreshStatus()
        {
            var dataAdapter = DataAdapterFactory.Factory(MachinesSettings.Mode, StoreId, MachineSn, CompanyId, DeviceSn);
            var settings    = dataAdapter.GetApiSettings(ApiCode);

            ApiUrl      = settings.ApiUrl;
            Title       = settings.Title;
            Enable      = Convert.ToBoolean(settings.State);
            EnableIcon  = settings.ApiIcon;
            DisableIcon = settings.ApiCloseIcon;
        }
Esempio n. 10
0
        public static DateTime RefundAll(string storeId, string machineSn, int companyId, int reason, string paySn, decimal amount, string deviceSn, IPay pay, DateTime createdt)
        {
            var customOrderSn = new Pharos.Infrastructure.Data.Normalize.PaySn(companyId, storeId, machineSn);
            var dataAdapter   = DataAdapterFactory.Factory(MachinesSettings.Mode, storeId, machineSn, companyId, deviceSn);
            var shoppingcart  = ShoppingCartFactory.Factory(storeId, machineSn, companyId, deviceSn);
            var uid           = shoppingcart.MachineInformation.CashierUid;
            var datetime      = dataAdapter.RefundAll(reason, paySn, amount, uid, pay.ApiCodes, pay.PayDetails.PaySn, customOrderSn.ToString(), createdt);

            customOrderSn.NextSerialNumber();
            return(datetime);
        }
Esempio n. 11
0
        public DateTime SaveRecord(string storeId, string machineSn, int companyId, int reason, decimal amount, decimal receive, IPay pay, string deviceSn)
        {
            var      dataAdapter  = DataAdapterFactory.Factory(MachinesSettings.Mode, storeId, machineSn, companyId, deviceSn);
            var      shoppingcart = ShoppingCartFactory.Factory(storeId, machineSn, companyId, deviceSn);
            var      uid          = shoppingcart.MachineInformation.CashierUid;
            string   apiCodes     = pay != null ? pay.ApiCodes : "-1";
            DateTime saveTime     = pay != null ? pay.PayDetails.CreateDt : DateTime.Now;
            var      orderTime    = dataAdapter.ChangeOrRefund(this, reason, shoppingcart.MachineInformation, this.CustomOrderSn, amount, receive, uid, apiCodes, saveTime, this.SaleMan, this.OldOrderSn);

            new Pharos.Infrastructure.Data.Normalize.PaySn(companyId, storeId, machineSn).NextSerialNumber();
            return(orderTime);
        }
Esempio n. 12
0
 /// <summary>
 /// 查询设备注册
 /// </summary>
 /// <param name="storeId">门店ID</param>
 /// <param name="machineSn">POS机编号</param>
 /// <param name="deviceSn">POS机唯一标识</param>
 /// <param name="type">POS机类型(PC = 1,PAD = 2,Mobile = 3)</param>
 /// <returns></returns>
 public static bool HasRegister(string storeId, string machineSn, int companyId, string deviceSn, DeviceType type, bool verfyState = true)
 {
     try
     {
         var dataAdapter = DataAdapterFactory.Factory(MachinesSettings.Mode, storeId, machineSn, companyId, DataAdapterFactory.DEFUALT);
         return(dataAdapter.HasRegister(deviceSn, type, verfyState));
     }
     catch (Exception ex)
     {
         throw;
     }
 }
Esempio n. 13
0
        /// <summary>
        /// 退换货时设置原单号
        /// </summary>
        /// <param name="oldOrderSn"></param>
        /// <returns></returns>
        public ChangeOrRefundReturnOrderData SetOldOrderSN(string oldOrderSn, string storeId, string machineSn, int companyId, string deviceSn)
        {
            var dataAdapter = DataAdapterFactory.Factory(MachinesSettings.Mode, storeId, machineSn, companyId, deviceSn);
            var orderInfos  = dataAdapter.IsHasCustomerOrderSn(oldOrderSn);

            //if (!order)
            //{
            //    return false;
            //}
            OldOrderSn = oldOrderSn;//设置原订单号
            return(orderInfos);
        }
Esempio n. 14
0
        public CustomBarcode(string storeId, string machineSn, int companyId, string barcodeString, SaleStatus saleStatus = SaleStatus.Normal, string marketingRuleId = "")
        {
            BarcodeType = Barcodes.BarcodeType.CustomBarcode;

            RecordId = Guid.NewGuid().ToString();
            //处理条码字符串的空格及移除所有前导空白字符和尾部空白字符
            if (string.IsNullOrWhiteSpace(barcodeString))
            {
                throw new BarcodeException("条码不能为空!");
            }
            var dataAdapter = DataAdapterFactory.Factory(MachinesSettings.Mode, storeId, machineSn, companyId, DataAdapterFactory.DEFUALT);

            CurrentString = barcodeString;
            Count         = CurrentString.Length;
            if (dataAdapter == null)
            {
                throw new Exception("数据适配器不能为null,请实现IDataAdapter,并实例化!");
            }
            var productInfo = dataAdapter.GetProductInfoByBarcode(CurrentString);

            if (productInfo == null)
            {
                throw new SaleException("602", "未找到商品信息,请确认商品是否已经入库销售!");
            }
            if (productInfo.ProductType == ProductType.Weigh)
            {
                throw new PosException("604", "散称商品请过称!", productInfo);
            }
            MultiCode   = productInfo.MultiCode;
            MainBarcode = productInfo.MainBarcode;
            ProductType = productInfo.ProductType;
            SaleNumber  = 1;
            ProductCode = productInfo.ProductCode;
            SalePrice   = productInfo.SystemPrice;
            Details     = new ProductDetails()
            {
                Brand           = productInfo.Brand,
                Category        = productInfo.Category,
                EnableEditNum   = productInfo.EnableEditNum,
                EnableEditPrice = productInfo.EnableEditPrice,
                //  GiftId = giftId,
                MarketingRuleId = marketingRuleId,
                SaleStatus      = saleStatus,
                Size            = productInfo.Size,
                SystemPrice     = productInfo.SystemPrice,
                Title           = productInfo.Title,
                Unit            = productInfo.Unit,
                Total           = SalePrice * SaleNumber,
                BuyPrice        = productInfo.BuyPrice
            };
            IsMultiCode = MultiCode.Contains(CurrentString);
        }
Esempio n. 15
0
        public object RequestPay()
        {
            if (string.IsNullOrEmpty(PayDetails.CardNo))
            {
                throw new PosException("储值卡支付必须提供卡号!");
            }
            var dataAdapter = DataAdapterFactory.Factory(MachinesSettings.Mode, StoreId, MachineSn, CompanyId, DeviceSn);

            var card = dataAdapter.GetStoredValueCardInfo(PayDetails.CardNo);

            switch (card.State)
            {
            case 0:
                throw new PosException(string.Format("储值卡{0}未激活!", PayDetails.CardNo));

            case 2:
                throw new PosException(string.Format("储值卡{0}已挂失!", PayDetails.CardNo));

            case 3:
                throw new PosException(string.Format("储值卡{0}已作废!", PayDetails.CardNo));

            case 4:
                throw new PosException(string.Format("储值卡{0}已退卡!", PayDetails.CardNo));
            }
            var member = "未知持卡人";

            if (card.MemberId != null)
            {
                var info = dataAdapter.GetMemberInfo(string.Empty, string.Empty, card.MemberId);
                if (info != null && !string.IsNullOrEmpty(info.RealName))
                {
                    member = info.RealName;
                }
                if (info != null && !string.IsNullOrEmpty(info.MobilePhone))
                {
                    member += "【" + info.MobilePhone + "】";
                }
            }
            if (!string.IsNullOrEmpty(card.Password) && card.Password != PayDetails.CardPassword)
            {
                throw new PosException("支付密码错误,请重试刷卡并输入支付密码!");
            }
            if (card.Balance < PayDetails.Amount)
            {
                throw new PosException("500", string.Format("卡内余额不足,当前余额{0:N2}元", card.Balance), new { Balance = card.Balance, User = member, PayAmount = 0m });
            }
            var balance = card.Balance - PayDetails.Amount;

            dataAdapter.SaveToStoredValueCard(PayDetails.CardNo, PayDetails.Amount, balance);

            return(new { Balance = balance, User = member, PayAmount = PayDetails.Amount });
        }
Esempio n. 16
0
        /// <summary>
        /// 验证用户登录
        /// </summary>
        /// <param name="userParams">登录参数</param>
        /// <returns></returns>
        public static LoginResult Login(LoginParams userParams, string deviceSn, bool inTestMode = false, bool isLock = false)
        {
            var dataAdapter = DataAdapterFactory.Factory(MachinesSettings.Mode, userParams.StoreId, userParams.MachineSn, userParams.CompanyId, deviceSn);
            var userInfo    = dataAdapter.GetUser(userParams.Account);

            if (userInfo == null)
            {
                throw new LoginExecption("401", "账号错误!");
            }
            if (userInfo.LoginPwd != MD5.MD5Encrypt(userParams.Password))
            {
                throw new LoginExecption("401", "密码错误!");
            }
            //本店角色(1:店长、2:营业员、3:收银员、4:数据维护),格式:门店ID,角色ID|门店ID,角色ID
            if (!inTestMode && !(VerfyOperateAuth(userInfo, dataAdapter.StoreId, StoreOperateAuth.Cashier) || VerfyOperateAuth(userInfo, dataAdapter.StoreId, StoreOperateAuth.DataManager)))
            {
                throw new LoginExecption("402", "非销售员或数据维护员不允许登录销售!");
            }
            var key         = KeyFactory.MachineKeyFactory(userParams.CompanyId, userParams.StoreId, userParams.MachineSn, deviceSn);
            var machineInfo = new MachineInformation()
            {
                CashierName        = userInfo.FullName,
                CashierOperateAuth = userInfo.OperateAuth,
                CashierUid         = userInfo.UID,
                CashierUserCode    = userInfo.UserCode,
                StoreName          = userInfo.StoreName,
                StoreId            = userParams.StoreId,
                MachineSn          = userParams.MachineSn,
                CompanyId          = userParams.CompanyId,
                InTestMode         = inTestMode,
                DeviceSn           = deviceSn
            };

            onlineCache.Set(key, machineInfo);
#if (Local != true)
            RedisManager.Publish("SyncOnlineCache", JsonConvert.SerializeObject(machineInfo));
#endif
#if (Local)
            StoreManager.PubEvent("SyncOnlineCache", JsonConvert.SerializeObject(machineInfo));
#endif
            if (!isLock)
            {
                ShoppingCartFactory.Factory(userParams.StoreId, userParams.MachineSn, userParams.CompanyId, deviceSn, true);
            }
            return(new LoginResult()
            {
                FullName = userInfo.FullName,
                OperateAuth = userInfo.OperateAuth,
                UserCode = userInfo.UserCode,
                StoreName = userInfo.StoreName
            });
        }
Esempio n. 17
0
        public WeighBarcode(string storeId, string machineSn, int companyId, string barcodeString, SaleStatus saleStatus = SaleStatus.Normal, string marketingRuleId = "")
        {
            BarcodeType = Barcodes.BarcodeType.WeighBarcode;

            RecordId = Guid.NewGuid().ToString();
            //处理条码字符串的空格及移除所有前导空白字符和尾部空白字符
            if (string.IsNullOrWhiteSpace(barcodeString))
            {
                throw new BarcodeException("条码不能为空!");
            }
            var dataAdapter = DataAdapterFactory.Factory(MachinesSettings.Mode, storeId, machineSn, companyId, DataAdapterFactory.DEFUALT);

            CurrentString = barcodeString;
            Count         = CurrentString.Length;
            if (dataAdapter == null)
            {
                throw new Exception("数据适配器不能为null,请实现IDataAdapter,并实例化!");
            }
            //条码解析
            var barcode = CurrentString.Substring(2, 5);
            var weight  = Convert.ToInt32(CurrentString.Substring(7, 5)) / 1000.000000m;


            var productInfo = dataAdapter.GetProductInfoByBarcode(barcode);

            if (productInfo == null)
            {
                throw new SaleException("602", "未找到商品信息,请确认商品是否已经入库销售!");
            }
            MainBarcode = productInfo.MainBarcode;
            ProductType = ProductType.Weigh;
            SaleNumber  = weight;
            ProductCode = productInfo.ProductCode;
            SalePrice   = productInfo.SystemPrice;
            Details     = new ProductDetails()
            {
                Brand           = productInfo.Brand,
                Category        = productInfo.Category,
                EnableEditNum   = false,
                EnableEditPrice = false,
                //  GiftId = giftId,
                MarketingRuleId = marketingRuleId,
                SaleStatus      = saleStatus,
                Size            = productInfo.Size,
                SystemPrice     = productInfo.SystemPrice,
                Title           = productInfo.Title,
                Unit            = productInfo.Unit,
                Total           = SalePrice * SaleNumber,
                BuyPrice        = productInfo.BuyPrice
            };
        }
Esempio n. 18
0
        public BundlingBarcode(string storeId, string machineSn, int companyId, string barcodeString, SaleStatus saleStatus = SaleStatus.Normal, string marketingRuleId = "")
        {
            RecordId    = Guid.NewGuid().ToString();
            BarcodeType = Barcodes.BarcodeType.BundlingBarcode;
            //处理条码字符串的空格及移除所有前导空白字符和尾部空白字符
            IsMultiCode = false;
            if (string.IsNullOrWhiteSpace(barcodeString))
            {
                throw new BarcodeException("条码不能为空!");
            }
            var dataAdapter = DataAdapterFactory.Factory(MachinesSettings.Mode, storeId, machineSn, companyId, DataAdapterFactory.DEFUALT);

            CurrentString = barcodeString;
            MainBarcode   = barcodeString;
            Count         = CurrentString.Length;
            if (Count != 12)
            {
                throw new BarcodeException("条码缺失,或者条码长度异常!");
            }
            if (dataAdapter == null)
            {
                throw new Exception("数据适配器不能为null,请实现IDataAdapter,并实例化!");
            }
            var productInfo = dataAdapter.GetProductInfoFromBundlingByBarcode(CurrentString);

            if (productInfo == null)
            {
                throw new SaleException("602", "未找到商品信息,请确认该捆绑商品是否正在销售!");
            }
            MultiCode   = new List <string>();
            ProductType = ProductType.Bundling;
            SaleNumber  = 1;
            ProductCode = null;
            SalePrice   = productInfo.SystemPrice;
            Details     = new ProductDetails()
            {
                Brand           = productInfo.Brand,
                Category        = productInfo.Category,
                EnableEditNum   = productInfo.EnableEditNum,
                EnableEditPrice = productInfo.EnableEditPrice,
                //  GiftId = giftId,
                MarketingRuleId = marketingRuleId,
                SaleStatus      = SaleStatus.Promotion,
                Size            = productInfo.Size,
                SystemPrice     = productInfo.SystemPrice,
                Title           = productInfo.Title,
                Unit            = productInfo.Unit,
                Total           = SalePrice * SaleNumber,
                BuyPrice        = productInfo.BuyPrice
            };
        }
Esempio n. 19
0
        public static bool VerfyStoreManagerOperateAuth(string storeId, string machineSn, int companyId, string password)
        {
            var dataAdapter   = DataAdapterFactory.Factory(MachinesSettings.Mode, storeId, machineSn, companyId, DataAdapterFactory.DEFUALT);
            var storeManagers = dataAdapter.GetStoreUsers(StoreOperateAuth.ShopManager);

            foreach (var item in storeManagers)
            {
                if (VerfyOperateAuth(item, storeId, StoreOperateAuth.ShopManager) && item.LoginPwd == MD5.MD5Encrypt(password))
                {
                    return(true);
                }
            }
            return(false);
        }
Esempio n. 20
0
        public static void PosIncomePayout(string storeId, string machineSn, int companyId, string userCode, string password, decimal money, PosIncomePayoutMode mode)
        {
            var dataAdapter = DataAdapterFactory.Factory(MachinesSettings.Mode, storeId, machineSn, companyId, DataAdapterFactory.DEFUALT);
            var userInfo    = dataAdapter.GetUser(userCode);

            if (userInfo == null)
            {
                throw new LoginExecption("401", "账号错误!");
            }
            if (userInfo.LoginPwd != MD5.MD5Encrypt(password))
            {
                throw new LoginExecption("401", "密码错误!");
            }
            dataAdapter.PosIncomePayout(userInfo.UID, money, mode);
        }
Esempio n. 21
0
 public string GetStoreName([FromBody] BaseApiParams requestParams)
 {
     try
     {
         var dataAdapter = DataAdapterFactory.Factory(MachinesSettings.Mode, requestParams.StoreId, requestParams.MachineSn, requestParams.CID, requestParams.DeviceSn);
         return(dataAdapter.GetStoreName());
     }
     catch (PosException)
     {
         throw;
     }
     catch
     {
         throw new PosException("无法获取门店信息");
     }
 }
Esempio n. 22
0
        /// <summary>
        /// 获取会员ID
        /// </summary>
        /// <param name="storeId">门店编号</param>
        /// <param name="machineSn">设备编号</param>
        /// <param name="phone">手机号</param>
        /// <param name="mode">会员来源模式</param>
        /// <param name="uid">操作人</param>
        /// <returns>会员ID</returns>
        public MemberInfo GetMemberInfo(string storeId, string machineSn, int companyId, string phone, string cardNo, MembersSourseMode mode, string uid)
        {
            var result = default(MemberInfo);

            switch (mode)
            {
            case MembersSourseMode.Internal:
                var dataAdapter = DataAdapterFactory.Factory(MachinesSettings.Mode, storeId, machineSn, companyId, DataAdapterFactory.DEFUALT);

                result = dataAdapter.GetMemberInfo(phone, cardNo, uid);
                break;

            case MembersSourseMode.External:
                throw new PosException("500", "未实现的会员来源!");

            default:
                throw new PosException("500", "未实现的会员来源!");
            }
            return(result);
        }
Esempio n. 23
0
        /// <summary>
        /// 完成支付时,保存支付信息
        /// </summary>
        public virtual void SavePayInfomactions()
        {
            if (PayDetails == null || string.IsNullOrEmpty(StoreId) || string.IsNullOrEmpty(MachineSn))
            {
                throw new PosException("支付信息不全,无法支付!");
            }
            var dataAdapter = DataAdapterFactory.Factory(MachinesSettings.Mode, StoreId, MachineSn, CompanyId, DataAdapterFactory.DEFUALT);

            dataAdapter.RecordPayment(PayDetails.PaySn, PayDetails.Amount, ApiCode, PayDetails.Change, PayDetails.Receive, PayDetails.ApiOrderSn, PayDetails.CardNo);
            //保存抹零数据
            if (PayDetails.WipeZero != 0)
            {
                dataAdapter.AddWipeZero(CompanyId, PayDetails.PaySn, PayDetails.WipeZero);
            }

            if (CallBack != null)
            {
                CallBack(this);
            }
        }
Esempio n. 24
0
        /// <summary>
        /// 记录销售信息
        /// </summary>
        /// <param name="apiCodes">支付方式编码(多个以,隔开)</param>
        /// <param name="amount">账单整单优惠后的金额,或者账单应收金额</param>
        /// <param name="wipeZeroAfter">账单抹零之后的金额</param>
        public void Record(string apiCodes, decimal amount, decimal wipeZeroAfter, string deviceSn, DateTime saveTime)
        {
            //OrderDiscount = amount - OrderList.Sum(o => o.Details.Total);//整单折扣=订单金额-订单小计金额
            OrderDiscount = OrderList.Sum(o => o.Details.Total) - amount;//2016-08-03 整单让利又要存成正的,又要改一次
            //订单小计《订单金额=没有整单折扣
            if (EnableRangeMarketings)
            {
                if (OrderDiscount > 0)
                {
                    OrderDiscount -= TotalPreferential;
                }
                else
                {
                    OrderDiscount = 0m;
                }
            }
            EditTotal     = wipeZeroAfter;
            WipeZeroAfter = wipeZeroAfter;

            var total         = GetSaleStatistics().Receivable;
            var detailsTotal  = OrderList.Sum(o => o.Details.CollectionMarketingPrice * o.SaleNumber);
            var oldReceivable = (total - detailsTotal);

            foreach (var item in OrderList)
            {
                if (detailsTotal != 0)
                {
                    item.AveragePrice = (oldReceivable * (item.Details.CollectionMarketingPrice / detailsTotal)) + item.Details.CollectionMarketingPrice;
                }
            }
            foreach (var item in _Marketings)
            {
                item.MarketingRule.SetMarketingRecordNumber(MachineInformation.StoreId, MachineInformation.MachineSn, MachineInformation.CompanyId);
            }
            var dataAdapter = DataAdapterFactory.Factory(MachinesSettings.Mode, MachineInformation.StoreId, MachineInformation.MachineSn, MachineInformation.CompanyId, deviceSn);

            dataAdapter.SaveOrder(this, apiCodes, saveTime);
            new Pharos.Infrastructure.Data.Normalize.PaySn(MachineInformation.CompanyId, MachineInformation.StoreId, MachineInformation.MachineSn).NextSerialNumber();
            this.Clear(true);
            ShoppingCartFactory.ResetCache(this, MachineInformation.StoreId, MachineInformation.MachineSn, MachineInformation.CompanyId, MachineInformation.DeviceSn);
        }
Esempio n. 25
0
        /// <summary>
        /// 初始化支付基础信息
        /// </summary>
        /// <param name="companyId"></param>
        public virtual void Init(int companyId, string storeId, string machineSn, string deviceSn)
        {
            //init
            CompanyId = companyId;
            StoreId   = storeId;
            MachineSn = machineSn;
            DeviceSn  = deviceSn;

            //find db settings
            var dataAdapter = DataAdapterFactory.Factory(MachinesSettings.Mode, StoreId, MachineSn, CompanyId, DeviceSn);
            var settings    = dataAdapter.GetApiSettings(ApiCode);

            if (settings == null)
            {
                throw new PosException(string.Format("支付接口编号{0},尚未配置!", ApiCodes));
            }
            ApiUrl      = settings.ApiUrl;
            Title       = settings.Title;
            Enable      = Convert.ToBoolean(settings.State);
            EnableIcon  = settings.ApiIcon;
            DisableIcon = settings.ApiCloseIcon;
            OrderNumber = settings.ApiOrder;
        }
Esempio n. 26
0
        public SaleManInfo SetSaleMan(string saleMan)
        {
            if (saleMan == "0")
            {
                SaleMan = string.Empty;
                return(new SaleManInfo());
            }
            var dataAdapter = DataAdapterFactory.Factory(MachinesSettings.Mode, MachineInformation.StoreId, MachineInformation.MachineSn, MachineInformation.CompanyId, DataAdapterFactory.DEFUALT);
            var saleManInfo = dataAdapter.GetUser(saleMan);

            if (saleManInfo != null)
            {
                SaleMan = saleManInfo.UID;
                //return string.Format("[{0};{1}]", saleManInfo.UserCode, saleManInfo.FullName);
                return(new SaleManInfo()
                {
                    SaleManCode = saleManInfo.UserCode, SaleManName = saleManInfo.FullName
                });
            }
            else
            {
                throw new PosException("606", "导购员不存在!");
            }
        }
Esempio n. 27
0
        public StoredValueCardRechargeResult StoredValueCardRecharge([FromBody] StoredValueCardRechargeRequest requestParams)
        {
            var dataAdapter = DataAdapterFactory.Factory(MachinesSettings.Mode, requestParams.StoreId, requestParams.MachineSn, requestParams.CID, requestParams.DeviceSn);

            return(dataAdapter.StoredValueCardRecharge(requestParams.Type, requestParams.CardNo, requestParams.Amount));
        }
Esempio n. 28
0
        public IEnumerable <StoredValueCardPayDetailsItem> GetStoredValueCardPayDetails([FromBody] FindStoredValueCardPayDetailsRequest requestParams)
        {
            var dataAdapter = DataAdapterFactory.Factory(MachinesSettings.Mode, requestParams.StoreId, requestParams.MachineSn, requestParams.CID, requestParams.DeviceSn);

            return(dataAdapter.GetStoredValueCardPayDetails(requestParams.CardNo, requestParams.Start, requestParams.End));
        }
Esempio n. 29
0
        public IEnumerable <object> GetAreas([FromBody] AreaInfoBaseApiParams requestParams)
        {
            var dataAdapter = DataAdapterFactory.Factory(MachinesSettings.Mode, requestParams.StoreId, requestParams.MachineSn, requestParams.CID, requestParams.DeviceSn);

            return(dataAdapter.GetAreas(requestParams.PID));
        }
Esempio n. 30
0
        public static IEnumerable <ReasonItem> GetRefundReason(string storeId, string machineSn, int companyId, string deviceSn)
        {
            var dataAdapter = DataAdapterFactory.Factory(MachinesSettings.Mode, storeId, machineSn, companyId, deviceSn);

            return(dataAdapter.GetReason(2));
        }