Beispiel #1
0
        private void NetworkSave()
        {
            bool verify = true;

            for (int i = 0; i < Ipsite.Count; i++)
            {
                if (!FormatVerification.HasIP(Ipsite[i].Text.Trim()) || !FormatVerification.IsFloat(PortData[i].Text.Trim()))
                {
                    verify = false;
                }
            }
            if (verify)
            {
                if (mapMessage.SavenetworkBLL(MapRegulate.UTCTime, Ipsite.Select(p => p.Text.Trim()).ToList(), PortData.Select(p => p.Text.Trim()).ToList()))
                {
                    MessageBox.Show("保存成功!", "提示", MessageBoxButton.OK, MessageBoxImage.Information);
                    this.Close();
                }
                else
                {
                    MessageBox.Show("保存失败!", "提示", MessageBoxButton.OK, MessageBoxImage.Error);
                }
            }
            else
            {
                MessageBox.Show("格式输入错误!", "提示", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
Beispiel #2
0
 private void SaveTag_Click(object sender, RoutedEventArgs e)
 {
     if (FormatVerification.IsFloat(TagNum.Text.ToString()) && FormatVerification.IsFloat(Tag_X.Text.ToString()) && FormatVerification.IsFloat(Text_Y.Text.ToString()))
     {
         if (!exist(Convert.ToInt32(ObjTag.Content.ToString()), Convert.ToInt32(TagNum.Text.ToString().Trim())) || ObjTag.Content.ToString().Equals(TagNum.Text.ToString()))
         {
             ClearLine(Convert.ToInt32(ObjTag.Content.ToString()));
             ObjTag.Margin  = new Thickness(Convert.ToDouble(Tag_X.Text.Trim()) * MapSize, Convert.ToDouble(Text_Y.Text.Trim()) * MapSize, 0, 0);
             ObjTag.Content = TagNum.Text.ToString();
             action(new Point()
             {
                 X = ObjTag.Margin.Left + 19, Y = ObjTag.Margin.Top + 11.5
             }, Convert.ToInt32(ObjTag.Content));
             this.Close();
         }
         else
         {
             MessageBox.Show("编号已存在!", "提示", MessageBoxButton.OK, MessageBoxImage.Error);
         }
     }
     else
     {
         MessageBox.Show("格式错误!", "提示", MessageBoxButton.OK, MessageBoxImage.Error);
     }
 }
Beispiel #3
0
 public ObservableCollection <Route> GetrouteList(string MapName, string LineName, string Program)
 {
     if (string.IsNullOrWhiteSpace(Program) || !FormatVerification.IsFloat(Program))
     {
         return(Ergodic_Read(IO_AGVMapService.BLLMapRoute(MapName, LineName, "N/A")));
     }
     else
     {
         return(Ergodic_Read(IO_AGVMapService.BLLMapRoute(MapName, LineName, Program)));
     }
 }
Beispiel #4
0
 private void RouteSave_Click(object sender, RoutedEventArgs e)
 {
     if (ProgramNum.Text.Trim() != "" && RouteName.Text.Trim() != "" && FormatVerification.IsFloat(ProgramNum.Text.Trim()))
     {
         if (mapService.ExistsSystem(ProgramNum.Text.Trim(), UTCTime, RouteData.CreateTime))
         {
             MessageBox.Show("线路号已存在!", "提示", MessageBoxButton.OK, MessageBoxImage.Error);
             return;
         }
         else if (routes.Count == 0)
         {
             MessageBox.Show("请添加线路!", "提示", MessageBoxButton.OK, MessageBoxImage.Error);
             return;
         }
         else
         {
             var route = new Route()
             {
                 Name          = RouteName.Text,
                 Program       = Convert.ToInt32(ProgramNum.Text.Trim()),
                 CreateTime    = edit == true ? RouteData.CreateTime : UTC.ConvertDateTimeLong(DateTime.Now),
                 Pbs           = string.Join(",", routes.Select(p => MainInfo.agvPbs.ToList().IndexOf(p.Pbs))),
                 Hook          = string.Join(",", routes.Select(p => MainInfo.agvHook.ToList().IndexOf(p.Hook))),
                 Turn          = string.Join(",", routes.Select(p => MainInfo.agvTurn.ToList().IndexOf(p.Turn))),
                 Direction     = string.Join(",", routes.Select(p => MainInfo.agvDire.ToList().IndexOf(p.Direction))),
                 Speed         = string.Join(",", routes.Select(p => MainInfo.agvSpeed.ToList().IndexOf(p.Speed))),
                 Stop          = string.Join(",", routes.Select(p => p.Stop)),
                 Tag           = string.Join(",", routes.Select(p => p.Tag)),
                 ChangeProgram = string.Join(",", routes.Select(p => p.ChangeProgram)),
             };
             if (mapService.SaveRouteSystem(route, edit, UTC.ConvertDateTimeLong(Convert.ToDateTime(MapMenu.SelectedValue.ToString()))))
             {
                 edit = true;
                 Task.Factory.StartNew(() =>
                 {
                     GetRoutes = mapService.GetrouteList(UTCTime.ToString());
                     this.Dispatcher.Invoke(() => { Line.ItemsSource = GetRoutes; Line.Text = route.Name; });
                 });
                 MessageBox.Show("保存成功!", "提示", MessageBoxButton.OK, MessageBoxImage.Information);
             }
             else
             {
                 MessageBox.Show("保存失败!", "提示", MessageBoxButton.OK, MessageBoxImage.Error);
             }
         }
     }
     else
     {
         MessageBox.Show("格式输入错误!", "提示", MessageBoxButton.OK, MessageBoxImage.Error);
     }
 }
Beispiel #5
0
 /// <summary>
 /// 表单验证
 /// </summary>
 /// <returns></returns>
 private bool Formverify()
 {
     if (MpName.Text.ToString().Trim().Equals(""))
     {
         MessageBox.Show("区域名称不能为空", "提示", MessageBoxButton.OK, MessageBoxImage.Error);
         return(false);
     }
     if (Fontsize.Text.ToString().Trim().Equals(""))
     {
         MessageBox.Show("字体大小不能为空", "提示", MessageBoxButton.OK, MessageBoxImage.Error);
         return(false);
     }
     if (DisX.Text.ToString().Trim().Equals(""))
     {
         MessageBox.Show("X轴距离不能为空", "提示", MessageBoxButton.OK, MessageBoxImage.Error);
         return(false);
     }
     if (DisY.Text.ToString().Trim().Equals(""))
     {
         MessageBox.Show("Y轴距离不能为空", "提示", MessageBoxButton.OK, MessageBoxImage.Error);
         return(false);
     }
     if (ArWidth.Text.ToString().Trim().Equals(""))
     {
         MessageBox.Show("区域长度不能为空", "提示", MessageBoxButton.OK, MessageBoxImage.Error);
         return(false);
     }
     if (ArHeight.Text.ToString().Trim().Equals(""))
     {
         MessageBox.Show("区域宽度不能为空", "提示", MessageBoxButton.OK, MessageBoxImage.Error);
         return(false);
     }
     if (!FormatVerification.IsFloat(Fontsize.Text.ToString().Trim()))
     {
         MessageBox.Show("字体大小只能为数字", "提示", MessageBoxButton.OK, MessageBoxImage.Error);
         return(false);
     }
     if (!FormatVerification.IsFloat(DisX.Text.ToString().Trim()) || !FormatVerification.IsFloat(DisY.Text.ToString().Trim()) || !FormatVerification.IsFloat(ArWidth.Text.ToString().Trim()) || !FormatVerification.IsFloat(ArHeight.Text.ToString().Trim()))
     {
         MessageBox.Show("格式输入错误", "提示", MessageBoxButton.OK, MessageBoxImage.Error);
         return(false);
     }
     return(true);
 }
Beispiel #6
0
 private void MapAdd_Click(object sender, RoutedEventArgs e)
 {
     if (FormatVerification.IsFloat(mapHeight.Text.Trim()) && FormatVerification.IsFloat(mapWidth.Text.Trim()) && !string.IsNullOrEmpty(mapHeight.Text.Trim()) && !string.IsNullOrEmpty(mapWidth.Text.Trim()) && !string.IsNullOrEmpty(mapName.Text.Trim()))
     {
         MapEdit map = new MapEdit(
             new Ga_Map()
         {
             CreateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
             Height     = Convert.ToDouble(mapHeight.Text),
             Width      = Convert.ToDouble(mapWidth.Text),
             Name       = mapName.Text,
         }, false);
         map.Show();
         this.Close();
     }
     else
     {
         MessageBox.Show("格式输入错误!!!", "提示", MessageBoxButton.OK, MessageBoxImage.Exclamation);
     }
 }
Beispiel #7
0
 /// <summary>
 /// 系统设置保存
 /// </summary>
 private void SystemSave()
 {
     if (FormatVerification.IsFloat(interval.Text.Trim()))
     {
         if (OperateIniTool.Exist)
         {
             DataBaseConfig().OperateIniWrite("DB", "MySql");
             interval.Text.Trim().OperateIniWrite("Table", "interval");
             ConnectionStringsConfig.UpdateConnectionStringsConfig("DataBaseText", DataBaseConfig());
             SaveRun();
             this.Close();
         }
         else
         {
             MessageBoxTool.Error("配置文件丢失!");
         }
     }
     else
     {
         MessageBoxTool.Error("格式错误!");
     }
 }
Beispiel #8
0
 private void Go_Click(object sender, RoutedEventArgs e)
 {
     if (Table_Data.Items.Count > 0)
     {
         if (FormatVerification.IsFloat(IndexPs.Text.Trim()))
         {
             if (!FormatVerification.Strfloat(IndexPs.Text.Trim()))
             {
                 int Ind = Convert.ToInt32(IndexPs.Text.Trim());
                 if (Ind > 0 && Ind <= Convert.ToInt32(CountData.Content))
                 {
                     Index = Ind;
                 }
                 LoadLogInfo();
             }
         }
         else
         {
             MessageBoxTool.Error("格式输入错误!");
         }
     }
 }
Beispiel #9
0
        public bool Verify()
        {
            if (string.IsNullOrEmpty(DateTimes.Text))
            {
                MessageBoxTool.Error("请选择查询日期!");
                return(false);
            }
            if (!string.IsNullOrEmpty(AgvNum.Text))
            {
                if (!FormatVerification.IsFloat(AgvNum.Text.Trim()))
                {
                    MessageBoxTool.Error("AGV编号格式输入错误!");
                    return(false);
                }
            }
            if (FormatVerification.IsFloat(StartHour.Text))
            {
                if (FormatVerification.Strfloat(StartHour.Text))
                {
                    MessageBoxTool.Error("开始时间小时格式输入错误!");
                    return(false);
                }
                else
                {
                    if (Convert.ToInt32(StartHour.Text) > 23 || Convert.ToInt32(StartHour.Text) < 0)
                    {
                        MessageBoxTool.Error("开始时间小时格式输入错误!");
                        return(false);
                    }
                }
            }
            else
            {
                MessageBoxTool.Error("开始时间格小时式输入错误!");
                return(false);
            }
            if (FormatVerification.IsFloat(Startminute.Text))
            {
                if (FormatVerification.Strfloat(Startminute.Text))
                {
                    MessageBoxTool.Error("开始时间分钟格式输入错误!");
                    return(false);
                }
                else
                {
                    if (Convert.ToInt32(Startminute.Text) > 60 || Convert.ToInt32(Startminute.Text) < 0)
                    {
                        MessageBoxTool.Error("开始时间分钟格式输入错误!");
                        return(false);
                    }
                }
            }
            else
            {
                MessageBoxTool.Error("开始时间分钟格式输入错误!");
                return(false);
            }

            if (FormatVerification.IsFloat(Startsecond.Text))
            {
                if (FormatVerification.Strfloat(Startsecond.Text))
                {
                    MessageBoxTool.Error("开始时间秒格式输入错误!");
                    return(false);
                }
                else
                {
                    if (Convert.ToInt32(Startsecond.Text) > 60 || Convert.ToInt32(Startsecond.Text) < 0)
                    {
                        MessageBoxTool.Error("开始时间秒格式输入错误!");
                        return(false);
                    }
                }
            }
            else
            {
                MessageBoxTool.Error("开始时间秒格式输入错误!");
                return(false);
            }
            if (FormatVerification.IsFloat(StopHour.Text))
            {
                if (FormatVerification.Strfloat(StopHour.Text))
                {
                    MessageBoxTool.Error("结束时间小时格式输入错误!");
                    return(false);
                }
                else
                {
                    if (Convert.ToInt32(StopHour.Text) > 23 || Convert.ToInt32(StopHour.Text) < 0)
                    {
                        MessageBoxTool.Error("结束时间小时格式输入错误!");
                        return(false);
                    }
                }
            }
            else
            {
                MessageBoxTool.Error("结束时间格小时式输入错误!");
                return(false);
            }
            if (FormatVerification.IsFloat(Stopminute.Text))
            {
                if (FormatVerification.Strfloat(Stopminute.Text))
                {
                    MessageBoxTool.Error("结束时间分钟格式输入错误!");
                    return(false);
                }
                else
                {
                    if (Convert.ToInt32(Stopminute.Text) > 60 || Convert.ToInt32(Stopminute.Text) < 0)
                    {
                        MessageBoxTool.Error("结束时间分钟格式输入错误!");
                        return(false);
                    }
                }
            }
            else
            {
                MessageBoxTool.Error("结束时间分钟格式输入错误!");
                return(false);
            }
            if (FormatVerification.IsFloat(Stopsecond.Text))
            {
                if (FormatVerification.Strfloat(Stopsecond.Text))
                {
                    MessageBoxTool.Error("结束时间秒格式输入错误!");
                    return(false);
                }
                else
                {
                    if (Convert.ToInt32(Stopsecond.Text) > 60 || Convert.ToInt32(Stopsecond.Text) < 0)
                    {
                        MessageBoxTool.Error("结束时间秒格式输入错误!");
                        return(false);
                    }
                }
            }
            else
            {
                MessageBoxTool.Error("结束时间秒格式输入错误!");
                return(false);
            }
            return(true);
        }