Commit 071e1423 张东亮

监控相机

1 个父辈 e42f8115
此文件类型无法预览
......@@ -62,10 +62,12 @@
<Compile Include="util\MyWebClient.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="util\ProcessUtil.cs" />
<Compile Include="util\TcpClient.cs" />
<Compile Include="util\TcpServer.cs" />
<Compile Include="util\UdpServer.cs" />
<Compile Include="util\WaitUtil.cs" />
<Compile Include="util\WindowUtil.cs" />
</ItemGroup>
<ItemGroup>
<WCFMetadata Include="Service References\" />
......
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Common
{
/// <summary>
/// 软件管理工具
/// </summary>
public class ProcessUtil
{
/// <summary>
/// 设置自动启动
/// </summary>
/// <param name="strName"></param>
/// <param name="value"></param>
public static void AutoRun(string strName, bool value)
{
try
{
//创建启动对象
System.Diagnostics.ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo();
//设置运行文件
startInfo.FileName = System.Windows.Forms.Application.StartupPath + "\\AuToRunManager.exe";
//设置启动参数
startInfo.Arguments = String.Join(" ", new string[2] { strName, value.ToString() });
//设置启动动作,确保以管理员身份运行
startInfo.Verb = "runas";
//如果不是管理员,则启动UAC
System.Diagnostics.Process.Start(startInfo);
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
}
public static Process StartProcess(string appName, string baseDir = @".\",int waitIdle=5000)
{
try
{
Process process = new Process();
process.StartInfo = new System.Diagnostics.ProcessStartInfo();
process.StartInfo.FileName = appName+".exe";
process.StartInfo.WorkingDirectory = baseDir;
process.Start();
process.WaitForInputIdle(waitIdle);
return process;
}
catch (Exception ex)
{
}
return null;
}
public static Process IsRun(Process process)
{
Process processRun = new Process();
try
{
System.Diagnostics.Process[] processList = System.Diagnostics.Process.GetProcesses
();
foreach (System.Diagnostics.Process process2 in processList)
{
if (process2.Id == process.Id)
{
processRun = process;
}
}
}
catch { }
return processRun;
}
public static bool CloseProcess(Process process)
{
bool sc = false;
try
{
System.Diagnostics.Process[] processList = System.Diagnostics.Process.GetProcesses();
foreach (System.Diagnostics.Process process2 in processList)
{
if (process2.Id == process.Id)
{
process.Kill(); //结束进程
sc = process.WaitForExit(100000);
}
}
}
catch { sc = true; }
return sc;
}
}
}
using log4net.Util;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Xml.Linq;
namespace Common
{
public class WindowUtil
{
public const int WM_CLOSE = 0x0010;
static List<Process> SubProcesses = new List<Process>();
public static Process OpenExe(Panel panel, string appName, string titleName, string baseDir = @".\")
{
if (appName == null || appName == string.Empty) return null;
Process process = null;
IntPtr appWin = IntPtr.Zero;
try
{
process = ProcessUtil.StartProcess(appName, baseDir);
}
catch (Exception ex)
{
// MessageBox.Show(fm, ex.Message, "Error");
return process;
}
return process;
}
public static IntPtr PutIntoForm(Panel panel, string titleName)
{
IntPtr appWin = FindWindow(null, titleName);
if(appWin == IntPtr.Zero)
{
appWin= GetDesktopWindows(titleName);
}
// Put it into this form
SetParent(appWin, panel.Handle);
// Remove border and whatnot
// SetWindowLong(appWin, GWL_STYLE, WS_VISIBLE);
// Move the window to overlay it on this window
MoveWindow(appWin, 0, 0, panel.Width + 2, panel.Height, true);
return appWin;
}
public static void Resize(Panel panel, string titleName)
{
IntPtr appWin = FindWindow(null, titleName);
if (appWin != IntPtr.Zero)
WindowUtil.MoveWindow(appWin, 0, 0, panel.Width, panel.Height, true);
}
public static void RemoveFromForm(string titleName)
{
IntPtr appWin = FindWindow(null, titleName);
// Put it into this form
SetParent(appWin, IntPtr.Zero);
}
/// <summary>
/// 找到某个窗口与给出的类别名和窗口名相同窗口
/// </summary>
/// <param name="lpClassName">类别名</param>
/// <param name="lpWindowName">窗口名</param>
/// <returns>成功找到返回窗口句柄,否则返回null</returns>
[DllImport("user32.dll")]
public static extern IntPtr FindWindow(string lpClassName, string lpWindowName);
/// <summary>
/// 切换到窗口并把窗口设入前台,类似 SetForegroundWindow方法的功能
/// </summary>
/// <param name="hWnd">窗口句柄</param>
/// <param name="fAltTab">True代表窗口正在通过Alt/Ctrl +Tab被切换</param>
[DllImport("user32.dll ", SetLastError = true)]
public static extern void SwitchToThisWindow(IntPtr hWnd, bool fAltTab);
/// <summary>
/// 设置窗口的显示状态
/// </summary>
/// <param name="hWnd">窗口句柄</param>
/// <param name="cmdShow">指示窗口如何被显示</param>
/// <returns>如果窗体之前是可见,返回值为非零;如果窗体之前被隐藏,返回值为零</returns>
[DllImport("user32.dll", EntryPoint = "ShowWindow", CharSet = CharSet.Auto)]
public static extern int ShowWindow(IntPtr hwnd, int nCmdShow);
[DllImport("user32.dll", SetLastError = true)]
private static extern long SetParent(IntPtr hWndChild, IntPtr hWndNewParent);
/// <summary>
/// 改变指定窗口的位置和尺寸
/// </summary>
/// <param name="hwnd">窗口句柄</param>
/// <param name="x">窗口左侧的新位置</param>
/// <param name="y">窗口顶部的新位置</param>
/// <param name="nWidth">窗口的新宽度</param>
/// <param name="nHeight">窗口的新高度</param>
/// <param name="bRepaint">指示是否重新绘制窗口。 如果此参数为 TRUE,窗口将收到消息。 如果参数为 FALSE,则不会重新绘制任何类型的参数。 这适用于工作区、非client 区域 (,包括标题栏和滚动条) ,以及由于移动子窗口而发现父窗口的任何部分</param>
/// <returns>该函数成功,则返回值为非零值</returns>
[DllImport("user32.dll", SetLastError = true)]
private static extern bool MoveWindow(IntPtr hwnd, int x, int y, int nWidth, int nHeight, bool bRepaint);
[DllImport("user32.dll")]
private static extern bool EnumWindows(WNDENUMPROC lpEnumFunc, int lParam);
[DllImport("user32.dll", CharSet = CharSet.Auto)]
public static extern int SendMessage(IntPtr hWnd, int msg, int wParam, string lparam);
[DllImport("user32.dll", EntryPoint = "PostMessage")]
public static extern int PostMessage(IntPtr hwnd, int Msg, int wParam, int lParam);
[DllImport("user32.dll")]
public static extern int GetWindowText(IntPtr hWnd, StringBuilder lpString, int nMaxCount);
[DllImport("user32.dll")]
private static extern int GetWindowTextW(IntPtr hWnd, [MarshalAs(UnmanagedType.LPWStr)] StringBuilder lpString, int nMaxCount);
[DllImport("user32.dll")]
private static extern int GetClassNameW(IntPtr hWnd, [MarshalAs(UnmanagedType.LPWStr)] StringBuilder lpString, int nMaxCount);
private delegate bool WNDENUMPROC(IntPtr hWnd, int lParam);
//寻找系统的全部窗口
public static WindowInfo[] GetAllDesktopWindows()
{
List<WindowInfo> wndList = new List<WindowInfo>();
EnumWindows(delegate (IntPtr hWnd, int lParam)
{
WindowInfo wnd = new WindowInfo();
StringBuilder sb = new StringBuilder(256);
//get hwnd
wnd.hWnd = hWnd;
//get window name
GetWindowTextW(hWnd, sb, sb.Capacity);
wnd.szWindowName = sb.ToString();
//get window class
GetClassNameW(hWnd, sb, sb.Capacity);
wnd.szClassName = sb.ToString();
Console.WriteLine("Window handle=" + wnd.hWnd.ToString().PadRight(20) + " szClassName=" + wnd.szClassName.PadRight(20) + " szWindowName=" + wnd.szWindowName);
//add it into list
wndList.Add(wnd);
return true;
}, 0);
return wndList.ToArray();
}
public static IntPtr GetDesktopWindows(string windowName, StringComparison comparison = StringComparison.Ordinal)
{
WindowInfo[] allWindow = WindowUtil.GetAllDesktopWindows();
var wnd = allWindow.FirstOrDefault(s => s.szWindowName.Equals(windowName, comparison));
return wnd.hWnd;
}
}
public struct WindowInfo
{
public IntPtr hWnd;
public string szWindowName;
public string szClassName;
}
}
......@@ -9,7 +9,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>OnlineStore.DeviceLibrary</RootNamespace>
<AssemblyName>DeviceLibrary</AssemblyName>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
</PropertyGroup>
......
......@@ -8,4 +8,4 @@
</dependentAssembly>
</assemblyBinding>
</runtime>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1"/></startup></configuration>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8"/></startup></configuration>
......@@ -14,37 +14,17 @@ namespace OnlineStore.DeviceLibrary
{
public class IPCameraHelper
{
//"E:\\Codes\\CSharp-Workspace\\MyProject\\WindowsService\\IPCamService\\bin\\Debug\\IPCamService.exe"
static string baseDir = ConfigHelper.Config.Get("IPCamService_HttpServer", "http://localhost:8088");
public static void StartIPCamService()
{
string appFilePath = ConfigHelper.Config.Get("IPCamService_FilePath", @"D:\IPCamera");
if (Directory.Exists(appFilePath))
{
var exe = "IPCamera.exe";
try
{
Process process = new Process();
process.StartInfo = new ProcessStartInfo();
process.StartInfo.FileName = exe;
process.StartInfo.WorkingDirectory = appFilePath;
process.Start();
LogUtil.info($"启动软件:{appFilePath}\\{exe}");
}
catch (Exception ex)
{
LogUtil.error($"启动软件失败:{appFilePath}\\{exe}",ex);
}
}
}
public static void StartRecord(string camName, string fileName = "")
{
Task.Factory.StartNew(delegate
{
string url = $"{baseDir}/cam/startRecord?camName={camName}&filename={fileName}";
string res = HttpHelper.Get(url);
LogUtil.info($"开始记录视频:{fileName},{res}");
//string url = $"{baseDir}/cam/startRecord?camName={camName}&filename={fileName}";
//string res = HttpHelper.Get(url);
LogUtil.info($"视频开始:{camName},{fileName}");
});
}
......@@ -52,9 +32,9 @@ namespace OnlineStore.DeviceLibrary
{
Task.Factory.StartNew(delegate
{
string url = $"{baseDir}/cam/stopRecord?camName={camName}";
string res = HttpHelper.Get(url);
LogUtil.info($"停止记录视频:{res}");
//string url = $"{baseDir}/cam/stopRecord?camName={camName}";
//string res = HttpHelper.Get(url);
LogUtil.info($"视频结束:{camName}");
});
}
......
using CodeLibrary;
using CodeLibrary;
using OnlineStore.Common;
using System;
using System.Collections.Generic;
......@@ -44,7 +44,6 @@ namespace OnlineStore.DeviceLibrary
LoadCamera(false);
CodeLibrary.HDCodeLearnHelper.LoadConfig("", codeStr);
CodeLibrary.EyemDecode.InitModel();
}
catch (Exception ex)
{
......@@ -147,17 +146,24 @@ namespace OnlineStore.DeviceLibrary
LogUtil.debug(deviceName + " 【" + cameraName + "】取图片完成,开始扫码");
string r = "";
bool eyemNoCode = false;
Task eyemtask = Task.Factory.StartNew(delegate {
List<CodeInfo> tlci = EyemDecode.ModelDecoder(ref bmp);
Task eyemtask = Task.Factory.StartNew(delegate
{
RemoteDecodeHelper.RemoteDecodeParam remoteDecodeParam = new RemoteDecodeHelper.RemoteDecodeParam
{
codeTypeList = codeTypeList.ToArray(),
codeCount = codeCount,
timeout = timeOut
};
List<CodeInfo> tlci = new List<CodeInfo>();
tlci = RemoteDecodeHelper.DecodeRequest(bmp, remoteDecodeParam);
foreach (CodeInfo code in tlci)
{
//LogUtil.info(deviceName + " 【" + cameraName + "】[eyemDecode]" + code.CodeType + "(X: " + code.X + ",Y: " + code.Y + ") " + code.CodeStr);
string str = CodeManager.ReplaceCode(code.CodeStr);
if (!codeList.Contains(str))
{
codeList.Add(str);
r = r + "##eyem|" + code.CodeType + "|" + str;
r = r + "##remote|" + code.CodeType + "|" + str;
if (!findRightCode)
{
findRightCode = HasRightCode(str);
......@@ -169,65 +175,14 @@ namespace OnlineStore.DeviceLibrary
bool taskResult = eyemtask.Wait(60000);
if (!taskResult)
{
LogUtil.error(deviceName + " 【" + cameraName + "】eyem扫码超时");
eyemNoCode = true;
LogUtil.error(deviceName + " 【" + cameraName + "】扫码超时");
}
if (!isPreScan)
if (!findRightCode)
{
if (!findRightCode)
{
List<CodeInfo> cc = new List<CodeInfo>();
eyemNoCode = true;
foreach (string codeType in codeTypeList)
{
//判断是否是一维码
if (codeType.ToLower().Equals("barcode"))
{
cc = HDCodeHelper.DecodeBarCode(ho_Image);
}
else
{
cc = HDCodeHelper.DecodeCode(ho_Image, codeType, GetCodeParamFilePath(codeType), codeCount, timeOut);
}
foreach (CodeInfo c in cc)
{
string str = CodeManager.ReplaceCode(c.CodeStr);
if (!codeList.Contains(str))
{
codeList.Add(str);
r = r + "##halcon|" + codeType + "|" + str;
if (!findRightCode)
{
findRightCode = HasRightCode(str);
}
}
}
if (findRightCodeBreak && findRightCode)
{
break;
}
}
}
//if (!findRightCode && SaveErrorImageToFile.Equals(1))
if ((!findRightCode) || eyemNoCode)
{
//如果halcon没扫出的,
string nameStr = "";
if (findRightCode && eyemNoCode)
{
nameStr = "eyem";
}
if (!taskResult)
{
nameStr = "eyemTimeOut";
}
SaveImageToFile(deviceName, cameraName + nameStr, bmp);
}
SaveImageToFile(deviceName, cameraName, bmp);
}
if (deviceName != "" || r != "")
{
LogUtil.info(deviceName + " 【" + cameraName + "】扫码完成【" + FormUtil.GetSpanStr(DateTime.Now - startTime) + "】[" + findRightCode + "]" + ScanCount + " :" + r);
......@@ -316,14 +271,14 @@ namespace OnlineStore.DeviceLibrary
//640104 * 3331001202 * 210417624 * 600 * 0011
//分号分割后长度=4,L,E,B,R
//TJM211030000146 & 10446500228 & 15000 & 2021 - 06 - 28 & 59K0646169 && 10446 && R02472021102600281
// RI & PN & QTY & 4 & BATCH & 5 & 6 & 7 & 8
// RI & PN & QTY & 4 & BATCH & 5 & 6 & 7 & 8
// RI & PN & QTY & PRODATEyyyy - MM - dd & 5 & 6 & 7 & 8 & 9
try
{
foreach (string code in codes)
{
string[] strarray = code.Split('&');
if (strarray.Length >=5)
if (strarray.Length >= 5)
{
try
{
......@@ -336,7 +291,7 @@ namespace OnlineStore.DeviceLibrary
if (QTY > 0)
{
return true;
}
}
}
catch (Exception ex)
{
......
......@@ -111,7 +111,6 @@ namespace OnlineStore.DeviceLibrary
//CSVPositionReader<DrawerPosition>.AddCSVFile(drawConfigFile);
XLRStore = new XLRStoreBean(Config, inputConfig, boxConfig);
IPCameraHelper.StartIPCamService();
LogUtil.info("加载 完成!");
return true;
}
......
......@@ -25,16 +25,16 @@ namespace OnlineStore.DeviceLibrary
{
if (loadCameraState)
return;
string path = @".\Config\Camera.json";
if (!File.Exists(path))
{
LogUtil.error(Name + "找不到监控相机配置文件" + path);
}
//string path = @".\Config\Camera.json";
//if (!File.Exists(path))
//{
// LogUtil.error(Name + "找不到监控相机配置文件" + path);
//}
camera = new Asa.Camera.VisionLib(path);
camerathread = new Thread[2];
//pictureBox1.Image = bmp;
StartCamera();
//camera = new Asa.Camera.VisionLib(path);
//camerathread = new Thread[2];
////pictureBox1.Image = bmp;
//StartCamera();
loadCameraState = true;
}
void StartCamera()
......@@ -50,22 +50,6 @@ namespace OnlineStore.DeviceLibrary
//camerathread[1].Start("box_B");
}
void startMonitor(object obj)
{
if (!loadCameraState)
{
LogUtil.error(Name + "监控相机初始化失败,无法开启");
return;
}
string name = (string)obj;
while (IsOpen)
{
Bitmap bmp = AcqImage(name);
if (bmp != null)
camera_event?.Invoke(new CameraArgs(name, bmp));
Thread.Sleep(300);
}
}
public Bitmap AcqImage(string camName)
{
Bitmap bitmap = camera.GetImage(camName);
......@@ -74,45 +58,6 @@ namespace OnlineStore.DeviceLibrary
string imgPath = ConfigAppSettings.GetValue(Setting_Init.ImagePath);
public void SaveImage(string camName)
{
try
{
if (MoveInfo.MoveParam == null)
{
string path = Application.StartupPath + imgPath + "Records\\" + DateTime.Now.ToString("yyyyMMdd");
if (AutoSaveImage)
{
if (!System.IO.Directory.Exists(path))
Directory.CreateDirectory(path);
Task.Factory.StartNew(() =>
{
camera.SaveImage(camName, path, $"{camName}-{DateTime.Now.ToString("hhmmssfff")}", System.Drawing.Imaging.ImageFormat.Bmp);
});
}
}
else
{
if (MoveInfo.MoveParam.PosInfo != null)
{
InOutPosInfo inOutPosInfo = MoveInfo.MoveParam.PosInfo;
string path = Application.StartupPath + imgPath + "Records\\" + DateTime.Now.ToString("yyyyMMdd") + "\\" + inOutPosInfo.PosId;
if (AutoSaveImage)
{
if (!System.IO.Directory.Exists(path))
Directory.CreateDirectory(path);
Task.Factory.StartNew(() =>
{
camera.SaveImage(camName, path, $"{camName}-{inOutPosInfo.barcode}-{MoveInfo.MoveType}-{DateTime.Now.ToString("hhmmssfff")}", System.Drawing.Imaging.ImageFormat.Bmp);
});
}
}
}
}
catch (Exception ex)
{
LogUtil.error($"保存{camName}图片失败", ex);
}
}
......
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,log4net" />
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,log4net"/>
</configSections>
<log4net>
<appender name="RollingLogFileAppender" type="log4net.Appender.RollingFileAppender">
<file value="logs/XLR-SO908.log" />
<param name="Encoding" value="UTF-8" />
<appendToFile value="true" />
<rollingStyle value="Date" />
<datePattern value="yyyy-MM-dd" />
<file value="logs/XLR-SO908.log"/>
<param name="Encoding" value="UTF-8"/>
<appendToFile value="true"/>
<rollingStyle value="Date"/>
<datePattern value="yyyy-MM-dd"/>
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="[%date][%t]%-5p %m%n" />
<conversionPattern value="[%date][%t]%-5p %m%n"/>
</layout>
</appender>
<appender name="TheRFID" type="log4net.Appender.RollingFileAppender">
<file value="logs/rfid/TheRFID-line.log" />
<param name="Encoding" value="UTF-8" />
<appendToFile value="true" />
<rollingStyle value="Date" />
<datePattern value="yyyy-MM-dd" />
<file value="logs/rfid/TheRFID-line.log"/>
<param name="Encoding" value="UTF-8"/>
<appendToFile value="true"/>
<rollingStyle value="Date"/>
<datePattern value="yyyy-MM-dd"/>
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="[%date][%t]%-5p %m%n" />
<conversionPattern value="[%date][%t]%-5p %m%n"/>
</layout>
</appender>
<appender name="Rmaxis" type="log4net.Appender.RollingFileAppender">
<file value="logs/rmaix/Rmaxis-line.log" />
<param name="Encoding" value="UTF-8" />
<appendToFile value="true" />
<rollingStyle value="Date" />
<datePattern value="yyyy-MM-dd" />
<file value="logs/rmaix/Rmaxis-line.log"/>
<param name="Encoding" value="UTF-8"/>
<appendToFile value="true"/>
<rollingStyle value="Date"/>
<datePattern value="yyyy-MM-dd"/>
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="[%date][%t]%-5p %m%n" />
<conversionPattern value="[%date][%t]%-5p %m%n"/>
</layout>
</appender>
<logger name="RollingLogFileAppender">
<level value="Info" />
<appender-ref ref="RollingLogFileAppender" />
<level value="Info"/>
<appender-ref ref="RollingLogFileAppender"/>
</logger>
<logger name="TheRFID">
<level value="Info" />
<appender-ref ref="TheRFID" />
<level value="Info"/>
<appender-ref ref="TheRFID"/>
</logger>
<logger name="Rmaxis">
<level value="Info" />
<appender-ref ref="Rmaxis" />
<level value="Info"/>
<appender-ref ref="Rmaxis"/>
</logger>
<!--<root>
<level value="Info" />
......@@ -52,14 +52,14 @@
</root>-->
</log4net>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8"/>
</startup>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="log4net" publicKeyToken="669e0ddf0bb1aa2a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.0.12.0" newVersion="2.0.12.0" />
<assemblyIdentity name="log4net" publicKeyToken="669e0ddf0bb1aa2a" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-2.0.12.0" newVersion="2.0.12.0"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
\ No newline at end of file
</configuration>
......@@ -44,6 +44,8 @@
this.BoxControl = new OnlineStore.XLRStore.EquipControl();
this.ShelfAControl = new OnlineStore.XLRStore.EquipControl();
this.ShelfBControl = new OnlineStore.XLRStore.EquipControl();
this.tabPage3 = new System.Windows.Forms.TabPage();
this.panelVideo = new System.Windows.Forms.Panel();
this.lblStatus = new System.Windows.Forms.Label();
this.lblWarnMsg = new System.Windows.Forms.Label();
this.notifyIcon1 = new System.Windows.Forms.NotifyIcon(this.components);
......@@ -69,6 +71,7 @@
this.托盘初始化ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator16 = new System.Windows.Forms.ToolStripSeparator();
this.toolStripMenuItem3 = new System.Windows.Forms.ToolStripMenuItem();
this.查看监控ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.帮助ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.清空日志ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator10 = new System.Windows.Forms.ToolStripSeparator();
......@@ -85,12 +88,12 @@
this.toolStripSeparator17 = new System.Windows.Forms.ToolStripSeparator();
this.禁用安全光栅ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.启用门禁ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.查看监控ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.tabControl1.SuspendLayout();
this.tabPage1.SuspendLayout();
this.tabPage2.SuspendLayout();
this.panel1.SuspendLayout();
this.tableLayoutPanel1.SuspendLayout();
this.tabPage3.SuspendLayout();
this.contextMenuStrip1.SuspendLayout();
this.menuStrip1.SuspendLayout();
this.SuspendLayout();
......@@ -102,6 +105,7 @@
| System.Windows.Forms.AnchorStyles.Right)));
this.tabControl1.Controls.Add(this.tabPage1);
this.tabControl1.Controls.Add(this.tabPage2);
this.tabControl1.Controls.Add(this.tabPage3);
this.tabControl1.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.tabControl1.Location = new System.Drawing.Point(4, 78);
this.tabControl1.Multiline = true;
......@@ -293,6 +297,24 @@
this.ShelfBControl.TabIndex = 7;
this.ShelfBControl.WorkStatus = "暂未启动";
//
// tabPage3
//
this.tabPage3.Controls.Add(this.panelVideo);
this.tabPage3.Location = new System.Drawing.Point(4, 60);
this.tabPage3.Name = "tabPage3";
this.tabPage3.Size = new System.Drawing.Size(192, 36);
this.tabPage3.TabIndex = 2;
this.tabPage3.Text = "监控";
this.tabPage3.UseVisualStyleBackColor = true;
//
// panelVideo
//
this.panelVideo.Dock = System.Windows.Forms.DockStyle.Fill;
this.panelVideo.Location = new System.Drawing.Point(0, 0);
this.panelVideo.Name = "panelVideo";
this.panelVideo.Size = new System.Drawing.Size(192, 36);
this.panelVideo.TabIndex = 0;
//
// lblStatus
//
this.lblStatus.AutoSize = true;
......@@ -447,39 +469,46 @@
// toolStripSeparator6
//
this.toolStripSeparator6.Name = "toolStripSeparator6";
this.toolStripSeparator6.Size = new System.Drawing.Size(221, 6);
this.toolStripSeparator6.Size = new System.Drawing.Size(215, 6);
this.toolStripSeparator6.Visible = false;
//
// 二维码学习ToolStripMenuItem
//
this.二维码学习ToolStripMenuItem.Name = "二维码学习ToolStripMenuItem";
this.二维码学习ToolStripMenuItem.Size = new System.Drawing.Size(224, 32);
this.二维码学习ToolStripMenuItem.Size = new System.Drawing.Size(218, 32);
this.二维码学习ToolStripMenuItem.Text = "二维码学习";
this.二维码学习ToolStripMenuItem.Click += new System.EventHandler(this.二维码学习ToolStripMenuItem_Click);
//
// toolStripSeparator7
//
this.toolStripSeparator7.Name = "toolStripSeparator7";
this.toolStripSeparator7.Size = new System.Drawing.Size(221, 6);
this.toolStripSeparator7.Size = new System.Drawing.Size(215, 6);
//
// 托盘初始化ToolStripMenuItem
//
this.托盘初始化ToolStripMenuItem.Name = "托盘初始化ToolStripMenuItem";
this.托盘初始化ToolStripMenuItem.Size = new System.Drawing.Size(224, 32);
this.托盘初始化ToolStripMenuItem.Size = new System.Drawing.Size(218, 32);
this.托盘初始化ToolStripMenuItem.Text = "托盘编码";
//
// toolStripSeparator16
//
this.toolStripSeparator16.Name = "toolStripSeparator16";
this.toolStripSeparator16.Size = new System.Drawing.Size(221, 6);
this.toolStripSeparator16.Size = new System.Drawing.Size(215, 6);
//
// toolStripMenuItem3
//
this.toolStripMenuItem3.Name = "toolStripMenuItem3";
this.toolStripMenuItem3.Size = new System.Drawing.Size(224, 32);
this.toolStripMenuItem3.Size = new System.Drawing.Size(218, 32);
this.toolStripMenuItem3.Text = "脆盘料号配置";
this.toolStripMenuItem3.Click += new System.EventHandler(this.toolStripMenuItem3_Click);
//
// 查看监控ToolStripMenuItem
//
this.查看监控ToolStripMenuItem.Name = "查看监控ToolStripMenuItem";
this.查看监控ToolStripMenuItem.Size = new System.Drawing.Size(218, 32);
this.查看监控ToolStripMenuItem.Text = "查看监控";
this.查看监控ToolStripMenuItem.Click += new System.EventHandler(this.查看监控ToolStripMenuItem_Click);
//
// 帮助ToolStripMenuItem
//
this.帮助ToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
......@@ -606,13 +635,6 @@
this.启用门禁ToolStripMenuItem.Text = "启用门禁";
this.启用门禁ToolStripMenuItem.Click += new System.EventHandler(this.启用门禁ToolStripMenuItem_Click);
//
// 查看监控ToolStripMenuItem
//
this.查看监控ToolStripMenuItem.Name = "查看监控ToolStripMenuItem";
this.查看监控ToolStripMenuItem.Size = new System.Drawing.Size(224, 32);
this.查看监控ToolStripMenuItem.Text = "查看监控";
this.查看监控ToolStripMenuItem.Click += new System.EventHandler(this.查看监控ToolStripMenuItem_Click);
//
// FrmXLRStore
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
......@@ -638,6 +660,7 @@
this.tabPage2.ResumeLayout(false);
this.panel1.ResumeLayout(false);
this.tableLayoutPanel1.ResumeLayout(false);
this.tabPage3.ResumeLayout(false);
this.contextMenuStrip1.ResumeLayout(false);
this.menuStrip1.ResumeLayout(false);
this.menuStrip1.PerformLayout();
......@@ -704,6 +727,8 @@
private System.Windows.Forms.ToolStripMenuItem 禁用安全光栅ToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem 启用门禁ToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem 查看监控ToolStripMenuItem;
private System.Windows.Forms.TabPage tabPage3;
private System.Windows.Forms.Panel panelVideo;
}
}
......@@ -19,7 +19,7 @@ namespace OnlineStore.XLRStore.Properties {
// 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
// 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen
// (以 /str 作为命令选项),或重新生成 VS 项目。
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {
......
......@@ -12,7 +12,7 @@ namespace OnlineStore.XLRStore.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.8.1.0")]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.5.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
......
using Common;
using OnlineStore.Common;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace OnlineStore.XLRStore
{
internal class WindowManager
{
public static List<WindInfo> windInfos = new List<WindInfo>();
static string baseDir = @".\Modules\";
public static void Start()
{
foreach (var item in windInfos)
{
try
{
item.ProcessInfo = ProcessUtil.StartProcess(item.Name, baseDir + $"{item.Name}\\", 60000);
}
catch (Exception ex)
{
LogUtil.error($"程序{item.Name}启动失败", ex);
}
}
}
public static void Show()
{
foreach (var item in windInfos)
{
if (item.Parent.IsHandleCreated)
{
if (item.WindowHandle == IntPtr.Zero)
item.WindowHandle = WindowUtil.PutIntoForm(item.Parent, item.Name);
}
}
}
}
class WindInfo
{
public string Name { get; set; }
public IntPtr WindowHandle { get; set; }
public Panel Parent { get; set; }
public Process ProcessInfo { get; set; }
public const string IPCamera = "IPCamera";
}
}
......@@ -9,7 +9,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>OnlineStore.XLRStore</RootNamespace>
<AssemblyName>XLRStore</AssemblyName>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
<PublishUrl>publish\</PublishUrl>
......@@ -223,6 +223,7 @@
<Compile Include="useControl\EquipControl.Designer.cs">
<DependentUpon>EquipControl.cs</DependentUpon>
</Compile>
<Compile Include="WindowManager.cs" />
<EmbeddedResource Include="boxForm\FrmAutoFindPos.resx">
<DependentUpon>FrmAutoFindPos.cs</DependentUpon>
</EmbeddedResource>
......
......@@ -12,7 +12,6 @@ using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using eyemLib_Sharp;
using static CodeLibrary.EyemDecode;
namespace OnlineStore.XLRStore
{
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!