示例#1
0
    private void AddTask(FaultList faultList)
    {
        var child = Instantiate(taskPrefab, taskParent);

        child.Set(faultList);
        spawnedTasks.Add(child.transform);
    }
示例#2
0
        private bool ParseCurrentInformation()
        {
            if (_result == null)
            {
                return(false);
            }

            var vbList = _result.Pdu.VbList;
            var portA  = new PortAConfiguration((Integer32)vbList[1].Value,  //frequency
                                                (Integer32)vbList[2].Value,  //mute
                                                (Integer32)vbList[3].Value,  //mute configure
                                                (Integer32)vbList[4].Value,  //attenuator
                                                (Integer32)vbList[5].Value,  //slope
                                                (Integer32)vbList[7].Value); //inverse

            var portB = new PortBConfiguration((Integer32)vbList[9].Value,   //frequency
                                               (Integer32)vbList[10].Value,  //mute
                                               (Integer32)vbList[11].Value,  //mute configure
                                               (Integer32)vbList[12].Value,  //attenuator
                                               (Integer32)vbList[13].Value,  //slope
                                               (Integer32)vbList[14].Value); //inverse

            _logger.WriteAsIs(portA.ToString());
            _logger.WriteAsIs(portB.ToString());

            var faults = new FaultList((Integer32)vbList[15].Value,
                                       (Integer32)vbList[16].Value,
                                       (Integer32)vbList[17].Value,
                                       (Integer32)vbList[18].Value,
                                       (Integer32)vbList[19].Value,
                                       (Integer32)vbList[20].Value,
                                       (Integer32)vbList[21].Value,
                                       (Integer32)vbList[22].Value,
                                       (Integer32)vbList[23].Value,
                                       (Integer32)vbList[24].Value,
                                       (Integer32)vbList[25].Value,
                                       (Integer32)vbList[26].Value,
                                       (Integer32)vbList[27].Value);

            Status = new Lbc4000Status(portA, portB, faults);
            return(true);
        }
示例#3
0
    public void Set(FaultList faultList)
    {
        stationIndicator.sprite =
            Constants.InstructionIcons[Tuple.Create(
                                           "station",
                                           faultList.station_id
                                           )];


        foreach (var chunk in faultList.chunks)
        {
            var componentName = chunk.component_name;
            foreach (var target in chunk.targets)
            {
                var sprite = Constants.InstructionIcons[
                    Tuple.Create(
                        componentName,
                        target.target_value
                        )
                             ];
                AddIcon(sprite);
            }
        }
    }
示例#4
0
        // GET: Faults
        public ActionResult Index()
        {
            List <Faults> FL = new List <Faults>();


            FL.Add(new Faults()
            {
                Category = "Under Bonnet", Fault = "Accelerator Operation", Checked = false, Price = 100
            });
            FL.Add(new Faults()
            {
                Category = "Under Bonnet", Fault = "Engine Performance", Checked = false, Price = 100
            });
            FL.Add(new Faults()
            {
                Category = "Under Bonnet", Fault = "Battery load test", Checked = false, Price = 100
            });
            FL.Add(new Faults()
            {
                Category = "Under Bonnet", Fault = "Condition of Spark plugs", Checked = false, Price = 100
            });
            FL.Add(new Faults()
            {
                Category = "Under Bonnet", Fault = "Condition of engine oil & level", Checked = false, Price = 100
            });
            FL.Add(new Faults()
            {
                Category = "Under Body", Fault = "Condition of ball joints", Checked = false, Price = 100
            });
            FL.Add(new Faults()
            {
                Category = "Under Body", Fault = "Condition of brake disks & drums", Checked = false, Price = 100
            });
            FL.Add(new Faults()
            {
                Category = "Under Body", Fault = "Inspect wheel alignment, if necessary rotate & balance", Checked = false, Price = 100
            });
            FL.Add(new Faults()
            {
                Category = "Under Body", Fault = "Condition of CV joints & boots", Checked = false, Price = 100
            });
            FL.Add(new Faults()
            {
                Category = "Under Body", Fault = "Check for exhaust leaks", Checked = false, Price = 100
            });
            FL.Add(new Faults()
            {
                Category = "External Condition", Fault = "Condition of exterior lights and operations", Checked = false, Price = 100
            });
            FL.Add(new Faults()
            {
                Category = "External Condition", Fault = "Condition of front & rear wiper blade & operation", Checked = false, Price = 100
            });
            FL.Add(new Faults()
            {
                Category = "External Condition", Fault = "Condition of windscreen chips/cracks", Checked = false, Price = 100
            });
            FL.Add(new Faults()
            {
                Category = "External Condition", Fault = "Whells-Condition of mags/rims/hubcaps", Checked = false, Price = 100
            });
            FL.Add(new Faults()
            {
                Category = "External Condition", Fault = "Operation of Jack & tools", Checked = false, Price = 100
            });
            FL.Add(new Faults()
            {
                Category = "Internal Condition", Fault = "Air conditioner operation", Checked = false, Price = 100
            });
            FL.Add(new Faults()
            {
                Category = "Internal Condition", Fault = "Operation of air vents and fan", Checked = false, Price = 100
            });
            FL.Add(new Faults()
            {
                Category = "Internal Condition", Fault = "Operation of guages & speedo", Checked = false, Price = 100
            });
            FL.Add(new Faults()
            {
                Category = "Internal Condition", Fault = "Check hooter operation", Checked = false, Price = 100
            });
            FL.Add(new Faults()
            {
                Category = "Internal Condition", Fault = "Condition of upholstery", Checked = false, Price = 100
            });

            FaultList fltlist = new FaultList();

            fltlist.faults = FL;
            return(View(fltlist));
        }
示例#5
0
        public ActionResult Index(FaultList frl)
        {
            StringBuilder sb = new StringBuilder();
            //JobCard j = new JobCard();
            // sb.Append("Faults:");
            //JobCard j = new JobCard();
            List <JobCard> jl = new List <JobCard>();

            foreach (var item in frl.faults)
            {
                if (item.Checked)
                {
                    sb.Append(item.Fault + ",");
                    //item.p = item.p + item.Price;
                }
            }
            //FaultList f = new FaultList();
            //int max = db.JobCards.Max(p => p.JobCardId);

            //foreach (JobCard search in jl)
            //{
            //    if (search.TechFaults == null)
            //    {
            //        j.JobCardId = 122;
            //        j.RegId = "ND 1";
            //        j.UserFaults = "Wooo";
            //        j.TechFaults = sb.ToString();
            //        db.JobCards.Add(j);
            //    }
            //}


            //List<JobCards> companiesWithEmployees = db.JobCards.ToList();
            //JobCards ces = JobCards
            //        .Find(x => x.Employees==companiesWithEmployees.R

            //j.JobCardId = max;
            //j.TechFaults = sb.ToString();
            sb.Remove(sb.ToString().LastIndexOf(","), 1);
            //j.TechFaults = sb.ToString();

            //var model = new JobCards()
            //{
            //    TechFaults = sb.ToString()
            //};
            //TempData["ModelName"] = model;
            //StringBuilder st = new StringBuilder();
            //foreach (var item in jl)
            //{
            //    if (item.RegId != null)
            //    {
            //        st.Append(item.RegId + ",");
            //        //item.p = item.p + item.Price;



            //    }
            //}
            JobCard jobCard = Session["jcData"] as JobCard;

            jobCard.Techfaults  = sb.ToString();
            ViewBag.selectFault = "selected faults are:" + sb.ToString();



            db.JobCards.Add(jobCard);
            db.SaveChanges();
            return(RedirectToAction("GetJobCardsSA", "JobCard"));
        }
示例#6
0
        /// <summary>
        /// 添加故障排名前十的列表
        /// </summary>
        public void AddFaultData(string Date)
        {
            DataTable dt = new DataTable("Fault");

            dt.Columns.Add("ID", typeof(int));
            dt.Columns.Add("Number", typeof(int));
            dt.Columns.Add("Duration", typeof(int));

            string    allsql  = $"SELECT * FROM DetailedFault WHERE Day = '{Date}'";
            DataTable Alldata = SQLiteHelp.ExecuteQuery(allsql);

            // 判断是否有数据
            if (Alldata.Rows.Count > 0)
            {
                var DayTime = DateTime.Today.ToShortDateString();
                for (int i = 0; i < MainWindow.FaultMessageList.Length; i++)
                {
                    string    sql  = $"SELECT ID, sum(Number),sum(Duration) FROM DetailedFault WHERE Day = '{DayTime}' AND ID = {i}";
                    DataTable data = SQLiteHelp.ExecuteQuery(sql);
                    dt.Rows.Add(
                        data.Rows[0][0],
                        data.Rows[0][1],
                        data.Rows[0][2]
                        );
                }

                // 排序表格
                DataView dv = dt.DefaultView;
                dv.Sort = "Number DESC";
                dt      = dv.ToTable();

                // 取表格前几位
                DataTable NewTable = DtSelectTop(10, dt);

                // 获取故障总数
                string    ratiosql  = $"SELECT sum(Number) FROM DetailedFault WHERE Day = '{DayTime}'";
                DataTable ToyalData = SQLiteHelp.ExecuteQuery(ratiosql);

                int TotalValue = 0;
                if (ToyalData.Rows[0][0].ToString() != "")
                {
                    TotalValue = int.Parse(ToyalData.Rows[0][0].ToString());
                }

                // 添加表格体数据
                for (int i = 0; i < NewTable.Rows.Count; i++)
                {
                    // 格式化时间信息
                    double FaultTime   = double.Parse(NewTable.Rows[i][2].ToString());
                    string TimeFormate = $"{Math.Floor(FaultTime / 3600)}时{Math.Floor((FaultTime - (Math.Floor(FaultTime / 3600) * 3600)) / 60)}分";

                    // 添加表格信息
                    FaultList.Add(new FaultFormat()
                    {
                        FaultName   = MainWindow.FaultMessageList[int.Parse(NewTable.Rows[i][0].ToString())],
                        FaultNumber = NewTable.Rows[i][1].ToString(),
                        Ratio       = (double.Parse(NewTable.Rows[i][1].ToString()) / TotalValue).ToString("P2"),
                        Time        = TimeFormate,
                    });
                }
            }



            // 循环刷新
            timerNotice          = new System.Timers.Timer();
            timerNotice.Elapsed += new System.Timers.ElapsedEventHandler((o, eea) =>
            {
                ChangeTableData();
            });
            timerNotice.Interval = MainWindow.Time * 10;
            timerNotice.Start();
        }