Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
H
hemei
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
潘栩锋
hemei
Commits
b749b0e7
Commit
b749b0e7
authored
Nov 14, 2019
by
潘栩锋
🚴
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复 追边测厚仪 数据重复3次问题
parent
21640179
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
157 additions
and
86 deletions
+157
-86
FeedbackHeat.cs
...dbackRenZiJia/FLY.FeedbackRenZiJia/Server/FeedbackHeat.cs
+41
-32
Lc_AutoMapperProfile.cs
...FLY.FeedbackRenZiJia/Server/Model/Lc_AutoMapperProfile.cs
+1
-1
GM_BlowingFix.cs
...Y.Thick.Blowing/FLY.Thick.Blowing/Server/GM_BlowingFix.cs
+114
-52
Lc_AutoMapperProfile.cs
...ng/FLY.Thick.Blowing/Server/Model/Lc_AutoMapperProfile.cs
+1
-1
No files found.
Project.FLY.FeedbackRenZiJia/FLY.FeedbackRenZiJia/Server/FeedbackHeat.cs
View file @
b749b0e7
...
...
@@ -217,6 +217,16 @@ namespace FLY.FeedbackRenZiJia.Server
mHeatChanged
.
Add
(
mHeatCell
.
Heats
);
UndoIdx
=
mHeatChanged
.
mItem
.
Count
()
-
1
;
//记录到数据库
if
(
lastLcThickHeat
!=
null
)
{
HeatChanged
.
ITEM
heat
=
mHeatChanged
.
mItem
.
Last
();
lastLcThickHeat
.
HTime
=
heat
.
Time
;
lastLcThickHeat
.
Heats
=
heat
.
Heats
;
setLcThickHeatIsStable
(
lastLcThickHeat
);
mHistoryDb
.
AddThickHeat
(
lastLcThickHeat
);
}
};
mHeatCell
.
AfterClearOffsetsEvent
+=
(
c
)
=>
{
...
...
@@ -693,6 +703,20 @@ namespace FLY.FeedbackRenZiJia.Server
}
void
setLcThickHeatIsStable
(
Lc_ThickHeat
lcThickHeat
)
{
DateTime
time
=
lcThickHeat
.
Time
;
DateTime
htime
=
lcThickHeat
.
HTime
;
double
filmLength
=
lcThickHeat
.
FilmLength
;
double
filmVelocity
=
lcThickHeat
.
FilmVelocity
;
lcThickHeat
.
IsStable
=
time
>
(
htime
+
TimeSpan
.
FromSeconds
(
Delay
)
+
TimeSpan
.
FromMinutes
(
filmLength
/
filmVelocity
));
}
/// <summary>
/// 最后一次保存的记录
/// </summary>
Lc_ThickHeat
lastLcThickHeat
=
null
;
void
Add
(
DateTime
time
,
DateTime
endtime
,
bool
isBackw
,
TimeSpan
period
,
int
rotateCnt
,
int
orgboltno
,
double
rAngle
,
double
filmLength
,
double
filmVelocity
,
double
K
,
double
[]
frame
,
List
<
Thick
.
Blowing
.
IService
.
BoltMapCell
>
boltMaps
)
...
...
@@ -712,15 +736,9 @@ namespace FLY.FeedbackRenZiJia.Server
if
(
invalid_cnt
>
NBolts
/
2
)
//有一半数据都是无效的
return
;
bool
need_cal
=
true
;
//获取对应方向的加热幅
HeatChanged
.
ITEM
heat
=
mHeatChanged
.
Get
(
time
+
period
-
mHeatBuf
.
Delay
);
if
(
heat
!=
mHeatChanged
.
mItem
.
Last
())
{
//后面还加了热, 不用自控
need_cal
=
false
;
}
mHistoryDb
.
AddThickHeat
(
new
Lc_ThickHeat
()
HeatChanged
.
ITEM
heat
=
mHeatChanged
.
mItem
.
Last
();
var
lcThickHeat
=
new
Lc_ThickHeat
()
{
Time
=
time
,
EndTime
=
endtime
,
...
...
@@ -729,16 +747,18 @@ namespace FLY.FeedbackRenZiJia.Server
RCnt
=
rotateCnt
,
OrgBoltNo
=
orgboltno
,
RAngle
=
rAngle
,
FilmLength
=
filmLength
,
FilmLength
=
filmLength
,
FilmVelocity
=
filmVelocity
,
K
=
K
,
Thicks
=
frame
,
K
=
K
,
Thicks
=
frame
,
Boltmap
=
boltMaps
,
IsStable
=
time
>(
heat
.
Time
+
TimeSpan
.
FromSeconds
(
Delay
)+
TimeSpan
.
FromMinutes
(
filmLength
/
filmVelocity
)),
HTime
=
heat
.
Time
,
Heats
=
heat
.
Heats
});
Heats
=
heat
.
Heats
};
setLcThickHeatIsStable
(
lcThickHeat
);
mHistoryDb
.
AddThickHeat
(
lcThickHeat
);
lastLcThickHeat
=
lcThickHeat
;
mHeatBuf
.
IsIntoAutoONo
=
mHeatCell
.
IsInAutoONo
;
...
...
@@ -774,7 +794,7 @@ namespace FLY.FeedbackRenZiJia.Server
mHeatCell
.
SetThickPercents
(
d
.
Thicks
);
if
(
IsAuto
&&
need_cal
)
//如果自控中!!!
if
(
IsAuto
&&
lcThickHeat
.
IsStable
)
//如果自控中!!!
{
mHeatCell
.
Auto
();
}
...
...
@@ -800,23 +820,12 @@ namespace FLY.FeedbackRenZiJia.Server
}
#
region
撤销
private
int
undoidx
=
0
;
/// <summary>
/// undo 的序号
/// </summary>
public
int
UndoIdx
{
get
{
return
undoidx
;
}
protected
set
{
if
(
undoidx
!=
value
)
{
undoidx
=
value
;
NotifyPropertyChanged
(
"UndoIdx"
);
}
}
}
public
int
UndoIdx
{
get
;
protected
set
;
}
//读取 UndoIdx 的 加热
public
void
Undo
()
{
...
...
Project.FLY.FeedbackRenZiJia/FLY.FeedbackRenZiJia/Server/Model/Lc_AutoMapperProfile.cs
View file @
b749b0e7
...
...
@@ -36,7 +36,7 @@ namespace FLY.FeedbackRenZiJia.Server.Model
CreateMap
<
Lc_ThickHeat
,
Db_ThickHeat
>()
.
ForMember
(
s
=>
s
.
RPeriod
,
opt
=>
{
opt
.
MapFrom
(
s
=>
s
.
RPeriod
.
TotalMinutes
);
opt
.
MapFrom
(
s
=>
Math
.
Round
(
s
.
RPeriod
.
TotalMinutes
,
2
)
);
})
.
ForMember
(
s
=>
s
.
Thicks
,
opt
=>
{
...
...
Project.FLY.Thick.Blowing/FLY.Thick.Blowing/Server/GM_BlowingFix.cs
View file @
b749b0e7
...
...
@@ -27,6 +27,8 @@ namespace FLY.Thick.Blowing.Server
/// </summary>
public
class
GM_BlowingFix
:
GM_Base
,
IBlowingFixService
,
ISaveToXml
{
NLog
.
Logger
logger
=
NLog
.
LogManager
.
GetCurrentClassLogger
();
const
int
MARKNO_PROFILE_ADD
=
87
;
const
int
MARKNO_PROFILE_CHANGED
=
88
;
...
...
@@ -1182,7 +1184,7 @@ namespace FLY.Thick.Blowing.Server
/// <param name="frameinfo"></param>
/// <param name="index_start"></param>
/// <param name="index_end"></param>
/// <returns></returns>
/// <returns>
false 数据不存在
</returns>
bool
GetFilmInfoADIndex
(
FRAME_INFO
frameinfo
,
out
int
index_start
,
out
int
index_end
)
{
index_start
=
mADList
.
No2Index
(
frameinfo
.
NoStartAD
);
...
...
@@ -1198,24 +1200,29 @@ namespace FLY.Thick.Blowing.Server
return
true
;
}
void
mPDetect_FilmInfoChangedEvent
(
object
sender
,
BlowingDetect
.
FilmInfoChangedEventArgs
e
)
{
int
idx
;
int
ret
=
ADListFastSearchIndex
(
e
.
Time
,
out
idx
);
if
(
ret
<
0
)
//发送在过去
var
ret
=
ADListFastSearchIndex
(
e
.
Time
,
out
int
idx
);
switch
(
ret
)
{
if
(
mADList
.
Count
>
0
)
case
ADListFastSearchIndexResult
.
Before
:
//发送在过去
{
mADListToDoNo
=
mADList
.
Index2No
(
0
);
mADListToDoNo_ToFilmInfo
=
mADListToDoNo
;
}
}
else
if
(
ret
==
0
)
break
;
case
ADListFastSearchIndexResult
.
Now
:
//发生在列表时间内
{
mADListToDoNo
=
mADList
.
Index2No
(
idx
);
mADListToDoNo_ToFilmInfo
=
mADListToDoNo
;
}
break
;
case
ADListFastSearchIndexResult
.
Future
:
{
//未来的,不处理
}
break
;
}
}
...
...
@@ -1312,6 +1319,8 @@ namespace FLY.Thick.Blowing.Server
MarkDebugInit
();
}
#
region
记录测试数据
DateTime
markdebug_dt
=
DateTime
.
MinValue
;
void
MarkDebugInit
()
{
...
...
@@ -1371,6 +1380,7 @@ namespace FLY.Thick.Blowing.Server
},
TimeSpan
.
FromMinutes
(
1
));
}
#
endregion
void
UpdateCurrFrame
()
{
...
...
@@ -1507,58 +1517,103 @@ namespace FLY.Thick.Blowing.Server
return
boltindex
;
}
enum
ADListFastSearchIndexResult
{
/// <summary>
/// 时间点在列表以前;
/// </summary>
Before
=
-
1
,
/// <summary>
/// 时间点在列表中;
/// </summary>
Now
=
0
,
/// <summary>
/// 返回 -1, 时间点在列表以前;
/// 返回 0, 时间点在列表中;
/// 返回 1, 时间点在列表的未来;
/// 时间点在列表的未来;
/// </summary>
Future
=
1
}
/// <summary>
/// 找到在 dt 前最近的 ADList 序号;
/// 当ADList 没有数据,返回 Future;
/// 已知AD列表每个数据之间的时间差,快速推断结果;
/// </summary>
/// <param name="dt"></param>
/// <param name="index"></param>
/// <returns></returns>
in
t
ADListFastSearchIndex
(
DateTime
dt
,
out
int
index
)
ADListFastSearchIndexResul
t
ADListFastSearchIndex
(
DateTime
dt
,
out
int
index
)
{
index
=
0
;
if
(
mADList
.
Count
<=
0
)
return
1
;
if
(
mADList
.
Count
<=
0
)
//列表没有数据, 只能当它在未来
return
ADListFastSearchIndexResult
.
Future
;
int
offset
=
(
int
)((
mADList
.
Last
().
Time
-
dt
).
TotalSeconds
*
10
);
index
=
mADList
.
Count
-
offset
-
1
;
if
(
index
>=
mADList
.
Count
)
return
1
;
else
if
(
index
<
0
)
return
-
1
;
if
(
dt
>
mADList
.
Last
().
Time
)
return
ADListFastSearchIndexResult
.
Future
;
else
if
(
dt
<
mADList
.
First
().
Time
)
return
ADListFastSearchIndexResult
.
Before
;
else
{
if
(
mADList
[
index
].
Time
==
dt
)
int
offset
=
(
int
)((
mADList
.
Last
().
Time
-
dt
).
TotalSeconds
/
datOf1s_interval
.
TotalSeconds
);
index
=
mADList
.
Count
-
offset
-
1
;
//大约在这个位置附近
//安全限制
if
(
index
>=
mADList
.
Count
)
index
=
mADList
.
Count
()
-
1
;
else
if
(
index
<
0
)
index
=
0
;
if
(
mADList
[
index
].
Time
==
dt
)
{
return
0
;
//已经找到就是它!!!!
}
else
if
(
mADList
[
index
].
Time
>
dt
)
else
if
(
mADList
[
index
].
Time
>
dt
)
{
while
(
true
)
{
do
{
index
--;
if
(
index
<
0
)
return
-
1
;
if
(
index
<=
0
)
{
index
=
0
;
//最前面一个了
break
;
}
if
(
mADList
[
index
].
Time
<=
dt
)
{
//找到了
break
;
}
}
while
(
mADList
[
index
].
Time
>
dt
);
return
0
;
}
else
{
do
{
index
++;
if
(
index
>=
mADList
.
Count
)
return
1
;
while
(
true
)
{
index
++;
//测试一下
if
(
index
>=
mADList
.
Count
)
{
//到顶了,不找了
index
--;
break
;
}
while
(
mADList
[
index
].
Time
<
dt
);
return
index
;
else
if
(
mADList
[
index
].
Time
==
dt
)
{
//找到了,就是它
break
;
}
else
if
(
mADList
[
index
].
Time
>
dt
)
{
//上一个小于,现在大于,上一个就对了
index
--;
break
;
}
}
}
return
ADListFastSearchIndexResult
.
Now
;
}
}
...
...
@@ -1742,8 +1797,10 @@ namespace FLY.Thick.Blowing.Server
int
adlist_index
=
mADList
.
No2Index
(
mADListToDoNo_ToFilmInfo
);
//当前在处理的 数据点
if
(
adlist_index
>=
mADList
.
Count
)
return
;
//没有数据需要处理
if
(
adlist_index
<
0
)
//全部都要处理
adlist_index
=
0
;
//当没有任何一幅数据时, frameinfo_index = mFrameInfoList.Count = 0
int
frameinfo_index
=
Math
.
Max
(
mFrameInfoList
.
Count
-
1
,
0
);
...
...
@@ -1798,8 +1855,12 @@ namespace FLY.Thick.Blowing.Server
else
{
frameinfo
=
mFrameInfoList
[
frameinfo_index
];
if
(
i
<=
mADList
.
No2Index
(
frameinfo
.
NoEndAD
))
//清空数据,重新来过, ????????????
if
(
i
<=
mADList
.
No2Index
(
frameinfo
.
NoEndAD
))
{
//当为新数据, i应该>mADList.No2Index(frameinfo.NoEndAD)
//能进这里,证明是要重新计算
//清空数据,重新来过
frameinfo
.
StartTime
=
adcell
.
Time
;
frameinfo
.
EndTime
=
adcell
.
Time
;
frameinfo
.
direction
=
adcell
.
Direction
;
...
...
@@ -1863,10 +1924,10 @@ namespace FLY.Thick.Blowing.Server
RPeriod
=
mPDetect
.
RenZiJiaPeriod
,
RCnt
=
frameinfo
.
rotationCnt
,
OrgBoltNo
=
OrgBoltNo
,
RAngle
=
mPDetect
.
RAngle
,
FilmLength
=
mPDetect
.
FilmLength
,
FilmVelocity
=
mPDetect
.
FilmVelocity
,
K
=
mProfileParam
.
K
,
RAngle
=
Math
.
Round
(
mPDetect
.
RAngle
,
2
)
,
FilmLength
=
Math
.
Round
(
mPDetect
.
FilmLength
,
2
)
,
FilmVelocity
=
Math
.
Round
(
mPDetect
.
FilmVelocity
,
2
)
,
K
=
Math
.
Round
(
mProfileParam
.
K
,
3
)
,
Thicks
=
realthicks
,
Boltmap
=
map
};
...
...
@@ -2000,7 +2061,8 @@ namespace FLY.Thick.Blowing.Server
}
}
//检测数据更新情况,放入数据库
//检测数据更新情况,放入数据库, 数据不能被修改
foreach
(
var
frameinfo
in
mFrameInfoList
)
{
if
(
frameinfo
.
renZiJiaDataEventArgsHasChanged
)
...
...
Project.FLY.Thick.Blowing/FLY.Thick.Blowing/Server/Model/Lc_AutoMapperProfile.cs
View file @
b749b0e7
...
...
@@ -39,7 +39,7 @@ namespace FLY.Thick.Blowing.Server.Model
CreateMap
<
Lc_ScanData
,
Db_ScanData
>()
.
ForMember
(
s
=>
s
.
RPeriod
,
opt
=>
{
opt
.
MapFrom
(
s
=>
s
.
RPeriod
.
TotalMinutes
);
opt
.
MapFrom
(
s
=>
Math
.
Round
(
s
.
RPeriod
.
TotalMinutes
,
2
)
);
})
.
ForMember
(
s
=>
s
.
Thicks
,
opt
=>
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment