系统设置添加 称重清零
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace MesWork.Pages
|
||||
@@ -179,6 +180,37 @@ namespace MesWork.Pages
|
||||
MessageBox.Show($"已手动发送条码:{barcode}\n工位:{opName}", "发送成功", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
}
|
||||
|
||||
private async void btn_WeightClear1_Click(object sender, EventArgs e)
|
||||
{
|
||||
await DoWeightClearAsync("OP10", btn_WeightClear1);
|
||||
}
|
||||
|
||||
private async void btn_WeightClear2_Click(object sender, EventArgs e)
|
||||
{
|
||||
await DoWeightClearAsync("OP20", btn_WeightClear2);
|
||||
}
|
||||
|
||||
private async Task DoWeightClearAsync(string opName, Button btn)
|
||||
{
|
||||
try
|
||||
{
|
||||
btn.Enabled = false;
|
||||
MesWorkForm.WritePLC_IF(100017, opName, 1);
|
||||
await Task.Delay(1000);
|
||||
MesWorkForm.WritePLC_IF(100017, opName, 0);
|
||||
MessageBox.Show($"{opName} 称重清零信号已发送", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MesWorkForm.WriteLog_Info("系统设置", $"{opName} 称重清零失败:{ex.Message}", ex);
|
||||
MessageBox.Show($"{opName} 称重清零失败:{ex.Message}", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
finally
|
||||
{
|
||||
btn.Enabled = true;
|
||||
}
|
||||
}
|
||||
|
||||
private void RefreshComPorts(ComboBox cmb, string opName)
|
||||
{
|
||||
cmb.Items.Clear();
|
||||
|
||||
Reference in New Issue
Block a user