예제 #1
0
        private void FixedBtn_Click(object sender, RoutedEventArgs e)
        {
            ChargerInfoConfig cf = (sender as Button).DataContext as ChargerInfoConfig;

            this.chargerManagementService.FixedConfigure(cf.Id, cf);
            this.chargerManagementService.SaveConfig(JsonConvert.SerializeObject(MainDataGrid.ItemsSource, Formatting.Indented));
        }
예제 #2
0
 public void FixedConfigure(ChargerId id, ChargerInfoConfig chcf)
 {
     if (ChargerStationList.ContainsKey(id))
     {
         ChargerStationList[(ChargerId)id].UpdateConfigure(chcf);
     }
 }
예제 #3
0
        public void Initialize()
        {
            ChargerInfoConfig pchr1 = new ChargerInfoConfig();

            pchr1.Id   = ChargerId.CHARGER_ID_1;
            pchr1.Ip   = "192.168.1.200";
            pchr1.Port = 8081;
            pchr1.PointFrontLineStr = "7.23,0.75,0";
            pchr1.ParsePointFrontLineValue(pchr1.PointFrontLineStr);
            pchr1.PointFrontLineStrInv = "3.23,0.75,180";
            pchr1.ParsePointFrontLineValueInv(pchr1.PointFrontLineStrInv);
            pchr1.PointOfPallet    = "{\"pallet\":2,\"bay\":1,\"dir_sub\":0,\"dir_main\":1,\"dir_out\":1,\"line_ord\":0,\"hasSubLine\":\"no\",\"row\":0}";
            pchr1.PointOfPalletInv = "{\"pallet\":2,\"bay\":1,\"dir_sub\":0,\"dir_main\":2,\"dir_out\":1,\"line_ord\":0,\"hasSubLine\":\"no\",\"row\":0}";

            PropertiesCharge_List.Add(pchr1);
            ChargerCtrl chargerStation1 = new ChargerCtrl(pchr1);

            ChargerStationList.Add(chargerStation1.cf.Id, chargerStation1);

            ChargerInfoConfig pchr2 = new ChargerInfoConfig();

            pchr2.Id   = ChargerId.CHARGER_ID_2;
            pchr2.Ip   = "192.168.1.201";
            pchr2.Port = 8081;
            pchr2.PointFrontLineStr = "9.23,0.75,0";
            pchr2.ParsePointFrontLineValue(pchr2.PointFrontLineStr);
            pchr2.PointFrontLineStrInv = "6.25,0.69,180";
            pchr2.ParsePointFrontLineValue(pchr2.PointFrontLineStrInv);
            pchr2.PointOfPallet    = "{\"pallet\":2,\"bay\":1,\"dir_sub\":0,\"dir_main\":1,\"dir_out\":1,\"line_ord\":0,\"hasSubLine\":\"no\",\"row\":0}";
            pchr2.PointOfPalletInv = "{\"pallet\":2,\"bay\":1,\"dir_sub\":0,\"dir_main\":2,\"dir_out\":1,\"line_ord\":0,\"hasSubLine\":\"no\",\"row\":0}";

            PropertiesCharge_List.Add(pchr2);
            ChargerCtrl chargerStation2 = new ChargerCtrl(pchr2);

            ChargerStationList.Add(chargerStation2.cf.Id, chargerStation2);

            ChargerInfoConfig pchr3 = new ChargerInfoConfig();

            pchr3.Id   = ChargerId.CHARGER_ID_3;
            pchr3.Ip   = "192.168.1.202";
            pchr3.Port = 8081;
            pchr3.PointFrontLineStr = "11.25,0.75,0";
            pchr3.ParsePointFrontLineValue(pchr3.PointFrontLineStr);
            pchr3.PointFrontLineStrInv = "9.25,0.69,180";
            pchr3.ParsePointFrontLineValue(pchr3.PointFrontLineStrInv);
            pchr3.PointOfPallet    = "{\"pallet\":2,\"bay\":1,\"dir_sub\":0,\"dir_main\":1,\"dir_out\":1,\"line_ord\":0,\"hasSubLine\":\"no\",\"row\":0}";
            pchr3.PointOfPalletInv = "{\"pallet\":2,\"bay\":1,\"dir_sub\":0,\"dir_main\":2,\"dir_out\":1,\"line_ord\":0,\"hasSubLine\":\"no\",\"row\":0}";

            PropertiesCharge_List.Add(pchr3);
            ChargerCtrl chargerStation3 = new ChargerCtrl(pchr3);

            ChargerStationList.Add(chargerStation3.cf.Id, chargerStation3);

            Grouped_PropertiesCharge.Refresh();
        }
예제 #4
0
        protected String GetPointOfCharger()
        {
            ChargerInfoConfig chrInfo = this.charger.PropertiesCharge_List[(int)this.robot.properties.ChargeID - 1];

            if (this.Traffic.RobotIsInArea("OUTER", robot.properties.pose.Position, TypeZone.MAIN_ZONE))
            {
                return(this.charger.PropertiesCharge_List[(int)this.robot.properties.ChargeID - 1].PointOfPallet);
            }
            else
            {
                return(this.charger.PropertiesCharge_List[(int)this.robot.properties.ChargeID - 1].PointOfPalletInv);
            }
        }
예제 #5
0
        public bool LoadConfigure()
        {
            String path = Path.Combine(System.IO.Directory.GetCurrentDirectory(), "ConfigCharge.json");

            if (!File.Exists(path))
            {
                Initialize();
                SaveConfig(JsonConvert.SerializeObject(PropertiesCharge_List, Formatting.Indented).ToString());
                return(false);
            }
            else
            {
                try
                {
                    String data = File.ReadAllText(path);
                    if (data.Length > 0)
                    {
                        // List<ChargerInfoConfig> tempPropertiestcharge = JsonConvert.DeserializeObject<List<ChargerInfoConfig>>(data);
                        //tempPropertiestcharge.ForEach(e => PropertiesCharge_List.Add(e));
                        JArray results = JArray.Parse(data);
                        foreach (var result in results)
                        {
                            ChargerInfoConfig pchr = new ChargerInfoConfig();
                            pchr.Id   = (ChargerId)((int)result["Id"]);
                            pchr.Ip   = (String)result["Ip"];
                            pchr.Port = (int)result["Port"];
                            pchr.PointFrontLineStr = (String)result["PointFrontLineStr"];
                            pchr.ParsePointFrontLineValue(pchr.PointFrontLineStr);

                            pchr.PointFrontLineStrInv = (String)result["PointFrontLineStrInv"];
                            pchr.ParsePointFrontLineValueInv(pchr.PointFrontLineStrInv);

                            pchr.PointOfPallet    = (String)result["PointOfPallet"];
                            pchr.PointOfPalletInv = (String)result["PointOfPalletInv"];
                            ChargerCtrl chargerStation = new ChargerCtrl(pchr);
                            ChargerStationList.Add(chargerStation.cf.Id, chargerStation);
                            PropertiesCharge_List.Add(pchr);
                        }
                        Grouped_PropertiesCharge.Refresh();
                        return(true);
                    }
                }
                catch { }
            }
            return(false);
        }