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
17cf2ab1
Commit
17cf2ab1
authored
Nov 04, 2020
by
潘栩锋
🚴
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
删除 删除原始数据2
parent
f3fbdde5
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
78 additions
and
77 deletions
+78
-77
HistoryDb.cs
...owingScan/FLY.Thick.BlowingScan/Server/Model/HistoryDb.cs
+78
-77
No files found.
Project.FLY.Thick.BlowingScan/FLY.Thick.BlowingScan/Server/Model/HistoryDb.cs
View file @
17cf2ab1
...
...
@@ -17,7 +17,7 @@ namespace FLY.Thick.BlowingScan.Server.Model
public
class
HistoryDb
:
IShareDbService
{
DbModel
dbModel
;
OrgDbModel
orgDbModel
;
//
OrgDbModel orgDbModel;
public
LocalDb
localDb
;
public
BufferError
ErrorBuffer
;
#
region
IShareDbService
...
...
@@ -34,10 +34,10 @@ namespace FLY.Thick.BlowingScan.Server.Model
/// <param name="dbModel">数据库对象</param>
/// <param name="orgDbModel">原始数据.数据库对象</param>
/// <param name="localDb">数据库的本地版</param>
public
void
Init
(
DbModel
dbModel
,
OrgDbModel
orgDbModel
,
LocalDb
localDb
)
public
void
Init
(
DbModel
dbModel
,
LocalDb
localDb
)
{
this
.
dbModel
=
dbModel
;
this
.
orgDbModel
=
orgDbModel
;
//
this.orgDbModel = orgDbModel;
this
.
localDb
=
localDb
;
ErrorBuffer
=
new
BufferError
();
ErrorBuffer
.
Init
(
dbModel
.
TbError
);
...
...
@@ -80,31 +80,31 @@ namespace FLY.Thick.BlowingScan.Server.Model
}
/// <summary>
/// 按时间删除数据库
/// </summary>
public
void
KeepOrgDbSize
(
int
day
)
{
if
(
day
<=
2
)
day
=
2
;
///
//
<summary>
///
//
按时间删除数据库
///
//
</summary>
//
public void KeepOrgDbSize(int day)
//
{
//
if (day <= 2)
//
day = 2;
DateTime
del_time
=
DateTime
.
Now
-
TimeSpan
.
FromDays
(
day
);
string
det_time_str
=
del_time
.
ToStringOfSQLiteFieldType
();
List
<
string
>
sqls
=
new
List
<
string
>();
sqls
.
Add
(
$"DELETE FROM
{
orgDbModel
.
TbSign
.
TableName
}
"
+
$" WHERE Time <
{
det_time_str
}
"
);
//
DateTime del_time = DateTime.Now - TimeSpan.FromDays(day);
//
string det_time_str = del_time.ToStringOfSQLiteFieldType();
//
List<string> sqls = new List<string>();
//
sqls.Add(
//
$"DELETE FROM {orgDbModel.TbSign.TableName}" +
//
$" WHERE Time < {det_time_str}");
sqls
.
Add
(
$"DELETE FROM
{
orgDbModel
.
TbRoll
.
TableName
}
"
+
$" WHERE Time <
{
det_time_str
}
"
);
//
sqls.Add(
//
$"DELETE FROM {orgDbModel.TbRoll.TableName}" +
//
$" WHERE Time < {det_time_str}");
sqls
.
Add
(
$"DELETE FROM
{
orgDbModel
.
TbOrgScanData
.
TableName
}
"
+
$" WHERE Time <
{
det_time_str
}
"
);
//
sqls.Add(
//
$"DELETE FROM {orgDbModel.TbOrgScanData.TableName}" +
//
$" WHERE Time < {det_time_str}");
orgDbModel
.
sqliteHelper
.
QueryTran
(
sqls
);
}
//
orgDbModel.sqliteHelper.QueryTran(sqls);
//
}
/// <summary>
/// 保存产品参数
...
...
@@ -316,59 +316,62 @@ namespace FLY.Thick.BlowingScan.Server.Model
#
region
原始数据
/// <summary>
/// 记录 原始数据.转向信号
/// </summary>
/// <param name="lc_Sign"></param>
public
void
AddSignData
(
Lc_Sign
lc_Sign
)
{
lc_Sign
.
ID
=
orgDbModel
.
TbSign
.
FreeID
;
//SQLs
List
<
string
>
sqls
=
new
List
<
string
>();
var
db_Sign
=
FLY
.
Thick
.
Blowing
.
Server
.
Model
.
OrgLc_AutoMapperProfile
.
Mapper
.
Map
<
Db_Sign
>(
lc_Sign
);
sqls
.
Add
(
SQLiteHelper
.
GetInsertCommandText
(
db_Sign
));
orgDbModel
.
sqliteHelper
.
QueryTranAsync
(
sqls
);
}
/// <summary>
/// 记录 原始数据.辊信号
/// </summary>
/// <param name="lc_Roll"></param>
public
void
AddRollData
(
Lc_Roll
lc_Roll
)
{
lc_Roll
.
ID
=
orgDbModel
.
TbRoll
.
FreeID
;
///// <summary>
///// 记录 原始数据.转向信号
///// </summary>
///// <param name="lc_Sign"></param>
//public void AddSignData(
// Lc_Sign lc_Sign
// )
//{
// lc_Sign.ID = orgDbModel.TbSign.FreeID;
// //SQLs
// List<string> sqls = new List<string>();
// var db_Sign = FLY.Thick.Blowing.Server.Model.OrgLc_AutoMapperProfile.Mapper.Map<Db_Sign>(lc_Sign);
// sqls.Add(SQLiteHelper.GetInsertCommandText(db_Sign));
// orgDbModel.sqliteHelper.QueryTranAsync(sqls);
//}
///// <summary>
///// 记录 原始数据.辊信号
///// </summary>
///// <param name="lc_Roll"></param>
//public void AddRollData(
// Lc_Roll lc_Roll
// )
//{
// lc_Roll.ID = orgDbModel.TbRoll.FreeID;
// //SQLs
// List<string> sqls = new List<string>();
// var db_Roll = FLY.Thick.Blowing.Server.Model.OrgLc_AutoMapperProfile.Mapper.Map<Db_Roll>(lc_Roll);
// sqls.Add(SQLiteHelper.GetInsertCommandText(db_Roll));
// orgDbModel.sqliteHelper.QueryTranAsync(sqls);
//}
///// <summary>
///// 记录 原始数据.扫描数据
///// </summary>
///// <param name="lc_OrgScanDatas"></param>
//public void AddOrgScanDatas(
// List<Lc_OrgScanData> lc_OrgScanDatas
// )
//{
// //SQLs
// List<string> sqls = new List<string>();
// foreach (var lc_OrgScanData in lc_OrgScanDatas)
// {
// lc_OrgScanData.ID = orgDbModel.TbOrgScanData.FreeID;
// var db_OrgScanData = OrgLc_AutoMapperProfile.Mapper.Map<Db_OrgScanData>(lc_OrgScanData);
// sqls.Add(SQLiteHelper.GetInsertCommandText(db_OrgScanData));
// }
// orgDbModel.sqliteHelper.QueryTranAsync(sqls);
//}
//SQLs
List
<
string
>
sqls
=
new
List
<
string
>();
var
db_Roll
=
FLY
.
Thick
.
Blowing
.
Server
.
Model
.
OrgLc_AutoMapperProfile
.
Mapper
.
Map
<
Db_Roll
>(
lc_Roll
);
sqls
.
Add
(
SQLiteHelper
.
GetInsertCommandText
(
db_Roll
));
orgDbModel
.
sqliteHelper
.
QueryTranAsync
(
sqls
);
}
/// <summary>
/// 记录 原始数据.扫描数据
/// </summary>
/// <param name="lc_OrgScanDatas"></param>
public
void
AddOrgScanDatas
(
List
<
Lc_OrgScanData
>
lc_OrgScanDatas
)
{
//SQLs
List
<
string
>
sqls
=
new
List
<
string
>();
foreach
(
var
lc_OrgScanData
in
lc_OrgScanDatas
)
{
lc_OrgScanData
.
ID
=
orgDbModel
.
TbOrgScanData
.
FreeID
;
var
db_OrgScanData
=
OrgLc_AutoMapperProfile
.
Mapper
.
Map
<
Db_OrgScanData
>(
lc_OrgScanData
);
sqls
.
Add
(
SQLiteHelper
.
GetInsertCommandText
(
db_OrgScanData
));
}
orgDbModel
.
sqliteHelper
.
QueryTranAsync
(
sqls
);
}
#
endregion
/// <summary>
/// 记录 原始数据.样品
...
...
@@ -387,8 +390,6 @@ namespace FLY.Thick.BlowingScan.Server.Model
dbModel
.
sqliteHelper
.
QueryTranAsync
(
sqls
);
}
#
endregion
#
region
IDBShareService
public
void
GetProfile
(
AsyncCBHandler
asyncDelegate
,
object
asyncContext
)
{
...
...
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