Advertisement
Guest User

Untitled

a guest
Aug 27th, 2013
359
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 37.29 KB | None | 0 0
  1. namespace ARMTitan.Forms
  2. {
  3.     public partial class Blocks : Form //класс формы!
  4.     {
  5.         private DateTime nullDate = DateTime.Parse("01.01.0001 00:00:00"); //зачем? за шкафом!
  6.        
  7.         private readonly string conString = "сплошные секреты";
  8.        
  9.         SqlConnection con;
  10.         bool mode;
  11.         int block;
  12.         PreBlock bl;
  13.        
  14.         public Blocks(bool mode, int block)
  15.         {
  16.             InitializeComponent();
  17.             this.mode = mode;       //true = добавление . false = редактирование
  18.             this.block = block;   //номер блока который будем редктировать
  19.             SqlConnection con; = new SqlConnection(conString);
  20.            
  21.             //загрузка справочников
  22.             try
  23.             {
  24.                 LoadDict(); //грузим справочники
  25.                 bl = new PreBlock(con); //создаем экземпляр класса
  26.  
  27.                 if (mode == false)
  28.                 {
  29.                     BlockText.Text = block.ToString();
  30.                     BlockText.Enabled = false;
  31.  
  32.                     bl.Prepare(block); //запрос
  33.                     //начинаем присваивать данные
  34.                     //осн.
  35.                     MassBlockText.Text = bl.BlockMass.ToString();
  36.                     CatBlockText.Text = Category.Text = bl.Category.ToString();
  37.                     CritOtklText.Text = bl.CritOtkl;
  38.                     OtklSKPText.Text = bl.OtklSKP;
  39.  
  40.                     //аппарат восстановления
  41.                     VostProcNumber.Text = bl.VostProcNumber.ToString();
  42.                     nCondensat.Value = bl.nCondensat;
  43.                     nVostRetorta.Value = bl.nVostRetorta;
  44.                     nVostCover.Value = bl.nVostCover;
  45.                     nChvost.Value = bl.nChvost;
  46.                     nSlivPipe.Value = bl.nSlivPipe;
  47.                     nVostStove.Value = bl.nVostStove;
  48.                     nVostStove2.Value = bl.nVostStove2;
  49.                     nVostVentDU32.Value = bl.nVostVentDU32;
  50.                     nVostVentDU50.Value = bl.nVostVentDU50;
  51.                     nTask80.Value = bl.nTask80;
  52.                     CleanCover.SelectedIndex = bl.CleanCover - 1;
  53.                     TestCleanAndParts.SelectedIndex = bl.TestCleanAndParts - 1;
  54.                     ControlCondFire.SelectedIndex = bl.ControlCondFire - 1;
  55.                     ControlCondOnAir.Value = bl.ControlCondOnAir;
  56.                     WeldControlCover.SelectedIndex = bl.WeldControlCover - 1;
  57.                     GrillSet.SelectedIndex = bl.GrillSet - 1;
  58.                     POstatApp.Text = bl.POstatApp.ToString();
  59.                     POstatChange.Text = bl.POstatChange.ToString();
  60.                     AVControl.SelectedIndex = bl.AVControl - 1;
  61.                     TiCl4Doze1.SelectedIndex = bl.TiCl4Doze1 - 1;
  62.                     VdAfterDoze1.SelectedIndex = bl.VdAfterDoze1 - 1;
  63.                     ExP.Text = bl.ExP.ToString();
  64.                     AVDecision220.SelectedIndex = bl.AVDecision220 - 1;
  65.                     SlivMgCl2.Value = bl.SlivMgCl2;
  66.                     TestGrillSet.SelectedIndex = bl.TestGrillSet - 1;
  67.                     MgCond.Value = bl.MgCond;
  68.                     CleanMg.SelectedIndex = bl.CleanMg - 1;
  69.                     ZalitoMg.Value = bl.ZalitoMg;
  70.                     CalcMg.Value = bl.CalcMg;
  71.                     VostProtokAr.SelectedIndex = bl.VostProtokAr - 1;
  72.                     TiCl4Stop.SelectedIndex = bl.TiCl4Stop - 1;
  73.                     KIM.Text = bl.KIM.ToString();
  74.                     SlivMgCl2AfterR.Text = bl.SlivMgCl2AfterR.ToString();
  75.                     LastSlivControl.SelectedIndex = bl.LastSlivControl - 1;
  76.                     PodslivMgCl2.SelectedIndex = bl.PodslivMgCl2 - 1;
  77.                     AVProgar.SelectedIndex = bl.AVProgar-1;
  78.                     AVProgarSeam.Value = bl.AVProgarSeam;
  79.                     AVComment460.SelectedIndex = bl.AVComment460 - 1;
  80.                     AVComment460Other.Text = bl.AVComment460Other;
  81.                     if (bl.DTMontagAV!=nullDate) DTMontagAV.DateTime = bl.DTMontagAV;
  82.                     if (bl.DTDemontagAV!=nullDate) DTDemontagAV.DateTime = bl.DTDemontagAV;
  83.                    
  84.                     //аппарат сепарации
  85.                     DistProcNumber.Text = bl.DistProcNumber.ToString();
  86.                     OutView1220.SelectedIndex = bl.OutView1220 - 1;
  87.                     Comment1220.Text = bl.Comment1220;
  88.                     ProcessDecision.SelectedIndex = bl.ProcessDecision - 1;
  89.                     nDistStove.Value = bl.nDistStove;
  90.                     nDistStove2.Value = bl.nDistStove2;
  91.                     nKesson.Value = bl.nKesson;
  92.                     nDistCover.Value = bl.nDistCover;
  93.                     nDistRetorta.Value = bl.nDistRetorta;
  94.                     nDistRetortaCond.Value = bl.nDistRetortaCond;
  95.                     nDistVentDU50.Value = bl.nDistVentDU50;
  96.                     PracticWork690.Value = bl.PracticWork690;
  97.                     TestCleanRetorta.SelectedIndex = bl.TestCleanRetorta - 1;
  98.                     WeldControlRetorta.SelectedIndex = bl.WeldControlRetorta - 1;
  99.                     POstatRet.Text = bl.POstatRet.ToString();
  100.                     TestVacuumRet.Text = bl.TestVacuumRet.ToString();
  101.                     ChangePulseTube.SelectedIndex = bl.ChangePulseTube - 1;
  102.                     CleanMaterialPipe.SelectedIndex = bl.CleanMaterialPipe - 1;
  103.                     TestCleanCoverDemont.SelectedIndex = bl.TestCleanCoverDemont - 1;
  104.                     TestCleanHeatScreen.SelectedIndex = bl.TestCleanHeatScreen - 1;
  105.                     ArToDistApp.SelectedIndex = bl.ArToDistApp - 1;
  106.                     ArValueDist.Text = bl.ArValueDist.ToString();
  107.                     ASAssembly.SelectedIndex = bl.ASAssembly - 1;
  108.                     ASDecision830.SelectedIndex = bl.ASDecision830 - 1;
  109.                     VacuumPumpParam.Text = bl.VacuumPumpParam.ToString();
  110.                     TestHermeticApp.Text = bl.TestHermeticApp.ToString();
  111.                     ExPControlBeforeVac.SelectedIndex = bl.ExPControlBeforeVac - 1;
  112.                     CritParamVost.SelectedIndex = bl.CritParamVost - 1;
  113.                     CritParamDist.SelectedIndex = bl.CritParamDist - 1;
  114.                     CritParamCool.SelectedIndex = bl.CritParamCool - 1;
  115.                     CritParamRegistration.SelectedIndex = bl.CritParamRegistration - 1;
  116.                     ASVdTime.Value = bl.ASVdTime;
  117.                     ExPControlAfterExtract.SelectedIndex = bl.ExPControlAfterExtract - 1;
  118.                     RetTGControl.SelectedIndex = bl.RetTGControl - 1;
  119.                     RetTGControlSeam.Value = bl.RetTGControlSeam;
  120.                     CoolTime1060.SelectedIndex = bl.CoolTime1060 - 1;
  121.                     passivation1061.SelectedIndex = bl.passivation1061 - 1;
  122.                     passivation1062.SelectedIndex = bl.passivation1062 - 1;
  123.                     RetDemount.SelectedIndex = bl.RetDemount - 1;
  124.                     RetDemountNLift.Value = bl.RetDemountNLift;
  125.                     LiftRetInAppDemount.SelectedIndex = bl.LiftRetInAppDemount - 1;
  126.                     DeleteMgFromRet.SelectedIndex = bl.DeleteMgFromRet - 1;
  127.                     BreakApp.SelectedIndex = bl.BreakApp - 1;
  128.                     BreakAppSeam.Value = bl.BreakAppSeam;
  129.                     RetPipeTest.SelectedIndex = bl.RetPipeTest - 1;
  130.                     RetCleanTest.SelectedIndex = bl.RetCleanTest - 1;
  131.                     ASComment1150.SelectedIndex = bl.ASComment1150 - 1;
  132.                     DTBlockDelivery.DateTime = bl.DTBlockDelivery;
  133.                     FlanzCleanTest.SelectedIndex = bl.FlanzCleanTest - 1;
  134.                     BurningInPrevProc.SelectedIndex = bl.BurningInPrevProc - 1;
  135.                     TableCleanTest.SelectedIndex = bl.TableCleanTest - 1;
  136.                     DTBlockProcessing.DateTime = bl.DTBlockProcessing;
  137.                     NProbe1170.Text = bl.NProbe1170.ToString();
  138.                     NResult1170.Text = bl.NResult1170.ToString();
  139.                     NProbe1200.Text = bl.NProbe1200.ToString();
  140.                     NResult1200.Text = bl.NResult1200.ToString();
  141.                     DTMontagAC.DateTime = bl.DTMontagAC;
  142.                     DTDemontagAC.DateTime = bl.DTDemontagAC;
  143.                 }
  144.             }
  145.             catch (Exception ex)
  146.             {
  147.                 MessageBox.Show(ex.Message);
  148.             }
  149.            
  150.         }
  151.  
  152.        
  153.         /// <summary>
  154.         /// Загружаем справочники
  155.         /// </summary>
  156.         public void LoadDict()
  157.         {
  158.             SqlConnection conD = con;
  159.             try
  160.             {
  161.                 string sql = "SELECT  [nCode],[Description] FROM [dbo].[BlockAV220Dict] Where nCode>0";
  162.                 //Открываем соединение
  163.                 if (conD.State == ConnectionState.Closed)
  164.                     conD.Open();
  165.                 //220
  166.                 using (SqlCommand command1 = new SqlCommand(sql, con))
  167.                 {
  168.                     SqlDataReader dataReader1 = command1.ExecuteReader();
  169.                     while (dataReader1.Read())
  170.                     {
  171.                         string n = dataReader1["Description"].ToString();
  172.                         AVDecision220.Items.Add(n.Trim());
  173.                         //fraction.BeginInvoke(new Action<string>((s) => fraction.Items.Add(s)), n);
  174.                     }
  175.                     dataReader1.Close();
  176.                 }
  177.  
  178.                 //460
  179.                 sql = "SELECT  [nCode],[Description] FROM [dbo].[BlockAV460Dict] Where nCode>0";
  180.                 using (SqlCommand command1 = new SqlCommand(sql, con))
  181.                 {
  182.                     SqlDataReader dataReader1 = command1.ExecuteReader();
  183.                     while (dataReader1.Read())
  184.                     {
  185.                         string n = dataReader1["Description"].ToString();
  186.                         AVComment460.Items.Add(n.Trim());
  187.                     }
  188.                     dataReader1.Close();
  189.                 }
  190.  
  191.                 //830
  192.                 sql = "SELECT  [nCode],[Description] FROM [dbo].[BlockAS830Dict] Where nCode>0";
  193.                 using (SqlCommand command1 = new SqlCommand(sql, con))
  194.                 {
  195.                     SqlDataReader dataReader1 = command1.ExecuteReader();
  196.                     while (dataReader1.Read())
  197.                     {
  198.                         string n = dataReader1["Description"].ToString();
  199.                         ASDecision830.Items.Add(n.Trim());
  200.                     }
  201.                     dataReader1.Close();
  202.                 }
  203.  
  204.             }
  205.             catch (Exception ex)
  206.             {
  207.                 MessageBox.Show(ex.Message);
  208.             }
  209.             con.Close();
  210.  
  211.         }
  212.        
  213.  
  214.         private void SaveBtn_Click(object sender, EventArgs e)
  215.         {
  216.             SyncBlock();
  217.         }
  218.  
  219.         /// <summary>
  220.         /// Синхронизировать PreBlock с введеными даными на форме
  221.         /// </summary>
  222.         public void SyncBlock()
  223.         {
  224.             try
  225.             {                
  226.                 //осн.
  227.                 bl.BlockNumber = Convert.ToInt32(BlockText.Text); //ОШИБКА!!
  228.                 bl.BlockMass = Convert.ToInt32(MassBlockText.Text);
  229.                 bl.Category = Category.SelectedIndex + 1;
  230.                 bl.CritOtkl = CritOtklText.Text;
  231.                 bl.OtklSKP = OtklSKPText.Text;
  232.  
  233.                 //аппарат восстановления
  234.                 bl.VostProcNumber = Convert.ToInt32(VostProcNumber.Text);
  235.                 bl.nCondensat = (int)nCondensat.Value;
  236.                 bl.nVostRetorta = (int)nVostRetorta.Value;
  237.                 bl.nVostCover = (int)nVostCover.Value;
  238.                 bl.nChvost = (int)nChvost.Value;
  239.                 bl.nSlivPipe = (int)nSlivPipe.Value;
  240.                 bl.nVostStove = (int)nVostStove.Value;
  241.                 bl.nVostStove2 = (int)nVostStove2.Value;
  242.                 bl.nVostVentDU32 = (int)nVostVentDU32.Value;
  243.                 bl.nVostVentDU50 = (int)nVostVentDU50.Value;
  244.                 bl.nTask80 = (int)nTask80.Value;
  245.                 bl.CleanCover = CleanCover.SelectedIndex + 1;
  246.                 bl.TestCleanAndParts = TestCleanAndParts.SelectedIndex + 1;
  247.                 bl.ControlCondFire = ControlCondFire.SelectedIndex + 1;
  248.                 bl.ControlCondOnAir = (int)ControlCondOnAir.Value;
  249.                 bl.WeldControlCover = WeldControlCover.SelectedIndex + 1;
  250.                 bl.GrillSet = GrillSet.SelectedIndex + 1;
  251.                 bl.POstatApp = Convert.ToDouble(POstatApp.Text);
  252.                 bl.POstatChange = Convert.ToDouble(POstatChange.Text);
  253.                 bl.AVControl = AVControl.SelectedIndex + 1;
  254.  
  255.                 bl.TiCl4Doze1 = TiCl4Doze1.SelectedIndex + 1;
  256.                 bl.VdAfterDoze1 = VdAfterDoze1.SelectedIndex + 1;
  257.                 bl.ExP = Convert.ToDouble(ExP.Text);
  258.                 bl.AVDecision220 = AVDecision220.SelectedIndex + 1;
  259.                 bl.SlivMgCl2 = (int)SlivMgCl2.Value;
  260.                 bl.TestGrillSet = TestGrillSet.SelectedIndex + 1;
  261.                 bl.MgCond = (int)MgCond.Value;
  262.                 bl.CleanMg = CleanMg.SelectedIndex + 1;
  263.                 bl.ZalitoMg = (int)ZalitoMg.Value;
  264.                 bl.CalcMg = (int)CalcMg.Value;
  265.                 bl.VostProtokAr = VostProtokAr.SelectedIndex + 1;
  266.                 bl.TiCl4Stop = TiCl4Stop.SelectedIndex + 1;
  267.                 bl.KIM = Convert.ToDouble(KIM.Text);
  268.                 bl.SlivMgCl2AfterR = Convert.ToDouble(SlivMgCl2AfterR.Text);
  269.                 bl.LastSlivControl = LastSlivControl.SelectedIndex + 1;
  270.                 bl.PodslivMgCl2 = PodslivMgCl2.SelectedIndex + 1;
  271.                 bl.AVProgar = AVProgar.SelectedIndex + 1;
  272.                 bl.AVProgarSeam = (int)AVProgarSeam.Value;
  273.                 bl.AVComment460 = AVComment460.SelectedIndex + 1;
  274.                 bl.AVComment460Other = AVComment460Other.Text;
  275.                 if (DTMontagAV.DateTime != nullDate) bl.DTMontagAV = DTMontagAV.DateTime;
  276.                 if (DTDemontagAV.DateTime != nullDate) bl.DTDemontagAV = DTDemontagAV.DateTime;
  277.  
  278.                 //аппарат сепарации
  279.                 bl.DistProcNumber = Convert.ToInt32(DistProcNumber.Text);
  280.                 bl.OutView1220 = OutView1220.SelectedIndex + 1;
  281.                 bl.Comment1220 = Comment1220.Text;
  282.                 bl.ProcessDecision = ProcessDecision.SelectedIndex + 1;
  283.                 bl.nDistStove = (int)nDistStove.Value;
  284.                 bl.nDistStove2 = (int)nDistStove2.Value;
  285.                 bl.nKesson = (int)nKesson.Value;
  286.                 bl.nDistCover = (int)nDistCover.Value;
  287.                 bl.nDistRetorta = (int)nDistRetorta.Value;
  288.                 bl.nDistRetortaCond = (int)nDistRetortaCond.Value;
  289.                 bl.nDistVentDU50 = (int)nDistVentDU50.Value;
  290.                 bl.PracticWork690 = (int)PracticWork690.Value;
  291.                 bl.TestCleanRetorta = TestCleanRetorta.SelectedIndex + 1;
  292.                 bl.WeldControlRetorta = WeldControlRetorta.SelectedIndex + 1;
  293.                 bl.POstatRet = Convert.ToDouble(POstatRet.Text);
  294.                 bl.TestVacuumRet = Convert.ToDouble(TestVacuumRet.Text);
  295.                 bl.ChangePulseTube = ChangePulseTube.SelectedIndex + 1;
  296.                 bl.CleanMaterialPipe = CleanMaterialPipe.SelectedIndex + 1;
  297.                 bl.TestCleanCoverDemont = TestCleanCoverDemont.SelectedIndex + 1;
  298.                 bl.TestCleanHeatScreen = TestCleanHeatScreen.SelectedIndex + 1;
  299.                 bl.ArToDistApp = ArToDistApp.SelectedIndex + 1;
  300.                 bl.ArValueDist = Convert.ToDouble(ArValueDist.Text);
  301.                 bl.ASAssembly = ASAssembly.SelectedIndex + 1;
  302.                 bl.ASDecision830 = ASDecision830.SelectedIndex + 1;
  303.                 bl.VacuumPumpParam = Convert.ToDouble(VacuumPumpParam.Text);
  304.                 bl.TestHermeticApp = Convert.ToDouble(TestHermeticApp.Text);
  305.                 bl.ExPControlBeforeVac = ExPControlBeforeVac.SelectedIndex + 1;
  306.                 bl.CritParamVost = CritParamVost.SelectedIndex + 1;
  307.                 bl.CritParamDist = CritParamDist.SelectedIndex + 1;
  308.                 bl.CritParamCool = CritParamCool.SelectedIndex + 1;
  309.                 bl.CritParamRegistration = CritParamRegistration.SelectedIndex + 1;
  310.                 bl.ASVdTime = (int)ASVdTime.Value;
  311.                 bl.ExPControlAfterExtract = ExPControlAfterExtract.SelectedIndex + 1;
  312.                 bl.RetTGControl = RetTGControl.SelectedIndex + 1;
  313.                 bl.RetTGControlSeam = (int)RetTGControlSeam.Value;
  314.                 bl.CoolTime1060 = CoolTime1060.SelectedIndex + 1;
  315.                 bl.passivation1061 = passivation1061.SelectedIndex + 1;
  316.                 bl.passivation1062 = passivation1062.SelectedIndex + 1;
  317.                 bl.RetDemount = RetDemount.SelectedIndex + 1;
  318.                 bl.RetDemountNLift = (int)RetDemountNLift.Value;
  319.                 bl.LiftRetInAppDemount = LiftRetInAppDemount.SelectedIndex + 1;
  320.                 bl.DeleteMgFromRet = DeleteMgFromRet.SelectedIndex + 1;
  321.                 bl.BreakApp = BreakApp.SelectedIndex + 1;
  322.                 bl.BreakAppSeam = (int)BreakAppSeam.Value;
  323.                 bl.RetPipeTest = RetPipeTest.SelectedIndex + 1;
  324.                 bl.RetCleanTest = RetCleanTest.SelectedIndex + 1;
  325.  
  326.                 bl.ASComment1150 = ASComment1150.SelectedIndex + 1;
  327.                 bl.DTBlockDelivery = DTBlockDelivery.DateTime;
  328.                 bl.FlanzCleanTest = FlanzCleanTest.SelectedIndex + 1;
  329.                 bl.BurningInPrevProc = BurningInPrevProc.SelectedIndex + 1;
  330.                 bl.TableCleanTest = TableCleanTest.SelectedIndex + 1;
  331.                 bl.DTBlockProcessing = DTBlockProcessing.DateTime;
  332.                 bl.NProbe1170 = Convert.ToInt32(NProbe1170.Text);
  333.                 bl.NResult1170 = Convert.ToDouble(NResult1170.Text);
  334.                 bl.NProbe1200 = Convert.ToInt32(NProbe1200.Text);
  335.                 bl.NResult1200 = Convert.ToDouble(NResult1200.Text);
  336.                 bl.DTMontagAC = DTMontagAC.DateTime;
  337.                 bl.DTDemontagAC = DTDemontagAC.DateTime;
  338.             }
  339.             catch (Exception ex)
  340.             {
  341.                 MessageBox.Show(ex.Message);
  342.             }
  343.  
  344.         }
  345.     }
  346.  
  347.  
  348.     ////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////
  349.     // Класс для загрузки данных о Блоке
  350.     ////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////
  351.     public class PreBlock
  352.     {
  353.         public PreBlock(SqlConnection conn)
  354.         {
  355.             con = conn;
  356.         }
  357.  
  358.         SqlConnection con;
  359.         private DateTime nullDate = DateTime.Parse("01.01.0001 00:00:00");
  360.         //main
  361.         public int BlockNumber;
  362.         public string BlockIndex;
  363.         public int BlockMass;
  364.         public int Category;
  365.         public string CritOtkl;
  366.         public string OtklSKP;
  367.         //Аппарат востановления
  368.         public int VostProcNumber;
  369.         public int nCondensat;
  370.         public int nVostRetorta;
  371.         public int nVostCover;
  372.         public int nChvost;
  373.         public int nSlivPipe;
  374.         public int nVostStove;
  375.         public int nVostStove2;
  376.         public int nVostVentDU32;
  377.         public int nVostVentDU50;
  378.         public int nTask80;
  379.         public int CleanCover;
  380.         public int TestCleanAndParts;
  381.         public int ControlCondFire;
  382.         public int ControlCondOnAir;
  383.         public int WeldControlCover;
  384.         public int GrillSet;
  385.         public double POstatApp;
  386.         public double POstatChange;
  387.         public int AVControl;
  388.         public int TiCl4Doze1;
  389.         public int VdAfterDoze1;
  390.         public double ExP;
  391.         public int AVDecision220;
  392.         public int SlivMgCl2;
  393.         public int TestGrillSet;
  394.         public int MgCond;
  395.         public int CleanMg;
  396.         public int ZalitoMg;
  397.         public int CalcMg;
  398.         public int VostProtokAr;
  399.         public int TiCl4Stop;
  400.         public double KIM;
  401.         public double SlivMgCl2AfterR;
  402.         public int LastSlivControl;
  403.         public int PodslivMgCl2;
  404.         public int AVProgar;
  405.         public int AVProgarSeam;
  406.         public int AVComment460;
  407.         public string AVComment460Other;
  408.         public DateTime DTMontagAV;
  409.         public DateTime DTDemontagAV;
  410.        
  411.         //аппарат сепарации
  412.         public int DistProcNumber;
  413.         public int OutView1220;
  414.         public string Comment1220;
  415.         public int ProcessDecision;
  416.         public int nDistStove;
  417.         public int nDistStove2;
  418.         public int nKesson;
  419.         public int nDistCover;
  420.         public int nDistRetorta;
  421.         public int nDistRetortaCond;
  422.         public int nDistVentDU50;
  423.         public int PracticWork690;
  424.         public int TestCleanRetorta;
  425.         public int WeldControlRetorta;
  426.         public double POstatRet;
  427.         public double TestVacuumRet;
  428.         public int ChangePulseTube;
  429.         public int CleanMaterialPipe;
  430.         public int TestCleanCoverDemont;
  431.         public int TestCleanHeatScreen;
  432.         public int ArToDistApp;
  433.         public double ArValueDist;
  434.         public int ASAssembly;
  435.         public int ASDecision830;
  436.         public double VacuumPumpParam;
  437.         public double TestHermeticApp;
  438.         public int ExPControlBeforeVac;
  439.         public int CritParamVost;
  440.         public int CritParamDist;
  441.         public int CritParamCool;
  442.         public int CritParamRegistration;
  443.         public int ASVdTime;
  444.         public int ExPControlAfterExtract;
  445.         public int RetTGControl;
  446.         public int RetTGControlSeam;
  447.         public int CoolTime1060;
  448.         public int passivation1061;
  449.         public int passivation1062;
  450.         public int RetDemount;
  451.         public int RetDemountNLift;
  452.         public int LiftRetInAppDemount;
  453.         public int DeleteMgFromRet;
  454.         public int BreakApp;
  455.         public int BreakAppSeam;
  456.         public int RetPipeTest;
  457.         public int RetCleanTest;
  458.         public int ASComment1150;
  459.         public DateTime DTBlockDelivery;
  460.         public int FlanzCleanTest;
  461.         public int BurningInPrevProc;
  462.         public int TableCleanTest;
  463.         public DateTime DTBlockProcessing;
  464.         public int NProbe1170;
  465.         public double NResult1170;
  466.         public int NProbe1200;
  467.         public double NResult1200;
  468.         public DateTime DTMontagAC;
  469.         public DateTime DTDemontagAC;
  470.  
  471.  
  472.         //загружаем данные о блоке
  473.         public void Prepare(int block)
  474.         {
  475.             if (con.State == ConnectionState.Closed)
  476.                 con.Open();
  477.             try
  478.             {
  479.                 //осн.  
  480.                 String sql = "Select * FROM Block Where BlockNumber=" + block;
  481.                 using (SqlCommand command1 = new SqlCommand(sql, con))
  482.                 {
  483.                     SqlDataReader dr = command1.ExecuteReader();
  484.                     dr.Read();
  485.                                      
  486.                     Category = dr["Category"] != DBNull.Value ? Convert.ToInt32(dr["Category"]):0;
  487.                     BlockMass = dr["BlockMass"] != DBNull.Value ? Convert.ToInt32(dr["BlockMass"].ToString()):0;
  488.                     CritOtkl = dr["CritOtkl"] != DBNull.Value ? dr["CritOtkl"].ToString():"";
  489.                     OtklSKP = dr["OtklSKP"] != DBNull.Value ? dr["OtklSKP"].ToString():"";
  490.                     dr.Close();
  491.                 }
  492.  
  493.                 //Аппарат востановления
  494.                 sql = "Select * FROM BlockAV Where BlockNumber=" + block;
  495.                 using (SqlCommand command1 = new SqlCommand(sql, con))
  496.                 {
  497.                     SqlDataReader dr = command1.ExecuteReader();
  498.                     dr.Read();
  499.                    
  500.                     VostProcNumber = dr["VostProcNumber"] != DBNull.Value ? Convert.ToInt32(dr["VostProcNumber"].ToString()) : 0;
  501.                     nCondensat = dr["nCondensat"] != DBNull.Value ? Convert.ToInt32(dr["nCondensat"].ToString()) : 0;
  502.                     nVostRetorta = dr["nVostRetorta"] != DBNull.Value ? Convert.ToInt32(dr["nVostRetorta"].ToString()) : 0;
  503.                     nVostCover = dr["nVostCover"] != DBNull.Value ? Convert.ToInt32(dr["nVostCover"].ToString()) : 0;
  504.                     nChvost = dr["nChvost"] != DBNull.Value ? Convert.ToInt32(dr["nChvost"].ToString()) : 0;
  505.                     nSlivPipe = dr["nSlivPipe"] != DBNull.Value ? Convert.ToInt32(dr["nSlivPipe"].ToString()) : 0;
  506.                     nVostStove = dr["nVostStove"] != DBNull.Value ? Convert.ToInt32(dr["nVostStove"].ToString()) : 0;
  507.                     nVostStove2 = dr["nVostStove2"] != DBNull.Value ? Convert.ToInt32(dr["nVostStove2"].ToString()) : 0;
  508.                     nVostVentDU32 = dr["nVostVentDU32"] != DBNull.Value ? Convert.ToInt32(dr["nVostVentDU32"].ToString()) : 0;
  509.                     nVostVentDU50 =dr["nVostVentDU50"] != DBNull.Value ? Convert.ToInt32(dr["nVostVentDU50"].ToString()) : 0;
  510.                     nTask80 = dr["nTask80"] != DBNull.Value ? Convert.ToInt32(dr["nTask80"].ToString()) : 0;
  511.                     CleanCover = dr["CleanCover"] != DBNull.Value ? Convert.ToInt32(dr["CleanCover"].ToString()) : 0;
  512.                     TestCleanAndParts = dr["TestCleanAndParts"] != DBNull.Value ? Convert.ToInt32(dr["TestCleanAndParts"].ToString()) : 0;
  513.                     ControlCondFire = dr["ControlCondFire"] != DBNull.Value ? Convert.ToInt32(dr["ControlCondFire"].ToString()) : 0;
  514.                     ControlCondOnAir = dr["ControlCondOnAir"] != DBNull.Value ? Convert.ToInt32(dr["ControlCondOnAir"].ToString()) : 0;
  515.                     WeldControlCover = dr["WeldControlCover"] != DBNull.Value ? Convert.ToInt32(dr["WeldControlCover"].ToString()) : 0;
  516.                     GrillSet = dr["GrillSet"] != DBNull.Value ? Convert.ToInt32(dr["GrillSet"].ToString()) : 0;
  517.                     POstatApp = dr["POstatApp"] != DBNull.Value ? Convert.ToDouble(dr["POstatApp"].ToString()) : 0;
  518.                     POstatChange = dr["POstatChange"] != DBNull.Value ? Convert.ToDouble(dr["POstatChange"].ToString()) : 0;
  519.                     AVControl = dr["AVControl"] != DBNull.Value ? Convert.ToInt32(dr["AVControl"].ToString()) : 0;
  520.                     TiCl4Doze1 = dr["TiCl4Doze1"] != DBNull.Value ? Convert.ToInt32(dr["TiCl4Doze1"].ToString()) : 0;
  521.                     VdAfterDoze1 = dr["VdAfterDoze1"] != DBNull.Value ? Convert.ToInt32(dr["VdAfterDoze1"].ToString()) : 0;
  522.                     ExP = dr["nTask80"] != DBNull.Value ? Convert.ToDouble(dr["nTask80"].ToString()) : 0; ;
  523.                     AVDecision220 = dr["AVDecision220"] != DBNull.Value ? Convert.ToInt32(dr["AVDecision220"].ToString()) : 0;
  524.                     SlivMgCl2 = dr["SlivMgCl2"] != DBNull.Value ? Convert.ToInt32(dr["SlivMgCl2"].ToString()) : 0;
  525.                     TestGrillSet = dr["TestGrillSet"] != DBNull.Value ? Convert.ToInt32(dr["TestGrillSet"].ToString()) : 0;
  526.                     MgCond = dr["MgCond"] != DBNull.Value ? Convert.ToInt32(dr["MgCond"].ToString()) : 0;
  527.                     CleanMg = dr["CleanMg"] != DBNull.Value ? Convert.ToInt32(dr["CleanMg"].ToString()) : 0;
  528.                     ZalitoMg = dr["ZalitoMg"] != DBNull.Value ? Convert.ToInt32(dr["ZalitoMg"].ToString()) : 0;
  529.                     CalcMg = dr["CalcMg"] != DBNull.Value ? Convert.ToInt32(dr["CalcMg"].ToString()) : 0;
  530.                     VostProtokAr = dr["VostProtokAr"] != DBNull.Value ? Convert.ToInt32(dr["VostProtokAr"].ToString()) : 0;
  531.                     TiCl4Stop = dr["TiCl4Stop"] != DBNull.Value ? Convert.ToInt32(dr["TiCl4Stop"].ToString()) : 0;
  532.                     KIM = dr["KIM"] != DBNull.Value ? Convert.ToDouble(dr["KIM"].ToString()) : 0;
  533.                     SlivMgCl2AfterR = dr["SlivMgCl2AfterR"] != DBNull.Value ? Convert.ToDouble(dr["SlivMgCl2AfterR"].ToString()) : 0;
  534.                     LastSlivControl = dr["LastSlivControl"] != DBNull.Value ? Convert.ToInt32(dr["LastSlivControl"].ToString()) : 0;
  535.                     PodslivMgCl2 = dr["PodslivMgCl2"] != DBNull.Value ? Convert.ToInt32(dr["PodslivMgCl2"].ToString()) : 0;
  536.                     AVProgar = dr["AVProgar"] != DBNull.Value ? Convert.ToInt32(dr["AVProgar"].ToString()) : 0;
  537.                     AVProgarSeam = dr["AVProgarSeam"] != DBNull.Value ? Convert.ToInt32(dr["AVProgarSeam"].ToString()) : 0;
  538.                     AVComment460 = dr["AVComment460"] != DBNull.Value ? Convert.ToInt32(dr["AVComment460"].ToString()) : 0;
  539.                     AVComment460Other = dr["AVComment460Other"] != DBNull.Value ? dr["AVComment460Other"].ToString(): "";
  540.                     //if (dr["DOtgruz"] != DBNull.Value) dOtgruz.DateTime = Convert.ToDateTime(dr["DOtgruz"]);
  541.  
  542.                     if (dr["DTMontagAV"] != DBNull.Value) DTMontagAV = Convert.ToDateTime(dr["DTMontagAV"]);// ? Convert.ToDateTime(dr["DTMontagAV"].ToString()) : 0;
  543.                     if (dr["DTDemontagAV"]!= DBNull.Value) DTDemontagAV = Convert.ToDateTime(dr["DTDemontagAV"]);//.ToString()):0;
  544.                    
  545.                     dr.Close();
  546.                 }
  547.  
  548.                 //Аппарат сепарации
  549.                 sql = "Select * FROM BlockAS Where BlockNumber=" + block;
  550.                 using (SqlCommand command1 = new SqlCommand(sql, con))
  551.                 {
  552.                     SqlDataReader dr = command1.ExecuteReader();
  553.                     dr.Read();
  554.                     DistProcNumber = dr["DistProcNumber"] != DBNull.Value ? Convert.ToInt32(dr["DistProcNumber"].ToString()) : 0;
  555.                     OutView1220 = dr["OutView1220"] != DBNull.Value ? Convert.ToInt32(dr["OutView1220"].ToString()) : 0;
  556.                     Comment1220 = dr["Comment1220"] != DBNull.Value ? dr["Comment1220"].ToString() : "";
  557.                     ProcessDecision = dr["ProcessDecision"] != DBNull.Value ? Convert.ToInt32(dr["ProcessDecision"].ToString()) : 0;
  558.                     nDistStove = dr["nDistStove"] != DBNull.Value ? Convert.ToInt32(dr["nDistStove"].ToString()) : 0;
  559.                     nDistStove2 = dr["nDistStove2"] != DBNull.Value ? Convert.ToInt32(dr["nDistStove2"].ToString()) : 0;
  560.                     nKesson = dr["nKesson"] != DBNull.Value ? Convert.ToInt32(dr["nKesson"].ToString()) : 0;
  561.                     nDistCover = dr["nDistCover"] != DBNull.Value ? Convert.ToInt32(dr["nDistCover"].ToString()) : 0;
  562.                     nDistRetorta = dr["nDistRetorta"] != DBNull.Value ? Convert.ToInt32(dr["nDistRetorta"].ToString()) : 0;
  563.                     nDistRetortaCond = dr["nDistRetortaCond"] != DBNull.Value ? Convert.ToInt32(dr["nDistRetortaCond"].ToString()) : 0;
  564.                     nDistVentDU50 = dr["nDistVentDU50"] != DBNull.Value ? Convert.ToInt32(dr["nDistVentDU50"].ToString()) : 0;
  565.                     PracticWork690 = dr["PracticWork690"] != DBNull.Value ? Convert.ToInt32(dr["PracticWork690"].ToString()) : 0;
  566.                     TestCleanRetorta = dr["TestCleanRetorta"] != DBNull.Value ? Convert.ToInt32(dr["TestCleanRetorta"].ToString()) : 0;
  567.                     WeldControlRetorta = dr["WeldControlRetorta"] != DBNull.Value ? Convert.ToInt32(dr["WeldControlRetorta"].ToString()) : 0;
  568.                     POstatRet = dr["POstatRet"] != DBNull.Value ? Convert.ToDouble(dr["POstatRet"].ToString()) : 0;
  569.                     TestVacuumRet = dr["TestVacuumRet"] != DBNull.Value ? Convert.ToDouble(dr["TestVacuumRet"].ToString()) : 0;
  570.                     ChangePulseTube = dr["ChangePulseTube"] != DBNull.Value ? Convert.ToInt32(dr["ChangePulseTube"].ToString()) : 0;
  571.                     CleanMaterialPipe = dr["CleanMaterialPipe"] != DBNull.Value ? Convert.ToInt32(dr["CleanMaterialPipe"].ToString()) : 0;
  572.                     TestCleanCoverDemont = dr["TestCleanCoverDemont"] != DBNull.Value ? Convert.ToInt32(dr["TestCleanCoverDemont"].ToString()) : 0;
  573.                     TestCleanHeatScreen = dr["TestCleanHeatScreen"] != DBNull.Value ? Convert.ToInt32(dr["TestCleanHeatScreen"].ToString()) : 0;
  574.                     ArToDistApp = dr["ArToDistApp"] != DBNull.Value ? Convert.ToInt32(dr["ArToDistApp"].ToString()) : 0;
  575.                     ArValueDist = dr["ArValueDist"] != DBNull.Value ? Convert.ToDouble(dr["ArValueDist"].ToString()) : 0;
  576.                     ASAssembly = dr["ASAssembly"] != DBNull.Value ? Convert.ToInt32(dr["ASAssembly"].ToString()) : 0;
  577.                     ASDecision830 = dr["ASDecision830"] != DBNull.Value ? Convert.ToInt32(dr["ASDecision830"].ToString()) : 0;
  578.                     VacuumPumpParam = dr["VacuumPumpParam"] != DBNull.Value ? Convert.ToDouble(dr["VacuumPumpParam"].ToString()) : 0;
  579.                     TestHermeticApp = dr["TestHermeticApp"] != DBNull.Value ? Convert.ToDouble(dr["TestHermeticApp"].ToString()) : 0;
  580.                     ExPControlBeforeVac = dr["ExPControlBeforeVac"] != DBNull.Value ? Convert.ToInt32(dr["ExPControlBeforeVac"].ToString()) : 0;
  581.                     CritParamVost = dr["CritParamVost"] != DBNull.Value ? Convert.ToInt32(dr["CritParamVost"].ToString()) : 0;
  582.                     CritParamDist = dr["CritParamDist"] != DBNull.Value ? Convert.ToInt32(dr["CritParamDist"].ToString()) : 0;
  583.                     CritParamCool = dr["CritParamCool"] != DBNull.Value ? Convert.ToInt32(dr["CritParamCool"].ToString()) : 0;
  584.                     CritParamRegistration = dr["CritParamRegistration"] != DBNull.Value ? Convert.ToInt32(dr["CritParamRegistration"].ToString()) : 0;
  585.                     ASVdTime = dr["ASVdTime"] != DBNull.Value ? Convert.ToInt32(dr["ASVdTime"].ToString()) : 0;
  586.                     ExPControlAfterExtract = dr["ExPControlAfterExtract"] != DBNull.Value ? Convert.ToInt32(dr["ExPControlAfterExtract"].ToString()) : 0;
  587.                     RetTGControl = dr["RetTGControl"] != DBNull.Value ? Convert.ToInt32(dr["RetTGControl"].ToString()) : 0;
  588.                     RetTGControlSeam = dr["RetTGControlSeam"] != DBNull.Value ? Convert.ToInt32(dr["RetTGControlSeam"].ToString()) : 0;
  589.                     CoolTime1060 = dr["CoolTime1060"] != DBNull.Value ? Convert.ToInt32(dr["CoolTime1060"].ToString()) : 0;
  590.                     passivation1061 = dr["passivation1061"] != DBNull.Value ? Convert.ToInt32(dr["passivation1061"].ToString()) : 0;
  591.                     passivation1062 = dr["passivation1062"] != DBNull.Value ? Convert.ToInt32(dr["passivation1062"].ToString()) : 0;
  592.                     RetDemount = dr["RetDemount"] != DBNull.Value ? Convert.ToInt32(dr["RetDemount"].ToString()) : 0;
  593.                     RetDemountNLift = dr["RetDemountNLift"] != DBNull.Value ? Convert.ToInt32(dr["RetDemountNLift"].ToString()) : 0;
  594.                     LiftRetInAppDemount = dr["LiftRetInAppDemount"] != DBNull.Value ? Convert.ToInt32(dr["LiftRetInAppDemount"].ToString()) : 0;
  595.                     DeleteMgFromRet = dr["DeleteMgFromRet"] != DBNull.Value ? Convert.ToInt32(dr["DeleteMgFromRet"].ToString()) : 0;
  596.                     BreakApp = dr["BreakApp"] != DBNull.Value ? Convert.ToInt32(dr["BreakApp"].ToString()) : 0;
  597.                     BreakAppSeam = dr["BreakAppSeam"] != DBNull.Value ? Convert.ToInt32(dr["BreakAppSeam"].ToString()) : 0;
  598.                     RetPipeTest = dr["RetPipeTest"] != DBNull.Value ? Convert.ToInt32(dr["RetPipeTest"].ToString()) : 0;
  599.                     RetCleanTest = dr["RetCleanTest"] != DBNull.Value ? Convert.ToInt32(dr["RetCleanTest"].ToString()) : 0;
  600.                     ASComment1150 = dr["ASComment1150"] != DBNull.Value ? Convert.ToInt32(dr["ASComment1150"].ToString()) : 0;
  601.  
  602.                     if (dr["DTBlockDelivery"] != DBNull.Value) DTBlockDelivery = Convert.ToDateTime(dr["DTBlockDelivery"].ToString());
  603.  
  604.                     FlanzCleanTest = dr["FlanzCleanTest"] != DBNull.Value ? Convert.ToInt32(dr["FlanzCleanTest"].ToString()) : 0;
  605.                     BurningInPrevProc = dr["BurningInPrevProc"] != DBNull.Value ? Convert.ToInt32(dr["BurningInPrevProc"].ToString()) : 0;
  606.                     TableCleanTest = dr["TableCleanTest"] != DBNull.Value ? Convert.ToInt32(dr["TableCleanTest"].ToString()) : 0;
  607.                     if (dr["DTBlockProcessing"] != DBNull.Value) DTBlockProcessing = Convert.ToDateTime(dr["DTBlockProcessing"].ToString());
  608.                     NProbe1170 = dr["NProbe1170"] != DBNull.Value ? Convert.ToInt32(dr["NProbe1170"].ToString()) : 0;
  609.                     NResult1170 = dr["NResult1170"] != DBNull.Value ? Convert.ToDouble(dr["NResult1170"].ToString()) : 0;
  610.                     NProbe1200 = dr["NProbe1200"] != DBNull.Value ? Convert.ToInt32(dr["NProbe1200"].ToString()) : 0;
  611.                     NResult1200 = dr["NResult1200"] != DBNull.Value ? Convert.ToDouble(dr["NResult1200"].ToString()) : 0;
  612.                     if (dr["DTMontagAC"] != DBNull.Value) DTMontagAC = Convert.ToDateTime(dr["DTMontagAC"].ToString());
  613.                     if (dr["DTDemontagAC"] != DBNull.Value) DTDemontagAC = Convert.ToDateTime(dr["DTDemontagAC"].ToString());
  614.  
  615.                     dr.Close();
  616.                 }
  617.  
  618.             }
  619.             catch (Exception ex)
  620.             {
  621.                 MessageBox.Show(ex.Message);
  622.             }
  623.             con.Close();
  624.         }
  625.  
  626.         //ну тут пока что пусто
  627.         public void saveBlock()
  628.         {
  629.             try
  630.             {
  631.                 if (con.State == ConnectionState.Closed)
  632.                     con.Open();
  633.  
  634.  
  635.  
  636.                 con.Close();
  637.             }
  638.             catch (Exception ex)
  639.             {
  640.                 MessageBox.Show(ex.Message);
  641.             }
  642.         }
  643.     }
  644. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement