Commit 022d033f LN

修改项目名

1 个父辈 5bda3d61
正在显示 66 个修改的文件 包含 664 行增加417 行删除
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
<DebugSymbols>true</DebugSymbols> <DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType> <DebugType>full</DebugType>
<Optimize>false</Optimize> <Optimize>false</Optimize>
<OutputPath>..\source\ACSingleStore\bin\</OutputPath> <OutputPath>..\source\HCSingleStore\bin\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants> <DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport> <ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
......
...@@ -3,30 +3,22 @@ Microsoft Visual Studio Solution File, Format Version 12.00 ...@@ -3,30 +3,22 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16 # Visual Studio Version 16
VisualStudioVersion = 16.0.29519.87 VisualStudioVersion = 16.0.29519.87
MinimumVisualStudioVersion = 10.0.40219.1 MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ACSingleStore", "source\ACSingleStore\ACSingleStore.csproj", "{0D2542F5-DD62-4352-82D0-383D9A045E74}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Common", "source\Common\Common.csproj", "{43CDD09E-FCF3-4960-A01D-3BBFE9933122}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Common", "source\Common\Common.csproj", "{43CDD09E-FCF3-4960-A01D-3BBFE9933122}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DeviceLibrary", "source\DeviceLibrary\DeviceLibrary.csproj", "{513BC1C9-800D-43A6-9499-3700BAEC3554}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DeviceLibrary", "source\DeviceLibrary\DeviceLibrary.csproj", "{513BC1C9-800D-43A6-9499-3700BAEC3554}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UserFromControl", "source\UserFromControl\UserFromControl.csproj", "{F018462A-D9BC-4365-97F2-F6D71751641E}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LoadCSVLibrary", "source\LoadCVSLibrary\LoadCSVLibrary.csproj", "{064BEBF5-8FAA-4EA2-A5F3-A06E6E7D9251}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LoadCSVLibrary", "source\LoadCVSLibrary\LoadCSVLibrary.csproj", "{064BEBF5-8FAA-4EA2-A5F3-A06E6E7D9251}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProCopyClient", "ProCopyClient\ProCopyClient.csproj", "{63ED00F8-B7E2-4674-859C-22B11625CAE8}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HuichuanLibrary", "source\HuichuanLibrary\HuichuanLibrary.csproj", "{C9575C5E-9D4B-4B4F-BE41-926652B8985F}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HuichuanLibrary", "source\HuichuanLibrary\HuichuanLibrary.csproj", "{C9575C5E-9D4B-4B4F-BE41-926652B8985F}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HCSingleStore", "source\HCSingleStore\HCSingleStore.csproj", "{0D2542F5-DD62-4352-82D0-383D9A045E74}"
EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU Release|Any CPU = Release|Any CPU
EndGlobalSection EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution GlobalSection(ProjectConfigurationPlatforms) = postSolution
{0D2542F5-DD62-4352-82D0-383D9A045E74}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0D2542F5-DD62-4352-82D0-383D9A045E74}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0D2542F5-DD62-4352-82D0-383D9A045E74}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0D2542F5-DD62-4352-82D0-383D9A045E74}.Release|Any CPU.Build.0 = Release|Any CPU
{43CDD09E-FCF3-4960-A01D-3BBFE9933122}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {43CDD09E-FCF3-4960-A01D-3BBFE9933122}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{43CDD09E-FCF3-4960-A01D-3BBFE9933122}.Debug|Any CPU.Build.0 = Debug|Any CPU {43CDD09E-FCF3-4960-A01D-3BBFE9933122}.Debug|Any CPU.Build.0 = Debug|Any CPU
{43CDD09E-FCF3-4960-A01D-3BBFE9933122}.Release|Any CPU.ActiveCfg = Release|Any CPU {43CDD09E-FCF3-4960-A01D-3BBFE9933122}.Release|Any CPU.ActiveCfg = Release|Any CPU
...@@ -35,22 +27,18 @@ Global ...@@ -35,22 +27,18 @@ Global
{513BC1C9-800D-43A6-9499-3700BAEC3554}.Debug|Any CPU.Build.0 = Debug|Any CPU {513BC1C9-800D-43A6-9499-3700BAEC3554}.Debug|Any CPU.Build.0 = Debug|Any CPU
{513BC1C9-800D-43A6-9499-3700BAEC3554}.Release|Any CPU.ActiveCfg = Release|Any CPU {513BC1C9-800D-43A6-9499-3700BAEC3554}.Release|Any CPU.ActiveCfg = Release|Any CPU
{513BC1C9-800D-43A6-9499-3700BAEC3554}.Release|Any CPU.Build.0 = Release|Any CPU {513BC1C9-800D-43A6-9499-3700BAEC3554}.Release|Any CPU.Build.0 = Release|Any CPU
{F018462A-D9BC-4365-97F2-F6D71751641E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F018462A-D9BC-4365-97F2-F6D71751641E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F018462A-D9BC-4365-97F2-F6D71751641E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F018462A-D9BC-4365-97F2-F6D71751641E}.Release|Any CPU.Build.0 = Release|Any CPU
{064BEBF5-8FAA-4EA2-A5F3-A06E6E7D9251}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {064BEBF5-8FAA-4EA2-A5F3-A06E6E7D9251}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{064BEBF5-8FAA-4EA2-A5F3-A06E6E7D9251}.Debug|Any CPU.Build.0 = Debug|Any CPU {064BEBF5-8FAA-4EA2-A5F3-A06E6E7D9251}.Debug|Any CPU.Build.0 = Debug|Any CPU
{064BEBF5-8FAA-4EA2-A5F3-A06E6E7D9251}.Release|Any CPU.ActiveCfg = Release|Any CPU {064BEBF5-8FAA-4EA2-A5F3-A06E6E7D9251}.Release|Any CPU.ActiveCfg = Release|Any CPU
{064BEBF5-8FAA-4EA2-A5F3-A06E6E7D9251}.Release|Any CPU.Build.0 = Release|Any CPU {064BEBF5-8FAA-4EA2-A5F3-A06E6E7D9251}.Release|Any CPU.Build.0 = Release|Any CPU
{63ED00F8-B7E2-4674-859C-22B11625CAE8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{63ED00F8-B7E2-4674-859C-22B11625CAE8}.Debug|Any CPU.Build.0 = Debug|Any CPU
{63ED00F8-B7E2-4674-859C-22B11625CAE8}.Release|Any CPU.ActiveCfg = Release|Any CPU
{63ED00F8-B7E2-4674-859C-22B11625CAE8}.Release|Any CPU.Build.0 = Release|Any CPU
{C9575C5E-9D4B-4B4F-BE41-926652B8985F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {C9575C5E-9D4B-4B4F-BE41-926652B8985F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C9575C5E-9D4B-4B4F-BE41-926652B8985F}.Debug|Any CPU.Build.0 = Debug|Any CPU {C9575C5E-9D4B-4B4F-BE41-926652B8985F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C9575C5E-9D4B-4B4F-BE41-926652B8985F}.Release|Any CPU.ActiveCfg = Release|Any CPU {C9575C5E-9D4B-4B4F-BE41-926652B8985F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C9575C5E-9D4B-4B4F-BE41-926652B8985F}.Release|Any CPU.Build.0 = Release|Any CPU {C9575C5E-9D4B-4B4F-BE41-926652B8985F}.Release|Any CPU.Build.0 = Release|Any CPU
{0D2542F5-DD62-4352-82D0-383D9A045E74}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0D2542F5-DD62-4352-82D0-383D9A045E74}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0D2542F5-DD62-4352-82D0-383D9A045E74}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0D2542F5-DD62-4352-82D0-383D9A045E74}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE
......
此文件类型无法预览
...@@ -14,93 +14,109 @@ namespace OnlineStore.Common ...@@ -14,93 +14,109 @@ namespace OnlineStore.Common
/// </summary> /// </summary>
public class HumitureController public class HumitureController
{ {
public static bool IsRun = false;
public static string serialPort = "";
private static int bautRate = 4800;//波特率 private static int bautRate = 4800;//波特率
private static Parity parity = Parity.None;//校验位 private static Parity parity = Parity.None;//校验位
private static int dataBits = 8;//数据位 private static int dataBits = 8;//数据位
private static StopBits stopBits = StopBits.One; //停止位 private static StopBits stopBits = StopBits.One; //停止位
private static AcSerialBean sb = null;
private static string LogName = "";
private static string LogName = "";
private static Dictionary<string, AcSerialBean> serialBeanMap = new Dictionary<string, AcSerialBean>();
public static int HumitureControllerType = ConfigAppSettings.GetIntValue(Setting_Init.HumitureControllerType); public static int HumitureControllerType = ConfigAppSettings.GetIntValue(Setting_Init.HumitureControllerType);
public static bool Init(string port) public static bool Init(string port)
{ {
if (IsRun && port.Equals(serialPort)) if (serialBeanMap.ContainsKey(port))
{ {
return true; return true;
} }
else if (IsRun)
{
Release();
}
LogName = "温湿度传感器[" + port + "]";
if (sb == null) LogName = "温湿度传感器[" + port + "]";
AcSerialBean sb = null;
if (HumitureControllerType.Equals(1))
{ {
serialPort = port; bautRate = 9600;//波特率
if (HumitureControllerType.Equals(1))
{
bautRate = 9600;//波特率
}
sb = new AcSerialBean(serialPort, bautRate, parity, dataBits, stopBits);
} }
sb = new AcSerialBean(port, bautRate, parity, dataBits, stopBits);
try try
{ {
if (sb.openPort()) if (sb.openPort())
{ {
IsRun = true; serialBeanMap.Add(port, sb);
return true; return true;
} }
else else
{ {
LogUtil.error( LogName + "串口打开失败!"); LogUtil.error(LogName + "串口" + port + "打开失败!");
IsRun = false;
return false; return false;
} }
} }
catch (Exception ex) catch (Exception ex)
{ {
IsRun = false; LogUtil.error("串口" + port + "打开失败:" + ex.ToString());
} }
return true; return true;
} }
/// <summary> /// <summary>
/// 释放资源 /// 释放资源
/// </summary> /// </summary>
public static void Release() public static void CloseAllPort()
{
List<string> kes = new List<string>(serialBeanMap.Keys);
foreach (string key in kes)
{
ClosePort(key);
}
}
public static void ClosePort(string portName)
{ {
if (sb != null) AcSerialBean bean = GetSerialBean(portName);
if (bean == null)
{ {
sb.closePort(); LogUtil.info("串口【" + portName + "】未打开,不需要关闭");
return;
} }
IsRun = false; //清理缓存
bean.clearInBuffer();
bean.clearOutBuffer();
bean.closePort();
if (serialBeanMap.ContainsKey(portName))
{
serialBeanMap.Remove(portName);
}
LogUtil.info("温湿度控制器 关闭串口【" + portName + "】 ");
}
private static AcSerialBean GetSerialBean(string portName)
{
if (serialBeanMap.ContainsKey(portName))
{
return serialBeanMap[portName];
}
return null;
} }
public static ASTemperateParam LastData = new ASTemperateParam(0, 0); // public static ASTemperateParam LastData = new ASTemperateParam(0, 0);
public static ASTemperateParam QueryData() public static HumitureParam QueryData(string port)
{ {
ASTemperateParam param = new ASTemperateParam(0, 0); HumitureParam param = new HumitureParam(0, 0);
List<double> data = queryData(); List<double> data = queryData(port);
if (data.Count.Equals(2)) if (data.Count.Equals(2))
{ {
param = new ASTemperateParam(data[1], data[0]); param = new HumitureParam(data[1], data[0]);
} }
LastData = param;
return param; return param;
} }
/// <summary> /// <summary>
/// 返回温度和湿度 /// 返回温度和湿度
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
private static List<double> queryData() private static List<double> queryData(string port)
{ {
// 温度计算: // 温度计算:
//当温度低于 0 ℃ 时温度数据以补码的形式上传。 //当温度低于 0 ℃ 时温度数据以补码的形式上传。
//温度:FF9B H(十六进制)= -101 => 温度 = -10.1℃ //温度:FF9B H(十六进制)= -101 => 温度 = -10.1℃
//湿度计算: //湿度计算:
//湿度:292 H(十六进制) = 658 => 湿度 = 65.8 % RH //湿度:292 H(十六进制) = 658 => 湿度 = 65.8 % RH
if (IsRun.Equals(false)) AcSerialBean sb = GetSerialBean(port);
if (sb == null)
{ {
return new List<double>(); return new List<double>();
} }
...@@ -108,7 +124,7 @@ namespace OnlineStore.Common ...@@ -108,7 +124,7 @@ namespace OnlineStore.Common
sendData[0] = 0x01; sendData[0] = 0x01;
if (HumitureControllerType.Equals(1)) if (HumitureControllerType.Equals(1))
{ {
sendData[1] = 0x04; sendData[1] = 0x04;
} }
else else
{ {
...@@ -129,10 +145,11 @@ namespace OnlineStore.Common ...@@ -129,10 +145,11 @@ namespace OnlineStore.Common
return getReviceData(reviceData); return getReviceData(reviceData);
} }
public static int QueryHistoryCount() public static int QueryHistoryCount(string port)
{ {
if (IsRun.Equals(false) || HumitureControllerType.Equals(2).Equals(false)) AcSerialBean sb = GetSerialBean(port);
if (sb == null || HumitureControllerType.Equals(2).Equals(false))
{ {
return -1; return -1;
} }
...@@ -164,9 +181,10 @@ namespace OnlineStore.Common ...@@ -164,9 +181,10 @@ namespace OnlineStore.Common
sb.SendCommand(sendData, ref reviceData, 100, out isOk); sb.SendCommand(sendData, ref reviceData, 100, out isOk);
return getReviceIntData(reviceData); return getReviceIntData(reviceData);
} }
public static int QueryCurrCount() public static int QueryCurrCount(string port)
{ {
if (IsRun.Equals(false) || HumitureControllerType.Equals(2).Equals(false)) AcSerialBean sb = GetSerialBean(port);
if (sb == null || HumitureControllerType.Equals(2).Equals(false))
{ {
return -1; return -1;
} }
...@@ -187,10 +205,11 @@ namespace OnlineStore.Common ...@@ -187,10 +205,11 @@ namespace OnlineStore.Common
sb.SendCommand(sendData, ref reviceData, 100, out isOk); sb.SendCommand(sendData, ref reviceData, 100, out isOk);
return getReviceIntData(reviceData); return getReviceIntData(reviceData);
} }
public static List<object> QueryHistory() public static List<object> QueryHistory(string port)
{ {
List<object> list = new List<object>(); List<object> list = new List<object>();
if (IsRun.Equals(false)||HumitureControllerType.Equals(2).Equals(false)) AcSerialBean sb = GetSerialBean(port);
if (sb == null || HumitureControllerType.Equals(2).Equals(false))
{ {
return list; return list;
} }
...@@ -240,7 +259,7 @@ namespace OnlineStore.Common ...@@ -240,7 +259,7 @@ namespace OnlineStore.Common
return list; return list;
} }
private static byte[] buildCheckData(byte[] sendData, int length) private static byte[] buildCheckData(byte[] sendData, int length)
{ {
ushort pChecksum = 0; ushort pChecksum = 0;
...@@ -257,7 +276,7 @@ namespace OnlineStore.Common ...@@ -257,7 +276,7 @@ namespace OnlineStore.Common
{ {
sendData[length + 1] = checkByte[0]; sendData[length + 1] = checkByte[0];
sendData[length] = checkByte[1]; sendData[length] = checkByte[1];
} }
return sendData; return sendData;
} }
...@@ -272,7 +291,7 @@ namespace OnlineStore.Common ...@@ -272,7 +291,7 @@ namespace OnlineStore.Common
} }
if (dataArray.Length >= 9) 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]) ); 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); int tempV = Convert.ToInt32(data, 16);
return tempV; return tempV;
} }
...@@ -286,7 +305,7 @@ namespace OnlineStore.Common ...@@ -286,7 +305,7 @@ namespace OnlineStore.Common
private static List<double> getReviceData(byte[] dataArray) private static List<double> getReviceData(byte[] dataArray)
{ {
List<double> list = new List<double>(); List<double> list = new List<double>();
try try
{ {
if (dataArray == null) if (dataArray == null)
...@@ -296,10 +315,10 @@ namespace OnlineStore.Common ...@@ -296,10 +315,10 @@ namespace OnlineStore.Common
if (dataArray.Length >= 9) 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 hum = String.Format("{0:X2}", dataArray[5]) + String.Format("{0:X2}", dataArray[6]);
double tempV = (double)Convert.ToInt32(temp, 16)/10; double tempV = (double)Convert.ToInt32(temp, 16) / 10;
double humV =(double) Convert.ToInt32(hum, 16)/10; double humV = (double)Convert.ToInt32(hum, 16) / 10;
list.Add(tempV); list.Add(tempV);
list.Add(humV); list.Add(humV);
} }
...@@ -310,6 +329,6 @@ namespace OnlineStore.Common ...@@ -310,6 +329,6 @@ namespace OnlineStore.Common
} }
return list; return list;
} }
} }
} }
...@@ -19,28 +19,28 @@ namespace OnlineStore.Common ...@@ -19,28 +19,28 @@ namespace OnlineStore.Common
/// <summary> /// <summary>
/// 最后一次接受到的温度信息,key=温湿度传感器IP地址 /// 最后一次接受到的温度信息,key=温湿度传感器IP地址
/// </summary> /// </summary>
public static Dictionary<string, ASTemperateParam> TemperateParamMap = new Dictionary<string, ASTemperateParam>(); public static Dictionary<string, HumitureParam> TemperateParamMap = new Dictionary<string, HumitureParam>();
/// <summary> /// <summary>
/// 根据IP 地址获得最后一次取到的温湿度 /// 根据IP 地址获得最后一次取到的温湿度
/// </summary> /// </summary>
public static ASTemperateParam GetTemperateParam(string ipAddr) public static HumitureParam GetTemperateParam(string ipAddr)
{ {
ASTemperateParam temperate = null; HumitureParam temperate = null;
TemperateParamMap.TryGetValue(ipAddr, out temperate); TemperateParamMap.TryGetValue(ipAddr, out temperate);
return temperate; return temperate;
} }
/// <summary> /// <summary>
/// 显示用的温湿度信息(改为计算平均温湿度) /// 显示用的温湿度信息(改为计算平均温湿度)
/// </summary> /// </summary>
public static ASTemperateParam GetTemperateParam(List<string> ipAddrList) public static HumitureParam GetTemperateParam(List<string> ipAddrList)
{ {
ASTemperateParam temperate = null; HumitureParam temperate = null;
int allCount = 0; int allCount = 0;
double wenDu = 0; double wenDu = 0;
double shiDu = 0; double shiDu = 0;
foreach (string addr in ipAddrList) foreach (string addr in ipAddrList)
{ {
ASTemperateParam param = GetTemperateParam(addr); HumitureParam param = GetTemperateParam(addr);
if (param != null && param.IsValid()) if (param != null && param.IsValid())
{ {
allCount++; allCount++;
...@@ -52,7 +52,7 @@ namespace OnlineStore.Common ...@@ -52,7 +52,7 @@ namespace OnlineStore.Common
{ {
double avgWendu = Math.Round(wenDu / allCount, 1); double avgWendu = Math.Round(wenDu / allCount, 1);
double avgShidu = Math.Round(shiDu / allCount, 1); double avgShidu = Math.Round(shiDu / allCount, 1);
temperate = new ASTemperateParam(avgWendu, avgShidu); temperate = new HumitureParam(avgWendu, avgShidu);
} }
return temperate; return temperate;
} }
...@@ -61,7 +61,7 @@ namespace OnlineStore.Common ...@@ -61,7 +61,7 @@ namespace OnlineStore.Common
double maxValue = 0; double maxValue = 0;
foreach (string addr in ipAddrList) foreach (string addr in ipAddrList)
{ {
ASTemperateParam param = GetTemperateParam(addr); HumitureParam param = GetTemperateParam(addr);
if (param != null && param.IsValid()) if (param != null && param.IsValid())
{ {
if (param.Humidity > maxValue) if (param.Humidity > maxValue)
...@@ -140,7 +140,7 @@ namespace OnlineStore.Common ...@@ -140,7 +140,7 @@ namespace OnlineStore.Common
else else
{ {
double newShiDu = GetRandomSD(); double newShiDu = GetRandomSD();
ASTemperateParam ast = new ASTemperateParam(add, deviceId, pwd, wendu, newShiDu, DateTime.Now); HumitureParam ast = new HumitureParam(add, deviceId, pwd, wendu, newShiDu, DateTime.Now);
if (TemperateParamMap.ContainsKey(add)) if (TemperateParamMap.ContainsKey(add))
{ {
TemperateParamMap.Remove(add); TemperateParamMap.Remove(add);
...@@ -164,7 +164,7 @@ namespace OnlineStore.Common ...@@ -164,7 +164,7 @@ namespace OnlineStore.Common
{ {
double newShiDu = GetRandomSD(); double newShiDu = GetRandomSD();
double newWenDu = GetRandomWD(); double newWenDu = GetRandomWD();
ASTemperateParam ast = new ASTemperateParam(IP, "", "", newWenDu, newShiDu, DateTime.Now); HumitureParam ast = new HumitureParam(IP, "", "", newWenDu, newShiDu, DateTime.Now);
if (TemperateParamMap.ContainsKey(IP)) if (TemperateParamMap.ContainsKey(IP))
{ {
TemperateParamMap.Remove(IP); TemperateParamMap.Remove(IP);
...@@ -212,9 +212,9 @@ namespace OnlineStore.Common ...@@ -212,9 +212,9 @@ namespace OnlineStore.Common
/// <summary> /// <summary>
/// 奥松温湿度上传参数 /// 奥松温湿度上传参数
/// </summary> /// </summary>
public class ASTemperateParam public class HumitureParam
{ {
public ASTemperateParam(string clientipe, string add, string pwd, double wendu, double shidu, DateTime updateTime) public HumitureParam(string clientipe, string add, string pwd, double wendu, double shidu, DateTime updateTime)
{ {
this.IpAddress = clientipe; this.IpAddress = clientipe;
this.DeviceAddress = add; this.DeviceAddress = add;
...@@ -224,7 +224,7 @@ namespace OnlineStore.Common ...@@ -224,7 +224,7 @@ namespace OnlineStore.Common
this.UpdateTime = updateTime; this.UpdateTime = updateTime;
} }
//获取平均值时使用此 参数,只做显示用 //获取平均值时使用此 参数,只做显示用
public ASTemperateParam(double wendu, double shidu) public HumitureParam(double wendu, double shidu)
{ {
this.IpAddress = ""; this.IpAddress = "";
this.DeviceAddress = ""; this.DeviceAddress = "";
......
...@@ -13,13 +13,14 @@ namespace OnlineStore.DeviceLibrary ...@@ -13,13 +13,14 @@ namespace OnlineStore.DeviceLibrary
public bool IsShowMsg = false; public bool IsShowMsg = false;
public static AxisManager instance; public static AxisManager instance;
public void Init() public static bool UseHCBoard = true;
public static void Init()
{ {
bool UseHCBoard = ConfigAppSettings.GetIntValue(Setting_Init.UseHCBoard).Equals(1); UseHCBoard = ConfigAppSettings.GetIntValue(Setting_Init.UseHCBoard).Equals(1);
if (UseHCBoard) if (UseHCBoard)
{ {
//instance = new HCAxisManager(); instance = new HCAxisManager();
} }
else else
{ {
...@@ -27,38 +28,37 @@ namespace OnlineStore.DeviceLibrary ...@@ -27,38 +28,37 @@ namespace OnlineStore.DeviceLibrary
} }
} }
#region 485通信方法
public abstract bool OpenPort(string portName); public abstract bool OpenPort(string portName);
public abstract void ColsePort(string portName); public abstract void ColsePort(string portName);
public abstract void CloseAllPort(); public abstract void CloseAllPort();
public abstract bool ServerOnStatus(string portName, short slvAddr);
public abstract void ClearSpeed(); public abstract void ClearSpeed();
public abstract void InitSlvAddr(string portName, short slvAddr, int targetSpeed, int addSpeed, int delSpeed);
public abstract bool IsHomeMoveEnd(string portName, short slvAddr); public abstract bool IsServeoOn(string portName, short slvAddr);
public abstract void ServoOn(string portName, short slvAddr);
public abstract void ServoOff(string portName, short slvAddr);
public abstract void InitSlvAddr(string portName, short slvAddr);
public abstract void InitSlvAddr(string portName, short slvAddr, int targetSpeed, int addSpeed, int delSpeed); #endregion
public abstract void RelMove(string portName, short slvAddr, int position, int targetSpeed = 0, int ptpAcc = 0, int ptpDec = 0); public abstract bool IsHomeMoveEnd(string portName, short slvAddr);
public abstract bool AbsMoveIsEnd(string portName, short axisNo, int targetPosition, int canErrorCount, out bool countError);
public abstract void ServoOn(string portName, short slvAddr);
public abstract void ServoOff(string portName, short slvAddr);
public abstract void RelMove(string portName, short slvAddr, int position, int targetSpeed = 0, int ptpAcc = 0, int ptpDec = 0);
public abstract void HomeMove(string portName, short slvAddr, int highVel, int lowVel, int acc);
public abstract void HomeMove(string portName, short slvAddr, int highVel, int lowVel, int acc); public abstract void SpeedMove(string portName, short slvAddr, int speed);
public abstract void SpeedMove(string portName, short slvAddr, int speed);
public abstract void SuddenStop(string portName, short slvAddr); public abstract void SuddenStop(string portName, short slvAddr);
public abstract bool isInPosition(ConfigMoveAxis Axis, int PPosition, bool isLog = false); public abstract bool isInPosition(string portName, short slvAddr, int PPosition, int canErrorCount, bool isLog = false);
public abstract void AbsMove(string portName, short slvAddr, int targetPosition, int targetSpeed = 0, int ptpAcc = 0, int ptpDec = 0);
public abstract void AbsMove(string portName, short slvAddr, int targetPosition, int targetSpeed=0 , int ptpAcc=0, int ptpDec=0);
public abstract void AlarmClear(string portName, short slvAddr); public abstract void AlarmClear(string portName, short slvAddr);
public abstract int GetTargetPosition(string portName, short slvAddr); public abstract int GetTargetPosition(string portName, short slvAddr);
public abstract int GetActualtPosition(string portName, short slvAddr);
public abstract int GetActualtPosition(string portName, short slvAddr);
public abstract int GetAlarmStatus(string portName, short slvAddr); public abstract int GetAlarmStatus(string portName, short slvAddr);
public abstract int GetBusyStatus(string portName, short slvAddr); public abstract int GetBusyStatus(string portName, short slvAddr);
...@@ -70,11 +70,11 @@ namespace OnlineStore.DeviceLibrary ...@@ -70,11 +70,11 @@ namespace OnlineStore.DeviceLibrary
/// 负极限 /// 负极限
/// </summary> /// </summary>
public abstract int GetLimitNegativeSingle(string portName, short slvAddr); public abstract int GetLimitNegativeSingle(string portName, short slvAddr);
/// <summary> /// <summary>
/// 正极限 /// 正极限
/// </summary> /// </summary>
public abstract int GetLimitPositiveSingle(string portName, short slvAddr); public abstract int GetLimitPositiveSingle(string portName, short slvAddr);
} }
} }
...@@ -19,7 +19,10 @@ namespace OnlineStore.DeviceLibrary ...@@ -19,7 +19,10 @@ namespace OnlineStore.DeviceLibrary
{ {
HCBoardManager.ClearAxisSts((short)slvAddr); HCBoardManager.ClearAxisSts((short)slvAddr);
} }
public override bool OpenPort(string portName)
{
return true;
}
public override void ClearSpeed() public override void ClearSpeed()
{ {
} }
...@@ -32,7 +35,11 @@ namespace OnlineStore.DeviceLibrary ...@@ -32,7 +35,11 @@ namespace OnlineStore.DeviceLibrary
{ {
} }
public override void InitSlvAddr(string portName, short slvAddr, int targetSpeed, int addSpeed, int delSpeed)
{
}
public override int GetActualtPosition(string portName, short slvAddr) public override int GetActualtPosition(string portName, short slvAddr)
{ {
...@@ -66,9 +73,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -66,9 +73,7 @@ namespace OnlineStore.DeviceLibrary
{ {
AxisSts axisS = HCBoardManager.GetAxisSts(slvAddr); AxisSts axisS = HCBoardManager.GetAxisSts(slvAddr);
return axisS.NEL; return axisS.NEL;
} }
public override int GetLimitPositiveSingle(string portName, short slvAddr) public override int GetLimitPositiveSingle(string portName, short slvAddr)
{ {
AxisSts axisS = HCBoardManager.GetAxisSts(slvAddr); AxisSts axisS = HCBoardManager.GetAxisSts(slvAddr);
...@@ -83,38 +88,22 @@ namespace OnlineStore.DeviceLibrary ...@@ -83,38 +88,22 @@ namespace OnlineStore.DeviceLibrary
public override void HomeMove(string portName, short slvAddr, int highVel, int lowVel, int acc) public override void HomeMove(string portName, short slvAddr, int highVel, int lowVel, int acc)
{ {
HCBoardManager.StartHomeMove(slvAddr,(uint) highVel, (uint)lowVel, (uint)acc); HCBoardManager.StartHomeMove(slvAddr,(uint) highVel, (uint)lowVel, (uint)acc);
} }
public override void InitSlvAddr(string portName, short slvAddr)
{
}
public override void InitSlvAddr(string portName, short slvAddr, int targetSpeed, int addSpeed, int delSpeed)
{
}
public override bool IsHomeMoveEnd(string portName, short slvAddr) public override bool IsHomeMoveEnd(string portName, short slvAddr)
{ {
return HCBoardManager.HomeingIsEnd(slvAddr); return HCBoardManager.HomeingIsEnd(slvAddr);
} }
public override bool isInPosition(ConfigMoveAxis Axis, int PPosition, bool isLog = false) public override bool isInPosition(string portName, short slvAddr, int PPosition, int canErrorCount, bool isLog = false)
{
return HCBoardManager.IsInPosition(Axis.GetAxisValue(), PPosition,Axis .CanErrorCountMax);
}
public override bool OpenPort(string portName)
{ {
return true; return HCBoardManager.IsInPosition(slvAddr, PPosition,canErrorCount );
} }
public override void RelMove(string portName, short slvAddr, int position, int targetSpeed = 0, int ptpAcc = 0, int ptpDec = 0) public override void RelMove(string portName, short slvAddr, int position, int targetSpeed = 0, int ptpAcc = 0, int ptpDec = 0)
{ {
HCBoardManager.RelMove(slvAddr, position, targetSpeed, ptpAcc, ptpDec); HCBoardManager.RelMove(slvAddr, position, targetSpeed, ptpAcc, ptpDec);
} }
public override bool ServerOnStatus(string portName, short slvAddr) public override bool IsServeoOn(string portName, short slvAddr)
{ {
AxisSts axisS = HCBoardManager.GetAxisSts(slvAddr); AxisSts axisS = HCBoardManager.GetAxisSts(slvAddr);
return axisS.ServoOn.Equals(1); return axisS.ServoOn.Equals(1);
...@@ -138,5 +127,19 @@ namespace OnlineStore.DeviceLibrary ...@@ -138,5 +127,19 @@ namespace OnlineStore.DeviceLibrary
{ {
HCBoardManager.AxisStop(slvAddr); HCBoardManager.AxisStop(slvAddr);
} }
public override bool AbsMoveIsEnd(string portName, short axisNo, int targetPosition, int canErrorCount, out bool countError)
{
countError = false;
bool isOk = HCBoardManager.MoveIsEnd(axisNo);
if (HCBoardManager.IsInPosition(axisNo, targetPosition, canErrorCount))
{
return true;
}
else
{
countError = true;
}
return false;
}
} }
} }
...@@ -141,7 +141,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -141,7 +141,7 @@ namespace OnlineStore.DeviceLibrary
/// <summary> /// <summary>
/// 是否成功打开伺服 /// 是否成功打开伺服
/// </summary> /// </summary>
public override bool ServerOnStatus(string portName, short slvAddr) public override bool IsServeoOn(string portName, short slvAddr)
{ {
if (!serialBeanMap.ContainsKey(portName)) if (!serialBeanMap.ContainsKey(portName))
{ {
...@@ -167,11 +167,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -167,11 +167,7 @@ namespace OnlineStore.DeviceLibrary
} }
return false; return false;
} }
public override void InitSlvAddr(string portName, short slvAddr)
{
InitSlvAddr(portName, slvAddr, 100, 30, 30);
//InitSlvAddr(portName, slvAddr, 100, 30, 30, 100, 50, 30);
}
//把数字转换为四位的字符串 //把数字转换为四位的字符串
public string SpeedToStr(int speed, int length) public string SpeedToStr(int speed, int length)
{ {
...@@ -411,15 +407,16 @@ namespace OnlineStore.DeviceLibrary ...@@ -411,15 +407,16 @@ namespace OnlineStore.DeviceLibrary
OpenAndCloseSTB(portName, slvAddr); OpenAndCloseSTB(portName, slvAddr);
} }
public override bool isInPosition(ConfigMoveAxis Axis, int PPosition, bool isLog = false) public override bool isInPosition(string portName, short slvAddr, int PPosition, int canErrorCount,bool isLog = false)
{ {
int outCount = GetActualtPosition(Axis.DeviceName, Axis.GetAxisValue()); string Name = "轴【" + portName + "_" + slvAddr + "】";
int outCount = GetActualtPosition(portName, slvAddr);
int errorCount = Math.Abs(outCount - PPosition); int errorCount = Math.Abs(outCount - PPosition);
if (errorCount <= Axis.CanErrorCountMin) if (errorCount <= canErrorCount)
{ {
if (isLog) if (isLog)
{ {
LogUtil.info("【" + Axis.GetNameStr() + "】isInPosition【" + PPosition + "】,当前实时位置:【" + outCount + "】 return true"); LogUtil.info("【" + Name + "】isInPosition【" + PPosition + "】,当前实时位置:【" + outCount + "】 return true");
} }
return true; return true;
} }
...@@ -427,7 +424,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -427,7 +424,7 @@ namespace OnlineStore.DeviceLibrary
{ {
if (isLog) if (isLog)
{ {
LogUtil.info("【" + Axis.GetNameStr() + "】isInPosition【" + PPosition + "】,当前实时位置:【" + outCount + "】 return false"); LogUtil.info("【" + Name + "】isInPosition【" + PPosition + "】,当前实时位置:【" + outCount + "】 return false");
} }
return false; return false;
} }
...@@ -497,5 +494,24 @@ namespace OnlineStore.DeviceLibrary ...@@ -497,5 +494,24 @@ namespace OnlineStore.DeviceLibrary
//Thread.Sleep(SleepMSendons); //Thread.Sleep(SleepMSendons);
OpenAndCloseSTB(portName, slvAddr); OpenAndCloseSTB(portName, slvAddr);
} }
public override bool AbsMoveIsEnd(string portName, short axisNo, int targetPosition, int canErrorCount, out bool countError)
{
countError = false;
bool isOk = AxisManager.instance.GetBusyStatus(portName, axisNo).Equals(0);
int CurrPosition = AxisManager.instance.GetActualtPosition(portName, axisNo);
int errorCount = Math.Abs(CurrPosition - targetPosition);
if (isOk)
{
if (errorCount <= canErrorCount)
{
return true;
}
else
{
countError = true;
}
}
return false;
}
} }
} }
...@@ -13,8 +13,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -13,8 +13,7 @@ namespace OnlineStore.DeviceLibrary
partial class ACServerManager partial class ACServerManager
{ {
private Dictionary<int, Dictionary<string, RegisterInfo>> LastDataMap = new Dictionary<int, Dictionary<string, RegisterInfo>>(); private Dictionary<int, Dictionary<string, RegisterInfo>> LastDataMap = new Dictionary<int, Dictionary<string, RegisterInfo>>();
//private SerialBean bean = null;
private string strFromat = "{0:X2}"; private string strFromat = "{0:X2}";
private Dictionary<string, AcSerialBean> serialBeanMap = new Dictionary<string, AcSerialBean>(); private Dictionary<string, AcSerialBean> serialBeanMap = new Dictionary<string, AcSerialBean>();
...@@ -467,6 +466,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -467,6 +466,7 @@ namespace OnlineStore.DeviceLibrary
byte[] reviceData = SendCommand(portName, dataArray, ReviceOutTimeMS, 6); byte[] reviceData = SendCommand(portName, dataArray, ReviceOutTimeMS, 6);
return GetCoilData(portName, reviceData, ACCMDManager.Home_Single); return GetCoilData(portName, reviceData, ACCMDManager.Home_Single);
} }
} }
/// <summary> /// <summary>
/// 记录最后一次获得的寄存器的值 /// 记录最后一次获得的寄存器的值
......
...@@ -57,6 +57,7 @@ ...@@ -57,6 +57,7 @@
<Compile Include="acSingleStore\BoxBean.cs" /> <Compile Include="acSingleStore\BoxBean.cs" />
<Compile Include="acSingleStore\BoxBean_Inventory.cs" /> <Compile Include="acSingleStore\BoxBean_Inventory.cs" />
<Compile Include="acSingleStore\BoxBean_Partial.cs" /> <Compile Include="acSingleStore\BoxBean_Partial.cs" />
<Compile Include="acSingleStore\HumitureBean.cs" />
<Compile Include="acSingleStore\StoreBean.cs" /> <Compile Include="acSingleStore\StoreBean.cs" />
<Compile Include="acSingleStore\StoreManager.cs" /> <Compile Include="acSingleStore\StoreManager.cs" />
<Compile Include="AXIS\AxisManager.cs" /> <Compile Include="AXIS\AxisManager.cs" />
......
...@@ -343,7 +343,9 @@ namespace OnlineStore.DeviceLibrary ...@@ -343,7 +343,9 @@ namespace OnlineStore.DeviceLibrary
} }
private void SI_05_DeviceToDoor() private void SI_05_DeviceToDoor()
{ {
if (!AxisManager.instance.isInPosition(Config.UpDown_Axis, MoveInfo.MoveParam.MoveP.UpDown_P1,true)) ConfigMoveAxis updown = Config.UpDown_Axis;
if (!AxisManager.instance.isInPosition(updown.DeviceName, updown.GetAxisValue(), MoveInfo.MoveParam.MoveP.UpDown_P1, updown.CanErrorCountMax,true))
{ {
MoveInfo.NextMoveStep(StoreMoveStep.SI_03_ReturnHome); MoveInfo.NextMoveStep(StoreMoveStep.SI_03_ReturnHome);
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(500)); MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(500));
...@@ -351,7 +353,8 @@ namespace OnlineStore.DeviceLibrary ...@@ -351,7 +353,8 @@ namespace OnlineStore.DeviceLibrary
ACAxisMove(Config.UpDown_Axis, MoveInfo.MoveParam.MoveP.UpDown_P1, Config.UpDownAxis_P1_Speed); ACAxisMove(Config.UpDown_Axis, MoveInfo.MoveParam.MoveP.UpDown_P1, Config.UpDownAxis_P1_Speed);
return; return;
} }
if (!AxisManager.instance.isInPosition(Config.Middle_Axis, MoveInfo.MoveParam.MoveP.Middle_P1)) ConfigMoveAxis middle = Config.Middle_Axis;
if (!AxisManager.instance.isInPosition(middle.DeviceName, middle.GetAxisValue(), MoveInfo.MoveParam.MoveP.Middle_P1, middle.CanErrorCountMax, true))
{ {
MoveInfo.NextMoveStep(StoreMoveStep.SI_03_ReturnHome); MoveInfo.NextMoveStep(StoreMoveStep.SI_03_ReturnHome);
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(500)); MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(500));
...@@ -395,7 +398,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -395,7 +398,7 @@ namespace OnlineStore.DeviceLibrary
else if (MoveInfo.IsTimeOut(10)) else if (MoveInfo.IsTimeOut(10))
{ {
WarnMsg = Name + "入库 等待料仓门口检测到料盘 [" + MoveInfo.MoveParam.PosInfo.barcode + "] [" + MoveInfo.MoveParam.PosInfo.PosId + "] 超时 [" + Math.Round(MoveInfo.StepSpan().TotalSeconds, 1) + "]秒 "; WarnMsg = Name + "入库 等待料仓门口检测到料盘 [" + MoveInfo.MoveParam.PosInfo.barcode + "] [" + MoveInfo.MoveParam.PosInfo.PosId + "] 超时 [" + Math.Round(MoveInfo.StepSpan().TotalSeconds, 1) + "]秒 ";
LogUtil.error( WarnMsg, 100); LogUtil.error(WarnMsg, 100);
Alarm(StoreAlarmType.IoSingleTimeOut, "", WarnMsg, MoveInfo.MoveType); Alarm(StoreAlarmType.IoSingleTimeOut, "", WarnMsg, MoveInfo.MoveType);
//InStoreLog(" 入库:SI_00 入库等待仓门口料盘信号"); //InStoreLog(" 入库:SI_00 入库等待仓门口料盘信号");
...@@ -428,7 +431,8 @@ namespace OnlineStore.DeviceLibrary ...@@ -428,7 +431,8 @@ namespace OnlineStore.DeviceLibrary
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000)); MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000));
ComMoveToPosition(moveP.ComPress_P3, Config.CompAxis_P3_Speed); ComMoveToPosition(moveP.ComPress_P3, Config.CompAxis_P3_Speed);
if (!AxisManager.instance.isInPosition(Config.UpDown_Axis, moveP.UpDown_P1)) ConfigMoveAxis updown = Config.UpDown_Axis;
if (!AxisManager.instance.isInPosition(updown.DeviceName, updown.GetAxisValue(), moveP.UpDown_P1, updown.CanErrorCountMax))
{ {
ACAxisMove(Config.UpDown_Axis, moveP.UpDown_P1, Config.UpDownAxis_P1_Speed); ACAxisMove(Config.UpDown_Axis, moveP.UpDown_P1, Config.UpDownAxis_P1_Speed);
} }
...@@ -436,7 +440,8 @@ namespace OnlineStore.DeviceLibrary ...@@ -436,7 +440,8 @@ namespace OnlineStore.DeviceLibrary
{ {
InStoreLog("入库:SI_03 升降轴已在P1[" + moveP.UpDown_P1 + "]"); InStoreLog("入库:SI_03 升降轴已在P1[" + moveP.UpDown_P1 + "]");
} }
if (!AxisManager.instance.isInPosition(Config.Middle_Axis, moveP.Middle_P1)) ConfigMoveAxis middle = Config.Middle_Axis;
if (!AxisManager.instance.isInPosition(middle.DeviceName, middle.GetAxisValue(), moveP.Middle_P1, middle.GetAxisValue()))
{ {
ACAxisMove(Config.Middle_Axis, moveP.Middle_P1, Config.MiddleAxis_P1_Speed); ACAxisMove(Config.Middle_Axis, moveP.Middle_P1, Config.MiddleAxis_P1_Speed);
} }
...@@ -477,14 +482,14 @@ namespace OnlineStore.DeviceLibrary ...@@ -477,14 +482,14 @@ namespace OnlineStore.DeviceLibrary
CodeMsg = "入库[" + posId + "]叉子取料后退后,未检测到料叉有料"; CodeMsg = "入库[" + posId + "]叉子取料后退后,未检测到料叉有料";
LogUtil.error(CodeMsg); LogUtil.error(CodeMsg);
} }
InStoreLog("入库:SI_09 移动到库位点,旋转轴至P2(库位点)[" + moveP.Middle_P2 + "], 升降轴至P3(库位入库前点)[" + moveP.UpDown_P3 + "] "); InStoreLog("入库:SI_09 移动到库位点,旋转轴至P2(库位点)[" + moveP.Middle_P2 + "], 升降轴至P3(库位入库前点)[" + moveP.UpDown_P3 + "] ");
MoveInfo.NextMoveStep(StoreMoveStep.SI_09_MoveToBag); MoveInfo.NextMoveStep(StoreMoveStep.SI_09_MoveToBag);
ACAxisMove(Config.Middle_Axis, moveP.Middle_P2, Config.MiddleAxis_P2_Speed); ACAxisMove(Config.Middle_Axis, moveP.Middle_P2, Config.MiddleAxis_P2_Speed);
ACAxisMove(Config.UpDown_Axis, moveP.UpDown_P3, Config.UpDownAxis_P3_Speed); ACAxisMove(Config.UpDown_Axis, moveP.UpDown_P3, Config.UpDownAxis_P3_Speed);
CloseDoor(false); CloseDoor(false);
} }
else if (MoveInfo.MoveStep == StoreMoveStep.SI_08_LocationCylinder_Up) else if (MoveInfo.MoveStep == StoreMoveStep.SI_08_LocationCylinder_Up)
{ {
...@@ -499,11 +504,9 @@ namespace OnlineStore.DeviceLibrary ...@@ -499,11 +504,9 @@ namespace OnlineStore.DeviceLibrary
} }
else if (MoveInfo.MoveStep == StoreMoveStep.SI_09_MoveToBag) else if (MoveInfo.MoveStep == StoreMoveStep.SI_09_MoveToBag)
{ {
InStoreLog("入库:SI_11 叉子进入库位中,进出轴至P3(库位取放料点) [" + moveP.InOut_P3 + "]");
InStoreLog("入库:SI_11 叉子进入库位中,进出轴至P3(库位取放料点) [" + moveP.InOut_P3 + "]"); MoveInfo.NextMoveStep(StoreMoveStep.SI_11_DeviceToBag);
MoveInfo.NextMoveStep(StoreMoveStep.SI_11_DeviceToBag); ACAxisMove(Config.InOut_Axis, moveP.InOut_P3, Config.InOutAxis_P3_Speed);
ACAxisMove(Config.InOut_Axis, moveP.InOut_P3, Config.InOutAxis_P3_Speed);
} }
else if (MoveInfo.MoveStep == StoreMoveStep.SI_10_LocationCylinder_Down) else if (MoveInfo.MoveStep == StoreMoveStep.SI_10_LocationCylinder_Down)
{ {
...@@ -554,7 +557,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -554,7 +557,7 @@ namespace OnlineStore.DeviceLibrary
{ {
TimeSpan span = DateTime.Now - startInStoreTime; TimeSpan span = DateTime.Now - startInStoreTime;
string posId = MoveInfo.MoveParam != null ? MoveInfo.MoveParam.PosInfo.PosId : ""; string posId = MoveInfo.MoveParam != null ? MoveInfo.MoveParam.PosInfo.PosId : "";
LogUtil.info( Name + " 【" + posId + "】 整个入库流程结束,耗时【" + FormUtil.GetSpanStr(span) + "】!" ); LogUtil.info(Name + " 【" + posId + "】 整个入库流程结束,耗时【" + FormUtil.GetSpanStr(span) + "】!");
MoveInfo.EndMove(); MoveInfo.EndMove();
storeRunStatus = StoreRunStatus.Runing; storeRunStatus = StoreRunStatus.Runing;
//设备连接,入库后,BOX恢复原始状态 //设备连接,入库后,BOX恢复原始状态
...@@ -563,7 +566,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -563,7 +566,7 @@ namespace OnlineStore.DeviceLibrary
} }
else else
{ {
LogUtil.info( Name + " 入库,moveStatus=" + MoveInfo.MoveStep + ",没有对应的处理!"); LogUtil.info(Name + " 入库,moveStatus=" + MoveInfo.MoveStep + ",没有对应的处理!");
} }
} }
......
using OnlineStore.Common;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace OnlineStore.DeviceLibrary
{
public class HumitureBean
{
private string PortName = "";
private string Name = "";
public HumitureParam LastData = new HumitureParam(0, 0);
internal HumitureBean(string port, string deviceName)
{
this.Name = deviceName;
this.PortName = port;
}
public HumitureParam QueryData()
{
HumitureParam param = HumitureController.QueryData(PortName);
LastData = param;
return LastData;
}
internal void ProcessHumidityCMD(Operation resultOperation)
{
Dictionary<string, string> data = resultOperation.data;
if (data != null && data.ContainsKey(ParamDefine.maxHumidity) && data.ContainsKey(ParamDefine.maxTemperature))
{
string maxHumidity = data[ParamDefine.maxHumidity];
string maxTemp = data[ParamDefine.maxTemperature];
LogUtil.info(Name + "收到服务器温湿度预警值:maxHumidity=" + maxHumidity + ",maxTemperature=" + maxTemp);
try
{
this.Max_Humidity = (float)Convert.ToDouble(maxHumidity);
this.Max_Temperature = (float)Convert.ToDouble(maxTemp);
LogUtil.info(Name + "保存温湿度预警值:Max_Humidity=" + Max_Humidity + ",Max_Temperature=" + Max_Temperature);
}
catch (Exception ex)
{
LogUtil.error(Name + "转换温湿度失败:" + ex.ToString());
}
}
}
#region 温湿度处理
/// <summary>
/// 湿度标准,超过后需要报警
/// </summary>
private float Max_Humidity = 0;
/// <summary>
/// 温度标准,超过后需要报警
/// </summary>
private float Max_Temperature = 0;
private bool IsInBlowing = false;
private DateTime LastBeginBlowTime = DateTime.Now;
private DateTime LastEndBlowTime = new DateTime(1997, 1, 1);
private DateTime preLogTime = DateTime.Now;
public bool TempOrHumidityIsAlarm = false;
public DateTime TempAlarmTime = DateTime.Now;
private float StartBlowValue = (float)ConfigAppSettings.GetNumValue(Setting_Init.StartBlowValue);
private float StopBlowValue = (float)ConfigAppSettings.GetNumValue(Setting_Init.StopBlowValue);
public string currTempStr = "";
internal void HumidityProcess(BoxBean box)
{
try
{
if ((DateTime.Now - preLogTime).TotalSeconds > (8 + box.DeviceID))
{
preLogTime = DateTime.Now;
//用最大的湿度判断是否需要吹气,开始吹气的值=发过来的值-4
//温湿度
//ASTemperateParam param = HumitureServer.GetTemperateParam(Config.GetTempAddrList());
HumitureParam param = QueryData();
double humidity = 0;
double temp = 0;
if (param != null)
{
humidity = param.Humidity;
temp = param.Temperate;
currTempStr = Name + ("湿度:" + humidity.ToString() + ",温度:" + temp);
}
//double currMaxHumidity = HumitureServer.GetMaxHumidity(Config.GetTempAddrList());
double currMaxHumidity = param.Humidity;
float startBlowHumidity = Max_Humidity - StartBlowValue;
float stopBlowHumidity = Max_Humidity - StopBlowValue;
////判断是否需要吹气
//if (startBlowHumidity > 0 && startBlowHumidity < currMaxHumidity && IsInBlowing.Equals(false))
//{
// //判断是否距离上次结束指定的时间
// TimeSpan span = DateTime.Now - LastEndBlowTime;
// if (span.TotalMinutes > box.Config.BlowAir_Interval)
// {
// LogUtil.info(Name + "当前最大湿度:" + currMaxHumidity.ToString() + ",开始吹气湿度:" + startBlowHumidity + ",当前不在吹气中,且间隔超过" + box.Config.BlowAir_Interval + "分钟,开始吹气!");
// IsInBlowing = true;
// //Thread.Sleep(100);
// box.IOMove(IO_Type.StartOrStopBlow, IO_VALUE.HIGH);
// LastBeginBlowTime = DateTime.Now;
// LastEndBlowTime = DateTime.Now;
// }
//}
//if (IsInBlowing && stopBlowHumidity > currMaxHumidity)
//{
// LogUtil.info(Name + "当前最大湿度:" + currMaxHumidity.ToString() + ",停止吹气湿度:" + stopBlowHumidity + ",停止吹气!");
// IsInBlowing = false;
// box.IOMove(IO_Type.StartOrStopBlow, IO_VALUE.LOW);
// LastEndBlowTime = DateTime.Now;
//}
//if (IsInBlowing)
//{
// //判断是否需要结束吹气
// TimeSpan span = DateTime.Now - LastBeginBlowTime;
// if (span.TotalMinutes > box.Config.BlowAir_Time)
// {
// LogUtil.info(Name + "已经吹气" + span.TotalMinutes + "分钟,超过配置的吹气时间" + box.Config.BlowAir_Time + "分钟,停止吹气!");
// IsInBlowing = false;
// //Thread.Sleep(100);
// box.IOMove(IO_Type.StartOrStopBlow, IO_VALUE.LOW);
// LastEndBlowTime = DateTime.Now;
// }
//}
bool needAlarm = false;
//如果开始吹气并且当前达到报警值
if (IsInBlowing && humidity > Max_Humidity)
{
needAlarm = true;
}
else if (temp > Max_Temperature && Max_Temperature > 0)
{
LogUtil.info(Name + "当前温度【" + param.Temperate + "】超过最高温度【" + Max_Temperature + "】,开始报警!");
needAlarm = true;
//box.IOMove(IO_Type.StartOrStopBlow, IO_VALUE.LOW);
}
else if (temp < Max_Temperature)
{
if (IsInBlowing.Equals(false) && TempOrHumidityIsAlarm)
{
LogUtil.info(Name + "不在吹气中,且当前温度【" + param.Temperate + "】低于【" + Max_Temperature + "】,关闭报警!");
TempOrHumidityIsAlarm = false;
//box.IOMove(IO_Type.StartOrStopBlow, IO_VALUE.LOW);
}
}
else
{
TempOrHumidityIsAlarm = false;
}
if (needAlarm)
{
HTAlarm();
}
}
}
catch (Exception ex)
{
LogUtil.error(Name + "HumidityProcess出错:" + ex.ToString());
}
}
private void HTAlarm()
{
if (TempOrHumidityIsAlarm)
{
return;
}
TempAlarmTime = DateTime.Now;
TempOrHumidityIsAlarm = true;
}
internal bool NeedGetTem()
{
if (Max_Humidity <= 0 || (Max_Temperature <= 0))
{
return true;
}
return false;
}
#endregion
}
}
...@@ -13,15 +13,9 @@ using System.Threading.Tasks; ...@@ -13,15 +13,9 @@ using System.Threading.Tasks;
using System.Timers; using System.Timers;
namespace OnlineStore.DeviceLibrary namespace OnlineStore.DeviceLibrary
{ {
/// <summary>
/// 流水线自动料仓-流水线类
/// </summary>
public partial class StoreBean : KTK_Store public partial class StoreBean : KTK_Store
{ {
/// <summary>
/// 灯闪烁定时器
/// </summary>
private System.Timers.Timer ledProcessTimer = null; private System.Timers.Timer ledProcessTimer = null;
public Dictionary<int, BoxConfig> BoxConfigMap { get; set; } public Dictionary<int, BoxConfig> BoxConfigMap { get; set; }
...@@ -49,25 +43,20 @@ namespace OnlineStore.DeviceLibrary ...@@ -49,25 +43,20 @@ namespace OnlineStore.DeviceLibrary
List<string> ioList = new List<string>(); List<string> ioList = new List<string>();
IOManager.Init(); IOManager.Init();
//AddDeviceName(ioList, Config.DIODeviceNameList); AxisManager.Init();
foreach (BoxConfig config in configList.Values) foreach (BoxConfig config in configList.Values)
{ {
BoxBean equip = new BoxBean(config); BoxBean equip = new BoxBean(config);
//增加站号名称
//AddDeviceName(ioList, config.DIODeviceNameList);
BoxMap.Add(config.DeviceID, equip); BoxMap.Add(config.DeviceID, equip);
BoxConfigMap.Add(config.DeviceID, config); BoxConfigMap.Add(config.DeviceID, config);
} }
//先初始化设备 //先初始化设备
Task.Factory.StartNew(delegate Task.Factory.StartNew(delegate
{ {
// RFIDManager.RfidReader.Open(rfidList.ToArray());
IOManager.instance.ConnectionIOList(ioList); IOManager.instance.ConnectionIOList(ioList);
addLastDI(IO_Type.Airpressure_Check, IOValue(IO_Type.Airpressure_Check)); addLastDI(IO_Type.Airpressure_Check, IOValue(IO_Type.Airpressure_Check));
addLastDI(IO_Type.SuddenStop_BTN, IOValue(IO_Type.SuddenStop_BTN)); addLastDI(IO_Type.SuddenStop_BTN, IOValue(IO_Type.SuddenStop_BTN));
...@@ -76,21 +65,10 @@ namespace OnlineStore.DeviceLibrary ...@@ -76,21 +65,10 @@ namespace OnlineStore.DeviceLibrary
IOMove(IO_Type.AutoRun_HddLed, IO_VALUE.LOW); IOMove(IO_Type.AutoRun_HddLed, IO_VALUE.LOW);
IOMove(IO_Type.RunSign_HddLed, IO_VALUE.LOW); IOMove(IO_Type.RunSign_HddLed, IO_VALUE.LOW);
mainTimer.Enabled = true; mainTimer.Enabled = true;
canStart = true; canStart = true;
}); });
} }
private void AddDeviceName(List<string> targetList, List<string> list)
{
foreach (string str in list)
{
if (!targetList.Contains(str))
{
targetList.Add(str);
}
}
}
public void InitTimer() public void InitTimer()
{ {
ledProcessTimer = new System.Timers.Timer(); ledProcessTimer = new System.Timers.Timer();
......
...@@ -4,6 +4,7 @@ using OnlineStore.LoadCSVLibrary; ...@@ -4,6 +4,7 @@ using OnlineStore.LoadCSVLibrary;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Drawing; using System.Drawing;
using System.IO.IsolatedStorage;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading; using System.Threading;
...@@ -26,7 +27,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -26,7 +27,7 @@ namespace OnlineStore.DeviceLibrary
/// <summary> /// <summary>
/// 提示消息,一般发给服务器后清空(LineBean表示报警提示消息,BoxBean表示出入库失败的原因记录) /// 提示消息,一般发给服务器后清空(LineBean表示报警提示消息,BoxBean表示出入库失败的原因记录)
/// </summary> /// </summary>
public string WarnMsg = ""; public string WarnMsg = "";
public string Name { get; set; } public string Name { get; set; }
public int DeviceID { get; set; } public int DeviceID { get; set; }
...@@ -42,18 +43,18 @@ namespace OnlineStore.DeviceLibrary ...@@ -42,18 +43,18 @@ namespace OnlineStore.DeviceLibrary
private bool isInit = false; private bool isInit = false;
public bool IsDebug = false; public bool IsDebug = false;
public StoreMoveInfo MoveInfo = null; public StoreMoveInfo MoveInfo = null;
public KTK_Store() public KTK_Store()
{ {
} }
public DateTime StartTime { get; set; } public DateTime StartTime { get; set; }
public DateTime lastAirCloseTime = DateTime.Now; public DateTime lastAirCloseTime = DateTime.Now;
public bool isInSuddenDown = false; public bool isInSuddenDown = false;
public bool isNoAirCheck = false; public bool isNoAirCheck = false;
public StoreAlarmType alarmType = StoreAlarmType.None; public StoreAlarmType alarmType = StoreAlarmType.None;
public AlarmInfo alarmInfo = new AlarmInfo(); public AlarmInfo alarmInfo = new AlarmInfo();
/// <summary> /// <summary>
...@@ -82,7 +83,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -82,7 +83,7 @@ namespace OnlineStore.DeviceLibrary
} }
} }
public TimeSpan GetStoreRunTime() public TimeSpan GetStoreRunTime()
{ {
if (StartTime != null) if (StartTime != null)
...@@ -93,7 +94,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -93,7 +94,7 @@ namespace OnlineStore.DeviceLibrary
{ {
return new TimeSpan(0); return new TimeSpan(0);
} }
} }
protected bool isInPro = false; protected bool isInPro = false;
protected virtual void BusyMoveProcess() protected virtual void BusyMoveProcess()
{ {
...@@ -114,10 +115,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -114,10 +115,7 @@ namespace OnlineStore.DeviceLibrary
OutStoreProcess(); OutStoreProcess();
isInPro = false; isInPro = false;
break; break;
case StoreMoveType.ReturnHome: case StoreMoveType.ReturnHome:
ReturnHomeProcess();
isInPro = false;
break;
case StoreMoveType.StoreReset: case StoreMoveType.StoreReset:
ResetProcess(); ResetProcess();
isInPro = false; isInPro = false;
...@@ -197,7 +195,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -197,7 +195,7 @@ namespace OnlineStore.DeviceLibrary
/// <summary> /// <summary>
/// 停止所有运动 /// 停止所有运动
/// </summary> /// </summary>
public abstract void StopMove( ); public abstract void StopMove();
/// <summary> /// <summary>
/// 重置处理 /// 重置处理
...@@ -208,65 +206,41 @@ namespace OnlineStore.DeviceLibrary ...@@ -208,65 +206,41 @@ namespace OnlineStore.DeviceLibrary
/// </summary> /// </summary>
protected virtual void InventoryProcess() protected virtual void InventoryProcess()
{ {
} }
/// <summary>
/// 原点返回处理
/// </summary>
protected virtual void ReturnHomeProcess() { }
/// <summary>
/// 松下伺服轴原点返回运动,等待收到反馈后才会返回
/// </summary>
protected void ACAxisHomeMove(ConfigMoveAxis moveAxis) protected void ACAxisHomeMove(ConfigMoveAxis moveAxis)
{ {
moveAxis.TargetPosition = 0; moveAxis.TargetPosition = 0;
LogUtil.info( moveAxis.DisplayStr + "speed[" + moveAxis.TargetSpeed + "]开始原点返回"); LogUtil.info(moveAxis.DisplayStr + "speed[" + moveAxis.TargetSpeed + "]开始原点返回");
MoveInfo.WaitList.Add(WaitResultInfo.WaitAxis(moveAxis, true)); MoveInfo.WaitList.Add(WaitResultInfo.WaitAxis(moveAxis, true));
AxisManager.instance.HomeMove(moveAxis.DeviceName, (short)moveAxis.GetAxisValue(), moveAxis.HomeHighSpeed,moveAxis.HomeLowSpeed,moveAxis.HomeAddSpeed); AxisManager.instance.HomeMove(moveAxis.DeviceName, (short)moveAxis.GetAxisValue(), moveAxis.HomeHighSpeed, moveAxis.HomeLowSpeed, moveAxis.HomeAddSpeed);
} }
/// <summary>
/// 松下伺服电机运动
/// </summary>
protected void ACAxisMove(ConfigMoveAxis moveAxis, int targetPosition, int targetSpeed) protected void ACAxisMove(ConfigMoveAxis moveAxis, int targetPosition, int targetSpeed)
{ {
MoveInfo.WaitList.Add(WaitResultInfo.WaitAxis(moveAxis, targetPosition, targetSpeed)); MoveInfo.WaitList.Add(WaitResultInfo.WaitAxis(moveAxis, targetPosition, targetSpeed));
moveAxis.TargetPosition = targetPosition; moveAxis.TargetPosition = targetPosition;
AxisManager.instance.AbsMove(moveAxis.DeviceName, moveAxis.GetAxisValue(), targetPosition, targetSpeed); AxisManager.instance.AbsMove(moveAxis.DeviceName, moveAxis.GetAxisValue(), targetPosition, targetSpeed);
} }
/// <summary>
/// 判断AC伺服电机轴是否运动完成
/// </summary>
protected bool ACAxisMoveIsEnd(ConfigMoveAxis moveAxis, int targetPosition, int targetSpeed, out string msg) protected bool ACAxisMoveIsEnd(ConfigMoveAxis moveAxis, int targetPosition, int targetSpeed, out string msg)
{ {
msg = ""; msg = "";
string deviceName = moveAxis.DeviceName; string deviceName = moveAxis.DeviceName;
short axisNo = moveAxis.GetAxisValue(); short axisNo = moveAxis.GetAxisValue();
bool countError = false;
//如果是进出轴,并且光栅被遮挡,直接返回false bool IsOk = AxisManager.instance.AbsMoveIsEnd(deviceName, axisNo, targetPosition, moveAxis.CanErrorCountMax, out countError);
//if (NeedCheckSafetyLight.Equals(2)) if (IsOk)
//{
// if (StoreMove.MoveStep.Equals(StoreMoveStep.SO_10_DeviceToDoor) ||
// StoreMove.MoveStep.Equals(StoreMoveStep.SI_05_DeviceToDoor))
// {
// return false;
// }
//}
bool isOk = AxisManager.instance.GetBusyStatus(deviceName, axisNo).Equals(0);
int outCount = AxisManager.instance.GetActualtPosition(deviceName, axisNo);
int errorCount = Math.Abs(outCount - targetPosition);
if (isOk)
{ {
if (errorCount <= moveAxis.CanErrorCountMax) return true;
{ }
return true; if (countError)
} {
int outCount = AxisManager.instance.GetActualtPosition(deviceName, axisNo);
//判断是否需要重新运动 //判断是否需要重新运动
if (MoveInfo.CanWhileCount > 0) if (MoveInfo.CanWhileCount > 0)
{ {
LogUtil.error( moveAxis.DisplayStr + "目标位置[" + targetPosition + "]当前位置[" + outCount + LogUtil.error(moveAxis.DisplayStr + "目标位置[" + targetPosition + "]当前位置[" + outCount +
"],误差过大,重新开始运动,剩余[" + MoveInfo.CanWhileCount + "]次"); "],误差过大,重新开始运动,剩余[" + MoveInfo.CanWhileCount + "]次");
AxisManager.instance.AbsMove(moveAxis.DeviceName, moveAxis.GetAxisValue(), targetPosition, targetSpeed); AxisManager.instance.AbsMove(moveAxis.DeviceName, moveAxis.GetAxisValue(), targetPosition, targetSpeed);
MoveInfo.CanWhileCount--; MoveInfo.CanWhileCount--;
...@@ -275,9 +249,9 @@ namespace OnlineStore.DeviceLibrary ...@@ -275,9 +249,9 @@ namespace OnlineStore.DeviceLibrary
{ {
msg = Name + " storeMoveStep=" + MoveInfo.MoveStep + moveAxis.DisplayStr + "目标位置[" + targetPosition + "]当前位置[" + outCount msg = Name + " storeMoveStep=" + MoveInfo.MoveStep + moveAxis.DisplayStr + "目标位置[" + targetPosition + "]当前位置[" + outCount
+ "],误差过大,需要报警"; + "],误差过大,需要报警";
LogUtil.error( msg); LogUtil.error(msg);
} }
} }
return false; return false;
} }
protected bool ACHomeMoveIsEnd(ConfigMoveAxis moveAxis, out string msg) protected bool ACHomeMoveIsEnd(ConfigMoveAxis moveAxis, out string msg)
......
...@@ -122,10 +122,10 @@ namespace OnlineStore.DeviceLibrary ...@@ -122,10 +122,10 @@ namespace OnlineStore.DeviceLibrary
/// </summary> /// </summary>
Wait = 0, Wait = 0,
#region 料仓原点返回和重置步骤 #region 料仓原点返回和重置步骤
/// <summary> ///// <summary>
/// 料仓原点返回和重置步骤,,定位气缸下降 ///// 料仓原点返回和重置步骤,,定位气缸下降
/// </summary> ///// </summary>
BOX_H_LocationCylinderBack = 010, //BOX_H_LocationCylinderBack = 010,
/// <summary> /// <summary>
/// 料仓原点返回和重置步骤,轴三先相对走3000 /// 料仓原点返回和重置步骤,轴三先相对走3000
......
...@@ -39,6 +39,7 @@ ...@@ -39,6 +39,7 @@
<!--是否调试状态--> <!--是否调试状态-->
<add key="IsInDebug" value="1" /> <add key="IsInDebug" value="1" />
<add key="ClientSettingsProvider.ServiceUri" value="" /> <add key="ClientSettingsProvider.ServiceUri" value="" />
<add key ="App_AutoRun" value ="0"/>
</appSettings> </appSettings>
<log4net> <log4net>
<appender name="RollingLogFileAppender" type="log4net.Appender.RollingFileAppender"> <appender name="RollingLogFileAppender" type="log4net.Appender.RollingFileAppender">
......
...@@ -17,16 +17,12 @@ namespace OnlineStore.ACSingleStore ...@@ -17,16 +17,12 @@ namespace OnlineStore.ACSingleStore
{ {
public partial class FrmAxisDebug : FrmBase public partial class FrmAxisDebug : FrmBase
{ {
//private KTK_LA_BoxBean store;
private ConfigMoveAxis middle = null; private ConfigMoveAxis middle = null;
private ConfigMoveAxis updown = null; private ConfigMoveAxis updown = null;
//private ConfigMoveAxis compress = null;
private ConfigMoveAxis inout = null; private ConfigMoveAxis inout = null;
private ConfigMoveAxis comp = null; private ConfigMoveAxis comp = null;
//private int compress_Slv = 0; private BoxBean boxBean;
private BoxBean boxBean;
public static readonly ILog LOGGER = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
public FrmAxisDebug(BoxBean boxBean) public FrmAxisDebug(BoxBean boxBean)
{ {
this.boxBean = boxBean; this.boxBean = boxBean;
...@@ -42,7 +38,7 @@ namespace OnlineStore.ACSingleStore ...@@ -42,7 +38,7 @@ namespace OnlineStore.ACSingleStore
private void AxisMove(ConfigMoveAxis axis, int speed) private void AxisMove(ConfigMoveAxis axis, int speed)
{ {
LogUtil.debug(LOGGER, "点动:deviceName=" + axis.DeviceName + ",axis=" + axis.GetAxisValue() + ",speed=" + speed); LogUtil.debug( "点动:deviceName=" + axis.DeviceName + ",axis=" + axis.GetAxisValue() + ",speed=" + speed);
AxisManager.instance.SpeedMove(axis.DeviceName, axis.GetAxisValue(), speed); AxisManager.instance.SpeedMove(axis.DeviceName, axis.GetAxisValue(), speed);
} }
......
...@@ -24,7 +24,7 @@ namespace OnlineStore.ACSingleStore ...@@ -24,7 +24,7 @@ namespace OnlineStore.ACSingleStore
{ {
private int StoreId = 1; private int StoreId = 1;
private BoxBean boxBean; private BoxBean boxBean;
public static readonly ILog LOGGER = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); //public static readonly ILog LOGGER = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
public FrmIOStatus() public FrmIOStatus()
{ {
Control.CheckForIllegalCrossThreadCalls = false; Control.CheckForIllegalCrossThreadCalls = false;
...@@ -49,7 +49,7 @@ namespace OnlineStore.ACSingleStore ...@@ -49,7 +49,7 @@ namespace OnlineStore.ACSingleStore
this.tableLayoutPanel1.RowCount = boxBean.Config.DIList.Count; this.tableLayoutPanel1.RowCount = boxBean.Config.DIList.Count;
foreach (ConfigIO ioValue in boxBean.Config.DIList.Values) foreach (ConfigIO ioValue in boxBean.Config.DIList.Values)
{ {
this.tableLayoutPanel1.RowStyles.Add(new RowStyle(SizeType.Absolute, 26)); this.tableLayoutPanel1.RowStyles.Add(new RowStyle(SizeType.Absolute, 28));
IOTextControl control = new IOTextControl(ioValue.ElectricalDefinition + "_" + ioValue.Explain, ioValue.ProName); IOTextControl control = new IOTextControl(ioValue.ElectricalDefinition + "_" + ioValue.Explain, ioValue.ProName);
this.tableLayoutPanel1.Controls.Add(control, 0, roleindex); this.tableLayoutPanel1.Controls.Add(control, 0, roleindex);
roleindex++; roleindex++;
...@@ -95,7 +95,7 @@ namespace OnlineStore.ACSingleStore ...@@ -95,7 +95,7 @@ namespace OnlineStore.ACSingleStore
catch (Exception ex) catch (Exception ex)
{ {
MessageBox.Show(ex.StackTrace, "Exception(异常)", MessageBoxButtons.OK, MessageBoxIcon.Error); MessageBox.Show(ex.StackTrace, "Exception(异常)", MessageBoxButtons.OK, MessageBoxIcon.Error);
LogUtil.error(LOGGER, ex.StackTrace); LogUtil.error( ex.StackTrace);
} }
} }
...@@ -185,33 +185,12 @@ namespace OnlineStore.ACSingleStore ...@@ -185,33 +185,12 @@ namespace OnlineStore.ACSingleStore
boxBean.CloseDoor(false); boxBean.CloseDoor(false);
} }
private void btnLocationUp_Click(object sender, EventArgs e)
{
IOManager.IOMove(IO_Type.LocationCylinder_Down, IO_VALUE.LOW);
IOManager.IOMove(IO_Type.LocationCylinder_Up, IO_VALUE.HIGH);
}
private void btnLocationDown_Click(object sender, EventArgs e)
{
IOManager.IOMove(IO_Type.LocationCylinder_Down, IO_VALUE.HIGH);
IOManager.IOMove(IO_Type.LocationCylinder_Up, IO_VALUE.LOW);
}
private void FrmIOStatus_Shown(object sender, EventArgs e) private void FrmIOStatus_Shown(object sender, EventArgs e)
{ {
timer1.Start(); timer1.Start();
} }
private void btnOpenAxisBreak_Click(object sender, EventArgs e)
{
IOManager.IOMove(IO_Type.Axis_Brake, IO_VALUE.HIGH);
}
private void btnCloseAxisBreak_Click(object sender, EventArgs e)
{
IOManager.IOMove(IO_Type.Axis_Brake, IO_VALUE.LOW);
}
private void button1_Click(object sender, EventArgs e) private void button1_Click(object sender, EventArgs e)
{ {
this.Close(); this.Close();
......
...@@ -203,9 +203,9 @@ ...@@ -203,9 +203,9 @@
| System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right))); | System.Windows.Forms.AnchorStyles.Right)));
this.logBox.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.logBox.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.logBox.Location = new System.Drawing.Point(241, 88); this.logBox.Location = new System.Drawing.Point(241, 6);
this.logBox.Name = "logBox"; this.logBox.Name = "logBox";
this.logBox.Size = new System.Drawing.Size(1085, 531); this.logBox.Size = new System.Drawing.Size(1085, 613);
this.logBox.TabIndex = 106; this.logBox.TabIndex = 106;
this.logBox.Text = ""; this.logBox.Text = "";
this.logBox.VisibleChanged += new System.EventHandler(this.logBox_VisibleChanged); this.logBox.VisibleChanged += new System.EventHandler(this.logBox_VisibleChanged);
...@@ -257,54 +257,54 @@ ...@@ -257,54 +257,54 @@
// toolStripSeparator1 // toolStripSeparator1
// //
this.toolStripSeparator1.Name = "toolStripSeparator1"; this.toolStripSeparator1.Name = "toolStripSeparator1";
this.toolStripSeparator1.Size = new System.Drawing.Size(114, 6); this.toolStripSeparator1.Size = new System.Drawing.Size(177, 6);
// //
// 启动AToolStripMenuItem // 启动AToolStripMenuItem
// //
this.启动AToolStripMenuItem.Name = "启动AToolStripMenuItem"; this.启动AToolStripMenuItem.Name = "启动AToolStripMenuItem";
this.启动AToolStripMenuItem.Size = new System.Drawing.Size(117, 26); this.启动AToolStripMenuItem.Size = new System.Drawing.Size(180, 26);
this.启动AToolStripMenuItem.Text = "启动 "; this.启动AToolStripMenuItem.Text = "启动 ";
this.启动AToolStripMenuItem.Click += new System.EventHandler(this.启动所有料仓AToolStripMenuItem_Click); this.启动AToolStripMenuItem.Click += new System.EventHandler(this.启动所有料仓AToolStripMenuItem_Click);
// //
// toolStripSeparator4 // toolStripSeparator4
// //
this.toolStripSeparator4.Name = "toolStripSeparator4"; this.toolStripSeparator4.Name = "toolStripSeparator4";
this.toolStripSeparator4.Size = new System.Drawing.Size(114, 6); this.toolStripSeparator4.Size = new System.Drawing.Size(177, 6);
// //
// 复位RToolStripMenuItem // 复位RToolStripMenuItem
// //
this.复位RToolStripMenuItem.Name = "复位RToolStripMenuItem"; this.复位RToolStripMenuItem.Name = "复位RToolStripMenuItem";
this.复位RToolStripMenuItem.Size = new System.Drawing.Size(117, 26); this.复位RToolStripMenuItem.Size = new System.Drawing.Size(180, 26);
this.复位RToolStripMenuItem.Text = "复位"; this.复位RToolStripMenuItem.Text = "复位";
this.复位RToolStripMenuItem.Click += new System.EventHandler(this.复位RToolStripMenuItem_Click); this.复位RToolStripMenuItem.Click += new System.EventHandler(this.复位RToolStripMenuItem_Click);
// //
// toolStripSeparator3 // toolStripSeparator3
// //
this.toolStripSeparator3.Name = "toolStripSeparator3"; this.toolStripSeparator3.Name = "toolStripSeparator3";
this.toolStripSeparator3.Size = new System.Drawing.Size(114, 6); this.toolStripSeparator3.Size = new System.Drawing.Size(177, 6);
// //
// 停止TToolStripMenuItem // 停止TToolStripMenuItem
// //
this.停止TToolStripMenuItem.Name = "停止TToolStripMenuItem"; this.停止TToolStripMenuItem.Name = "停止TToolStripMenuItem";
this.停止TToolStripMenuItem.Size = new System.Drawing.Size(117, 26); this.停止TToolStripMenuItem.Size = new System.Drawing.Size(180, 26);
this.停止TToolStripMenuItem.Text = "停止"; this.停止TToolStripMenuItem.Text = "停止";
this.停止TToolStripMenuItem.Click += new System.EventHandler(this.停止所有料仓TToolStripMenuItem_Click); this.停止TToolStripMenuItem.Click += new System.EventHandler(this.停止所有料仓TToolStripMenuItem_Click);
// //
// toolStripSeparator5 // toolStripSeparator5
// //
this.toolStripSeparator5.Name = "toolStripSeparator5"; this.toolStripSeparator5.Name = "toolStripSeparator5";
this.toolStripSeparator5.Size = new System.Drawing.Size(114, 6); this.toolStripSeparator5.Size = new System.Drawing.Size(177, 6);
// //
// toolStripSeparator2 // toolStripSeparator2
// //
this.toolStripSeparator2.Name = "toolStripSeparator2"; this.toolStripSeparator2.Name = "toolStripSeparator2";
this.toolStripSeparator2.Size = new System.Drawing.Size(114, 6); this.toolStripSeparator2.Size = new System.Drawing.Size(177, 6);
this.toolStripSeparator2.Visible = false; this.toolStripSeparator2.Visible = false;
// //
// 退出ToolStripMenuItem // 退出ToolStripMenuItem
// //
this.退出ToolStripMenuItem.Name = "退出ToolStripMenuItem"; this.退出ToolStripMenuItem.Name = "退出ToolStripMenuItem";
this.退出ToolStripMenuItem.Size = new System.Drawing.Size(117, 26); this.退出ToolStripMenuItem.Size = new System.Drawing.Size(180, 26);
this.退出ToolStripMenuItem.Text = "退出"; this.退出ToolStripMenuItem.Text = "退出";
this.退出ToolStripMenuItem.Click += new System.EventHandler(this.退出ToolStripMenuItem_Click_1); this.退出ToolStripMenuItem.Click += new System.EventHandler(this.退出ToolStripMenuItem_Click_1);
// //
...@@ -399,19 +399,19 @@ ...@@ -399,19 +399,19 @@
// toolStripMenuItem3 // toolStripMenuItem3
// //
this.toolStripMenuItem3.Name = "toolStripMenuItem3"; this.toolStripMenuItem3.Name = "toolStripMenuItem3";
this.toolStripMenuItem3.Size = new System.Drawing.Size(180, 26); this.toolStripMenuItem3.Size = new System.Drawing.Size(144, 26);
this.toolStripMenuItem3.Text = "料仓配置"; this.toolStripMenuItem3.Text = "料仓配置";
this.toolStripMenuItem3.Click += new System.EventHandler(this.toolStripMenuItem3_Click); this.toolStripMenuItem3.Click += new System.EventHandler(this.toolStripMenuItem3_Click);
// //
// toolStripSeparator9 // toolStripSeparator9
// //
this.toolStripSeparator9.Name = "toolStripSeparator9"; this.toolStripSeparator9.Name = "toolStripSeparator9";
this.toolStripSeparator9.Size = new System.Drawing.Size(177, 6); this.toolStripSeparator9.Size = new System.Drawing.Size(141, 6);
// //
// 版本号ToolStripMenuItem // 版本号ToolStripMenuItem
// //
this.版本号ToolStripMenuItem.Name = "版本号ToolStripMenuItem"; this.版本号ToolStripMenuItem.Name = "版本号ToolStripMenuItem";
this.版本号ToolStripMenuItem.Size = new System.Drawing.Size(180, 26); this.版本号ToolStripMenuItem.Size = new System.Drawing.Size(144, 26);
this.版本号ToolStripMenuItem.Text = "关于软件"; this.版本号ToolStripMenuItem.Text = "关于软件";
this.版本号ToolStripMenuItem.Click += new System.EventHandler(this.版本号ToolStripMenuItem_Click); this.版本号ToolStripMenuItem.Click += new System.EventHandler(this.版本号ToolStripMenuItem_Click);
// //
......
...@@ -7,8 +7,8 @@ ...@@ -7,8 +7,8 @@
<ProjectGuid>{0D2542F5-DD62-4352-82D0-383D9A045E74}</ProjectGuid> <ProjectGuid>{0D2542F5-DD62-4352-82D0-383D9A045E74}</ProjectGuid>
<OutputType>WinExe</OutputType> <OutputType>WinExe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder> <AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>OnlineStore.ACSingleStore</RootNamespace> <RootNamespace>OnlineStore.HCSingleStore</RootNamespace>
<AssemblyName>ACSingleStore</AssemblyName> <AssemblyName>HCSingleStore</AssemblyName>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion> <TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment> <FileAlignment>512</FileAlignment>
<TargetFrameworkProfile /> <TargetFrameworkProfile />
...@@ -69,6 +69,10 @@ ...@@ -69,6 +69,10 @@
<Reference Include="System.Drawing" /> <Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" /> <Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" /> <Reference Include="System.Xml" />
<Reference Include="UserFromControl, Version=1.0.7592.26798, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\dll\UserFromControl.dll</HintPath>
</Reference>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="FormManager.cs" /> <Compile Include="FormManager.cs" />
...@@ -207,10 +211,6 @@ ...@@ -207,10 +211,6 @@
<Project>{064bebf5-8faa-4ea2-a5f3-a06e6e7d9251}</Project> <Project>{064bebf5-8faa-4ea2-a5f3-a06e6e7d9251}</Project>
<Name>LoadCSVLibrary</Name> <Name>LoadCSVLibrary</Name>
</ProjectReference> </ProjectReference>
<ProjectReference Include="..\UserFromControl\UserFromControl.csproj">
<Project>{f018462a-d9bc-4365-97f2-f6d71751641e}</Project>
<Name>UserFromControl</Name>
</ProjectReference>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Content Include="AuToRunManager.exe"> <Content Include="AuToRunManager.exe">
......
...@@ -43,7 +43,7 @@ namespace OnlineStore.ACSingleStore ...@@ -43,7 +43,7 @@ namespace OnlineStore.ACSingleStore
public static extern int ShowWindow(IntPtr hwnd, int nCmdShow); public static extern int ShowWindow(IntPtr hwnd, int nCmdShow);
public const int SW_RESTORE = 9; public const int SW_RESTORE = 9;
public static IntPtr formhwnd; public static IntPtr formhwnd;
public static readonly ILog LOGGER = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); //public static readonly ILog LOGGER = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
#endregion #endregion
...@@ -157,7 +157,7 @@ namespace OnlineStore.ACSingleStore ...@@ -157,7 +157,7 @@ namespace OnlineStore.ACSingleStore
static void LogUnhandledException(object exceptionobj) static void LogUnhandledException(object exceptionobj)
{ {
//这里可以进一步地写日志 //这里可以进一步地写日志
LOGGER.Error(exceptionobj.ToString()); LogUtil.error(exceptionobj.ToString());
} }
} }
} }
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
// </auto-generated> // </auto-generated>
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
namespace OnlineStore.ACSingleStore.Properties { namespace OnlineStore.HCSingleStore.Properties {
using System; using System;
...@@ -19,7 +19,7 @@ namespace OnlineStore.ACSingleStore.Properties { ...@@ -19,7 +19,7 @@ namespace OnlineStore.ACSingleStore.Properties {
// 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。 // 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
// 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen // 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen
// (以 /str 作为命令选项),或重新生成 VS 项目。 // (以 /str 作为命令选项),或重新生成 VS 项目。
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources { internal class Resources {
...@@ -39,7 +39,7 @@ namespace OnlineStore.ACSingleStore.Properties { ...@@ -39,7 +39,7 @@ namespace OnlineStore.ACSingleStore.Properties {
internal static global::System.Resources.ResourceManager ResourceManager { internal static global::System.Resources.ResourceManager ResourceManager {
get { get {
if (object.ReferenceEquals(resourceMan, null)) { if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("OnlineStore.ACSingleStore.Properties.Resources", typeof(Resources).Assembly); global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("OnlineStore.HCSingleStore.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp; resourceMan = temp;
} }
return resourceMan; return resourceMan;
......
...@@ -8,11 +8,11 @@ ...@@ -8,11 +8,11 @@
// </auto-generated> // </auto-generated>
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
namespace OnlineStore.ACSingleStore.Properties { namespace OnlineStore.HCSingleStore.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.9.0.0")] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.7.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
......
...@@ -24,7 +24,7 @@ namespace OnlineStore.ACSingleStore ...@@ -24,7 +24,7 @@ namespace OnlineStore.ACSingleStore
private short SlvAddr = 0; private short SlvAddr = 0;
private string IoIp = ""; private string IoIp = "";
private int IoIndex = 0; private int IoIndex = 0;
public string Axis_Brake = IO_Type.Axis_Brake; public string Axis_Brake = "";
private System.Timers.Timer toolTimer = new System.Timers.Timer(); private System.Timers.Timer toolTimer = new System.Timers.Timer();
private ConfigMoveAxis configAxis; private ConfigMoveAxis configAxis;
...@@ -89,7 +89,7 @@ namespace OnlineStore.ACSingleStore ...@@ -89,7 +89,7 @@ namespace OnlineStore.ACSingleStore
SaveConfig(tSpeed, tPosition); SaveConfig(tSpeed, tPosition);
//判断伺服是否已经打开 //判断伺服是否已经打开
bool isOn = AxisManager.instance.ServerOnStatus(PortName, SlvAddr); bool isOn = AxisManager.instance.IsServeoOn(PortName, SlvAddr);
formStatus(isOn); formStatus(isOn);
timer1.Start(); timer1.Start();
ioStatusControl1.IOName = ResourceCulture.GetString("检测信号"); ioStatusControl1.IOName = ResourceCulture.GetString("检测信号");
...@@ -106,7 +106,7 @@ namespace OnlineStore.ACSingleStore ...@@ -106,7 +106,7 @@ namespace OnlineStore.ACSingleStore
} }
formStatus(true); formStatus(true);
AxisManager.instance.InitSlvAddr(PortName, SlvAddr); AxisManager.instance.InitSlvAddr(PortName, SlvAddr, configAxis.TargetSpeed, configAxis.AddSpeed, configAxis.DelSpeed);
Thread.Sleep(100); Thread.Sleep(100);
AxisManager.instance.AlarmClear(PortName, SlvAddr); AxisManager.instance.AlarmClear(PortName, SlvAddr);
AxisManager.instance.ServoOn(PortName, SlvAddr); AxisManager.instance.ServoOn(PortName, SlvAddr);
......
...@@ -184,7 +184,7 @@ namespace OnlineStore.AutoCountClient ...@@ -184,7 +184,7 @@ namespace OnlineStore.AutoCountClient
this.txtHomeSingle.Text = AxisManager.instance.GetHomeSingle(PortName, SlvAddr).ToString(); this.txtHomeSingle.Text = AxisManager.instance.GetHomeSingle(PortName, SlvAddr).ToString();
this.txtLimit1.Text = AxisManager.instance.GetLimitPositiveSingle(PortName, SlvAddr).ToString(); this.txtLimit1.Text = AxisManager.instance.GetLimitPositiveSingle(PortName, SlvAddr).ToString();
this.txtLimit2.Text = AxisManager.instance.GetLimitNegativeSingle(PortName, SlvAddr).ToString(); this.txtLimit2.Text = AxisManager.instance.GetLimitNegativeSingle(PortName, SlvAddr).ToString();
txtServoStatue.Text = AxisManager.instance.ServerOnStatus(PortName, SlvAddr) ? "✔" : "✘"; txtServoStatue.Text = AxisManager.instance.IsServeoOn(PortName, SlvAddr) ? "✔" : "✘";
} }
......
...@@ -199,15 +199,15 @@ namespace HuichuanLibrary ...@@ -199,15 +199,15 @@ namespace HuichuanLibrary
return false; return false;
} }
public static bool AbsMoveIsEnd(short axisNo, double targetPos) public static bool MoveIsEnd(short axisNo )
{ {
AxisSts sts = GetAxisSts(axisNo); AxisSts sts = GetAxisSts(axisNo);
if (sts.BUSY.Equals(0) && sts.INP.Equals(0)) if (sts.BUSY.Equals(0) && sts.INP.Equals(0))
{ {
if (IsInPosition(axisNo, targetPos)) //if (IsInPosition(axisNo, targetPos))
{ //{
return true; return true;
} //}
} }
return false; return false;
} }
......
...@@ -209,7 +209,12 @@ namespace OnlineStore.LoadCSVLibrary ...@@ -209,7 +209,12 @@ namespace OnlineStore.LoadCSVLibrary
{ {
string[] newArray = array; string[] newArray = array;
string proName = array[2]; string proName = array[2];
string proValue = array[3]; string proValue = array[3];
if (proName.ToUpper().Contains(BaseConfig.IOIP_Str.ToUpper()))
{
index++;
continue;
}
try try
{ {
PropertyInfo prop = props.First(c => c.Name == proName);//获取同名属性 PropertyInfo prop = props.First(c => c.Name == proName);//获取同名属性
...@@ -227,6 +232,10 @@ namespace OnlineStore.LoadCSVLibrary ...@@ -227,6 +232,10 @@ namespace OnlineStore.LoadCSVLibrary
{ {
newLine = newLine + s + ","; newLine = newLine + s + ",";
} }
if (newLine.EndsWith(","))
{
newLine = newLine.Substring(0, newLine.Length - 1);
}
newLines[index] = newLine; newLines[index] = newLine;
} }
} }
......
...@@ -131,7 +131,7 @@ namespace OnlineStore.LoadCSVLibrary ...@@ -131,7 +131,7 @@ namespace OnlineStore.LoadCSVLibrary
SubDIList[io.SubType].Add(io.ProName, io); SubDIList[io.SubType].Add(io.ProName, io);
} }
if (!ioTypeList.Contains(con.ProName)) //if (!ioTypeList.Contains(con.ProName))
{ {
AddBuffer(con, builder); AddBuffer(con, builder);
} }
...@@ -165,7 +165,7 @@ namespace OnlineStore.LoadCSVLibrary ...@@ -165,7 +165,7 @@ namespace OnlineStore.LoadCSVLibrary
{ {
SubDOList[io.SubType].Add(io.ProName, io); SubDOList[io.SubType].Add(io.ProName, io);
} }
if (!ioTypeList.Contains(con.ProName)) //if (!ioTypeList.Contains(con.ProName))
{ {
AddBuffer(con, builder); AddBuffer(con, builder);
} }
......
...@@ -200,6 +200,11 @@ namespace OnlineStore.LoadCSVLibrary ...@@ -200,6 +200,11 @@ namespace OnlineStore.LoadCSVLibrary
[ConfigProAttribute("CompAxis_P3_Speed")] [ConfigProAttribute("CompAxis_P3_Speed")]
public int CompAxis_P3_Speed { get; set; } public int CompAxis_P3_Speed { get; set; }
/// <summary>
/// PRO,温湿度端口号,Humiture_Port,COM1,,,,,,,
/// </summary>
[ConfigProAttribute("Humiture_Port", true)]
public string Humiture_Port { get; set; }
/// <summary> /// <summary>
/// PRO 每次吹气的时间(分钟) BlowAir_Time 10 /// PRO 每次吹气的时间(分钟) BlowAir_Time 10
......
...@@ -26,104 +26,193 @@ namespace OnlineStore.LoadCSVLibrary ...@@ -26,104 +26,193 @@ namespace OnlineStore.LoadCSVLibrary
return TypeList; return TypeList;
} }
/// <summary> ///// <summary>
/// 料仓,DI 急停 SuddenStop_BTN X01 DI-01 ///// 料仓,DI 急停 SuddenStop_BTN X01 DI-01
///// </summary>
//public static string SuddenStop_BTN = "SuddenStop_BTN";
///// <summary>
///// 料仓 DI 复位 Reset_BTN X02 DI-02
///// </summary>
//public static string Reset_BTN = "Reset_BTN";
///// <summary>
///// DI,盘点,CheckPos,2,PRO_AOI_IP_1,0,盘点,X03,DI-03,0,
///// </summary>
//public static string CheckPos = "CheckPos";
///// <summary>
/////DI 自动运行 AutoRun_Signal
///// </summary>
//// public static string AutoRun_Signal = "AutoRun_Signal";
///// <summary>
///// 料仓DI。气压检测(料仓) Airpressure_Check
///// </summary>
//public static string Airpressure_Check = "Airpressure_Check";
///// <summary>
///// DI 料仓门口料盘检测 TrayCheck_1
///// </summary>
//public static string TrayCheck_Door = "TrayCheck_Door";
///// <summary>
///// DI 叉子料盘检测 TrayCheck_Fixture
///// </summary>
//public static string TrayCheck_Fixture = "TrayCheck_Fixture";
///// <summary>
///// 料仓IO。定位气缸上升端(料仓) LocationCylinder_Up
///// </summary>
//public static string LocationCylinder_Up = "LocationCylinder_Up";
///// <summary>
/////料仓IO。 定位气缸下降端(料仓) LocationCylinder_Down
///// </summary>
//public static string LocationCylinder_Down = "LocationCylinder_Down";
///// <summary>
///// 料仓IO。定位气缸上升端(料仓) LocationCylinder2_Up
///// </summary>
//public static string LocationCylinder2_Up = "LocationCylinder2_Up";
///// <summary>
/////料仓IO。 定位气缸下降端(料仓) LocationCylinder2_Down
///// </summary>
//public static string LocationCylinder2_Down = "LocationCylinder2_Down";
///// <summary>
///// 料仓DO 。料仓运转ON Run_Signal
///// </summary>
//public static string Run_Signal = "Run_Signal";
///// <summary>
///// 料仓DO 。料仓轴2刹车ON Axis_Brake
///// </summary>
//public static string Axis_Brake = "Axis_Brake";
///// <summary>
///// 料仓DO 。料仓吹气SOL ON StartOrStopBlow
///// </summary>
//public static string StartOrStopBlow = "StartOrStopBlow";
///// <summary>
///// DO 自动指示灯 AutoRun_HddLed
///// </summary>
//public static string AutoRun_HddLed = "AutoRun_HddLed";
///// <summary>
///// DO 待机指示灯 RunSign_HddLed
///// </summary>
//public static string RunSign_HddLed = "RunSign_HddLed";
///// <summary>
/////DO 故障指示灯 Alarm_HddLed
///// </summary>
//public static string Alarm_HddLed = "Alarm_HddLed";
///// <summary>
///// 吹气SOL Blow_Single
///// </summary>
//public static string Blow_Single = "Blow_Single";
///// <summary>
///// 进出料口门上升端 Door_Up
///// </summary>
//public static string Door_Up = "Door_Up";
///// <summary>
///// 进出料口门下降端 Door_Down
///// </summary>
//public static string Door_Down = "Door_Down";
//public static string DoorLimit = "DoorLimit";
///// <summary>
///// DO,0,报警蜂鸣器,Alarm_Buzzer,3,HC,Y04,
///// </summary>
//public static string Alarm_Buzzer = "Alarm_Buzzer";
///// <summary>
///// DO,0,设备照明ON,Device_Led,8,HC,Y09,
///// </summary>
//public static string Device_Led = "Device_Led";
/// <summary>
/// DI,0,急停,SuddenStop_BTN,0,HC,X00,
/// </summary> /// </summary>
public static string SuddenStop_BTN = "SuddenStop_BTN"; public static string SuddenStop_BTN = "SuddenStop_BTN";
/// <summary> /// <summary>
/// 料仓 DI 复位 Reset_BTN X02 DI-02 /// DI,0,复位,Reset_BTN,1,HC,X01,
/// </summary> /// </summary>
public static string Reset_BTN = "Reset_BTN"; public static string Reset_BTN = "Reset_BTN";
/// <summary> /// <summary>
/// DI,盘点,CheckPos,2,PRO_AOI_IP_1,0,盘点,X03,DI-03,0, /// DI,0,气压检测,Airpressure_Check,2,HC,X02,
/// </summary>
public static string CheckPos = "CheckPos";
/// <summary>
///DI 自动运行 AutoRun_Signal
/// </summary>
// public static string AutoRun_Signal = "AutoRun_Signal";
/// <summary>
/// 料仓DI。气压检测(料仓) Airpressure_Check
/// </summary> /// </summary>
public static string Airpressure_Check = "Airpressure_Check"; public static string Airpressure_Check = "Airpressure_Check";
/// <summary> /// <summary>
/// DI 料仓门口料盘检测 TrayCheck_1 /// DI,1,左料仓进料口料盘检测,TrayCheck_Door,3,HC,X03,
/// </summary> /// </summary>
public static string TrayCheck_Door = "TrayCheck_Door"; public static string TrayCheck_Door = "TrayCheck_Door";
/// <summary> /// <summary>
/// DI 叉子料盘检测 TrayCheck_Fixture /// DI,1,左料仓料叉料盘检测,TrayCheck_Fixture,4,HC,X04,
/// </summary>
public static string TrayCheck_Fixture = "TrayCheck_Fixture";
/// <summary>
/// 料仓IO。定位气缸上升端(料仓) LocationCylinder_Up
/// </summary> /// </summary>
public static string LocationCylinder_Up = "LocationCylinder_Up"; public static string TrayCheck_Fixture = "TrayCheck_Fixture";
/// <summary>
///料仓IO。 定位气缸下降端(料仓) LocationCylinder_Down
/// </summary>
public static string LocationCylinder_Down = "LocationCylinder_Down";
/// <summary>
/// 料仓IO。定位气缸上升端(料仓) LocationCylinder2_Up
/// </summary>
public static string LocationCylinder2_Up = "LocationCylinder2_Up";
/// <summary>
///料仓IO。 定位气缸下降端(料仓) LocationCylinder2_Down
/// </summary>
public static string LocationCylinder2_Down = "LocationCylinder2_Down";
/// <summary> /// <summary>
/// 料仓DO 。料仓运转ON Run_Signal /// DI,1,左料仓进料口门上升端,Door_Up,5,HC,X05,
/// </summary> /// </summary>
public static string Run_Signal = "Run_Signal"; public static string Door_Up = "Door_Up";
/// <summary> /// <summary>
/// 料仓DO 。料仓轴2刹车ON Axis_Brake /// DI,1,左料仓进料口门下降端,Door_Down,6,HC,X06,
/// </summary> /// </summary>
public static string Axis_Brake = "Axis_Brake"; public static string Door_Down = "Door_Down";
/// <summary> /// <summary>
/// 料仓DO 。料仓吹气SOL ON StartOrStopBlow /// DI,1,左料仓激光检测,CheckPos,7,HC,X07,
/// </summary> /// </summary>
public static string StartOrStopBlow = "StartOrStopBlow"; public static string CheckPos = "CheckPos";
///// <summary>
///// DI,2,右料仓进料口料盘检测,TrayCheck_Door,8,HC,X08,
/// <summary> ///// </summary>
/// DO 自动指示灯 AutoRun_HddLed //public static string TrayCheck_Door = "TrayCheck_Door";
///// <summary>
///// DI,2,右料仓料叉料盘检测,TrayCheck_Fixture,9,HC,X09,
///// </summary>
//public static string TrayCheck_Fixture = "TrayCheck_Fixture";
///// <summary>
///// DI,2,右料仓进料口门上升端,Door_Up,10,HC,X10,
///// </summary>
//public static string Door_Up = "Door_Up";
///// <summary>
///// DI,2,右料仓进料口门下降端,Door_Down,11,HC,X11,
///// </summary>
//public static string Door_Down = "Door_Down";
///// <summary>
///// DI,2,右料仓激光检测,CheckPos,12,HC,X12,
///// </summary>
//public static string CheckPos = "CheckPos";
/// <summary>
/// DO,0,自动指示灯,AutoRun_HddLed,0,HC,Y01,
/// </summary> /// </summary>
public static string AutoRun_HddLed = "AutoRun_HddLed"; public static string AutoRun_HddLed = "AutoRun_HddLed";
/// <summary>
/// DO 待机指示灯 RunSign_HddLed
/// </summary>
public static string RunSign_HddLed = "RunSign_HddLed";
/// <summary> /// <summary>
///DO 故障指示灯 Alarm_HddLed /// DO,0,故障指示灯,Alarm_HddLed,1,HC,Y02,
/// </summary> /// </summary>
public static string Alarm_HddLed = "Alarm_HddLed"; public static string Alarm_HddLed = "Alarm_HddLed";
/// <summary> /// <summary>
/// 吹气SOL Blow_Single /// DO,0,待机指示灯,RunSign_HddLed,2,HC,Y03,
/// </summary> /// </summary>
public static string Blow_Single = "Blow_Single"; public static string RunSign_HddLed = "RunSign_HddLed";
/// <summary>
/// 进出料口门上升端 Door_Up
/// </summary>
public static string Door_Up = "Door_Up";
/// <summary>
/// 进出料口门下降端 Door_Down
/// </summary>
public static string Door_Down = "Door_Down";
public static string DoorLimit = "DoorLimit";
/// <summary> /// <summary>
/// DO,0,报警蜂鸣器,Alarm_Buzzer,3,HC,Y04, /// DO,0,报警蜂鸣器,Alarm_Buzzer,3,HC,Y04,
/// </summary> /// </summary>
public static string Alarm_Buzzer = "Alarm_Buzzer"; public static string Alarm_Buzzer = "Alarm_Buzzer";
///// <summary>
///// DO,1,左料仓进料口门上升SOL,Door_Up,4,HC,Y05,
///// </summary>
//public static string Door_Up = "Door_Up";
///// <summary>
///// DO,1,左料仓进料口门下降SOL,Door_Down,5,HC,Y06,
///// </summary>
//public static string Door_Down = "Door_Down";
///// <summary>
///// DO,2,右料仓进料口门上升SOL,Door_Up,6,HC,Y07,
///// </summary>
//public static string Door_Up = "Door_Up";
///// <summary>
///// DO,2,右料仓进料口门下降SOL,Door_Down,7,HC,Y08,
///// </summary>
//public static string Door_Down = "Door_Down";
/// <summary> /// <summary>
/// DO,0,设备照明ON,Device_Led,8,HC,Y09, /// DO,0,设备照明ON,Device_Led,8,HC,Y09,
/// </summary> /// </summary>
......
...@@ -39,36 +39,31 @@ namespace OnlineStore.LoadCSVLibrary ...@@ -39,36 +39,31 @@ namespace OnlineStore.LoadCSVLibrary
/// </summary> /// </summary>
[ConfigProAttribute("IOSingle_TimerOut", false)] [ConfigProAttribute("IOSingle_TimerOut", false)]
public int IOSingle_TimerOut { get; set; } public int IOSingle_TimerOut { get; set; }
/// <summary> ///// <summary>
/// PRO 需要吹气的温度(温度标准) Max_Temperature 10 ///// PRO 需要吹气的温度(温度标准) Max_Temperature 10
/// </summary> ///// </summary>
[ConfigProAttribute("Max_Temperature", false)] //[ConfigProAttribute("Max_Temperature", false)]
public int Max_Temperature { get; set; } //public int Max_Temperature { get; set; }
/// <summary> ///// <summary>
/// PRO 需要吹气的湿度(湿度标准) Max_Humidity 10 ///// PRO 需要吹气的湿度(湿度标准) Max_Humidity 10
/// </summary> ///// </summary>
[ConfigProAttribute("Max_Humidity", false)] //[ConfigProAttribute("Max_Humidity", false)]
public int Max_Humidity { get; set; } //public int Max_Humidity { get; set; }
/// <summary> ///// <summary>
/// PRO 每次吹气的时间(分钟) BlowAir_Time 10 ///// PRO 每次吹气的时间(分钟) BlowAir_Time 10
/// </summary> ///// </summary>
[ConfigProAttribute("BlowAir_Time", false)] //[ConfigProAttribute("BlowAir_Time", false)]
public int BlowAir_Time { get; set; } //public int BlowAir_Time { get; set; }
/// <summary> ///// <summary>
/// PRO 两次吹气间隔(分钟) BlowAir_Interval 10 ///// PRO 两次吹气间隔(分钟) BlowAir_Interval 10
/// </summary> ///// </summary>
[ConfigProAttribute("BlowAir_Interval", false)] //[ConfigProAttribute("BlowAir_Interval", false)]
public int BlowAir_Interval { get; set; } //public int BlowAir_Interval { get; set; }
public int InoutAxis_PositionMax { get; set; } public int InoutAxis_PositionMax { get; set; }
/// <summary>
/// PRO,温湿度端口号,Humiture_Port,COM1,,,,,,,
/// </summary>
[ConfigProAttribute("Humiture_Port", true)]
public string Humiture_Port { get; set; }
public ushort GetDOLength(string ioIp) public ushort GetDOLength(string ioIp)
{ {
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!