系统设置添加 称重清零

This commit is contained in:
XingCheng3
2026-05-13 00:51:52 +08:00
parent 14ff9fa4c3
commit 0ca8274260
3 changed files with 102 additions and 9 deletions

View File

@@ -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();