public void Execute(IJobExecutionContext context) { try { DateTime date = DateTime.Now.Date; //(DateTime)context.MergedJobDataMap.Get("Date"); LogUtil.Logger.Info("start gen StockSumRecordJob"); //IStockSumRecordService ss = new StockSumRecordService(Properties.Settings.Default.db); //ss.Generate(date); CalculateSetting setting = new CalculateSetting() { TaskType = "SumStock", Parameters = DateTime.Now.Date.ToString() //new Dictionary<string, string>() }; // setting.Parameters.Add("date", DateTime.Now.Date.ToString()); ICalculateService cs = new CalculateService(Settings.Default.db); cs.Start(Settings.Default.mrpQueue, setting); LogUtil.Logger.Info("end gen StockSumRecordJob"); } catch (Exception ex) { LogUtil.Logger.Error("StockSumRecordJob exec error!"); LogUtil.Logger.Error(ex.Message); LogUtil.Logger.Error(ex.StackTrace); LogUtil.Logger.Info("[Refire] StockSumRecordJob"); JobExecutionException e2 = new JobExecutionException(ex); e2.RefireImmediately = true; throw e2; } }
public ActionResult RunMrp() { // [Bind(Include = "OrderType,MergeMethod")] CalculateSetting setting = new CalculateSetting() { TaskType = "MRP", OrderType = Request.Form.Get("OrderType"), PartType = (PartType)int.Parse(Request.Form.Get("PartType")), MergeMethod = new MergeMethod() { FirstDay = DateTime.Parse(Request.Form.Get("FirstDay")), Count = int.Parse(Request.Form.Get("Count")), MergeType = Request.Form.Get("MergeType") } }; Message msg = new Message() { Result = false }; try { ICalculateService cs = new CalculateService(Settings.Default.db); cs.Start(Settings.Default.mrpQueue, setting); msg.Result = true; msg.Msg = "MRP 任务运行成功!"; } catch (Exception e) { msg.Msg = e.Message; } return(Json(msg)); }
public void Execute(IJobExecutionContext context) { try { LogUtil.Logger.Info("start gen AutoStockJob"); List <string> files = FileUtility.GetAllFilesFromDirectory(Settings.Default.autoStockFilePath); //Regex r = new Regex(Settings.Default.autoStockFileRegex); LogUtil.Logger.Error(files); if (files != null && files.Count > 0) { foreach (string file in files) { // if (r.IsMatch(Path.GetFileName(file))){ string fileName = Path.GetFileName(file); if (Settings.Default.autoStockFileRegex.Split(';').Contains(fileName)) { if (FileUtility.IsFileOpen(file)) { string newFile = Process(file); if (!string.IsNullOrWhiteSpace(newFile)) { CalculateSetting setting = new CalculateSetting() { TaskType = "AutoStock", Parameters = newFile //new Dictionary<string, string>() }; // setting.Parameters.Add("file", newFile); ICalculateService cs = new CalculateService(Settings.Default.db); cs.Start(Settings.Default.mrpQueue, setting); } } } // } } } LogUtil.Logger.Info("end gen AutoStockJob"); } catch (Exception ex) { LogUtil.Logger.Error("AutoStockJob exec error!"); LogUtil.Logger.Error(ex.Message); LogUtil.Logger.Error(ex.StackTrace); throw ex; } }
public void Execute(IJobExecutionContext context) { try { LogUtil.Logger.Info("start gen KskBackFlashJob"); CalculateSetting setting = new CalculateSetting() { TaskType = "BF" }; ICalculateService cs = new CalculateService(Settings.Default.db); cs.Start(Settings.Default.mrpQueue, setting); LogUtil.Logger.Info("end gen KskBackFlashJob"); } catch (Exception ex) { LogUtil.Logger.Error("KskBackFlashJob exec error!"); LogUtil.Logger.Error(ex.Message); LogUtil.Logger.Error(ex.StackTrace); throw ex; } }