Exemplo n.º 1
0
        private void UpdateDataBook(ETestState state)
        {
            if (context.Report.RecNo < 0)
            {
                return;
            }

            context.DB.Lock();

            try
            {
                FbTransaction trans = context.DB.BeginTrans();

                try
                {
                    DataBookDataSet set = context.DB.DataBookSet;

                    set.RecNo = context.Report.RecNo;
                    set.Update(state, trans);

                    context.DB.CommitTrans();
                }
                catch (Exception e)
                {
                    Resource.TLog.Log((int)ELogItem.Exception, e.ToString());
                    context.DB.RollbackTrans();
                }
            }
            finally
            {
                context.DB.Unlock();
            }
        }
Exemplo n.º 2
0
        private void SetDataBook()
        {
            ValueRow        row;
            ConditionNote   note   = context.Report.Note;
            ConditionRated  rated  = context.Report.Rated;
            ConditionMethod method = context.Report.Method;
            DataBookDataSet set    = context.DB.DataBookSet;

            context.Report.RecNo   = context.DB.GetGenNo("GN_DATABOOK");
            context.Report.RegTime = DateTime.Now;

            set.RecNo         = context.Report.RecNo;
            set.UserNo        = Resource.UserNo;
            set.BeginTime     = context.Report.RegTime.ToString(Resource.csDateTimeFormat);
            set.EndTime       = set.BeginTime;
            set.ElapsedTime   = "00 00:00:00";
            set.TestLine      = context.Handle;
            set.IntegCount    = method.IntegralCount;
            set.IntegTime     = method.IntegralTime;
            set.ScanTime      = method.ScanTime;
            set.Company       = note.Company;
            set.TestName      = note.Name;
            set.TestNo        = note.No;
            set.Observer      = note.Observer;
            set.Maker         = note.Maker;
            set.Model1        = note.Model1;
            set.Serial1       = note.Serial1;
            set.Model2        = note.Model2;
            set.Serial2       = note.Serial2;
            set.Model3        = note.Model3;
            set.Serial3       = note.Serial3;
            set.ExpDevice     = note.ExpDevice;
            set.Refrige       = note.Refrigerant;
            set.RefCharge     = note.RefCharge;
            row               = context.Value.Calcurated["Total.Capacity"];
            set.Capacity      = $"{rated.Capacity.ToString(row.Format)} {row.Unit.ToDescription}";
            row               = context.Value.Calcurated["Total.Power"];
            set.PowerInput    = $"{rated.PowerInput.ToString(row.Format)} {row.Unit.ToDescription}";
            row               = context.Value.Calcurated["Total.EER_COP"];
            set.EER_COP       = $"{rated.EER_COP.ToString(row.Format)} {row.Unit.ToDescription}";
            set.PowerSource   = $"{rated.Voltage}V / {rated.Current}A / {rated.Frequency}Hz / {EnumHelper.GetNames<EWT330Wiring>()[(int)rated.Wiring]}";
            set.TotalCapacity = "0.0 kcal/h";
            set.TotalPower    = "0.0 W";
            set.TotalEER_COP  = "0.0 kcal/hW";
            set.Memo          = note.Memo;
            set.State         = ETestState.Testing;
        }
Exemplo n.º 3
0
        private void SetSheetTitle(Dictionary <string, Cell> sheet, DataBookDataSet bookSet, DataSheetDataSet sheetSet)
        {
            sheetTags.SetWorkSheetVisible(sheetSet.SheetName, sheetSet.Use);

            if (sheetSet.Use == true)
            {
                sheet["{300}"].Value = bookSet.Company;
                sheet["{302}"].Value = bookSet.TestName;
                sheet["{304}"].Value = bookSet.TestNo;
                sheet["{306}"].Value = bookSet.Observer;
                sheet["{308}"].Value = bookSet.Maker;
                sheet["{310}"].Value = bookSet.Model1;
                sheet["{312}"].Value = bookSet.Serial1;
                sheet["{314}"].Value = bookSet.Model2;
                sheet["{316}"].Value = bookSet.Serial2;

                string str = bookSet.Model3 + " / " + bookSet.Serial3;
                if (str.Trim() == "/")
                {
                    sheet["{318}"].Value = "";
                }
                else
                {
                    sheet["{318}"].Value = str;
                }

                sheet["{320}"].Value = sheetSet.IDTemp;
                sheet["{322}"].Value = sheetSet.IDState;

                sheet["{301}"].Value = bookSet.Capacity;
                sheet["{303}"].Value = bookSet.PowerInput;
                sheet["{305}"].Value = bookSet.EER_COP;
                sheet["{307}"].Value = bookSet.PowerSource;
                sheet["{309}"].Value = bookSet.ExpDevice;
                sheet["{311}"].Value = bookSet.Refrige;
                sheet["{313}"].Value = bookSet.RefCharge;
                sheet["{315}"].Value = bookSet.BeginTime;
                sheet["{321}"].Value = sheetSet.ODTemp;
                sheet["{323}"].Value = sheetSet.ODState;
                sheet["{299}"].Value = "";

                if (sheetSet.SheetName.EndsWith("TC") == false)
                {
                    sheet["{365}"].Value = sheetSet.NozzleName;
                }
            }
        }
Exemplo n.º 4
0
        private void UpdateDataBook(DateTime time, TimeSpan elpased,
                                    string capacity, string power, string eer_cop, ETestState state)
        {
            if (context.Report.RecNo < 0)
            {
                return;
            }

            context.DB.Lock();

            try
            {
                FbTransaction trans = context.DB.BeginTrans();

                try
                {
                    DataBookDataSet set = context.DB.DataBookSet;

                    set.RecNo         = context.Report.RecNo;
                    set.EndTime       = time.ToString(Resource.csDateTimeFormat);
                    set.ElapsedTime   = elpased.ToString(@"ddd\.hh\:mm\:ss");
                    set.TotalCapacity = capacity;
                    set.TotalPower    = power;
                    set.TotalEER_COP  = eer_cop;
                    set.State         = state;
                    set.Update(trans);

                    context.DB.CommitTrans();
                }
                catch (Exception e)
                {
                    Resource.TLog.Log((int)ELogItem.Exception, e.ToString());
                    context.DB.RollbackTrans();
                }
            }
            finally
            {
                context.DB.Unlock();
            }
        }
Exemplo n.º 5
0
        public void Open(Int64 recNo)
        {
            db.Lock();

            try
            {
                this.recNo = recNo;
                bufferedSeries.ClearPoints();

                double             totalTime  = 0;
                DataBookDataSet    bookSet    = db.DataBookSet;
                DataRawUnitDataSet rawUnitSet = db.DataRawUnitSet;
                DataRawDataSet     rawSet     = db.DataRawSet;
                UnitConvert        unit       = new UnitConvert(EUnitType.None, 0, 0);

                bookSet.Select(recNo);

                if (bookSet.IsEmpty() == false)
                {
                    bookSet.Fetch();

                    scanTime = bookSet.ScanTime;
                    bufferedSeries.BaseTime = scanTime * 1000;

                    if (string.IsNullOrWhiteSpace(bookSet.TestName) == true)
                    {
                        fName = $"None_Line{bookSet.TestLine + 1}";
                    }
                    else
                    {
                        fName = $"{bookSet.TestName}_Line{bookSet.TestLine + 1}";
                    }

                    rawUnitSet.Select(bookSet.RecNo);

                    try
                    {
                        for (int i = 0; i < rawUnitSet.GetRowCount(); i++)
                        {
                            rawUnitSet.Fetch(i);

                            unit.Type = (EUnitType)rawUnitSet.UnitType;
                            unit.From = rawUnitSet.UnitFrom;
                            unit.To   = rawUnitSet.UnitTo;

                            SetMethodUnit((EUnitType)rawUnitSet.UnitType, rawUnitSet.UnitTo);
                            SetPlotSeriesUnit(i, (EUnitType)rawUnitSet.UnitType, rawUnitSet.UnitTo);

                            rawSet.Select(rawUnitSet.RecNo);
                            for (int j = 0; j < rawSet.GetRowCount(); j++)
                            {
                                rawSet.Fetch(j);
                                if (rawSet.DataRaw == null)
                                {
                                    break;
                                }

                                if (i == 0)
                                {
                                    totalTime += (rawSet.DataRaw.Length - 1) * bufferedSeries.BaseTime;
                                }

                                ConvertUnit(unit, rawSet.DataRaw);
                                bufferedSeries[i].Points.AddRange(rawSet.DataRaw);
                            }

                            Win32.SwitchToThread();
                        }
                    }
                    finally
                    {
                        foreach (TabPage page in graphTab.TabPages)
                        {
                            CtrlViewGraphPanel ctrl = page.Controls[0] as CtrlViewGraphPanel;

                            ctrl.Method = method;
                            ctrl.RefreshYAxesUnit();
                            ctrl.SetMaxRangeAxisX(totalTime);
                        }

                        InvalidateGraphSeries(graphTab.SelectedTab);
                    }
                }
            }
            finally
            {
                db.Unlock();
            }
        }
Exemplo n.º 6
0
 private void Initialize()
 {
     RecNo   = -1;
     dataSet = Resource.ViewDB.DataBookSet;
 }
Exemplo n.º 7
0
        public void Open(Int64 recNo)
        {
            sheetTags.Clear();
            db.Lock();

            try
            {
                Dictionary <string, Cell> sheet;
                DataBookDataSet           bookSet      = db.DataBookSet;
                DataSheetDataSet          sheetSet     = db.DataSheetSet;
                DataValueUnitDataSet      valueUnitSet = db.DataValueUnitSet;
                DataValueDataSet          valueSet     = db.DataValueSet;

                bookSet.Select(recNo);

                if (bookSet.IsEmpty() == false)
                {
                    bookSet.Fetch();
                    if (string.IsNullOrWhiteSpace(bookSet.TestName) == true)
                    {
                        fName = $"None_Line{bookSet.TestLine + 1}";
                    }
                    else
                    {
                        fName = $"{bookSet.TestName}_Line{bookSet.TestLine + 1}";
                    }

                    sheetSet.Select(bookSet.RecNo);

                    for (int i = 0; i < sheetSet.GetRowCount(); i++)
                    {
                        sheetSet.Fetch(i);

                        bool isNozzle = false;
                        if ((sheetSet.IDState.EndsWith("Cooling") == true) ||
                            (sheetSet.IDState.EndsWith("Heating") == true))
                        {
                            isNozzle = true;
                        }

                        sheet = sheetTags.Sheets[sheetSet.SheetName];

                        reportSheet.BeginUpdate();

                        try
                        {
                            SetSheetTitle(sheet, bookSet, sheetSet);

                            if (sheetSet.Use == true)
                            {
                                valueUnitSet.Select(sheetSet.RecNo);

                                if (i < 4)
                                {
                                    SetSheetValues(sheet, calorieTags,
                                                   bookSet.IntegCount, bookSet.IntegTime, valueUnitSet, valueSet, false, isNozzle);
                                }
                                else
                                {
                                    SetSheetValues(sheet, thermoTags,
                                                   bookSet.IntegCount, bookSet.IntegTime, valueUnitSet, valueSet, true, false);
                                }
                            }
                        }
                        finally
                        {
                            reportSheet.EndUpdate();
                        }

                        Thread.Sleep(1);
                    }
                }
            }
            finally
            {
                db.Unlock();
            }
        }