|
@@ -1148,7 +1148,7 @@ namespace OTSIncAReportGrids
|
|
|
Thread.Sleep(1500);
|
|
|
|
|
|
//第三步,断开电镜连接
|
|
|
- m_OTSIncAReportGridsFun.DisConnectSEM_ForParticlesGrid();
|
|
|
+ //m_OTSIncAReportGridsFun.DisConnectSEM_ForParticlesGrid();
|
|
|
|
|
|
//Thread.Sleep(500);
|
|
|
|
|
@@ -2096,7 +2096,7 @@ namespace OTSIncAReportGrids
|
|
|
{
|
|
|
if (i_ls_fieldid == item.FieldId && i_ls_particleid == item.ParticleId)
|
|
|
{
|
|
|
- if (ReportFun.DeleteParticlesFromLibrary(item.ParticleId, item.FieldId))
|
|
|
+ if (DeleteParticlesFromLibrary(item.ParticleId, item.FieldId))
|
|
|
{
|
|
|
MessageBox.Show("Deleted successfully");
|
|
|
|
|
@@ -2121,6 +2121,75 @@ namespace OTSIncAReportGrids
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ private bool DeleteParticlesFromLibrary(int in_clr_tagid, int in_clr_fieldid)
|
|
|
+ {
|
|
|
+ bool DoesItExist = false;
|
|
|
+ for (int i = 1; i < 201; i++)
|
|
|
+ {
|
|
|
+ if (System.IO.Directory.Exists(resultFile.FilePath + "\\FIELD_FILES\\Backups" + i.ToString()))
|
|
|
+ {
|
|
|
+ DoesItExist = true;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (!DoesItExist)
|
|
|
+ {
|
|
|
+ //备份数据库
|
|
|
+ BackupDatabase();
|
|
|
+ }
|
|
|
+ DoesItExist = false;
|
|
|
+
|
|
|
+ //防止为空校验判断
|
|
|
+ if (resultFile.List_OTSField == null)
|
|
|
+ return false;
|
|
|
+ Particle particle = resultFile.List_OTSField.Find(x => x.FieldID == in_clr_fieldid).ParticleList.Find(x => x.ParticleId == in_clr_tagid);
|
|
|
+ if (new ParticleData(resultFile.FilePath).DeleteFromData(Convert.ToString(particle.FieldId), Convert.ToString(particle.XrayId)))
|
|
|
+ {
|
|
|
+
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ else
|
|
|
+
|
|
|
+ {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ private bool BackupDatabase()
|
|
|
+ {
|
|
|
+ //创建备份数据库文件夹
|
|
|
+ string sourcePath = resultFile.FilePath + "\\FIELD_FILES\\Inclusion.db";//源文件路径
|
|
|
+ string sourceName = "Inclusion.db";//源文件名称
|
|
|
+ string folderPath = resultFile.FilePath + "\\FIELD_FILES\\Backups";//目标文件夹
|
|
|
+ string Fields = "";
|
|
|
+ for (int i = 1; i < 201; i++)
|
|
|
+ {
|
|
|
+ if (System.IO.Directory.Exists(folderPath + i.ToString()))
|
|
|
+ {
|
|
|
+ Fields = folderPath + i.ToString();
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ System.IO.Directory.CreateDirectory(folderPath + i.ToString());
|
|
|
+ Fields = folderPath + i.ToString();
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (Fields == "")
|
|
|
+ {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ //复制数据库文件
|
|
|
+ string targetPath = Path.Combine(Fields, sourceName);
|
|
|
+ FileInfo file = new FileInfo(sourcePath);
|
|
|
+ if (file.Exists)
|
|
|
+ {
|
|
|
+ file.CopyTo(targetPath, true);
|
|
|
+ }
|
|
|
+
|
|
|
+ return true;
|
|
|
+ }
|
|
|
private void DisplayData()
|
|
|
{
|
|
|
if (cbB_PageSize.SelectedItem.ToString() == "All")
|