private void dTimer_Tick(object sender, EventArgs e) { CPayout.price = ""; if (Payout.DoPoll(LOGS) == false) { while (true) { Payout.SSPComms.CloseComPort(); if (ConnectToValidator(5) == true) { break; } Payout.SSPComms.CloseComPort(); return; } } else { if (CPayout.price != "") { string[] s = CPayout.price.Split('.'); int cash = Int32.Parse(s[0]); switch (cash) { case 1: payoutcash[0] += 1; break; case 5: payoutcash[2] += 1; break; case 10: payoutcash[3] += 1; break; case 20: payoutcash[4] += 1; break; case 50: payoutcash[5] += 1; break; case 100: payoutcash[6] += 1; break; } if (payoutcash[0] > 5 || payoutcash[2] > 30 || payoutcash[3] > 30) { Payout.AdminSetChannelToPayout(LOGS); } ShowCashBoxCount(); } } }
private void dTimer_Tick(object sender, EventArgs e) //定时任务函数 { CPayout.price = ""; if (Payout.DoPoll(textBox1) == false) { while (true) { Payout.SSPComms.CloseComPort(); if (ConnectToValidator(5) == true) { break; } Payout.SSPComms.CloseComPort(); return; } } else { //处理正常收取纸币函数 HandleSmartPayout(); } //硬币收找处理 if (PayoutOrGetin) { string str = Cm.PayoutRevice(); if (str != "" && IsCashEnable == true) { string[] s = str.Split(','); if (s[0] == "0" && s[1] != "0") { if (ClickStatus == 2) { new LOG.LogClass().WriteLogFile(LOG.LogSerial.logSerialnum + "---CashPayout-->付款完毕处理"); ClickStatus = 0; prompt.Text = " 处理完毕,1秒后自动跳转 "; dTimer.IsEnabled = false; Payout.Reset(textBox1); Payout.SSPComms.CloseComPort(); Cm.CloseGetCoinChannelALL(); Cm.PayoutCoinReset(); Cm.CloseSerialPort(); Thread.Sleep(1000); new VIEW.PaySuccess(ParkPrice * 100, CarNum, recordId, InTime).Show(); this.Close(); } else if (ClickStatus == 1) { new LOG.LogClass().WriteLogFile(LOG.LogSerial.logSerialnum + "---CashPayout-->退款完毕处理"); ClickStatus = 0; prompt.Text = " 退款完毕 "; dTimer.IsEnabled = false; Payout.Reset(textBox1); Payout.SSPComms.CloseComPort(); Cm.CloseGetCoinChannelALL(); Cm.PayoutCoinReset(); Cm.CloseSerialPort(); Thread.Sleep(1000); new MainWindow().Show(); this.Close(); } PayoutOrGetin = false; } else //硬币没了 出纸币(标记没钱找了) 通知ipc { /* * IsCashEnable = false; * new LOG.LogClass().WriteLogFile(LOG.LogSerial.logSerialnum + "---CashPayout-->硬币找零不足,开启通过纸币找零" ); * UserChange[0] = int.Parse(s[0]); * PayoutOrGetin = true; * PayOutChange = true; * ChangePayout(); * // button1.IsEnabled = false; */ } } } else { int temp = Cm.GetInCoin(); if (temp > 0) { UserInCash[7] += temp; GetCash += temp; CheckCashEnoughPay(true); } } }