Commit 80107032 张东亮

添加agv对接逻辑

1 个父辈 a04de88a
 
Microsoft Visual Studio Solution File, Format Version 12.00 Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16 # Visual Studio Version 17
VisualStudioVersion = 16.0.30907.101 VisualStudioVersion = 17.5.33414.496
MinimumVisualStudioVersion = 10.0.40219.1 MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LoadCSVLibrary", "LoadCVSLibrary\LoadCSVLibrary.csproj", "{064BEBF5-8FAA-4EA2-A5F3-A06E6E7D9251}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LoadCSVLibrary", "LoadCVSLibrary\LoadCSVLibrary.csproj", "{064BEBF5-8FAA-4EA2-A5F3-A06E6E7D9251}"
EndProject EndProject
......
...@@ -22,188 +22,15 @@ namespace OnlineStore.Common ...@@ -22,188 +22,15 @@ namespace OnlineStore.Common
Interlocked.Increment(ref seq); Interlocked.Increment(ref seq);
return seq; return seq;
} }
public static string GetValue(string keyStr, string storeStr)
{
string key = keyStr + storeStr;
System.Configuration.Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
if (config.AppSettings.Settings[key] == null)
{
return GetValue(keyStr);
}
else
{
return config.AppSettings.Settings[key].Value;
}
}
public static decimal GetNumValue(string keyStr, string storeStr)
{
string key = keyStr + storeStr;
decimal a = 0;
System.Configuration.Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
if (config.AppSettings.Settings[key] == null)
{
return GetNumValue(keyStr);
}
else
{
{
Decimal.TryParse(config.AppSettings.Settings[key].Value, out a);
}
}
return a;
}
public static int GetIntValue(string keyStr, string storeStr)
{
string key = keyStr + storeStr;
int a = 0;
System.Configuration.Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
if (config.AppSettings.Settings[key] == null)
{
return GetIntValue(keyStr);
}
else
{
{
Int32.TryParse(config.AppSettings.Settings[key].Value, out a);
}
} return a;
}
public static string GetValue(string key)
{
System.Configuration.Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
if (config.AppSettings.Settings[key] == null)
{
LogUtil.error("未找到配置:" + key + ",请检查配置是否完整!");
return "";
}
else
{
return config.AppSettings.Settings[key].Value;
}
}
public static decimal GetNumValue(string key)
{
decimal a = 0;
System.Configuration.Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
if (config.AppSettings.Settings[key] == null)
{
LogUtil.error("未找到配置:" + key + ",请检查配置是否完整!");
return a;
}
else
{
{
Decimal.TryParse(config.AppSettings.Settings[key].Value, out a);
}
}
return a;
}
public static int GetIntValue(string key)
{
int a = 0;
System.Configuration.Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
if (config.AppSettings.Settings[key] == null)
{
LogUtil.error("未找到配置:" + key + ",请检查配置是否完整!");
return a;
}
else
{
{
Int32.TryParse(config.AppSettings.Settings[key].Value, out a);
}
} return a;
}
public static void SaveValue(string key, int value)
{
SaveValue(key, value.ToString());
}
public static void SaveValue(string key, string value)
{
try
{
if (key.Equals("") || value.Equals(""))
{
return;
}
//增加的内容写在appSettings段下 <add key="RegCode" value="0"/>
System.Configuration.Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
if (config.AppSettings.Settings[key] == null)
{
SetValue(key, value);
}
else
{
UpdateConfig(key, value);
}
}
catch (Exception ex)
{
LogUtil.error( "SaveValue保存配置出错:AppKey=" + key + ",AppValue=" + value + ",",ex);
}
}
public static string GetValue(object debugDeviceId) public static T GetValue<T>(string key, T defaultVal = default(T), string comment = "")
{ {
throw new NotImplementedException(); ConfigHelper.Config.SetComment(key, comment);
} return ConfigHelper.Config.Get(key, defaultVal);
/// <summary>
/// 更新配置文件信息
/// </summary>
/// <param name="name">配置文件字段名称</param>
/// <param name="Xvalue">值</param>
private static void UpdateConfig(string name, string Xvalue)
{
try
{
XmlDocument doc = new XmlDocument();
doc.Load(Application.ExecutablePath + ".config");
XmlNode node = doc.SelectSingleNode(@"//add[@key='" + name + "']");
XmlElement ele = (XmlElement)node;
ele.SetAttribute("value", Xvalue);
doc.Save(Application.ExecutablePath + ".config");
}
catch (Exception ex)
{
LogUtil.error( "UpdateConfig保存配置出错:name=" + name + ",Xvalue=" + Xvalue + ",",ex);
}
} }
public static void SetValue<T>(string key, T defaultVal = default(T))
///<summary>
///向.config文件的appKey结写入信息AppValue 保存设置
///</summary>
///<param name="AppKey">节点名</param>
///<param name="AppValue">值</param>
private static void SetValue(String AppKey, String AppValue)
{ {
try ConfigHelper.Config.Set(key, defaultVal);
{
XmlDocument xDoc = new XmlDocument();
xDoc.Load(System.Windows.Forms.Application.ExecutablePath + ".config");
XmlNode xNode;
XmlElement xElem1;
XmlElement xElem2;
xNode = xDoc.SelectSingleNode("//appSettings");
xElem1 = (XmlElement)xNode.SelectSingleNode("//add[@key='" + AppKey + "']");
if (xElem1 != null)
xElem1.SetAttribute("value", AppValue);
else
{
xElem2 = xDoc.CreateElement("add");
xElem2.SetAttribute("key", AppKey);
xElem2.SetAttribute("value", AppValue);
xNode.AppendChild(xElem2);
}
xDoc.Save(System.Windows.Forms.Application.ExecutablePath + ".config");
}
catch (Exception ex)
{
LogUtil.error( "SetValue保存配置出错:AppKey=" + AppKey + ",AppValue=" + AppValue + ",",ex);
}
} }
} }
} }
...@@ -32,6 +32,10 @@ ...@@ -32,6 +32,10 @@
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="AGVLib, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\DLL\AGVLib\AGVLib\bin\Debug\AGVLib.dll</HintPath>
</Reference>
<Reference Include="CodeLibrary, Version=1.0.8384.25672, Culture=neutral, processorArchitecture=MSIL"> <Reference Include="CodeLibrary, Version=1.0.8384.25672, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion> <SpecificVersion>False</SpecificVersion>
<HintPath>..\DLL\CodeLibrary.dll</HintPath> <HintPath>..\DLL\CodeLibrary.dll</HintPath>
...@@ -90,6 +94,7 @@ ...@@ -90,6 +94,7 @@
<Compile Include="theMachine\Common.cs" /> <Compile Include="theMachine\Common.cs" />
<Compile Include="theMachine\JobList.cs" /> <Compile Include="theMachine\JobList.cs" />
<Compile Include="theMachine\LabelParam.cs" /> <Compile Include="theMachine\LabelParam.cs" />
<Compile Include="theMachine\MainMachine_AGV.cs" />
<Compile Include="theMachine\MainMachine_ServerControl.cs" /> <Compile Include="theMachine\MainMachine_ServerControl.cs" />
<Compile Include="theMachine\MainMachine _BtnProcess.cs" /> <Compile Include="theMachine\MainMachine _BtnProcess.cs" />
<Compile Include="theMachine\MainMachine _Common.cs" /> <Compile Include="theMachine\MainMachine _Common.cs" />
......
...@@ -191,6 +191,7 @@ namespace DeviceLibrary ...@@ -191,6 +191,7 @@ namespace DeviceLibrary
ConfigHelper.Config.Get("CamTestReel_Ability", false); ConfigHelper.Config.Get("CamTestReel_Ability", false);
ConfigHelper.Config.Set("CamTestReel_debug", false); ConfigHelper.Config.Set("CamTestReel_debug", false);
ConfigHelper.Config.Get("Device_1315_ReelHeight_Compensation", 0); ConfigHelper.Config.Get("Device_1315_ReelHeight_Compensation", 0);
initAgv();
} }
private void Crc_LanguageChangeEvent(object sender, EventArgs e) private void Crc_LanguageChangeEvent(object sender, EventArgs e)
...@@ -275,6 +276,7 @@ namespace DeviceLibrary ...@@ -275,6 +276,7 @@ namespace DeviceLibrary
if (runStatus == RunStatus.Running) if (runStatus == RunStatus.Running)
{ {
ioMonitor(); ioMonitor();
AGVProcess();
StringProcess(); StringProcess();
ClampProcess(); ClampProcess();
boxTransport.Process(); boxTransport.Process();
......
...@@ -121,6 +121,7 @@ namespace DeviceLibrary ...@@ -121,6 +121,7 @@ namespace DeviceLibrary
StringMoveInfo.log($"当前没有料串"); StringMoveInfo.log($"当前没有料串");
StringState = StringStateE.None; StringState = StringStateE.None;
LastStringState = StringStateE.None; LastStringState = StringStateE.None;
needEnter(AGVLib.NodeStatus.NeedEnter);
} }
else if (IOValue(IO_Type.StringFront_Check).Equals(IO_VALUE.HIGH)) else if (IOValue(IO_Type.StringFront_Check).Equals(IO_VALUE.HIGH))
{ {
...@@ -428,7 +429,9 @@ namespace DeviceLibrary ...@@ -428,7 +429,9 @@ namespace DeviceLibrary
break; break;
case MoveStep.StringOut_02: case MoveStep.StringOut_02:
StringMoveInfo.NextMoveStep(MoveStep.StringOut_03); StringMoveInfo.NextMoveStep(MoveStep.StringOut_03);
StringMoveInfo.log($"打开门"); needLeave(AGVLib.NodeStatus.NeedLeave);
StringMoveInfo.log($"呼叫AGV取料串");
// StringMoveInfo.log($"打开门");
//CylinderMove(StringMoveInfo, IO_Type.StringDoor_Close, IO_Type.StringDoor_Open, IO_VALUE.HIGH); //CylinderMove(StringMoveInfo, IO_Type.StringDoor_Close, IO_Type.StringDoor_Open, IO_VALUE.HIGH);
break; break;
case MoveStep.StringOut_03: case MoveStep.StringOut_03:
...@@ -678,7 +681,7 @@ namespace DeviceLibrary ...@@ -678,7 +681,7 @@ namespace DeviceLibrary
} }
if (LastHeight <= 8) { LastHeight = 8; } if (LastHeight <= 8) { LastHeight = 8; }
//string code = CodeManager.ProcessCode(LastCodeList); //string code = CodeManager.ProcessCode(LastCodeList);
string msg = Name + prefix+"上升前 [" + StartMovePosition + "]实时[ " + EndMovePosition + "]差值[" + (EndMovePosition - StartMovePosition) + "]系数[" + AxisChangeValue + "] 计算后" + "[" + height + "]," + buchongStr + ",归类为【" + LastHeight + "mm】条码【" + LastCode + "】"; string msg = Name + prefix + "上升前 [" + StartMovePosition + "]实时[ " + EndMovePosition + "]差值[" + (EndMovePosition - StartMovePosition) + "]系数[" + AxisChangeValue + "] 计算后" + "[" + height + "]," + buchongStr + ",归类为【" + LastHeight + "mm】条码【" + LastCode + "】";
LogUtil.info(msg); LogUtil.info(msg);
return LastHeight; return LastHeight;
} }
......
...@@ -6,7 +6,7 @@ using System.Threading.Tasks; ...@@ -6,7 +6,7 @@ using System.Threading.Tasks;
namespace DeviceLibrary namespace DeviceLibrary
{ {
public enum MoveStep public enum MoveStep
{ {
Wait, Wait,
...@@ -31,7 +31,7 @@ namespace DeviceLibrary ...@@ -31,7 +31,7 @@ namespace DeviceLibrary
H16_HomeReset, H16_HomeReset,
HEND_HomeReset, HEND_HomeReset,
StringLoad_01, StringLoad_01,
StringLoad_01a, StringLoad_01a,
StringLoad_02, StringLoad_02,
...@@ -157,7 +157,27 @@ namespace DeviceLibrary ...@@ -157,7 +157,27 @@ namespace DeviceLibrary
StoreTS16, StoreTS16,
StoreTS17, StoreTS17,
StoreTS18, StoreTS18,
//AGV
AGV_In01,
AGV_In02,
AGV_In03,
AGV_In04,
AGV_In05,
AGV_In06,
AGV_In07,
AGV_In08,
AGV_Out01,
AGV_Out02,
AGV_Out03,
AGV_Out04,
AGV_Out05,
AGV_Out06,
AGV_Out07,
AGV_OpenDoor,
AGV_DetachOK,
AGV_CloseDoor,
} }
......
...@@ -25,7 +25,7 @@ namespace TheMachine ...@@ -25,7 +25,7 @@ namespace TheMachine
InitializeComponent(); InitializeComponent();
RobotManage.LoadFinishEvent += RobotManage_LoadFinishEvent; RobotManage.LoadFinishEvent += RobotManage_LoadFinishEvent;
//chbAutoRun.Enabled = false; //chbAutoRun.Enabled = false;
chbAutoRun.Checked = Convert.ToBoolean(ConfigAppSettings.GetIntValue(Setting_Init.App_AutoRun)); chbAutoRun.Checked = Convert.ToBoolean(ConfigAppSettings.GetValue(Setting_Init.App_AutoRun,0, "系统启动时自动启动料仓,=1时自动启动,并隐藏窗口,=0时不需要"));
this.chbAutoRun.CheckedChanged += new System.EventHandler(this.chbAutoRun_CheckedChanged); this.chbAutoRun.CheckedChanged += new System.EventHandler(this.chbAutoRun_CheckedChanged);
//chbAutoRun.Enabled = true; //chbAutoRun.Enabled = true;
for (int i = 0; i < 20; i++) for (int i = 0; i < 20; i++)
...@@ -80,12 +80,12 @@ namespace TheMachine ...@@ -80,12 +80,12 @@ namespace TheMachine
{ {
if (chbAutoRun.Checked) if (chbAutoRun.Checked)
{ {
ConfigAppSettings.SaveValue(Setting_Init.App_AutoRun, 1); ConfigAppSettings.SetValue(Setting_Init.App_AutoRun, 1);
AutoRun(Application.ExecutablePath, true); AutoRun(Application.ExecutablePath, true);
} }
else else
{ {
ConfigAppSettings.SaveValue(Setting_Init.App_AutoRun, 0); ConfigAppSettings.SetValue(Setting_Init.App_AutoRun, 0);
AutoRun(Application.ExecutablePath, false); AutoRun(Application.ExecutablePath, false);
} }
} }
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!