Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
张东亮
/
SO1131-XLRStore
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit b6dbd966
由
张东亮
编写于
2023-02-14 11:03:02 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
优化图片删除和报警灯
1 个父辈
e8dc6ad0
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
72 行增加
和
40 行删除
source/DeviceLibrary/deviceLibrary/halcon/CodeManager.cs
source/DeviceLibrary/storeBean/EquipBase.cs
source/XLRStoreClient/Program.cs
source/DeviceLibrary/deviceLibrary/halcon/CodeManager.cs
查看文件 @
b6dbd96
...
@@ -456,51 +456,41 @@ namespace OnlineStore.DeviceLibrary
...
@@ -456,51 +456,41 @@ namespace OnlineStore.DeviceLibrary
}
}
return
dire
+
iamgeName
;
return
dire
+
iamgeName
;
}
}
static
Task
deleteTask
=
null
;
static
void
deleteFiles
(
string
dire
)
static
void
deleteFiles
(
string
dire
)
{
{
if
((
deleteTask
==
null
)||
(
deleteTask
!=
null
&&
deleteTask
.
IsCompleted
))
try
{
{
deleteTask
=
Task
.
Factory
.
StartNew
(()
=>
string
[]
imgFiles
=
Directory
.
GetFiles
(
dire
);
if
(
imgFiles
.
Length
<=
CntImgs
)
{
{
try
return
;
}
FileInfo
fileInfo
;
List
<
FileInfo
>
files
=
new
List
<
FileInfo
>();
foreach
(
var
item
in
imgFiles
)
{
fileInfo
=
new
FileInfo
(
item
);
files
.
Add
(
fileInfo
);
}
do
{
FileInfo
oldFile
=
files
[
0
];
foreach
(
var
item
in
files
)
{
{
string
[]
imgFiles
=
Directory
.
GetFiles
(
dire
);
if
((
item
.
CreationTime
-
oldFile
.
CreationTime
).
TotalSeconds
<
0
)
if
(
imgFiles
.
Length
>
CntImgs
)
{
{
FileInfo
fileInfo
;
oldFile
=
item
;
List
<
FileInfo
>
files
=
new
List
<
FileInfo
>();
foreach
(
var
item
in
imgFiles
)
{
fileInfo
=
new
FileInfo
(
item
);
files
.
Add
(
fileInfo
);
}
do
{
FileInfo
oldFile
=
files
[
0
];
foreach
(
var
item
in
files
)
{
if
((
item
.
CreationTime
-
oldFile
.
CreationTime
).
Seconds
<
0
)
{
oldFile
=
item
;
}
}
oldFile
?.
Delete
();
}
while
(
files
.
Count
>
CntImgs
)
;
}
}
}
catch
(
Exception
ex
)
{
LogUtil
.
error
(
"删除文件失败"
,
ex
);
}
}
oldFile
?.
Delete
();
files
.
Remove
(
oldFile
);
}
while
(
files
.
Count
>
CntImgs
);
});
}
}
else
catch
(
Exception
ex
)
{
{
LogUtil
.
info
(
"延迟删除文件夹内的文件:"
+
dire
);
LogUtil
.
error
(
"删除文件失败"
,
ex
);
}
}
}
}
public
static
void
DelImg
(
string
deviceName
,
string
imgPath
)
public
static
void
DelImg
(
string
deviceName
,
string
imgPath
)
...
...
source/DeviceLibrary/storeBean/EquipBase.cs
查看文件 @
b6dbd96
...
@@ -769,16 +769,16 @@ namespace OnlineStore.DeviceLibrary
...
@@ -769,16 +769,16 @@ namespace OnlineStore.DeviceLibrary
}
}
protected
void
ClearSpecifiedAlarm
(
string
msg
)
protected
void
ClearSpecifiedAlarm
(
string
msg
)
{
{
if
(
WarnMsg
.
Contains
(
msg
))
{
SetWarnMsg
(
""
);
}
if
(
WarnMsg
.
Contains
(
msg
)
&&
alarmType
.
Equals
(
AlarmType
.
AlarmMsg
))
if
(
WarnMsg
.
Contains
(
msg
)
&&
alarmType
.
Equals
(
AlarmType
.
AlarmMsg
))
{
{
LogUtil
.
info
(
Name
+
"清理异常消息报警【"
+
WarnMsg
+
"】 "
);
LogUtil
.
info
(
Name
+
"清理异常消息报警【"
+
WarnMsg
+
"】 "
);
alarmType
=
AlarmType
.
None
;
alarmType
=
AlarmType
.
None
;
SetWarnMsg
(
""
);
SetWarnMsg
(
""
);
}
}
if
(
WarnMsg
.
Contains
(
msg
))
{
SetWarnMsg
(
""
);
}
}
}
protected
void
ClearTimeoutAlarm
(
string
msg
)
protected
void
ClearTimeoutAlarm
(
string
msg
)
{
{
...
...
source/XLRStoreClient/Program.cs
查看文件 @
b6dbd96
...
@@ -101,15 +101,57 @@ namespace OnlineStore.XLRStore
...
@@ -101,15 +101,57 @@ namespace OnlineStore.XLRStore
{
{
System
.
Net
.
ServicePointManager
.
DefaultConnectionLimit
=
512
;
System
.
Net
.
ServicePointManager
.
DefaultConnectionLimit
=
512
;
XmlConfigurator
.
Configure
();
XmlConfigurator
.
Configure
();
// deleteFiles(Application.StartupPath + @"\test\");
//deleteFiles(Application.StartupPath + @"\test1\");
Application
.
EnableVisualStyles
();
Application
.
EnableVisualStyles
();
Application
.
SetCompatibleTextRenderingDefault
(
false
);
Application
.
SetCompatibleTextRenderingDefault
(
false
);
ManagerUtil
.
Init
();
ManagerUtil
.
Init
();
Application
.
Run
(
new
FrmXLRStore
());
Application
.
Run
(
new
FrmXLRStore
());
}
}
}
}
static
void
deleteFiles
(
string
dire
)
{
int
CntImgs
=
2
;
try
{
string
[]
imgFiles
=
Directory
.
GetFiles
(
dire
);
if
(
imgFiles
.
Length
<=
CntImgs
)
{
return
;
}
FileInfo
fileInfo
;
List
<
FileInfo
>
files
=
new
List
<
FileInfo
>();
foreach
(
var
item
in
imgFiles
)
{
fileInfo
=
new
FileInfo
(
item
);
files
.
Add
(
fileInfo
);
}
do
{
FileInfo
oldFile
=
files
[
0
];
foreach
(
var
item
in
files
)
{
if
((
item
.
CreationTime
-
oldFile
.
CreationTime
).
TotalSeconds
<
0
)
{
oldFile
=
item
;
}
}
oldFile
?.
Delete
();
files
.
Remove
(
oldFile
);
}
while
(
files
.
Count
>
CntImgs
);
}
catch
(
Exception
ex
)
{
LogUtil
.
error
(
"删除文件失败"
,
ex
);
}
}
private
static
void
CurrentDomain_FirstChanceException
(
object
sender
,
System
.
Runtime
.
ExceptionServices
.
FirstChanceExceptionEventArgs
e
)
private
static
void
CurrentDomain_FirstChanceException
(
object
sender
,
System
.
Runtime
.
ExceptionServices
.
FirstChanceExceptionEventArgs
e
)
{
{
// LogUnhandledException("CurrentDomain_FirstChanceException", e.Exception.StackTrace);
// LogUnhandledException("CurrentDomain_FirstChanceException", e.Exception.StackTrace);
}
}
static
void
CurrentDomain_UnhandledException
(
object
sender
,
UnhandledExceptionEventArgs
e
)
static
void
CurrentDomain_UnhandledException
(
object
sender
,
UnhandledExceptionEventArgs
e
)
...
@@ -126,7 +168,7 @@ namespace OnlineStore.XLRStore
...
@@ -126,7 +168,7 @@ namespace OnlineStore.XLRStore
{
{
//这里可以进一步地写日志
//这里可以进一步地写日志
LogUtil
.
error
(
"【"
+
type
+
"】"
+
exceptionobj
);
LogUtil
.
error
(
"【"
+
type
+
"】"
+
exceptionobj
);
MiniDump
.
Write
(
Application
.
StartupPath
+
"\\ErrorDump\\"
+
DateTime
.
Now
.
ToString
(
"yyyyMMddHHmmss"
)
+
"-XLR-error.dmp"
);
MiniDump
.
Write
(
Application
.
StartupPath
+
"\\ErrorDump\\"
+
DateTime
.
Now
.
ToString
(
"yyyyMMddHHmmss"
)
+
"-XLR-error.dmp"
);
MessageBox
.
Show
(
exceptionobj
,
type
);
MessageBox
.
Show
(
exceptionobj
,
type
);
}
}
...
...
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论