Beispiel #1
0
        private void InsertCondition(int paramNo)
        {
            NoteParamDataSet noteSet = Context.DB.NoteParamSet;

            noteSet.RecNo     = (int)Context.DB.GetGenNo("GN_CONDITION_NOTEPARAM");
            noteSet.ParamNo   = paramNo;
            noteSet.Company   = Context.Condition.Note.Company;
            noteSet.TestName  = Context.Condition.Note.Name;
            noteSet.TestNo    = Context.Condition.Note.No;
            noteSet.Observer  = Context.Condition.Note.Observer;
            noteSet.Maker     = Context.Condition.Note.Maker;
            noteSet.Model1    = Context.Condition.Note.Model1;
            noteSet.Serial1   = Context.Condition.Note.Serial1;
            noteSet.Model2    = Context.Condition.Note.Model2;
            noteSet.Serial2   = Context.Condition.Note.Serial2;
            noteSet.Model3    = Context.Condition.Note.Model3;
            noteSet.Serial3   = Context.Condition.Note.Serial3;
            noteSet.ExpDevice = Context.Condition.Note.ExpDevice;
            noteSet.Refrig    = Context.Condition.Note.Refrigerant;
            noteSet.RefCharge = Context.Condition.Note.RefCharge;
            noteSet.Memo      = Context.Condition.Note.Memo;
            noteSet.CoolUnit  = Context.Condition.Method.CoolingCapacity;
            noteSet.HeatUnit  = Context.Condition.Method.HeatingCapacity;
            noteSet.Insert(Context.DB.Trans);

            MethodParamDataSet methodSet = Context.DB.MethodParamSet;

            methodSet.RecNo             = (int)Context.DB.GetGenNo("GN_CONDITION_METHODPARAM");
            methodSet.NoteNo            = noteSet.RecNo;
            methodSet.IntegCount        = Context.Condition.Method.IntegralCount;
            methodSet.IntegTime         = Context.Condition.Method.IntegralTime;
            methodSet.ScanTime          = Context.Condition.Method.ScanTime;
            methodSet.CoolCapacityUnit  = Context.Condition.Method.CoolingCapacity;
            methodSet.HeatCapacityUnit  = Context.Condition.Method.HeatingCapacity;
            methodSet.AirFlowUnit       = Context.Condition.Method.AirFlow;
            methodSet.EnthalpyUnit      = Context.Condition.Method.Enthalpy;
            methodSet.PressureUnit      = Context.Condition.Method.Pressure;
            methodSet.TemperatureUnit   = Context.Condition.Method.Temperature;
            methodSet.DiffPressureUnit  = Context.Condition.Method.DiffPressure;
            methodSet.AtmPressureUnit   = Context.Condition.Method.AtmPressure;
            methodSet.AutoSetController = Context.Condition.Method.AutoControllerSetting;
            methodSet.UsePowerMeter     = Context.Condition.Method.UsePowerMeterIntegral;
            methodSet.Insert(Context.DB.Trans);


            RatedParamDataSet ratedSet = Context.DB.RatedParamSet;

            foreach (KeyValuePair <EConditionRated, List <ConditionRated> > rated in Context.Condition.Rateds)
            {
                ratedSet.RecNo    = (int)Context.DB.GetGenNo("GN_CONDITION_RATEDPARAM");
                ratedSet.NoteNo   = noteSet.RecNo;
                ratedSet.PageNo   = rated.Key;
                ratedSet.Mode     = ETestMode.Cooling;
                ratedSet.Capacity = rated.Value[(int)ETestMode.Cooling].Capacity;
                ratedSet.Power    = rated.Value[(int)ETestMode.Cooling].PowerInput;
                ratedSet.EER_COP  = rated.Value[(int)ETestMode.Cooling].EER_COP;
                ratedSet.Volt     = rated.Value[(int)ETestMode.Cooling].Voltage;
                ratedSet.Amp      = rated.Value[(int)ETestMode.Cooling].Current;
                ratedSet.Freq     = rated.Value[(int)ETestMode.Cooling].Frequency;
                ratedSet.PM_IDU   = rated.Value[(int)ETestMode.Cooling].PM_IDU;
                ratedSet.PM_ODU   = rated.Value[(int)ETestMode.Cooling].PM_ODU;
                ratedSet.Phase    = rated.Value[(int)ETestMode.Cooling].Wiring;
                ratedSet.Insert(Context.DB.Trans);

                ratedSet.RecNo    = (int)Context.DB.GetGenNo("GN_CONDITION_RATEDPARAM");
                ratedSet.NoteNo   = noteSet.RecNo;
                ratedSet.PageNo   = rated.Key;
                ratedSet.Mode     = ETestMode.Heating;
                ratedSet.Capacity = rated.Value[(int)ETestMode.Heating].Capacity;
                ratedSet.Power    = rated.Value[(int)ETestMode.Heating].PowerInput;
                ratedSet.EER_COP  = rated.Value[(int)ETestMode.Heating].EER_COP;
                ratedSet.Volt     = rated.Value[(int)ETestMode.Heating].Voltage;
                ratedSet.Amp      = rated.Value[(int)ETestMode.Heating].Current;
                ratedSet.Freq     = rated.Value[(int)ETestMode.Heating].Frequency;
                ratedSet.PM_IDU   = rated.Value[(int)ETestMode.Heating].PM_IDU;
                ratedSet.PM_ODU   = rated.Value[(int)ETestMode.Heating].PM_ODU;
                ratedSet.Phase    = rated.Value[(int)ETestMode.Heating].Wiring;
                ratedSet.Insert(Context.DB.Trans);
            }

            ThermoPressParamDataSet tcSet = Context.DB.ThermoPressParamSet;

            foreach (MeasureRow row in Context.Condition.TC1)
            {
                tcSet.RecNo  = (int)Context.DB.GetGenNo("GN_CONDITION_THERMOPRESSPARAM");
                tcSet.NoteNo = noteSet.RecNo;
                tcSet.ChType = 0;
                tcSet.ChNo   = row.No;
                tcSet.Name   = row.Name;
                tcSet.Insert(Context.DB.Trans);
            }

            foreach (MeasureRow row in Context.Condition.TC2)
            {
                tcSet.RecNo  = (int)Context.DB.GetGenNo("GN_CONDITION_THERMOPRESSPARAM");
                tcSet.NoteNo = noteSet.RecNo;
                tcSet.ChType = 1;
                tcSet.ChNo   = row.No;
                tcSet.Name   = row.Name;
                tcSet.Insert(Context.DB.Trans);
            }

            foreach (MeasureRow row in Context.Condition.TC3)
            {
                tcSet.RecNo  = (int)Context.DB.GetGenNo("GN_CONDITION_THERMOPRESSPARAM");
                tcSet.NoteNo = noteSet.RecNo;
                tcSet.ChType = 2;
                tcSet.ChNo   = row.No;
                tcSet.Name   = row.Name;
                tcSet.Insert(Context.DB.Trans);
            }

            foreach (MeasureRow row in Context.Condition.Pressures)
            {
                tcSet.RecNo  = (int)Context.DB.GetGenNo("GN_CONDITION_THERMOPRESSPARAM");
                tcSet.NoteNo = noteSet.RecNo;
                tcSet.ChType = 3;
                tcSet.ChNo   = row.No;
                tcSet.Name   = row.Name;
                tcSet.Insert(Context.DB.Trans);
            }
        }
        private void InsertNote()
        {
            FbTransaction trans = db.BeginTrans();

            try
            {
                NoteParamDataSet noteSet = db.NoteParamSet;
                noteSet.RecNo     = (int)db.GetGenNo("GN_CONDITION_NOTEPARAM");
                noteSet.ParamNo   = -1;
                noteSet.Company   = noteCompanyEdit.Text;
                noteSet.TestName  = noteTestNameEdit.Text;
                noteSet.TestNo    = noteTestNoEdit.Text;
                noteSet.Observer  = noteObserverEdit.Text;
                noteSet.Maker     = noteMakerEdit.Text;
                noteSet.Model1    = noteModel1Edit.Text;
                noteSet.Serial1   = noteSerial1Edit.Text;
                noteSet.Model2    = noteModel2Edit.Text;
                noteSet.Serial2   = noteSerial2Edit.Text;
                noteSet.Model3    = noteModel3Edit.Text;
                noteSet.Serial3   = noteSerial3Edit.Text;
                noteSet.ExpDevice = noteExpDeviceEdit.Text;
                noteSet.Refrig    = noteRefrigerantCombo.Text;
                noteSet.RefCharge = noteRefChargeEdit.Text;
                noteSet.Memo      = noteMemoEdit.Text;
                noteSet.CoolUnit  = (EUnitCapacity)methodCapaCoolingUnitCombo.SelectedValue;
                noteSet.HeatUnit  = (EUnitCapacity)methodCapaHeatingUnitCombo.SelectedValue;
                noteSet.Insert(trans);

                RatedParamDataSet ratedSet = db.RatedParamSet;
                foreach (TabPage page in ratedTab.TabPages)
                {
                    CtrlTestRated ctrl = page.Controls[0] as CtrlTestRated;

                    ratedSet.RecNo    = (int)db.GetGenNo("GN_CONDITION_RATEDPARAM");
                    ratedSet.NoteNo   = noteSet.RecNo;
                    ratedSet.PageNo   = ctrl.Index;
                    ratedSet.Mode     = ETestMode.Cooling;
                    ratedSet.Capacity = float.Parse(ctrl.coolingCapacityEdit.Text);
                    ratedSet.Power    = float.Parse(ctrl.coolingPowerInEdit.Text);
                    ratedSet.EER_COP  = float.Parse(ctrl.coolingEepEdit.Text);
                    ratedSet.Volt     = float.Parse(ctrl.coolingVoltEdit.Text);
                    ratedSet.Amp      = float.Parse(ctrl.coolingCurrentEdit.Text);
                    ratedSet.Freq     = ctrl.coolingFreqCombo.Text;
                    ratedSet.PM_IDU   = ctrl.coolingPowerMeter1Combo.SelectedIndex;
                    ratedSet.PM_ODU   = ctrl.coolingPowerMeter2Combo.SelectedIndex;
                    ratedSet.Phase    = (EWT330Wiring)ctrl.coolingPhaseCombo.SelectedValue;
                    ratedSet.Insert(trans);

                    ratedSet.RecNo    = (int)db.GetGenNo("GN_CONDITION_RATEDPARAM");
                    ratedSet.NoteNo   = noteSet.RecNo;
                    ratedSet.PageNo   = ctrl.Index;
                    ratedSet.Mode     = ETestMode.Heating;
                    ratedSet.Capacity = float.Parse(ctrl.heatingCapacityEdit.Text);
                    ratedSet.Power    = float.Parse(ctrl.heatingPowerInEdit.Text);
                    ratedSet.EER_COP  = float.Parse(ctrl.heatingEepEdit.Text);
                    ratedSet.Volt     = float.Parse(ctrl.heatingVoltEdit.Text);
                    ratedSet.Amp      = float.Parse(ctrl.heatingCurrentEdit.Text);
                    ratedSet.Freq     = ctrl.heatingFreqCombo.Text;
                    ratedSet.PM_IDU   = ctrl.heatingPowerMeter1Combo.SelectedIndex;
                    ratedSet.PM_ODU   = ctrl.heatingPowerMeter2Combo.SelectedIndex;
                    ratedSet.Phase    = (EWT330Wiring)ctrl.heatingPhaseCombo.SelectedValue;
                    ratedSet.Insert(trans);
                }

                ThermoPressParamDataSet tcSet = db.ThermoPressParamSet;
                foreach (MeasureRow row in id1TCs)
                {
                    tcSet.RecNo  = (int)db.GetGenNo("GN_CONDITION_THERMOPRESSPARAM");
                    tcSet.NoteNo = noteSet.RecNo;
                    tcSet.ChType = 0;
                    tcSet.ChNo   = row.No;
                    tcSet.Name   = row.Value;
                    tcSet.Insert(trans);
                }

                foreach (MeasureRow row in id2TCs)
                {
                    tcSet.RecNo  = (int)db.GetGenNo("GN_CONDITION_THERMOPRESSPARAM");
                    tcSet.NoteNo = noteSet.RecNo;
                    tcSet.ChType = 1;
                    tcSet.ChNo   = row.No;
                    tcSet.Name   = row.Value;
                    tcSet.Insert(trans);
                }

                foreach (MeasureRow row in odTCs)
                {
                    tcSet.RecNo  = (int)db.GetGenNo("GN_CONDITION_THERMOPRESSPARAM");
                    tcSet.NoteNo = noteSet.RecNo;
                    tcSet.ChType = 2;
                    tcSet.ChNo   = row.No;
                    tcSet.Name   = row.Value;
                    tcSet.Insert(trans);
                }

                foreach (MeasureRow row in presses)
                {
                    tcSet.RecNo  = (int)db.GetGenNo("GN_CONDITION_THERMOPRESSPARAM");
                    tcSet.NoteNo = noteSet.RecNo;
                    tcSet.ChType = 3;
                    tcSet.ChNo   = row.No;
                    tcSet.Name   = row.Value;
                    tcSet.Insert(trans);
                }

                db.CommitTrans();
            }
            catch (Exception e)
            {
                Resource.TLog.Log((int)ELogItem.Exception, e.ToString());
                db.RollbackTrans();
            }
        }