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

删除 删除原始数据2

parent f3fbdde5
...@@ -17,7 +17,7 @@ namespace FLY.Thick.BlowingScan.Server.Model ...@@ -17,7 +17,7 @@ namespace FLY.Thick.BlowingScan.Server.Model
public class HistoryDb : IShareDbService public class HistoryDb : IShareDbService
{ {
DbModel dbModel; DbModel dbModel;
OrgDbModel orgDbModel; //OrgDbModel orgDbModel;
public LocalDb localDb; public LocalDb localDb;
public BufferError ErrorBuffer; public BufferError ErrorBuffer;
#region IShareDbService #region IShareDbService
...@@ -34,10 +34,10 @@ namespace FLY.Thick.BlowingScan.Server.Model ...@@ -34,10 +34,10 @@ namespace FLY.Thick.BlowingScan.Server.Model
/// <param name="dbModel">数据库对象</param> /// <param name="dbModel">数据库对象</param>
/// <param name="orgDbModel">原始数据.数据库对象</param> /// <param name="orgDbModel">原始数据.数据库对象</param>
/// <param name="localDb">数据库的本地版</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.dbModel = dbModel;
this.orgDbModel = orgDbModel; //this.orgDbModel = orgDbModel;
this.localDb = localDb; this.localDb = localDb;
ErrorBuffer = new BufferError(); ErrorBuffer = new BufferError();
ErrorBuffer.Init(dbModel.TbError); ErrorBuffer.Init(dbModel.TbError);
...@@ -80,31 +80,31 @@ namespace FLY.Thick.BlowingScan.Server.Model ...@@ -80,31 +80,31 @@ namespace FLY.Thick.BlowingScan.Server.Model
} }
/// <summary> ///// <summary>
/// 按时间删除数据库 ///// 按时间删除数据库
/// </summary> ///// </summary>
public void KeepOrgDbSize(int day) //public void KeepOrgDbSize(int day)
{ //{
if (day <= 2) // if (day <= 2)
day = 2; // day = 2;
DateTime del_time = DateTime.Now - TimeSpan.FromDays(day); // DateTime del_time = DateTime.Now - TimeSpan.FromDays(day);
string det_time_str = del_time.ToStringOfSQLiteFieldType(); // string det_time_str = del_time.ToStringOfSQLiteFieldType();
List<string> sqls = new List<string>(); // List<string> sqls = new List<string>();
sqls.Add( // sqls.Add(
$"DELETE FROM {orgDbModel.TbSign.TableName}" + // $"DELETE FROM {orgDbModel.TbSign.TableName}" +
$" WHERE Time < {det_time_str}"); // $" WHERE Time < {det_time_str}");
sqls.Add( // sqls.Add(
$"DELETE FROM {orgDbModel.TbRoll.TableName}" + // $"DELETE FROM {orgDbModel.TbRoll.TableName}" +
$" WHERE Time < {det_time_str}"); // $" WHERE Time < {det_time_str}");
sqls.Add( // sqls.Add(
$"DELETE FROM {orgDbModel.TbOrgScanData.TableName}" + // $"DELETE FROM {orgDbModel.TbOrgScanData.TableName}" +
$" WHERE Time < {det_time_str}"); // $" WHERE Time < {det_time_str}");
orgDbModel.sqliteHelper.QueryTran(sqls); // orgDbModel.sqliteHelper.QueryTran(sqls);
} //}
/// <summary> /// <summary>
/// 保存产品参数 /// 保存产品参数
...@@ -316,59 +316,62 @@ namespace FLY.Thick.BlowingScan.Server.Model ...@@ -316,59 +316,62 @@ namespace FLY.Thick.BlowingScan.Server.Model
#region 原始数据 #region 原始数据
/// <summary> ///// <summary>
/// 记录 原始数据.转向信号 ///// 记录 原始数据.转向信号
/// </summary> ///// </summary>
/// <param name="lc_Sign"></param> ///// <param name="lc_Sign"></param>
public void AddSignData( //public void AddSignData(
Lc_Sign lc_Sign // Lc_Sign lc_Sign
) // )
{ //{
lc_Sign.ID = orgDbModel.TbSign.FreeID; // lc_Sign.ID = orgDbModel.TbSign.FreeID;
//SQLs // //SQLs
List<string> sqls = new List<string>(); // List<string> sqls = new List<string>();
var db_Sign = FLY.Thick.Blowing.Server.Model.OrgLc_AutoMapperProfile.Mapper.Map<Db_Sign>(lc_Sign); // var db_Sign = FLY.Thick.Blowing.Server.Model.OrgLc_AutoMapperProfile.Mapper.Map<Db_Sign>(lc_Sign);
sqls.Add(SQLiteHelper.GetInsertCommandText(db_Sign)); // sqls.Add(SQLiteHelper.GetInsertCommandText(db_Sign));
orgDbModel.sqliteHelper.QueryTranAsync(sqls); // orgDbModel.sqliteHelper.QueryTranAsync(sqls);
} //}
/// <summary> ///// <summary>
/// 记录 原始数据.辊信号 ///// 记录 原始数据.辊信号
/// </summary> ///// </summary>
/// <param name="lc_Roll"></param> ///// <param name="lc_Roll"></param>
public void AddRollData( //public void AddRollData(
Lc_Roll lc_Roll // Lc_Roll lc_Roll
) // )
{ //{
lc_Roll.ID = orgDbModel.TbRoll.FreeID; // 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); #endregion
}
/// <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);
}
/// <summary> /// <summary>
/// 记录 原始数据.样品 /// 记录 原始数据.样品
...@@ -387,8 +390,6 @@ namespace FLY.Thick.BlowingScan.Server.Model ...@@ -387,8 +390,6 @@ namespace FLY.Thick.BlowingScan.Server.Model
dbModel.sqliteHelper.QueryTranAsync(sqls); dbModel.sqliteHelper.QueryTranAsync(sqls);
} }
#endregion
#region IDBShareService #region IDBShareService
public void GetProfile(AsyncCBHandler asyncDelegate, object asyncContext) 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