Commit 89e44274 刘韬

1

1 个父辈 30ce5a84
...@@ -45,6 +45,8 @@ namespace OnlineStore.Common ...@@ -45,6 +45,8 @@ namespace OnlineStore.Common
public static MyConfig<int> Device_HumidityStartOffser = 1; public static MyConfig<int> Device_HumidityStartOffser = 1;
[MyConfigComment("湿度超限吹气停止相对值=服务器设定湿度报警值-本相对值")] [MyConfigComment("湿度超限吹气停止相对值=服务器设定湿度报警值-本相对值")]
public static MyConfig<int> Device_HumidityEndOffser = 10; public static MyConfig<int> Device_HumidityEndOffser = 10;
public static MyConfig<int> Device_HumidityAdjust = 0;
public static MyConfig<int> Device_HumidityLimited = 4;
[MyConfigComment("扫码识别类型")] [MyConfigComment("扫码识别类型")]
public static MyConfig<string[]> CodeScan_CodeType = new string[] { "QR Code" }; public static MyConfig<string[]> CodeScan_CodeType = new string[] { "QR Code" };
......
...@@ -177,7 +177,7 @@ namespace OnlineStore.Common ...@@ -177,7 +177,7 @@ namespace OnlineStore.Common
} }
catch (Exception Ex) catch (Exception Ex)
{ {
LogUtil.error(LOGGER, Ex.ToString()); LogUtil.error(Ex.ToString());
//throw Ex; //throw Ex;
} }
return ok; return ok;
......
...@@ -15,20 +15,20 @@ namespace OnlineStore.Common ...@@ -15,20 +15,20 @@ namespace OnlineStore.Common
/// </summary> /// </summary>
public class HumitureController public class HumitureController
{ {
public static readonly ILog LOGGER = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); public readonly ILog LOGGER = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
public static bool IsRun = false; public bool IsRun = false;
public static string serialPort = ""; public string serialPort = "";
private static int bautRate = 4800;//波特率 private int bautRate = 4800;//波特率
private static Parity parity = Parity.None;//校验位 private Parity parity = Parity.None;//校验位
private static int dataBits = 8;//数据位 private int dataBits = 8;//数据位
private static StopBits stopBits = StopBits.One; //停止位 private StopBits stopBits = StopBits.One; //停止位
private static AcSerialBean sb = null; private AcSerialBean sb = null;
private static string LogName = ""; private string LogName = "";
public static int HumitureControllerType = 0;// ConfigAppSettings.GetIntValue(Setting_Init.HumitureControllerType); public int HumitureControllerType = 0;// ConfigAppSettings.GetIntValue(Setting_Init.HumitureControllerType);
static Timer timer = new Timer(); Timer timer = new Timer();
public static bool Init(string port) public bool Init(string port)
{ {
if (IsRun && port.Equals(serialPort)) if (IsRun && port.Equals(serialPort))
{ {
...@@ -61,20 +61,21 @@ namespace OnlineStore.Common ...@@ -61,20 +61,21 @@ namespace OnlineStore.Common
} }
else else
{ {
LogUtil.error(LOGGER, LogName + "串口打开失败!"); LogUtil.error(LogName + "串口打开失败!");
IsRun = false; IsRun = false;
return false; return false;
} }
} }
catch (Exception ex) catch (Exception ex)
{ {
LogUtil.error(LogName + ex.ToString());
IsRun = false; IsRun = false;
} }
return true; return true;
} }
private static void Timer_Elapsed(object sender, ElapsedEventArgs e) private void Timer_Elapsed(object sender, ElapsedEventArgs e)
{ {
QueryData(); QueryData();
} }
...@@ -82,7 +83,7 @@ namespace OnlineStore.Common ...@@ -82,7 +83,7 @@ namespace OnlineStore.Common
/// <summary> /// <summary>
/// 释放资源 /// 释放资源
/// </summary> /// </summary>
public static void Release() public void Release()
{ {
if (sb != null) if (sb != null)
{ {
...@@ -90,13 +91,22 @@ namespace OnlineStore.Common ...@@ -90,13 +91,22 @@ namespace OnlineStore.Common
} }
IsRun = false; IsRun = false;
} }
public static ASTemperateParam LastData = new ASTemperateParam(0, 0,0); public ASTemperateParam LastData = new ASTemperateParam(0, 0,0);
public static ASTemperateParam QueryData() public ASTemperateParam QueryData()
{ {
ASTemperateParam param = new ASTemperateParam(0, 0, 0); ASTemperateParam param = new ASTemperateParam(0, 0, 0);
List<double> data = queryData(); List<double> data = queryData();
if (data.Count.Equals(3)) if (data.Count.Equals(3))
{ {
if (Setting_Init.Device_HumidityAdjust != 0 && Setting_Init.Device_HumidityLimited != 0)
{
if (data[0] + Setting_Init.Device_HumidityAdjust < Setting_Init.Device_HumidityLimited)
{
data[0] = Setting_Init.Device_HumidityLimited;
}
else
data[0] += Setting_Init.Device_HumidityAdjust;
}
param = new ASTemperateParam(data[1], data[0], data[2]); param = new ASTemperateParam(data[1], data[0], data[2]);
} }
LastData = param; LastData = param;
...@@ -106,7 +116,7 @@ namespace OnlineStore.Common ...@@ -106,7 +116,7 @@ namespace OnlineStore.Common
/// 返回温度和湿度 /// 返回温度和湿度
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
private static List<double> queryData() private List<double> queryData()
{ {
// 温度计算: // 温度计算:
//当温度低于 0 ℃ 时温度数据以补码的形式上传。 //当温度低于 0 ℃ 时温度数据以补码的形式上传。
...@@ -146,7 +156,7 @@ namespace OnlineStore.Common ...@@ -146,7 +156,7 @@ namespace OnlineStore.Common
private static byte[] buildCheckData(byte[] sendData, int length) private byte[] buildCheckData(byte[] sendData, int length)
{ {
ushort pChecksum = 0; ushort pChecksum = 0;
AcSerialBean.CalculateCRC(sendData, length, out pChecksum); AcSerialBean.CalculateCRC(sendData, length, out pChecksum);
...@@ -166,7 +176,7 @@ namespace OnlineStore.Common ...@@ -166,7 +176,7 @@ namespace OnlineStore.Common
return sendData; return sendData;
} }
private static List<double> getReviceData(byte[] dataArray) private List<double> getReviceData(byte[] dataArray)
{ {
List<double> list = new List<double>(); List<double> list = new List<double>();
try try
......
...@@ -167,8 +167,17 @@ namespace DeviceLibrary ...@@ -167,8 +167,17 @@ namespace DeviceLibrary
BoxStatus boxStatus = new BoxStatus(); BoxStatus boxStatus = new BoxStatus();
boxStatus.boxId = StoreID; boxStatus.boxId = StoreID;
boxStatus.humidity = HumitureController.LastData.Humidity.ToString(); if (RobotManage.humitureControllers.Count > 0)
boxStatus.temperature = HumitureController.LastData.Temperate.ToString(); {
boxStatus.humidity = RobotManage.humitureControllers.Average(x => x.LastData.Humidity).ToString();
boxStatus.temperature = RobotManage.humitureControllers.Average(x => x.LastData.Temperate).ToString();
}
List<humidata> humidatas = new List<humidata>();
for (int i = 0; i < RobotManage.humitureControllers.Count; i++) {
var v = RobotManage.humitureControllers[i].LastData;
humidatas.Add(new humidata { id = (i+1).ToString(), humidity = v.Humidity.ToString(), temperature = v.Temperate.ToString() });
}
boxStatus.data.Add("humiAndtempList", JsonConvert.SerializeObject(humidatas));
//状态 //状态
boxStatus.status = (int)storeStatus; boxStatus.status = (int)storeStatus;
...@@ -207,6 +216,11 @@ namespace DeviceLibrary ...@@ -207,6 +216,11 @@ namespace DeviceLibrary
lineOperation.boxStatus.Add(StoreID, boxStatus); lineOperation.boxStatus.Add(StoreID, boxStatus);
return lineOperation; return lineOperation;
} }
class humidata {
public string id;
public string humidity;
public string temperature;
}
private static string api_communication = "service/store/communication"; //流水线状态通信接口 private static string api_communication = "service/store/communication"; //流水线状态通信接口
public static string GetPostApi() public static string GetPostApi()
{ {
......
...@@ -63,7 +63,7 @@ namespace DeviceLibrary ...@@ -63,7 +63,7 @@ namespace DeviceLibrary
case MoveStep.Wait: case MoveStep.Wait:
break; break;
case MoveStep.In01: case MoveStep.In01:
MoveInfo.NextMoveStep(MoveStep.In02); MoveInfo.NextMoveStep(MoveStep.In03);
Line.LineRun("work", false, 999); Line.LineRun("work", false, 999);
MiddleStop(MoveInfo, IO_VALUE.HIGH); MiddleStop(MoveInfo, IO_VALUE.HIGH);
FrontStop(MoveInfo, IO_VALUE.LOW); FrontStop(MoveInfo, IO_VALUE.LOW);
......
...@@ -123,9 +123,9 @@ namespace DeviceLibrary ...@@ -123,9 +123,9 @@ namespace DeviceLibrary
IOManager.IOMove(IO_Type.SafeDoor_Lock, IO_VALUE.HIGH); IOManager.IOMove(IO_Type.SafeDoor_Lock, IO_VALUE.HIGH);
//var temp = HumitureController.QueryData(); //var temp = HumitureController.QueryData();
var temp = HumitureController.LastData; //var temp = HumitureController.LastData;
Current_Humidity = temp.Humidity; Current_Humidity = RobotManage.humitureControllers.Average(x => x.LastData.Humidity);
Current_Temperate = temp.Temperate; Current_Temperate = RobotManage.humitureControllers.Average(x => x.LastData.Temperate);
//var tempIsOK = Current_Temperate < ServerCM.Max_Temperature; //var tempIsOK = Current_Temperate < ServerCM.Max_Temperature;
var humiNeedStart = Current_Humidity > ServerCM.Max_Humidity - Setting_Init.Device_HumidityStartOffser; var humiNeedStart = Current_Humidity > ServerCM.Max_Humidity - Setting_Init.Device_HumidityStartOffser;
...@@ -148,8 +148,8 @@ namespace DeviceLibrary ...@@ -148,8 +148,8 @@ namespace DeviceLibrary
DateTime lastTHoutRangeTime = DateTime.MaxValue; DateTime lastTHoutRangeTime = DateTime.MaxValue;
bool IsTHoutRange() bool IsTHoutRange()
{ {
if (HumitureController.LastData.Humidity > ServerCM.Max_Humidity// || HumitureController.LastData.Humidity < ServerCM.Min_Humidity if (RobotManage.humitureControllers.Average(x => x.LastData.Humidity) > ServerCM.Max_Humidity// || HumitureController.LastData.Humidity < ServerCM.Min_Humidity
|| HumitureController.LastData.Temperate > ServerCM.Max_Temperature) || RobotManage.humitureControllers.Average(x => x.LastData.Temperate) > ServerCM.Max_Temperature)
{ {
if (!lastTHoutRangeStatus) if (!lastTHoutRangeStatus)
lastTHoutRangeTime = DateTime.Now; lastTHoutRangeTime = DateTime.Now;
......
...@@ -28,6 +28,7 @@ namespace DeviceLibrary ...@@ -28,6 +28,7 @@ namespace DeviceLibrary
public static List<string> PositionNumList { get => CSVPositionReader<ACStorePosition>.allPositionMap.Keys.ToList(); } public static List<string> PositionNumList { get => CSVPositionReader<ACStorePosition>.allPositionMap.Keys.ToList(); }
static string baseDir = Application.StartupPath; static string baseDir = Application.StartupPath;
static Thread mainThread; static Thread mainThread;
public static List<HumitureController> humitureControllers = new List<HumitureController>();
public static HIKCamera CameraA=new HIKCamera(); public static HIKCamera CameraA=new HIKCamera();
...@@ -61,12 +62,22 @@ namespace DeviceLibrary ...@@ -61,12 +62,22 @@ namespace DeviceLibrary
IsLoadOk = false; IsLoadOk = false;
msg += "IO板卡初始化失败\n"; msg += "IO板卡初始化失败\n";
} }
var hports = Setting_Init.Device_Humiture_Port.Val.Split(',');
if (!HumitureController.Init(Setting_Init.Device_Humiture_Port)) foreach(var p in hports)
{
var hc = new HumitureController();
if (!hc.Init(p))
{ {
LogUtil.info("尝试打开端口:" + p+" 失败");
IsLoadOk = false; IsLoadOk = false;
msg += "温湿度传感器初始化失败,端口:" + $"{Setting_Init.Device_Humiture_Port}\n"; msg += "温湿度传感器初始化失败,端口:" + $"{p}\n";
}
else {
LogUtil.info("尝试打开端口:" + p + " 成功");
humitureControllers.Add(hc);
} }
}
//if (StoreType == StoreType.TypeA) //if (StoreType == StoreType.TypeA)
//{ //{
...@@ -78,12 +89,12 @@ namespace DeviceLibrary ...@@ -78,12 +89,12 @@ namespace DeviceLibrary
//} //}
if (!CameraA.LoadCameraConfig("CameraA", out string errmsg)) if (!CameraA.LoadCameraConfig("CameraA", out string errmsg))
{ {
IsLoadOk = false; //IsLoadOk = false;
msg += errmsg + "\r\n"; msg += errmsg + "\r\n";
} }
if (!CameraB.LoadCameraConfig("CameraB", out errmsg)) if (!CameraB.LoadCameraConfig("CameraB", out errmsg))
{ {
IsLoadOk = false; //IsLoadOk = false;
msg += errmsg+"\r\n"; msg += errmsg+"\r\n";
} }
......
...@@ -41,6 +41,7 @@ namespace TheMachine ...@@ -41,6 +41,7 @@ namespace TheMachine
this.tabPage1 = new System.Windows.Forms.TabPage(); this.tabPage1 = new System.Windows.Forms.TabPage();
this.pictureBox2 = new System.Windows.Forms.PictureBox(); this.pictureBox2 = new System.Windows.Forms.PictureBox();
this.pictureBox1 = new System.Windows.Forms.PictureBox(); this.pictureBox1 = new System.Windows.Forms.PictureBox();
this.btn_opendoor = new System.Windows.Forms.Button();
this.btn_IgnoreX09 = new System.Windows.Forms.Button(); this.btn_IgnoreX09 = new System.Windows.Forms.Button();
this.btn_PauseBuzzer = new System.Windows.Forms.Button(); this.btn_PauseBuzzer = new System.Windows.Forms.Button();
this.cb_EnableBuzzer = new System.Windows.Forms.CheckBox(); this.cb_EnableBuzzer = new System.Windows.Forms.CheckBox();
...@@ -51,7 +52,6 @@ namespace TheMachine ...@@ -51,7 +52,6 @@ namespace TheMachine
this.listView1 = new System.Windows.Forms.ListView(); this.listView1 = new System.Windows.Forms.ListView();
this.btn_stop = new System.Windows.Forms.Button(); this.btn_stop = new System.Windows.Forms.Button();
this.btn_run = new System.Windows.Forms.Button(); this.btn_run = new System.Windows.Forms.Button();
this.btn_opendoor = new System.Windows.Forms.Button();
this.menuStrip1.SuspendLayout(); this.menuStrip1.SuspendLayout();
this.tabControl1.SuspendLayout(); this.tabControl1.SuspendLayout();
this.tabPage1.SuspendLayout(); this.tabPage1.SuspendLayout();
...@@ -183,6 +183,17 @@ namespace TheMachine ...@@ -183,6 +183,17 @@ namespace TheMachine
this.pictureBox1.DoubleClick += new System.EventHandler(this.pictureBox1_DoubleClick); this.pictureBox1.DoubleClick += new System.EventHandler(this.pictureBox1_DoubleClick);
this.pictureBox1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pictureBox1_MouseDown); this.pictureBox1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pictureBox1_MouseDown);
// //
// btn_opendoor
//
this.btn_opendoor.BackColor = System.Drawing.Color.White;
this.btn_opendoor.Location = new System.Drawing.Point(657, 236);
this.btn_opendoor.Name = "btn_opendoor";
this.btn_opendoor.Size = new System.Drawing.Size(201, 40);
this.btn_opendoor.TabIndex = 6;
this.btn_opendoor.Text = "解锁舱门";
this.btn_opendoor.UseVisualStyleBackColor = false;
this.btn_opendoor.Click += new System.EventHandler(this.btn_opendoor_Click);
//
// btn_IgnoreX09 // btn_IgnoreX09
// //
this.btn_IgnoreX09.BackColor = System.Drawing.Color.OrangeRed; this.btn_IgnoreX09.BackColor = System.Drawing.Color.OrangeRed;
...@@ -301,18 +312,6 @@ namespace TheMachine ...@@ -301,18 +312,6 @@ namespace TheMachine
this.btn_run.UseVisualStyleBackColor = true; this.btn_run.UseVisualStyleBackColor = true;
this.btn_run.Click += new System.EventHandler(this.btn_run_Click); this.btn_run.Click += new System.EventHandler(this.btn_run_Click);
// //
// btn_opendoor
//
this.btn_opendoor.BackColor = System.Drawing.Color.White;
this.btn_opendoor.Location = new System.Drawing.Point(657, 236);
this.btn_opendoor.Name = "btn_opendoor";
this.btn_opendoor.Size = new System.Drawing.Size(201, 40);
this.btn_opendoor.TabIndex = 6;
this.btn_opendoor.Text = "解锁舱门";
this.btn_opendoor.UseVisualStyleBackColor = false;
this.btn_opendoor.Visible = false;
this.btn_opendoor.Click += new System.EventHandler(this.btn_opendoor_Click);
//
// Form1 // Form1
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 14F); this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 14F);
......
...@@ -67,7 +67,6 @@ namespace TheMachine ...@@ -67,7 +67,6 @@ namespace TheMachine
// //
// timer1 // timer1
// //
this.timer1.Enabled = true;
this.timer1.Interval = 1500; this.timer1.Interval = 1500;
this.timer1.Tick += new System.EventHandler(this.timer1_Tick); this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
// //
......
...@@ -19,14 +19,32 @@ namespace TheMachine ...@@ -19,14 +19,32 @@ namespace TheMachine
public FrmReleaseDoor() public FrmReleaseDoor()
{ {
InitializeComponent(); InitializeComponent();
this.FormClosing += FrmReleaseDoor_FormClosing;
}
private void FrmReleaseDoor_FormClosing(object sender, FormClosingEventArgs e)
{
if (IOManager.IOValue(IO_Type.FrontDoor_Check).Equals(IO_VALUE.HIGH) && IOManager.IOValue(IO_Type.BackDoor_Check).Equals(IO_VALUE.HIGH))
{
timer1.Stop();
IOManager.IOMove(IO_Type.SafeDoor_Lock, IO_VALUE.HIGH);
Thread.Sleep(200);
IOManager.IOMove(IO_Type.SafeDoor_Lock, IO_VALUE.HIGH);
IOManager.IOMove(IO_Type.AirValve_Open, IO_VALUE.LOW);
}
else
{
e.Cancel = true;
MessageBox.Show("请先关闭料仓门");
}
} }
private void timer1_Tick(object sender, EventArgs e) private void timer1_Tick(object sender, EventArgs e)
{ {
IOManager.IOMove(IO_Type.AirValve_Open, IO_VALUE.HIGH); IOManager.IOMove(IO_Type.AirValve_Open, IO_VALUE.HIGH);
IOManager.IOMove(IO_Type.AirValue, IO_VALUE.LOW); IOManager.IOMove(IO_Type.AirValue, IO_VALUE.LOW);
var dd=HumitureController.QueryData(); var dd= RobotManage.humitureControllers.Average(x => x.LastData.OxygenV);
var nitrogen = 100- dd.OxygenV-1; var nitrogen = 100- dd-1;
if (nitrogen <= Setting_Init.Nitrogen_Safe_Maximum) { if (nitrogen <= Setting_Init.Nitrogen_Safe_Maximum) {
IOManager.IOMove(IO_Type.SafeDoor_Lock, IO_VALUE.LOW); IOManager.IOMove(IO_Type.SafeDoor_Lock, IO_VALUE.LOW);
...@@ -45,23 +63,14 @@ namespace TheMachine ...@@ -45,23 +63,14 @@ namespace TheMachine
IOManager.IOMove(IO_Type.AirValve_Open, IO_VALUE.HIGH); IOManager.IOMove(IO_Type.AirValve_Open, IO_VALUE.HIGH);
Thread.Sleep(1000); Thread.Sleep(1000);
IOManager.IOMove(IO_Type.AirValue, IO_VALUE.LOW); IOManager.IOMove(IO_Type.AirValue, IO_VALUE.LOW);
timer1.Start();
} }
private void btn_cancel_Click(object sender, EventArgs e) private void btn_cancel_Click(object sender, EventArgs e)
{ {
if (IOManager.IOValue(IO_Type.FrontDoor_Check).Equals(IO_VALUE.HIGH) && IOManager.IOValue(IO_Type.BackDoor_Check).Equals(IO_VALUE.HIGH))
{
timer1.Stop();
IOManager.IOMove(IO_Type.SafeDoor_Lock, IO_VALUE.HIGH);
Thread.Sleep(200);
IOManager.IOMove(IO_Type.SafeDoor_Lock, IO_VALUE.HIGH);
IOManager.IOMove(IO_Type.AirValve_Open, IO_VALUE.LOW);
this.Close(); this.Close();
}
else
{
MessageBox.Show("请先关闭料仓门");
}
} }
} }
} }
...@@ -38,11 +38,9 @@ namespace TheMachine ...@@ -38,11 +38,9 @@ namespace TheMachine
this.label3 = new System.Windows.Forms.Label(); this.label3 = new System.Windows.Forms.Label();
this.button1 = new System.Windows.Forms.Button(); this.button1 = new System.Windows.Forms.Button();
this.tp = new System.Windows.Forms.TableLayoutPanel(); this.tp = new System.Windows.Forms.TableLayoutPanel();
this.label_tempsensor = new System.Windows.Forms.Label();
this.cb_tempsensorport = new System.Windows.Forms.ComboBox();
this.lbl_hmdstate = new System.Windows.Forms.Label();
this.chbAutoRun = new System.Windows.Forms.CheckBox(); this.chbAutoRun = new System.Windows.Forms.CheckBox();
this.timer1 = new System.Windows.Forms.Timer(this.components); this.timer1 = new System.Windows.Forms.Timer(this.components);
this.lbl_hmdstate = new System.Windows.Forms.Label();
this.groupBox1.SuspendLayout(); this.groupBox1.SuspendLayout();
this.tp.SuspendLayout(); this.tp.SuspendLayout();
this.SuspendLayout(); this.SuspendLayout();
...@@ -91,7 +89,7 @@ namespace TheMachine ...@@ -91,7 +89,7 @@ namespace TheMachine
this.groupBox1.Controls.Add(this.cb_leftmode); this.groupBox1.Controls.Add(this.cb_leftmode);
this.groupBox1.Controls.Add(this.label1); this.groupBox1.Controls.Add(this.label1);
this.groupBox1.Controls.Add(this.cb_rightmode); this.groupBox1.Controls.Add(this.cb_rightmode);
this.groupBox1.Location = new System.Drawing.Point(3, 135); this.groupBox1.Location = new System.Drawing.Point(3, 72);
this.groupBox1.Name = "groupBox1"; this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(363, 204); this.groupBox1.Size = new System.Drawing.Size(363, 204);
this.groupBox1.TabIndex = 4; this.groupBox1.TabIndex = 4;
...@@ -124,9 +122,6 @@ namespace TheMachine ...@@ -124,9 +122,6 @@ namespace TheMachine
this.tp.ColumnCount = 2; this.tp.ColumnCount = 2;
this.tp.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F)); this.tp.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
this.tp.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F)); this.tp.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
this.tp.Controls.Add(this.label_tempsensor, 0, 0);
this.tp.Controls.Add(this.cb_tempsensorport, 1, 0);
this.tp.Controls.Add(this.lbl_hmdstate, 0, 4);
this.tp.Controls.Add(this.chbAutoRun, 0, 7); this.tp.Controls.Add(this.chbAutoRun, 0, 7);
this.tp.Location = new System.Drawing.Point(3, 3); this.tp.Location = new System.Drawing.Point(3, 3);
this.tp.Name = "tp"; this.tp.Name = "tp";
...@@ -140,50 +135,14 @@ namespace TheMachine ...@@ -140,50 +135,14 @@ namespace TheMachine
this.tp.RowStyles.Add(new System.Windows.Forms.RowStyle()); this.tp.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tp.RowStyles.Add(new System.Windows.Forms.RowStyle()); this.tp.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tp.RowStyles.Add(new System.Windows.Forms.RowStyle()); this.tp.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tp.Size = new System.Drawing.Size(328, 112); this.tp.Size = new System.Drawing.Size(128, 40);
this.tp.TabIndex = 7; this.tp.TabIndex = 7;
// //
// label_tempsensor
//
this.label_tempsensor.AutoSize = true;
this.label_tempsensor.Cursor = System.Windows.Forms.Cursors.Default;
this.label_tempsensor.Location = new System.Drawing.Point(10, 10);
this.label_tempsensor.Margin = new System.Windows.Forms.Padding(10);
this.label_tempsensor.Name = "label_tempsensor";
this.label_tempsensor.Size = new System.Drawing.Size(144, 16);
this.label_tempsensor.TabIndex = 3;
this.label_tempsensor.Text = "温湿度控制器端口:";
this.label_tempsensor.TextAlign = System.Drawing.ContentAlignment.TopRight;
//
// cb_tempsensorport
//
this.cb_tempsensorport.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cb_tempsensorport.FormattingEnabled = true;
this.cb_tempsensorport.Location = new System.Drawing.Point(170, 6);
this.cb_tempsensorport.Margin = new System.Windows.Forms.Padding(6);
this.cb_tempsensorport.Name = "cb_tempsensorport";
this.cb_tempsensorport.Size = new System.Drawing.Size(121, 24);
this.cb_tempsensorport.TabIndex = 2;
this.cb_tempsensorport.Tag = "not";
this.cb_tempsensorport.SelectedIndexChanged += new System.EventHandler(this.cb_tempsensorport_SelectedIndexChanged);
//
// lbl_hmdstate
//
this.lbl_hmdstate.AutoSize = true;
this.tp.SetColumnSpan(this.lbl_hmdstate, 2);
this.lbl_hmdstate.Location = new System.Drawing.Point(10, 46);
this.lbl_hmdstate.Margin = new System.Windows.Forms.Padding(10);
this.lbl_hmdstate.Name = "lbl_hmdstate";
this.lbl_hmdstate.Size = new System.Drawing.Size(72, 16);
this.lbl_hmdstate.TabIndex = 5;
this.lbl_hmdstate.Tag = "not";
this.lbl_hmdstate.Text = "当前状态";
//
// chbAutoRun // chbAutoRun
// //
this.chbAutoRun.AutoSize = true; this.chbAutoRun.AutoSize = true;
this.tp.SetColumnSpan(this.chbAutoRun, 2); this.tp.SetColumnSpan(this.chbAutoRun, 2);
this.chbAutoRun.Location = new System.Drawing.Point(10, 82); this.chbAutoRun.Location = new System.Drawing.Point(10, 10);
this.chbAutoRun.Margin = new System.Windows.Forms.Padding(10); this.chbAutoRun.Margin = new System.Windows.Forms.Padding(10);
this.chbAutoRun.Name = "chbAutoRun"; this.chbAutoRun.Name = "chbAutoRun";
this.chbAutoRun.Size = new System.Drawing.Size(107, 20); this.chbAutoRun.Size = new System.Drawing.Size(107, 20);
...@@ -197,9 +156,18 @@ namespace TheMachine ...@@ -197,9 +156,18 @@ namespace TheMachine
this.timer1.Interval = 1000; this.timer1.Interval = 1000;
this.timer1.Tick += new System.EventHandler(this.timer1_Tick); this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
// //
// lbl_hmdstate
//
this.lbl_hmdstate.Location = new System.Drawing.Point(10, 299);
this.lbl_hmdstate.Name = "lbl_hmdstate";
this.lbl_hmdstate.Size = new System.Drawing.Size(405, 145);
this.lbl_hmdstate.TabIndex = 8;
this.lbl_hmdstate.Text = "label4";
//
// SettingControl // SettingControl
// //
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.Controls.Add(this.lbl_hmdstate);
this.Controls.Add(this.tp); this.Controls.Add(this.tp);
this.Controls.Add(this.groupBox1); this.Controls.Add(this.groupBox1);
this.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
...@@ -224,10 +192,8 @@ namespace TheMachine ...@@ -224,10 +192,8 @@ namespace TheMachine
private System.Windows.Forms.Label label3; private System.Windows.Forms.Label label3;
private System.Windows.Forms.Button button1; private System.Windows.Forms.Button button1;
private System.Windows.Forms.TableLayoutPanel tp; private System.Windows.Forms.TableLayoutPanel tp;
private System.Windows.Forms.Label label_tempsensor;
private System.Windows.Forms.ComboBox cb_tempsensorport;
private System.Windows.Forms.Label lbl_hmdstate;
private System.Windows.Forms.CheckBox chbAutoRun; private System.Windows.Forms.CheckBox chbAutoRun;
private System.Windows.Forms.Timer timer1; private System.Windows.Forms.Timer timer1;
private System.Windows.Forms.Label lbl_hmdstate;
} }
} }
...@@ -28,10 +28,7 @@ namespace TheMachine ...@@ -28,10 +28,7 @@ namespace TheMachine
this.chbAutoRun.CheckedChanged += new System.EventHandler(this.chbAutoRun_CheckedChanged); this.chbAutoRun.CheckedChanged += new System.EventHandler(this.chbAutoRun_CheckedChanged);
//chbAutoRun.Enabled = true; //chbAutoRun.Enabled = true;
for (int i = 0; i < 20; i++)
{
cb_tempsensorport.Items.Add("COM" + i);
}
} }
private void RobotManage_LoadFinishEvent(bool state, string msg) private void RobotManage_LoadFinishEvent(bool state, string msg)
...@@ -49,7 +46,7 @@ namespace TheMachine ...@@ -49,7 +46,7 @@ namespace TheMachine
cb_rightmode.Items.AddRange(InOutModeItem.Items); cb_rightmode.Items.AddRange(InOutModeItem.Items);
cb_rightmode.SelectedIndex = (int)((InOutModeE)Setting_Init.Device_RightInoutMode); cb_rightmode.SelectedIndex = (int)((InOutModeE)Setting_Init.Device_RightInoutMode);
Config.PropertyBind(Setting_Init.Device_Humiture_Port.Key, cb_tempsensorport, "SelectedItem", "SelectedIndexChanged"); //Config.PropertyBind(Setting_Init.Device_Humiture_Port.Key, cb_tempsensorport, "SelectedItem", "SelectedIndexChanged");
} }
...@@ -113,24 +110,23 @@ namespace TheMachine ...@@ -113,24 +110,23 @@ namespace TheMachine
Setting_Init.Device_RightInoutMode = ((InOutModeItem)cb_rightmode.SelectedItem).inOutModeItem; Setting_Init.Device_RightInoutMode = ((InOutModeItem)cb_rightmode.SelectedItem).inOutModeItem;
} }
private void cb_tempsensorport_SelectedIndexChanged(object sender, EventArgs e)
{
HumitureController.Init(Setting_Init.Device_Humiture_Port);
}
private void timer1_Tick(object sender, EventArgs e) private void timer1_Tick(object sender, EventArgs e)
{ {
if (!Visible) if (!Visible)
return; return;
lbl_hmdstate.Text = "当前配置端口:" + Setting_Init.Device_Humiture_Port;
lbl_hmdstate.Text = "当前状态:"; lbl_hmdstate.Text = "\r\n当前状态:";
if (!HumitureController.IsRun) for (int i = 0; i < RobotManage.humitureControllers.Count; i++)
{ {
lbl_hmdstate.Text += "未成功连接"; lbl_hmdstate.Text += "\r\n\t端口:" + RobotManage.humitureControllers[i].serialPort;
return; if (!RobotManage.humitureControllers[i].IsRun)
{
lbl_hmdstate.Text += ", 未成功连接";
}
var t = RobotManage.humitureControllers[i].LastData;
lbl_hmdstate.Text += ", 温度" + $":{t.Temperate}℃, " + "湿度" + $":{t.Humidity}%, " + "氮气" + $":{100 - t.OxygenV - 1}%";
} }
var t = HumitureController.LastData;
lbl_hmdstate.Text += "温度"+$":{t.Temperate}℃, "+ "湿度"+$":{t.Humidity}%, " + "氮气" + $":{100-t.OxygenV-1}%";
} }
} }
} }
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!