Exemplo n.º 1
0
        public void Execute(JobContext context)
        {
            if (!context.JobDataMap.ContainKey("UserCode"))
            {
                log.Error("User code not specified.");
            }

            if (!context.JobDataMap.ContainKey("Plant"))
            {
                log.Error("Plant not specified.");
            }

            if (context.JobDataMap.ContainKey("UserCode") && context.JobDataMap.ContainKey("Plant"))
            {
                SAPService.SAPService sapService = new SAPService.SAPService();
                if (context.JobDataMap.ContainKey("SIServiceAddress") && context.JobDataMap.ContainKey("SIServicePort"))
                {
                    sapService.Url = ServiceURLHelper.ReplaceServiceUrl(sapService.Url, context.JobDataMap.GetStringValue("SIServiceAddress"), context.JobDataMap.GetStringValue("SIServicePort"));
                }

                Double diffDate = 0;
                if (context.JobDataMap.ContainKey("DayDiff"))
                {
                    diffDate = context.JobDataMap.GetDoubleValue("DayDiff");
                }

                //sapService.GetProcOrdersAsync(context.JobDataMap.GetStringValue("UserCode"), null, null, context.JobDataMap.GetStringValue("Plant"), DateTime.Now.AddDays(diffDate), true);
            }
        }
Exemplo n.º 2
0
        public void Execute(JobContext context)
        {
            if (!context.JobDataMap.ContainKey("UserCode"))
            {
                log.Error("User code not specified.");
            }

            if (!context.JobDataMap.ContainKey("SystemCodes"))
            {
                log.Error("User code not specified.");
            }

            if (context.JobDataMap.ContainKey("UserCode") && context.JobDataMap.ContainKey("SystemCodes"))
            {
                FISService.FISService fisService = new FISService.FISService();
                if (context.JobDataMap.ContainKey("SIServiceAddress") && context.JobDataMap.ContainKey("SIServicePort"))
                {
                    fisService.Url = ServiceURLHelper.ReplaceServiceUrl(fisService.Url, context.JobDataMap.GetStringValue("SIServiceAddress"), context.JobDataMap.GetStringValue("SIServicePort"));
                }
                fisService.ExportAsync(context.JobDataMap.GetStringValue("SystemCodes").Split(','), context.JobDataMap.GetStringValue("UserCode"));
            }
            //if (!context.JobDataMap.ContainKey("UserCode"))
            //{
            //    log.Error("User code not specified.");
            //}

            //if (context.JobDataMap.ContainKey("UserCode"))
            //{
            //    string userCode = context.JobDataMap.GetStringValue("UserCode");
            //    FISService.FISService fISService = new FISService.FISService();
            //    fISService.Export();
            //}
        }
Exemplo n.º 3
0
 public void Execute(JobContext context)
 {
    
         FISService.FISService fisService = new FISService.FISService();
         if (context.JobDataMap.ContainKey("SIServiceAddress") && context.JobDataMap.ContainKey("SIServicePort"))
         {
             fisService.Url = ServiceURLHelper.ReplaceServiceUrl(fisService.Url, context.JobDataMap.GetStringValue("SIServiceAddress"), context.JobDataMap.GetStringValue("SIServicePort"));
         }
         fisService.UploadFileAsync();
     
 }
 public void Execute(JobContext context)
 {
     if (!context.JobDataMap.ContainKey("ProductLine"))
     {
         log.Error("ProductLine not specified.");
     }
     SAPService.SAPService sapService = new SAPService.SAPService();
     if (context.JobDataMap.ContainKey("SIServiceAddress") && context.JobDataMap.ContainKey("SIServicePort"))
     {
         sapService.Url = ServiceURLHelper.ReplaceServiceUrl(sapService.Url, context.JobDataMap.GetStringValue("SIServiceAddress"), context.JobDataMap.GetStringValue("SIServicePort"));
     }
     sapService.GetVehicleStationInfoByProductLine(context.JobDataMap.GetStringValue("ProductLine"));
 }
Exemplo n.º 5
0
        public void Execute(JobContext context)
        {
            if (!context.JobDataMap.ContainKey("UserCode"))
            {
                log.Error("User code not specified.");
            }

            if (context.JobDataMap.ContainKey("UserCode"))
            {
                SAPService.SAPService sapService = new SAPService.SAPService();
                if (context.JobDataMap.ContainKey("SIServiceAddress") && context.JobDataMap.ContainKey("SIServicePort"))
                {
                    sapService.Url = ServiceURLHelper.ReplaceServiceUrl(sapService.Url, context.JobDataMap.GetStringValue("SIServiceAddress"), context.JobDataMap.GetStringValue("SIServicePort"));
                }
                sapService.CreateDN(context.JobDataMap.GetStringValue("UserCode"));
            }
        }
Exemplo n.º 6
0
        public void Execute(JobContext context)
        {
            if (!context.JobDataMap.ContainKey("UserCode"))
            {
                log.Error("User code not specified.");
            }

            if (context.JobDataMap.ContainKey("UserCode"))
            {
                OrderService.OrderService orderService = new OrderService.OrderService();
                if (context.JobDataMap.ContainKey("SIServiceAddress") && context.JobDataMap.ContainKey("SIServicePort"))
                {
                    orderService.Url = ServiceURLHelper.ReplaceServiceUrl(orderService.Url, context.JobDataMap.GetStringValue("SIServiceAddress"), context.JobDataMap.GetStringValue("SIServicePort"));
                }
                orderService.RunLeanEngineAsync(context.JobDataMap.GetStringValue("UserCode"));
            }
        }
        public void Execute(JobContext context)
        {
            if (!context.JobDataMap.ContainKey("UserCode"))
            {
                log.Error("User code not specified.");
            }

            if (context.JobDataMap.ContainKey("UserCode"))
            {
                OrderService.OrderService serviceProxy = new OrderService.OrderService();
                //SAPService.SAPService sapService = new SAPService.SAPService();
                if (context.JobDataMap.ContainKey("SIServiceAddress") && context.JobDataMap.ContainKey("SIServicePort"))
                {
                    serviceProxy.Url = ServiceURLHelper.ReplaceServiceUrl(serviceProxy.Url, context.JobDataMap.GetStringValue("SIServiceAddress"), context.JobDataMap.GetStringValue("SIServicePort"));
                }
                serviceProxy.AutoGenAnDonOrderAsync(context.JobDataMap.GetStringValue("UserCode"));
            }
        }
Exemplo n.º 8
0
        public void Execute(JobContext context)
        {
            if (!context.JobDataMap.ContainKey("UserCode"))
            {
                log.Error("User code not specified.");
            }


            if (context.JobDataMap.ContainKey("UserCode"))
            {
                FISService.FISService fisService = new FISService.FISService();
                if (context.JobDataMap.ContainKey("SIServiceAddress") && context.JobDataMap.ContainKey("SIServicePort"))
                {
                    fisService.Url = ServiceURLHelper.ReplaceServiceUrl(fisService.Url, context.JobDataMap.GetStringValue("SIServiceAddress"), context.JobDataMap.GetStringValue("SIServicePort"));
                }
                fisService.ImportAsync(context.JobDataMap.GetStringValue("UserCode"));
            }
        }
Exemplo n.º 9
0
        public void Execute(JobContext context)
        {
            if (!context.JobDataMap.ContainKey("UserCode"))
            {
                log.Error("User code not specified.");
            }

            if (!context.JobDataMap.ContainKey("DayDiff"))
            {
                log.Error("Day difference not specified.");
            }

            if (context.JobDataMap.ContainKey("UserCode") && context.JobDataMap.ContainKey("DayDiff"))
            {
                OrderService.OrderService orderService = new OrderService.OrderService();
                if (context.JobDataMap.ContainKey("SIServiceAddress") && context.JobDataMap.ContainKey("SIServicePort"))
                {
                    orderService.Url = ServiceURLHelper.ReplaceServiceUrl(orderService.Url, context.JobDataMap.GetStringValue("SIServiceAddress"), context.JobDataMap.GetStringValue("SIServicePort"));
                }
                orderService.AutoCloseASNAsync(context.JobDataMap.GetStringValue("UserCode"), DateTime.Now.AddDays(context.JobDataMap.GetDoubleValue("DayDiff")));
            }
        }
Exemplo n.º 10
0
        public void Execute(JobContext context)
        {
            if (!context.JobDataMap.ContainKey("UserCode"))
            {
                log.Error("User code not specified.");
            }

            if (!context.JobDataMap.ContainKey("DayDiff"))
            {
                log.Error("Day difference not specified.");
            }

            if (context.JobDataMap.ContainKey("UserCode") && context.JobDataMap.ContainKey("DayDiff"))
            {
                string userCode = context.JobDataMap.GetStringValue("UserCode");
                DateTime dateTimeNow = DateTime.Now;
                SAPService.SAPService sapService = new SAPService.SAPService();
                if (context.JobDataMap.ContainKey("SIServiceAddress") && context.JobDataMap.ContainKey("SIServicePort"))
                {
                    sapService.Url = ServiceURLHelper.ReplaceServiceUrl(sapService.Url, context.JobDataMap.GetStringValue("SIServiceAddress"), context.JobDataMap.GetStringValue("SIServicePort"));
                }
                //sapService.GetProdOrders(userCode, dateTimeNow.AddDays(context.JobDataMap.GetDoubleValue("DayDiff")), null);
            }
        }
Exemplo n.º 11
0
        public void RunBatchJobs(IWindsorContainer container)
        {
            log.Info("----------------------------------Invincible's dividing line---------------------------------------");
            log.Info("BatchJobs run start.");

            IList<Trigger> tobeFiredTriggerList = this.GetTobeFiredTrigger();
            string siServiceAddress = this.dao.FindAllWithNativeSql<string>("select Value from SYS_EntityPreference where Id = ?", new object[] { com.Sconit.Entity.SYS.EntityPreference.CodeEnum.SIServiceAddress }).SingleOrDefault();
            string siServicePort = this.dao.FindAllWithNativeSql<string>("select Value from SYS_EntityPreference where Id = ?", new object[] { com.Sconit.Entity.SYS.EntityPreference.CodeEnum.SIServicePort }).SingleOrDefault();

            if (tobeFiredTriggerList != null && tobeFiredTriggerList.Count > 0)
            {
                //Parallel.ForEach(tobeFiredTriggerList, (tobeFiredTrigger) =>
                foreach (Trigger tobeFiredTrigger in tobeFiredTriggerList)
                {
                    Thread.Sleep(500);

                    JobDetail jobDetail = tobeFiredTrigger.JobDetail;
                    RunLog runLog = new RunLog();
                    try
                    {
                        #region Job运行前处理
                        BeforeJobRun(runLog, tobeFiredTrigger);
                        #endregion

                        #region 运行Job
                        JobDataMap dataMap = new JobDataMap();

                        #region 把WebService地址传入Job
                        if (!string.IsNullOrWhiteSpace(siServiceAddress)
                            && !string.IsNullOrWhiteSpace(siServicePort))
                        {
                            dataMap.PutData("SIServiceAddress", siServiceAddress);
                            dataMap.PutData("SIServicePort", siServicePort);
                        }
                        #endregion

                        #region Job参数获取
                        IList<JobParameter> jobParameterList = this.dao.FindAllWithCustomQuery<JobParameter>("from JobParameter where JobId = ?", jobDetail.Id);
                        if (jobParameterList != null && jobParameterList.Count > 0)
                        {
                            foreach (JobParameter jobParameter in jobParameterList)
                            {
                                log.Debug("Set Job Parameter Name:" + jobParameter.Key + ", Value:" + jobParameter.Value);
                                dataMap.PutData(jobParameter.Key, jobParameter.Value);
                            }
                        }
                        #endregion

                        #region Trigger参数获取
                        IList<TriggerParameter> triggerParameterList = this.dao.FindAllWithCustomQuery<TriggerParameter>("from TriggerParameter where TriggerId = ?", tobeFiredTrigger.Id);
                        if (triggerParameterList != null && triggerParameterList.Count > 0)
                        {
                            foreach (TriggerParameter triggerParameter in triggerParameterList)
                            {
                                log.Debug("Set Trigger Parameter Name:" + triggerParameter.Key + ", Value:" + triggerParameter.Value);
                                if (!dataMap.ContainKey(triggerParameter.Key))
                                {
                                    dataMap.PutData(triggerParameter.Key, triggerParameter.Value);
                                }
                            }
                        }
                        #endregion

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

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

                        #endregion

                        #region Job运行后处理
                        AfterJobRunSuccess(runLog, tobeFiredTrigger);
                        #endregion
                    }
                    catch (Exception ex)
                    {
                        AfterJobRunFail(runLog, tobeFiredTrigger, ex);
                    }
                    finally
                    {
                        #region 更新BatchTrigger
                        UpdateTrigger(tobeFiredTrigger);
                        #endregion
                    }
                }
                //);
            }
            else
            {
                log.Info("No job found may run in this batch.");
            }

            log.Info("BatchJobs run end.");
        }
Exemplo n.º 12
0
        public void Execute(JobContext context)
        {
            if (!context.JobDataMap.ContainKey("UserCode"))
            {
                log.Error("User code not specified.");
            }

            if (!context.JobDataMap.ContainKey("FtpServer"))
            {
                log.Error("FtpServer not specified.");
            }

            if (!context.JobDataMap.ContainKey("FtpPort"))
            {
                log.Error("FtpPort not specified.");
            }

            if (!context.JobDataMap.ContainKey("FtpUser"))
            {
                log.Error("FtpUser not specified.");
            }

            if (!context.JobDataMap.ContainKey("FtpPass"))
            {
                log.Error("FtpPass not specified.");
            }

            if (!context.JobDataMap.ContainKey("FtpFolder"))
            {
                log.Error("FtpFolder not specified.");
            }

            if (!context.JobDataMap.ContainKey("LocalFolder"))
            {
                log.Error("LocalFolder not specified.");
            }

            if (!context.JobDataMap.ContainKey("LocalTempFolder"))
            {
                log.Error("LocalTempFolder not specified.");
            }

            if (context.JobDataMap.ContainKey("UserCode") && context.JobDataMap.ContainKey("FtpServer")
                && context.JobDataMap.ContainKey("FtpPort") && context.JobDataMap.ContainKey("FtpUser")
                && context.JobDataMap.ContainKey("FtpPass") && context.JobDataMap.ContainKey("FtpFolder")
                && context.JobDataMap.ContainKey("LocalFolder") && context.JobDataMap.ContainKey("LocalTempFolder"))
            {
                SAPService.SAPService sapService = new SAPService.SAPService();
                if (context.JobDataMap.ContainKey("SIServiceAddress") && context.JobDataMap.ContainKey("SIServicePort"))
                {
                    sapService.Url = ServiceURLHelper.ReplaceServiceUrl(sapService.Url, context.JobDataMap.GetStringValue("SIServiceAddress"), context.JobDataMap.GetStringValue("SIServicePort"));
                }

                sapService.ReportLocLotDetAsync(context.JobDataMap.GetStringValue("UserCode"),
                                           context.JobDataMap.GetStringValue("FtpServer"),
                                           context.JobDataMap.GetIntValue("FtpPort"),
                                           context.JobDataMap.GetStringValue("FtpUser"),
                                           context.JobDataMap.GetStringValue("FtpPass"),
                                           context.JobDataMap.GetStringValue("FtpFolder"),
                                           context.JobDataMap.GetStringValue("LocalFolder"),
                                           context.JobDataMap.GetStringValue("LocalTempFolder"));
            }
        }