Beispiel #1
0
        public void start(SCApplication app)
        {
            vehicleBLL          = app.VehicleBLL;
            vehicleService      = app.VehicleService;
            segmentBLL          = app.SegmentBLL;
            addressesBLL        = app.AddressesBLL;
            guideBLL            = app.GuideBLL;
            cmdBLL              = app.CMDBLL;
            unitBLL             = app.UnitBLL;
            commObjCacheManager = app.getCommObjCacheManager();
            var vhs = app.getEQObjCacheManager().getAllVehicle();

            lineService = app.LineService;
            foreach (AVEHICLE vh in vhs)
            {
                vh.CommandComplete       += Vh_CommandComplete;
                vh.BatteryLevelChange    += Vh_BatteryLevelChange;
                vh.BatteryCapacityChange += Vh_BatteryCapacityChange;
            }

            //註冊各個Coupler的Status變化,在有其中一個有變化的時候要通知AGV目前所有coupler的狀態
            List <AUNIT> chargers = unitBLL.OperateCatch.loadUnits();

            foreach (AUNIT charger in chargers)
            {
                //charger.CouplerStatusChanged += Charger_CouplerStatusChanged;
                charger.CouplerHPSafetyChaged += Charger_CouplerHPSafetyChaged;
            }
        }
Beispiel #2
0
        public void GetSegmentsTest()
        {
            SegmentBLL     target   = new SegmentBLL(); // TODO: Initialize to an appropriate value
            List <Segment> expected = null;             // TODO: Initialize to an appropriate value
            List <Segment> actual;

            actual = target.GetSegments();
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }
Beispiel #3
0
        public void GetSegmentbyPlantIDTest1()
        {
            SegmentBLL target  = new SegmentBLL();           // TODO: Initialize to an appropriate value
            int        plantID = 0;                          // TODO: Initialize to an appropriate value
            List <ViewPlantWorkshopSegment> expected = null; // TODO: Initialize to an appropriate value
            List <ViewPlantWorkshopSegment> actual;

            actual = target.GetSegmentbyPlantID(plantID);
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }
Beispiel #4
0
        public void start(SCApplication app)
        {
            vehicleBLL          = app.VehicleBLL;
            vehicleService      = app.VehicleService;
            segmentBLL          = app.SegmentBLL;
            addressesBLL        = app.AddressesBLL;
            guideBLL            = app.GuideBLL;
            cmdBLL              = app.CMDBLL;
            unitBLL             = app.UnitBLL;
            commObjCacheManager = app.getCommObjCacheManager();
            var vhs = app.getEQObjCacheManager().getAllVehicle();

            foreach (AVEHICLE vh in vhs)
            {
                vh.CommandComplete       += Vh_CommandComplete;
                vh.BatteryLevelChange    += Vh_BatteryLevelChange;
                vh.BatteryCapacityChange += Vh_BatteryCapacityChange;
            }
        }
Beispiel #5
0
 private void btnShowWordCloud_Click(object sender, EventArgs e)
 {
     if (radDictionary.Checked)
     {
         string result = WordDictBLL.ShowKeyWordWeightColl(objKeyWordColl, Convert.ToInt32(numericUpDown1.Value), chkOrderBy.Checked, chkIsOnlyWord.Checked);
         this.richTextBox1.Text = result;
     }
     if (radSegment.Checked)
     {
         using (StringReader sr = new StringReader(this.tbCoreWordList.Text))
         {
             StringBuilder sb = new StringBuilder();
             Dictionary <string, double> dictValue = new Dictionary <string, double>();
             string line = null;
             while ((line = sr.ReadLine()) != null)
             {
                 List <string> objKeyWordList = SegmentBLL.Segment(line, objCharBondColl, objKeyWordColl, 7, false, false);
                 foreach (string keyword in objKeyWordList)
                 {
                     if (!dictValue.ContainsKey(keyword))
                     {
                         dictValue.Add(keyword, !objKeyWordColl.Contains(keyword)?0: -Math.Log(objKeyWordColl[keyword].ValidCount / objKeyWordColl.MinuteOffsetSize));
                     }
                     else
                     {
                         dictValue[keyword] += !objKeyWordColl.Contains(keyword) ? 0 : -Math.Log(objKeyWordColl[keyword].ValidCount / objKeyWordColl.MinuteOffsetSize);
                     }
                 }
                 sb.AppendLine(SegmentBLL.ShowSegment(objKeyWordList));
             }
             sb.AppendLine();
             var buffer = from x in dictValue
                          orderby x.Value descending
                          select x;
             foreach (var x in buffer)
             {
                 sb.AppendLine(String.Format("【{0}】{1}", x.Key, Math.Round(x.Value, 4)));
             }
             this.richTextBox1.Text = sb.ToString();
         }
     }
 }
Beispiel #6
0
        public void SegmentBLLConstructorTest1()
        {
            SegmentBLL target = new SegmentBLL();

            Assert.Inconclusive("TODO: Implement code to verify target");
        }
Beispiel #7
0
        private void CatchWordIndexColl()
        {
            objCharBondColl.MinuteOffsetSize = Convert.ToInt32(nmbReadSpeed.Value) * 60 * 60 * 24 * 6;
            objKeyWordColl.MinuteOffsetSize  = Convert.ToInt32(nmbReadSpeed.Value) * 60 * 60 * 24 * 6;
            Encoding objEncoding = GetEncoding();

            if (!String.IsNullOrWhiteSpace(this.tbCoreWordList.Text))
            {
                if (radSegment.Checked)
                {
                    AppendText(SegmentBLL.ShowSegment(SegmentBLL.Segment(this.tbCoreWordList.Text, objCharBondColl, objKeyWordColl, 4, true, true)));
                    return;
                }
            }

            DateTime dtStartTime = DateTime.Now;

            if (radFileMode.Checked)
            {
                string sPathFile = this.tbFilePath.Text;
                if (File.Exists(sPathFile))
                {
                    this.AppendText(String.Format("【进行】{0}", sPathFile));

                    FileInfo info            = new FileInfo(sPathFile);
                    double   dFileCharLength = info.Length / 2 + 1;
                    double   dLoadCharCount  = 0;
                    double   dTempCharCount  = objCharBondColl.OffsetTotalCount;

                    DateTime dtUpdateTime = DateTime.Now;
                    this.progressBar1.Maximum = Convert.ToInt32(dFileCharLength);
                    this.progressBar1.Minimum = 0;
                    this.progressBar1.Value   = this.progressBar1.Minimum;
                    using (StreamReader sr = new StreamReader(sPathFile, objEncoding))
                    {
                        string line = null;
                        while ((line = sr.ReadLine()) != null)
                        {
                            Application.DoEvents();

                            if (!String.IsNullOrWhiteSpace(line))
                            {
                                line = Regex.Replace(Regex.Replace(line, @"\p{C}+", ""), "<.*?>", "", RegexOptions.IgnoreCase | RegexOptions.Singleline);                                  //去除可能的控制符、Html标签
                            }
                            if (String.IsNullOrWhiteSpace(line))
                            {
                                continue;
                            }


                            dLoadCharCount         += line.Length;
                            dTempCharCount         += line.Length;
                            this.progressBar1.Value = this.progressBar1.Maximum > dLoadCharCount?Convert.ToInt32(dLoadCharCount) : this.progressBar1.Maximum - 1;

                            string text = line; //这里可以再做一些需要特别处理的数据清洗,如多余的空格等

                            if (!String.IsNullOrEmpty(text))
                            {
                                if (this.chkDelayTime.Checked)
                                {
                                    dtUpdateTime = dtPickerUpdateTime.Value.AddSeconds(dLoadCharCount / (double)nmbReadSpeed.Value);
                                }

                                if (radDictionary.Checked)
                                {
                                    //当数据跑过一个周期的数据时清理一次邻键集、词库,避免内存空间不足
                                    if (dTempCharCount > objCharBondColl.MinuteOffsetSize)
                                    {
                                        DictionaryDAL.ClearMemoryBondColl <string>(objCharBondColl);
                                        DictionaryDAL.ClearMemoryItemColl <string>(objKeyWordColl);
                                        dTempCharCount = 0;
                                    }

                                    WordDictBLL.UpdateKeyWordColl(text, objCharBondColl, objKeyWordColl);
                                }

                                if (radSegment.Checked)
                                {
                                    AppendText(SegmentBLL.ShowSegment(SegmentBLL.Segment(text, objCharBondColl, objKeyWordColl, 4, true, true)));
                                }
                            }
                        }
                    }
                    this.progressBar1.Value = this.progressBar1.Maximum;
                    this.progressBar1.Value = this.progressBar1.Minimum;
                    if (this.chkDelayTime.Checked)
                    {
                        dtPickerUpdateTime.Value = dtPickerUpdateTime.Value.AddSeconds(dLoadCharCount / (double)nmbReadSpeed.Value);
                    }
                }
            }

            if (radFloderMode.Checked)
            {
                if (Directory.Exists(this.tbFilePath.Text))
                {
                    double   dTempCharCount = objCharBondColl.OffsetTotalCount;
                    string[] objFileColl    = Directory.GetFiles(this.tbFilePath.Text, "*.txt", SearchOption.AllDirectories);
                    foreach (string sPathFile in objFileColl)
                    {
                        if (File.Exists(sPathFile))
                        {
                            double dLoadCharCount = 0;
                            this.AppendText(String.Format("【进行】{0}", sPathFile));

                            FileInfo info            = new FileInfo(sPathFile);
                            double   dFileCharLength = info.Length / 2 + 1;

                            DateTime dtUpdateTime = DateTime.Now;
                            this.progressBar1.Maximum = Convert.ToInt32(dFileCharLength);
                            this.progressBar1.Minimum = 0;
                            this.progressBar1.Value   = this.progressBar1.Minimum;
                            using (StreamReader sr = new StreamReader(sPathFile, objEncoding))
                            {
                                string line = null;
                                while ((line = sr.ReadLine()) != null)
                                {
                                    Application.DoEvents();

                                    if (!String.IsNullOrWhiteSpace(line))
                                    {
                                        line = Regex.Replace(Regex.Replace(line, @"\p{C}+", ""), "<.*?>", "", RegexOptions.IgnoreCase | RegexOptions.Singleline);                                  //去除可能的控制符、Html标签
                                    }
                                    if (String.IsNullOrWhiteSpace(line))
                                    {
                                        continue;
                                    }


                                    dLoadCharCount         += line.Length;
                                    dTempCharCount         += line.Length;
                                    this.progressBar1.Value = this.progressBar1.Maximum > dLoadCharCount?Convert.ToInt32(dLoadCharCount) : this.progressBar1.Maximum - 1;

                                    string text = line; //这里可以再做一些需要特别处理的数据清洗,如多余的空格等

                                    if (!String.IsNullOrEmpty(text))
                                    {
                                        if (this.chkDelayTime.Checked)
                                        {
                                            dtUpdateTime = dtPickerUpdateTime.Value.AddSeconds(dLoadCharCount / (double)nmbReadSpeed.Value);
                                        }

                                        if (radDictionary.Checked)
                                        {
                                            //当数据跑过一个周期的数据时清理一次邻键集、词库,避免内存空间不足
                                            if (dTempCharCount > objCharBondColl.MinuteOffsetSize)
                                            {
                                                DictionaryDAL.ClearMemoryBondColl <string>(objCharBondColl);
                                                DictionaryDAL.ClearMemoryItemColl <string>(objKeyWordColl);
                                                dTempCharCount = 0;
                                            }

                                            WordDictBLL.UpdateKeyWordColl(text, objCharBondColl, objKeyWordColl);
                                        }

                                        if (radSegment.Checked)
                                        {
                                            AppendText(SegmentBLL.ShowSegment(SegmentBLL.Segment(text, objCharBondColl, objKeyWordColl, 4, true, true)));
                                        }
                                    }
                                }
                            }
                            this.progressBar1.Value = this.progressBar1.Maximum;
                            this.progressBar1.Value = this.progressBar1.Minimum;
                            if (this.chkDelayTime.Checked)
                            {
                                dtPickerUpdateTime.Value = dtPickerUpdateTime.Value.AddSeconds(dLoadCharCount / (double)nmbReadSpeed.Value);
                            }
                        }
                    }
                }
            }
            AppendText(String.Format("完成,共用时{0}秒。", (DateTime.Now - dtStartTime).ToString()));
        }
        public WindownApplication()
        {
            ViewerID         = getString("Viewer_ID", "");
            webClientManager = WebClientManager.getInstance();

            ObjCacheManager = new ObjCacheManager(this);

            elasticSearchManager = new ElasticSearchManager();

            RailDao             = new RAILDao();
            AddressDao          = new ADDRESSDao();
            PortIconDao         = new PortIconDao();
            PointDao            = new POINTDao();
            GroupRailDao        = new GROUPRAILSDao();
            SegmentDao          = new SegmentDao();
            SectionDao          = new SectionDao();
            PortDao             = new PortDao();
            VehicleDao          = new VehicleDao();
            UserDao             = new UserDao();
            UserGroupDao        = new UserGroupDao();
            UserFuncDao         = new UserFuncDao();
            FunctionCodeDao     = new FunctionCodeDao();
            CMD_OHTCDao         = new CMD_OHTCDao();
            CMD_MCSDao          = new CMD_MCSDao();
            VCMD_MCSDao         = new VCMD_MCSDao();
            PortStationDao      = new PortStationDao();
            AlarmDao            = new AlarmDao();
            MapBLL              = new MapBLL(this);
            UserBLL             = new UserBLL(this);
            OperationHistoryBLL = new OperationHistoryBLL(this);
            CmdBLL              = new CmdBLL(this);
            AlarmBLL            = new AlarmBLL(this);
            PortStationBLL      = new PortStationBLL(this);
            SegmentBLL          = new SegmentBLL(this);
            ObjCacheManager.start();
            ID = ObjCacheManager.MapId;

            LineBLL             = new LineBLL(this);
            VehicleBLL          = new VehicleBLL(this);
            SysExcuteQualityBLL = new SysExcuteQualityBLL(this);

            dBTableWatcher = new EventAction.DBTableWatcher(this);
            dBTableWatcher.initStart();
            // setEFConnectionString(ObjCacheManager.EFConnectionString);



            SysExcuteQualityQueryService = new SysExcuteQualityQueryService(this);
            //initBackgroundWork();
            //  SysExcuteQualityQueryService = new SysExcuteQualityQueryService();
            switch (WindownApplication.OHxCFormMode)
            {
            case OHxCFormMode.CurrentPlayer:
                natsManager       = new NatsManager(ID, "nats-cluster", ViewerID);
                redisCacheManager = new RedisCacheManager(ID);
                SubscriberNatsEvent();
                SubscriberDBTableWatcherEvent();
                //SysExcuteQualityQueryService.start();
                break;

            case OHxCFormMode.HistoricalPlayer:
                HistoricalReplyService = new HistoricalReplyService(this);
                //HistoricalReplyService.loadVhHistoricalInfo();
                break;
            }
            //VehicleBLL.ReguestViewerUpdate();
        }