예제 #1
0
        public void AstroQueueUpdateExposure(String jSon)
        {
            jSon = StringCompression.DecompressString(jSon);
            JObject obj = JObject.Parse(jSon);

            STATIONNAME    stationName        = TTCSHelper.StationStrConveter(obj["StationName"].ToString());
            String         Id                 = obj["Id"].ToString();
            String         AstroQueueId       = obj["AstroQueueId"].ToString();
            ExposedHistory exposedHistoryRecv = (ExposedHistory)JsonConvert.DeserializeObject(obj["ExposedHistory"].ToString(), typeof(ExposedHistory));

            Console.WriteLine("[AstroQueueUpdateExposure] " + obj["StationName"] + " : " + exposedHistoryRecv.filterName + " --> " + Id);

            AstroQueueImpl astroQueue     = DBQueueEngine.FindById(stationName, AstroQueueId);
            ExposedHistory exposedHistory = astroQueue.Target.exposedHistory.Find(Item => Item.filterName == exposedHistoryRecv.filterName && Item.executedStatus == EXECUTESTATUS.WAIT);

            if (exposedHistory != null)
            {
                exposedHistory.executedStatus = exposedHistoryRecv.executedStatus;
                exposedHistory.executedDate   = exposedHistoryRecv.executedDate;

                astroQueue.Save();

                Task task = Task.Run(async() =>
                {
                    await Task.Delay(100);

                    StationHandler StationCommunication = AstroData.GetStationObject(stationName);
                    StationCommunication.AckExposure(Id, SENDING_STATUS.COMPLETED);
                });
            }
        }
예제 #2
0
        //--------------------------------------------------------------------------------------Queue----------------------------------------------------------------------------------

        public void AstroQueueUpdate(String jSon)
        {
            jSon = StringCompression.DecompressString(jSon);
            JObject obj = JObject.Parse(jSon);

            STATIONNAME stationName = TTCSHelper.StationStrConveter(obj["StationName"].ToString());
            String      Id          = obj["Id"].ToString();
            String      Event       = obj["Event"].ToString();
            DateTime    TimeStamp   = DateTime.Parse(obj["TimeStamp"].ToString());

            Console.WriteLine("[AstroQueueUpdate] " + obj["StationName"] + " : " + obj["Event"] + " --> " + Id);

            AstroQueueImpl astroQueue = DBQueueEngine.FindById(stationName, Id);

            if (Event == "RECEIVED")
            {
                QueueStatus queueStatus = new QueueStatus(QUEUE_STATUS.WAITINGSTATION, SENDING_STATUS.COMPLETED, TimeStamp);

                astroQueue.QueueStatus.Add(queueStatus);
                astroQueue.Save();
            }

            Task task = Task.Run(async() =>
            {
                await Task.Delay(100);

                StationHandler StationCommunication = AstroData.GetStationObject(stationName);
                StationCommunication.AckTarget(astroQueue, QUEUE_STATUS.WAITINGSTATION, SENDING_STATUS.COMPLETED);
            });
        }