CIDebugControl.cs 2.0 KB
using OnlineStore;
using DeviceLibrary;
using OnlineStore.Common;
using OnlineStore.LoadCSVLibrary;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace TheMachine.device
{
    public partial class CIDebugControl : UserControl
    {
        public CIDebugControl()
        {
            InitializeComponent();
        }

        private void timer1_Tick(object sender, EventArgs e)
        {
            if (!TrayStop.DeviceList.ContainsKey("CI"))
                return;
            string status = "";
            if (TrayStop.DeviceList["CI"].IOValue(IO_Type.CI_Count_Finished).Equals(IO_VALUE.HIGH))
            {
                status = "Ready";
            }
            else
            {
                status = "Counting";
            }

            label_status.Text = status;
        }

        private void btn_start_Click(object sender, EventArgs e)
        {
            if (TrayStop.DeviceList["CI"].IOValue(IO_Type.CI_Count_Finished).Equals(IO_VALUE.HIGH))
            {
                if (VJCounter.CheckConnect())
                {
                    VJCounter.SendBarcode(txt_barcode.Text.Trim());
                    Thread.Sleep(500);
                    TrayStop.DeviceList["CI"].IOMove(IO_Type.CI_Start, IO_VALUE.HIGH, 1000);
                    LogUtil.info("手动点击开始点料");
                }
                else {
                    MessageBox.Show(crc.GetString("Res0117.c9f109fe","未成功连接VJ点料机"));
                }
            }
            else
            {
                MessageBox.Show(crc.GetString("Res0118.f955ef4e","点料机没有准备好,不能启动."));
            }
        }

        private void cb_manualcount_CheckedChanged(object sender, EventArgs e)
        {
            CI.DeviceList["CI"].ManualCount = cb_manualcount.Checked;
        }
    }
}