using DSWeb.Common; using DSWeb.Common.DB; using DSWeb.Common.Helper; using log4net; using log4net.Repository.Hierarchy; using Newtonsoft.Json; using Newtonsoft.Json.Linq; using Quartz; using RabbitMQ.Client; using System; using System.Collections.Generic; using System.ComponentModel; using System.Configuration; using System.Linq; using System.Runtime.Caching; using System.Runtime.Remoting.Contexts; using System.Text; using System.Threading.Tasks; namespace DSWeb.Service.Output { // public class MakeNeedReadApply : IJob { private ILog log = LogManager.GetLogger(typeof(MakeNeedReadApply)); string DS7connStr = ConfigurationManager.AppSettings["DS7connStr"]; string DS7URL = ConfigurationManager.AppSettings["DS7URL"]; public void Execute(IJobExecutionContext context) { //int reqTimeout = Convert.ToInt32(context.JobDetail.JobDataMap.GetString("RequestTimeout")); try { log.Debug("Execute start"); // 申报日期为过去48小时之内的业务 //DecHead.DDate>= 当前时间-2天 && DecHead.DDate<当前时间 //和 //DecHead.AgentStatus==结关 且 OP_LOGICINFO,不存在 PROPNAME="结关已读取",BSNO=DecHead.BSNO 的数据 //not exists(select 1 from OP_LOGICINFO where PROPNAME='结关已读取' and BSNO=DecHead.BSNO) //查询来自视图:select * from VW_JGWL_APPLYNEEDREAD //结果写入 OP_LOGICINFO ,数值为NAME="定时读取单一窗口" BSNO=DecHead.BSNO //下方执行读取服务每次读取一条并删除一条 var cdc = new CommonDataContext(DS7connStr); var needreadList1 = cdc.VW_JGWL_APPLYNEEDREAD.Where(x => 1 == 1).ToList(); if (needreadList1 != null && needreadList1.Count > 0) { foreach (var item in needreadList1) { var newrec = new OP_LOGICINFO_md(); newrec.PROPNAME = "定时读取单一窗口"; newrec.BSNO = item.GID; newrec.PROPVALUE = item.GVALUE; cdc.OP_LOGICINFO.Add(newrec); } cdc.SaveChanges(); } log.Debug("Execute end"); } catch (Exception ex) { log.Debug($"catch:{ex.Message}"); log.Error(ex.Message); log.Error(ex.StackTrace); } } } }