Example #1
0
 public void Execute(TestRecord testRecord, string batteryTypeStr, string projectName, Battery battery, Chamber chamber, string testerStr, Channel channel, double current, double temperature, DateTime startTime, double measurementGain, double measurementOffset, double traceResistance, double capacityDifference, string @operator, string programName, string recipeName)
 {
     testRecord.BatteryTypeStr = batteryTypeStr;
     testRecord.ProjectStr     = projectName;
     testRecord.BatteryStr     = battery.Name;
     testRecord.LastCycle      = battery.CycleCount;
     if (chamber != null)
     {
         testRecord.ChamberStr = chamber.Name;
     }
     testRecord.TesterStr          = testerStr;
     testRecord.ChannelStr         = channel.Name;
     testRecord.Current            = current;
     testRecord.Temperature        = temperature;
     testRecord.StartTime          = startTime;
     testRecord.MeasurementGain    = measurementGain;
     testRecord.MeasurementOffset  = measurementOffset;
     testRecord.TraceResistance    = traceResistance;
     testRecord.CapacityDifference = capacityDifference;
     testRecord.Operator           = @operator;
     testRecord.ProgramStr         = programName;
     testRecord.RecipeStr          = recipeName;
     testRecord.AssignedBattery    = battery;
     testRecord.AssignedChamber    = chamber;
     testRecord.AssignedChannel    = channel;
     testRecord.Status             = TestStatus.Executing;
     DatabaseUpdate(testRecord);
 }
Example #2
0
        internal void UpdateFreeTestRecord(TestRecord testRecord, bool isRename, string newName, string batteryType, string projectName, string programName, string recipeName)
        {
            testRecord.ProjectStr = projectName;
            testRecord.ProgramStr = programName;
            testRecord.RecipeStr  = recipeName;
            string root             = $@"{GlobalSettings.RootPath}{batteryType}\{projectName}";
            string temproot         = $@"{GlobalSettings.LocalFolder}{batteryType}\{projectName}";
            string temptestfilepath = string.Empty;

            if (isRename)
            {
                var oldPath = Path.Combine($@"{GlobalSettings.LocalFolder}{GlobalSettings.TempDataFolderName}", Path.GetFileName(testRecord.TestFilePath));
                temptestfilepath        = RenameRawDataAndCopyToFolder(oldPath, $@"{temproot}\{GlobalSettings.TestDataFolderName}", Path.GetFileNameWithoutExtension(newName));
                testRecord.TestFilePath = $@"{root}\{GlobalSettings.TestDataFolderName}\{Path.GetFileName(temptestfilepath)}";
                CopyToServerWithRetry(temptestfilepath, testRecord.TestFilePath);
            }
            else
            {
                temptestfilepath        = CopyToFolder(testRecord.TestFilePath, temproot);
                testRecord.TestFilePath = $@"{root}\{GlobalSettings.TestDataFolderName}\{Path.GetFileName(temptestfilepath)}";
                CopyToServerWithRetry(temptestfilepath, testRecord.TestFilePath);
            }
            if (testRecord.TestFilePath == "")
            {
                MessageBox.Show("Test File Path Empty!");
                return;
            }
            SuperUpdate(testRecord);
        }
        internal void AddTestRecord(Recipe recipe)
        {
            var newTestRecord = new TestRecord();

            recipe.TestRecords.Add(newTestRecord);
            SuperUpdate(recipe);
            TestRecordService.DomainAdd(newTestRecord);
        }
Example #4
0
 public void DatabaseUpdate(TestRecord item)
 {
     using (var uow = new UnitOfWork(new AppDbContext()))
     {
         uow.TestRecords.Update(item);
         uow.Commit();
     }
 }
        internal void Invalidate(Recipe recipe, TestRecord testRecord, string comment)
        {
            TestRecordService.Invalidate(testRecord, comment);

            //var newTestRecord = new TestRecord();
            //recipe.TestRecords.Add(newTestRecord);
            //SuperUpdate(recipe);
            //TestRecordService.DomainAdd(newTestRecord);   //Issue 2322
        }
Example #6
0
 internal void Abandon(TestRecord testRecord)
 {
     testRecord.Status = TestStatus.Abandoned;
     if (testRecord.TestFilePath != string.Empty)
     {
         File.Move(testRecord.TestFilePath, testRecord.TestFilePath + "_ABANDONED");
         testRecord.TestFilePath += "_ABANDONED";
     }
     DatabaseUpdate(testRecord);
 }
Example #7
0
        internal void Commit(TestRecord testRecord, string comment, List <string> rawDataList, bool isRename, string newName, DateTime startTime, DateTime completeTime, string batteryType, string projectName, Header header)
        {
            testRecord.Comment         = comment;
            testRecord.StartTime       = startTime;
            testRecord.EndTime         = completeTime;
            testRecord.AssignedBattery = null;
            testRecord.AssignedChamber = null;
            testRecord.AssignedChannel = null;
            testRecord.Status          = TestStatus.Completed;
            string root             = $@"{GlobalSettings.RootPath}{batteryType}\{projectName}";
            string temproot         = $@"{GlobalSettings.LocalFolder}{batteryType}\{projectName}";
            string temptestfilepath = string.Empty;

            if (rawDataList.Count > 1)
            {
                temptestfilepath        = CreateTestFile(rawDataList, temproot, newName);
                testRecord.TestFilePath = $@"{root}\{GlobalSettings.TestDataFolderName}\{Path.GetFileName(temptestfilepath)}";
                CopyToServerWithRetry(temptestfilepath, testRecord.TestFilePath);
            }
            else
            {
                if (isRename)
                {
                    temptestfilepath        = RenameRawDataAndCopyToFolder(rawDataList[0], $@"{temproot}\{GlobalSettings.TestDataFolderName}", newName);
                    testRecord.TestFilePath = $@"{root}\{GlobalSettings.TestDataFolderName}\{Path.GetFileName(temptestfilepath)}";
                    CopyToServerWithRetry(temptestfilepath, testRecord.TestFilePath);
                }
                else
                {
                    temptestfilepath        = CopyToFolder(rawDataList[0], temproot);
                    testRecord.TestFilePath = $@"{root}\{GlobalSettings.TestDataFolderName}\{Path.GetFileName(temptestfilepath)}";
                    CopyToServerWithRetry(temptestfilepath, testRecord.TestFilePath);
                }
            }
            if (testRecord.TestFilePath == "")
            {
                MessageBox.Show("Test File Path Empty!");
                return;
            }
            SuperUpdate(testRecord);

            if (header.Type == "RC" || header.Type == "OCV")
            {
                string tempheaderFilePath = Path.ChangeExtension($@"{temproot}\{GlobalSettings.HeaderFolderName}\{Path.GetFileName(testRecord.TestFilePath)}", "HDR");
                string headerFilePath     = Path.ChangeExtension($@"{root}\{GlobalSettings.HeaderFolderName}\{Path.GetFileName(testRecord.TestFilePath)}", "HDR");
                if (!File.Exists(tempheaderFilePath))
                {
                    CreateHeaderFile(tempheaderFilePath, header);
                    CopyToServerWithRetry(tempheaderFilePath, headerFilePath);
                    var    tempSourceFilePath = CreateSourceFile(temproot, tempheaderFilePath, temptestfilepath);
                    string sourceFilePath     = $@"{root}\{GlobalSettings.SourceDataFolderName}\{Path.GetFileName(temptestfilepath)}";
                    CopyToServerWithRetry(tempSourceFilePath, sourceFilePath);
                }
            }
        }
Example #8
0
 internal void CommitV2(TestRecord testRecord, string comment, string filePath, DateTime startTime, DateTime completeTime)
 {
     testRecord.Comment         = comment;
     testRecord.StartTime       = startTime;
     testRecord.EndTime         = completeTime;
     testRecord.AssignedBattery = null;
     testRecord.AssignedChamber = null;
     testRecord.AssignedChannel = null;
     testRecord.Status          = TestStatus.Completed;
     testRecord.TestFilePath    = filePath;
     SuperUpdate(testRecord);
 }
        internal void Attach(Recipe recipe, TestRecord record)
        {
            var rec = new Recipe();
            var tr  = new TestRecord();

            using (var uow = new UnitOfWork(new AppDbContext()))
            {
                rec = uow.Recipies.SingleOrDefault(o => o.Id == recipe.Id);
                tr  = uow.TestRecords.SingleOrDefault(o => o.Id == record.Id);
                rec.TestRecords.Add(tr);
                uow.Commit();
            }
            recipe.TestRecords.Add(record);
        }
Example #10
0
 internal void Invalidate(TestRecord testRecord, string comment)
 {
     testRecord.Comment += "\r\n" + comment;
     testRecord.Status   = TestStatus.Invalid;
     try
     {
         File.Move(testRecord.TestFilePath, testRecord.TestFilePath + "_INVALID");
     }
     catch (Exception e)
     {
     }
     testRecord.TestFilePath += "_INVALID";
     DatabaseUpdate(testRecord);
 }
Example #11
0
        public void DomainUpdate(TestRecord item)
        {
            var edittarget = Items.SingleOrDefault(o => o.Id == item.Id);

            edittarget.BatteryStr     = item.BatteryStr;
            edittarget.BatteryTypeStr = item.BatteryTypeStr;
            edittarget.ChamberStr     = item.ChamberStr;
            edittarget.ChannelStr     = item.ChannelStr;
            edittarget.Comment        = item.Comment;
            edittarget.EndTime        = item.EndTime;
            edittarget.LastCycle      = item.LastCycle;
            edittarget.NewCycle       = item.NewCycle;
            edittarget.ProgramStr     = item.ProgramStr;
            edittarget.RecipeStr      = item.RecipeStr;
            edittarget.StartTime      = item.StartTime;
            edittarget.Status         = item.Status;
            edittarget.TesterStr      = item.TesterStr;
        }
Example #12
0
        internal string DataPreProcess(TestRecord record, List <string> rawDataList, bool isRename, string newName, int startIndex, DateTime st, DateTime et, string batteryType, string projectName, Program program, Recipe recipe, ITesterProcesser processer, bool isSkipDP)
        {
            string root             = $@"{GlobalSettings.RootPath}{batteryType}\{projectName}";
            string temproot         = $@"{GlobalSettings.LocalFolder}{batteryType}\{projectName}";
            string temptestfilepath = string.Empty;

            if (rawDataList.Count > 1)
            {
                temptestfilepath = CreateTestFile(rawDataList, temproot, newName);
            }
            else
            {
                if (isRename)
                {
                    temptestfilepath = RenameRawDataAndCopyToFolder(rawDataList[0], $@"{temproot}\{GlobalSettings.TestDataFolderName}", newName);
                }
                else
                {
                    temptestfilepath = CopyToFolder(rawDataList[0], temproot);
                }
            }
            TesterServiceClass ts = new TesterServiceClass();

            //#if !Test

            if (!isSkipDP)
            {
                if (!ts.DataPreprocessing(processer, temptestfilepath, program, recipe, record, startIndex))
                {
                    File.Delete(temptestfilepath);
                    return(string.Empty);
                }
            }
            //#endif
            var TestFilePath = $@"{root}\{GlobalSettings.TestDataFolderName}\{Path.GetFileName(temptestfilepath)}";

            CopyToServerWithRetry(temptestfilepath, TestFilePath);
            if (TestFilePath == "")
            {
                MessageBox.Show("Test File Path Empty!");
                return(string.Empty);
            }
            return(TestFilePath);
        }
Example #13
0
        internal void CommitFree(TestRecord testRecord, string comment, List <string> rawDataList, bool isRename, string newName, DateTime startTime, DateTime completeTime)
        {
            testRecord.Comment         = comment;
            testRecord.StartTime       = startTime;
            testRecord.EndTime         = completeTime;
            testRecord.AssignedBattery = null;
            testRecord.AssignedChamber = null;
            testRecord.AssignedChannel = null;
            testRecord.Status          = TestStatus.Completed;
            string root             = $@"{GlobalSettings.RootPath}{GlobalSettings.TempDataFolderName}";
            string temproot         = $@"{GlobalSettings.LocalFolder}{GlobalSettings.TempDataFolderName}";
            string temptestfilepath = string.Empty;

            if (rawDataList.Count > 1)
            {
                temptestfilepath        = CreateTestFile(rawDataList, temproot, newName);
                testRecord.TestFilePath = $@"{root}\{GlobalSettings.TestDataFolderName}\{Path.GetFileName(temptestfilepath)}";
                CopyToServerWithRetry(temptestfilepath, testRecord.TestFilePath);
            }
            else
            {
                if (isRename)
                {
                    temptestfilepath        = RenameRawDataAndCopyToFolder(rawDataList[0], temproot, newName);
                    testRecord.TestFilePath = $@"{root}\{Path.GetFileName(temptestfilepath)}";
                    CopyToServerWithRetry(temptestfilepath, testRecord.TestFilePath);
                }
                else
                {
                    temptestfilepath        = CopyToFolder(rawDataList[0], temproot);
                    testRecord.TestFilePath = $@"{root}\{GlobalSettings.TestDataFolderName}\{Path.GetFileName(temptestfilepath)}";
                    CopyToServerWithRetry(temptestfilepath, testRecord.TestFilePath);
                }
            }
            if (testRecord.TestFilePath == "")
            {
                MessageBox.Show("Test File Path Empty!");
                return;
            }
            SuperUpdate(testRecord);
        }
Example #14
0
 internal void ExecuteFree(TestRecord testRecord, Battery battery, Chamber chamber, string testerStr, Channel channel, DateTime startTime, double measurementGain, double measurementOffset, double traceResistance, double capacityDifference, string @operator)
 {
     testRecord.BatteryTypeStr = battery.BatteryType.Name;
     testRecord.BatteryStr     = battery.Name;
     if (chamber != null)
     {
         testRecord.ChamberStr = chamber.Name;
     }
     testRecord.TesterStr          = testerStr;
     testRecord.ChannelStr         = channel.Name;
     testRecord.StartTime          = startTime;
     testRecord.MeasurementGain    = measurementGain;
     testRecord.MeasurementOffset  = measurementOffset;
     testRecord.TraceResistance    = traceResistance;
     testRecord.CapacityDifference = capacityDifference;
     testRecord.Operator           = @operator;
     testRecord.AssignedBattery    = battery;
     testRecord.AssignedChamber    = chamber;
     testRecord.AssignedChannel    = channel;
     testRecord.Status             = TestStatus.Executing;
     DatabaseUpdate(testRecord);
 }
Example #15
0
 public void SuperAdd(TestRecord item)
 {
     DatabaseAdd(item);
     DomainAdd(item);
 }
Example #16
0
 public void SuperUpdate(TestRecord item)
 {
     DatabaseUpdate(item);
     DomainUpdate(item);
 }
        public bool DataPreprocessing(string filepath, Program program, Recipe recipe, TestRecord record, int startIndex)
        {
            return(true);

            throw new NotImplementedException();
        }
Example #18
0
 internal void Detach(TestRecord record)
 {
     Items.Remove(record);
 }
Example #19
0
 public void DomainAdd(TestRecord item)
 {
     Items.Add(item);
 }
 public string EventDescriptor(string filepath, Program program, Recipe recipe, TestRecord record, string info)
 {
     throw new NotImplementedException();
 }
 internal bool DataPreprocessing(ITesterProcesser tester, string filepath, Program program, Recipe recipe, TestRecord record, int startIndex)
 {
     return(tester.DataPreprocessing(filepath, program, recipe, record, startIndex));
 }