Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
张东亮
/
SO1131-XLRStore
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit f256ab84
由
张东亮
编写于
2023-03-14 20:40:52 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
添加监控相机保存
1 个父辈
15312fe1
隐藏空白字符变更
内嵌
并排
正在显示
10 个修改的文件
包含
236 行增加
和
51 行删除
source/DeviceLibrary/DeviceLibrary.csproj
source/DeviceLibrary/manager/IPCameraHelper.cs
source/DeviceLibrary/storeBean/XLRStoreBean.cs
source/DeviceLibrary/storeBean/boxBean/BoxEquip.cs
source/DeviceLibrary/storeBean/boxBean/BoxEquip_Camera.cs
source/DeviceLibrary/storeBean/boxBean/BoxEquip_InExecute.cs
source/DeviceLibrary/storeBean/boxBean/BoxEquip_OutExecute.cs
source/DeviceLibrary/storeBean/boxBean/BoxEquip_Partial.cs
source/XLRStoreClient/boxForm/FrmBoxEquip.Designer.cs
source/XLRStoreClient/boxForm/FrmBoxEquip.cs
source/DeviceLibrary/DeviceLibrary.csproj
查看文件 @
f256ab8
...
...
@@ -59,8 +59,10 @@
</Reference>
<Reference Include="System" />
<Reference Include="System.Configuration" />
<Reference Include="System.Configuration.Install" />
<Reference Include="System.Core" />
<Reference Include="System.Drawing" />
<Reference Include="System.ServiceProcess" />
<Reference Include="System.Web" />
<Reference Include="System.Web.Extensions" />
<Reference Include="System.Windows.Forms" />
...
...
@@ -85,6 +87,7 @@
<Compile Include="manager\agvClient\AgvClient - 复制.cs" />
<Compile Include="manager\agvClient\AgvClient.cs" />
<Compile Include="manager\BufferDataManager.cs" />
<Compile Include="manager\IPCameraHelper.cs" />
<Compile Include="manager\StoreManager.cs" />
<Compile Include="deviceLibrary\RFID\RFIDManagercs.cs" />
<Compile Include="manager\SServerManager.cs" />
...
...
@@ -207,6 +210,10 @@
<Project>{43cdd09e-fcf3-4960-a01d-3bbfe9933122}</Project>
<Name>Common</Name>
</ProjectReference>
<ProjectReference Include="..\ConfigHelper\ConfigHelper\ConfigHelper.csproj">
<Project>{290182db-d949-434e-9ff7-c59bde3f433a}</Project>
<Name>ConfigHelper</Name>
</ProjectReference>
<ProjectReference Include="..\DL.CV\DL.CV.csproj">
<Project>{f0a7c33b-7db5-485b-8451-45955d756c2e}</Project>
<Name>DL.CV</Name>
...
...
source/DeviceLibrary/manager/IPCameraHelper.cs
0 → 100644
查看文件 @
f256ab8
using
OnlineStore.Common
;
using
System
;
using
System.Collections
;
using
System.Collections.Generic
;
using
System.Configuration.Install
;
using
System.Linq
;
using
System.ServiceProcess
;
using
System.Text
;
using
System.Threading.Tasks
;
namespace
OnlineStore.DeviceLibrary
{
public
class
IPCameraHelper
{
//"E:\\Codes\\CSharp-Workspace\\MyProject\\WindowsService\\IPCamService\\bin\\Debug\\IPCamService.exe"
static
string
appPath
=
AppDomain
.
CurrentDomain
.
BaseDirectory
;
static
string
serviceFilePath
=
ConfigHelper
.
Config
.
Get
(
"IPCamService_FilePath"
,
$
"{appPath}IPCamService\\IPCamService.exe"
);
static
string
serviceName
=
ConfigHelper
.
Config
.
Get
(
"IPCamService_ServiceName"
,
"IPCamService"
);
/// <summary>
/// 安装服务
/// </summary>
public
static
void
InstallService
()
{
if
(!
IsServiceExisted
(
serviceName
))
{
InstallService
(
serviceFilePath
);
LogUtil
.
info
(
"安装监控相机服务"
);
ServiceStart
(
serviceName
);
LogUtil
.
info
(
"启动监控相机服务"
);
}
else
{
ServiceStart
(
serviceName
);
LogUtil
.
info
(
"启动监控相机服务"
);
}
}
static
string
baseDir
=
ConfigHelper
.
Config
.
Get
(
"IPCameraService_HttpServer"
,
"http://localhost:8088"
);
public
static
void
StartRecord
(
string
camName
,
string
fileName
=
""
)
{
string
url
=
$
"{baseDir}/cam/startRecord?camName={camName}&filename={fileName}"
;
string
res
=
HttpHelper
.
Get
(
url
);
LogUtil
.
info
(
$
"开始记录视频:{fileName},{res}"
);
}
public
static
void
StopRecord
(
string
camName
)
{
string
url
=
$
"{baseDir}/cam/stopRecord?camName={camName}"
;
string
res
=
HttpHelper
.
Get
(
url
);
LogUtil
.
info
(
$
"停止记录视频:{res}"
);
}
//判断服务是否存在
static
bool
IsServiceExisted
(
string
serviceName
)
{
ServiceController
[]
services
=
ServiceController
.
GetServices
();
foreach
(
ServiceController
sc
in
services
)
{
if
(
sc
.
ServiceName
.
ToLower
()
==
serviceName
.
ToLower
())
{
return
true
;
}
}
return
false
;
}
//安装服务
static
void
InstallService
(
string
serviceFilePath
)
{
try
{
using
(
AssemblyInstaller
installer
=
new
AssemblyInstaller
())
{
installer
.
UseNewContext
=
true
;
installer
.
Path
=
serviceFilePath
;
IDictionary
savedState
=
new
Hashtable
();
installer
.
Install
(
savedState
);
installer
.
Commit
(
savedState
);
}
}
catch
(
Exception
ex
)
{
LogUtil
.
error
(
"安装监控相机服务失败"
,
ex
);
}
}
//卸载服务
static
void
UninstallService
(
string
serviceFilePath
)
{
using
(
AssemblyInstaller
installer
=
new
AssemblyInstaller
())
{
installer
.
UseNewContext
=
true
;
installer
.
Path
=
serviceFilePath
;
installer
.
Uninstall
(
null
);
}
}
//启动服务
static
void
ServiceStart
(
string
serviceName
)
{
try
{
using
(
ServiceController
control
=
new
ServiceController
(
serviceName
))
{
if
(
control
.
Status
==
ServiceControllerStatus
.
Stopped
)
{
control
.
Start
();
}
}
}
catch
(
Exception
ex
)
{
LogUtil
.
error
(
$
"启动监控相机服务失败"
,
ex
);
}
}
//停止服务
static
void
ServiceStop
(
string
serviceName
)
{
using
(
ServiceController
control
=
new
ServiceController
(
serviceName
))
{
if
(
control
.
Status
==
ServiceControllerStatus
.
Running
)
{
control
.
Stop
();
}
}
}
}
}
source/DeviceLibrary/storeBean/XLRStoreBean.cs
查看文件 @
f256ab8
...
...
@@ -74,6 +74,7 @@ namespace OnlineStore.DeviceLibrary
CodeManager
.
LoadConfig
();
BufferDataManager
.
InitData
();
IPCameraHelper
.
InstallService
();
mainTimer
.
Enabled
=
true
;
canStart
=
true
;
}
...
...
source/DeviceLibrary/storeBean/boxBean/BoxEquip.cs
查看文件 @
f256ab8
...
...
@@ -960,7 +960,7 @@ namespace OnlineStore.DeviceLibrary
internal
override
void
StopMove
()
{
StopRecord
();
MoveInfo
.
EndMove
();
PullAxis_Updown
.
SuddenStop
();
...
...
source/DeviceLibrary/storeBean/boxBean/BoxEquip_Camera.cs
查看文件 @
f256ab8
...
...
@@ -82,17 +82,37 @@ namespace OnlineStore.DeviceLibrary
catch
{
}
}
void
StopCamera
()
{
IsOpen
=
false
;
camera
.
Close
();
camera
.
Dispose
();
}
public
Bitmap
AcqImage
(
string
camName
)
{
Bitmap
bitmap
=
camera
.
GetImage
(
camName
);
return
bitmap
;
}
public
void
StartRecord
(
string
boxAFileName
,
string
boxBFileName
)
{
StartBoxARecord
(
boxAFileName
);
StartBoxBRecord
(
boxBFileName
);
}
public
void
StartBoxARecord
(
string
filename
)
{
IPCameraHelper
.
StartRecord
(
boxACamName
,
filename
);
}
public
void
StartBoxBRecord
(
string
filename
)
{
IPCameraHelper
.
StartRecord
(
boxBCamName
,
filename
);
}
public
void
StopBoxARecord
()
{
IPCameraHelper
.
StopRecord
(
boxACamName
);
}
public
void
StopBoxBRecord
()
{
IPCameraHelper
.
StopRecord
(
boxBCamName
);
}
public
void
StopRecord
()
{
StopBoxARecord
();
StopBoxBRecord
();
}
}
public
class
CameraArgs
:
EventArgs
{
...
...
@@ -110,47 +130,4 @@ namespace OnlineStore.DeviceLibrary
Image
=
img
;
}
}
//partial class BoxEquip
//{
// public const string boxACamName = "box_A";
// public const string boxBCamName = "box_B";
// bool loadCameraState = false;
// void LoadCameraConfig(string id = "")
// {
// if (loadCameraState)
// return;
// string path = Application.StartupPath+@"\Config\IPCamera.json";
// if (!File.Exists(path))
// {
// LogUtil.error(Name + "找不到监控相机配置文件:" + path);
// }
// IPCameraManager.LoadConfig(path);
// loadCameraState = true;
// }
// public void RegisterCameraAGrabImage(ImageGrabbedEventHandler grabbedEventHandler)
// {
// IPCameraManager.GetCamera(boxACamName).ImageGrabbed += grabbedEventHandler;
// IPCameraManager.GetCamera(boxACamName).StartLive();
// }
// public void RegisterCameraBGrabImage(ImageGrabbedEventHandler grabbedEventHandler)
// {
// IPCameraManager.GetCamera(boxBCamName).ImageGrabbed += grabbedEventHandler;
// IPCameraManager.GetCamera(boxBCamName).StartLive();
// }
// public void UnRegisterCameraAGrabImage(ImageGrabbedEventHandler grabbedEventHandler)
// {
// IPCameraManager.GetCamera(boxACamName).ImageGrabbed -= grabbedEventHandler;
// IPCameraManager.GetCamera(boxACamName).StopLive();
// }
// public void UnRegisterCameraBGrabImage(ImageGrabbedEventHandler grabbedEventHandler)
// {
// IPCameraManager.GetCamera(boxBCamName).ImageGrabbed -= grabbedEventHandler;
// IPCameraManager.GetCamera(boxBCamName).StopLive();
// }
// void StartRecord() { }
// void StopRecord() { }
//}
}
source/DeviceLibrary/storeBean/boxBean/BoxEquip_InExecute.cs
查看文件 @
f256ab8
...
...
@@ -459,7 +459,14 @@ namespace OnlineStore.DeviceLibrary
MoveInfo
.
EndMove
();
AutoInout
.
InOutEndProcess
(
this
,
MoveType
.
InStore
);
}
if
(
CheckASide
())
{
StopBoxARecord
();
}
else
{
StopBoxBRecord
();
}
}
else
{
...
...
source/DeviceLibrary/storeBean/boxBean/BoxEquip_OutExecute.cs
查看文件 @
f256ab8
...
...
@@ -321,6 +321,14 @@ namespace OnlineStore.DeviceLibrary
break
;
case
StepEnum
.
SO_20_Finish
:
SetBoxStatus
(
DeviceStatus
.
StoreOnline
,
RunStatus
.
Runing
);
if
(
CheckASide
())
{
StopBoxARecord
();
}
else
{
StopBoxBRecord
();
}
MoveInfo
.
EndMove
();
AutoInout
.
InOutEndProcess
(
this
,
MoveType
.
OutStore
);
break
;
...
...
source/DeviceLibrary/storeBean/boxBean/BoxEquip_Partial.cs
查看文件 @
f256ab8
...
...
@@ -1047,6 +1047,7 @@ namespace OnlineStore.DeviceLibrary
{
return
false
;
}
StopRecord
();
startInStoreTime
=
DateTime
.
Now
;
LogInfo
(
" 启动入库【"
+
param
.
PosInfo
.
ToStr
()
+
"】 "
);
param
.
MoveP
=
new
LineMoveP
(
Config
,
param
.
PosInfo
.
PosId
);
...
...
@@ -1054,9 +1055,22 @@ namespace OnlineStore.DeviceLibrary
MoveInfo
.
NewMove
(
MoveType
.
InStore
,
param
);
SetBoxStatus
(
DeviceStatus
.
InStoreExecute
,
RunStatus
.
Busy
,
param
.
PosInfo
.
PosId
,
param
.
PosInfo
.
barcode
);
if
(
param
.
PosInfoBack
!=
null
)
{
MoveInfo
.
NextMoveStep
(
StepEnum
.
SIB_00_StartInstore
);
StartRecord
(
$
"IN-{param.PosInfo.barcode}-{param.PosInfo.PosId}"
,
$
"IN-{param.PosInfoBack.barcode}-{param.PosInfoBack.PosId}"
);
}
else
{
MoveInfo
.
NextMoveStep
(
StepEnum
.
SI_00_StartInstore
);
if
(
CheckASide
())
{
StartBoxARecord
(
$
"IN-{param.PosInfo.barcode}-{param.PosInfo.PosId}"
);
}
else
{
StartBoxBRecord
(
$
"IN-{param.PosInfo.barcode}-{param.PosInfo.PosId}"
);
}
}
AxisAlarmFlag
=
false
;
return
true
;
}
...
...
@@ -1301,6 +1315,14 @@ namespace OnlineStore.DeviceLibrary
LogInfo
(
"启动出库【"
+
param
.
PosInfo
.
ToStr
()
+
"】 "
);
//LogInfo("LoadInoutParam:" + JsonHelper.SerializeObject(param.MoveP));
MoveInfo
.
NextMoveStep
(
StepEnum
.
SO_00_StartOutstore
);
if
(
CheckASide
())
{
StartBoxARecord
(
$
"OUT-{param.PosInfo.barcode}-{param.PosInfo.PosId}"
);
}
else
{
StartBoxBRecord
(
$
"OUT-{param.PosInfo.barcode}-{param.PosInfo.PosId}"
);
}
AxisAlarmFlag
=
false
;
return
true
;
}
...
...
source/XLRStoreClient/boxForm/FrmBoxEquip.Designer.cs
查看文件 @
f256ab8
...
...
@@ -34,6 +34,8 @@
this
.
groupBox3
=
new
System
.
Windows
.
Forms
.
GroupBox
();
this
.
tableLayoutPanel1
=
new
System
.
Windows
.
Forms
.
TableLayoutPanel
();
this
.
groupDO
=
new
System
.
Windows
.
Forms
.
GroupBox
();
this
.
button2
=
new
System
.
Windows
.
Forms
.
Button
();
this
.
button1
=
new
System
.
Windows
.
Forms
.
Button
();
this
.
lblThisSta
=
new
System
.
Windows
.
Forms
.
Label
();
this
.
tabControl1
=
new
System
.
Windows
.
Forms
.
TabControl
();
this
.
tabPage3
=
new
System
.
Windows
.
Forms
.
TabPage
();
...
...
@@ -60,6 +62,7 @@
this
.
groupBox1
.
SuspendLayout
();
this
.
groupBox4
.
SuspendLayout
();
this
.
groupBox3
.
SuspendLayout
();
this
.
groupDO
.
SuspendLayout
();
this
.
tabControl1
.
SuspendLayout
();
this
.
tabPage3
.
SuspendLayout
();
this
.
groupBox5
.
SuspendLayout
();
...
...
@@ -281,6 +284,8 @@
//
this
.
groupDO
.
Anchor
=
((
System
.
Windows
.
Forms
.
AnchorStyles
)(((
System
.
Windows
.
Forms
.
AnchorStyles
.
Top
|
System
.
Windows
.
Forms
.
AnchorStyles
.
Left
)
|
System
.
Windows
.
Forms
.
AnchorStyles
.
Right
)));
this
.
groupDO
.
Controls
.
Add
(
this
.
button2
);
this
.
groupDO
.
Controls
.
Add
(
this
.
button1
);
this
.
groupDO
.
Location
=
new
System
.
Drawing
.
Point
(
414
,
128
);
this
.
groupDO
.
Name
=
"groupDO"
;
this
.
groupDO
.
Size
=
new
System
.
Drawing
.
Size
(
565
,
381
);
...
...
@@ -288,6 +293,26 @@
this
.
groupDO
.
TabStop
=
false
;
this
.
groupDO
.
Text
=
"IO操作测试"
;
//
// button2
//
this
.
button2
.
Location
=
new
System
.
Drawing
.
Point
(
253
,
59
);
this
.
button2
.
Name
=
"button2"
;
this
.
button2
.
Size
=
new
System
.
Drawing
.
Size
(
146
,
60
);
this
.
button2
.
TabIndex
=
1
;
this
.
button2
.
Text
=
"手动停止监控保存"
;
this
.
button2
.
UseVisualStyleBackColor
=
true
;
this
.
button2
.
Click
+=
new
System
.
EventHandler
(
this
.
button2_Click
);
//
// button1
//
this
.
button1
.
Location
=
new
System
.
Drawing
.
Point
(
62
,
59
);
this
.
button1
.
Name
=
"button1"
;
this
.
button1
.
Size
=
new
System
.
Drawing
.
Size
(
146
,
60
);
this
.
button1
.
TabIndex
=
0
;
this
.
button1
.
Text
=
"手动开始监控保存"
;
this
.
button1
.
UseVisualStyleBackColor
=
true
;
this
.
button1
.
Click
+=
new
System
.
EventHandler
(
this
.
button1_Click
);
//
// lblThisSta
//
this
.
lblThisSta
.
Dock
=
System
.
Windows
.
Forms
.
DockStyle
.
Fill
;
...
...
@@ -598,6 +623,7 @@
this
.
groupBox1
.
PerformLayout
();
this
.
groupBox4
.
ResumeLayout
(
false
);
this
.
groupBox3
.
ResumeLayout
(
false
);
this
.
groupDO
.
ResumeLayout
(
false
);
this
.
tabControl1
.
ResumeLayout
(
false
);
this
.
tabPage3
.
ResumeLayout
(
false
);
this
.
groupBox5
.
ResumeLayout
(
false
);
...
...
@@ -657,6 +683,8 @@
private
System
.
Windows
.
Forms
.
TableLayoutPanel
tableLayoutPanel3
;
private
System
.
Windows
.
Forms
.
TableLayoutPanel
tableLayoutPanel4
;
private
System
.
Windows
.
Forms
.
Button
btnHlhasReel
;
private
System
.
Windows
.
Forms
.
Button
button2
;
private
System
.
Windows
.
Forms
.
Button
button1
;
}
}
source/XLRStoreClient/boxForm/FrmBoxEquip.cs
查看文件 @
f256ab8
...
...
@@ -562,6 +562,16 @@ namespace OnlineStore.XLRStore
}
}
}
private
void
button1_Click
(
object
sender
,
EventArgs
e
)
{
boxBean
.
StartRecord
(
"manual"
,
"manual"
);
}
private
void
button2_Click
(
object
sender
,
EventArgs
e
)
{
boxBean
.
StopRecord
();
}
}
}
...
...
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论