Esempio n. 1
0
        public static void DateTreating2(Point point)
        {
            string FullFileName = Global.DateFilePath + Global.DateFileName2;

            if (Global.Working2)
            {
                if (Global.Point2.x >= Global.con_chek_x && Global.Point2.y >= Global.con_chek_y)//进入压洞状态
                {
                    Global.SubWorking2 = true;
                    FrmTest.frmtest.SetRedo2Ena(false);
                    Global.lstPoint2.Add(point);
                    if (Global.Point2.y > Global.MaxPressure2)
                    {
                        Global.MaxPressure2 = Global.Point2.y;
                    }
                }
                if (Global.Point2.x < Global.con_chek_x || Global.Point2.y < Global.con_chek_y)//不在压洞状态
                {
                    Global.SubWorking2 = false;
                }
                if (Global.LastSubWorking2 && !Global.SubWorking2)//一个洞压完
                {
                    //调用异步写数据库和写数据文件代码
                    Global.WorkRecord2.LastTime   = DateTime.Now;
                    Global.WorkRecord2.HoleCount  = Global.HoleNumber2;
                    Global.HoleRecod2.TestTime    = DateTime.Now;
                    Global.HoleRecod2.MaxPressure = (float)Math.Round((Global.MaxPressure2 * Global.con_factor_y - 10), 2);
                    Global.HoleRecod2.Id          = Global.WorkRecord2.Id;
                    Global.HoleRecod2.HoleNumber  = Global.WorkRecord2.HoleCount;
                    // Global.HoleRecod2.HoleDate = SerializeListCompress(Global.lstPoint2.ConvertAll(s => (object)s));
                    Global.HoleRecod2.HoleDate = ListToString(Global.lstPoint2);
                    Global.HoleRecod2.MacId    = 1;
                    WorkTableUpdate(Global.WorkRecord2);
                    HoleRecordUpdate(Global.HoleRecod2);
                    if (Model.Global.AutoOut)
                    {
                        if (GetFilePath(FullFileName))
                        {
                            NopiExcelHelper <Point> .AddExcel(Global.lstPoint2, FullFileName, "hole" + Global.HoleRecod2.HoleNumber.ToString(),
                                                              Global.HoleRecod2.MaxPressure);
                        }
                    }

                    FrmTest.frmtest.SetRedo2Ena(true);
                    Global.MaxPressure2 = 0;
                    Global.HoleNumber2++;
                }
                if (!Global.SubWorking2)
                {
                    Global.lstPoint2.Clear();
                }
                Global.LastSubWorking2 = Global.SubWorking2;
            }
            //非测试状态
            else
            {
                Global.lstPoint2.Clear();
            }
        }
Esempio n. 2
0
        public static void DateTreating1(Point point)
        {
            string FullFileName = Global.DateFilePath + Global.DateFileName1;

            //测试状态
            if (Global.Working1)
            {
                if (Global.Point1.x >= Global.con_chek_x && Global.Point1.y >= Global.con_chek_y)//进入压洞状态
                {
                    Global.SubWorking1 = true;
                    FrmTest.frmtest.SetRedo1Ena(false);
                    if (Global.Point1.y > Global.MaxPressure1)
                    {
                        Global.MaxPressure1 = Global.Point1.y;
                    }
                    Global.lstPoint1.Add(point);
                }
                else if (Global.Point1.x < Global.con_chek_x || Global.Point1.y < Global.con_chek_y)//不在压洞状态
                {
                    Global.SubWorking1 = false;
                }

                if (Global.LastSubWorking1 && !Global.SubWorking1)//一个洞压完
                {
                    //调用异步写数据库和写数据文件代码
                    Global.WorkRecord1.LastTime   = DateTime.Now;
                    Global.WorkRecord1.HoleCount  = Global.HoleNumber1;
                    Global.HoleRecod1.MaxPressure = (float)Math.Round((Global.MaxPressure1 * Global.con_factor_y - 10), 2);
                    Global.HoleRecod1.TestTime    = DateTime.Now;
                    Global.HoleRecod1.Id          = Global.WorkRecord1.Id;
                    Global.HoleRecod1.HoleNumber  = Global.WorkRecord1.HoleCount;
                    //Global.HoleRecod1.HoleDate = SerializeListCompress(Global.lstPoint1.ConvertAll(s => (object)s));
                    Global.HoleRecod1.HoleDate = ListToString(Global.lstPoint1);
                    //List<Model.Point> points = new List<Model.Point>();
                    //points = StringToList(Global.HoleRecod1.HoleDate);
                    //for (int i = 0; i < points.Count; i++)
                    //{
                    //    ReadValue.logNet.WriteWarn(i + "  " + Global.lstPoint1[i].x + " " + points[i].x + " " + Global.lstPoint1[i].y + " " + points[i].y);
                    //}
                    Global.HoleRecod1.MacId = 1;
                    // Global.HoleRecod1.HoleDate = ToBinary(Global.lstPoint1.ConvertAll(s => (object)s));
                    HoleRecordUpdate(Global.HoleRecod1);
                    WorkTableUpdate(Global.WorkRecord1);
                    if (Model.Global.AutoOut)
                    {
                        if (GetFilePath(FullFileName))
                        {
                            NopiExcelHelper <Point> .AddExcel(Global.lstPoint1, FullFileName, "hole" + Global.HoleRecod1.HoleNumber.ToString(),
                                                              Global.HoleRecod1.MaxPressure);
                        }
                    }
                    FrmTest.frmtest.SetRedo1Ena(true);
                    Global.MaxPressure1 = 0;
                    Global.HoleNumber1++;
                    #region 要删除
                    //ReadValue.Distance = 0;
                    //ReadValue.Pressure = 320;
                    //ReadValue.IsMax = false;
                    #endregion
                }
                if (!Global.SubWorking1)
                {
                    Global.lstPoint1.Clear();
                }

                Global.LastSubWorking1 = Global.SubWorking1;
            }
            //非测试状态
            else
            {
                Global.lstPoint1.Clear();
            }
        }