FrmReleaseDoor.cs
2.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
using OnlineStore.Common;
using OnlineStore.DeviceLibrary;
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 OnlineStore.XLRStore
{
public partial class FrmReleaseDoor : Form
{
public FrmReleaseDoor()
{
InitializeComponent();
this.FormClosing += FrmReleaseDoor_FormClosing;
}
private void FrmReleaseDoor_FormClosing(object sender, FormClosingEventArgs e)
{
if (IOManager.IOValue(IO_Type.LeftDoor_Limit, 2).Equals(IO_VALUE.HIGH) && IOManager.IOValue(IO_Type.RightDoor_Limit, 2).Equals(IO_VALUE.HIGH) && IOManager.IOValue(IO_Type.BackDoor_Limit, 2).Equals(IO_VALUE.HIGH))
{
timer1.Stop();
IOManager.IOMove(IO_Type.SafeDoor_Close, IO_VALUE.HIGH, 1);
Thread.Sleep(200);
IOManager.IOMove(IO_Type.SafeDoor_Close, IO_VALUE.HIGH, 1);
IOManager.IOMove(IO_Type.Air_OpenValve, IO_VALUE.LOW, 1);
}
else
{
e.Cancel = true;
MessageBox.Show("请先关闭料仓门");
}
}
private void timer1_Tick(object sender, EventArgs e)
{
IOManager.IOMove(IO_Type.Air_OpenValve, IO_VALUE.HIGH,1);
IOManager.IOMove(IO_Type.Nitrogen_OpenValve, IO_VALUE.HIGH,1);
var dd= HumitureBean.GetMinOxygenV();
var nitrogen = 100- dd;
if (nitrogen <= StoreManager.XLRStore.boxEquip.Config.Nitrogen_Safe_Maximum) {
IOManager.IOMove(IO_Type.SafeDoor_Close, IO_VALUE.LOW,1);
}
lbl_airstatus.Text = $"当前氮气含量:{nitrogen:0.0}%, 等待低于{StoreManager.XLRStore.boxEquip.Config.Nitrogen_Safe_Maximum}%后解锁舱门";
var islock = IOManager.IOValue(IO_Type.SafeDoor_Close,1).Equals(IO_VALUE.HIGH);
var isair = IOManager.IOValue(IO_Type.Air_OpenValve,1).Equals(IO_VALUE.HIGH);
lbl_lockstatus.Text = $"当前门锁状态:{(islock ? "已锁门" : "已解锁")}\r\n空气阀状态:{(isair ? "已打开" : "已关闭")}";
}
private void FrmReleaseDoor_Load(object sender, EventArgs e)
{
LogUtil.info("请求打开舱门开始");
IOManager.IOMove(IO_Type.Air_OpenValve, IO_VALUE.HIGH, 1);
Thread.Sleep(1000);
IOManager.IOMove(IO_Type.Nitrogen_OpenValve, IO_VALUE.HIGH, 1);
timer1.Start();
}
private void btn_cancel_Click(object sender, EventArgs e)
{
this.Close();
}
}
}