|
|
using System;
|
|
|
using System.Collections.Generic;
|
|
|
using System.ComponentModel;
|
|
|
using System.Drawing;
|
|
|
using System.Data;
|
|
|
using System.Linq;
|
|
|
using System.Text;
|
|
|
using System.Windows.Forms;
|
|
|
using POSV.ShoppingCart;
|
|
|
using DevComponents.DotNetBar;
|
|
|
using POSV.Bean;
|
|
|
using POSV.Utils;
|
|
|
using DevComponents.DotNetBar.Controls;
|
|
|
using POSV.MessageEvent;
|
|
|
using DevComponents.DotNetBar.Metro;
|
|
|
using POSV.Entity;
|
|
|
using System.Threading.Tasks;
|
|
|
using POSV.Card;
|
|
|
using System.Threading;
|
|
|
|
|
|
namespace POSV.Bill
|
|
|
{
|
|
|
[ToolboxItem(true)]
|
|
|
public partial class MCardControl : AbstractBill
|
|
|
{
|
|
|
/// <summary>
|
|
|
/// 会员卡参数配置规则
|
|
|
/// </summary>
|
|
|
private MemberCardItem _currentCardItem = null;
|
|
|
|
|
|
/// <summary>
|
|
|
/// 当前读卡的方式
|
|
|
/// </summary>
|
|
|
private MemberCardReadType _currentReadCardType = MemberCardReadType.手机号码;
|
|
|
|
|
|
/// <summary>
|
|
|
/// 会员卡操作
|
|
|
/// </summary>
|
|
|
private MemberCardOperator _currentOperator = MemberCardOperator.会员刷卡;
|
|
|
|
|
|
/// <summary>
|
|
|
/// 当前会员对象,操作员输入条件后获取的对象
|
|
|
/// </summary>
|
|
|
private MemberInfoQueryResponse _currentMemberInfo = null;
|
|
|
|
|
|
/// <summary>
|
|
|
/// 会员卡支付前,请求的交易参考号
|
|
|
/// </summary>
|
|
|
private CardTradeCreateVoucherNoResponse _newVoucherNo = null;
|
|
|
|
|
|
/// <summary>
|
|
|
/// 当前会员选择的会员卡
|
|
|
/// </summary>
|
|
|
private MemberCard _currentCard = null;
|
|
|
|
|
|
/// <summary>
|
|
|
/// 是否是M1读卡
|
|
|
/// </summary>
|
|
|
private bool isM1Card = false;
|
|
|
|
|
|
/// <summary>
|
|
|
/// 是否需要循环读卡
|
|
|
/// </summary>
|
|
|
private bool isClose = false;
|
|
|
|
|
|
public MCardControl()
|
|
|
{
|
|
|
InitializeComponent();
|
|
|
}
|
|
|
|
|
|
protected override void OnLoad(EventArgs e)
|
|
|
{
|
|
|
|
|
|
base.OnLoad(e);
|
|
|
|
|
|
SetStyle(ControlStyles.Selectable, true);
|
|
|
|
|
|
//消费金额
|
|
|
this.txtAmount.Multiline = false;
|
|
|
//会员卡号
|
|
|
this.txtCardNo.Multiline = false;
|
|
|
//会员密码
|
|
|
this.txtPasswd.Multiline = false;
|
|
|
|
|
|
if (this.PayNo.Equals("49"))
|
|
|
{
|
|
|
lblFree.Visible = false;
|
|
|
labelX16.Visible = false;
|
|
|
lblPoint.Visible = false;
|
|
|
this.txtCardNo.WatermarkText = "请刷卡";
|
|
|
bool astrict = Global.Instance.GlobalConfigBoolValue(ConfigConstant.CASHIER_ALLOW_MEMBER_XMKMANUALINPUT, false);
|
|
|
if (!astrict)
|
|
|
{
|
|
|
this.txtCardNo.Enabled = false;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
protected override void OnPaintBackground(PaintEventArgs e)
|
|
|
{
|
|
|
e.Graphics.Clear(Focused ? SystemColors.Control : SystemColors.Control);
|
|
|
}
|
|
|
|
|
|
protected override void OnGotFocus(EventArgs e)
|
|
|
{
|
|
|
Invalidate();
|
|
|
base.OnGotFocus(e);
|
|
|
}
|
|
|
|
|
|
protected override void OnLostFocus(EventArgs e)
|
|
|
{
|
|
|
base.OnLostFocus(e);
|
|
|
Invalidate();
|
|
|
}
|
|
|
|
|
|
public override void SetFocus()
|
|
|
{
|
|
|
this.txtCardNo.Focus();
|
|
|
this.txtCardNo.SelectAll();
|
|
|
}
|
|
|
|
|
|
public override bool Focused
|
|
|
{
|
|
|
get
|
|
|
{
|
|
|
if (this.ActiveControl == null)
|
|
|
{
|
|
|
this.ActiveControl = this.txtAmount;
|
|
|
}
|
|
|
|
|
|
return this.ActiveControl.Focused;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
public override void Clear()
|
|
|
{
|
|
|
base.Clear();
|
|
|
|
|
|
this._newVoucherNo = null;
|
|
|
|
|
|
this._orderObject = null;
|
|
|
|
|
|
//关闭读卡器
|
|
|
CardOperateUtilsOther.Instance.TerminationCardRead();
|
|
|
|
|
|
//关闭读卡器
|
|
|
CardOperateUtils.Instance.TerminationCardRead();
|
|
|
|
|
|
// 终止循环
|
|
|
isClose = true;
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 统一收单-订单创建(获取交易参考号)
|
|
|
/// </summary>
|
|
|
/// <param name="refresh"></param>
|
|
|
private void NewVoucherNo(bool refresh)
|
|
|
{
|
|
|
var data = BusinessUtils.Instance.CreateOrderCardTrade(this._orderObject);
|
|
|
|
|
|
if (data.Item1)
|
|
|
{
|
|
|
this._newVoucherNo = data.Item3;
|
|
|
|
|
|
LOGGER.Warn("统一收单-订单创建(获取交易参考号):"+this._newVoucherNo.TradeNo);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
MsgEvent.Send(Constant.PAY_MESSAGE_EVENT_NOTIFY, new Tuple<bool, string>(true, data.Item2));
|
|
|
|
|
|
this._newVoucherNo = null;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
public override void Close()
|
|
|
{
|
|
|
base.Close();
|
|
|
|
|
|
//关闭读卡器
|
|
|
CardOperateUtilsOther.Instance.TerminationCardRead();
|
|
|
//关闭读卡器
|
|
|
CardOperateUtils.Instance.TerminationCardRead();
|
|
|
// 终止循环
|
|
|
isClose = true;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
/// 调整会员卡操作Tab项
|
|
|
/// </summary>
|
|
|
private void RefreshUi()
|
|
|
{
|
|
|
if (this._currentOperator == MemberCardOperator.会员刷卡)
|
|
|
{
|
|
|
MsgEvent.Send(Constant.PAY_MESSAGE_EVENT_NOTIFY, new Tuple<bool, string>(false, "请刷卡"));
|
|
|
isClose = false;
|
|
|
if (this._currentCardItem.ListReader.Contains(MemberCardReadType.磁条卡或IC卡) && this._currentCardItem.ListType.Contains(MemberCardType.Mifare))
|
|
|
{
|
|
|
//启用M1卡,自动打开循环读卡模式
|
|
|
Task.Factory.StartNew(() =>
|
|
|
{
|
|
|
string showMsg = string.Empty;
|
|
|
while (true)
|
|
|
{
|
|
|
bool astrict = Global.Instance.GlobalConfigBoolValue(ConfigConstant.CASHIER_ALLOW_MEMBER_XMKONLYMEMBERSHIPCARDAREALLOWED, false);
|
|
|
if (this.PayNo.Equals("49"))
|
|
|
{
|
|
|
if (!astrict)
|
|
|
{
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
if (isClose)
|
|
|
{
|
|
|
break;
|
|
|
}
|
|
|
var result = CardOperateUtils.Instance.ReadCardNoContinue();
|
|
|
if (result.Item1)
|
|
|
{
|
|
|
if (result.Item2.Length == 16)
|
|
|
{
|
|
|
if (!this.IsHandleCreated || this.IsDisposed) return;
|
|
|
this.Invoke(new Action(() =>
|
|
|
{
|
|
|
this.txtCardNo.Text = result.Item2;
|
|
|
isM1Card = true;
|
|
|
|
|
|
if (this.txtCardNo.Enabled)
|
|
|
{
|
|
|
//读卡成功,模拟回车事件
|
|
|
InputSimulatorUtils.SendKey(KeyCodes.Map["return"]);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
OnMCardEnterClick(null, null);
|
|
|
}
|
|
|
|
|
|
}));
|
|
|
return;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
showMsg = "卡号非法";
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
result = CardOperateUtilsOther.Instance.ReadCardNoContinue();
|
|
|
if (result.Item1)
|
|
|
{
|
|
|
|
|
|
if (!this.IsHandleCreated || this.IsDisposed) return;
|
|
|
this.Invoke(new Action(() =>
|
|
|
{
|
|
|
this.txtCardNo.Text = result.Item2;
|
|
|
isM1Card = true;
|
|
|
|
|
|
//读卡成功,模拟回车事件
|
|
|
InputSimulatorUtils.SendKey(KeyCodes.Map["return"]);
|
|
|
}));
|
|
|
return;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
if (result.Item2.Contains("读卡失败"))
|
|
|
{
|
|
|
continue;
|
|
|
}
|
|
|
showMsg = result.Item2;
|
|
|
}
|
|
|
}
|
|
|
if (!this.IsHandleCreated || this.IsDisposed) return;
|
|
|
this.Invoke(new Action(() =>
|
|
|
{
|
|
|
MsgEvent.Send(Constant.PAY_MESSAGE_EVENT_NOTIFY, new Tuple<bool, string>(true, showMsg));
|
|
|
}));
|
|
|
Thread.Sleep(1000);
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
//关闭读卡器
|
|
|
CardOperateUtilsOther.Instance.TerminationCardRead();
|
|
|
//关闭读卡器
|
|
|
CardOperateUtils.Instance.TerminationCardRead();
|
|
|
|
|
|
// 终止循环
|
|
|
isClose = true;
|
|
|
|
|
|
}
|
|
|
|
|
|
switch (this._currentOperator)
|
|
|
{
|
|
|
case MemberCardOperator.会员刷卡:
|
|
|
{
|
|
|
|
|
|
this.ActiveControl = this.txtCardNo;
|
|
|
|
|
|
this.txtCardNo.Focus();
|
|
|
this.txtCardNo.SelectAll();
|
|
|
}
|
|
|
break;
|
|
|
case MemberCardOperator.会员消费:
|
|
|
{
|
|
|
var skipNoMoney = Global.Instance.GlobalConfigStringValue(ConfigConstant.CONFIG_CASHIER_CARDPAYSKIPNOMONEY, "0");
|
|
|
if (!BusinessUtils.Instance.HavMemberPromotionCoup(this._orderObject) && this._currentCard != null && this._currentCard.AvailableAmount <= 0 && "1".Equals(skipNoMoney))
|
|
|
{
|
|
|
this._currentOperator = MemberCardOperator.会员刷卡;
|
|
|
//享迷卡
|
|
|
if (this.PayNo.Equals("49"))
|
|
|
{
|
|
|
this._orderObject.XmkMember = null;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
this._orderObject.Member = null;
|
|
|
}
|
|
|
|
|
|
this._currentCard = null;
|
|
|
BusinessUtils.Instance.RemoveMemberPromotion(this._orderObject);
|
|
|
this.BindUi(this._orderObject);
|
|
|
MsgEvent.Send(Constant.PAY_MESSAGE_EVENT_NOTIFY, new Tuple<bool, string>(true, "余额为0不允许消费,请充值或选择其他付款方式!"));
|
|
|
return;
|
|
|
}
|
|
|
var cardNo = string.IsNullOrEmpty(this._currentCard.FaceNo) ? this._currentCard.CardNo : this._currentCard.CardNo;
|
|
|
this.lblCardNo.Text = CardUtils.CardNoEncrypt(cardNo);
|
|
|
this.lblBalance.Text = this._currentCard.AvailableAmount.ToString();
|
|
|
this.lblPoint.Text = this._currentCard.TotalPoint.ToString();
|
|
|
|
|
|
if (this._currentCard.IsNoPwd == 1 && this._currentCardItem.PaymentType == 1 && this._currentMemberInfo.GetWay != MemberCardNoType.手机号)
|
|
|
{
|
|
|
this.lblFree.Text = string.Format("免密额度:{0}元/笔", this._currentCard.NpAmount.ToString());
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
this.lblFree.Text = string.Format("凭密码消费");
|
|
|
}
|
|
|
|
|
|
//不抹零
|
|
|
this._orderObject.MalingAmount = 0;
|
|
|
//不找零
|
|
|
this._orderObject.ChangeAmount = 0;
|
|
|
|
|
|
//未收金额
|
|
|
var unpaidAmount = this._orderObject.ReceivableAmount - this._orderObject.ReceivedAmount;
|
|
|
//将当前应收金额赋值
|
|
|
this.txtAmount.Text = unpaidAmount >= 0 ? unpaidAmount.ToString() : "0";
|
|
|
//如果会员余额小于未付金额,将应收金额赋值为会员余额
|
|
|
if (this._currentCard.AvailableAmount < unpaidAmount)
|
|
|
{
|
|
|
this.txtAmount.Text = this._currentCard.AvailableAmount.ToString();
|
|
|
}
|
|
|
|
|
|
this.ActiveControl = this.txtAmount;
|
|
|
|
|
|
this.txtAmount.Focus();
|
|
|
this.txtAmount.SelectAll();
|
|
|
|
|
|
//是否需要确认金额,不跳过确认
|
|
|
var skipConfirmMoney = Global.Instance.GlobalConfigBoolValue(ConfigConstant.CONFIG_CASHIER_CARDPAYSKIPCONFIRMMONEY, true);
|
|
|
if (skipConfirmMoney)
|
|
|
{
|
|
|
Task.Factory.StartNew(() =>
|
|
|
{
|
|
|
Thread.Sleep(100);
|
|
|
if (this.IsDisposed || !this.IsHandleCreated) return;
|
|
|
this.Invoke(new Action(() =>
|
|
|
{
|
|
|
if (VerifyInputValue())
|
|
|
{
|
|
|
MsgEvent.Send(Constant.PAY_AUTO_EVENT_NOTIFY, "快捷触发会员卡支付结账");
|
|
|
}
|
|
|
}));
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
break;
|
|
|
case MemberCardOperator.支付密码:
|
|
|
{
|
|
|
|
|
|
//消费前余额
|
|
|
decimal beforeAmount = this._currentCard.AvailableAmount;
|
|
|
this.lblBefAmount.Text = OrderUtils.ToRound(beforeAmount).ToString();
|
|
|
//本次消费金额
|
|
|
this.lblPayAmount.Text = this.txtAmount.DecimalValue.ToString();
|
|
|
//消费后的余额
|
|
|
decimal afterAmount = beforeAmount - this.txtAmount.DecimalValue;
|
|
|
this.lblAftAmount.Text = OrderUtils.ToRound(afterAmount).ToString();
|
|
|
|
|
|
|
|
|
this.ActiveControl = this.txtPasswd;
|
|
|
|
|
|
|
|
|
|
|
|
if (verifymoney)
|
|
|
{
|
|
|
this.txtPasswd.Text = string.Empty;
|
|
|
}
|
|
|
this.txtPasswd.Focus();
|
|
|
this.txtPasswd.SelectAll();
|
|
|
|
|
|
MsgEvent.Send(Constant.PAY_MESSAGE_EVENT_NOTIFY, new Tuple<bool, string>(true, "请输入密码"));
|
|
|
}
|
|
|
break;
|
|
|
}
|
|
|
|
|
|
//刷新支付汇总清单
|
|
|
this.billSummary1.Refresh(this._orderObject);
|
|
|
//刷新支付列表
|
|
|
this.billGrid1.RefreshGrid(this._orderObject.Pays);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 订单对象
|
|
|
/// </summary>
|
|
|
private OrderObject _orderObject = null;
|
|
|
|
|
|
public override void BindUi(OrderObject orderObject)
|
|
|
{
|
|
|
if (orderObject == null) return;
|
|
|
|
|
|
this._orderObject = orderObject;
|
|
|
|
|
|
this._newVoucherNo = null;
|
|
|
//异步获取交易参考号
|
|
|
//Task.Factory.StartNew(() => {
|
|
|
// this.NewVoucherNo(false);
|
|
|
//});
|
|
|
|
|
|
//享迷卡
|
|
|
if (this.PayNo.Equals("49"))
|
|
|
{
|
|
|
this._currentMemberInfo = this._orderObject.XmkMember;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
this._currentMemberInfo = this._orderObject.Member;
|
|
|
}
|
|
|
|
|
|
|
|
|
if (this._currentMemberInfo != null)
|
|
|
{
|
|
|
//享迷卡
|
|
|
if (this.PayNo.Equals("49"))
|
|
|
{
|
|
|
this._currentCard = this._orderObject.XmkMember.CurrentCard;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
this._currentCard = this._orderObject.Member.CurrentCard;
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
//会员规则
|
|
|
this._currentCardItem = JsonUtils.Deserialize<MemberCardItem>(Global.Instance.GlobalConfigStringValue(ConfigConstant.CASHIER_MEMBER_CARD));
|
|
|
|
|
|
//是否会员卡功能以管理端设置参数优先
|
|
|
var memberFunctionsPrior = Global.Instance.GlobalConfigBoolValue(ConfigConstant.CONFIG_CASHIER_MEMBER_FUNCTIONS_PRIOR, false);
|
|
|
|
|
|
//享迷卡
|
|
|
if (this.PayNo.Equals("49"))
|
|
|
{
|
|
|
//主界面刷卡
|
|
|
if (this._orderObject.XmkMember != null && this._currentCardItem.Function.Contains(MemberCardFunctions.会员储值及消费))
|
|
|
{
|
|
|
this._currentOperator = MemberCardOperator.会员消费;
|
|
|
|
|
|
this.tabCardRead.Visible = false;
|
|
|
this.tabCardPasswd.Visible = false;
|
|
|
this.tabCardSelected.Visible = false;
|
|
|
this.tabCardPay.Visible = true;
|
|
|
|
|
|
this.tabCardControl.SelectedTab = this.tabCardPay;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
//主界面没有刷卡
|
|
|
this._currentOperator = MemberCardOperator.会员刷卡;
|
|
|
|
|
|
this.tabCardRead.Visible = true;
|
|
|
this.tabCardPasswd.Visible = false;
|
|
|
this.tabCardSelected.Visible = false;
|
|
|
this.tabCardPay.Visible = false;
|
|
|
|
|
|
this.tabCardControl.SelectedTab = this.tabCardRead;
|
|
|
|
|
|
this.txtCardNo.Text = string.Empty;
|
|
|
this.txtCardNo.Focus();
|
|
|
this.txtCardNo.SelectAll();
|
|
|
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
//主界面刷卡
|
|
|
if (this._orderObject.Member != null && this._currentCardItem.Function.Contains(MemberCardFunctions.会员储值及消费))
|
|
|
{
|
|
|
this._currentOperator = MemberCardOperator.会员消费;
|
|
|
|
|
|
this.tabCardRead.Visible = false;
|
|
|
this.tabCardPasswd.Visible = false;
|
|
|
this.tabCardSelected.Visible = false;
|
|
|
this.tabCardPay.Visible = true;
|
|
|
|
|
|
this.tabCardControl.SelectedTab = this.tabCardPay;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
//主界面没有刷卡
|
|
|
this._currentOperator = MemberCardOperator.会员刷卡;
|
|
|
|
|
|
this.tabCardRead.Visible = true;
|
|
|
this.tabCardPasswd.Visible = false;
|
|
|
this.tabCardSelected.Visible = false;
|
|
|
this.tabCardPay.Visible = false;
|
|
|
|
|
|
this.tabCardControl.SelectedTab = this.tabCardRead;
|
|
|
|
|
|
this.txtCardNo.Text = string.Empty;
|
|
|
this.txtCardNo.Focus();
|
|
|
this.txtCardNo.SelectAll();
|
|
|
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
this.RefreshUi();
|
|
|
}
|
|
|
|
|
|
private bool VerifyInputValue()
|
|
|
{
|
|
|
if (this._orderObject == null)
|
|
|
{
|
|
|
MsgEvent.Send(Constant.PAY_MESSAGE_EVENT_NOTIFY, new Tuple<bool, string>(true, "订单数据错误啦,请拍个照..."));
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
switch (this._currentOperator)
|
|
|
{
|
|
|
case MemberCardOperator.会员刷卡:
|
|
|
{
|
|
|
var inputValue = this.txtCardNo.Text.Trim();
|
|
|
if (string.IsNullOrEmpty(inputValue))
|
|
|
{
|
|
|
MsgEvent.Send(Constant.PAY_MESSAGE_EVENT_NOTIFY, new Tuple<bool, string>(true, "请刷卡"));
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
//智能识别刷卡方式
|
|
|
var way = CardUtils.JudgeCardWay(Global.Instance.Worker.TenantId, inputValue);
|
|
|
if (way == MemberCardNoType.未知)
|
|
|
{
|
|
|
MsgEvent.Send(Constant.PAY_MESSAGE_EVENT_NOTIFY, new Tuple<bool, string>(true, "无法识别的卡号,请确认"));
|
|
|
return false;
|
|
|
}
|
|
|
}
|
|
|
break;
|
|
|
case MemberCardOperator.会员消费:
|
|
|
{
|
|
|
if (this._newVoucherNo == null)
|
|
|
{
|
|
|
this.NewVoucherNo(false);
|
|
|
if (this._newVoucherNo == null)
|
|
|
{
|
|
|
MsgEvent.Send(Constant.PAY_MESSAGE_EVENT_NOTIFY, new Tuple<bool, string>(true, "获取交易参考号失败"));
|
|
|
return false;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
////输入是否满足结账条件:应收金额 = 实际收款金额 - 找零金额
|
|
|
//bool isVerify = (this._orderObject.ReceivableAmount == (this._orderObject.PaidAmount - this._orderObject.ChangeAmount));
|
|
|
//输入是否满足结账条件:消费明细中实收金额的合计 = 主单中的实收金额
|
|
|
var isVerify = this._orderObject.Pays.Sum(x => x.PaidAmount) >= this._orderObject.PaidAmount;
|
|
|
|
|
|
//满足结账条件
|
|
|
if (isVerify)
|
|
|
{
|
|
|
MsgEvent.Send(Constant.PAY_MESSAGE_EVENT_NOTIFY, new Tuple<bool, string>(true, "满足结账条件,点击完成结账"));
|
|
|
this.txtAmount.SelectAll();
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
//当前选择的会员卡
|
|
|
var cardNo = this._currentCard.CardNo;
|
|
|
//实收金额,操作员录入消费卡金
|
|
|
decimal inputAmount = this.txtAmount.DecimalValue;
|
|
|
if (inputAmount < 0)
|
|
|
{
|
|
|
MsgEvent.Send(Constant.PAY_MESSAGE_EVENT_NOTIFY, new Tuple<bool, string>(true, "请输入金额"));
|
|
|
this.txtAmount.SelectAll();
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
if (inputAmount > this._orderObject.ReceivableAmount)
|
|
|
{
|
|
|
MsgEvent.Send(Constant.PAY_MESSAGE_EVENT_NOTIFY, new Tuple<bool, string>(true, "不允许超出应收金额"));
|
|
|
this.txtAmount.SelectAll();
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
//扣除已经在支付清单的余额
|
|
|
decimal freeze = this._orderObject.Pays.Where(x => x.CardNo == cardNo).Sum(x => x.Amount);
|
|
|
//当前卡可用余额
|
|
|
decimal balance = this._currentCard.AvailableAmount - freeze;
|
|
|
//操作员录入消费金额大于卡余额
|
|
|
if (inputAmount > balance)
|
|
|
{
|
|
|
MsgEvent.Send(Constant.PAY_MESSAGE_EVENT_NOTIFY, new Tuple<bool, string>(true, "卡余额不足,请重新输入"));
|
|
|
this.txtAmount.SelectAll();
|
|
|
return false;
|
|
|
}
|
|
|
}
|
|
|
break;
|
|
|
case MemberCardOperator.支付密码:
|
|
|
{
|
|
|
//当前选择的会员卡
|
|
|
var cardNo = this._currentCard.CardNo;
|
|
|
decimal inputAmount = this.txtAmount.DecimalValue;
|
|
|
//扣除已经在支付清单的余额
|
|
|
decimal freeze = this._orderObject.Pays.Where(x => x.CardNo == cardNo).Sum(x => x.Amount);
|
|
|
//当前卡可用余额
|
|
|
decimal balance = this._currentCard.AvailableAmount - freeze;
|
|
|
|
|
|
if (balance == 0)
|
|
|
{
|
|
|
MsgEvent.Send(Constant.PAY_MESSAGE_EVENT_NOTIFY, new Tuple<bool, string>(true, "可用余额为0,请确认"));
|
|
|
this.txtAmount.SelectAll();
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
|
|
|
//操作员录入消费金额大于卡余额
|
|
|
if (inputAmount > balance)
|
|
|
{
|
|
|
MsgEvent.Send(Constant.PAY_MESSAGE_EVENT_NOTIFY, new Tuple<bool, string>(true, "卡余额不足,请重新输入"));
|
|
|
this.txtAmount.SelectAll();
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
MsgEvent.Send(Constant.PAY_MESSAGE_EVENT_NOTIFY, new Tuple<bool, string>(false, "请输入密码"));
|
|
|
if (this._newVoucherNo == null)
|
|
|
{
|
|
|
MsgEvent.Send(Constant.PAY_MESSAGE_EVENT_NOTIFY, new Tuple<bool, string>(true, "获取交易参考号失败"));
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
|
|
|
////输入是否满足结账条件:应收金额 = 实际收款金额 - 找零金额
|
|
|
//bool isVerify = (this._orderObject.ReceivableAmount == (this._orderObject.PaidAmount - this._orderObject.ChangeAmount));
|
|
|
|
|
|
//输入是否满足结账条件:消费明细中实收金额的合计 = 主单中的实收金额
|
|
|
var isVerify = this._orderObject.Pays.Sum(x => x.PaidAmount) >= this._orderObject.PaidAmount;
|
|
|
|
|
|
//满足结账条件
|
|
|
if (isVerify)
|
|
|
{
|
|
|
MsgEvent.Send(Constant.PAY_MESSAGE_EVENT_NOTIFY, new Tuple<bool, string>(true, "满足结账条件,点击完成结账"));
|
|
|
this.txtAmount.SelectAll();
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
}
|
|
|
break;
|
|
|
}
|
|
|
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 操作是否验证通过
|
|
|
/// </summary>
|
|
|
private bool PaymentVerify = false;
|
|
|
private void OnKeyboardBefore(object sender, BillKeyboardEventArgs e)
|
|
|
{
|
|
|
this.PaymentVerify = VerifyInputValue();
|
|
|
}
|
|
|
|
|
|
private void AddMCardPayType(CardTradeCreateCardRequest request, CardTradeCreateCardResponse response, bool useConfirmed, string passwd)
|
|
|
{
|
|
|
if (request == null || response == null || this._newVoucherNo == null) return;
|
|
|
|
|
|
|
|
|
//构建会员卡支付方式
|
|
|
var payMode = this.Tag as PayMode;
|
|
|
//构建支付方式
|
|
|
PayItem item = OrderUtils.ToPayItem(payMode);
|
|
|
|
|
|
//租户ID
|
|
|
item.TenantId = Global.Instance.Authc.TenantId;
|
|
|
|
|
|
//订单号
|
|
|
item.OrderId = this._orderObject.Id;
|
|
|
item.TradeNo = this._orderObject.TradeNo;
|
|
|
|
|
|
//支付编号
|
|
|
item.PayNo = OrderUtils.Instance.GeneratePayNo();
|
|
|
|
|
|
item.Id = IdWorkerUtils.Instance.NextId();
|
|
|
item.Name = payMode.Name;
|
|
|
item.No = payMode.No;
|
|
|
item.PointFlag = payMode.PointFlag;
|
|
|
|
|
|
//实收金额
|
|
|
item.PaidAmount = this.txtAmount.DecimalValue;
|
|
|
//找零金额
|
|
|
item.ChangeAmount = Convert.ToDecimal(0.00);
|
|
|
//已收金额,真正意义上实际收款金额
|
|
|
item.Amount = this.txtAmount.DecimalValue;
|
|
|
|
|
|
item.CardNo = request.CardNo;
|
|
|
|
|
|
//加入卡面号,手机号信息
|
|
|
if (this._currentCard != null)
|
|
|
{
|
|
|
item.CardFaceNo = this._currentCard.FaceNo;
|
|
|
}
|
|
|
//享迷卡
|
|
|
if (this.PayNo.Equals("49"))
|
|
|
{
|
|
|
if (this._orderObject.XmkMember != null)
|
|
|
{
|
|
|
item.MemberMobileNo = this._orderObject.XmkMember.Mobile;
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
if (this._orderObject.Member != null)
|
|
|
{
|
|
|
item.MemberMobileNo = this._orderObject.Member.Mobile;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
//用户确认输入密码
|
|
|
item.UseConfirmed = useConfirmed;
|
|
|
|
|
|
//会员卡密码加密
|
|
|
item.Passwd = passwd;
|
|
|
|
|
|
//预支付编码
|
|
|
item.PrePayNo = response.PrePayment;
|
|
|
//交易参考号
|
|
|
item.TradeVoucherNo = this._newVoucherNo.TradeVoucherNo;
|
|
|
|
|
|
item.Memo = "会员卡支付";
|
|
|
item.Subscribe = string.Empty;
|
|
|
|
|
|
//会员卡支付状态,NOT_PAID未扣款
|
|
|
item.Status = (int)OrderPaymentStatus.未付款;
|
|
|
item.StatusDesc = "预下单成功,未扣款";
|
|
|
|
|
|
if (item.Amount == 0)
|
|
|
{
|
|
|
return;
|
|
|
}
|
|
|
//将会员卡压入支付清单
|
|
|
this._orderObject.Pays.Add(item);
|
|
|
|
|
|
if (Property.Equals("cardNo"))
|
|
|
{
|
|
|
this._orderObject.Ext1 = "享迷卡";
|
|
|
}
|
|
|
|
|
|
//刷新界面数据
|
|
|
this.billSummary1.Refresh(this._orderObject);
|
|
|
//刷新支付列表
|
|
|
this.billGrid1.RefreshGrid(this._orderObject.Pays);
|
|
|
|
|
|
//未收金额
|
|
|
var unpaidAmount = this._orderObject.PaidAmount - this._orderObject.ReceivedAmount;
|
|
|
|
|
|
this.txtAmount.Text = unpaidAmount < 0 ? "0" : unpaidAmount.ToString();
|
|
|
|
|
|
this.txtAmount.Focus();
|
|
|
|
|
|
this.txtAmount.SelectAll();
|
|
|
}
|
|
|
string Property = "";
|
|
|
bool verifymoney = false;
|
|
|
private void OnKeyboardAfter(object sender, BillKeyboardEventArgs e)
|
|
|
{
|
|
|
switch (e.KeyCode)
|
|
|
{
|
|
|
case "clear":
|
|
|
//如果当前焦点控件是输入框
|
|
|
if (this.ActiveControl is TextBox)
|
|
|
{
|
|
|
var activeControl = this.ActiveControl as TextBox;
|
|
|
activeControl.Text = string.Empty;
|
|
|
|
|
|
RefreshUi();
|
|
|
}
|
|
|
break;
|
|
|
case "accept":
|
|
|
//验证通过
|
|
|
if (this.PaymentVerify)
|
|
|
{
|
|
|
switch (this._currentOperator)
|
|
|
{
|
|
|
case MemberCardOperator.会员刷卡:
|
|
|
{
|
|
|
verifymoney = false;
|
|
|
var voucherNo = this.txtCardNo.Text.Trim();
|
|
|
//智能识别刷卡方式
|
|
|
var way = CardUtils.JudgeCardWay(Global.Instance.Worker.TenantId, voucherNo);
|
|
|
if (way == MemberCardNoType.未知)
|
|
|
{
|
|
|
MsgEvent.Send(Constant.PAY_MESSAGE_EVENT_NOTIFY, new Tuple<bool, string>(true, "无法识别的卡号,请确认"));
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
MemberInfoQueryRequest request = new MemberInfoQueryRequest();
|
|
|
|
|
|
request.Keyword = voucherNo;
|
|
|
|
|
|
if (this.PayNo.Equals("49"))
|
|
|
{
|
|
|
bool astrict = Global.Instance.GlobalConfigBoolValue(ConfigConstant.CASHIER_ALLOW_MEMBER_XMKONLYMEMBERSHIPCARDAREALLOWED, false);
|
|
|
if (!astrict && way == MemberCardNoType.真实卡号)
|
|
|
{
|
|
|
MsgEvent.Send(Constant.PAY_MESSAGE_EVENT_NOTIFY, new Tuple<bool, string>(true, "不允许刷卡"));
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
astrict = Global.Instance.GlobalConfigBoolValue(ConfigConstant.CASHIER_ALLOW_MEMBER_XMKMANUALINPUT, false);
|
|
|
|
|
|
if (!astrict && way != MemberCardNoType.真实卡号)
|
|
|
{
|
|
|
MsgEvent.Send(Constant.PAY_MESSAGE_EVENT_NOTIFY, new Tuple<bool, string>(true, "只允许刷卡"));
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
bool astrict = Global.Instance.GlobalConfigBoolValue(ConfigConstant.CASHIER_ALLOW_MEMBER_WXMEMBERSHIPCARDARENOTALLOWED, false);
|
|
|
if (astrict && way == MemberCardNoType.真实卡号)
|
|
|
{
|
|
|
MsgEvent.Send(Constant.PAY_MESSAGE_EVENT_NOTIFY, new Tuple<bool, string>(true, "不允许刷卡"));
|
|
|
return;
|
|
|
}
|
|
|
astrict = Global.Instance.GlobalConfigBoolValue(ConfigConstant.CASHIER_ALLOW_MEMBER_ENTERYOURPHONENUMBER, true);
|
|
|
|
|
|
if (!astrict && way == MemberCardNoType.手机号)
|
|
|
{
|
|
|
MsgEvent.Send(Constant.PAY_MESSAGE_EVENT_NOTIFY, new Tuple<bool, string>(true, "不允许使用手机号"));
|
|
|
return;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
switch (way)
|
|
|
{
|
|
|
case MemberCardNoType.电子卡号:
|
|
|
{
|
|
|
Property = request.Property = "scanCode";
|
|
|
}
|
|
|
break;
|
|
|
case MemberCardNoType.真实卡号:
|
|
|
{
|
|
|
Property = request.Property = "cardNo";
|
|
|
}
|
|
|
break;
|
|
|
case MemberCardNoType.手机号:
|
|
|
{
|
|
|
Property = request.Property = "mobile";
|
|
|
}
|
|
|
break;
|
|
|
case MemberCardNoType.卡面号:
|
|
|
{
|
|
|
Property = request.Property = "surfaceNo";
|
|
|
}
|
|
|
break;
|
|
|
}
|
|
|
//享迷卡
|
|
|
if (this.PayNo.Equals("49"))
|
|
|
{
|
|
|
if (!request.Property.Equals("cardNo"))
|
|
|
{
|
|
|
MsgEvent.Send(Constant.PAY_MESSAGE_EVENT_NOTIFY, new Tuple<bool, string>(true, "请刷享迷卡"));
|
|
|
return;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
if (!isM1Card)
|
|
|
{
|
|
|
//是否允许手工输入卡号
|
|
|
var allowInput = Global.Instance.GlobalConfigStringValue(ConfigConstant.CASHIER_ALLOW_INPUT_CARDNO, "0");
|
|
|
if ("0".Equals(allowInput) && maxChangeTime > 200 && (request.Property.Equals("surfaceNo") || request.Property.Equals("cardNo")))
|
|
|
{
|
|
|
txtCardNo.Text = "";
|
|
|
MsgEvent.Send(Constant.PAY_MESSAGE_EVENT_NOTIFY, new Tuple<bool, string>(true, "不允许手工录入卡号"));
|
|
|
return;
|
|
|
}
|
|
|
}
|
|
|
isM1Card = false;
|
|
|
request.ShopNo = Global.Instance.Authc.StoreNo;
|
|
|
request.WorkerNo = Global.Instance.Worker.No;
|
|
|
request.PosNo = Global.Instance.Authc.PosNo;
|
|
|
|
|
|
var resp = CardUtils.MemberInfoQuery(request);
|
|
|
//会员卡获取成功
|
|
|
if (resp.Item1)
|
|
|
{
|
|
|
|
|
|
//查询返回结果
|
|
|
this._currentMemberInfo = resp.Item3;
|
|
|
//读卡方式
|
|
|
this._currentMemberInfo.GetWay = way;
|
|
|
|
|
|
if (this._currentMemberInfo.CardList.Count == 0)
|
|
|
{
|
|
|
MsgEvent.Send(Constant.PAY_MESSAGE_EVENT_NOTIFY, new Tuple<bool, string>(true, "没有可用的会员卡..."));
|
|
|
return;
|
|
|
}
|
|
|
verifymoney = true;
|
|
|
//享迷卡
|
|
|
if (this.PayNo.Equals("49"))
|
|
|
{
|
|
|
//当前会员
|
|
|
if (this._orderObject.XmkMember == null && this._currentCardItem.Function.Contains(MemberCardFunctions.会员储值及消费))
|
|
|
{
|
|
|
//享迷卡
|
|
|
if (this.PayNo.Equals("49"))
|
|
|
{
|
|
|
this._orderObject.XmkMember = this._currentMemberInfo;
|
|
|
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
this._orderObject.Member = this._currentMemberInfo;
|
|
|
}
|
|
|
|
|
|
|
|
|
//外部未刷卡,新会员,执行订单会员价
|
|
|
foreach (var item in this._orderObject.Items)
|
|
|
{
|
|
|
//套餐,自动找到套餐主菜进行优惠计算
|
|
|
if (item != null && item.RowState == OrderRowState.套餐明)
|
|
|
{
|
|
|
//套餐明细,找到套餐主菜进行优惠计算
|
|
|
var mainItem = this._orderObject.Items.Find(x => x.Group == item.Group && x.RowState == OrderRowState.套餐主);
|
|
|
if (mainItem != null)
|
|
|
{
|
|
|
|
|
|
if (item.Promotions != null && item.Promotions.Count > 0)
|
|
|
{
|
|
|
//有优惠,不计算单品优惠
|
|
|
//return;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
var promResult = PromotionEngine.Instance.CalItemPromotion(this._orderObject, item);
|
|
|
if (promResult.Count > 0)
|
|
|
{
|
|
|
if (promResult.Exists(x => x.Type == PromotionType.双数特价优惠 || x.Type == PromotionType.双数特价赠送))
|
|
|
{
|
|
|
//ApplyDoublePromMain(promResult, item);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
var fineProm = promResult.OrderByDescending(x => x.DiscountAmount).ToList()[0];
|
|
|
var needUpdate = BusinessUtils.Instance.ApplyItemFinePromotion(this._orderObject, item, fineProm);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
if (item != null && item.Promotions != null && item.Promotions.Count > 0)
|
|
|
{
|
|
|
//有优惠,不计算单品优惠
|
|
|
//return;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
var promResult = PromotionEngine.Instance.CalItemPromotion(this._orderObject, item);
|
|
|
if (promResult.Count > 0)
|
|
|
{
|
|
|
if (promResult.Exists(x => x.Type == PromotionType.双数特价优惠 || x.Type == PromotionType.双数特价赠送))
|
|
|
{
|
|
|
//ApplyDoublePromMain(promResult, item);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
var fineProm = promResult.OrderByDescending(x => x.DiscountAmount).ToList()[0];
|
|
|
var needUpdate = BusinessUtils.Instance.ApplyItemFinePromotion(this._orderObject, item, fineProm);
|
|
|
}
|
|
|
}
|
|
|
//套餐道菜分摊
|
|
|
PromotionUtils.CalculateSuitShare(this._orderObject, item);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
if (this._currentMemberInfo.MemberTypeNo.Equals("9999"))
|
|
|
{
|
|
|
MsgEvent.Send(Constant.PAY_MESSAGE_EVENT_NOTIFY, new Tuple<bool, string>(true, "不能在会员卡支付方式使用享迷卡"));
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
//当前会员
|
|
|
if (this._orderObject.Member == null && this._currentCardItem.Function.Contains(MemberCardFunctions.会员储值及消费))
|
|
|
{
|
|
|
//享迷卡
|
|
|
if (this.PayNo.Equals("49"))
|
|
|
{
|
|
|
this._orderObject.XmkMember = this._currentMemberInfo;
|
|
|
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
this._orderObject.Member = this._currentMemberInfo;
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//外部未刷卡,新会员,执行订单会员价
|
|
|
foreach (var item in this._orderObject.Items)
|
|
|
{
|
|
|
//套餐,自动找到套餐主菜进行优惠计算
|
|
|
if (item != null && item.RowState == OrderRowState.套餐明)
|
|
|
{
|
|
|
//套餐明细,找到套餐主菜进行优惠计算
|
|
|
var mainItem = this._orderObject.Items.Find(x => x.Group == item.Group && x.RowState == OrderRowState.套餐主);
|
|
|
if (mainItem != null)
|
|
|
{
|
|
|
|
|
|
if (item.Promotions != null && item.Promotions.Count > 0)
|
|
|
{
|
|
|
//有优惠,不计算单品优惠
|
|
|
//return;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
var promResult = PromotionEngine.Instance.CalItemPromotion(this._orderObject, item);
|
|
|
if (promResult.Count > 0)
|
|
|
{
|
|
|
if (promResult.Exists(x => x.Type == PromotionType.双数特价优惠 || x.Type == PromotionType.双数特价赠送))
|
|
|
{
|
|
|
//ApplyDoublePromMain(promResult, item);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
var fineProm = promResult.OrderByDescending(x => x.DiscountAmount).ToList()[0];
|
|
|
var needUpdate = BusinessUtils.Instance.ApplyItemFinePromotion(this._orderObject, item, fineProm);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
if (item != null && item.Promotions != null && item.Promotions.Count > 0)
|
|
|
{
|
|
|
//有优惠,不计算单品优惠
|
|
|
//return;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
var promResult = PromotionEngine.Instance.CalItemPromotion(this._orderObject, item);
|
|
|
if (promResult.Count > 0)
|
|
|
{
|
|
|
if (promResult.Exists(x => x.Type == PromotionType.双数特价优惠 || x.Type == PromotionType.双数特价赠送))
|
|
|
{
|
|
|
//ApplyDoublePromMain(promResult, item);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
var fineProm = promResult.OrderByDescending(x => x.DiscountAmount).ToList()[0];
|
|
|
var needUpdate = BusinessUtils.Instance.ApplyItemFinePromotion(this._orderObject, item, fineProm);
|
|
|
}
|
|
|
}
|
|
|
//套餐道菜分摊
|
|
|
PromotionUtils.CalculateSuitShare(this._orderObject, item);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (this._currentMemberInfo.CardList.Count > 1)
|
|
|
{
|
|
|
this._currentOperator = MemberCardOperator.多卡选择;
|
|
|
|
|
|
this.tabCardRead.Visible = false;
|
|
|
this.tabCardPasswd.Visible = false;
|
|
|
this.tabCardSelected.Visible = true;
|
|
|
this.tabCardPay.Visible = false;
|
|
|
|
|
|
this.tabCardSelected.Text = "获取到" + this._currentMemberInfo.CardList.Count + "张卡,请选择";
|
|
|
this.tabCardControl.SelectedTab = this.tabCardSelected;
|
|
|
|
|
|
//多张会员卡,等待收银员选择
|
|
|
this._currentCard = null;
|
|
|
|
|
|
//进入多卡选择界面
|
|
|
this.BuilderSelectedCard(this._currentMemberInfo.CardList);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
|
|
|
this._currentOperator = MemberCardOperator.会员消费;
|
|
|
|
|
|
this.tabCardRead.Visible = false;
|
|
|
this.tabCardPasswd.Visible = false;
|
|
|
this.tabCardSelected.Visible = false;
|
|
|
this.tabCardPay.Visible = true;
|
|
|
|
|
|
this.tabCardControl.SelectedTab = this.tabCardPay;
|
|
|
|
|
|
//只有一张会员卡,自动选择作为当前可用会员卡
|
|
|
this._currentCard = this._currentMemberInfo.CardList[0];
|
|
|
|
|
|
//当前选中的会员卡
|
|
|
|
|
|
//享迷卡
|
|
|
if (this.PayNo.Equals("49"))
|
|
|
{
|
|
|
if (this._orderObject.XmkMember != null && this._orderObject.XmkMember.Id.Equals(this._currentMemberInfo.Id))
|
|
|
{
|
|
|
this._orderObject.XmkMember.CurrentCard = this._currentCard;
|
|
|
}
|
|
|
var skipNoMoney = Global.Instance.GlobalConfigStringValue(ConfigConstant.CONFIG_CASHIER_CARDPAYSKIPNOMONEY, "0");
|
|
|
if (!BusinessUtils.Instance.HavMemberPromotionCoup(this._orderObject) && this._currentCard != null && this._currentCard.AvailableAmount <= 0 && "1".Equals(skipNoMoney))
|
|
|
{
|
|
|
this._currentOperator = MemberCardOperator.会员刷卡;
|
|
|
this._orderObject.XmkMember = null;
|
|
|
this._currentCard = null;
|
|
|
BusinessUtils.Instance.RemoveMemberPromotion(this._orderObject);
|
|
|
this.BindUi(this._orderObject);
|
|
|
this.txtCardNo.Text = voucherNo;
|
|
|
MsgEvent.Send(Constant.PAY_MESSAGE_EVENT_NOTIFY, new Tuple<bool, string>(true, "余额为0不允许消费,请充值或选择其他付款方式!"));
|
|
|
return;
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
if (this._orderObject.Member != null && this._orderObject.Member.Id.Equals(this._currentMemberInfo.Id))
|
|
|
{
|
|
|
this._orderObject.Member.CurrentCard = this._currentCard;
|
|
|
}
|
|
|
var skipNoMoney = Global.Instance.GlobalConfigStringValue(ConfigConstant.CONFIG_CASHIER_CARDPAYSKIPNOMONEY, "0");
|
|
|
if (!BusinessUtils.Instance.HavMemberPromotionCoup(this._orderObject) && this._currentCard != null && this._currentCard.AvailableAmount <= 0 && "1".Equals(skipNoMoney))
|
|
|
{
|
|
|
this._currentOperator = MemberCardOperator.会员刷卡;
|
|
|
this._orderObject.Member = null;
|
|
|
this._currentCard = null;
|
|
|
BusinessUtils.Instance.RemoveMemberPromotion(this._orderObject);
|
|
|
this.BindUi(this._orderObject);
|
|
|
this.txtCardNo.Text = voucherNo;
|
|
|
MsgEvent.Send(Constant.PAY_MESSAGE_EVENT_NOTIFY, new Tuple<bool, string>(true, "余额为0不允许消费,请充值或选择其他付款方式!"));
|
|
|
return;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
verifymoney = true;
|
|
|
this.RefreshUi();
|
|
|
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
MsgEvent.Send(Constant.PAY_MESSAGE_EVENT_NOTIFY, new Tuple<bool, string>(true, resp.Item2));
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
}
|
|
|
break;
|
|
|
case MemberCardOperator.会员消费:
|
|
|
{
|
|
|
verifymoney = false;
|
|
|
//当前卡号
|
|
|
var cardNo = this._currentCard.CardNo;
|
|
|
|
|
|
//实收金额,操作员录入消费卡金
|
|
|
decimal inputAmount = this.txtAmount.DecimalValue;
|
|
|
|
|
|
//是否启用免密支付,前台收银参数中关闭免密支付
|
|
|
bool notAllowNoPwd = this._currentCardItem.PaymentType == 0;
|
|
|
|
|
|
var _notPassword = Global.Instance.GlobalConfigBoolValue(ConfigConstant.CASHIER_ALLOW_MEMBER_DONOTENTERPASSWORD, true);
|
|
|
|
|
|
//1)设置开启免密支付;2)开启免密支付,但支付金额大于免密支付额度;3)收银参数关闭免密支付
|
|
|
if (notAllowNoPwd || this._currentCard.IsNoPwd == 0 || (this._currentCard.IsNoPwd == 1 && this._currentCard.NpAmount < inputAmount ) || (this._currentMemberInfo.GetWay == MemberCardNoType.手机号 && !_notPassword))
|
|
|
{
|
|
|
this._currentOperator = MemberCardOperator.支付密码;
|
|
|
|
|
|
this.tabCardRead.Visible = false;
|
|
|
this.tabCardPasswd.Visible = true;
|
|
|
this.tabCardSelected.Visible = false;
|
|
|
this.tabCardPay.Visible = false;
|
|
|
|
|
|
this.tabCardControl.SelectedTab = this.tabCardPasswd;
|
|
|
verifymoney = true;
|
|
|
this.RefreshUi();
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
if (this._orderObject.Pays.FirstOrDefault(f => f.No.Equals(this.PayNo)) == null && verifymoney)
|
|
|
{
|
|
|
this.tabCardRead.Visible = false;
|
|
|
this.tabCardPasswd.Visible = false;
|
|
|
this.tabCardSelected.Visible = false;
|
|
|
this.tabCardPay.Visible = true;
|
|
|
|
|
|
this.tabCardControl.SelectedTab = this.tabCardPay;
|
|
|
this.RefreshUi();
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
var request = new CardTradeCreateCardRequest();
|
|
|
request.TradeVoucherNo = this._newVoucherNo.TradeVoucherNo;
|
|
|
request.TradeNo = this._orderObject.TradeNo;
|
|
|
request.CardNo = this._currentCard.CardNo;
|
|
|
|
|
|
request.CardTypeNo = this._currentCard.CardTypeNo;
|
|
|
request.CardLevelNo = this._currentCard.CardLevelNo;
|
|
|
request.Amount = Convert.ToInt32(this.txtAmount.DecimalValue * 100);
|
|
|
|
|
|
request.ShopNo = Global.Instance.Authc.StoreNo;
|
|
|
request.WorkerNo = Global.Instance.Worker.No;
|
|
|
request.PosNo = Global.Instance.Authc.PosNo;
|
|
|
|
|
|
//会员卡统一下单
|
|
|
var unifiedOrder = CardUtils.CardTradeCreateCard(request);
|
|
|
if (!unifiedOrder.Item1)
|
|
|
{
|
|
|
MsgEvent.Send(Constant.PAY_MESSAGE_EVENT_NOTIFY, new Tuple<bool, string>(true, unifiedOrder.Item2));
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
//构建会员卡支付列表,默认没有支付密码,按免密支付处理,免密支付采用扣款金额RSA加密
|
|
|
string passwd = RSAFromPkcs8.encryptData(request.Amount.ToString(), Properties.Resources.RSAPublicKey, "UTF-8");
|
|
|
|
|
|
this.AddMCardPayType(request, unifiedOrder.Item3, false, passwd);
|
|
|
|
|
|
|
|
|
}
|
|
|
}
|
|
|
break;
|
|
|
case MemberCardOperator.支付密码:
|
|
|
{
|
|
|
|
|
|
//当前选择的会员卡
|
|
|
var cardNo = this._currentCard.CardNo;
|
|
|
//实收金额,操作员录入消费卡金
|
|
|
var inputValue = this.txtPasswd.Text;
|
|
|
|
|
|
var validRequest = new CardValidRequest();
|
|
|
validRequest.CardNo = cardNo;
|
|
|
validRequest.Passwd = inputValue;
|
|
|
validRequest.ShopNo = Global.Instance.Authc.StoreNo;
|
|
|
validRequest.PosNo = Global.Instance.Authc.PosNo;
|
|
|
//校验卡密码
|
|
|
var data = CardUtils.CardValid(validRequest);
|
|
|
if (!data.Item1)
|
|
|
{
|
|
|
MsgEvent.Send(Constant.PAY_MESSAGE_EVENT_NOTIFY, new Tuple<bool, string>(true, data.Item2));
|
|
|
this.txtPasswd.SelectAll();
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
|
|
|
if (this._orderObject.Pays.FirstOrDefault(f => f.No.Equals(this.PayNo)) == null && verifymoney)
|
|
|
{
|
|
|
//是否需要确认金额,不跳过确认
|
|
|
var skipConfirmMoney = Global.Instance.GlobalConfigBoolValue(ConfigConstant.CONFIG_CASHIER_CARDPAYSKIPCONFIRMMONEY, true);
|
|
|
if (skipConfirmMoney)
|
|
|
{
|
|
|
Task.Factory.StartNew(() =>
|
|
|
{
|
|
|
Thread.Sleep(100);
|
|
|
if (this.IsDisposed || !this.IsHandleCreated) return;
|
|
|
this.Invoke(new Action(() =>
|
|
|
{
|
|
|
if (VerifyInputValue())
|
|
|
{
|
|
|
MsgEvent.Send(Constant.PAY_AUTO_EVENT_NOTIFY, "快捷触发会员卡支付结账");
|
|
|
}
|
|
|
}));
|
|
|
});
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
this.tabCardRead.Visible = false;
|
|
|
this.tabCardPasswd.Visible = false;
|
|
|
this.tabCardSelected.Visible = false;
|
|
|
this.tabCardPay.Visible = true;
|
|
|
verifymoney = false;
|
|
|
this.tabCardControl.SelectedTab = this.tabCardPay;
|
|
|
this.RefreshUi();
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var request = new CardTradeCreateCardRequest();
|
|
|
request.TradeVoucherNo = this._newVoucherNo.TradeVoucherNo;
|
|
|
request.TradeNo = this._orderObject.TradeNo;
|
|
|
request.CardNo = this._currentCard.CardNo;
|
|
|
|
|
|
request.CardTypeNo = this._currentCard.CardTypeNo;
|
|
|
request.CardLevelNo = this._currentCard.CardLevelNo;
|
|
|
request.Amount = Convert.ToInt32(this.txtAmount.DecimalValue * 100);
|
|
|
|
|
|
request.ShopNo = Global.Instance.Authc.StoreNo;
|
|
|
request.WorkerNo = Global.Instance.Worker.No;
|
|
|
request.PosNo = Global.Instance.Authc.PosNo;
|
|
|
|
|
|
//会员卡统一下单
|
|
|
var unifiedOrder = CardUtils.CardTradeCreateCard(request);
|
|
|
if (!unifiedOrder.Item1)
|
|
|
{
|
|
|
MsgEvent.Send(Constant.PAY_MESSAGE_EVENT_NOTIFY, new Tuple<bool, string>(true, unifiedOrder.Item2));
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
//构建会员卡支付列表
|
|
|
string passwd = DesUtils.Encrypt(this.txtPasswd.Text);
|
|
|
this.AddMCardPayType(request, unifiedOrder.Item3, true, passwd);
|
|
|
|
|
|
}
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
break;
|
|
|
case "100":
|
|
|
{
|
|
|
//如果当前焦点控件是输入框
|
|
|
if (this.ActiveControl is TextBox)
|
|
|
{
|
|
|
var activeControl = this.ActiveControl as TextBox;
|
|
|
activeControl.Text = string.Empty;
|
|
|
}
|
|
|
|
|
|
InputSimulatorUtils.SendKey(KeyCodes.Map["1"]);
|
|
|
InputSimulatorUtils.SendKey(KeyCodes.Map["0"]);
|
|
|
InputSimulatorUtils.SendKey(KeyCodes.Map["0"]);
|
|
|
}
|
|
|
break;
|
|
|
case "50":
|
|
|
{
|
|
|
//如果当前焦点控件是输入框
|
|
|
if (this.ActiveControl is TextBox)
|
|
|
{
|
|
|
var activeControl = this.ActiveControl as TextBox;
|
|
|
activeControl.Text = string.Empty;
|
|
|
}
|
|
|
|
|
|
InputSimulatorUtils.SendKey(KeyCodes.Map["5"]);
|
|
|
InputSimulatorUtils.SendKey(KeyCodes.Map["0"]);
|
|
|
}
|
|
|
break;
|
|
|
case "20":
|
|
|
{
|
|
|
//如果当前焦点控件是输入框
|
|
|
if (this.ActiveControl is TextBox)
|
|
|
{
|
|
|
var activeControl = this.ActiveControl as TextBox;
|
|
|
activeControl.Text = string.Empty;
|
|
|
}
|
|
|
|
|
|
InputSimulatorUtils.SendKey(KeyCodes.Map["2"]);
|
|
|
InputSimulatorUtils.SendKey(KeyCodes.Map["0"]);
|
|
|
}
|
|
|
break;
|
|
|
case "10":
|
|
|
{
|
|
|
//如果当前焦点控件是输入框
|
|
|
if (this.ActiveControl is TextBox)
|
|
|
{
|
|
|
var activeControl = this.ActiveControl as TextBox;
|
|
|
activeControl.Text = string.Empty;
|
|
|
}
|
|
|
|
|
|
InputSimulatorUtils.SendKey(KeyCodes.Map["1"]);
|
|
|
InputSimulatorUtils.SendKey(KeyCodes.Map["0"]);
|
|
|
}
|
|
|
break;
|
|
|
default:
|
|
|
InputSimulatorUtils.SendKey(KeyCodes.Map[e.KeyCode]);
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 构建多张会员卡选择
|
|
|
/// </summary>
|
|
|
private void BuilderSelectedCard(List<MemberCard> lists)
|
|
|
{
|
|
|
this.itemPanel.Items.Clear();
|
|
|
this.itemPanel.Font = Constant.NORMAL_FONT;
|
|
|
|
|
|
foreach (var card in lists)
|
|
|
{
|
|
|
MetroTileItem item = new MetroTileItem();
|
|
|
|
|
|
item.TileStyle.PaddingTop = 2;
|
|
|
item.TileStyle.PaddingLeft = item.TileStyle.PaddingRight = item.TileStyle.PaddingBottom = -1;
|
|
|
|
|
|
item.CheckBehavior = eMetroTileCheckBehavior.LeftMouseButtonClick;
|
|
|
item.OptionGroup = "SelectedCard";
|
|
|
item.TileSize = new Size(180, 45);
|
|
|
item.Checked = false;
|
|
|
item.TileColor = eMetroTileColor.Teal;
|
|
|
|
|
|
item.TileStyle.Font = Constant.NORMAL_FONT;
|
|
|
item.TileStyle.TextAlignment = eStyleTextAlignment.Near;
|
|
|
item.TileStyle.TextLineAlignment = eStyleTextAlignment.Near;
|
|
|
|
|
|
item.TitleTextFont = Constant.NORMAL_FONT;
|
|
|
item.TitleTextAlignment = ContentAlignment.BottomLeft;
|
|
|
|
|
|
//卡状态(1-正常;2-预售;3-挂失;4-冻结;5-销户;)
|
|
|
var cardStatus = (MemberCardStatus)Enum.ToObject(typeof(MemberCardStatus), card.Status);
|
|
|
item.Text = string.Format("{0} {1} {2}", card.CardNo, cardStatus.ToString(), this._currentMemberInfo.Name);
|
|
|
item.TitleText = string.Format("余额:{0} 积分:{1}", card.AvailableAmount, card.TotalPoint);
|
|
|
|
|
|
item.Tag = card;
|
|
|
|
|
|
item.MouseDown += (o, args) =>
|
|
|
{
|
|
|
MetroTileItem _item = o as MetroTileItem;
|
|
|
_item.Checked = true;
|
|
|
};
|
|
|
|
|
|
item.CheckedChanged += (o, args) =>
|
|
|
{
|
|
|
|
|
|
MetroTileItem _item = o as MetroTileItem;
|
|
|
if (_item.Checked)
|
|
|
{
|
|
|
MemberCard _card = _item.Tag as MemberCard;
|
|
|
|
|
|
//多张卡,操作员选择一张
|
|
|
this._currentCard = _card;
|
|
|
|
|
|
//享迷卡
|
|
|
if (this.PayNo.Equals("49"))
|
|
|
{
|
|
|
//当前选中的会员卡
|
|
|
if (this._orderObject.XmkMember != null && this._orderObject.XmkMember.Id.Equals(this._currentMemberInfo.Id))
|
|
|
{
|
|
|
this._orderObject.XmkMember.CurrentCard = this._currentCard;
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
//当前选中的会员卡
|
|
|
if (this._orderObject.Member != null && this._orderObject.Member.Id.Equals(this._currentMemberInfo.Id))
|
|
|
{
|
|
|
this._orderObject.Member.CurrentCard = this._currentCard;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
_item.TileColor = eMetroTileColor.Coffee;
|
|
|
|
|
|
//选择会员卡后转入会员消费
|
|
|
this._currentOperator = MemberCardOperator.会员消费;
|
|
|
|
|
|
this.tabCardRead.Visible = false;
|
|
|
this.tabCardPasswd.Visible = false;
|
|
|
this.tabCardSelected.Visible = false;
|
|
|
this.tabCardPay.Visible = true;
|
|
|
this.tabCardControl.SelectedTab = this.tabCardPay;
|
|
|
|
|
|
this.RefreshUi();
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
_item.TileColor = eMetroTileColor.Teal;
|
|
|
}
|
|
|
};
|
|
|
|
|
|
|
|
|
this.itemPanel.Items.Add(item);
|
|
|
}
|
|
|
|
|
|
this.itemPanel.Invalidate();
|
|
|
|
|
|
}
|
|
|
private void OnBackReadCardClick(object sender, EventArgs e)
|
|
|
{
|
|
|
this._currentOperator = MemberCardOperator.会员刷卡;
|
|
|
|
|
|
this.tabCardRead.Visible = true;
|
|
|
this.tabCardPasswd.Visible = false;
|
|
|
this.tabCardSelected.Visible = false;
|
|
|
this.tabCardPay.Visible = false;
|
|
|
|
|
|
this.tabCardControl.SelectedTab = this.tabCardRead;
|
|
|
|
|
|
RefreshUi();
|
|
|
}
|
|
|
|
|
|
private void OnChangedCardClick(object sender, EventArgs e)
|
|
|
{
|
|
|
//如果是多张卡,转入多卡选择界面
|
|
|
if (this._currentMemberInfo.CardList.Count > 1)
|
|
|
{
|
|
|
this._currentOperator = MemberCardOperator.多卡选择;
|
|
|
|
|
|
this.tabCardRead.Visible = false;
|
|
|
this.tabCardPasswd.Visible = false;
|
|
|
this.tabCardSelected.Visible = true;
|
|
|
this.tabCardPay.Visible = false;
|
|
|
|
|
|
this.tabCardSelected.Text = "获取到" + this._currentMemberInfo.CardList.Count + "张卡,请选择";
|
|
|
this.tabCardControl.SelectedTab = this.tabCardSelected;
|
|
|
|
|
|
//多张会员卡,等待收银员选择
|
|
|
this._currentCard = null;
|
|
|
|
|
|
//进入多卡选择界面
|
|
|
this.BuilderSelectedCard(this._currentMemberInfo.CardList);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
var skipNoMoney = Global.Instance.GlobalConfigStringValue(ConfigConstant.CONFIG_CASHIER_CARDPAYSKIPNOMONEY, "0");
|
|
|
if ("1".Equals(skipNoMoney) && BusinessUtils.Instance.HavMemberPromotion(this._orderObject))
|
|
|
{
|
|
|
MsgEvent.Send(Constant.PAY_MESSAGE_EVENT_NOTIFY, new Tuple<bool, string>(true, "已使用会员优惠不允许换卡"));
|
|
|
return;
|
|
|
}
|
|
|
this._currentOperator = MemberCardOperator.会员刷卡;
|
|
|
|
|
|
this.tabCardRead.Visible = true;
|
|
|
this.tabCardPasswd.Visible = false;
|
|
|
this.tabCardSelected.Visible = false;
|
|
|
this.tabCardPay.Visible = false;
|
|
|
|
|
|
this.tabCardControl.SelectedTab = this.tabCardRead;
|
|
|
|
|
|
this.txtCardNo.Focus();
|
|
|
this.txtCardNo.SelectAll();
|
|
|
RefreshUi();
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
private void OnMCardEnterClick(object sender, Component.EnterEventArg e)
|
|
|
{
|
|
|
this.SimulateKeyboard(new BillKeyboardEventArgs("accept"));
|
|
|
}
|
|
|
|
|
|
private void OnPaymentRowDeleteClick(object sender, PaymentRowDeleteClickEventArgs e)
|
|
|
{
|
|
|
var skipNoMoney = Global.Instance.GlobalConfigStringValue(ConfigConstant.CONFIG_CASHIER_CARDPAYSKIPNOMONEY, "0");
|
|
|
if ("1".Equals(skipNoMoney) && BusinessUtils.Instance.HavMemberPromotion(this._orderObject))
|
|
|
{
|
|
|
MsgEvent.Send(Constant.PAY_MESSAGE_EVENT_NOTIFY, new Tuple<bool, string>(true, "已使用会员优惠不允许删除"));
|
|
|
return;
|
|
|
}
|
|
|
if (this._orderObject.Pays.Exists(x => x.Id == e.ObjectId))
|
|
|
{
|
|
|
var _oldItem = this._orderObject.Pays.Find(x => x.Id == e.ObjectId);
|
|
|
|
|
|
//删除已经存在的支付方式
|
|
|
this._orderObject.Pays.Remove(_oldItem);
|
|
|
|
|
|
//刷新界面数据
|
|
|
this.billSummary1.Refresh(this._orderObject);
|
|
|
this.billGrid1.RefreshGrid(this._orderObject.Pays);
|
|
|
|
|
|
//未收金额
|
|
|
var unpaidAmount = this._orderObject.ReceivableAmount - this._orderObject.ReceivedAmount;
|
|
|
this.txtAmount.Text = unpaidAmount < 0 ? "0" : unpaidAmount.ToString();
|
|
|
|
|
|
this.txtAmount.Focus();
|
|
|
this.txtAmount.SelectAll();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
public override void SimulateKeyboard(BillKeyboardEventArgs e)
|
|
|
{
|
|
|
base.SimulateKeyboard(e);
|
|
|
|
|
|
switch (this._currentOperator)
|
|
|
{
|
|
|
case MemberCardOperator.会员刷卡:
|
|
|
{
|
|
|
this.OnKeyboardBefore(this.billKeyboard2, e);
|
|
|
if (this.PaymentVerify)
|
|
|
{
|
|
|
this.OnKeyboardAfter(this.billKeyboard2, e);
|
|
|
}
|
|
|
}
|
|
|
break;
|
|
|
case MemberCardOperator.会员消费:
|
|
|
{
|
|
|
this.OnKeyboardBefore(this.billKeyboard1, e);
|
|
|
if (this.PaymentVerify)
|
|
|
{
|
|
|
this.OnKeyboardAfter(this.billKeyboard1, e);
|
|
|
}
|
|
|
}
|
|
|
break;
|
|
|
case MemberCardOperator.支付密码:
|
|
|
{
|
|
|
this.OnKeyboardBefore(this.billKeyboard3, e);
|
|
|
|
|
|
if (this.PaymentVerify)
|
|
|
{
|
|
|
this.OnKeyboardAfter(this.billKeyboard3, e);
|
|
|
}
|
|
|
}
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
private long maxChangeTime = 0;
|
|
|
private bool input = false;
|
|
|
private long upTime = 0;
|
|
|
/// <summary>
|
|
|
/// 监听输入框不允许输入
|
|
|
/// </summary>
|
|
|
/// <param name="sender"></param>
|
|
|
/// <param name="e"></param>
|
|
|
private void OnMemberValueChage(object sender, Component.EnterEventArg e)
|
|
|
{
|
|
|
if (txtCardNo.Text.Length == 0)
|
|
|
{
|
|
|
maxChangeTime = 0;
|
|
|
input = false;
|
|
|
upTime = 0;
|
|
|
}
|
|
|
if (txtCardNo.Text.Length == 1)
|
|
|
{
|
|
|
upTime = DateTime.Now.ToUniversalTime().Ticks;
|
|
|
}
|
|
|
if (txtCardNo.Text.Length > 1)
|
|
|
{
|
|
|
input = true;
|
|
|
}
|
|
|
if (input)
|
|
|
{
|
|
|
var nowTime = DateTime.Now.ToUniversalTime().Ticks;
|
|
|
if ((nowTime - upTime) / 10000 > maxChangeTime)
|
|
|
{
|
|
|
maxChangeTime = (nowTime - upTime) / 10000;
|
|
|
}
|
|
|
LOGGER.Info("输入号码耗时======>" + maxChangeTime);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
private void MCardControl_VisibleChanged(object sender, EventArgs e)
|
|
|
{
|
|
|
|
|
|
if (this._orderObject == null)
|
|
|
{
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
//享迷卡
|
|
|
if (this.PayNo.Equals("49"))
|
|
|
{
|
|
|
if (this._orderObject.XmkMember == null)
|
|
|
{
|
|
|
return;
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
if (this._orderObject.Member == null)
|
|
|
{
|
|
|
return;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
private void txtCardNo_TextChanged(object sender, EventArgs e)
|
|
|
{
|
|
|
if (this.PayNo.Equals("49"))
|
|
|
{
|
|
|
txtCardNo.Text = "";
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 会员卡操作步骤
|
|
|
/// </summary>
|
|
|
public enum MemberCardOperator
|
|
|
{
|
|
|
会员刷卡 = 1,
|
|
|
多卡选择 = 2,
|
|
|
会员消费 = 3,
|
|
|
支付密码 = 4,
|
|
|
会员信息 = 5
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 会员卡状态
|
|
|
/// </summary>
|
|
|
public enum MemberCardStatus
|
|
|
{
|
|
|
未知 = 0,
|
|
|
正常 = 1,
|
|
|
预售 = 2,
|
|
|
挂失 = 3,
|
|
|
冻结 = 4,
|
|
|
销户 = 5
|
|
|
}
|
|
|
}
|