Commit f32af551 刘韬
2 个父辈 b7f2e3c0 e3a65576
......@@ -233,11 +233,12 @@ namespace OnlineStore.Common
/// 湿度报警值
/// </summary>
public static string maxHumidity = "humi";
public static string minHumidity = "minHumi";
/// <summary>
/// 温度报警值
/// </summary>
public static string maxTemperature = "temp";
public static string minTemperature = "minTemp";
/// <summary>
/// urgentReel: true 表示紧急料,需要出到料串上
/// </summary>
......


using log4net;
using System;
using System.Collections.Generic;
......@@ -23,7 +23,7 @@ namespace OnlineStore.Common
private Parity parity = Parity.None;//校验位
private int dataBits = 8;//数据位
private StopBits stopBits = StopBits.One; //停止位
private AcSerialBean sb = null;
private AcSerialBean sb = null;
private string LogName = "";
public int HumitureControllerType = 0;// ConfigAppSettings.GetIntValue(Setting_Init.HumitureControllerType);
......@@ -91,8 +91,8 @@ namespace OnlineStore.Common
}
IsRun = false;
}
public ASTemperateParam LastData = new ASTemperateParam(0, 0,0);
public ASTemperateParam QueryData()
public ASTemperateParam LastData = new ASTemperateParam(0, 0, 0);
public bool QueryData()
{
ASTemperateParam param = new ASTemperateParam(0, 0, 0);
List<double> data = queryData();
......@@ -107,7 +107,7 @@ namespace OnlineStore.Common
// else
// data[0] += Setting_Init.Device_HumidityAdjust;
//}
data[0] = ProcessHumity(data[0]);
data[0] = ProcessHumity(serialPort, data[0]);
//if (Setting_Init.Device_TemptureAdjust != 0 && Setting_Init.Device_TemptureLimited != 0)
//{
// if (data[1] + Setting_Init.Device_TemptureAdjust < Setting_Init.Device_TemptureLimited)
......@@ -117,18 +117,32 @@ namespace OnlineStore.Common
// else
// data[1] += Setting_Init.Device_TemptureAdjust;
//}
data[1] = ProcessTemp(data[1]);
data[1] = ProcessTemp(serialPort, data[1]);
var maxTemp = ConfigHelper.Config.Get("MaxTempThreshold", 60);
var minTemp = ConfigHelper.Config.Get("MinTempThreshold", 0);
if (data[1] >= maxTemp || data[1] <= minTemp)//温度
{
return false;
}
var maxHum = ConfigHelper.Config.Get("MaxHumidityThreshold", 100);
var minHum = ConfigHelper.Config.Get("MinHumidityThreshold", 0);
if (data[0] >= maxHum || data[0] <= minHum)//湿度
{
return false;
}
param = new ASTemperateParam(data[1], data[0], data[2]);
LastData = param;
return true;
}
LastData = param;
return param;
return false;
}
/// <summary>
/// 温度数据处理
/// </summary>
/// <param name="nowTemp"></param>
/// <returns></returns>
private static double ProcessTemp(double nowTemp)
private static double ProcessTemp(string port, double nowTemp)
{
double temp = nowTemp;
double minVal = 5;//ConfigHelper.Config.Get("TempThreshold_Min", 5);
......@@ -147,7 +161,12 @@ namespace OnlineStore.Common
{
temp = (nowTemp - 11) * (nowTemp - 10) / 10 + 11;
}
else
{
var calib = ConfigHelper.Config.Get($"TemptureCalib_{port}", 0);
nowTemp += calib;
return nowTemp;
}
return Math.Round(temp, 1);
}
/// <summary>
......@@ -155,7 +174,7 @@ namespace OnlineStore.Common
/// </summary>
/// <param name="nowHumity"></param>
/// <returns></returns>
private static double ProcessHumity(double nowHumity)
private static double ProcessHumity(string port, double nowHumity)
{
double temp = nowHumity;
double minVal = ConfigHelper.Config.Get("HumidityThreshold_Min", 5);
......@@ -170,7 +189,6 @@ namespace OnlineStore.Common
{
temp = (nowHumity - minVal) * coefVal + minVal;
}
return Math.Round(temp, 1);
}
/// <summary>
......@@ -192,7 +210,7 @@ namespace OnlineStore.Common
sendData[0] = 0x01;
if (HumitureControllerType.Equals(1))
{
sendData[1] = 0x04;
sendData[1] = 0x04;
}
else
{
......@@ -213,10 +231,10 @@ namespace OnlineStore.Common
return getReviceData(reviceData);
}
private byte[] buildCheckData(byte[] sendData, int length)
{
ushort pChecksum = 0;
......@@ -233,13 +251,13 @@ namespace OnlineStore.Common
{
sendData[length + 1] = checkByte[0];
sendData[length] = checkByte[1];
}
}
return sendData;
}
private List<double> getReviceData(byte[] dataArray)
{
List<double> list = new List<double>();
List<double> list = new List<double>();
try
{
if (dataArray == null)
......@@ -249,12 +267,12 @@ namespace OnlineStore.Common
if (dataArray.Length >= 9)
{
string temp = String.Format("{0:X2}", dataArray[3])+ String.Format("{0:X2}", dataArray[4]);
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;
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);
......@@ -266,6 +284,6 @@ namespace OnlineStore.Common
}
return list;
}
}
}
......@@ -114,7 +114,10 @@ namespace DeviceLibrary
{
return instance.GetLimitNegativeSingle(portName, slvAddr);
}
public static string GetAxisSts(string portName, short slvAddr)
{
return instance.GetAxisSts(portName, slvAddr);
}
/// <summary>
/// 正极限
/// </summary>
......
......@@ -141,5 +141,11 @@ namespace DeviceLibrary
{
return HCBoardManager.GetAxErrCode(slvAddr);
}
public string GetAxisSts(string portName, short slvAddr)
{
AxisSts axisS = HCBoardManager.GetAxisSts(slvAddr);
return axisS.ToStr();
}
}
}
......@@ -55,6 +55,6 @@ namespace DeviceLibrary
int AxisStsINP(string portName, short slvAddr);
short GetErrorCode(string portName, short slvAddr);
string GetAxisSts(string portName, short slvAddr);
}
}
......@@ -209,8 +209,8 @@ namespace DeviceLibrary
boxStatus.boxId = StoreID;
if (RobotManage.humitureControllers.Count > 0)
{
boxStatus.humidity = RobotManage.humitureControllers.Average(x => x.LastData.Humidity).ToString();
boxStatus.temperature = RobotManage.humitureControllers.Average(x => x.LastData.Temperate).ToString();
boxStatus.humidity = RobotManage.averageHumidity().ToString();
boxStatus.temperature = RobotManage.averageTemp().ToString();
}
List<humidata> humidatas = new List<humidata>();
for (int i = 0; i < RobotManage.humitureControllers.Count; i++)
......@@ -415,13 +415,16 @@ namespace DeviceLibrary
//}
else
{
LogUtil.info("扫码时状态错误.");
LogUtil.info("入库时状态错误.");
}
}
public float Max_Humidity;
public float Min_Humidity;
public float Max_Temperature;
public float Min_Temperature;
/// <summary>
/// 处理服务器温湿度消息
/// </summary>
......@@ -446,6 +449,23 @@ namespace DeviceLibrary
LogUtil.error("转换温湿度失败:" + ex.ToString());
}
}
if (data != null && data.ContainsKey(ParamDefine.minHumidity) && data.ContainsKey(ParamDefine.minTemperature))
{
string maxHumidity = data[ParamDefine.minHumidity];
string maxTemp = data[ParamDefine.minTemperature];
LogUtil.info("收到服务器温湿度预警值:minHumidity=" + maxHumidity + ",minTemperature=" + maxTemp);
try
{
this.Min_Humidity = (float)Convert.ToDouble(maxHumidity);
this.Min_Temperature = (float)Convert.ToDouble(maxTemp);
LogUtil.info("保存温湿度预警值:Min_Humidity=" + Min_Humidity + ",Min_Temperature=" + Min_Temperature);
}
catch (Exception ex)
{
LogUtil.error("转换温湿度失败:" + ex.ToString());
}
}
}
/// <summary>
/// 处理服务器出库任务消息
......
......@@ -171,7 +171,8 @@ namespace DeviceLibrary
if (MoveInfo.CanWhileCount > 0)
{
var errCode = AxisManager.GetErrorCode(deviceName, axisNo);
LogUtil.info($"{MoveInfo.Name} {MoveInfo.MoveStep} {axis.DisplayStr} 报警码:{errCode.ToString("X8")}");
var pos= AxisManager.GetAxisSts(deviceName, axisNo);
LogUtil.info($"{MoveInfo.Name} {MoveInfo.MoveStep} {axis.DisplayStr} 轴状态:{pos}, 报警码:{errCode.ToString("X8")}");
string clearMsg = "";
//判断轴是否报警
if (MoveInfo.CanWhileCount <= 3)
......
......@@ -142,6 +142,7 @@ namespace DeviceLibrary
Line.Pause();
//Lift.Pause();
}
if(!ok)
Msg.add(Name + "正面安全光栅被遮挡" + (ok ? "[已忽略]" : ""), MsgLevel.warning);
}
......@@ -152,7 +153,8 @@ namespace DeviceLibrary
ok = false;
Line.Pause();
}
Msg.add(Name + "侧面光栅被遮挡" + (ok ? "[已忽略]" : ""), MsgLevel.warning);
if (!ok)
Msg.add(Name + "侧面光栅被遮挡" + (ok ? "[已忽略]" : ""), MsgLevel.warning);
}
if (ok)
......
......@@ -3,6 +3,7 @@ using OnlineStore.Common;
using OnlineStore.LoadCSVLibrary;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Threading.Tasks;
......@@ -129,9 +130,23 @@ namespace DeviceLibrary
}
else
{
MoveInfo.NextMoveStep(MoveStep.In05);
Lift.LiftDown(MoveInfo);
MoveInfo.log($"放下入料阻挡");
var codes = x.Select((a) => a.CodeStr);
if (x.Count == 1 && codes.Any(s => !string.IsNullOrEmpty(s) && s.ToUpper().StartsWith("CB")))
{
MoveInfo.NextMoveStep(MoveStep.In05);
Lift.LiftDown(MoveInfo);
MoveInfo.log($"放下入料阻挡");
}
else
{
Msg.add($"扫到的料箱条码无CB开头,请确认:{string.Join(",", codes)}", MsgLevel.critical);
if (IOValue(IO_M_Stop_In).Equals(IO_VALUE.LOW))
{
MoveInfo.log($"料箱被拿走");
MoveInfo.NewMove(MoveStep.Wait);
MoveInfo.log("入库线体状态重置");
}
}
}
}
......@@ -148,7 +163,7 @@ namespace DeviceLibrary
MoveInfo.log("检测到周转箱3,中间阻挡下降");
break;
case MoveStep.In06:
if (IOValue(IO_OverHead_Check).Equals(IO_VALUE.LOW))
if (IOValue(IO_OverHead_Check).Equals(IO_VALUE.HIGH))
{
Line.LineStop("work");
MoveInfo.log($"X18检测到物料超高,停止滚筒");
......@@ -228,7 +243,8 @@ namespace DeviceLibrary
else if (MoveInfo.IsTimeOut(15))
{
isScanErrorTimes++;
if (isScanErrorTimes < 3) {
if (isScanErrorTimes < 3)
{
MoveInfo.NextMoveStep(MoveStep.In03);
}
else
......@@ -254,7 +270,7 @@ namespace DeviceLibrary
MoveInfo.log("周转箱已取走,顶升下降");
break;
case MoveStep.InOverHead:
Msg.add("料箱存储超高", MsgLevel.warning);//X19检测到物料超高,请取出周转箱
Msg.add("料箱存储超高", MsgLevel.critical);//X19检测到物料超高,请取出周转箱
if (IOMonitor.IODebound(IO_M_Stop_In, Config, IO_VALUE.LOW))
{
MiddleStop(MoveInfo, IO_VALUE.HIGH);
......@@ -281,7 +297,7 @@ namespace DeviceLibrary
MoveInfo.NextMoveStep(MoveStep.InNG3);
Line.LineStop("work");
MoveInfo.log($"料箱抵达出口");
if (isScanErrorTimes>2)
if (isScanErrorTimes > 2)
Msg.add("入库周转箱扫码失败,请确认料箱方向后重试", MsgLevel.critical);
else
Msg.add("入库周转箱超重,已退出,请处理", MsgLevel.critical);
......
......@@ -105,7 +105,7 @@ namespace DeviceLibrary
MoveInfo.NextMoveStep(MoveStep.OutWaitAgv);
mainMachine.ServerCM.SendStoreState(MoveInfo.MoveParam.PosID, StoreStatus.OutStoreEnd);
//IOMove(DO_Agv_Rsp, IO_VALUE.HIGH);
MoveInfo.log($"等待agv接走周转箱");
MoveInfo.log($"等待走周转箱");
break;
case MoveStep.OutWaitAgv:
Msg.add("等待取走周转箱" + MoveInfo.MoveParam.WareCode, MsgLevel.info);
......
......@@ -42,7 +42,8 @@ namespace DeviceLibrary
else
{
var timediff = DateTime.Now - lastBtnUpPressTime;
if (timediff.TotalSeconds < 3 && trueCount == 2) {
if (timediff.TotalSeconds < 3 && trueCount == 2)
{
if (btnUP_L && btnUP_R)
{
BtnAction = BtnActionE.Mid_Up;
......@@ -51,12 +52,16 @@ namespace DeviceLibrary
{
BtnAction = BtnActionE.Mid_Down;
}
} else if (timediff.TotalSeconds > 3 && trueCount == 1) {
if (BtnAction == BtnActionE.None) {
}
else if (timediff.TotalSeconds > 3 && trueCount == 1)
{
if (BtnAction == BtnActionE.None)
{
if (btnUP_L)
{
BtnAction = BtnActionE.Left_IN;
} else if (btnUP_R)
}
else if (btnUP_R)
{
BtnAction = BtnActionE.Right_IN;
}
......@@ -86,7 +91,8 @@ namespace DeviceLibrary
}
if (BtnAction == BtnActionE.Left_IN || BtnAction == BtnActionE.Right_IN) {
if (BtnAction == BtnActionE.Left_IN || BtnAction == BtnActionE.Right_IN)
{
var side = BtnAction == BtnActionE.Left_IN ? InOutSideE.Left : InOutSideE.Right;
var ld = InOutDevice.InOutDeviceList[side];
......@@ -97,7 +103,8 @@ namespace DeviceLibrary
ld.CurrnetDirection = InOutDirectionE.IN;
return;
}
else {
else
{
Msg.add(ld.Name + msg, MsgLevel.info);
}
}
......@@ -116,7 +123,7 @@ namespace DeviceLibrary
IOMove(IO_Type.AirValue, IO_VALUE.HIGH);
return;
}
if ((DateTime.Now - lastAirprocesstime).TotalSeconds < 5)
return;
lastAirprocesstime = DateTime.Now;
......@@ -124,8 +131,8 @@ namespace DeviceLibrary
IOManager.IOMove(IO_Type.SafeDoor_Lock, IO_VALUE.HIGH);
//var temp = HumitureController.QueryData();
//var temp = HumitureController.LastData;
Current_Humidity = RobotManage.humitureControllers.Average(x => x.LastData.Humidity);
Current_Temperate = RobotManage.humitureControllers.Average(x => x.LastData.Temperate);
Current_Humidity = averageHumidity();
Current_Temperate = averageTemp();
//var tempIsOK = Current_Temperate < ServerCM.Max_Temperature;
var humiNeedStart = Current_Humidity > ServerCM.Max_Humidity - Setting_Init.Device_HumidityStartOffser;
......@@ -139,17 +146,30 @@ namespace DeviceLibrary
else if (humiNeedStop && airisopen)
{
IOMove(IO_Type.AirValue, IO_VALUE.HIGH);
// airisopen = false;
// airisopen = false;
LogUtil.info($"关闭吹气,当前最大湿度:{Current_Humidity} < {ServerCM.Max_Humidity}-{Setting_Init.Device_HumidityEndOffser}.");
}
}
bool lastTHoutRangeStatus = false;
DateTime lastTHoutRangeTime = DateTime.MaxValue;
double averageHumidity()
{
return RobotManage.averageHumidity();
}
double averageTemp()
{
return RobotManage.averageTemp();
}
bool IsTHoutRange()
{
if (RobotManage.humitureControllers.Average(x => x.LastData.Humidity) > ServerCM.Max_Humidity// || HumitureController.LastData.Humidity < ServerCM.Min_Humidity
|| RobotManage.humitureControllers.Average(x => x.LastData.Temperate) > ServerCM.Max_Temperature)
if (averageHumidity() > ServerCM.Max_Humidity
|| averageHumidity() < ServerCM.Min_Humidity
|| averageTemp() > ServerCM.Max_Temperature
|| averageTemp() < ServerCM.Min_Temperature)
{
Msg.add($"温湿度超出范围,当前温度:{averageTemp()},范围:{ServerCM.Min_Temperature}~{ServerCM.Max_Temperature}," +
$"当前湿度:{averageHumidity()},范围:{ServerCM.Min_Humidity}~{ServerCM.Max_Humidity}", MsgLevel.warning);
if (!lastTHoutRangeStatus)
lastTHoutRangeTime = DateTime.Now;
lastTHoutRangeStatus = true;
......
......@@ -83,10 +83,10 @@ namespace DeviceLibrary
MachineLedState.Add(MachineLedStateE.SystemPause, nls(LedState.blink, LedState.off, LedState.blink));
//温湿度超限30分钟. 红闪,黄闪
MachineLedStateName[MachineLedStateE.THoutRangeOver30m] = "温湿度超限30分钟";
MachineLedState.Add(MachineLedStateE.THoutRangeOver30m, nls(LedState.blink, LedState.blink, LedState.none));
MachineLedState.Add(MachineLedStateE.THoutRangeOver30m, nls(LedState.blink, LedState.blink, LedState.off));
//温湿度超限 绿闪黄闪
MachineLedStateName[MachineLedStateE.THoutRange] = "温湿度超限";
MachineLedState.Add(MachineLedStateE.THoutRange, nls(LedState.none, LedState.blink, LedState.blink));
MachineLedState.Add(MachineLedStateE.THoutRange, nls(LedState.blink, LedState.blink, LedState.off));
//进出库, 绿亮,黄闪
MachineLedStateName[MachineLedStateE.InOut] = "出入库中";
MachineLedState.Add(MachineLedStateE.InOut, nls(LedState.none, LedState.blink, LedState.on));
......
......@@ -93,7 +93,7 @@ namespace DeviceLibrary
}
else
{
Msg.add($"{CurrentSide}:入料线等待周转箱离开", MsgLevel.info);
Msg.add($"{(CurrentSide== InOutSideE.Left?"左边":"右边")}:入料线等待周转箱离开", MsgLevel.info);
}
//if (string.IsNullOrEmpty(boxTransport.ErrMsgTxt)) {
// Msg.add(boxTransport.ErrMsgTxt, MsgLevel.warning);
......
......@@ -304,18 +304,18 @@ namespace DeviceLibrary
ResetMoveInfo.WaitList.Add(WaitResultInfo.WaitTime(500));
break;
case MoveStep.H03_HomeReset:
if (IOMonitor.IODebound(IO_Type.SideA_ForkMaterial_Check,Config, IO_VALUE.LOW,2000)&&
IOMonitor.IODebound(IO_Type.SideB_ForkMaterial_Check,Config,IO_VALUE.LOW,2000))
if (IOMonitor.IODebound(IO_Type.SideA_ForkMaterial_Check, Config, IO_VALUE.LOW, 2000) &&
IOMonitor.IODebound(IO_Type.SideB_ForkMaterial_Check, Config, IO_VALUE.LOW, 2000))
{
ResetMoveInfo.NextMoveStep(MoveStep.H04_HomeReset);
YAxis.HomeMove(ResetMoveInfo, forceHome);
ResetMoveInfo.log("正在回原 ,升降轴,回原");
ResetMoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000));
}
else if(ResetMoveInfo.IsTimeOut(6))
else if (ResetMoveInfo.IsTimeOut(6))
{
Msg.add("存储机构取料暂停", MsgLevel.warning);//伸缩叉2侧X06/X07检测到有物料无法继续
RobotManage.UserPause("回原时料叉上有物料");
RobotManage.UserPause("再次确认回原时料叉上是否有料");
return;
}
......@@ -430,7 +430,8 @@ namespace DeviceLibrary
ok = false;
DeviceSuddenStop();
}
Msg.add("前门没有关闭" + (ok ? "[已忽略]" : ""), MsgLevel.warning);
if (!ok)
Msg.add("前门没有关闭" + (ok ? "[已忽略]" : ""), MsgLevel.warning);
}
if (IOValue(IO_Type.BackDoor_Check).Equals(IO_VALUE.LOW))
{
......@@ -439,7 +440,8 @@ namespace DeviceLibrary
ok = false;
DeviceSuddenStop();
}
Msg.add("后门没有关闭" + (ok ? "[已忽略]" : ""), MsgLevel.warning);
if (!ok)
Msg.add("后门没有关闭" + (ok ? "[已忽略]" : ""), MsgLevel.warning);
}
if (!lastSafeCheckStatus && ok)
{
......
......@@ -11,7 +11,7 @@ namespace DeviceLibrary
public class MoveInfo
{
public static List<MoveInfo> List = new List<MoveInfo>();
public int TimeOutSeconds = 60;
public int TimeOutSeconds = 240;
public MoveInfo(string name, bool addtolist=true)
{
MoveParam = new BoxParam();
......
......@@ -19,7 +19,7 @@ namespace DeviceLibrary
public static bool IsLoadOk = true;
public static bool IsConfigMode = false;
public static bool InoutDebugMode = false;
public delegate void LoadFinish(bool state,string msg);
public delegate void LoadFinish(bool state, string msg);
public static event LoadFinish LoadFinishEvent;
public static event EventHandler<bool> UserPauseSet;
......@@ -29,15 +29,29 @@ namespace DeviceLibrary
static string baseDir = Application.StartupPath;
static Thread mainThread;
public static List<HumitureController> humitureControllers = new List<HumitureController>();
public static double averageHumidity()
{
var ss = humitureControllers.FindAll(s => s.LastData.Humidity > 0);
if (ss != null && ss.Count > 0)
return ss.Average(x => x.LastData.Humidity);
return 0;
}
public static double averageTemp()
{
var ss = humitureControllers.FindAll(s => s.LastData.Temperate > 0);
if (ss != null && ss.Count > 0)
return ss.Average(x => x.LastData.Temperate);
return 0;
}
public static HIKCamera CameraA=new HIKCamera();
public static HIKCamera CameraB= new HIKCamera();
public static void Init() {
public static HIKCamera CameraA = new HIKCamera();
public static HIKCamera CameraB = new HIKCamera();
public static void Init()
{
string msg = "";
try
{
mainMachine = null;
mainMachine = null;
string configFile = Path.Combine(baseDir, "config\\Config.csv");
Config = new Robot_Config(0, "", configFile);
Config = (Robot_Config)CSVConfigReader.LoadConfig(Config);
......@@ -49,7 +63,8 @@ namespace DeviceLibrary
LogUtil.info("加载位置文件:" + positionConfigFile);
CSVPositionReader<ACStorePosition>.ReloadCSVFile(positionConfigFile);
}
else {
else
{
IsLoadOk = false;
msg += "找不到库位配置文件\n";
}
......@@ -63,16 +78,17 @@ namespace DeviceLibrary
msg += "IO板卡初始化失败\n";
}
var hports = Setting_Init.Device_Humiture_Port.Val.Split(',');
foreach(var p in hports)
{
foreach (var p in hports)
{
var hc = new HumitureController();
if (!hc.Init(p))
{
LogUtil.info("尝试打开端口:" + p+" 失败");
LogUtil.info("尝试打开端口:" + p + " 失败");
IsLoadOk = false;
msg += "温湿度传感器初始化失败,端口:" + $"{p}\n";
}
else {
else
{
LogUtil.info("尝试打开端口:" + p + " 成功");
humitureControllers.Add(hc);
}
......@@ -95,22 +111,25 @@ namespace DeviceLibrary
if (!CameraB.LoadCameraConfig("CameraB", out errmsg))
{
//IsLoadOk = false;
msg += errmsg+"\r\n";
msg += errmsg + "\r\n";
}
//IOManager.IOMove(IO_Type.Device_Led, IO_VALUE.HIGH);
//IOManager.IOMove(IO_Type.Camera_Led, IO_VALUE.HIGH);
LoadFinishEvent?.Invoke(IsConfigMode ? IsConfigMode : IsLoadOk, msg);
}
catch (Exception ex) {
catch (Exception ex)
{
LoadFinishEvent?.Invoke(false, ex.Message);
LogUtil.error(ex.Message+ex.StackTrace);
LogUtil.error(ex.Message + ex.StackTrace);
return;
}
}
public static void LoadDebug() {
public static void LoadDebug()
{
LoadFinishEvent?.Invoke(true, "打开调试模式");
}
public static void Start() {
public static void Start()
{
//Init();
if (!IsLoadOk)
{
......@@ -123,20 +142,21 @@ namespace DeviceLibrary
isRunning = true;
GC.KeepAlive(mainThread);
Task.Run(()=> {
Task.Run(() =>
{
AxisBean.List.ForEach((x) => { AxisManager.AlarmClear(x.Config.DeviceName, x.Config.GetAxisValue()); });
Task.Delay(1000).Wait();
if (mainMachine.DeviceCheck())
mainMachine.BeginHomeReset(true);
});
}
public static void Stop()
{
LogUtil.info("开始停止系统.");
mainMachine.Stop();
mainMachine.UserPause = false;
//IOManager.CloseAllConnection();
......@@ -153,14 +173,15 @@ namespace DeviceLibrary
}
public static void UserPause(bool userpause)
{
UserPause("", userpause,false);
UserPause("", userpause, false);
}
public static void UserPause(string msg="",bool userpause=true,bool upload=true) {
public static void UserPause(string msg = "", bool userpause = true, bool upload = true)
{
if (userpause)
{
if(string.IsNullOrEmpty(msg))
if (string.IsNullOrEmpty(msg))
{
if(upload)
if (upload)
{
Msg.add("用户暂停", MsgLevel.critical);
}
......
......@@ -72,7 +72,7 @@ namespace TheMachine
this.menuStrip1.Location = new System.Drawing.Point(0, 0);
this.menuStrip1.Name = "menuStrip1";
this.menuStrip1.Padding = new System.Windows.Forms.Padding(7, 2, 0, 2);
this.menuStrip1.Size = new System.Drawing.Size(1008, 35);
this.menuStrip1.Size = new System.Drawing.Size(1904, 29);
this.menuStrip1.TabIndex = 0;
this.menuStrip1.Text = "menuStrip1";
//
......@@ -86,38 +86,38 @@ namespace TheMachine
this.退出ToolStripMenuItem});
this.设备操作ToolStripMenuItem.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.设备操作ToolStripMenuItem.Name = "设备操作ToolStripMenuItem";
this.设备操作ToolStripMenuItem.Size = new System.Drawing.Size(106, 31);
this.设备操作ToolStripMenuItem.Size = new System.Drawing.Size(86, 25);
this.设备操作ToolStripMenuItem.Text = "设备操作";
//
// 启用调试模式ToolStripMenuItem
//
this.启用调试模式ToolStripMenuItem.Enabled = false;
this.启用调试模式ToolStripMenuItem.Name = "启用调试模式ToolStripMenuItem";
this.启用调试模式ToolStripMenuItem.Size = new System.Drawing.Size(238, 32);
this.启用调试模式ToolStripMenuItem.Size = new System.Drawing.Size(192, 26);
this.启用调试模式ToolStripMenuItem.Text = "启用配置模式";
this.启用调试模式ToolStripMenuItem.Click += new System.EventHandler(this.启用调试模式ToolStripMenuItem_Click);
//
// toolStripSeparator4
//
this.toolStripSeparator4.Name = "toolStripSeparator4";
this.toolStripSeparator4.Size = new System.Drawing.Size(235, 6);
this.toolStripSeparator4.Size = new System.Drawing.Size(189, 6);
//
// 二维码识别调试ToolStripMenuItem
//
this.二维码识别调试ToolStripMenuItem.Name = "二维码识别调试ToolStripMenuItem";
this.二维码识别调试ToolStripMenuItem.Size = new System.Drawing.Size(238, 32);
this.二维码识别调试ToolStripMenuItem.Size = new System.Drawing.Size(192, 26);
this.二维码识别调试ToolStripMenuItem.Text = "二维码识别调试";
this.二维码识别调试ToolStripMenuItem.Click += new System.EventHandler(this.二维码识别调试ToolStripMenuItem_Click);
//
// toolStripSeparator1
//
this.toolStripSeparator1.Name = "toolStripSeparator1";
this.toolStripSeparator1.Size = new System.Drawing.Size(235, 6);
this.toolStripSeparator1.Size = new System.Drawing.Size(189, 6);
//
// 退出ToolStripMenuItem
//
this.退出ToolStripMenuItem.Name = "退出ToolStripMenuItem";
this.退出ToolStripMenuItem.Size = new System.Drawing.Size(238, 32);
this.退出ToolStripMenuItem.Size = new System.Drawing.Size(192, 26);
this.退出ToolStripMenuItem.Text = "退出";
this.退出ToolStripMenuItem.Click += new System.EventHandler(this.退出ToolStripMenuItem_Click);
//
......@@ -125,7 +125,7 @@ namespace TheMachine
//
this.关于ToolStripMenuItem.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F);
this.关于ToolStripMenuItem.Name = "关于ToolStripMenuItem";
this.关于ToolStripMenuItem.Size = new System.Drawing.Size(66, 31);
this.关于ToolStripMenuItem.Size = new System.Drawing.Size(54, 25);
this.关于ToolStripMenuItem.Text = "关于";
this.关于ToolStripMenuItem.Click += new System.EventHandler(this.关于ToolStripMenuItem_Click);
//
......@@ -136,10 +136,10 @@ namespace TheMachine
| System.Windows.Forms.AnchorStyles.Right)));
this.tabControl1.Controls.Add(this.tabPage1);
this.tabControl1.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.tabControl1.Location = new System.Drawing.Point(0, 90);
this.tabControl1.Location = new System.Drawing.Point(0, 351);
this.tabControl1.Name = "tabControl1";
this.tabControl1.SelectedIndex = 0;
this.tabControl1.Size = new System.Drawing.Size(1008, 639);
this.tabControl1.Size = new System.Drawing.Size(1904, 678);
this.tabControl1.TabIndex = 1;
//
// tabPage1
......@@ -155,9 +155,9 @@ namespace TheMachine
this.tabPage1.Controls.Add(this.cb_IgnoreGratingSignal);
this.tabPage1.Controls.Add(this.cb_IgnoreSafecheck);
this.tabPage1.Controls.Add(this.groupBox1);
this.tabPage1.Location = new System.Drawing.Point(4, 36);
this.tabPage1.Location = new System.Drawing.Point(4, 30);
this.tabPage1.Name = "tabPage1";
this.tabPage1.Size = new System.Drawing.Size(1000, 599);
this.tabPage1.Size = new System.Drawing.Size(1896, 644);
this.tabPage1.TabIndex = 0;
this.tabPage1.Text = "信息";
this.tabPage1.UseVisualStyleBackColor = true;
......@@ -193,7 +193,7 @@ namespace TheMachine
// pictureBox2
//
this.pictureBox2.BackColor = System.Drawing.Color.Gainsboro;
this.pictureBox2.Location = new System.Drawing.Point(479, 314);
this.pictureBox2.Location = new System.Drawing.Point(479, 350);
this.pictureBox2.Name = "pictureBox2";
this.pictureBox2.Size = new System.Drawing.Size(463, 283);
this.pictureBox2.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
......@@ -206,7 +206,7 @@ namespace TheMachine
// pictureBox1
//
this.pictureBox1.BackColor = System.Drawing.Color.Gainsboro;
this.pictureBox1.Location = new System.Drawing.Point(10, 314);
this.pictureBox1.Location = new System.Drawing.Point(10, 350);
this.pictureBox1.Name = "pictureBox1";
this.pictureBox1.Size = new System.Drawing.Size(463, 283);
this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
......@@ -256,7 +256,7 @@ namespace TheMachine
this.cb_EnableBuzzer.AutoSize = true;
this.cb_EnableBuzzer.Location = new System.Drawing.Point(657, 16);
this.cb_EnableBuzzer.Name = "cb_EnableBuzzer";
this.cb_EnableBuzzer.Size = new System.Drawing.Size(134, 31);
this.cb_EnableBuzzer.Size = new System.Drawing.Size(109, 25);
this.cb_EnableBuzzer.TabIndex = 5;
this.cb_EnableBuzzer.Text = "使用蜂鸣器";
this.cb_EnableBuzzer.UseVisualStyleBackColor = true;
......@@ -267,7 +267,7 @@ namespace TheMachine
this.cb_IgnoreGratingSignal.AutoSize = true;
this.cb_IgnoreGratingSignal.Location = new System.Drawing.Point(657, 78);
this.cb_IgnoreGratingSignal.Name = "cb_IgnoreGratingSignal";
this.cb_IgnoreGratingSignal.Size = new System.Drawing.Size(154, 31);
this.cb_IgnoreGratingSignal.Size = new System.Drawing.Size(125, 25);
this.cb_IgnoreGratingSignal.TabIndex = 2;
this.cb_IgnoreGratingSignal.Text = "忽略安全光栅";
this.cb_IgnoreGratingSignal.UseVisualStyleBackColor = true;
......@@ -278,7 +278,7 @@ namespace TheMachine
this.cb_IgnoreSafecheck.AutoSize = true;
this.cb_IgnoreSafecheck.Location = new System.Drawing.Point(657, 47);
this.cb_IgnoreSafecheck.Name = "cb_IgnoreSafecheck";
this.cb_IgnoreSafecheck.Size = new System.Drawing.Size(268, 31);
this.cb_IgnoreSafecheck.Size = new System.Drawing.Size(215, 25);
this.cb_IgnoreSafecheck.TabIndex = 2;
this.cb_IgnoreSafecheck.Text = "忽略安全检查(含安全光栅)";
this.cb_IgnoreSafecheck.UseVisualStyleBackColor = true;
......@@ -300,10 +300,10 @@ namespace TheMachine
this.stateView.Dock = System.Windows.Forms.DockStyle.Fill;
this.stateView.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.Nonclickable;
this.stateView.HideSelection = false;
this.stateView.Location = new System.Drawing.Point(3, 30);
this.stateView.Location = new System.Drawing.Point(3, 25);
this.stateView.MultiSelect = false;
this.stateView.Name = "stateView";
this.stateView.Size = new System.Drawing.Size(605, 259);
this.stateView.Size = new System.Drawing.Size(605, 264);
this.stateView.TabIndex = 0;
this.stateView.UseCompatibleStateImageBehavior = false;
//
......@@ -314,11 +314,11 @@ namespace TheMachine
this.listView1.BorderStyle = System.Windows.Forms.BorderStyle.None;
this.listView1.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.Nonclickable;
this.listView1.HideSelection = false;
this.listView1.Location = new System.Drawing.Point(411, 0);
this.listView1.Location = new System.Drawing.Point(4, 85);
this.listView1.MultiSelect = false;
this.listView1.Name = "listView1";
this.listView1.ShowGroups = false;
this.listView1.Size = new System.Drawing.Size(597, 118);
this.listView1.Size = new System.Drawing.Size(1888, 260);
this.listView1.TabIndex = 2;
this.listView1.UseCompatibleStateImageBehavior = false;
//
......@@ -347,10 +347,10 @@ namespace TheMachine
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 17F);
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 14F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.Color.White;
this.ClientSize = new System.Drawing.Size(1008, 729);
this.ClientSize = new System.Drawing.Size(1904, 1041);
this.Controls.Add(this.listView1);
this.Controls.Add(this.btn_stop);
this.Controls.Add(this.btn_run);
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!