增加工位号兼容功能 不依赖固定的 OP10 OP20做硬编码判定 通过App.config作为工位依据
This commit is contained in:
@@ -10,13 +10,13 @@ namespace MesWork.Pages
|
||||
/// </summary>
|
||||
public partial class UC_SystemSettings : UserControl
|
||||
{
|
||||
// OP10 控件
|
||||
// 工位1控件
|
||||
private ComboBox cmb_Com1;
|
||||
private Button btn_Connect1, btn_Disconnect1, btn_ManualSend1;
|
||||
private Label lbl_Status1, lbl_ScanTime1;
|
||||
private TextBox txt_Barcode1;
|
||||
|
||||
// OP20 控件
|
||||
// 工位2控件
|
||||
private ComboBox cmb_Com2;
|
||||
private Button btn_Connect2, btn_Disconnect2, btn_ManualSend2;
|
||||
private Label lbl_Status2, lbl_ScanTime2;
|
||||
@@ -26,19 +26,26 @@ namespace MesWork.Pages
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
string station1 = MesWorkForm.Station1OpName;
|
||||
string station2 = MesWorkForm.Station2OpName;
|
||||
grp_Station1.Text = $" 工位1({station1}) ";
|
||||
grp_Station2.Text = $" 工位2({station2}) ";
|
||||
grp_Scanner1.Text = $" {station1} 扫码枪 ";
|
||||
grp_Scanner2.Text = $" {station2} 扫码枪 ";
|
||||
|
||||
if (BarcodeManager.IsEnabled)
|
||||
{
|
||||
BuildScannerPanel(grp_Scanner1, "OP10", ref cmb_Com1, ref lbl_Status1, ref txt_Barcode1, ref lbl_ScanTime1,
|
||||
BuildScannerPanel(grp_Scanner1, station1, ref cmb_Com1, ref lbl_Status1, ref txt_Barcode1, ref lbl_ScanTime1,
|
||||
ref btn_Connect1, ref btn_Disconnect1, ref btn_ManualSend1);
|
||||
BuildScannerPanel(grp_Scanner2, "OP20", ref cmb_Com2, ref lbl_Status2, ref txt_Barcode2, ref lbl_ScanTime2,
|
||||
BuildScannerPanel(grp_Scanner2, station2, ref cmb_Com2, ref lbl_Status2, ref txt_Barcode2, ref lbl_ScanTime2,
|
||||
ref btn_Connect2, ref btn_Disconnect2, ref btn_ManualSend2);
|
||||
timer_Refresh.Start();
|
||||
}
|
||||
else
|
||||
{
|
||||
BuildScannerPanel(grp_Scanner1, "OP10", ref cmb_Com1, ref lbl_Status1, ref txt_Barcode1, ref lbl_ScanTime1,
|
||||
BuildScannerPanel(grp_Scanner1, station1, ref cmb_Com1, ref lbl_Status1, ref txt_Barcode1, ref lbl_ScanTime1,
|
||||
ref btn_Connect1, ref btn_Disconnect1, ref btn_ManualSend1);
|
||||
BuildScannerPanel(grp_Scanner2, "OP20", ref cmb_Com2, ref lbl_Status2, ref txt_Barcode2, ref lbl_ScanTime2,
|
||||
BuildScannerPanel(grp_Scanner2, station2, ref cmb_Com2, ref lbl_Status2, ref txt_Barcode2, ref lbl_ScanTime2,
|
||||
ref btn_Connect2, ref btn_Disconnect2, ref btn_ManualSend2);
|
||||
grp_Scanner1.Enabled = false;
|
||||
grp_Scanner2.Enabled = false;
|
||||
@@ -182,12 +189,12 @@ namespace MesWork.Pages
|
||||
|
||||
private async void btn_WeightClear1_Click(object sender, EventArgs e)
|
||||
{
|
||||
await DoWeightClearAsync("OP10", btn_WeightClear1);
|
||||
await DoWeightClearAsync(MesWorkForm.Station1OpName, btn_WeightClear1);
|
||||
}
|
||||
|
||||
private async void btn_WeightClear2_Click(object sender, EventArgs e)
|
||||
{
|
||||
await DoWeightClearAsync("OP20", btn_WeightClear2);
|
||||
await DoWeightClearAsync(MesWorkForm.Station2OpName, btn_WeightClear2);
|
||||
}
|
||||
|
||||
private async Task DoWeightClearAsync(string opName, Button btn)
|
||||
@@ -230,8 +237,8 @@ namespace MesWork.Pages
|
||||
|
||||
private void timer_Refresh_Tick(object sender, EventArgs e)
|
||||
{
|
||||
RefreshScannerStatus("OP10", lbl_Status1, txt_Barcode1, lbl_ScanTime1);
|
||||
RefreshScannerStatus("OP20", lbl_Status2, txt_Barcode2, lbl_ScanTime2);
|
||||
RefreshScannerStatus(MesWorkForm.Station1OpName, lbl_Status1, txt_Barcode1, lbl_ScanTime1);
|
||||
RefreshScannerStatus(MesWorkForm.Station2OpName, lbl_Status2, txt_Barcode2, lbl_ScanTime2);
|
||||
}
|
||||
|
||||
private void RefreshScannerStatus(string opName, Label lblStatus, TextBox txtBar, Label lblTime)
|
||||
|
||||
Reference in New Issue
Block a user