private void btn_Z_Click(object sender, RoutedEventArgs e) { //this.tb_selecttype.FontSize = 50; if (T_SellTicketRecord.Judge_TicketAlarmCount(this.parent.mSelfHelpClass.TicketTypeID, this.nCount)) { this.la_show.Visibility = Visibility.Visible; this.la_show.Content = "余票不足!"; // MessageBox.Show("所购票数已超过当前票箱允许的售票数!", T_SellTicketRecord.str_Apption, MessageBoxButton.OK, MessageBoxImage.Information); return; } if (nCount >= T_SellTicketRecord.MaxTicketCount) { // MessageBox.Show("票数已达单次最大购票数量!", T_SellTicketRecord.str_Apption, MessageBoxButton.OK, MessageBoxImage.Information); // this.txshow.Text = "购票信息-票数已达单次最大购票数量!"; // this.txshow.Foreground = System.Windows.Media.Brushes.Red; this.la_show.Visibility = Visibility.Visible; this.la_show.Content = "单次限购10张!"; this.nCount = T_SellTicketRecord.MaxTicketCount;//单次最大购票数 } else { this.nCount++; // this.txshow.Text = "购票信息-选择数量"; // this.txshow.Foreground = System.Windows.Media.Brushes.White; if (this.nCount >= T_SellTicketRecord.MaxTicketCount) { this.la_show.Visibility = Visibility.Visible; this.la_show.Content = "单次限购10张!"; } else { this.la_show.Visibility = Visibility.Hidden; } } //bool flag = this.nCount > this.MaxCount; //if (flag) //{ // this.nCount = this.MaxCount; //} this.tb_Count.Text = this.nCount.ToString().PadLeft(2, '0'); //this.parent.SelfHelpInfo.TicketCount = this.nCount; this.parent.mSelfHelpClass.TicketCount = this.nCount; //自助售票类 //this.tb_ShowTotal.Text = this.parent.SelfHelpInfo.TicketPriceTotal.ToString(); this.tb_ShowTotal.Text = this.parent.mSelfHelpClass.RealSum.ToString(); //自助售票类 }
private void btn_GQ_Click(object sender, RoutedEventArgs e) { //*************************将所选票种张数,金额写入临时销售主表中************** this.parent.mSelfHelpClass.OrderID = ""; //销售单号暂不生成 T_SellTicketRecord.CreateTableUID(M_Configuration.CLIENTID, T_SellTicketRecord.LocalTicket_Prefix_ZG, 1);//销售单号 T_SellTicketRecord.slorder.OrderId = this.parent.mSelfHelpClass.OrderID; //销售单号 T_SellTicketRecord.slorder.OrderType = T_SellTicketRecord.LocalTicket_Prefix_ZG; //销售类型 ZG 自助购票 // T_SellTicketRecord.slorder.TicketCount = this.parent.SelfHelpInfo.TicketCount;//销售张数 T_SellTicketRecord.slorder.DueSum = this.parent.mSelfHelpClass.DueSum; //应收金额 T_SellTicketRecord.slorder.RealSum = this.parent.mSelfHelpClass.RealSum; //实收金额 T_SellTicketRecord.slorder.Remark = "自助售票"; //订单说明 T_SellTicketRecord.slorder.PayStat = "1"; //支付状态(1-待支付 2-已支付 3-支付失败) T_SellTicketRecord.slorder.SaleTime = T_Date.ConvertDataTimeToLong(DateTime.Now); //售票时间 T_SellTicketRecord.slorder.VersionNo = T_Date.ConvertDataTimeToLong(DateTime.Now); //版本号 T_SellTicketRecord.slorder.SaleUserId = Convert.ToString(M_Configuration.CLIENTID); //售票人存为终端编号 //*************************将所选票种张数,金额写入临时销售主表中************** //******************将销售信息写入临时销售主表 #region//待删除 //if (T_SellTicketRecord.Inert_SL_ORDER_Temp(T_SellTicketRecord.slorder)) //{ // this.parent.Operation("gp4"); //} //else //{ // MessageBox.Show("票据信息保存失败!", T_SellTicketRecord.str_Apption, MessageBoxButton.OK, MessageBoxImage.Information); // return; //} #endregion if (T_SellTicketRecord.Judge_TicketAlarmCount(this.parent.mSelfHelpClass.TicketTypeID, this.nCount)) { MessageBox.Show("所购票数已超过当前票箱允许的售票数!", T_SellTicketRecord.str_Apption, MessageBoxButton.OK, MessageBoxImage.Information); return; } else { this.parent.Operation("gp4"); } }
private void Page_Loaded(object sender, RoutedEventArgs e) { // this.parent.SelfHelpInfo.PayType = ""; this.parent.mSelfHelpClass.PayType = "";//支付方式 自助售票类 //this.ticketDate.Text = this.parent.SelfHelpInfo.SaleTime; // this.ticketDate.Text = this.parent.mSelfHelpClass.SaleTime;//销售时间 自助售票类 // this.ticketType.Text = ConfigHelper.GetConfigValue("ticket", "t" + this.parent.SelfHelpInfo.TicketType); if (this.parent.mSelfHelpClass.BoxNumber == "A") { this.ticketType.Text = T_SellTicketRecord.GetTicketTypeName(M_Configuration.TicketTypeID_1);//票种 自助售票类\ } else if (this.parent.mSelfHelpClass.BoxNumber == "B") { this.ticketType.Text = T_SellTicketRecord.GetTicketTypeName(M_Configuration.TicketTypeID_2);//票种 自助售票类\ } // this.ticketCount.Text = this.parent.SelfHelpInfo.TicketCount.ToString(); this.ticketCount.Text = this.parent.mSelfHelpClass.TicketCount.ToString(); //票数 自助售票类 //this.ticketPriceTotal.Text = this.parent.SelfHelpInfo.TicketPriceTotal.ToString(); this.ticketPriceTotal.Text = this.parent.mSelfHelpClass.RealSum.ToString(); //销售金额 自助售票类 //this.ss.SelectVoiceByHints(VoiceGender.Female); // string configValue = ConfigHelper.GetConfigValue("speechqp", "paytype"); // this.ss.SpeakAsync(configValue); }
private void Page_Loaded(object sender, RoutedEventArgs e) { //this.parent.SelfHelpInfo.PayType = "alipay"; //this.parent.SelfHelpInfo.PayodNo = string.Empty; //this.parent.SelfHelpInfo.PayRefNo = string.Empty; //this.parent.SelfHelpInfo.PayTxnId = string.Empty; //this.parent.SelfHelpInfo.PaySuccess = false; //this.parent.SelfHelpInfo.PayReturnInfo = string.Empty; // this.ticketDate.Text = this.parent.SelfHelpInfo.SaleTime; //this.ticketCount.Text = this.parent.SelfHelpInfo.TicketCount.ToString(); //this.ticketType.Text = ConfigHelper.GetConfigValue("ticket", "t" + this.parent.SelfHelpInfo.TicketType); //this.ticketPriceTotal.Text = this.parent.SelfHelpInfo.TicketPriceTotal.ToString(); //this.ticketTotal.Text = this.parent.SelfHelpInfo.TicketPriceTotal.ToString(); //********************************支付部分***************************** this.parent.mSelfHelpClass.OperType = "0"; //取票还是购票 0表示购票 1表示取票 自助售票类 this.parent.mSelfHelpClass.PayType = "04"; //支付方式 自助售票类 01-现金,02-POS付款,03-微信,04-支付宝,05-代理 this.parent.mSelfHelpClass.PayStat = "1"; //支付状态(1-待支付 2-已支付 3-支付失败) this.parent.mSelfHelpClass.PayTypeID = T_SellTicketRecord.CreateTableUID(M_Configuration.CLIENTID, T_SellTicketRecord.LocalPayType_Prefix, 1); //支付单号 自助售票类 this.parent.mSelfHelpClass.PayID = string.Empty; //第三方支付单号 自助售票类 this.parent.mSelfHelpClass.PaySuccess = false; //是否支付成功 自助售票类 // this.ticketDate.Text = this.parent.mSelfHelpClass.SaleTime;//销售时间 自助售票类 this.ticketCount.Text = this.parent.mSelfHelpClass.TicketCount.ToString(); //票数 自助售票类 this.ticketType.Text = T_SellTicketRecord.GetTicketTypeName(this.parent.mSelfHelpClass.TicketTypeID); //票种 自助售票类 this.ticketPriceTotal.Text = this.parent.mSelfHelpClass.RealSum.ToString(); //销售金额 自助售票类 // this.ticketTotal.Text = this.parent.mSelfHelpClass.RealSum.ToString();//销售金额 自助售票类 //********************************支付部分***************************** //********************支付部分*********************** T_SellTicketRecord.slpaytype.OrderId = this.parent.mSelfHelpClass.OrderID; //销售单号 T_SellTicketRecord.slpaytype.PayTypeId = this.parent.mSelfHelpClass.PayTypeID; //支付单号 T_SellTicketRecord.slpaytype.PayType = this.parent.mSelfHelpClass.PayType; //支付方式 T_SellTicketRecord.slpaytype.Amt = this.parent.mSelfHelpClass.RealSum; //支付金额 T_SellTicketRecord.slpaytype.VersionNo = T_Date.ConvertDataTimeToLong(DateTime.Now); //版本号 //***************获取支付方式***************** //*******************写入数据*************************** this.parent.mSelfHelpClass.PayTypeID = T_SellTicketRecord.CreateTableUID(M_Configuration.CLIENTID, T_SellTicketRecord.LocalPayType_Prefix, 1); //支付单号 自助售票类 this.parent.mSelfHelpClass.OrderID = T_SellTicketRecord.CreateTableUID(M_Configuration.CLIENTID, T_SellTicketRecord.LocalTicket_Prefix_ZG, 1); //销售单号 this.parent.mSelfHelpClass.PayStat = "2"; //支付状态(1-待支付 2-已支付 3-支付失败) if (!T_SellTicketRecord.Insert_GP_Data(this.parent.mSelfHelpClass)) { _log.Error("支付宝购票数据写入失败!"); return; } //*******************写入数据*************************** this.odNo = ConfigHelper.GetConfigValue("pay", "odNoHead").PadLeft(2, '0') + ConfigHelper.GetConfigValue("window", "deviceNo").PadLeft(2, '0') + ConfigHelper.GetConfigValue("window", "busNo").PadLeft(2, '0') + DateTime.Now.ToString("yyMMddHHmmss"); //this.ss.SelectVoiceByHints(VoiceGender.Female); //this.ss.SpeakAsync("使用支付宝扫一扫,扫描右侧二维码"); this.counttimer = new DispatcherTimer(); this.counttimer.Interval = new TimeSpan(0, 0, 0, 1, 0); //10秒支付时间 this.counttimer.Tick += new EventHandler(this.timer_Tick); this.counttimer.Start(); this.inputBox.Focus(); //委托用 this.timer_test = new DispatcherTimer(); this.timer_test.Interval = new TimeSpan(0, 0, 0, 1, 0); this.timer_test.Tick += new EventHandler(this.Timer_test); this.timer_test.Start(); this.isre = false; this.istest = false; }
private void Page_Loaded(object sender, RoutedEventArgs e) { try { int k1 = -1; int k2 = -1; string ticket1 = ConfigurationManager.AppSettings["TicketTypeID_1"].ToString(); string ticket2 = ConfigurationManager.AppSettings["TicketTypeID_2"].ToString(); SQLiteDataAdapter ada = new SQLiteDataAdapter("select TICKET_TYPE_NAME, TICKET_TYPE_ID from SYS_TICKET_TYPE where TEAM_flag='N' ", SQLiteHelper.LocalDbConnectionString); DataSet ds = new DataSet(); ada.Fill(ds); Dictionary <string, string> mydic = new Dictionary <string, string>(); for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { if (ds.Tables[0].Rows[i]["TICKET_TYPE_ID"].ToString() == ticket1) { k1 = i; } if (ds.Tables[0].Rows[i]["TICKET_TYPE_ID"].ToString() == ticket2) { k2 = i; } mydic.Add(ds.Tables[0].Rows[i]["TICKET_TYPE_ID"].ToString(), ds.Tables[0].Rows[i]["TICKET_TYPE_NAME"].ToString()); //this.look_Ticket1.Items.Add(ds.Tables[0].Rows[i]["TICKET_TYPE_NAME"].ToString()); //this.look_Ticket2.Items.Add(ds.Tables[0].Rows[i]["TICKET_TYPE_NAME"].ToString()); } //*******************获取废票数量 this.txt_AbolishCountt.Text = Convert.ToString(T_SellTicketRecord.GetCount_SL_AbolishCount()); this.look_Ticket1.ItemsSource = mydic; this.look_Ticket2.ItemsSource = mydic; this.look_Ticket1.SelectedValuePath = "Key"; this.look_Ticket1.DisplayMemberPath = "Value"; this.look_Ticket2.SelectedValuePath = "Key"; this.look_Ticket2.DisplayMemberPath = "Value"; this.look_Ticket1.SelectedIndex = k1; this.look_Ticket2.SelectedIndex = k2; } catch (Exception ex) { _log.Error(ex.Message); } //**********获取余票及报警票数等信息 DataTable dt = new DataTable(); dt = T_SellTicketRecord.Get_BoxTicketInfo(); if (dt.Rows.Count > 0) { for (int i = 0; i < dt.Rows.Count; i++) { if (dt.Rows[i]["boxNumber"].ToString() == "A") { this.txt_AalarmCount.Text = dt.Rows[i]["alarmCount"].ToString(); this.txt_AYuCount.Text = dt.Rows[i]["surplusCount"].ToString(); } else if (dt.Rows[i]["boxNumber"].ToString() == "B") { this.txt_BalarmCount.Text = dt.Rows[i]["alarmCount"].ToString(); this.txt_BYuCount.Text = dt.Rows[i]["surplusCount"].ToString(); } } } }
private void bt_Save_Click(object sender, RoutedEventArgs e) { if (this.look_Ticket1.Text == "") { MessageBox.Show("请设置一号票箱的票种!", T_SellTicketRecord.str_Apption, MessageBoxButton.OK, MessageBoxImage.Information); return; } if (this.look_Ticket2.Text == "") { MessageBox.Show("请设置二号票箱的票种!", T_SellTicketRecord.str_Apption, MessageBoxButton.OK, MessageBoxImage.Information); return; } Configuration cfa = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None); cfa.AppSettings.Settings["TicketTypeID_1"].Value = this.look_Ticket1.SelectedValue.ToString(); cfa.AppSettings.Settings["TicketTypeID_2"].Value = this.look_Ticket2.SelectedValue.ToString(); cfa.Save(ConfigurationSaveMode.Modified); //更新票箱余票 Int32 surplusCount = 0; Int32 alarmCount = 0; bool isok = false; if (txt_ACount.Text.ToString() != "") { surplusCount = Convert.ToInt32(txt_ACount.Text); } if (txt_AalarmCount.Text.ToString() != "") { alarmCount = Convert.ToInt32(txt_AalarmCount.Text); } string strchang = "0"; if (this.look_Ticket1.SelectedValue.ToString() != M_Configuration.TicketTypeID_1) { strchang = "1";//票种更改了 } else { strchang = "0";//票种没变 } if (!T_SellTicketRecord.UpdateCount_SL_TicketCount("A", this.look_Ticket1.SelectedValue.ToString(), surplusCount, alarmCount, strchang)) { MessageBox.Show("A票箱余票更新失败!", T_SellTicketRecord.str_Apption, MessageBoxButton.OK, MessageBoxImage.Information); isok = true; } surplusCount = 0; alarmCount = 0; if (txt_BCount.Text.ToString() != "") { surplusCount = Convert.ToInt32(txt_BCount.Text); } if (txt_BalarmCount.Text.ToString() != "") { alarmCount = Convert.ToInt32(txt_BalarmCount.Text); } if (this.look_Ticket2.SelectedValue.ToString() != M_Configuration.TicketTypeID_2) { strchang = "1";//票种更改了 } else { strchang = "0";//票种没变 } if (!T_SellTicketRecord.UpdateCount_SL_TicketCount("B", this.look_Ticket2.SelectedValue.ToString(), surplusCount, alarmCount, strchang)) { MessageBox.Show("B票箱余票更新失败!", T_SellTicketRecord.str_Apption, MessageBoxButton.OK, MessageBoxImage.Information); isok = true; } //废票重置 if (this.check_Abolish.IsChecked == true) { T_SellTicketRecord.Update_SL_AbolishCount(true); } if (isok == false) { MessageBox.Show("票箱余票更新成功!系统将自动退出,重启后配置生效!", T_SellTicketRecord.str_Apption, MessageBoxButton.OK, MessageBoxImage.Information); this.parent.EndOperation(); this.parent.Close();// } }
private void Window_Loaded(object sender, RoutedEventArgs e) { try { WinSleepCtr.PreventScreenSave(); WinSleepCtr.PreventSleep(true); //*******************端口连接部分 T_ReadConfig.ReadConfig(); //读取配置文件 T_ReadConfig.GetPIN(); //获取PIN码 AUTHORIZATION auth = new AUTHORIZATION(); auth.ClientId = M_Configuration.CLIENTID; //终端号 auth.Token = M_Configuration.TOKEN; //ConfigurationManager.AppSettings["Token"].ToString();//授权码 Client = new T_RpcClient(auth, M_Configuration.HOST, M_Configuration.PORT, M_Configuration.TIMEOUT); //StateClient = new T_RpcClient(auth, M_Configuration.HOST, M_Configuration.PORT, M_Configuration.TIMEOUT); // HeartClient = new T_RpcClient(auth, M_Configuration.HOST, M_Configuration.PORT, M_Configuration.TIMEOUT);//心跳 //票种名称 M_Configuration.RunState = 0;//自助售票运行状态 0表示正常 M_Configuration.TicketID_AName = T_SellTicketRecord.GetTicketTypeName(M_Configuration.TicketTypeID_1); M_Configuration.TicketID_BName = T_SellTicketRecord.GetTicketTypeName(M_Configuration.TicketTypeID_2); #region//暂时不用 ////获取票种信息 //try //{ // M_TicketTypeList.listTicketType = Client.TicketTypeSyncRpc(T_Date.ConvertDataTimeToLong(DateTime.Now)); //} //catch (Exception ex) //{ // _log.Error(typeof(MainWindow), ex); //} ////获取售售期信息 //try //{ // M_PeriodList.listPeriod = Client.SalePeriodSyncRpc(T_Date.ConvertDataTimeToLong(DateTime.Now)); //} //catch (Exception ex) //{ // _log.Error(typeof(MainWindow), ex); //} #endregion ////启动数据同步线程 _DataSyncThread = new Thread(new ThreadStart(_theadDeal.DataSyncThread)); _DataSyncThread.Name = "DataSyncThread"; _DataSyncThread.IsBackground = true; _DataSyncThread.Start(); _DataSyncThread.Priority = ThreadPriority.BelowNormal; Thread.Sleep(10); if (_DataSyncThread.IsAlive) { _log.Info("数据同步工作线程启动成功。"); } ////*******************端口连接部分 //强制回收线程 TGCThread = new T_GCThread(); GCThread = new Thread(new ThreadStart(TGCThread.DoWork)); GCThread.IsBackground = true; GCThread.Start(); if (GCThread.IsAlive) { _log.Error("强制回收线程启动成功!"); } string strSAM = M_Configuration.Samreadername; string strRFID = M_Configuration.RfidReadername; string strPIN = M_Configuration.Pin; try { rfidReaderTest = TicketHandlerAdapter.getRfidTicketHandler(Convert.ToInt32(M_Configuration.CLIENTID), strRFID, strSAM, Encoding.ASCII.GetBytes(strPIN)); } catch { // MessageBox.Show("初始化失败,请确认读卡器选择正确!"); } this.totaltimeout = int.Parse(ConfigHelper.GetConfigValue("window", "totaltimeout"));//操作最长时间 this.InitControlSize(); base.WindowState = WindowState.Maximized; base.WindowStyle = WindowStyle.None; base.ResizeMode = ResizeMode.NoResize; base.Left = 0.0; base.Top = 0.0; this.notice = new NoticePage(ConfigHelper.GetConfigValue("window", "notice"), double.Parse(ConfigHelper.GetConfigValue("window", "noticefontsize"))); this.topFrame.Content = this.notice; //this.videopage = new VideoPage(this); //this.topFrame.Content = this.videopage; this.imagepage = new ImageShowPage(this); this.middleFrame.Content = this.imagepage; pageTest = new FirstPage(this); this.operationpage = pageTest;//new FirstPage(this); this.mainFrame.Content = this.operationpage; //bool flag = SystemInfo.GetAllNetInfo() != null; //if (flag) //{ // this.MacStr = SystemInfo.GetAllNetInfo()[0].PhysAddr; //} this.countdowntimer = new DispatcherTimer(); this.countdowntimer.Interval = new TimeSpan(0, 0, 0, 1, 0); this.countdowntimer.Tick += new EventHandler(this.timer_Tick); this.countdowntimer.Start(); } catch (Exception ex) { _log.Error("服务器连接失败!"); _log.Error(typeof(MainWindow), ex); MessageBox.Show("服务器连接失败!", T_SellTicketRecord.str_Apption, MessageBoxButton.OK, MessageBoxImage.Information); base.Close(); } }
/// <summary> /// 上传身份证购票的信息数据 /// </summary> /// <param name="SaleClient">RPC</param> /// <param name="XiaoNumber">销售单号</param> /// <returns></returns> public static bool SellTicketDataUP_IDCard(T_RpcClient SaleClient, string XiaoNumber, M_SelfHelpClass selfhelpclass) { bool isresult = false; M_TicketType mticketType; //票种实体 string XiaoMX = ""; //明细单号 try { //1.创建实体 SL_ORDER slorder = new SL_ORDER(); //销售主表 SL_ORDER_TICKETTYPE_DETAIL slorderticket = new SL_ORDER_TICKETTYPE_DETAIL(); //销售单票种明细表 List <SL_PAY_TYPE> listsl_pay_type = new List <SL_PAY_TYPE>(); SL_PAY_TYPE slpaytype = new SL_PAY_TYPE(); //支付方式表 List <SL_ORDER_DETAIL> listorderdetial = new List <SL_ORDER_DETAIL>(); //2.根据单号获取要上传的销售主表信息 string strOrder = "select * from SL_ORDER where ORDER_ID='" + XiaoNumber + "'"; SQLiteCommand cmdOrder = new SQLiteCommand(strOrder); DataSet dsOrder = new DataSet(); dsOrder = SQLiteHelper.ExecuteDataSet(SQLiteHelper.LocalDbConnectionString, cmdOrder); if (dsOrder.Tables[0].Rows.Count > 0) { slorder.OrderId = dsOrder.Tables[0].Rows[0]["ORDER_ID"].ToString(); //销售单号 slorder.OrderType = dsOrder.Tables[0].Rows[0]["ORDER_TYPE"].ToString(); //销售类型(XC-现场售票、ZY-自营售票、TD-团队换票、WL-网络人工换票、ST-实体代理、BP-补票、ZG-自助购票、ZQ-自助取票) slorder.TicketCount = Convert.ToInt64(dsOrder.Tables[0].Rows[0]["TICKET_COUNT"]); //销售张数 slorder.DueSum = Convert.ToInt64(dsOrder.Tables[0].Rows[0]["DUE_SUM"]); //应收金额 slorder.RealSum = Convert.ToInt64(dsOrder.Tables[0].Rows[0]["REAL_SUM"]); //实收金额 slorder.Remark = dsOrder.Tables[0].Rows[0]["REMARK"].ToString(); //订单说明 slorder.PayStat = dsOrder.Tables[0].Rows[0]["PAY_STAT"].ToString(); //支付状态 slorder.SaleUserId = dsOrder.Tables[0].Rows[0]["SALE_USER_ID"].ToString(); //出票人 在此指终端号 slorder.SaleTime = T_Date.ConvertDataTimeToLong(Convert.ToDateTime(dsOrder.Tables[0].Rows[0]["SALE_TIME"])); //售票时间 slorder.VersionNo = T_Date.ConvertDataTimeToLong(Convert.ToDateTime(dsOrder.Tables[0].Rows[0]["VERSION_NO"])); //版本号 //2.根据销售单号获取支付信息 string strPay = "select * from SL_PAY_TYPE where ORDER_ID='" + XiaoNumber + "'"; SQLiteCommand cmdPay = new SQLiteCommand(strPay); DataSet dsPay = new DataSet(); dsPay = SQLiteHelper.ExecuteDataSet(SQLiteHelper.LocalDbConnectionString, cmdPay); slpaytype.PayTypeId = dsPay.Tables[0].Rows[0]["PAY_TYPE_ID"].ToString(); //支付单号 slpaytype.OrderId = dsPay.Tables[0].Rows[0]["ORDER_ID"].ToString(); //销售单号 slpaytype.PayType = dsPay.Tables[0].Rows[0]["PAY_TYPE"].ToString(); //支付方式 slpaytype.Amt = Convert.ToInt64(dsPay.Tables[0].Rows[0]["AMT"]); //支付金额 slpaytype.PayId = ""; //第三方支付单号 slpaytype.PaymentCode = selfhelpclass.PayodNo; //付款码 slpaytype.VersionNo = T_Date.ConvertDataTimeToLong(Convert.ToDateTime(dsPay.Tables[0].Rows[0]["VERSION_NO"])); //版本号 listsl_pay_type.Add(slpaytype); slorder.SlPayTypelist = listsl_pay_type; //支付方式 //3.销售单明细表 //string strDetail = "select * from SL_PAY_TYPE where ORDER_ID='" + XiaoNumber + "'"; //SQLiteCommand cmdMX = new SQLiteCommand(strDetail); //DataSet dsMX = new DataSet(); //dsMX = SQLiteHelper.ExecuteDataSet(SQLiteHelper.LocalDbConnectionString, cmdMX); //获到票种实体 mticketType = D_TicketType.GetTicketTypeInfo(selfhelpclass.TicketTypeID); for (int j = 0; j <= selfhelpclass.TicketCount - 1; j++) { XiaoMX = T_SellTicketRecord.CreateTableUID(M_Configuration.CLIENTID, T_SellTicketRecord.LocalTicketMX_Prefix_ZG, j); SL_ORDER_DETAIL slorderdetail = new SL_ORDER_DETAIL(); slorderdetail.OrderDetailId = XiaoMX; //dsMX.Tables[0].Rows[j]["Order_detail_id"].ToString();//销售明细单号 slorderdetail.OrderId = XiaoNumber; //dsMX.Tables[0].Rows[j]["Order_id"].ToString();//销售单号 slorderdetail.TicketClass = "2"; //dsMX.Tables[0].Rows[j]["TICKET_CLASS"].ToString();//门票类型(1-FRID、2-身份证、3-二维码) slorderdetail.IdenttyId = selfhelpclass.GetTicketUserNumber; //dsMX.Tables[0].Rows[j]["IDENTTY_ID"].ToString();//身份证号码 slorderdetail.TicketId = 0; // Convert.ToInt64(dsMX.Tables[0].Rows[j]["Ticket_id"]);//票号 slorderdetail.TicketUid = ""; //票种唯一号 slorderdetail.TicketTypeId = selfhelpclass.TicketTypeID; //dsMX.Tables[0].Rows[j]["Ticket_type_id"].ToString();//票种编号 slorderdetail.ValidateTimes = mticketType.VALIDATE_TIMES; //可用次数 slorderdetail.OriginalPrice = selfhelpclass.OriginalPrice; //原单价 slorderdetail.SalePrice = selfhelpclass.SalePrice; //销售价 slorderdetail.CheckFlag = "N"; // 是否检票(Y是N否) slorderdetail.UselessFlag = "N"; //是否作废(Y是N否) // slorderdetail.OpeUserId = dsMX.Tables[0].Rows[j]["Ope_user_id"].ToString();//操作人 // slorderdetail.OpeTime = T_Date.ConvertDataTimeToLong(Convert.ToDateTime(dsMX.Tables[0].Rows[j]["Ope_time"]));//操作时间 slorderdetail.OutletId = Convert.ToInt64(M_Configuration.CLIENTID.ToString().Substring(1, 3)); //Convert.ToInt64(dsMX.Tables[0].Rows[j]["OUTLET_ID"]);//出票网点编号 slorderdetail.ClientId = M_Configuration.CLIENTID; //Convert.ToInt64(dsMX.Tables[0].Rows[j]["CLIENT_ID"]);//出票终端编号 //slorderdetail.EjectUserId = dsMX.Tables[0].Rows[j]["EJECT_USER_ID"].ToString();//出票人 slorderdetail.EjectTicketStat = "1"; //dsMX.Tables[0].Rows[j]["EJECT_TICKET_STAT"].ToString();//出票状态(1-待出票 2-已出票) //slorderdetail.EjectTicketTime = T_Date.ConvertDataTimeToLong(Convert.ToDateTime(dsMX.Tables[0].Rows[j]["EJECT_TICKET_TIME"]));//出票时间 slorderdetail.VersionNo = T_Date.ConvertDataTimeToLong(Convert.ToDateTime(dsOrder.Tables[0].Rows[0]["VERSION_NO"])); //版本号;//版本号 listorderdetial.Add(slorderdetail); } slorder.SlOrderDetaillist = listorderdetial;//销售明细表 } if (slorder != null) { isresult = SaleClient.saleTicketByIdenttyZG_RPC(slorder);//身份证购票信息上传 } } catch (Exception ex) { _log.Error(typeof(B_SellTicketUpData), ex); throw new Exception(ex.Message.ToString()); } return(isresult); }
private void button1_Click(object sender, RoutedEventArgs e) { Button button = sender as Button; //this.parent.SelfHelpInfo.SaleTime = DateTime.Now.ToString("MM月dd日"); //this.parent.SelfHelpInfo.TicketType = button.Tag.ToString(); string configValue = ConfigHelper.GetConfigValue("ticket", "t" + button.Tag.ToString(), "price"); this.parent.mSelfHelpClass.SaleTime = DateTime.Now.ToString("MM月dd日"); if ((Convert.ToInt32(button.Tag) - 2) == 0) { this.parent.mSelfHelpClass.BoxNumber = "A"; //票箱 this.parent.mSelfHelpClass.TicketTypeID = M_Configuration.TicketTypeID_1; //默认A票箱的票种就是TicketTypeID_1 } else if ((Convert.ToInt32(button.Tag) - 2) == 1) { this.parent.mSelfHelpClass.BoxNumber = "B"; this.parent.mSelfHelpClass.TicketTypeID = M_Configuration.TicketTypeID_2;//默认B票箱的票种就是TicketTypeID_2 } //********************验证下票数是否已报警************* if (T_SellTicketRecord.Judge_TicketAlarmCount(this.parent.mSelfHelpClass.TicketTypeID, 0)) { MessageBox.Show("余票不足!", T_SellTicketRecord.str_Apption, MessageBoxButton.OK, MessageBoxImage.Information); return; } //********************验证下票数是否已报警************* //***预售期价格 Int64 ticketprice = -1; //预售期票价 ticketprice = T_SellTicketRecord.Get_sl_period_Price(this.parent.mSelfHelpClass.TicketTypeID); //获取预售期票价 this.parent.mSelfHelpClass.OriginalPrice = T_SellTicketRecord.GetTicketInfo(this.parent.mSelfHelpClass.TicketTypeID).Price; //T_GetCurTicketInfo.GetCurTicketTypeIDInfo(M_Configuration.TicketTypeID_1, M_TicketTypeList.listTicketType).Price;//原票价 自助售票类 //this.parent.mSelfHelpClass.TicketTypeID = M_Configuration.TicketTypeID_1;//票种 自助售票类 if (ticketprice != -1) { this.parent.mSelfHelpClass.SalePrice = ticketprice;//预售期票价 自助售票类 } else { this.parent.mSelfHelpClass.SalePrice = this.parent.mSelfHelpClass.OriginalPrice;//原票价 } //if (this.parent.mSelfHelpClass.BoxNumber == "A")//箱号1中的票种 //{ // ticketprice = T_SellTicketRecord.Get_sl_period_Price(M_Configuration.TicketTypeID_1);//获取预售期票价 // this.parent.mSelfHelpClass.OriginalPrice = T_SellTicketRecord.GetTicketInfo(M_Configuration.TicketTypeID_1).Price; //T_GetCurTicketInfo.GetCurTicketTypeIDInfo(M_Configuration.TicketTypeID_1, M_TicketTypeList.listTicketType).Price;//原票价 自助售票类 // this.parent.mSelfHelpClass.TicketTypeID = M_Configuration.TicketTypeID_1;//票种 自助售票类 // if (ticketprice != -1) // { // this.parent.mSelfHelpClass.SalePrice = ticketprice;//预售期票价 自助售票类 // } // else // { // this.parent.mSelfHelpClass.SalePrice = this.parent.mSelfHelpClass.OriginalPrice;//原票价 // } //} //else if (this.parent.mSelfHelpClass.BoxNumber == "B")//箱号2中的票种 //{ // ticketprice = T_SellTicketRecord.Get_sl_period_Price(M_Configuration.TicketTypeID_2); // this.parent.mSelfHelpClass.TicketTypeID = M_Configuration.TicketTypeID_2;//票种 自助售票类 // this.parent.mSelfHelpClass.OriginalPrice = T_SellTicketRecord.GetTicketInfo(M_Configuration.TicketTypeID_2).Price; //T_GetCurTicketInfo.GetCurTicketTypeIDInfo(M_Configuration.TicketTypeID_2, M_TicketTypeList.listTicketType).Price;//原票价 自助售票类 // if (ticketprice != -1) // { // this.parent.mSelfHelpClass.SalePrice = ticketprice;//预售期票价 自助售票类 // } // else // { // this.parent.mSelfHelpClass.SalePrice = this.parent.mSelfHelpClass.OriginalPrice;//原票价 // } //} //*********************获取下票价---还有预售期价格************** //this.parent.SelfHelpInfo.TicketPrice = decimal.Parse(configValue); this.parent.Operation("gp3"); }
public QPPage3(MainWindow parentWindow) { this.parent = parentWindow; this.InitializeComponent(); TicketInfo.Clear(); //TicketInfo.Add(new TicketInfo //{ // tickettype = "八里沟", // ticketcount = "1", // ticketdate = "2017年5月4日" //}); //TicketInfo.Add(new TicketInfo //{ // tickettype = "九莲山", // ticketcount = "1", // ticketdate = "2017年5月5日" //}); //TicketInfo.Add(new TicketInfo //{ // tickettype = "天界山", // ticketcount = "1", // ticketdate = "2017年5月5日" //}); this.dataGrid1.ItemsSource = TicketInfo.GetInfo(); //发送身份证取票 List <SL_ORDER_DETAIL> listOrderDetail = new List <SL_ORDER_DETAIL>(); listOrderDetail = B_SellTicketUpData.GetTicketInfo_IDCard(this.parent.Client, this.parent.mSelfHelpClass.GetTicketUserNumber); if (listOrderDetail.Count > 0) { //余票验证 #region //1.先获取要取的票中各个票种的数量 Int32 ACount = 0; //A票种数量 Int32 BCount = 0; //B票种数量 for (int i = 0; i < listOrderDetail.Count; i++) { if (listOrderDetail[i].TicketTypeId == M_Configuration.TicketTypeID_1)//A票箱票种 { ACount++; } else if (listOrderDetail[i].TicketTypeId == M_Configuration.TicketTypeID_2)//B票箱票种 { BCount++; } } //2.先看下两个票箱票种是一样的情况 if (M_Configuration.TicketTypeID_1 == M_Configuration.TicketTypeID_2) //票箱放的是一种票的情况 { if ((ACount > 0) && (BCount > 0)) //实际是取两种票的情况 { MessageBox.Show("本取票网点没有您所购的全体票种!", T_SellTicketRecord.str_Apption, MessageBoxButton.OK, MessageBoxImage.Information); return; } else { //自助售票机两个票箱是一种票时 有一个票箱的票数能满足就行或A B两票箱数量加起来够也行 Int32 TicketCount = T_SellTicketRecord.GetCount_SL_TicketCount();//获取票箱内全体票数 if (listOrderDetail.Count > TicketCount) { MessageBox.Show("所购票数已超过当前票箱允许的售票数!", T_SellTicketRecord.str_Apption, MessageBoxButton.OK, MessageBoxImage.Information); return; } } } else//票箱是两种票的情况 这种情况下必须是两种票都满足才能出票 否则不出票 { for (int i = 0; i < listOrderDetail.Count; i++) { if (T_SellTicketRecord.Judge_TicketAlarmCount(listOrderDetail[i].TicketTypeId, ACount)) { MessageBox.Show("所购票数已超过当前票箱余票数!", T_SellTicketRecord.str_Apption, MessageBoxButton.OK, MessageBoxImage.Information); return; } } } #endregion string str1 = ""; //临时存票种1 string str2 = ""; //临时存票种2 string strcount = ""; //计算票数用的 Int32 ticket1count = 0; //****************先根据票种获取箱号 如果是两个票箱号是同一种票种的 哪个余票多就用哪个的票箱号**************** #region//待删除 //if (M_Configuration.TicketTypeID_1 == M_Configuration.TicketTypeID_2) //{ } //else //{ // // //} #endregion //****************先根据票种获取箱号 如果是两个票箱号是同一种票种的 哪个余票多就用哪个的票箱号**************** for (int i = 0; i < listOrderDetail.Count; i++) { TicketInfo.Add(new TicketInfo { tickettype = T_SellTicketRecord.GetTicketInfo(listOrderDetail[i].TicketTypeId).TicketTypeName,//票种 ticketcount = "1", ticketdate = DateTime.Now.ToString("门票日期:MM月dd日") }); if (str1 == "") { str1 = listOrderDetail[i].TicketTypeId; } else if (str1 != listOrderDetail[i].TicketTypeId) { str2 = listOrderDetail[i].TicketTypeId; } if (strcount == "") { strcount = listOrderDetail[i].TicketTypeId; ticket1count = 1; } else if (strcount == listOrderDetail[i].TicketTypeId) { ticket1count = ticket1count + 1;//其中一个票种的票数 } } this.parent.mSelfHelpClass.listtypeid.Add(str1); //票种1 this.parent.mSelfHelpClass.listtypeid.Add(str2); //票种2 this.parent.mSelfHelpClass.listticketcount.Add(ticket1count); //其中一个票种的票数 其实是第一个票种的票数 this.parent.mSelfHelpClass.listticketcount.Add(listOrderDetail.Count - ticket1count); //其中一个票种的票数 第二个票种的票数 //****************赋值 if (this.parent.mSelfHelpClass.OperType != "0") //购票也用此 先区分下 取票还是购票 0表示购票 1表示取票 自助售票类 { this.parent.mSelfHelpClass.OperType = "1"; //取票还是购票 0表示购票 1表示取票 自助售票类 } this.parent.mSelfHelpClass.listorderdetail.Clear(); this.parent.mSelfHelpClass.listorderdetail = listOrderDetail; //服务器回传销售明细信息 this.parent.mSelfHelpClass.TicketTypeID = listOrderDetail[0].TicketTypeId; //票种 this.parent.mSelfHelpClass.TicketCount = listOrderDetail.Count; //票数 this.parent.mSelfHelpClass.SaleTime = DateTime.Now.ToString("MM月dd日"); //销售时间 this.parent.mSelfHelpClass.OrderID = listOrderDetail[0].OrderId; //销售单号 } }
//internal StackPanel dockfull; //internal StackPanel TicketImg; //internal TextBlock tb_selectdate; //internal TextBlock tb_selecttype; //internal Button btn_J; //internal TextBlock tb_Count; //internal Button btn_Z; //internal TextBlock tb_ShowTotal; //internal Button btn_GQ; //internal Button btn_SY; //internal Button btn_FH; public GPPage3(MainWindow parentWindow) { this.parent = parentWindow; this.InitializeComponent(); //this.tb_selectdate.Text = this.parent.SelfHelpInfo.SaleTime; // this.tb_selectdate.Text = this.parent.mSelfHelpClass.SaleTime;//自助售票类 销售时间 即当时间 ImageBrush imageBrush = new ImageBrush(); //imageBrush.ImageSource = new BitmapImage(new Uri(AppDomain.CurrentDomain.BaseDirectory + "\\pic\\bn" + this.parent.SelfHelpInfo.TicketType + ".png")); imageBrush.Stretch = Stretch.Fill; this.TicketImg.Background = imageBrush; //this.tb_selectdate.Text = this.parent.SelfHelpInfo.SaleTime; // this.tb_selectdate.Text = this.parent.mSelfHelpClass.SaleTime;//自助售票类 //this.tb_selecttype.Text = ConfigHelper.GetConfigValue("ticket", "t" + this.parent.SelfHelpInfo.TicketType); //*****获取票种名称 this.tb_selecttype.Text = T_SellTicketRecord.GetTicketTypeName(this.parent.mSelfHelpClass.TicketTypeID); if ((this.tb_selecttype.Text.Length > 3) && (this.tb_selecttype.Text.Length < 6)) { this.tb_selecttype.FontSize = 50; } else if (this.tb_selecttype.Text.Length > 6) { this.tb_selecttype.FontSize = 40; } else if (this.tb_selecttype.Text.Length < 3) { this.tb_selecttype.FontSize = 60; } //this.tb_ShowTotal.Text = this.parent.SelfHelpInfo.TicketPriceTotal.ToString(); this.tb_ShowTotal.Text = this.parent.mSelfHelpClass.RealSum.ToString();//自助售票类 //*************显示票种图片 string str = ""; if (this.parent.mSelfHelpClass.TicketTypeID == M_Configuration.TicketTypeID_1) { str = AppDomain.CurrentDomain.BaseDirectory + "\\Ticket\\" + M_Configuration.TicketTypeID_1 + ".png"; if (System.IO.File.Exists(str)) { // BitmapImage imagetemp = new BitmapImage(new Uri(str, UriKind.Absolute)); this.img_show.Source = null; this.img_show.Source = this.parent.GetImage(str); //imagetemp; } else { str = AppDomain.CurrentDomain.BaseDirectory + "\\Ticket\\default.png"; // BitmapImage imagetemp = new BitmapImage(new Uri(str, UriKind.Absolute)); this.img_show.Source = null; this.img_show.Source = this.parent.GetImage(str); //imagetemp; } this.txt_show.Text = M_Configuration.boxA_info; //票箱说明 } else if (this.parent.mSelfHelpClass.TicketTypeID == M_Configuration.TicketTypeID_2) { str = AppDomain.CurrentDomain.BaseDirectory + "\\Ticket\\" + M_Configuration.TicketTypeID_2 + ".png"; if (System.IO.File.Exists(str)) { // BitmapImage imagetemp = new BitmapImage(new Uri(str, UriKind.Absolute)); this.img_show.Source = null; this.img_show.Source = this.parent.GetImage(str); // imagetemp; } else { str = AppDomain.CurrentDomain.BaseDirectory + "\\Ticket\\default.png"; //BitmapImage imagetemp = new BitmapImage(new Uri(str, UriKind.Absolute)); this.img_show.Source = null; this.img_show.Source = this.parent.GetImage(str); //imagetemp; } this.txt_show.Text = M_Configuration.boxB_info; //票箱说明 } }
private void Page_Loaded(object sender, RoutedEventArgs e) { //this.parent.SelfHelpInfo.PayType = "weixin"; //this.parent.SelfHelpInfo.PayodNo = string.Empty; //this.parent.SelfHelpInfo.PayRefNo = string.Empty; //this.parent.SelfHelpInfo.PayTxnId = string.Empty; //this.parent.SelfHelpInfo.PaySuccess = false; //this.parent.SelfHelpInfo.PayReturnInfo = string.Empty; //this.ticketDate.Text = this.parent.SelfHelpInfo.SaleTime; //this.ticketCount.Text = this.parent.SelfHelpInfo.TicketCount.ToString(); //this.ticketType.Text = ConfigHelper.GetConfigValue("ticket", "t" + this.parent.SelfHelpInfo.TicketType); //this.ticketPriceTotal.Text = this.parent.SelfHelpInfo.TicketPriceTotal.ToString(); //this.ticketTotal.Text = this.parent.SelfHelpInfo.TicketPriceTotal.ToString();//wjl //**********************支付部分********************* this.parent.mSelfHelpClass.OperType = "0"; //取票还是购票 0表示购票 1表示取票 自助售票类 this.parent.mSelfHelpClass.PayType = "03"; //支付方式 自助售票类 01-现金,02-POS付款,03-微信,04-支付宝,05-代理 this.parent.mSelfHelpClass.PayStat = "1"; //支付状态(1-待支付 2-已支付 3-支付失败) this.parent.mSelfHelpClass.PayTypeID = ""; //支付单号暂不生成 T_SellTicketRecord.CreateTableUID(M_Configuration.CLIENTID, T_SellTicketRecord.LocalPayType_Prefix, 1);//支付单号 自助售票类 this.parent.mSelfHelpClass.PayID = string.Empty; //第三方支付单号 自助售票类 this.parent.mSelfHelpClass.PaySuccess = false; //是否支付成功 自助售票类 // this.ticketDate.Text = this.parent.mSelfHelpClass.SaleTime;//销售时间 自助售票类 this.ticketCount.Text = this.parent.mSelfHelpClass.TicketCount.ToString(); //票数 自助售票类 this.ticketType.Text = T_SellTicketRecord.GetTicketTypeName(this.parent.mSelfHelpClass.TicketTypeID); //票种 自助售票类 this.ticketPriceTotal.Text = this.parent.mSelfHelpClass.RealSum.ToString(); //销售金额 自助售票类 // this.ticketTotal.Text = this.parent.mSelfHelpClass.RealSum.ToString();//销售金额 自助售票类 //********************支付部分*********************** T_SellTicketRecord.slpaytype.OrderId = this.parent.mSelfHelpClass.OrderID; //销售单号 T_SellTicketRecord.slpaytype.PayTypeId = this.parent.mSelfHelpClass.PayTypeID; //支付单号 T_SellTicketRecord.slpaytype.PayType = this.parent.mSelfHelpClass.PayType; //支付方式 T_SellTicketRecord.slpaytype.Amt = this.parent.mSelfHelpClass.RealSum; //支付金额 T_SellTicketRecord.slpaytype.VersionNo = T_Date.ConvertDataTimeToLong(DateTime.Now); //版本号 //***************获取支付方式***************** //*******************写入数据*************************** this.parent.mSelfHelpClass.PayTypeID = T_SellTicketRecord.CreateTableUID(M_Configuration.CLIENTID, T_SellTicketRecord.LocalPayType_Prefix, 1); //支付单号 自助售票类 this.parent.mSelfHelpClass.OrderID = T_SellTicketRecord.CreateTableUID(M_Configuration.CLIENTID, T_SellTicketRecord.LocalTicket_Prefix_ZG, 1); //销售单号 this.parent.mSelfHelpClass.PayStat = "2"; //支付状态(1-待支付 2-已支付 3-支付失败) if (!T_SellTicketRecord.Insert_GP_Data(this.parent.mSelfHelpClass)) { _log.Error("微信支付数据写入失败!"); return; } //*******************写入数据*************************** //this.ss.SelectVoiceByHints(VoiceGender.Female); //this.ss.SpeakAsync("使用微信扫一扫,扫描右侧二维码"); // this.parent.SelfHelpInfo.PaySuccess = false; this.counttimer = new DispatcherTimer(); this.counttimer.Interval = new TimeSpan(0, 0, 0, 1, 0); this.counttimer.Tick += new EventHandler(this.timer_Tick); this.counttimer.Start(); this.inputBox.Focus(); this.timer_test = new DispatcherTimer(); this.timer_test.Interval = new TimeSpan(0, 0, 0, 1, 0); this.timer_test.Tick += new EventHandler(this.test); this.timer_test.Start(); this.isre = false; this.istest = false; //string str = AppDomain.CurrentDomain.BaseDirectory + "flash" + "\\f3.swf"; //this.web.Navigate(str); }
//****写票函数 private bool WriteTicket() { bool isok = false; try { //具体写票操作 bool hasTicket = rfidReader.WaitForTicketPresent(1000); #region try { if (hasTicket) { //读取发行信息 TicketPublishInfo tpInfo = rfidReader.readTicketPublishInfo(); _log.Debug("已读取到门票,票号:" + tpInfo.ID.ToString()); CurTicketID = tpInfo.ID.ToString(); //票号 上传时用到 //读取销售信息 TicketSaleInfo?tsInfo = rfidReader.readTicketSaleInfo(); if (!tsInfo.HasValue) //未做过销售的 { #region //验证出票与购票的票种是否相同 if ((tpInfo.TicketClass.ToString() == M_Configuration.TicketTypeID_1) || (tpInfo.TicketClass.ToString() == M_Configuration.TicketTypeID_2)) { //获到票种实体 mticketType = D_TicketType.GetTicketTypeInfo(tpInfo.TicketClass.ToString()); #region //首先判断票种是否存在 if (mticketType.TICKET_TYPE_ID != null) //当前票票种存在的 { #region //两个票箱票种互换的情况 if ((this.parent.mSelfHelpClass.BoxNumber == "A" && tpInfo.TicketClass.ToString() != M_Configuration.TicketTypeID_1) || (this.parent.mSelfHelpClass.BoxNumber == "B" && tpInfo.TicketClass.ToString() != M_Configuration.TicketTypeID_2)) { // 票箱设置的票种与实际所放票种不一致 //TPU_OUT(1);//回收票据 _log.Error("票箱设置票种与实际出票票种不符!"); this.parent.ticketbox_isErr = 1;//票种放反 rfidReader.LongBeep(); isok = false; return(isok); } #endregion Yu_Price = T_SellTicketRecord.Get_sl_period_Price(tpInfo.TicketClass.ToString()); //获取预售期票价 #region //是否团体票 if (mticketType.TEAM_FLAG == "Y") //团体票 { BeginDate = DateTime.Now; EndDate = DateTime.Now.AddMinutes(M_Configuration.Teamtickettime);//从参数表中取出结束时间//Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd 16:00:00")); _log.Error("此门票为团体票,不能在此销售!"); rfidReader.LongBeep(); return(false); } else { if (mticketType.DAY_VALIDATE_FLAG == "Y")//当日有效 { BeginDate = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd 00:00:00")); EndDate = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd 23:59:59")); } else //非当日有效 { BeginDate = DateTime.Now; EndDate = DateTime.Now.AddYears(2); } } #endregion //真正写票 并保存到数据库中 #region if (rfidReader.writeTicketSaleInfo(BeginDate, EndDate, 1)) { _log.Debug("写票成功!"); if (this.parent.mSelfHelpClass.OperType == "0")//购票时生成销售明细单号 { XiaoMX = T_SellTicketRecord.CreateTableUID(M_Configuration.CLIENTID, T_SellTicketRecord.LocalTicketMX_Prefix_ZG, this.cardCount); } //保存数据 #region if (T_SellTicketRecord.Insert_SL_ORDER_DETAIL(mticketType, tpInfo.ID.ToString(), Convert.ToInt32(this.parent.mSelfHelpClass.OperType), this.parent.mSelfHelpClass, XiaoMX, this.cardCount)) { _log.Debug("本地缓存写入成功!"); isok = true; } else { _log.Warn("本地缓存写入失败!"); } #endregion } else { _log.Warn("写入票据信息失败!"); } #endregion } else//该票的票种不存在 { _log.Error("系统中不存在当前票种!票种:" + tpInfo.TicketClass.ToString()); rfidReader.LongBeep(); } #endregion } else//购票与出票 票种不符 { _log.Error("当前门票同所购门票的票种不符!票种:" + tpInfo.TicketClass.ToString()); rfidReader.LongBeep(); } #endregion } else//已做过销售的 { _log.Error("当前门票已做过销售处理!票号:" + CurTicketID.ToString()); rfidReader.LongBeep(); } } else { return(false); } } catch (Exception ex) { _log.Error("门票读取错误!", ex); rfidReader.LongBeep(); } #endregion } catch (Exception ex) { _log.Error("读卡器异常!", ex); rfidReader.LongBeep(); } finally { //rfidReader.WaitForTicketRemoval(0); } return(isok); }
//***************读卡函数************ // public void DoWork() // { // B_CallBackEventArg arg = new B_CallBackEventArg(); // arg.message = ""; // while (!_shoudStop) // { // #region // try // { // rfidReader.WaitForTicketPresent(-1); // //读取发行信息 // TicketPublishInfo tpInfo = rfidReader.readTicketPublishInfo(); // arg.TicketNumber = tpInfo.ID.ToString();//票号 // //读取销售信息 // TicketSaleInfo? tsInfo = rfidReader.readTicketSaleInfo(); // if (!tsInfo.HasValue)//未做过销售的 // { // #region //验证出票与购票的票种是否相同 // if (tpInfo.TicketClass.ToString() == this.parent.mSelfHelpClass.TicketTypeID) // { // //获到票种实体 // mticketType = D_TicketType.GetTicketTypeInfo(tpInfo.TicketClass.ToString()); // #region//首先判断票种是否存在 // if (mticketType.TICKET_TYPE_ID != null)//当前票票种存在的 // { // Yu_Price = T_SellTicketRecord.Get_sl_period_Price(tpInfo.TicketClass.ToString());//获取预售期票价 // #region//是否团体票 // if (mticketType.TEAM_FLAG == "Y")//团体票 // { // BeginDate = DateTime.Now; // EndDate = DateTime.Now.AddMinutes(M_Configuration.Teamtickettime);//从参数表中取出结束时间//Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd 16:00:00")); // arg.message = "此门票为团体票,不能在此销售!"; // // reportChange(-1, arg, null); // wkThread_progressReport(-1, arg, null); // rfidReader.LongBeep(); // } // else // { // if (mticketType.DAY_VALIDATE_FLAG == "Y")//当日有效 // { // BeginDate = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd 00:00:00")); // EndDate = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd 23:59:59")); // } // else //非当日有效 // { // BeginDate = DateTime.Now; // EndDate = DateTime.Now.AddYears(2); // } // } // #endregion // #region// 循环写票 // if (this.cardCount > 0)//未出完票的 // { // //************************写入售票内容***************** // #region//写票 // if (rfidReader.writeTicketSaleInfo(BeginDate, EndDate, 1)) // { // if (this.parent.mSelfHelpClass.OperType == "0")//购票时生成销售明细单号 // { // XiaoMX = T_SellTicketRecord.CreateTableUID(M_Configuration.CLIENTID, T_SellTicketRecord.LocalTicketMX_Prefix_ZG, this.cardCount); // } // //保存数据 // #region//保存 // if (T_SellTicketRecord.Insert_SL_ORDER_DETAIL(mticketType, tpInfo.ID.ToString(), Convert.ToInt32(this.parent.mSelfHelpClass.OperType), this.parent.mSelfHelpClass, XiaoMX,this.cardCount)) // { // rfidReader.Beep(); // try // { // if (this.api.OutputCard())//出票 // { // this.cardCount--;//读取成功且出票成功再计数 // } // else//出票不成功 // { // isError = true; // arg.message = "未成功出票!"; // wkThread_progressReport(-1, arg, null); // } // } // catch (Exception ex) // { // _log.Error(typeof(GPPage6), ex); // } // } // else // { // arg.message = "保存票据信息失败!"; // wkThread_progressReport(-1, arg, null); // } //#endregion // } // else//写票失败 // { // arg.message = "写入票据信息失败!"; // wkThread_progressReport(-1, arg, null); // } //#endregion // } // else // { // rfidReader.Beep(); // arg.message = "已完成售票,请取票!"; // wkThread_progressReport(-1, arg, null); // } // #endregion // } // else//该票的票种不存在 // { // arg.message = "系统中不存在当前票种!"; // // reportChange(-1, arg, null); // wkThread_progressReport(-1, arg, null); // rfidReader.LongBeep(); // } // #endregion // } // else//购票与出票 票种不符 // { // arg.message = "当前门票同所购门票的票种不符!"; // // reportChange(-1, arg, null); // wkThread_progressReport(-1, arg, null); // rfidReader.LongBeep(); // } // #endregion // } // else//已做过销售的 // { // arg.message = "当前门票已做过销售处理!"; // // reportChange(-1, arg, null); // wkThread_progressReport(-1, arg, null); // rfidReader.LongBeep(); // } // } // catch (Exception ex) // { // if (_shoudStop) // return; // arg.message = ex.Message; // // reportChange(-1, arg, ex); // wkThread_progressReport(-1, arg, ex); // _log.Error(typeof(GPPage6), ex); // } // finally // { // rfidReader.WaitForTicketRemoval(-1); // } // #endregion // } // } //void wkThread_progressReport(int pProgressPercentage, object UserState, Exception ex) //{ // arg = (B_CallBackEventArg)UserState; // //this.Invoke(new ShowinfoDelegate(ShowInfo)); // if (pProgressPercentage >= 0) // { // // str_ChangTicket = arg.TicketNumber; // } // else // { // // MessageBox.Show("提示信息:"+arg.message, T_SellTicketRecord.str_Apption,MessageBoxButton.OK,MessageBoxImage.Information); // } //} //***************读卡函数************ //*********************刮票、写票、出票操作函数**************** private void OutPutTicket() { //刮票 写票 出票部分 #region bool isok = false; bool isup = false;//上传 try { while (this.cardCount > 0) //未出完票的 { if (this.parent.mSelfHelpClass.OperType == "1") //取票还是购票 0表示购票 1表示取票 自助售票类 { displayErrorMessage("暂不支持自助取票!", "error"); break; //取票 #region //*****************实际取票时 需要判定的情况比较多 //if (M_Configuration.TicketTypeID_1 != M_Configuration.TicketTypeID_2)//不同票种 //{ //不同票种出票 //#region // if (M_Configuration.TicketTypeID_1 == this.parent.mSelfHelpClass.listorderdetail[this.cardCount - 1].TicketTypeId) // { // curBoxNumber = 0;//A票箱号 // this.parent.mSelfHelpClass.BoxNumber = "A"; // _log.Info("出A票箱!"); // } // else if (M_Configuration.TicketTypeID_2 == this.parent.mSelfHelpClass.listorderdetail[this.cardCount - 1].TicketTypeId) // { // curBoxNumber = 1;//B票箱号 // this.parent.mSelfHelpClass.BoxNumber = "B"; // _log.Info("出B票箱!"); // } // else // { // _log.Error("票箱内不含当前票种!"); // } // #endregion //} //else if (M_Configuration.TicketTypeID_1 == M_Configuration.TicketTypeID_2)//同一票种的 //{ // if (T_SellTicketRecord.Judge_TicketAlarmCount("A", 1))//A箱不够出B票箱 // { // curBoxNumber = 1;//B票箱号 // this.parent.mSelfHelpClass.BoxNumber = "B"; // _log.Info("出B票箱!"); // } // else if (T_SellTicketRecord.Judge_TicketAlarmCount("B", 1))//B箱不够出A票箱 // { // curBoxNumber = 0;//A票箱号 // this.parent.mSelfHelpClass.BoxNumber = "A"; // _log.Info("出A票箱!"); // } //} #endregion } else if (this.parent.mSelfHelpClass.OperType == "0")//取票还是购票 0表示购票 1表示取票 自助售票类 { DataTable dt = T_SellTicketRecord.Get_BoxTicketInfo(); for (int i = 0; i < dt.Rows.Count; i++) { if (dt.Rows[i]["ticket_type_id"].ToString() == this.parent.mSelfHelpClass.TicketTypeID && (int)dt.Rows[i]["surplusCount"] >= this.cardCount + (int)dt.Rows[i]["alarmCount"]) { if (dt.Rows[i]["boxNumber"].ToString() == "A") { this.parent.mSelfHelpClass.BoxNumber = "A"; curBoxNumber = 0;//A票箱号 break; } else { this.parent.mSelfHelpClass.BoxNumber = "B"; curBoxNumber = 1;//B票箱号 break; } } } } Thread.Sleep(100); //1.刮票 //num = TPU_SEND_TK(Convert.ToByte(curBoxNumber));//0表示A票箱 1表示B票箱 num = CZLHTpuHandler.SendTicket((byte)curBoxNumber); // num =0;//测试代码 _log.Info("刮票结果:" + num.ToString()); Thread.Sleep(200); if (num == 0) { _log.Info("刮票成功!"); isok = T_SellTicketRecord.Update_SL_TicketCount(this.parent.mSelfHelpClass.BoxNumber); if (isok) { _log.Info("更新票箱余票成功!"); } else { _log.Error("更新票箱余票失败!"); } //2.写票 #region if (WriteTicket() == true) //if(1==1)//测试代码 { Thread.Sleep(100); _log.Info("写票成功!"); //********************写票成功后是各种更新及上传******** #region//各种更新上传 //******************出一张票就上传一次 for (int i = 0; i < 3; i++) { try { isup = B_SellTicketUpData.SellTicketDataUP_MX(this.parent.Client, this.parent.mSelfHelpClass.OrderID, this.parent.mSelfHelpClass, CurTicketID); // CurTicketID if (isup == true) //上传成功 { break; } else { _log.Warn("上传出票数据失败,开始重试。上传计数:" + (i + 1).ToString()); } } catch (Exception ex) { _log.Error("上传出票数据失败,开始重试。上传计数:" + (i + 1).ToString(), ex); } } if (isup) { _log.Info("出票上传成功!"); //******开始出票** //num = TPU_OUT(0);//出票 TPU_OUT返回1为出票成功 num = CZLHTpuHandler.OutTicket(0); // num = 1;//测试代码 if (num != 0) { //num = TPU_OUT(0);//再出一次 num = CZLHTpuHandler.OutTicket(0); } if (num == 0)//出票成功 { _log.Info("出票成功!"); this.cardCount--; } else//出票失败 { #region//出票失败的 _log.Error("出票操作失败!"); M_Configuration.RunState = Convert.ToInt32(DeviceStatus.OutCardFault); //出票机故障 this.cardCount = -99999; //返回首页 displayErrorMessage("出票卡票!请联系工作人员取走卡票,并到人工售票窗口补取余票。", "error"); #endregion } //*******开始出票** } else { //*******************************数据上传失败就回收票********* try { rfidReader.clearTicketSaleInfo(); } catch { } //num = TPU_OUT(1);//出不了就回收 废票回收无法判断是否执行成功 num = CZLHTpuHandler.OutTicket(1); if (num == 0)//回收成功 { _log.Info("出票上传失败,门票回收成功!"); } else { _log.Error("出票上传失败,门票回收失败!状态码:" + num.ToString()); } //*****更新废票箱 isok = T_SellTicketRecord.Update_SL_AbolishCount(false);//更新废票箱票数; if (isok) { _log.Info("更新废票箱成功!"); } else { _log.Error("更新废票箱失败!"); } //*******************************数据上传失败就回收票********* this.cardCount = -99999; this.parent.ticketbox_isErr = 100; } #endregion } else { #region 写票失败的 try { rfidReader.clearTicketSaleInfo(); } catch { } num = CZLHTpuHandler.OutTicket(1); if (num == 0)//回收成功 { _log.Info("写票操作失败,门票回收成功!"); } else { _log.Error("写票操作失败,门票回收失败!状态码:" + num.ToString()); } // 废票回收无法获取到是否回收成功状态 //*****更新废票箱 isok = T_SellTicketRecord.Update_SL_AbolishCount(false);//更新废票箱票数; if (isok) { _log.Info("更新废票箱成功!"); } else { _log.Error("更新废票箱失败!"); } if (this.parent.ticketbox_isErr == 1)//票种放反 { this.cardCount = 0; } #endregion } #endregion } else { //_log.Error("刮票操作失败!"); //TPU_RST(0); num = CZLHTpuHandler.Reset(); if (num == 0)//回收成功 { _log.Error("刮票操作失败,控制板重置成功!"); } else { _log.Error("刮票操作失败,控制板重置失败!状态码:" + num.ToString()); } M_Configuration.RunState = Convert.ToInt32(DeviceStatus.OutCardFault); //出票机故障 this.cardCount = -99999; //返回首页 displayErrorMessage("出票失败!请到人工售票窗口取票。", "error"); } } #endregion if (this.cardCount == 0) { displayErrorMessage("出票完成,请取走门票。", "INFO", true); } } catch (Exception ex) { _log.Error("出票失败,未知异常。", ex); displayErrorMessage("出票失败!请到人工售票窗口取票。", "error"); } finally { CZLHTpuHandler.Close(); } }
private void timer_Tick(object sender, EventArgs e) { //this.counttimer.Stop(); //bool flag = !this.locktag; //if (flag) //{ // this.locktag = true; // while (this.cardCount > 0) // { // string empty = "票号?";// string.Empty; // bool flag2 = false;//!this.api.ReadCard(out empty);//wjl // if (flag2) // { // this.isError = true; // break; // } // bool flag3 = !this.api.OutputCard();//wjl // if (flag3) // { // this.isError = true; // break; // } // this.cardCount--; // this.parent.SelfHelpInfo.TicketNumberList.Add(empty); // System.Threading.Thread.Sleep(1000); // } //} //bool flag4 = false;// this.cardCount == 0;//this.cardCount > 0 && this.isError; if (isError) { StringBuilder stringBuilder = new StringBuilder(); //stringBuilder.AppendLine("景区票种:" + ConfigHelper.GetConfigValue("ticket", "t" + this.parent.SelfHelpInfo.TicketType)); //stringBuilder.AppendLine("购买数量:" + this.parent.SelfHelpInfo.TicketCount); //stringBuilder.AppendLine("已付金额:" + this.parent.SelfHelpInfo.TicketPriceTotal); //stringBuilder.AppendLine("已出票数:" + (this.parent.SelfHelpInfo.TicketCount - this.cardCount).ToString()); //stringBuilder.AppendLine("购买日期:" + DateTime.Now.ToString("yyyy年MM月dd日 HH:mm:ss")); //stringBuilder.AppendLine(""); //stringBuilder.AppendLine("请联系工作人员取票!"); stringBuilder.AppendLine("景区票种:" + T_SellTicketRecord.GetTicketTypeName(this.parent.mSelfHelpClass.TicketTypeID)); stringBuilder.AppendLine("购买数量:" + this.parent.mSelfHelpClass.TicketCount); stringBuilder.AppendLine("已付金额:" + this.parent.mSelfHelpClass.RealSum); stringBuilder.AppendLine("已出票数:" + (this.parent.mSelfHelpClass.TicketCount - this.cardCount).ToString()); stringBuilder.AppendLine("购买日期:" + DateTime.Now.ToString("yyyy年MM月dd日 HH:mm:ss")); stringBuilder.AppendLine(""); stringBuilder.AppendLine("请联系工作人员取票!"); this.parent.WarmOperation(stringBuilder.ToString(), "error", false); //LogHelper.WriteLog(new LogHelper //{ // Message = "已付款,但是无法出票!", // StackTrace = stringBuilder.ToString() //}); } else { if (this.cardCount == 0)// wjl add { //**************改为出一张票就上传一次的 //this.web.Source = new Uri(AppDomain.CurrentDomain.BaseDirectory + "flash\\f7.swf"); // this.ss.SelectVoiceByHints(VoiceGender.Female); // this.ss.SpeakAsync("请取票!"); this.Dispatcher.BeginInvoke((Action) delegate() { if (this.parent.ticketbox_isErr != 1)//票种放反 { this.txt_show.Text = "购票信息-出票完毕,请取票!!"; } isre = true; }); if (isre) { System.Threading.Thread.Sleep(3000); this.cardCount = -1; this.parent.EndOperation(); isre = false; } } else if (this.cardCount == -99999) { this.Dispatcher.BeginInvoke((Action) delegate() { this.txt_show.Foreground = System.Windows.Media.Brushes.Red; this.txt_show.Text = "购票信息-刮票失败!请到人工窗口取票!"; isre = true; }); if (isre) { // System.Threading.Thread.Sleep(300); this.cardCount = -1; // this.parent.EndOperation(); if (this.parent.ticketbox_isErr == 0) { this.parent.Err_Info = "出票失败!请到人工售票窗口取票。"; this.parent.Operation("error"); } else if (this.parent.ticketbox_isErr == 1) //票种放反的 { this.parent.Err_Info = "出票失败!请到人工售票窗口取票。"; //"所购票种与实际出票种不符!\r\n请到人工售票窗口取票!"; this.parent.Operation("error"); } else if (this.parent.ticketbox_isErr == 100) //上传失败 { this.parent.Err_Info = "出票失败!请到人工售票窗口取票。"; // "系统提示:\r\n数据上传失败!\r\n请到人工售票窗口取票!"; this.parent.Operation("error"); } isre = false; } } //LogHelper.WriteLog(this.parent.SelfHelpInfo.ToString(), AppDomain.CurrentDomain.BaseDirectory + "pay" + DateTime.Now.ToString("yyyyMMdd") + ".log"); } }