Commit 2e54d381 authored by 李佳's avatar 李佳

按钮防多次点击

parent d079a5ca
......@@ -146,7 +146,9 @@ namespace ChuPiao.AutoPrint.Desktop.AutoEncash
}
void service_EncashTicketLoaded(object sender, EventArgs e)
{
WorkbenchSingleton.SafeThreadCall(new Action(UpdateToolBar_LoadButton));
//WorkbenchSingleton.SafeThreadCall(new Action(UpdateToolBar_LoadButton));
this.autoEncashToolStrip.toolStripButtonLoad.Enabled = true;
this.autoEncashToolStrip.toolStripButtonLoadBig.Enabled = true;
}
void toolStripButtonStop_Click(object sender, EventArgs e)
......@@ -212,6 +214,7 @@ namespace ChuPiao.AutoPrint.Desktop.AutoEncash
try
{
this.autoEncashToolStrip.toolStripButtonLoad.Enabled = false;
this.autoEncashToolStrip.toolStripButtonLoadBig.Enabled = false;
M_LotTypeEntity lotTypeEntity =
this.autoEncashToolStrip.toolStripComboBoxLotType.SelectedItem as M_LotTypeEntity;
//EnumDescription encashLoadTypeDesc = this.autoEncashToolStrip.toolStripComboBoxType.SelectedItem as EnumDescription;
......@@ -260,14 +263,17 @@ namespace ChuPiao.AutoPrint.Desktop.AutoEncash
if (selectedMachineNum == 0)
{
MessageService.ShowMessage("请选择机器号", "操作提示");
this.autoEncashToolStrip.toolStripButtonLoad.Enabled = true;
this.autoEncashToolStrip.toolStripButtonLoadBig.Enabled = true;
}
}
}
catch (Exception ex)
{
this.autoEncashToolStrip.toolStripButtonLoad.Enabled = true;
MessageService.ShowError(string.Concat("加载票异常。错误信息:", ex));
this.autoEncashToolStrip.toolStripButtonLoad.Enabled = true;
this.autoEncashToolStrip.toolStripButtonLoadBig.Enabled = true;
}
}
......@@ -320,9 +326,9 @@ namespace ChuPiao.AutoPrint.Desktop.AutoEncash
autoEncashToolStrip.toolStripButtonStop.Enabled = isEnabledStop;
}
}
private void UpdateToolBar_LoadButton()
{
this.autoEncashToolStrip.toolStripButtonLoad.Enabled = true;
}
//private void UpdateToolBar_LoadButton()
//{
// this.autoEncashToolStrip.toolStripButtonLoad.Enabled = true;
//}
}
}
......@@ -145,6 +145,9 @@ namespace ChuPiao.AutoPrint.Desktop.AutoPrint
AutoPrintService service = new AutoPrintService();
service.LotMachine = keyValuePair.Value;
service.StatusChanged += new EventHandler<MachineStatusArgs>(service_StatusChanged);
service.PrintTestOver += new EventHandler(service_PrintTestOver);
service.PrintMoneyReportOver += new EventHandler(service_PrintMoneyReportOver);
service.PrintTimeReportOver += new EventHandler(service_PrintTimeReportOver);
AutoPrintView view = new AutoPrintView();
//view.LotMachine = keyValuePair.Value;
view.Service = service;
......@@ -177,6 +180,24 @@ namespace ChuPiao.AutoPrint.Desktop.AutoPrint
}
void service_PrintTimeReportOver(object sender, EventArgs e)
{
autoPrintToolStrip.ToolStripButtonPrintCurrentDayReport.Enabled = true;
Logger.Log.Info("service_PrintTimeReportOver");
}
void service_PrintMoneyReportOver(object sender, EventArgs e)
{
autoPrintToolStrip.ToolStripButtonUpdateMoney.Enabled = true;
Logger.Log.Info("service_PrintMoneyReportOver");
}
void service_PrintTestOver(object sender, EventArgs e)
{
autoPrintToolStrip.ToolStripButtonTest.Enabled = true;
Logger.Log.Info("service_PrintTestOver");
}
private int _selectedtimetype = 0;
private string _selectedtimename = "";
private void toolStripComboBox_timetype_SelectedIndexChanged(object sender, EventArgs e)
......@@ -384,9 +405,6 @@ namespace ChuPiao.AutoPrint.Desktop.AutoPrint
}
}
void ToolStripButtonEnterSaleGui_Click(object sender, EventArgs e)
{
int selectedMachineNum = 0;
......@@ -421,12 +439,6 @@ namespace ChuPiao.AutoPrint.Desktop.AutoPrint
}
}
void ToolStripButtonReloadConfig_Click(object sender, EventArgs e)
{
try
......@@ -615,12 +627,16 @@ namespace ChuPiao.AutoPrint.Desktop.AutoPrint
void ToolStripButtonPrintCurrentDayReport_Click(object sender, EventArgs e)
{
MachineReportTime entity = autoPrintToolStrip.toolStripComboBox_timeselect.ComboBox.SelectedItem as MachineReportTime;
if (DialogResult.OK != MessageBox.Show(string.Format("将上传 {0}({1:yyyyMMdd} - {2:yyyyMMdd}) 的 {3} 时段报表", entity.DisplayMember, entity.From, entity.To, autoPrintToolStrip.toolStripComboBox_timetype.Text), "确认", MessageBoxButtons.OKCancel))
{
return;
}
autoPrintToolStrip.ToolStripButtonPrintCurrentDayReport.Enabled = false;
try
{
int selectedMachineNum = 0;
......@@ -635,19 +651,21 @@ namespace ChuPiao.AutoPrint.Desktop.AutoPrint
if (selectedMachineNum == 0)
{
MessageService.ShowMessage("请选择机器号", "操作提示");
autoPrintToolStrip.ToolStripButtonPrintCurrentDayReport.Enabled = true;
return;
}
}
catch (Exception ex)
{
LoggingService.Error(string.Concat("上传天报表异常。", ex));
autoPrintToolStrip.ToolStripButtonPrintCurrentDayReport.Enabled = true;
}
}
void ToolStripButtonUpdateMoney_Click(object sender, EventArgs e)
{
autoPrintToolStrip.ToolStripButtonUpdateMoney.Enabled = false;
try
{
int selectedMachineNum = 0;
......@@ -662,12 +680,15 @@ namespace ChuPiao.AutoPrint.Desktop.AutoPrint
if (selectedMachineNum == 0)
{
MessageService.ShowMessage("请选择机器号", "操作提示");
autoPrintToolStrip.ToolStripButtonUpdateMoney.Enabled = true;
return;
}
}
catch (Exception ex)
{
LoggingService.Error(string.Concat("上传缴款报表异常。", ex));
autoPrintToolStrip.ToolStripButtonUpdateMoney.Enabled = true;
}
}
......@@ -675,6 +696,7 @@ namespace ChuPiao.AutoPrint.Desktop.AutoPrint
void ToolStripButtonTest_Click(object sender, EventArgs e)
{
autoPrintToolStrip.ToolStripButtonTest.Enabled = false;
try
{
int selectedMachineNum = 0;
......@@ -689,15 +711,18 @@ namespace ChuPiao.AutoPrint.Desktop.AutoPrint
if (selectedMachineNum == 0)
{
MessageService.ShowMessage("请选择机器号", "操作提示");
autoPrintToolStrip.ToolStripButtonTest.Enabled = true;
}
}
catch (Exception ex)
{
LoggingService.Error(string.Concat("打印测试票异常。", ex));
autoPrintToolStrip.ToolStripButtonTest.Enabled = true;
}
}
void ToolStripButtonLogin_Click(object sender, EventArgs e)
{
try
......
......@@ -43,6 +43,13 @@ namespace ChuPiao.AutoPrint.Services.AutoPrint
/// 错误清除
/// </summary>
public event EventHandler ErrorCleared;
//按钮启用
public event EventHandler PrintTestOver;
public event EventHandler PrintMoneyReportOver;
public event EventHandler PrintTimeReportOver;
public ILotMachine LotMachine;
private Thread _workThread;
private bool _isStop = true;
......@@ -2239,6 +2246,28 @@ namespace ChuPiao.AutoPrint.Services.AutoPrint
}
}
public void OnPrintTestOver()
{
if (PrintTestOver != null)
{
PrintTestOver(this, new EventArgs());
}
}
public void OnPrintMoneyReportOver()
{
if (PrintMoneyReportOver != null)
{
PrintMoneyReportOver(this, new EventArgs());
}
}
public void OnPrintTimeReportOver()
{
if (PrintTimeReportOver != null)
{
PrintTimeReportOver(this, new EventArgs());
}
}
//private List<L_LotTicketEntity> CreateTestTicketList()
//{
// List<L_LotTicketEntity> list = new List<L_LotTicketEntity>();
......@@ -2677,6 +2706,8 @@ namespace ChuPiao.AutoPrint.Services.AutoPrint
throw new Exception(string.Concat("解析缴款报表失败。错误信息:", decodePrintData.ErrorMessage));
}
OnPrintMoneyReportOver();
}
/// <summary>
......@@ -2727,6 +2758,8 @@ namespace ChuPiao.AutoPrint.Services.AutoPrint
}
OnPrintTimeReportOver();
}
/// <summary>
......@@ -3160,6 +3193,10 @@ namespace ChuPiao.AutoPrint.Services.AutoPrint
{
this.LotMachine.Log.Error(string.Concat("打印测试票异常。错误信息:", exception));
}
finally
{
OnPrintTestOver();
}
}
}
}
No preview for this file type
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment