public void Execute(JobRunContext context)
        {
            string hql = @"select t.OrderNo from TransportationOrder as t where t.Status = ?";

            IList<string> orderNoList = hqlMgr.FindAll<string>(hql, BusinessConstants.CODE_MASTER_STATUS_VALUE_INPROCESS);
            if (orderNoList != null && orderNoList.Count > 0)
            {
                foreach (string orderNo in orderNoList)
                {
                    try
                    {
                        string dhql = @"select d from TransportationOrderDetail as d where d.TransportationOrder.OrderNo = ?";

                        IList<TransportationOrderDetail> transportationOrderDetailList = hqlMgr.FindAll<TransportationOrderDetail>(dhql, orderNo);
                        var q = transportationOrderDetailList.Where(t => t.InProcessLocation.Status == BusinessConstants.CODE_MASTER_STATUS_VALUE_CREATE ||
                                                                         t.InProcessLocation.Status == BusinessConstants.CODE_MASTER_STATUS_VALUE_INPROCESS);
                        if (q.ToList() == null || q.ToList().Count == 0)
                        {
                            transportationOrderMgr.CompleteTransportationOrder(orderNo, userMgr.GetMonitorUser());
                        }
                    }
                    catch (Exception ex)
                    {
                        log.Error("CalculateFixPriceList Error.", ex);
                        continue;
                    }
                }
            }
        }
Esempio n. 2
0
 public void Execute(JobRunContext context)
 {
     string flowCode = context.JobDataMap.GetStringValue("FlowCode");
      if (flowCode != null && flowCode != string.Empty)
      {
          string[] flowCodeArray = flowCode.Split(',');
          orderMgr.TryCompleteOrder(flowCodeArray);
      }
 }
Esempio n. 3
0
 public void Execute(JobRunContext context)
 {
     try
     {
         ProcessData(context.Container);
     }
     catch (Exception ex)
     {
         log.Error("Import Data Error.", ex);
     }
 }
 public void Execute(JobRunContext context)
 {
     try
     {
         transportationActBillMgr.CalculateFixPriceList();
     }
     catch (Exception ex)
     {
         log.Error("CalculateFixPriceList Error.", ex);
     }
 }
Esempio n. 5
0
 public void Execute(JobRunContext context)
 {
     try
     {
         mesMgr.RunMes();
     }
     catch (Exception ex)
     {
         log.Error("Mes Run Error.", ex);
     }
 }
        //public void Execute(JobRunContext context)
        //{
        //    DetachedCriteria criteria = DetachedCriteria.For<OrderHead>();
        //    criteria.Add(Expression.Eq("Status", BusinessConstants.CODE_MASTER_STATUS_VALUE_INPROCESS));
        //    criteria.Add(Expression.Eq("IsAutoCreatePickList", true));
        //    //查找自动创建拣货单并且正在执行中的订单
        //    IList<OrderHead> orderHeadList = this.criteriaMgr.FindAll<OrderHead>(criteria);
        //    if (orderHeadList != null && orderHeadList.Count > 0)
        //    {
        //        foreach(OrderHead orderHead in orderHeadList)
        //        {
        //           GenertatePickList(orderHead);
        //        }
        //    }
        //}
        public void Execute(JobRunContext context)
        {
            DetachedCriteria criteria = DetachedCriteria.For<OrderHead>();

            criteria.Add(Expression.Eq("Status", BusinessConstants.CODE_MASTER_STATUS_VALUE_INPROCESS));
            criteria.Add(Expression.Eq("IsAutoCreatePickList", true));
            criteria.Add(Expression.Eq("IsPickListCreated", false));

            //查找自动创建拣货单并且正在执行中的订单
            IList<OrderHead> orderHeadList = this.criteriaMgr.FindAll<OrderHead>(criteria);
            if (orderHeadList != null && orderHeadList.Count > 0)
            {

                string productLine = context.JobDataMap.GetStringValue("FlowCode");
                if (productLine != null && productLine != string.Empty)
                {
                    string[] productLineArray = productLine.Split('|');
                    foreach (string seperatedProductLineArray in productLineArray)
                    {
                        string[] plArray = seperatedProductLineArray.Split(',');

                        List<OrderHead> odList = new List<OrderHead>();

                        foreach (string pl in plArray)
                        {
                            IList<OrderHead> q = orderHeadList.Where(o => pl == o.Flow).ToList();
                            if (q != null && q.Count > 0)
                            {
                                IListHelper.AddRange<OrderHead>(odList, q);
                            }
                        }

                        if (odList != null && odList.Count > 0)
                        {
                            try
                            {
                                GenertatePickList(odList);
                            }
                            catch (Exception ex)
                            {
                                log.Error(ex);
                                this.criteriaMgr.FlushSession();
                                this.criteriaMgr.CleanSession();
                            }
                        }
                    }
                }
            }
        }
        public void Execute(JobRunContext context)
        {
            DetachedCriteria criteria = DetachedCriteria.For<OrderHead>();

            criteria.Add(Expression.Eq("Status", BusinessConstants.CODE_MASTER_STATUS_VALUE_INPROCESS));
            criteria.Add(Expression.Eq("IsAutoCreatePickList", true));

            //查找自动创建拣货单并且正在执行中的订单
            IList<OrderHead> orderHeadList = this.criteriaMgrE.FindAll<OrderHead>(criteria);
            if (orderHeadList != null && orderHeadList.Count > 0)
            {
                foreach(OrderHead orderHead in orderHeadList) 
                {
                   GenertatePickList(orderHead);
                }
            }
        }
Esempio n. 8
0
 public void Execute(JobRunContext context)
 {
     try
     {
         IList<MesScmsTableIndex> mesScmsTableIndexList = mesScmsTableIndexMgr.GetUpdateMesScmsTableIndex();
         if (mesScmsTableIndexList != null && mesScmsTableIndexList.Count > 0)
         {
             foreach (MesScmsTableIndex mesScmsTableIndex in mesScmsTableIndexList)
             {
                 //IMesDssInMgr mesDssInMgr = context.Container.Resolve<IMesDssInMgr>(context.JobDataMap.GetStringValue(mesScmsTableIndex.TableName.ToUpper()));
                 mesDssInMgr.ProcessIn(mesScmsTableIndex);
             }
         }
     }
     catch (Exception ex)
     {
         log.Error("Import Data Error.", ex);
     }
 }
Esempio n. 9
0
        public void Execute(JobRunContext context)
        {
            try
            {
                ExportData(context.Container);
            }
            catch (Exception ex)
            {
                log.Error("Export Data Error.", ex);
            }

            try
            {
                UploadFile();
            }
            catch (Exception ex)
            {
                log.Error("Upload File Error.", ex);
            }
        }
        public override Task <JobResult> RunAsync(JobRunContext context)
        {
            Log.Info().Message("Remove stale accounts job starting").Write();

            var organizations = _organizationRepository.GetAbandoned();

            while (organizations.Count > 0)
            {
                foreach (var organization in organizations)
                {
                    TryDeleteOrganization(organization);
                }

                organizations = _organizationRepository.GetAbandoned();
            }

            return(Task.FromResult(new JobResult {
                Message = "Successfully removed all stale accounts."
            }));
        }
        public void Execute(JobRunContext context)
        {
            try
            {
                DownloadFile();
            }
            catch (Exception ex)
            {
                log.Error("Download File Error.", ex);
            }

            try
            {
                ImportData(context.Container);
            }
            catch (Exception ex)
            {
                log.Error("Import Data Error.", ex);
            }
        }
Esempio n. 12
0
        public void Execute(JobRunContext context)
        {
            try
            {
                IList<ScmsTableIndex> scmsTableIndexList = scmsTableIndexMgr.GetUpdateScmsTableIndex();
                if (scmsTableIndexList != null && scmsTableIndexList.Count > 0)
                {
                    foreach (ScmsTableIndex scmsTableIndex in scmsTableIndexList)
                    {
                        //IMesDssOutMgr mesDssOutMgr = context.Container.Resolve<IMesDssOutMgr>(context.JobDataMap.GetStringValue(scmsTableIndex.TableName.ToUpper()));

                        mesDssOutMgr.ProcessOut(scmsTableIndex);
                    }
                }
            }
            catch (Exception ex)
            {
                log.Error("Export Data Error.", ex);
            }
        }
Esempio n. 13
0
 public void Execute(JobRunContext context)
 {
     string flowCode = context.JobDataMap.GetStringValue("FlowCode");
     if (flowCode != null && flowCode != string.Empty)
     {
         string[] flowCodeArray = flowCode.Split(',');
         foreach (string singleFlowCode in flowCodeArray)
         {
             try
             {
                 log.Info("Start backflush production line " + singleFlowCode);
                 TryRawMaterialBackflush(singleFlowCode);
                 log.Info("End backflush production line " + singleFlowCode);
             }
             catch (Exception ex)
             {
                 log.Error("Backflush Error.", ex);
             }
         }
     }
 }
Esempio n. 14
0
        public override Task <JobResult> RunAsync(JobRunContext context)
        {
            Log.Info().Message("Enforce retention limits job starting").Write();

            var page          = 1;
            var organizations = _organizationRepository.GetByRetentionDaysEnabled(new PagingOptions().WithLimit(100));

            while (organizations.Count > 0)
            {
                // TODO: Need to add overage days to the org when they went over their limit for the day.
                foreach (var organization in organizations)
                {
                    EnforceEventCountLimits(organization);
                }

                organizations = _organizationRepository.GetByRetentionDaysEnabled(new PagingOptions().WithPage(++page).WithLimit(100));
            }

            return(Task.FromResult(new JobResult {
                Message = "Successfully enforced all retention limits."
            }));
        }
Esempio n. 15
0
        public void Execute(JobRunContext context)
        {
            string flowCode = context.JobDataMap.GetStringValue("FlowCode");

            if (flowCode != null && flowCode != string.Empty)
            {
                string[] flowCodeArray = flowCode.Split(',');
                foreach (string singleFlowCode in flowCodeArray)
                {
                    try
                    {
                        log.Info("Start backflush production line " + singleFlowCode);
                        TryRawMaterialBackflush(singleFlowCode);
                        log.Info("End backflush production line " + singleFlowCode);
                    }
                    catch (Exception ex)
                    {
                        log.Error("Backflush Error.", ex);
                    }
                }
            }
        }
Esempio n. 16
0
        protected override async Task <JobResult> RunInternalAsync(JobRunContext context)
        {
            await _metrics.CounterAsync("runs").AnyContext();

            if (RandomData.GetBool(10))
            {
                await _metrics.CounterAsync("errors").AnyContext();

                throw new ApplicationException("Boom!");
            }

            if (RandomData.GetBool(10))
            {
                await _metrics.CounterAsync("failed").AnyContext();

                return(JobResult.FailedWithMessage("Failed"));
            }

            await _metrics.CounterAsync("completed").AnyContext();

            return(JobResult.Success);
        }
Esempio n. 17
0
        protected override async Task <JobResult> RunInternalAsync(JobRunContext context)
        {
            var results = await _organizationRepository.GetByRetentionDaysEnabledAsync(new PagingOptions().WithPage(1).WithLimit(100)).AnyContext();

            while (results.Documents.Count > 0 && !context.CancellationToken.IsCancellationRequested)
            {
                foreach (var organization in results.Documents)
                {
                    await EnforceEventCountLimitsAsync(organization).AnyContext();

                    // Sleep so we are not hammering the backend.
                    await Task.Delay(TimeSpan.FromSeconds(5)).AnyContext();
                }

                await results.NextPageAsync().AnyContext();

                if (results.Documents.Count > 0)
                {
                    await context.JobLock.RenewAsync().AnyContext();
                }
            }

            return(JobResult.Success);
        }
        public void Execute(JobRunContext context)
        {
            DetachedCriteria criteria = DetachedCriteria.For(typeof(CycleCount));
            criteria.Add(Expression.Eq("Status", BusinessConstants.CODE_MASTER_STATUS_VALUE_SUBMIT));
            criteria.Add(Expression.Not(Expression.Eq("CreateUser", "su")));
            IList<CycleCount> cycleCountList = criteriaMgr.FindAll<CycleCount>(criteria);

            if (cycleCountList.Count > 0)
            {
                int count = 0;
                foreach (CycleCount cycleCount in cycleCountList)
                {
                    if (count < 10)
                    {
                        cycleCountMgr.ProcessCycleCountResult(cycleCount.Code, userMgr.GetMonitorUser());
                        count++;
                    }
                    else
                    {
                        break;
                    }
                }
            }
        }
        public void Execute(JobRunContext context)
        {
            #region 获取参数
            JobDataMap jobDataMap = context.JobDataMap;
            string inboundDirectoryName = string.Empty;
            string archiveDirectoryName = string.Empty;
            string errorDirectoryName = string.Empty;
            string ftpServer = string.Empty;
            int ftpPort = 21;
            string ftpInboundFolder = string.Empty;
            string ftpUser = string.Empty;
            string ftpPass = string.Empty;
            string localTempFolder = string.Empty;

            if (jobDataMap.ContainKey(INBOUND_DIRECTORY))
            {
                inboundDirectoryName = jobDataMap.GetStringValue(INBOUND_DIRECTORY);
            }
            else
            {
                throw new BusinessErrorException("not specify inbound directory.");
            }

            if (jobDataMap.ContainKey(ARCHIVE_DIRECTORY))
            {
                archiveDirectoryName = jobDataMap.GetStringValue(ARCHIVE_DIRECTORY);
            }
            else
            {
                throw new BusinessErrorException("not specify archive directory.");
            }

            if (jobDataMap.ContainKey(ERROR_DIRECTORY))
            {
                errorDirectoryName = jobDataMap.GetStringValue(ERROR_DIRECTORY);
            }
            else
            {
                throw new BusinessErrorException("not specify error directory.");
            }

            if (jobDataMap.ContainKey(FTP_SERVER))
            {
                ftpServer = jobDataMap.GetStringValue(FTP_SERVER);
            }
            else
            {
                throw new BusinessErrorException("not ftp server address.");
            }

            if (jobDataMap.ContainKey(FTP_PORT))
            {
                ftpPort = jobDataMap.GetIntValue(FTP_PORT);
            }
            else
            {
                log.Info("using default ftp port 21.");
            }

            if (jobDataMap.ContainKey(FTP_INBOUND_FOLDER))
            {
                ftpInboundFolder = jobDataMap.GetStringValue(FTP_INBOUND_FOLDER);
            }
            else
            {
                throw new BusinessErrorException("not specify ftp inbound folder.");
            }

            if (jobDataMap.ContainKey(FTP_USER))
            {
                ftpUser = jobDataMap.GetStringValue(FTP_USER);
            }
            else
            {
                throw new BusinessErrorException("not specify ftp user.");
            }

            if (jobDataMap.ContainKey(FTP_PASSWORD))
            {
                ftpPass = jobDataMap.GetStringValue(FTP_PASSWORD);
            }
            else
            {
                throw new BusinessErrorException("not specify ftp password.");
            }

            if (jobDataMap.ContainKey(LOCAL_TEMP_FOLDER))
            {
                localTempFolder = jobDataMap.GetStringValue(LOCAL_TEMP_FOLDER);
            }
            else
            {
                throw new BusinessErrorException("not specify local temp folder.");
            }
            #endregion

            #region 下载WO文件
            try
            {
                #region 初始化本地目录
                localTempFolder = localTempFolder.Replace("\\", "/");
                if (!localTempFolder.EndsWith("/"))
                {
                    localTempFolder += "/";
                }
                if (!Directory.Exists(localTempFolder))
                {
                    Directory.CreateDirectory(localTempFolder);
                }
         
                inboundDirectoryName = inboundDirectoryName.Replace("\\", "/");
                if (!inboundDirectoryName.EndsWith("/"))
                {
                    inboundDirectoryName += "/";
                }
                if (!Directory.Exists(inboundDirectoryName))
                {
                    Directory.CreateDirectory(inboundDirectoryName);
                }
                #endregion

                #region 下载文件
                FtpHelper ftp = new FtpHelper(ftpServer, ftpPort, ftpInboundFolder, ftpUser, ftpPass);
                string[] fileList = ftp.GetFileList();
                foreach (string fileName in fileList)
                {
                    try
                    {
                        ftp.Download(localTempFolder, fileName);
                        log.Info("Move file from folder: " + localTempFolder + fileName + " to folder: " + inboundDirectoryName + fileName);
                        File.Move(localTempFolder + fileName, inboundDirectoryName + fileName);
                        ftp.Delete(fileName);
                    }
                    catch (Exception ex)
                    {
                        log.Error("Download file:" + fileName, ex);
                    }
                }
                #endregion
            }
            catch (Exception ex)
            {
                log.Error("Download files from ftpServer:" + ftpServer, ex);
            }
            #endregion

            string[] inboundFiles = Directory.GetFiles(inboundDirectoryName);
            if (inboundFiles != null && inboundFiles.Length > 0)
            {
                foreach (string inboundFile in inboundFiles)
                {
                    string fileName = inboundFile.Substring(inboundFile.LastIndexOf("/"));

                    
                    try
                    {
                        ProcessSingleFile(inboundDirectoryName, inboundFile);

                        if (!Directory.Exists(archiveDirectoryName))
                        {
                            Directory.CreateDirectory(archiveDirectoryName);
                        }

                        if (File.Exists(archiveDirectoryName + fileName))
                        {
                            File.Delete(archiveDirectoryName + fileName);
                        }

                        File.Move(inboundFile, archiveDirectoryName + fileName);
                    }
                    catch (Exception ex)
                    {
                        log.Error("Unexpected error occour when processing inbound file " + inboundFile, ex);
                        if (!Directory.Exists(errorDirectoryName))
                        {
                            Directory.CreateDirectory(errorDirectoryName);
                        }

                        if (File.Exists(errorDirectoryName + fileName))
                        {
                            File.Delete(errorDirectoryName + fileName);
                        }

                        File.Move(inboundFile, errorDirectoryName + fileName);
                    }
                }
            }
        }
Esempio n. 20
0
        private void Run(IWindsorContainer container, bool isLeanEngine, bool isReceiveWO)
        {
            if (isLeanEngine)
            {
                lelog.Info("----------------------------------Invincible's dividing line---------------------------------------");
                lelog.Info("BatchJobs run start.");
            }
            else if (isReceiveWO)
            {
                rwolog.Info("----------------------------------Invincible's dividing line---------------------------------------");
                rwolog.Info("BatchJobs run start.");
            }
            else
            {
                log.Info("----------------------------------Invincible's dividing line---------------------------------------");
                log.Info("BatchJobs run start.");
            }

            IList <BatchTrigger> tobeFiredTriggerList = this.batchTriggerMgr.GetTobeFiredTrigger();

            if (tobeFiredTriggerList != null && tobeFiredTriggerList.Count > 0)
            {
                foreach (BatchTrigger tobeFiredTrigger in tobeFiredTriggerList)
                {
                    bool isSuccess = true;
                    if (isLeanEngine && tobeFiredTrigger.Id != 2 && tobeFiredTrigger.Id != 23 && tobeFiredTrigger.Id != 51 && tobeFiredTrigger.Id != 54 && tobeFiredTrigger.Id != 55 && tobeFiredTrigger.Id != 56 && tobeFiredTrigger.Id != 7)
                    {
                        continue;
                    }

                    if (isReceiveWO && tobeFiredTrigger.Id != 57 && tobeFiredTrigger.Id != 50)
                    {
                        continue;
                    }

                    if (!isLeanEngine && !isReceiveWO && tobeFiredTrigger.Id != 8 && tobeFiredTrigger.Id != 16 && tobeFiredTrigger.Id != 20)
                    {
                        continue;
                    }

                    BatchJobDetail jobDetail = tobeFiredTrigger.BatchJobDetail;
                    BatchRunLog    runLog    = new BatchRunLog();
                    try
                    {
                        #region Job运行前处理
                        if (isLeanEngine)
                        {
                            lelog.Info("Start run job. JobId:" + jobDetail.Id + ", JobName:" + jobDetail.Name);
                        }
                        else if (isReceiveWO)
                        {
                            rwolog.Info("Start run job. JobId:" + jobDetail.Id + ", JobName:" + jobDetail.Name);
                        }
                        else
                        {
                            log.Info("Start run job. JobId:" + jobDetail.Id + ", JobName:" + jobDetail.Name);
                        }
                        runLog.BatchJobDetail = jobDetail;
                        runLog.BatchTrigger   = tobeFiredTrigger;
                        runLog.StartTime      = DateTime.Now;
                        runLog.Status         = "InProcess";
                        this.batchRunLogMgr.CreateBatchRunLog(runLog);
                        #endregion

                        #region 运行Job

                        JobDataMap dataMap = new JobDataMap();
                        #region Job参数获取
                        IList <BatchJobParameter> batchJobParameterList = this.batchJobParameterMgr.GetBatchJobParameter(jobDetail.Id);
                        if (batchJobParameterList != null && batchJobParameterList.Count > 0)
                        {
                            foreach (BatchJobParameter batchJobParameter in batchJobParameterList)
                            {
                                if (isLeanEngine)
                                {
                                    lelog.Debug("Set Job Parameter Name:" + batchJobParameter.ParameterName + ", Value:" + batchJobParameter.ParameterValue);
                                }
                                else if (isReceiveWO)
                                {
                                    rwolog.Debug("Set Job Parameter Name:" + batchJobParameter.ParameterName + ", Value:" + batchJobParameter.ParameterValue);
                                }
                                else
                                {
                                    log.Debug("Set Job Parameter Name:" + batchJobParameter.ParameterName + ", Value:" + batchJobParameter.ParameterValue);
                                }
                                dataMap.PutData(batchJobParameter.ParameterName, batchJobParameter.ParameterValue);
                            }
                        }
                        #endregion

                        #region Trigger参数获取
                        IList <BatchTriggerParameter> batchTriggerParameterList = this.batchTriggerParameterMgr.GetBatchTriggerParameter(tobeFiredTrigger.Id);
                        if (batchTriggerParameterList != null && batchTriggerParameterList.Count > 0)
                        {
                            foreach (BatchTriggerParameter batchTriggerParameter in batchTriggerParameterList)
                            {
                                if (isLeanEngine)
                                {
                                    lelog.Debug("Set Trigger Parameter Name:" + batchTriggerParameter.ParameterName + ", Value:" + batchTriggerParameter.ParameterValue);
                                }
                                else if (isReceiveWO)
                                {
                                    rwolog.Debug("Set Trigger Parameter Name:" + batchTriggerParameter.ParameterName + ", Value:" + batchTriggerParameter.ParameterValue);
                                }
                                else
                                {
                                    log.Debug("Set Trigger Parameter Name:" + batchTriggerParameter.ParameterName + ", Value:" + batchTriggerParameter.ParameterValue);
                                }
                                dataMap.PutData(batchTriggerParameter.ParameterName, batchTriggerParameter.ParameterValue);
                            }
                        }
                        #endregion

                        #region 初始化JobRunContext
                        JobRunContext jobRunContext = new JobRunContext(tobeFiredTrigger, jobDetail, dataMap, container);
                        #endregion

                        #region 调用Job



                        IJob job = container.Resolve <IJob>(jobDetail.ServiceName);
                        if (isLeanEngine)
                        {
                            lelog.Debug("Start run job: " + jobDetail.ServiceName);
                        }
                        else if (isReceiveWO)
                        {
                            rwolog.Debug("Start run job: " + jobDetail.ServiceName);
                        }
                        else
                        {
                            log.Debug("Start run job: " + jobDetail.ServiceName);
                        }
                        job.Execute(jobRunContext);
                        #endregion

                        #endregion

                        #region Job运行后处理
                        if (isLeanEngine)
                        {
                            lelog.Info("Job run successful. JobId:" + jobDetail.Id + ", JobName:" + jobDetail.Name);
                        }
                        else if (isReceiveWO)
                        {
                            rwolog.Info("Job run successful. JobId:" + jobDetail.Id + ", JobName:" + jobDetail.Name);
                        }
                        else
                        {
                            log.Info("Job run successful. JobId:" + jobDetail.Id + ", JobName:" + jobDetail.Name);
                        }
                        runLog.EndTime = DateTime.Now;
                        runLog.Status  = "Successful";
                        this.batchRunLogMgr.UpdateBatchRunLog(runLog);
                        #endregion
                    }
                    catch (Exception ex)
                    {
                        try
                        {
                            this.batchTriggerMgr.CleanSession();
                            isSuccess = false;
                            if (isLeanEngine)
                            {
                                lelog.Error("Job run failure. JobId:" + jobDetail.Id + ", JobName:" + jobDetail.Name, ex);
                            }
                            else if (isReceiveWO)
                            {
                                rwolog.Error("Job run failure. JobId:" + jobDetail.Id + ", JobName:" + jobDetail.Name, ex);
                            }
                            else
                            {
                                log.Error("Job run failure. JobId:" + jobDetail.Id + ", JobName:" + jobDetail.Name, ex);
                            }
                            runLog.EndTime = DateTime.Now;
                            runLog.Status  = "Failure";
                            if (ex.Message != null && ex.Message.Length > 255)
                            {
                                runLog.Message = ex.Message.Substring(0, 255);
                            }
                            else
                            {
                                runLog.Message = ex.Message;
                            }
                            this.batchRunLogMgr.UpdateBatchRunLog(runLog);
                        }
                        catch (Exception ex1)
                        {
                            if (isLeanEngine)
                            {
                                lelog.Error("", ex1);
                            }
                            else if (isReceiveWO)
                            {
                                rwolog.Error("", ex1);
                            }
                            else
                            {
                                log.Error("", ex1);
                            }
                        }
                    }
                    finally
                    {
                        #region 更新BatchTrigger
                        try
                        {
                            BatchTrigger oldTobeFiredTrigger = this.batchTriggerMgr.LoadBatchTrigger(tobeFiredTrigger.Id);
                            oldTobeFiredTrigger.TimesTriggered++;
                            oldTobeFiredTrigger.PreviousFireTime = oldTobeFiredTrigger.NextFireTime;
                            if (oldTobeFiredTrigger.RepeatCount != 0 && oldTobeFiredTrigger.TimesTriggered >= oldTobeFiredTrigger.RepeatCount)
                            {
                                //关闭Trigger
                                if (isLeanEngine)
                                {
                                    lelog.Debug("Close Trigger:" + oldTobeFiredTrigger.Name);
                                }
                                else if (isReceiveWO)
                                {
                                    rwolog.Debug("Close Trigger:" + oldTobeFiredTrigger.Name);
                                }
                                else
                                {
                                    log.Debug("Close Trigger:" + oldTobeFiredTrigger.Name);
                                }
                                oldTobeFiredTrigger.Status       = BusinessConstants.CODE_MASTER_STATUS_VALUE_CLOSE;
                                oldTobeFiredTrigger.NextFireTime = null;
                            }
                            else
                            {
                                if (isSuccess)
                                {
                                    //设置下次运行时间
                                    if (isLeanEngine)
                                    {
                                        lelog.Debug("Set Trigger Next Start Time, Add:" + oldTobeFiredTrigger.Interval.ToString() + " " + oldTobeFiredTrigger.IntervalType);
                                    }
                                    else if (isReceiveWO)
                                    {
                                        rwolog.Debug("Set Trigger Next Start Time, Add:" + oldTobeFiredTrigger.Interval.ToString() + " " + oldTobeFiredTrigger.IntervalType);
                                    }
                                    else
                                    {
                                        log.Debug("Set Trigger Next Start Time, Add:" + oldTobeFiredTrigger.Interval.ToString() + " " + oldTobeFiredTrigger.IntervalType);
                                    }
                                    DateTime dateTimeNow = DateTime.Now;
                                    if (!oldTobeFiredTrigger.NextFireTime.HasValue)
                                    {
                                        oldTobeFiredTrigger.NextFireTime = dateTimeNow;
                                    }

                                    while (oldTobeFiredTrigger.NextFireTime.Value <= dateTimeNow)
                                    {
                                        if (oldTobeFiredTrigger.IntervalType == BusinessConstants.DATETIME_TYPE_YEAR)
                                        {
                                            oldTobeFiredTrigger.NextFireTime = oldTobeFiredTrigger.NextFireTime.Value.AddYears(oldTobeFiredTrigger.Interval);
                                        }
                                        else if (oldTobeFiredTrigger.IntervalType == BusinessConstants.DATETIME_TYPE_MONTH)
                                        {
                                            oldTobeFiredTrigger.NextFireTime = oldTobeFiredTrigger.NextFireTime.Value.AddMonths(oldTobeFiredTrigger.Interval);
                                        }
                                        else if (oldTobeFiredTrigger.IntervalType == BusinessConstants.DATETIME_TYPE_DAY)
                                        {
                                            oldTobeFiredTrigger.NextFireTime = oldTobeFiredTrigger.NextFireTime.Value.AddDays(oldTobeFiredTrigger.Interval);
                                        }
                                        else if (oldTobeFiredTrigger.IntervalType == BusinessConstants.DATETIME_TYPE_HOUR)
                                        {
                                            oldTobeFiredTrigger.NextFireTime = oldTobeFiredTrigger.NextFireTime.Value.AddHours(oldTobeFiredTrigger.Interval);
                                        }
                                        else if (oldTobeFiredTrigger.IntervalType == BusinessConstants.DATETIME_TYPE_MINUTE)
                                        {
                                            oldTobeFiredTrigger.NextFireTime = oldTobeFiredTrigger.NextFireTime.Value.AddMinutes(oldTobeFiredTrigger.Interval);
                                        }
                                        else if (oldTobeFiredTrigger.IntervalType == BusinessConstants.DATETIME_TYPE_SECOND)
                                        {
                                            oldTobeFiredTrigger.NextFireTime = oldTobeFiredTrigger.NextFireTime.Value.AddSeconds(oldTobeFiredTrigger.Interval);
                                        }
                                        else if (oldTobeFiredTrigger.IntervalType == BusinessConstants.DATETIME_TYPE_MILLISECOND)
                                        {
                                            oldTobeFiredTrigger.NextFireTime = oldTobeFiredTrigger.NextFireTime.Value.AddMilliseconds(oldTobeFiredTrigger.Interval);
                                        }
                                        else
                                        {
                                            throw new ArgumentException("invalid Interval Type:" + oldTobeFiredTrigger.IntervalType);
                                        }
                                    }
                                    if (isLeanEngine)
                                    {
                                        lelog.Debug("Trigger Next Start Time is set as:" + oldTobeFiredTrigger.NextFireTime.Value.ToString("yyyy-MM-dd HH:mm:ss"));
                                    }
                                    else if (isReceiveWO)
                                    {
                                        rwolog.Debug("Trigger Next Start Time is set as:" + oldTobeFiredTrigger.NextFireTime.Value.ToString("yyyy-MM-dd HH:mm:ss"));
                                    }
                                    else
                                    {
                                        log.Debug("Trigger Next Start Time is set as:" + oldTobeFiredTrigger.NextFireTime.Value.ToString("yyyy-MM-dd HH:mm:ss"));
                                    }
                                }
                            }
                            this.batchTriggerMgr.UpdateBatchTrigger(oldTobeFiredTrigger);
                        }
                        catch (Exception ex)
                        {
                            if (isLeanEngine)
                            {
                                lelog.Error("Error occur when update batch trigger.", ex);
                            }
                            else if (isReceiveWO)
                            {
                                rwolog.Error("Error occur when update batch trigger.", ex);
                            }
                            else
                            {
                                log.Error("Error occur when update batch trigger.", ex);
                            }
                        }
                        #endregion
                    }
                }
            }
            else
            {
                if (isLeanEngine)
                {
                    lelog.Info("No job found may run in this batch.");
                }
                else if (isReceiveWO)
                {
                    rwolog.Info("No job found may run in this batch.");
                }
                else
                {
                    log.Info("No job found may run in this batch.");
                }
            }

            if (isLeanEngine)
            {
                lelog.Info("BatchJobs run end.");
            }
            else if (isReceiveWO)
            {
                rwolog.Info("BatchJobs run end.");
            }
            else
            {
                log.Info("BatchJobs run end.");
            }
        }
Esempio n. 21
0
 public void Execute(JobRunContext context)
 {
     //leanEngineMgr.GenerateOrder();
     leanEngineMgr.OrderGenerate();
 }
Esempio n. 22
0
 public void Execute(JobRunContext context)
 {
     User user= this.userMgr.GetMonitorUser();
     this.theEDIMgr.LoadEDI(user);
     this.theEDIMgr.TransformationPlan(user);
 }
 public void Execute(JobRunContext context)
 {
     orderMgrE.TryCloseOrder();
 }
Esempio n. 24
0
 private static void CronJobMethod(JobRunContext jobContext, string arg0, int arg1)
 {
     _callCount++;
 }
        public void Execute(JobRunContext context)
        {
            #region 获取参数
            JobDataMap jobDataMap           = context.JobDataMap;
            string     inboundDirectoryName = string.Empty;
            string     archiveDirectoryName = string.Empty;
            string     errorDirectoryName   = string.Empty;
            string     ftpServer            = string.Empty;
            int        ftpPort          = 21;
            string     ftpInboundFolder = string.Empty;
            string     ftpUser          = string.Empty;
            string     ftpPass          = string.Empty;
            string     localTempFolder  = string.Empty;

            if (jobDataMap.ContainKey(INBOUND_DIRECTORY))
            {
                inboundDirectoryName = jobDataMap.GetStringValue(INBOUND_DIRECTORY);
            }
            else
            {
                throw new BusinessErrorException("not specify inbound directory.");
            }

            if (jobDataMap.ContainKey(ARCHIVE_DIRECTORY))
            {
                archiveDirectoryName = jobDataMap.GetStringValue(ARCHIVE_DIRECTORY);
            }
            else
            {
                throw new BusinessErrorException("not specify archive directory.");
            }

            if (jobDataMap.ContainKey(ERROR_DIRECTORY))
            {
                errorDirectoryName = jobDataMap.GetStringValue(ERROR_DIRECTORY);
            }
            else
            {
                throw new BusinessErrorException("not specify error directory.");
            }

            if (jobDataMap.ContainKey(FTP_SERVER))
            {
                ftpServer = jobDataMap.GetStringValue(FTP_SERVER);
            }
            else
            {
                throw new BusinessErrorException("not ftp server address.");
            }

            if (jobDataMap.ContainKey(FTP_PORT))
            {
                ftpPort = jobDataMap.GetIntValue(FTP_PORT);
            }
            else
            {
                log.Info("using default ftp port 21.");
            }

            if (jobDataMap.ContainKey(FTP_INBOUND_FOLDER))
            {
                ftpInboundFolder = jobDataMap.GetStringValue(FTP_INBOUND_FOLDER);
            }
            else
            {
                throw new BusinessErrorException("not specify ftp inbound folder.");
            }

            if (jobDataMap.ContainKey(FTP_USER))
            {
                ftpUser = jobDataMap.GetStringValue(FTP_USER);
            }
            else
            {
                throw new BusinessErrorException("not specify ftp user.");
            }

            if (jobDataMap.ContainKey(FTP_PASSWORD))
            {
                ftpPass = jobDataMap.GetStringValue(FTP_PASSWORD);
            }
            else
            {
                throw new BusinessErrorException("not specify ftp password.");
            }

            if (jobDataMap.ContainKey(LOCAL_TEMP_FOLDER))
            {
                localTempFolder = jobDataMap.GetStringValue(LOCAL_TEMP_FOLDER);
            }
            else
            {
                throw new BusinessErrorException("not specify local temp folder.");
            }
            #endregion

            #region  载WO文件
            try
            {
                #region 初始化本地目录
                localTempFolder = localTempFolder.Replace("\\", "/");
                if (!localTempFolder.EndsWith("/"))
                {
                    localTempFolder += "/";
                }
                if (!Directory.Exists(localTempFolder))
                {
                    Directory.CreateDirectory(localTempFolder);
                }

                inboundDirectoryName = inboundDirectoryName.Replace("\\", "/");
                if (!inboundDirectoryName.EndsWith("/"))
                {
                    inboundDirectoryName += "/";
                }
                if (!Directory.Exists(inboundDirectoryName))
                {
                    Directory.CreateDirectory(inboundDirectoryName);
                }
                #endregion

                #region  载文件
                FtpHelper ftp      = new FtpHelper(ftpServer, ftpPort, ftpInboundFolder, ftpUser, ftpPass);
                string[]  fileList = ftp.GetFileList();
                foreach (string fileName in fileList)
                {
                    try
                    {
                        ftp.Download(localTempFolder, fileName);
                        log.Info("Move file from folder: " + localTempFolder + fileName + " to folder: " + inboundDirectoryName + fileName);
                        File.Move(localTempFolder + fileName, inboundDirectoryName + fileName);
                        ftp.Delete(fileName);
                    }
                    catch (Exception ex)
                    {
                        log.Error("Download file:" + fileName, ex);
                    }
                }
                #endregion
            }
            catch (Exception ex)
            {
                log.Error("Download files from ftpServer:" + ftpServer, ex);
            }
            #endregion

            string[] inboundFiles = Directory.GetFiles(inboundDirectoryName);
            if (inboundFiles != null && inboundFiles.Length > 0)
            {
                foreach (string inboundFile in inboundFiles)
                {
                    string fileName = inboundFile.Substring(inboundFile.LastIndexOf("/"));


                    try
                    {
                        ProcessSingleFile(inboundDirectoryName, inboundFile);

                        if (!Directory.Exists(archiveDirectoryName))
                        {
                            Directory.CreateDirectory(archiveDirectoryName);
                        }

                        if (File.Exists(archiveDirectoryName + fileName))
                        {
                            File.Delete(archiveDirectoryName + fileName);
                        }

                        File.Move(inboundFile, archiveDirectoryName + fileName);
                    }
                    catch (Exception ex)
                    {
                        log.Error("Unexpected error occour when processing inbound file " + inboundFile, ex);
                        if (!Directory.Exists(errorDirectoryName))
                        {
                            Directory.CreateDirectory(errorDirectoryName);
                        }

                        if (File.Exists(errorDirectoryName + fileName))
                        {
                            File.Delete(errorDirectoryName + fileName);
                        }

                        File.Move(inboundFile, errorDirectoryName + fileName);
                    }
                }
            }
        }
Esempio n. 26
0
 public void Execute(JobRunContext context)
 {
     //leanEngineMgr.GenerateOrder();
     leanEngineMgr.OrderGenerate();
 }
Esempio n. 27
0
 public void Execute(JobRunContext context)
 {
     transportationOrderMgr.TryCloseTransportationOrder();
 }
Esempio n. 28
0
        public void Execute(JobRunContext context)
        {
            string customers = context.JobDataMap.GetStringValue("Customers");

            this.billMgr.TryCreateBill(customers);
        }
        public async override Task <JobResult> RunAsync(JobRunContext context)
        {
            Log.Info().Message("Process events job starting").Write();

            while (!CancelPending)
            {
                QueueEntry <EventPost> queueEntry = null;
                try {
                    queueEntry = await _queue.DequeueAsync();

                    _statsClient.Counter(StatNames.PostsDequeued);
                } catch (Exception ex) {
                    if (!(ex is TimeoutException))
                    {
                        Log.Error().Exception(ex).Message("An error occurred while trying to dequeue the next EventPost: {0}", ex.Message).Write();
                        return(JobResult.FromException(ex));
                    }
                }
                if (queueEntry == null)
                {
                    continue;
                }

                Log.Info().Message("Processing EventPost '{0}'.", queueEntry.Id).Write();

                List <PersistentEvent> events = null;
                try {
                    _statsClient.Time(() => {
                        events = ParseEventPost(queueEntry.Value);
                    }, StatNames.PostsParsingTime);
                    _statsClient.Counter(StatNames.PostsParsed);
                } catch (Exception ex) {
                    _statsClient.Counter(StatNames.PostsParseErrors);
                    queueEntry.AbandonAsync().Wait();

                    // TODO: Add the EventPost to the logged exception.
                    Log.Error().Exception(ex).Message("An error occurred while processing the EventPost '{0}': {1}", queueEntry.Id, ex.Message).Write();
                    continue;
                }
                if (events == null)
                {
                    queueEntry.AbandonAsync().Wait();
                    continue;
                }

                int  eventsToProcess = events.Count;
                bool isSingleEvent   = events.Count == 1;
                if (!isSingleEvent)
                {
                    var project = _projectRepository.GetById(queueEntry.Value.ProjectId, true);
                    // Don't process all the events if it will put the account over its limits.
                    eventsToProcess = _organizationRepository.GetRemainingEventLimit(project.OrganizationId);

                    // Add 1 because we already counted 1 against their limit when we received the event post.
                    if (eventsToProcess < Int32.MaxValue)
                    {
                        eventsToProcess += 1;
                    }

                    // Increment by count - 1 since we already incremented it by 1 in the OverageHandler.
                    _organizationRepository.IncrementUsage(project.OrganizationId, events.Count - 1);
                }
                int errorCount = 0;
                foreach (PersistentEvent ev in events.Take(eventsToProcess))
                {
                    try {
                        _eventPipeline.Run(ev);
                    } catch (Exception ex) {
                        Log.Error().Exception(ex).Message("An error occurred while processing the EventPipeline: {0}", ex.Message).Write();

                        if (!isSingleEvent)
                        {
                            // Put this single event back into the queue so we can retry it separately.
                            _queue.EnqueueAsync(new EventPost {
                                Data      = Encoding.UTF8.GetBytes(ev.ToJson()).Compress(),
                                ProjectId = ev.ProjectId,
                                CharSet   = "utf-8",
                                MediaType = "application/json",
                            }).Wait();
                        }

                        errorCount++;
                    }
                }

                if (isSingleEvent && errorCount > 0)
                {
                    queueEntry.AbandonAsync().Wait();
                }
                else
                {
                    queueEntry.CompleteAsync().Wait();
                }
            }

            return(JobResult.Success);
        }
Esempio n. 30
0
        public void RunBatchJobs(IWindsorContainer container)
        {
            log.Info("----------------------------------Invincible's dividing line---------------------------------------");
            log.Info("BatchJobs run start.");

            IList<BatchTrigger> tobeFiredTriggerList = this.batchTriggerMgrE.GetTobeFiredTrigger();

            if (tobeFiredTriggerList != null && tobeFiredTriggerList.Count > 0)
            {
                foreach (BatchTrigger tobeFiredTrigger in tobeFiredTriggerList)
                {
                    BatchJobDetail jobDetail = tobeFiredTrigger.BatchJobDetail;
                    BatchRunLog runLog = new BatchRunLog();
                    try
                    {
                        #region Job运行前处理
                        log.Info("Start run job. JobId:" + jobDetail.Id + ", JobName:" + jobDetail.Name);
                        runLog.BatchJobDetail = jobDetail;
                        runLog.BatchTrigger = tobeFiredTrigger;
                        runLog.StartTime = DateTime.Now;
                        runLog.Status = "InProcess";
                        this.batchRunLogMgrE.CreateBatchRunLog(runLog);
                        #endregion

                        #region 运行Job

                        JobDataMap dataMap = new JobDataMap();
                        #region Job参数获取
                        IList<BatchJobParameter> batchJobParameterList = this.batchJobParameterMgrE.GetBatchJobParameter(jobDetail.Id);
                        if (batchJobParameterList != null && batchJobParameterList.Count > 0)
                        {
                            foreach (BatchJobParameter batchJobParameter in batchJobParameterList)
                            {
                                log.Debug("Set Job Parameter Name:" + batchJobParameter.ParameterName + ", Value:" + batchJobParameter.ParameterValue);
                                dataMap.PutData(batchJobParameter.ParameterName, batchJobParameter.ParameterValue);
                            }
                        }
                        #endregion

                        #region Trigger参数获取
                        IList<BatchTriggerParameter> batchTriggerParameterList = this.batchTriggerParameterMgrE.GetBatchTriggerParameter(tobeFiredTrigger.Id);
                        if (batchTriggerParameterList != null && batchTriggerParameterList.Count > 0)
                        {
                            foreach (BatchTriggerParameter batchTriggerParameter in batchTriggerParameterList)
                            {
                                log.Debug("Set Trigger Parameter Name:" + batchTriggerParameter.ParameterName + ", Value:" + batchTriggerParameter.ParameterValue);
                                dataMap.PutData(batchTriggerParameter.ParameterName, batchTriggerParameter.ParameterValue);
                            }
                        }
                        #endregion

                        #region 初始化JobRunContext
                        JobRunContext jobRunContext = new JobRunContext(tobeFiredTrigger, jobDetail, dataMap, container);
                        #endregion

                        #region 调用Job
                        IJob job = container.Resolve<IJob>(jobDetail.ServiceName);
                        log.Debug("Start run job: " + jobDetail.ServiceName);
                        job.Execute(jobRunContext);
                        #endregion

                        #endregion

                        #region Job运行后处理
                        log.Info("Job run successful. JobId:" + jobDetail.Id + ", JobName:" + jobDetail.Name);
                        runLog.EndTime = DateTime.Now;
                        runLog.Status = "Successful";
                        this.batchRunLogMgrE.UpdateBatchRunLog(runLog);
                        #endregion
                    }
                    catch (Exception ex)
                    {
                        try
                        {
                            log.Error("Job run failure. JobId:" + jobDetail.Id + ", JobName:" + jobDetail.Name, ex);
                            runLog.EndTime = DateTime.Now;
                            runLog.Status = "Failure";
                            if (ex.Message != null && ex.Message.Length > 255)
                            {
                                runLog.Message = ex.Message.Substring(0, 255);
                            }
                            else
                            {
                                runLog.Message = ex.Message;
                            }
                            this.batchRunLogMgrE.UpdateBatchRunLog(runLog);
                        }
                        catch (Exception ex1)
                        {
                            log.Error("", ex1);
                        }
                    }
                    finally
                    {
                        #region 更新BatchTrigger
                        try
                        {
                            BatchTrigger oldTobeFiredTrigger = this.batchTriggerMgrE.LoadBatchTrigger(tobeFiredTrigger.Id);
                            oldTobeFiredTrigger.TimesTriggered++;
                            oldTobeFiredTrigger.PreviousFireTime = oldTobeFiredTrigger.NextFireTime;
                            if (oldTobeFiredTrigger.RepeatCount != 0 && oldTobeFiredTrigger.TimesTriggered >= oldTobeFiredTrigger.RepeatCount)
                            {
                                //关闭Trigger
                                log.Debug("Close Trigger:" + oldTobeFiredTrigger.Name);
                                oldTobeFiredTrigger.Status = BusinessConstants.CODE_MASTER_STATUS_VALUE_CLOSE;
                                oldTobeFiredTrigger.NextFireTime = null;
                            }
                            else
                            {
                                //设置下次运行时间
                                log.Debug("Set Trigger Next Start Time, Add:" + oldTobeFiredTrigger.Interval.ToString() + " " + oldTobeFiredTrigger.IntervalType);
                                //if (oldTobeFiredTrigger.IntervalType == BusinessConstants.DATETIME_TYPE_YEAR)
                                //{
                                //    oldTobeFiredTrigger.NextFireTime = dateTimeNow.AddYears(oldTobeFiredTrigger.Interval);
                                //}
                                //else if (oldTobeFiredTrigger.IntervalType == BusinessConstants.DATETIME_TYPE_MONTH)
                                //{
                                //    oldTobeFiredTrigger.NextFireTime = dateTimeNow.AddMonths(oldTobeFiredTrigger.Interval);
                                //}
                                //else if (oldTobeFiredTrigger.IntervalType == BusinessConstants.DATETIME_TYPE_DAY)
                                //{
                                //    oldTobeFiredTrigger.NextFireTime = dateTimeNow.AddDays(oldTobeFiredTrigger.Interval);
                                //}
                                //else if (oldTobeFiredTrigger.IntervalType == BusinessConstants.DATETIME_TYPE_HOUR)
                                //{
                                //    oldTobeFiredTrigger.NextFireTime = dateTimeNow.AddHours(oldTobeFiredTrigger.Interval);
                                //}
                                //else if (oldTobeFiredTrigger.IntervalType == BusinessConstants.DATETIME_TYPE_MINUTE)
                                //{
                                //    oldTobeFiredTrigger.NextFireTime = dateTimeNow.AddMinutes(oldTobeFiredTrigger.Interval);
                                //}
                                //else if (oldTobeFiredTrigger.IntervalType == BusinessConstants.DATETIME_TYPE_SECOND)
                                //{
                                //    oldTobeFiredTrigger.NextFireTime = dateTimeNow.AddSeconds(oldTobeFiredTrigger.Interval);
                                //}
                                //else if (oldTobeFiredTrigger.IntervalType == BusinessConstants.DATETIME_TYPE_MILLISECOND)
                                //{
                                //    oldTobeFiredTrigger.NextFireTime = dateTimeNow.AddMilliseconds(oldTobeFiredTrigger.Interval);
                                //}      
                                DateTime dateTimeNow = DateTime.Now;
                                if (!oldTobeFiredTrigger.NextFireTime.HasValue)
                                {
                                    oldTobeFiredTrigger.NextFireTime = dateTimeNow;
                                }

                                while (oldTobeFiredTrigger.NextFireTime.Value <= dateTimeNow)
                                {
                                    if (oldTobeFiredTrigger.IntervalType == BusinessConstants.DATETIME_TYPE_YEAR)
                                    {
                                        oldTobeFiredTrigger.NextFireTime = oldTobeFiredTrigger.NextFireTime.Value.AddYears(oldTobeFiredTrigger.Interval);
                                    }
                                    else if (oldTobeFiredTrigger.IntervalType == BusinessConstants.DATETIME_TYPE_MONTH)
                                    {
                                        oldTobeFiredTrigger.NextFireTime = oldTobeFiredTrigger.NextFireTime.Value.AddMonths(oldTobeFiredTrigger.Interval);
                                    }
                                    else if (oldTobeFiredTrigger.IntervalType == BusinessConstants.DATETIME_TYPE_DAY)
                                    {
                                        oldTobeFiredTrigger.NextFireTime = oldTobeFiredTrigger.NextFireTime.Value.AddDays(oldTobeFiredTrigger.Interval);
                                    }
                                    else if (oldTobeFiredTrigger.IntervalType == BusinessConstants.DATETIME_TYPE_HOUR)
                                    {
                                        oldTobeFiredTrigger.NextFireTime = oldTobeFiredTrigger.NextFireTime.Value.AddHours(oldTobeFiredTrigger.Interval);
                                    }
                                    else if (oldTobeFiredTrigger.IntervalType == BusinessConstants.DATETIME_TYPE_MINUTE)
                                    {
                                        oldTobeFiredTrigger.NextFireTime = oldTobeFiredTrigger.NextFireTime.Value.AddMinutes(oldTobeFiredTrigger.Interval);
                                    }
                                    else if (oldTobeFiredTrigger.IntervalType == BusinessConstants.DATETIME_TYPE_SECOND)
                                    {
                                        oldTobeFiredTrigger.NextFireTime = oldTobeFiredTrigger.NextFireTime.Value.AddSeconds(oldTobeFiredTrigger.Interval);
                                    }
                                    else if (oldTobeFiredTrigger.IntervalType == BusinessConstants.DATETIME_TYPE_MILLISECOND)
                                    {
                                        oldTobeFiredTrigger.NextFireTime = oldTobeFiredTrigger.NextFireTime.Value.AddMilliseconds(oldTobeFiredTrigger.Interval);
                                    }
                                    else
                                    {
                                        throw new ArgumentException("invalid Interval Type:" + oldTobeFiredTrigger.IntervalType);
                                    }
                                }
                                log.Debug("Trigger Next Start Time is set as:" + oldTobeFiredTrigger.NextFireTime.Value.ToString("yyyy-MM-dd HH:mm:ss"));
                            }

                            this.batchTriggerMgrE.UpdateBatchTrigger(oldTobeFiredTrigger);
                        }
                        catch (Exception ex)
                        {
                            log.Error("Error occur when update batch trigger.", ex);
                        }
                        #endregion
                    }
                }
            }
            else
            {
                log.Info("No job found may run in this batch.");
            }

            log.Info("BatchJobs run end.");
        }
Esempio n. 31
0
 public void Execute(JobRunContext context)
 {
     orderMgr.TryCloseOrder();
 }
Esempio n. 32
0
 // Sample scheduled job; sample data generator schedules this method as a job to run every 5 minutes
 public void RestockingJobMethod(JobRunContext jobContext)
 {
 }
Esempio n. 33
0
        public void Execute(JobRunContext context)
        {
            string customers = context.JobDataMap.GetStringValue("Customers");

            this.billMgr.TryCreateBill(customers);
        }
 public void Execute(JobRunContext context)
 {
     transportationOrderMgr.TryCloseTransportationOrder();
 }
Esempio n. 35
0
 public void Execute(JobRunContext context)
 {
     this.theEDIMgr.ReadEDIFordPlanASN();
 }
Esempio n. 36
0
 public void Execute(JobRunContext context)
 {
     this.theEDIMgr.RunBat();
 }
Esempio n. 37
0
        protected override Task <JobResult> RunInternalAsync(JobRunContext context)
        {
            RunCount++;

            return(Task.FromResult(JobResult.Success));
        }
 public void Execute(JobRunContext context)
 {
     this.theEDIMgr.ReadEDIFordPlanASN();
 }
Esempio n. 39
0
 private void IncrementCallCount(JobRunContext jobCtx)
 {
     System.Threading.Thread.Sleep(100);
     _noWaitCallCount++;
 }
Esempio n. 40
0
 public void Execute(JobRunContext context)
 {
     this.theEDIMgr.RunBat();
 }