158 lines
5.5 KiB
C#
158 lines
5.5 KiB
C#
|
|
using System;
|
|||
|
|
using System.Collections.Generic;
|
|||
|
|
using System.ComponentModel;
|
|||
|
|
using System.Data;
|
|||
|
|
using System.Drawing;
|
|||
|
|
using System.Linq;
|
|||
|
|
using System.Runtime.InteropServices;
|
|||
|
|
using System.Text;
|
|||
|
|
using System.Threading.Tasks;
|
|||
|
|
using System.Windows.Forms;
|
|||
|
|
using static JJMediSys.AlertForm;
|
|||
|
|
|
|||
|
|
namespace JJMediSys
|
|||
|
|
{
|
|||
|
|
public partial class DevParamSet : Form
|
|||
|
|
{
|
|||
|
|
public DevParamSet()
|
|||
|
|
{
|
|||
|
|
InitializeComponent();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void BRTB_Click(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
byte[] RecvData = new byte[200];
|
|||
|
|
if (!SystemSet.mTubeLabelTool.IsDevFree)
|
|||
|
|
{
|
|||
|
|
AlertForm.ShowAlert("设备正忙,请稍后", AlertType.Warning, 3);
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
SystemSet.mTubeLabelTool.MechineCtrol("GetTbPargs", null, ref RecvData);
|
|||
|
|
string msg = string.Format("{0};{1};{2}", RecvData[3], RecvData[4], RecvData[5]);
|
|||
|
|
TextTB.Text = msg;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void BSTB_Click(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
if (!SystemSet.mTubeLabelTool.IsDevFree)
|
|||
|
|
{
|
|||
|
|
AlertForm.ShowAlert("设备正忙,请稍后", AlertType.Warning, 3);
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
if (TextTB.Text.Length > 0 && TextTB.Text.Contains(";"))
|
|||
|
|
{
|
|||
|
|
string[] pargs = TextTB.Text.Split(';');
|
|||
|
|
if (pargs.Length == 3)
|
|||
|
|
{
|
|||
|
|
byte[] RecvData = new byte[200];
|
|||
|
|
byte[] SendData = new byte[3];
|
|||
|
|
SendData[0] = (byte)int.Parse(pargs[0]);
|
|||
|
|
SendData[1] = (byte)int.Parse(pargs[1]);
|
|||
|
|
SendData[2] = (byte)int.Parse(pargs[2]);
|
|||
|
|
SystemSet.mTubeLabelTool.MechineCtrol("SetTbPargs", SendData, ref RecvData);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
AlertForm.ShowAlert("参数错误", AlertType.Error, 3);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void BRQD_Click(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
byte[] RecvData = new byte[200];
|
|||
|
|
if (!SystemSet.mTubeLabelTool.IsDevFree)
|
|||
|
|
{
|
|||
|
|
AlertForm.ShowAlert("设备正忙,请稍后", AlertType.Warning, 3);
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
SystemSet.mTubeLabelTool.MechineCtrol("GetQdPargs", null, ref RecvData);
|
|||
|
|
string msg = string.Format("{0};{1};{2}", RecvData[3], RecvData[4], RecvData[5]);
|
|||
|
|
TextQD.Text = msg;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void BSQD_Click(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
if (TextQD.Text.Length > 0 && TextQD.Text.Contains(";"))
|
|||
|
|
{
|
|||
|
|
string[] pargs = TextQD.Text.Split(';');
|
|||
|
|
if (pargs.Length == 3)
|
|||
|
|
{
|
|||
|
|
byte[] RecvData = new byte[200];
|
|||
|
|
byte[] SendData = new byte[3];
|
|||
|
|
SendData[0] = (byte)int.Parse(pargs[0]);
|
|||
|
|
SendData[1] = (byte)int.Parse(pargs[1]);
|
|||
|
|
SendData[2] = (byte)int.Parse(pargs[2]);
|
|||
|
|
SystemSet.mTubeLabelTool.MechineCtrol("SetQdPargs", SendData, ref RecvData);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
AlertForm.ShowAlert("参数错误", AlertType.Error, 3);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void BRSM_Click(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
byte[] RecvData = new byte[200];
|
|||
|
|
if (!SystemSet.mTubeLabelTool.IsDevFree)
|
|||
|
|
{
|
|||
|
|
AlertForm.ShowAlert("设备正忙,请稍后", AlertType.Warning, 3);
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
SystemSet.mTubeLabelTool.MechineCtrol("GetSmPargs", null, ref RecvData);
|
|||
|
|
string msg = string.Format("{0};{1};{2}", RecvData[3], RecvData[4], RecvData[5]);
|
|||
|
|
TextSM.Text = msg;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void BSSM_Click(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
if (!SystemSet.mTubeLabelTool.IsDevFree)
|
|||
|
|
{
|
|||
|
|
AlertForm.ShowAlert("设备正忙,请稍后", AlertType.Warning, 3);
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
if (TextSM.Text.Length > 0 && TextSM.Text.Contains(";"))
|
|||
|
|
{
|
|||
|
|
string[] pargs = TextSM.Text.Split(';');
|
|||
|
|
if (pargs.Length == 3)
|
|||
|
|
{
|
|||
|
|
byte[] RecvData = new byte[200];
|
|||
|
|
byte[] SendData = new byte[3];
|
|||
|
|
SendData[0] = (byte)int.Parse(pargs[0]);
|
|||
|
|
SendData[1] = (byte)int.Parse(pargs[1]);
|
|||
|
|
SendData[2] = (byte)int.Parse(pargs[2]);
|
|||
|
|
SystemSet.mTubeLabelTool.MechineCtrol("SetSmPargs", SendData, ref RecvData);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
AlertForm.ShowAlert("参数错误", AlertType.Error, 3);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void BSensorInit_Click(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
byte[] RecvData = new byte[200];
|
|||
|
|
if (!SystemSet.mTubeLabelTool.IsDevFree)
|
|||
|
|
{
|
|||
|
|
AlertForm.ShowAlert("设备正忙,请稍后", AlertType.Warning, 3);
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
bool result = SystemSet.mTubeLabelTool.MechineCtrol("InitSensor", null, ref RecvData);
|
|||
|
|
if (RecvData[3] != 0x00 && result == true)
|
|||
|
|
{
|
|||
|
|
string msg = string.Format("传感器初始化失败 Code[{0}]", RecvData[3].ToString("X2"));
|
|||
|
|
MessageBox.Show(msg);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void pictureBox1_Click(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
this.Close();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
}
|