Beispiel #1
0
        public Form1()
        {
            L4Logger l4Logger = new L4Logger("common.log");

            l4Logger.Add("App Started!");
            l4Logger.Close();

            InitializeComponent();

            // 프로그램 실행시 fwjournal.ini의 첫 주소를 선택한 걸로 셋팅
            InitializeToolBar();

            // 현재주소 메뉴
            InitializeContextMenuStripAddress();

            // 수집옵션 메뉴
            InitializeContextMenuStripCrawlOption();

            InitializeDIManager();
            // RunCrawlAndCheck();
            aTimer           = new System.Timers.Timer(60000);
            aTimer.Elapsed  += OnTimedEvent;
            aTimer.AutoReset = true;
            aTimer.Enabled   = true;

            // 로그파일 출력
            loManagerForCommon  = new LogOutputManager("common", textBoxCommonLog);
            loManagerForAddress = new LogOutputManager("f0", textBoxPrivateLog);
        }
        static public List <Item2> GetFcstSpaceFromDateNCategory(ForecastTimeSpaceResult data, string date, string category)
        {
            List <Item2> result = new List <Item2>();

            int tmpDataCount = 0;

            try
            {
                tmpDataCount = data.response.body.items.item.Count;
            }
            catch (System.NullReferenceException e)
            {
                Console.WriteLine("NullReferenceException : {0}", e.Message);
                L4Logger l4Logger = new L4Logger("common.log");
                l4Logger.Add("System.NullReferenceException!");
                l4Logger.Close();
                return(null);
            }

            for (int i = 0; i < data.response.body.items.item.Count; i++)
            {
                if (category == data.response.body.items.item[i].category &&
                    date == data.response.body.items.item[i].fcstDate.ToString())
                {
                    result.Add(data.response.body.items.item[i]);
                }
            }

            return(result);
        }
        // https://sites.google.com/site/netcorenote/scheduler-in-netcore/quartz/02--tutorial-of-quartz-in-netcore/01-simpleexamplewithquartznet300-alpha2
        public async Task TaskFJJob(string indexNo, string address, string nx, string ny, string crawlTerm, string crawlStatus)
        {
            ISchedulerFactory schedulerFactory = new StdSchedulerFactory();

            schedulerForFJ = schedulerFactory.GetScheduler().Result;
            schedulerForFJ.Start().Wait();

            int crawlTermMin = 0;

            switch (crawlTerm)
            {
            case "1H":
                crawlTermMin = 60;
                break;

            case "30M":
                crawlTermMin = 30;
                break;

            case "1M":
                crawlTermMin = 1;
                break;

            default:
                break;
            }

            int ScheduleIntervalInMinute = crawlTermMin;

            IJobDetail job = JobBuilder.Create <Job>().WithIdentity(indexNo)
                             .UsingJobData("address", address)
                             .UsingJobData("nx", nx)
                             .UsingJobData("ny", ny)
                             .Build();

            ITrigger trigger = TriggerBuilder.Create()
                               .WithIdentity("JobTrigger" + indexNo)
                               .StartNow()
                               // .WithSimpleSchedule(x => x.WithIntervalInSeconds(ScheduleIntervalInMinute).RepeatForever())
                               // https://www.quartz-scheduler.net/documentation/quartz-2.x/tutorial/crontriggers.html
                               // http://devfun.tistory.com/1
                               // .WithCronSchedule("0/30 * 9-20 * * ?")
                               .WithCronSchedule("0 0/30 9-20 * * ?")
                               .Build();

            await schedulerForFJ.ScheduleJob(job, trigger);

            if ("S" == crawlStatus)
            {
                await schedulerForFJ.PauseJob(new JobKey(indexNo));
            }
            Console.WriteLine("TaskFJJob - job:{0}, trigger:{1}", job.ToString(), trigger.ToString());

            // 로그
            L4Logger l4Logger = new L4Logger(indexNo + ".log");

            l4Logger.Add("TaskFJJob - job:" + job.ToString() + ", trigger:" + trigger.ToString());
            l4Logger.Close();
        }
        static public void DeleteLogFile(string fileName)
        {
            string FilePath = AppDomain.CurrentDomain.BaseDirectory + "\\Log\\" + fileName; //실행폴더 아래에 Log폴더

            if (File.Exists(FilePath))
            {
                File.Delete(FilePath);
                L4Logger l4Logger = new L4Logger("common.log");
                l4Logger.Add(FilePath + " is deleted");
                l4Logger.Close();
            }
        }
Beispiel #5
0
        private void 새로운주소ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            FormNewAddress dlgForNewAddress = new FormNewAddress();

            if (DialogResult.OK == dlgForNewAddress.ShowDialog())
            {
                L4Logger l4Logger = new L4Logger("common.log");
                l4Logger.Add("New address added!");
                l4Logger.Close();

                isAddedNewAddress = true;
            }
        }
Beispiel #6
0
        private void 삭제ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (currentSelectedIndex.Contains("f"))
            {
                // 기본적으로 fwjournal.ini 는 삭제못하도록 함.

                /*
                 * FwjournalIniManager fiManager = new FwjournalIniManager();
                 * fiManager.DeleteAddressByIndexNo(currentSelectedIndex);
                 */
                MessageBox.Show("영농일지 관련 데이터(fwjournal.ini)는 삭제할 수 없습니다");
            }
            else
            {
                // 해당 작업 멈추고 삭제
                JobKey jobKey = JobKey.Create(currentSelectedIndex);
                cManager.schedulerForAddr.PauseJob(jobKey);
                cManager.schedulerForAddr.DeleteJob(jobKey);

                // address.ini 에서 삭제
                AddressIniManager aiManager = new AddressIniManager();
                aiManager.DeleteAddressByIndexNo(currentSelectedIndex);

                // 공통 로그파일에 삭제로그 남기기
                L4Logger l4Logger = new L4Logger("common.log");
                l4Logger.Add(currentSelectedIndex + " is deleted");
                l4Logger.Close();

                // 삭제할 인덱스 저장
                // string indexForDelete = currentSelectedIndex;

                // 현재 주소 리스트 초기화
                InitializeContextMenuStripAddress();

                // 툴바 초기화
                ResetToolBar();

                // 로그 출력창 설정
                loManagerForAddress.StopOutput();
                loManagerForAddress = new LogOutputManager(currentSelectedIndex, textBoxPrivateLog);

                // 개별 로그파일 삭제
                // UtilManager.DeleteLogFile(indexForDelete + ".log");
            }
        }
Beispiel #7
0
        private void RunCrawlAndCheck()
        {
            L4Logger l4Logger = new L4Logger("common.log");

            // 수집중이라면 스케쥴러를 모두 셧다운 시킴
            if (null != cManager)
            {
                if (null != cManager.schedulerForFJ && cManager.schedulerForFJ.IsStarted)
                {
                    l4Logger.Add("Shutdown CrawlManager FJ Tasks");
                    cManager.schedulerForFJ.PauseAll();
                    cManager.schedulerForFJ.Shutdown();
                }

                if (null != cManager.schedulerForAddr && cManager.schedulerForAddr.IsStarted)
                {
                    l4Logger.Add("Shutdown CrawlManager Addr Tasks");
                    cManager.schedulerForAddr.PauseAll();
                    cManager.schedulerForAddr.Shutdown();
                }
            }

            // fwjournal.ini, address.ini 읽어서 수집시작
            l4Logger.Add("Start CrawlManager Tasks");
            cManager = new CrawlManager();

            // DB 체크 스케쥴러가 실행중이라면 셧다운 시킴
            if (null != fjDbChecker &&
                null != fjDbChecker.CrawlScheduler &&
                fjDbChecker.CrawlScheduler.IsStarted)
            {
                l4Logger.Add("Shutdown FwjournalDBChecker Tasks");

                fjDbChecker.CrawlScheduler.PauseAll();
                fjDbChecker.CrawlScheduler.Shutdown();
            }

            // fwjournal DB Checker 시작
            l4Logger.Add("Start FwjournalDBChecker Tasks");
            l4Logger.Close();
            fjDbChecker = new FwjournalDBChecker(cManager.schedulerForFJ);
        }
Beispiel #8
0
        private void 모든주소수집정지ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            // 모든 작업 정지
            cManager.schedulerForFJ.PauseAll();
            cManager.schedulerForAddr.PauseAll();

            // *.ini 파일 업데이트
            FwjournalIniManager fjiManager = new FwjournalIniManager();
            AddressIniManager   aiManager  = new AddressIniManager();

            fjiManager.WriteAllCrawlStatus("S");
            aiManager.WriteAllCrawlStatus("S");

            // 현재 주소 리스트 초기화
            InitializeContextMenuStripAddress();

            // 로그
            L4Logger l4Logger = new L4Logger("common.log");

            l4Logger.Add("All tasks paused!");
            l4Logger.Close();
        }
Beispiel #9
0
        public virtual Task Execute(IJobExecutionContext context)
        {
            JobKey jobKey = context.JobDetail.Key;

            // 로그
            lock (ThisLock)
            {
                L4Logger l4Logger = new L4Logger(jobKey.Name + ".log");
                l4Logger.Add("Start Task : " + jobKey.Name);
                l4Logger.Close();
            }

            JobDataMap dataMap = context.JobDetail.JobDataMap;
            string     address = dataMap.GetString("address");
            string     nx      = dataMap.GetString("nx");
            string     ny      = dataMap.GetString("ny");

            Console.WriteLine("IJob says: {0}, address:{1}, nx:{2}, ny:{3}, executing at {4}", jobKey, address, nx, ny, DateTime.Now.ToString("r"));
            WeatherCrawlerData wcd = new WeatherCrawlerData();

            // db.ini 파일을 읽어서 수집서버 DB 연결
            DbIniManager dbIniManager = new DbIniManager();

            dbIniManager.ReadIni();
            DbManager dm = new DbManager(dbIniManager.IpAddress, dbIniManager.DbName, dbIniManager.CollectionName, dbIniManager.Id, dbIniManager.Pw);

            if (dm.Connect())
            {
                // 이미 같은 주소의 데이터가 있는지 체크
                if (dm.IsExistAddress(address))
                {
                    Console.WriteLine("이미 같은 주소의 데이터가 DB에 존재합니다");
                    // 기존 데이터 중 currentData만 보존
                    List <CurrentData> existCD = dm.GetCurrentData(address);

                    // 기존 currentData를 포함하여 데이터 생성
                    wcd = GetAssembledWCD(address, nx, ny, true, existCD);

                    if (null != wcd)
                    {
                        // 기존 데이터 삭제
                        dm.DeleteDocumentByAddress(address);

                        // 수집서버 DB에 데이터 INSERT
                        dm.InsertWeatherData(wcd);
                    }
                }
                else
                {
                    Console.WriteLine("같은 주소의 데이터가 DB에 존재하지 않습니다");
                    wcd = GetAssembledWCD(address, nx, ny, false, null);

                    if (null != wcd)
                    {
                        // 수집서버 DB에 데이터 INSERT
                        dm.InsertWeatherData(wcd);
                    }
                }
            }
            else
            {
                MessageBox.Show("수집서버 DB에 접속할 수 없습니다");
            }

            // 로그
            lock (ThisLock)
            {
                L4Logger l4Logger = new L4Logger(jobKey.Name + ".log");
                l4Logger.Add("End Task : " + jobKey.Name);
                l4Logger.Close();
            }

            return(Task.FromResult(0));
        }
Beispiel #10
0
        private WeatherCrawlerData GetAssembledWCD(string address, string nx, string ny, bool isExistCD, List <CurrentData> existCD)
        {
            // 데이터 수집
            var resultForForecastGrib  = RunHCMForForecastGrib(nx, ny);
            var resultForAirData       = RunHCMAirData(UtilManager.GetUmdFromAddress(address));
            var resultForForecastTime  = RunHCMForForecastTime(nx, ny);
            var resultForForecastSpace = RunHCMForForecastSpace(nx, ny);

            // 데이터 생성
            WeatherCrawlerData wcd = new WeatherCrawlerData();

            wcd.address = address;
            wcd.nx      = Int32.Parse(nx);
            wcd.ny      = Int32.Parse(ny);

            // currentData
            ForecastGribResult reassembledFGR = null;

            try
            {
                reassembledFGR = UtilManager.ReassembleDataForForecastGrib(resultForForecastGrib.Result);
            }
            catch (System.AggregateException e)
            {
                Console.WriteLine("ForecastGribResult AggregateException : {0}", e.Message);
                L4Logger l4Logger = new L4Logger("common.log");
                l4Logger.Add("ForecastGribResult System.AggregateException!");
                l4Logger.Close();
                return(null);
            }

            if (null == reassembledFGR)
            {
                Console.WriteLine("reassembledFGR_Null_Exception");
                L4Logger l4Logger = new L4Logger("common.log");
                l4Logger.Add("reassembledFGR Null Exception!");
                l4Logger.Close();
                return(null);
            }
            CurrentData tmpCD = new CurrentData();

            tmpCD.insertDate       = UtilManager.GetNowDateTime();
            tmpCD.weather          = new Weather();
            tmpCD.weather.baseDate = reassembledFGR.response.body.items.item[0].baseDate.ToString();
            tmpCD.weather.baseTime = reassembledFGR.response.body.items.item[0].baseTime;
            tmpCD.weather.pty      = UtilManager.GetObsrValueFromCategory(reassembledFGR, "PTY");
            tmpCD.weather.reh      = UtilManager.GetObsrValueFromCategory(reassembledFGR, "REH");
            tmpCD.weather.rn1      = UtilManager.GetObsrValueFromCategory(reassembledFGR, "RN1");
            tmpCD.weather.sky      = UtilManager.GetObsrValueFromCategory(reassembledFGR, "SKY");
            tmpCD.weather.t1h      = UtilManager.GetObsrValueFromCategory(reassembledFGR, "T1H");

            AirDataResult adr = null;

            try
            {
                adr = resultForAirData.Result;
            }
            catch (System.AggregateException e)
            {
                Console.WriteLine("AggregateException : {0}", e.Message);
                L4Logger l4Logger = new L4Logger("common.log");
                l4Logger.Add("System.AggregateException!");
                l4Logger.Close();
                return(null);
            }

            if (null == adr)
            {
                Console.WriteLine("adr is Null");
                L4Logger l4Logger = new L4Logger("common.log");
                l4Logger.Add("adr is Null Exception!");
                l4Logger.Close();
                return(null);
            }

            tmpCD.air          = new Air();
            tmpCD.air.dataTime = adr.list[0].dataTime;
            if ("-" == adr.list[0].so2Value)
            {
                tmpCD.air.so2Value = -1;
            }
            else
            {
                tmpCD.air.so2Value = Double.Parse(adr.list[0].so2Value);
            }
            if ("-" == adr.list[0].coValue)
            {
                tmpCD.air.coValue = -1;
            }
            else
            {
                tmpCD.air.coValue = Double.Parse(adr.list[0].coValue);
            }
            if ("-" == adr.list[0].o3Value)
            {
                tmpCD.air.o3Value = -1;
            }
            else
            {
                tmpCD.air.o3Value = Double.Parse(adr.list[0].o3Value);
            }
            if ("-" == adr.list[0].no2Value)
            {
                tmpCD.air.no2Value = -1;
            }
            else
            {
                tmpCD.air.no2Value = Double.Parse(adr.list[0].no2Value);
            }
            if ("-" == adr.list[0].pm10Value)
            {
                tmpCD.air.pm10Value = -1;
            }
            else
            {
                tmpCD.air.pm10Value = Double.Parse(adr.list[0].pm10Value);
            }
            if ("-" == adr.list[0].pm25Value)
            {
                tmpCD.air.pm25Value = -1;
            }
            else
            {
                tmpCD.air.pm25Value = Double.Parse(adr.list[0].pm25Value);
            }

            wcd.currentData = new List <CurrentData>();
            if (isExistCD)
            {
                wcd.currentData = existCD;
            }
            wcd.currentData.Add(tmpCD);

            // twoHour
            int[]  fctTimeTable = { 3, 2, 4, 3, 2, 4, 3, 2, 4, 3, 2, 4, 3, 2, 4, 3, 2, 4, 3, 2, 4, 3, 2, 4 };
            string ftsrHour     = UtilManager.GetFTSRHour();
            int    fctTimeIndex = fctTimeTable[Int32.Parse(ftsrHour)];

            ForecastTimeSpaceResult ftsr = null;

            try
            {
                ftsr = resultForForecastTime.Result;
            }
            catch (System.AggregateException e)
            {
                Console.WriteLine("resultForForecastTime AggregateException : {0}", e.Message);
                L4Logger l4Logger = new L4Logger("common.log");
                l4Logger.Add("resultForForecastTime System.AggregateException!");
                l4Logger.Close();
                return(null);
            }

            if (null == ftsr)
            {
                Console.WriteLine("ftsr is Null");
                L4Logger l4Logger = new L4Logger("common.log");
                l4Logger.Add("ftsr is Null Exception!");
                l4Logger.Close();
                return(null);
            }
            Fcst tmpFcst = new Fcst();

            tmpFcst.insertDate = UtilManager.GetNowDateTime();

            // twoHour - 1Hour
            string startDateTime = UtilManager.GetStartDateTime(ftsr);
            string startDate     = startDateTime.Substring(0, 8);
            string startTime     = startDateTime.Substring(8, 4);

            Item2 tmpItem = UtilManager.GetFcstWeatherFromTimeNCategory(ftsr, startDate, startTime, "PTY");

            tmpFcst.weather = new List <FcstWeather>();
            FcstWeather tmpFW = new FcstWeather();

            tmpFW.fcstDate = tmpItem.fcstDate.ToString();
            tmpFW.fcstTime = tmpItem.fcstTime.ToString();
            tmpFW.pty      = tmpItem.fcstValue;
            tmpItem        = UtilManager.GetFcstWeatherFromTimeNCategory(ftsr, startDate, startTime, "RN1");
            tmpFW.rn1      = tmpItem.fcstValue;
            tmpItem        = UtilManager.GetFcstWeatherFromTimeNCategory(ftsr, startDate, startTime, "SKY");
            tmpFW.sky      = tmpItem.fcstValue;
            tmpItem        = UtilManager.GetFcstWeatherFromTimeNCategory(ftsr, startDate, startTime, "T1H");
            tmpFW.t1h      = tmpItem.fcstValue;
            tmpItem        = UtilManager.GetFcstWeatherFromTimeNCategory(ftsr, startDate, startTime, "REH");
            tmpFW.reh      = tmpItem.fcstValue;
            tmpFcst.weather.Add(tmpFW);

            // twoHour - 2Hour
            string startDatePlusOneHour = UtilManager.GetStartDateTimePlusOneHour(startDateTime);
            string plusOneHourDate      = startDatePlusOneHour.Substring(0, 8);
            string plusOneHourTime      = startDatePlusOneHour.Substring(8, 4);

            tmpItem        = UtilManager.GetFcstWeatherFromTimeNCategory(ftsr, plusOneHourDate, plusOneHourTime, "PTY");
            tmpFW          = new FcstWeather();
            tmpFW.fcstDate = tmpItem.fcstDate.ToString();
            tmpFW.fcstTime = tmpItem.fcstTime.ToString();
            tmpFW.pty      = tmpItem.fcstValue;
            tmpItem        = UtilManager.GetFcstWeatherFromTimeNCategory(ftsr, plusOneHourDate, plusOneHourTime, "RN1");
            tmpFW.rn1      = tmpItem.fcstValue;
            tmpItem        = UtilManager.GetFcstWeatherFromTimeNCategory(ftsr, plusOneHourDate, plusOneHourTime, "SKY");
            tmpFW.sky      = tmpItem.fcstValue;
            tmpItem        = UtilManager.GetFcstWeatherFromTimeNCategory(ftsr, plusOneHourDate, plusOneHourTime, "T1H");
            tmpFW.t1h      = tmpItem.fcstValue;
            tmpItem        = UtilManager.GetFcstWeatherFromTimeNCategory(ftsr, plusOneHourDate, plusOneHourTime, "REH");
            tmpFW.reh      = tmpItem.fcstValue;
            tmpFcst.weather.Add(tmpFW);

            // twoHour - 3Hour
            if (3 <= fctTimeIndex)
            {
                string startDatePlusTwoHour = UtilManager.GetStartDateTimePlusTwoHour(startDateTime);
                string plusTwoHourDate      = startDatePlusTwoHour.Substring(0, 8);
                string plusTwoHourTime      = startDatePlusTwoHour.Substring(8, 4);

                tmpItem        = UtilManager.GetFcstWeatherFromTimeNCategory(ftsr, plusTwoHourDate, plusTwoHourTime, "PTY");
                tmpFW          = new FcstWeather();
                tmpFW.fcstDate = tmpItem.fcstDate.ToString();
                tmpFW.fcstTime = tmpItem.fcstTime.ToString();
                tmpFW.pty      = tmpItem.fcstValue;
                tmpItem        = UtilManager.GetFcstWeatherFromTimeNCategory(ftsr, plusTwoHourDate, plusTwoHourTime, "RN1");
                tmpFW.rn1      = tmpItem.fcstValue;
                tmpItem        = UtilManager.GetFcstWeatherFromTimeNCategory(ftsr, plusTwoHourDate, plusTwoHourTime, "SKY");
                tmpFW.sky      = tmpItem.fcstValue;
                tmpItem        = UtilManager.GetFcstWeatherFromTimeNCategory(ftsr, plusTwoHourDate, plusTwoHourTime, "T1H");
                tmpFW.t1h      = tmpItem.fcstValue;
                tmpItem        = UtilManager.GetFcstWeatherFromTimeNCategory(ftsr, plusTwoHourDate, plusTwoHourTime, "REH");
                tmpFW.reh      = tmpItem.fcstValue;
                tmpFcst.weather.Add(tmpFW);
            }

            // twoHour - 4Hour
            if (4 == fctTimeIndex)
            {
                string startDatePlusThreeHour = UtilManager.GetStartDateTimePlusThreeHour(startDateTime);
                string plusThreeHourDate      = startDatePlusThreeHour.Substring(0, 8);
                string plusThreeHourTime      = startDatePlusThreeHour.Substring(8, 4);

                tmpItem        = UtilManager.GetFcstWeatherFromTimeNCategory(ftsr, plusThreeHourDate, plusThreeHourTime, "PTY");
                tmpFW          = new FcstWeather();
                tmpFW.fcstDate = tmpItem.fcstDate.ToString();
                tmpFW.fcstTime = tmpItem.fcstTime.ToString();
                tmpFW.pty      = tmpItem.fcstValue;
                tmpItem        = UtilManager.GetFcstWeatherFromTimeNCategory(ftsr, plusThreeHourDate, plusThreeHourTime, "RN1");
                tmpFW.rn1      = tmpItem.fcstValue;
                tmpItem        = UtilManager.GetFcstWeatherFromTimeNCategory(ftsr, plusThreeHourDate, plusThreeHourTime, "SKY");
                tmpFW.sky      = tmpItem.fcstValue;
                tmpItem        = UtilManager.GetFcstWeatherFromTimeNCategory(ftsr, plusThreeHourDate, plusThreeHourTime, "T1H");
                tmpFW.t1h      = tmpItem.fcstValue;
                tmpItem        = UtilManager.GetFcstWeatherFromTimeNCategory(ftsr, plusThreeHourDate, plusThreeHourTime, "REH");
                tmpFW.reh      = tmpItem.fcstValue;
                tmpFcst.weather.Add(tmpFW);
            }

            wcd.twoHour = tmpFcst;

            // tomorrow
            ftsr = resultForForecastSpace.Result;

            if (null == ftsr)
            {
                Console.WriteLine("resultForForecastSpace.Result is null");
                L4Logger l4Logger = new L4Logger("common.log");
                l4Logger.Add("resultForForecastSpace.Result is null!");
                l4Logger.Close();
                return(null);
            }

            Fcst2 tmpFcst2 = new Fcst2();

            tmpFcst2.insertDate = UtilManager.GetNowDateTime();

            string tomorrowDate = UtilManager.GetTomorrowDate();

            List <Item2> tmpItemsPTY = UtilManager.GetFcstSpaceFromDateNCategory(ftsr, tomorrowDate, "PTY");

            if (null == tmpItemsPTY)
            {
                return(null);
            }
            List <Item2> tmpItemsR06 = UtilManager.GetFcstSpaceFromDateNCategory(ftsr, tomorrowDate, "R06");

            if (null == tmpItemsR06)
            {
                return(null);
            }
            List <Item2> tmpItemsSKY = UtilManager.GetFcstSpaceFromDateNCategory(ftsr, tomorrowDate, "SKY");

            if (null == tmpItemsSKY)
            {
                return(null);
            }
            List <Item2> tmpItemsT3H = UtilManager.GetFcstSpaceFromDateNCategory(ftsr, tomorrowDate, "T3H");

            if (null == tmpItemsT3H)
            {
                return(null);
            }
            List <Item2> tmpItemsREH = UtilManager.GetFcstSpaceFromDateNCategory(ftsr, tomorrowDate, "REH");

            if (null == tmpItemsREH)
            {
                return(null);
            }

            tmpFcst2.weather = new List <FcstWeather2>();
            for (int i = 0; i < tmpItemsPTY.Count; i++)
            {
                FcstWeather2 tmpFW2 = new FcstWeather2();
                tmpFW2.fcstDate = tmpItemsPTY[i].fcstDate;
                tmpFW2.fcstTime = tmpItemsPTY[i].fcstTime;
                tmpFW2.pty      = tmpItemsPTY[i].fcstValue;
                if (0 == i % 2)
                {
                    tmpFW2.r06 = tmpItemsR06[i / 2].fcstValue;
                }
                tmpFW2.sky = tmpItemsSKY[i].fcstValue;
                tmpFW2.t3h = tmpItemsT3H[i].fcstValue;
                tmpFW2.reh = tmpItemsREH[i].fcstValue;
                tmpFcst2.weather.Add(tmpFW2);
            }

            wcd.tomorrow = tmpFcst2;

            // afterTomorrow
            tmpFcst2            = new Fcst2();
            tmpFcst2.insertDate = UtilManager.GetNowDateTime();
            string afterTomorrowDate = UtilManager.GetAfterTomorrowDate();

            tmpItemsPTY = UtilManager.GetFcstSpaceFromDateNCategory(ftsr, afterTomorrowDate, "PTY");
            tmpItemsR06 = UtilManager.GetFcstSpaceFromDateNCategory(ftsr, afterTomorrowDate, "R06");
            tmpItemsSKY = UtilManager.GetFcstSpaceFromDateNCategory(ftsr, afterTomorrowDate, "SKY");
            tmpItemsT3H = UtilManager.GetFcstSpaceFromDateNCategory(ftsr, afterTomorrowDate, "T3H");
            tmpItemsREH = UtilManager.GetFcstSpaceFromDateNCategory(ftsr, afterTomorrowDate, "REH");

            tmpFcst2.weather = new List <FcstWeather2>();
            for (int i = 0; i < tmpItemsPTY.Count; i++)
            {
                FcstWeather2 tmpFW2 = new FcstWeather2();
                tmpFW2.fcstDate = tmpItemsPTY[i].fcstDate;
                tmpFW2.fcstTime = tmpItemsPTY[i].fcstTime;
                tmpFW2.pty      = tmpItemsPTY[i].fcstValue;
                if (0 == i % 2)
                {
                    tmpFW2.r06 = tmpItemsR06[i / 2].fcstValue;
                }
                tmpFW2.sky = tmpItemsSKY[i].fcstValue;
                tmpFW2.t3h = tmpItemsT3H[i].fcstValue;
                tmpFW2.reh = tmpItemsREH[i].fcstValue;
                tmpFcst2.weather.Add(tmpFW2);
            }

            wcd.afterTomorrow = tmpFcst2;

            return(wcd);
        }