Commit 17cf2ab1 authored by 潘栩锋's avatar 潘栩锋 🚴

删除 删除原始数据2

parent f3fbdde5
......@@ -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)
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment