Commit 30ce5a84 刘韬

1

1 个父辈 a6c3be72
......@@ -54,6 +54,8 @@ namespace OnlineStore.Common
[MyConfigComment("扫码读码匹配参数")]
public static MyConfig<string> CodeScan_ParamPath = "Conifg\\";
[MyConfigComment("允许解锁安全门的氮气阈值")]
public static MyConfig<double> Nitrogen_Safe_Maximum = 80;
}
public enum StoreType
......
......@@ -90,14 +90,14 @@ namespace OnlineStore.Common
}
IsRun = false;
}
public static ASTemperateParam LastData = new ASTemperateParam(0, 0);
public static ASTemperateParam LastData = new ASTemperateParam(0, 0,0);
public static ASTemperateParam QueryData()
{
ASTemperateParam param = new ASTemperateParam(0, 0);
ASTemperateParam param = new ASTemperateParam(0, 0, 0);
List<double> data = queryData();
if (data.Count.Equals(2))
if (data.Count.Equals(3))
{
param = new ASTemperateParam(data[1], data[0]);
param = new ASTemperateParam(data[1], data[0], data[2]);
}
LastData = param;
return param;
......@@ -130,7 +130,7 @@ namespace OnlineStore.Common
sendData[2] = 0x00;
sendData[3] = 0x00;
sendData[4] = 0x00;
sendData[5] = 0x02;
sendData[5] = 0x03;
sendData[6] = 0x00;
sendData[7] = 0x00;
sendData = buildCheckData(sendData, sendData.Length - 2);
......@@ -143,115 +143,7 @@ namespace OnlineStore.Common
}
public static int QueryHistoryCount()
{
if (IsRun.Equals(false) || HumitureControllerType.Equals(2).Equals(false))
{
return -1;
}
byte[] sendData = new byte[8];
sendData[0] = 0x01;
sendData[1] = 0x04;
sendData[2] = 0x20;
sendData[3] = 0x00;
byte[] addrByte = AcSerialBean.StringToByte("2000");
if (addrByte.Length == 1)
{
sendData[2] = 0x00;
sendData[3] = addrByte[0];
}
else if (addrByte.Length == 2)
{
sendData[3] = addrByte[1];
sendData[2] = addrByte[0];
}
sendData[4] = 0x00;
sendData[5] = 0x02;
sendData[6] = 0x00;
sendData[7] = 0x00;
sendData = buildCheckData(sendData, sendData.Length - 2);
string str = AcSerialBean.byteToHexStr(sendData);
LogUtil.debug("温湿度控制器发送数据:" + str);
byte[] reviceData = new byte[9];
bool isOk = false;
sb.SendCommand(sendData, ref reviceData, 100, out isOk);
return getReviceIntData(reviceData);
}
public static int QueryCurrCount()
{
if (IsRun.Equals(false) || HumitureControllerType.Equals(2).Equals(false))
{
return -1;
}
byte[] sendData = new byte[8];
sendData[0] = 0x01;
sendData[1] = 0x04;
sendData[2] = 0x20;
sendData[3] = 0x02;
sendData[4] = 0x00;
sendData[5] = 0x02;
sendData[6] = 0x00;
sendData[7] = 0x00;
sendData = buildCheckData(sendData, sendData.Length - 2);
string str = AcSerialBean.byteToHexStr(sendData);
LogUtil.debug("温湿度控制器发送数据:" + str);
byte[] reviceData = new byte[9];
bool isOk = false;
sb.SendCommand(sendData, ref reviceData, 100, out isOk);
return getReviceIntData(reviceData);
}
public static List<object> QueryHistory()
{
List<object> list = new List<object>();
if (IsRun.Equals(false)||HumitureControllerType.Equals(2).Equals(false))
{
return list;
}
byte[] sendData = new byte[8];
sendData[0] = 0x01;
sendData[1] = 0x04;
sendData[2] = 0x20;
sendData[3] = 0x04;
sendData[4] = 0x00;
sendData[5] = 0x05;
sendData[6] = 0x00;
sendData[7] = 0x00;
sendData = buildCheckData(sendData, sendData.Length - 2);
string str = AcSerialBean.byteToHexStr(sendData);
LogUtil.debug("温湿度控制器发送数据:" + str);
byte[] reviceData = new byte[15];
bool isOk = false;
sb.SendCommand(sendData, ref reviceData, 100, out isOk);
try
{
if (reviceData != null && reviceData.Length >= 9)
{
string temp = String.Format("{0:X2}", reviceData[3]) + String.Format("{0:X2}", reviceData[4]);
string hum = String.Format("{0:X2}", reviceData[5]) + String.Format("{0:X2}", reviceData[6]);
double tempV = (double)Convert.ToInt32(temp, 16) / 10;
double humV = (double)Convert.ToInt32(hum, 16) / 10;
int year = Convert.ToInt32(String.Format("{0:X2}", reviceData[7]), 16);
int mouth = Convert.ToInt32(String.Format("{0:X2}", reviceData[8]), 16);
int day = Convert.ToInt32(String.Format("{0:X2}", reviceData[9]), 16);
int hour = Convert.ToInt32(String.Format("{0:X2}", reviceData[10]), 16);
int minute = Convert.ToInt32(String.Format("{0:X2}", reviceData[11]), 16);
int second = Convert.ToInt32(String.Format("{0:X2}", reviceData[12]), 16);
DateTime time = new DateTime(year, mouth, day, hour, minute, second);
list.Add(tempV);
list.Add(humV);
list.Add(time);
}
}
catch (Exception ex)
{
LOGGER.Info(LogName + "转换出错:" + ex.ToString());
}
return list;
}
private static byte[] buildCheckData(byte[] sendData, int length)
......@@ -274,29 +166,6 @@ namespace OnlineStore.Common
return sendData;
}
private static int getReviceIntData(byte[] dataArray)
{
List<double> list = new List<double>();
try
{
if (dataArray == null)
{
return -1;
}
if (dataArray.Length >= 9)
{
string data = String.Format("{0:X2}", dataArray[5]) + String.Format("{0:X2}", dataArray[6]+String.Format("{0:X2}", dataArray[3]) + String.Format("{0:X2}", dataArray[4]) );
int tempV = Convert.ToInt32(data, 16);
return tempV;
}
}
catch (Exception ex)
{
LOGGER.Info(LogName + "转换出错:" + ex.ToString());
}
return -1;
}
private static List<double> getReviceData(byte[] dataArray)
{
List<double> list = new List<double>();
......@@ -311,10 +180,13 @@ namespace OnlineStore.Common
string temp = String.Format("{0:X2}", dataArray[3])+ String.Format("{0:X2}", dataArray[4]);
string hum = String.Format("{0:X2}", dataArray[5]) + String.Format("{0:X2}", dataArray[6]);
string Oxygen = String.Format("{0:X2}", dataArray[7]) + String.Format("{0:X2}", dataArray[8]);
double tempV = (double)Convert.ToInt32(temp, 16)/10;
double humV =(double) Convert.ToInt32(hum, 16)/10;
double OxygenV = (double) Convert.ToInt32(Oxygen, 16)/10;
list.Add(tempV);
list.Add(humV);
list.Add(OxygenV);
}
}
catch (Exception ex)
......
......@@ -31,49 +31,6 @@ namespace OnlineStore.Common
return temperate;
}
/// <summary>
/// 显示用的温湿度信息(改为计算平均温湿度)
/// </summary>
public static ASTemperateParam GetTemperateParam(List<string> ipAddrList)
{
ASTemperateParam temperate = null;
int allCount = 0;
double wenDu = 0;
double shiDu = 0;
foreach (string addr in ipAddrList)
{
ASTemperateParam param = GetTemperateParam(addr);
if (param != null && param.IsValid())
{
allCount++;
wenDu = wenDu + param.Temperate;
shiDu = shiDu + param.Humidity;
}
}
if (allCount > 0)
{
double avgWendu = Math.Round(wenDu / allCount, 1);
double avgShidu = Math.Round(shiDu / allCount, 1);
temperate = new ASTemperateParam(avgWendu, avgShidu);
}
return temperate;
}
public static double GetMaxHumidity(List<string> ipAddrList)
{
double maxValue = 0;
foreach (string addr in ipAddrList)
{
ASTemperateParam param = GetTemperateParam(addr);
if (param != null && param.IsValid())
{
if (param.Humidity > maxValue)
{
maxValue = param.Humidity;
}
}
}
return maxValue;
}
/// <summary>
/// 温湿度传感器服务器
/// </summary>
private static UdpServer temperateTcpServer = null;
......@@ -225,13 +182,14 @@ namespace OnlineStore.Common
this.UpdateTime = updateTime;
}
//获取平均值时使用此 参数,只做显示用
public ASTemperateParam(double wendu, double shidu)
public ASTemperateParam(double wendu, double shidu,double oxygenV)
{
this.IpAddress = "";
this.DeviceAddress = "";
this.Password = "";
this.Temperate = wendu;
this.Humidity = shidu;
this.OxygenV = oxygenV;
this.UpdateTime = DateTime.Now;
}
/// <summary>
......@@ -272,5 +230,9 @@ namespace OnlineStore.Common
/// 湿度
/// </summary>
public double Humidity { get; set; }
/// <summary>
/// 氧含量
/// </summary>
public double OxygenV { get; set; }
}
}
......@@ -70,7 +70,7 @@ namespace DeviceLibrary
}
private static void LoadCamera(bool isReLoad)
public static void LoadCamera(bool isReLoad)
{
if (isReLoad || Camera._cam == null)
{
......@@ -155,7 +155,7 @@ namespace DeviceLibrary
continue;
retrytime++;
LogUtil.info($"bitmap为空重试第{retrytime}次");
CloseCamera(cameraName);
LoadCamera(true);
Task.Delay(1500).Wait();
goto retry;
}
......
......@@ -21,7 +21,7 @@ namespace DeviceLibrary
/// <summary>
/// 干涉检测回调 from, to
/// </summary>
public event Func<int,int,(bool,string)> interference;
public event Func<int, int, (bool, string)> interference;
public string AxisName;
public bool ForceSafeCheck = false;
public AxisBean(ConfigMoveAxis axisConfig, string deviceName)
......@@ -92,7 +92,7 @@ namespace DeviceLibrary
LogUtil.info("ServoOff【" + AxisName + "】");
AxisManager.ServoOff(Config.DeviceName, Config.GetAxisValue());
}
public void HomeMove(MoveInfo MoveInfo,bool force=true)
public void HomeMove(MoveInfo MoveInfo, bool force = true)
{
if (!force && AxisManager.GetHomeEndStatus(Config.DeviceName, (short)Config.GetAxisValue()) == 3)
{
......@@ -101,8 +101,12 @@ namespace DeviceLibrary
}
Config.TargetPosition = 0;
LogUtil.info(AxisName + "speed[" + Config.HomeHighSpeed + "]开始原点返回");
MoveInfo.WaitList.Add(WaitResultInfo.WaitAxis(Config, true));
AxisManager.HomeMove(Config.DeviceName, (short)Config.GetAxisValue(), Config.HomeHighSpeed, Config.HomeLowSpeed, Config.HomeAddSpeed);
if (MoveInfo != null)
MoveInfo.WaitList.Add(WaitResultInfo.WaitAxis(Config, true));
var HomeLowSpeed = Config.HomeLowSpeed > 0 ? Config.HomeLowSpeed : Config.HomeHighSpeed / 10;
var HomeAddSpeed = Config.HomeAddSpeed > 0 ? Config.HomeAddSpeed : Config.HomeHighSpeed * 5;
AxisManager.HomeMove(Config.DeviceName, (short)Config.GetAxisValue(), Config.HomeHighSpeed, HomeLowSpeed, HomeAddSpeed);
}
/// <summary>
......@@ -111,9 +115,12 @@ namespace DeviceLibrary
public void AbsMove(MoveInfo MoveInfo, int targetPosition, int targetSpeed)
{
if (IsInPosition(targetPosition))
{
LogUtil.info(AxisName + $" 已在目标点:{targetPosition}");
return;
}
if (ForceSafeCheck && !IsSafe(targetPosition,out string msg))
if (ForceSafeCheck && !IsSafe(targetPosition, out string msg))
{
Msg.add(msg, MsgLevel.alarm);
RobotManage.UserPause(msg);
......@@ -129,7 +136,9 @@ namespace DeviceLibrary
{
MoveInfo.WaitList.Add(WaitResultInfo.WaitAxis(Config, targetPosition, targetSpeed));
Config.TargetPosition = targetPosition;
AxisManager.AbsMove(Config.DeviceName, Config.GetAxisValue(), targetPosition, targetSpeed, targetSpeed * 4, targetSpeed * 4);// Config.AddSpeed, Config.DelSpeed);
var AddSpeed = Config.AddSpeed > 0 ? Config.AddSpeed : targetSpeed * 4;
var DelSpeed = Config.DelSpeed > 0 ? Config.DelSpeed : targetSpeed * 4;
AxisManager.AbsMove(Config.DeviceName, Config.GetAxisValue(), targetPosition, targetSpeed, AddSpeed, DelSpeed);// Config.AddSpeed, Config.DelSpeed);
}
}
......@@ -179,7 +188,9 @@ namespace DeviceLibrary
Thread.Sleep(100);
}
LogUtil.error($"{ MoveInfo.Name} {MoveInfo.MoveStep} {axis.DisplayStr}目标位置{targetPosition}当前位置{outCount},误差过大,{clearMsg}重新开始运动,剩余{MoveInfo.CanWhileCount}次");
AxisManager.AbsMove(axis.DeviceName, axis.GetAxisValue(), targetPosition, targetSpeed, targetSpeed * 4, targetSpeed * 4);// , axis.AddSpeed, axis.DelSpeed);
var AddSpeed = axis.AddSpeed > 0 ? axis.AddSpeed : targetSpeed * 4;
var DelSpeed = axis.DelSpeed > 0 ? axis.DelSpeed : targetSpeed * 4;
AxisManager.AbsMove(axis.DeviceName, axis.GetAxisValue(), targetPosition, targetSpeed, AddSpeed, DelSpeed);// , axis.AddSpeed, axis.DelSpeed);
MoveInfo.CanWhileCount--;
Thread.Sleep(200);
}
......@@ -239,7 +250,7 @@ namespace DeviceLibrary
/// <summary>
/// 绝对运动至点,不等待结果
/// </summary>
private void AbsMove(int targetPos, double targetSpeed)
private void AbsMove(int targetPos, int targetSpeed)
{
if (targetPos.Equals(-1))
{
......@@ -255,7 +266,9 @@ namespace DeviceLibrary
{
targetSpeed = Config.TargetSpeed * targetSpeed;
}
AxisManager.AbsMove(Config.DeviceName, Config.GetAxisValue(), targetPos, (int)targetSpeed, (int)targetSpeed * 4, (int)targetSpeed * 4);// , Config.AddSpeed, Config.DelSpeed);
var AddSpeed = Config.AddSpeed > 0 ? Config.AddSpeed : targetSpeed * 4;
var DelSpeed = Config.DelSpeed > 0 ? Config.DelSpeed : targetSpeed * 4;
AxisManager.AbsMove(Config.DeviceName, Config.GetAxisValue(), targetPos, targetSpeed, AddSpeed, DelSpeed);// , Config.AddSpeed, Config.DelSpeed);
}
/// <summary>
......@@ -280,7 +293,8 @@ namespace DeviceLibrary
AxisManager.RelMove(Config.DeviceName, Config.GetAxisValue(), targetPos, (int)targetSpeed, (int)targetSpeed * 4, (int)targetSpeed * 4);// , Config.AddSpeed, Config.DelSpeed);
}
public bool IsBusy {
public bool IsBusy
{
get => AxisManager.GetBusyStatus(Config.DeviceName, Config.GetAxisValue()) == 1;
}
public bool IsServeoOn
......@@ -295,15 +309,17 @@ namespace DeviceLibrary
/// 判断轴运动是否安全
/// </summary>
/// <returns></returns>
public bool IsSafe(int Targetpos,out string msg) {
public bool IsSafe(int Targetpos, out string msg)
{
msg = "";
if (interference == null)
return true;
bool result;
var from = GetAclPosition();
(result,msg) = interference.Invoke(from, Targetpos);
(result, msg) = interference.Invoke(from, Targetpos);
if (result) {
if (result)
{
LogUtil.info(AxisName + $" 干涉:{msg},From:{from},To:{Targetpos}");
}
......@@ -313,19 +329,15 @@ namespace DeviceLibrary
#region 匀速上升处理
private System.Timers.Timer axisCheckTimer = null;
internal string TargetIoType = "";
internal string[] TargetIoType = new string[] { };
internal IO_VALUE TargetIoValue = IO_VALUE.HIGH;
public bool BatchAxisStartCheck(string targetIo, IO_VALUE value = IO_VALUE.HIGH)
public bool BatchAxisStartCheck(string[] targetIo, IO_VALUE value = IO_VALUE.HIGH)
{
if (String.IsNullOrEmpty(targetIo))
{
targetIo = "";
}
if (axisCheckTimer == null)
{
axisCheckTimer = new System.Timers.Timer();
axisCheckTimer.AutoReset = true;
axisCheckTimer.Interval += 30;
axisCheckTimer.Interval += 15;
axisCheckTimer.Elapsed += CheckTimer_Elapsed;
axisCheckTimer.Enabled = false;
}
......@@ -345,21 +357,21 @@ namespace DeviceLibrary
return true;
}
private bool IsInProcess = false;
private DateTime lastOkTime = DateTime.Now;
private void CheckTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
{
TimeSpan pan = DateTime.Now - lastOkTime;
if (IsInProcess && pan.TotalMilliseconds < 100) { return; }
if (IsInProcess) { return; }
try
{
IsInProcess = true;
lastOkTime = DateTime.Now;
if (IOManager.IOValue(TargetIoType).Equals(TargetIoValue))
foreach (var io in TargetIoType)
{
StopAxisCheckMove();
LogUtil.info(AxisName + "上料轴,检测到 " + TargetIoType + "=" + TargetIoValue + ",停止运动");
SuddenStop();
if (IOManager.IOValue(io).Equals(TargetIoValue))
{
SuddenStop();
StopAxisCheckMove();
LogUtil.info(AxisName + "上料轴,检测到 " + io + "=" + TargetIoValue + ",停止运动");
break;
}
}
}
catch (Exception ex)
......@@ -400,7 +412,7 @@ namespace DeviceLibrary
public static void CloseMultiAxis(List<AxisBean> axisArray)
{
foreach (AxisBean axis in axisArray)
{
{
axis.ServoOff();
Thread.Sleep(10);
}
......
......@@ -42,7 +42,7 @@ namespace DeviceLibrary
else
{
var timediff = DateTime.Now - lastBtnUpPressTime;
if (timediff.TotalSeconds < 1 && trueCount == 2) {
if (timediff.TotalSeconds < 3 && trueCount == 2) {
if (btnUP_L && btnUP_R)
{
BtnAction = BtnActionE.Mid_Up;
......@@ -100,7 +100,7 @@ namespace DeviceLibrary
else {
Msg.add(ld.Name + msg, MsgLevel.info);
}
}
}
}
......@@ -111,10 +111,17 @@ namespace DeviceLibrary
DateTime lastAirprocesstime = DateTime.Now;
void airprocess()
{
if (IOManager.IOValue(IO_Type.AirValve_Open).Equals(IO_VALUE.HIGH) || IOManager.IOValue(IO_Type.FrontDoor_Check).Equals(IO_VALUE.LOW) || IOManager.IOValue(IO_Type.BackDoor_Check).Equals(IO_VALUE.LOW))
{
IOMove(IO_Type.AirValue, IO_VALUE.LOW);
return;
}
if ((DateTime.Now - lastAirprocesstime).TotalSeconds < 5)
return;
lastAirprocesstime = DateTime.Now;
IOManager.IOMove(IO_Type.SafeDoor_Lock, IO_VALUE.HIGH);
//var temp = HumitureController.QueryData();
var temp = HumitureController.LastData;
Current_Humidity = temp.Humidity;
......
......@@ -103,7 +103,7 @@ namespace DeviceLibrary
};
//BoxTransport_InOutEndProcessEvent;
//ProcessMsgEvent += MainMachine_ProcessMsgEvent;
CodeManager.LoadCamera(true);
AlarmBuzzer.SetOnOffAction(() =>{ IOMove(IO_Type.Alarm_Buzzer, IO_VALUE.HIGH); }, () => { IOMove(IO_Type.Alarm_Buzzer, IO_VALUE.LOW); });
//IOMonitor.RegisterIO(IO_Type.OutLeave_BTN, Config, IO_VALUE.HIGH, OutLeave_BTN,2500,100);
......
......@@ -93,6 +93,7 @@ namespace DeviceLibrary
}
catch (Exception ex) {
LoadFinishEvent?.Invoke(false, ex.Message);
LogUtil.error(ex.Message);
return;
}
LoadFinishEvent?.Invoke(IsConfigMode ? IsConfigMode : IsLoadOk, msg);
......
......@@ -123,3 +123,5 @@ DO,0,右线体防护门上升,Right_Door_Up,26,HC,Y26,,,,,,,,,,
DO,0,右线体防护门下降,Right_Door_Down,27,HC,Y27,,,,,,,,,,
DO,0,分拣台上升,Mid_Up,28,HC,Y28,,,,,,,,,,
DO,0,分拣台下降,Mid_Down,29,HC,Y29,,,,,,,,,,
DO,0,安全门关闭,SafeDoor_Lock,30,HC,Y30,,,,,,,,,,
DO,0,空气阀门打开,AirValve_Open,31,HC,Y31,,,,,,,,,,
......@@ -338,6 +338,14 @@ namespace OnlineStore.LoadCSVLibrary
public static string Mid_Down = "Mid_Down";
/// <summary>
/// DO,0,安全门关闭,SafeDoor_Lock,30,HC,Y30,,,,,,,,,,
/// </summary>
public static string SafeDoor_Lock = "SafeDoor_Lock";
/// <summary>
/// DO,0,空气阀门打开,AirValve_Open,31,HC,Y31,,,,,,,,,,
/// </summary>
public static string AirValve_Open = "AirValve_Open";
}
public enum IO_VALUE
{
......
......@@ -51,6 +51,7 @@ namespace TheMachine
this.listView1 = new System.Windows.Forms.ListView();
this.btn_stop = 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.tabControl1.SuspendLayout();
this.tabPage1.SuspendLayout();
......@@ -142,6 +143,7 @@ namespace TheMachine
//
this.tabPage1.Controls.Add(this.pictureBox2);
this.tabPage1.Controls.Add(this.pictureBox1);
this.tabPage1.Controls.Add(this.btn_opendoor);
this.tabPage1.Controls.Add(this.btn_IgnoreX09);
this.tabPage1.Controls.Add(this.btn_PauseBuzzer);
this.tabPage1.Controls.Add(this.cb_EnableBuzzer);
......@@ -299,6 +301,18 @@ namespace TheMachine
this.btn_run.UseVisualStyleBackColor = true;
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
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 14F);
......@@ -353,6 +367,7 @@ namespace TheMachine
private System.Windows.Forms.PictureBox pictureBox2;
private System.Windows.Forms.PictureBox pictureBox1;
private System.Windows.Forms.Button btn_IgnoreX09;
private System.Windows.Forms.Button btn_opendoor;
}
}
......@@ -154,6 +154,8 @@ namespace TheMachine
}
void SetState(List<MoveInfo> moveInfoList)
{
if (RobotManage.mainMachine == null)
return;
this.SuspendLayout();
stateView.Items.Clear();
foreach (MoveInfo moveInfo in moveInfoList)
......@@ -448,5 +450,13 @@ namespace TheMachine
RobotManage.mainMachine.IgnoreX09();
btn_IgnoreX09.Visible = false;
}
private void btn_opendoor_Click(object sender, EventArgs e)
{
LogUtil.info("用户点击打开舱门");
RobotManage.UserPause(true);
FrmReleaseDoor frmReleaseDoor = new FrmReleaseDoor();
frmReleaseDoor.ShowDialog();
}
}
}

namespace TheMachine
{
partial class FrmReleaseDoor
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.btn_cancel = new System.Windows.Forms.Button();
this.lbl_lockstatus = new System.Windows.Forms.Label();
this.lbl_airstatus = new System.Windows.Forms.Label();
this.timer1 = new System.Windows.Forms.Timer(this.components);
this.SuspendLayout();
//
// btn_cancel
//
this.btn_cancel.Font = new System.Drawing.Font("微软雅黑", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btn_cancel.Location = new System.Drawing.Point(202, 318);
this.btn_cancel.Name = "btn_cancel";
this.btn_cancel.Size = new System.Drawing.Size(234, 49);
this.btn_cancel.TabIndex = 0;
this.btn_cancel.Text = "取消开启或关闭门锁";
this.btn_cancel.UseVisualStyleBackColor = true;
this.btn_cancel.Click += new System.EventHandler(this.btn_cancel_Click);
//
// lbl_lockstatus
//
this.lbl_lockstatus.Font = new System.Drawing.Font("微软雅黑", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.lbl_lockstatus.Location = new System.Drawing.Point(99, 24);
this.lbl_lockstatus.Name = "lbl_lockstatus";
this.lbl_lockstatus.Size = new System.Drawing.Size(469, 75);
this.lbl_lockstatus.TabIndex = 1;
this.lbl_lockstatus.Text = "门锁状态:已锁定";
//
// lbl_airstatus
//
this.lbl_airstatus.Font = new System.Drawing.Font("微软雅黑", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.lbl_airstatus.Location = new System.Drawing.Point(99, 112);
this.lbl_airstatus.Name = "lbl_airstatus";
this.lbl_airstatus.Size = new System.Drawing.Size(469, 149);
this.lbl_airstatus.TabIndex = 1;
this.lbl_airstatus.Text = "舱内氮气含量:";
//
// timer1
//
this.timer1.Enabled = true;
this.timer1.Interval = 1500;
this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
//
// FrmReleaseDoor
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.ClientSize = new System.Drawing.Size(662, 394);
this.Controls.Add(this.lbl_airstatus);
this.Controls.Add(this.lbl_lockstatus);
this.Controls.Add(this.btn_cancel);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "FrmReleaseDoor";
this.ShowIcon = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "解锁门锁";
this.Load += new System.EventHandler(this.FrmReleaseDoor_Load);
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.Button btn_cancel;
private System.Windows.Forms.Label lbl_lockstatus;
private System.Windows.Forms.Label lbl_airstatus;
private System.Windows.Forms.Timer timer1;
}
}
\ No newline at end of file
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
{
public partial class FrmReleaseDoor : Form
{
public FrmReleaseDoor()
{
InitializeComponent();
}
private void timer1_Tick(object sender, EventArgs e)
{
IOManager.IOMove(IO_Type.AirValve_Open, IO_VALUE.HIGH);
IOManager.IOMove(IO_Type.AirValue, IO_VALUE.LOW);
var dd=HumitureController.QueryData();
var nitrogen = 100- dd.OxygenV-1;
if (nitrogen <= Setting_Init.Nitrogen_Safe_Maximum) {
IOManager.IOMove(IO_Type.SafeDoor_Lock, IO_VALUE.LOW);
}
lbl_airstatus.Text = $"当前氮气含量:{nitrogen:0.0}%, 等待低于{Setting_Init.Nitrogen_Safe_Maximum}%后解锁舱门";
var islock = IOManager.IOValue(IO_Type.SafeDoor_Lock).Equals(IO_VALUE.HIGH);
var isair = IOManager.IOValue(IO_Type.AirValve_Open).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.AirValve_Open, IO_VALUE.HIGH);
Thread.Sleep(1000);
IOManager.IOMove(IO_Type.AirValue, IO_VALUE.LOW);
}
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();
}
else
{
MessageBox.Show("请先关闭料仓门");
}
}
}
}
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="timer1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root>
\ No newline at end of file
......@@ -130,7 +130,7 @@ namespace TheMachine
return;
}
var t = HumitureController.LastData;
lbl_hmdstate.Text += "温度"+$":{t.Temperate}℃, "+ "湿度"+$":{t.Humidity}%";
lbl_hmdstate.Text += "温度"+$":{t.Temperate}℃, "+ "湿度"+$":{t.Humidity}%, " + "氮气" + $":{100-t.OxygenV-1}%";
}
}
}
......@@ -93,6 +93,12 @@
<Compile Include="Form1.Designer.cs">
<DependentUpon>Form1.cs</DependentUpon>
</Compile>
<Compile Include="FrmReleaseDoor.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="FrmReleaseDoor.Designer.cs">
<DependentUpon>FrmReleaseDoor.cs</DependentUpon>
</Compile>
<Compile Include="Frm_AxisMoveByIO.cs">
<SubType>Form</SubType>
</Compile>
......@@ -153,6 +159,9 @@
<EmbeddedResource Include="Form1.resx">
<DependentUpon>Form1.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="FrmReleaseDoor.resx">
<DependentUpon>FrmReleaseDoor.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Frm_AxisMoveByIO.resx">
<DependentUpon>Frm_AxisMoveByIO.cs</DependentUpon>
</EmbeddedResource>
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!