Commit 58320050 张东亮

校准库位料盘顶起检查功能

1 个父辈 d98f9a8c
...@@ -84,6 +84,7 @@ ...@@ -84,6 +84,7 @@
<Compile Include="DeviceLibrary\ServerCommunication.cs" /> <Compile Include="DeviceLibrary\ServerCommunication.cs" />
<Compile Include="DeviceLibrary\AxisBean.cs" /> <Compile Include="DeviceLibrary\AxisBean.cs" />
<Compile Include="DeviceLibrary\ServerCommunication_AgvProcess.cs" /> <Compile Include="DeviceLibrary\ServerCommunication_AgvProcess.cs" />
<Compile Include="DeviceLibrary\VisionHelper.cs" />
<Compile Include="theMachine\BoxTransport.cs" /> <Compile Include="theMachine\BoxTransport.cs" />
<Compile Include="theMachine\Common.cs" /> <Compile Include="theMachine\Common.cs" />
<Compile Include="theMachine\JobList.cs" /> <Compile Include="theMachine\JobList.cs" />
......
...@@ -256,14 +256,14 @@ namespace DeviceLibrary ...@@ -256,14 +256,14 @@ namespace DeviceLibrary
if (moveInfo1.WaitList[0].WaitType == WaitEnum.W013_Action) if (moveInfo1.WaitList[0].WaitType == WaitEnum.W013_Action)
{ {
var wt = moveInfo1.WaitList[0]; var wt = moveInfo1.WaitList[0];
for (int i = 0; i < 1000; i++) for (int i = 0; i < 100; i++)
{ {
var w = wt.Action?.Invoke(moveInfo1.WaitList[0]); var w = wt.Action?.Invoke(moveInfo1.WaitList[0]);
if (w == null) if (w == null)
return; return;
if (w.Value) if (w.Value)
break; break;
Task.Delay(10).Wait(); Task.Delay(100).Wait();
} }
} }
} }
......
using Common;
using OnlineStore.Common;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Diagnostics.Eventing.Reader;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace DeviceLibrary
{
public class VisionHelper
{
static string visionUrl = ConfigHelper.Config.Get("VisionUrl", "http://localhost:8089/vision/eyem");
public static bool ReelStatusCheck()
{
string cameraName = ConfigHelper.Config.Get("MonitorCamName", "cam1");
string url = visionUrl + "/reelStatusCheck/cam?camName=" + cameraName;
try
{
CheckAndRunServer();
string json = HttpHelper.Get(url);
Result result = JsonHelper.DeserializeJsonToObject<Result>(json);
if (result != null && result.code == 0)
{
LogUtil.info("料盘放置正常");
return true;
}
else
{
LogUtil.info("料盘放置异常");
return false;
}
}
catch (Exception ex)
{
LogUtil.error("ReelStatusCheck", ex);
}
return false;
}
static Process EyemFeatureSet = new Process();
static int webclienttimeout = 30000;
public static void CheckAndRunServer()
{
lock (EyemFeatureSet)
{
Process[] processesByName = Process.GetProcessesByName("EyemFeatureSet");
if (processesByName.Length != 0)
{
return;
}
string text = "Modules\\EyemFeatureSet\\EyemFeatureSet.exe";
if (!File.Exists(text))
{
throw new Exception("找不到算法服务器文件");
}
EyemFeatureSet= ProcessUtil.StartProcess("EyemFeatureSet", Application.StartupPath+"\\Modules\\EyemFeatureSet\\");
int num = 5;
while (num > 0)
{
num--;
Thread.Sleep(1000);
MyWebClient myWebClient = new MyWebClient(webclienttimeout);
string text2 = myWebClient.DownloadString(visionUrl+"/alive");
if (text2.Trim() == "\"1\"")
{
return;
}
}
throw new Exception("算法服务器文件打开失败");
}
}
public class Result
{
/// <summary>
/// 状态码,0为正常
/// </summary>
public int code { get; set; } = 0;
/// <summary>
/// 返回数据
/// </summary>
public Dictionary<string, string> data { get; set; }
/// <summary>
/// 提示信息
/// </summary>
public string msg { get; set; } = "ok";
}
}
}
...@@ -138,6 +138,10 @@ namespace DeviceLibrary ...@@ -138,6 +138,10 @@ namespace DeviceLibrary
StoreFIX02, StoreFIX02,
StoreFIX03, StoreFIX03,
StoreFIX04, StoreFIX04,
StoreFIX04_01_InoutBackToP1,
StoreFIX04_02_CheckLocation,
StoreFIX04_03_ReloadPos,
StoreFIX04_04_InoutToPos,
StoreFIX05, StoreFIX05,
StoreFIX06, StoreFIX06,
StoreTS10, StoreTS10,
......
...@@ -73,8 +73,8 @@ namespace TheMachine ...@@ -73,8 +73,8 @@ namespace TheMachine
var t = stopwatch.ElapsedMilliseconds / 1000d; var t = stopwatch.ElapsedMilliseconds / 1000d;
b.Save(@"D:\rick\vs\SO1069MIMO_PLUS\11-57-09-156_11.bmp"); b.Save(@"D:\rick\vs\SO1069MIMO_PLUS\11-57-09-156_11.bmp");
*/ */
DeviceLibrary.VisionHelper.CheckAndRunServer();
_ = new Mutex(true, Application.ProductName, out bool ret); _ = new Mutex(true, Application.ProductName, out bool ret);
if (!ret) if (!ret)
......
...@@ -13,7 +13,7 @@ namespace TheMachine ...@@ -13,7 +13,7 @@ namespace TheMachine
internal class WindowManager internal class WindowManager
{ {
public static List<WindInfo> windInfos = new List<WindInfo>(); public static List<WindInfo> windInfos = new List<WindInfo>();
static string baseDir = @".\Modules\"; static string baseDir = Application.StartupPath + @"\Modules\";
public static void Start() public static void Start()
{ {
foreach (var item in windInfos) foreach (var item in windInfos)
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!