You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
DS7/DSWeb.Service.Output/MakeNeedReadApply.cs

86 lines
2.8 KiB
C#

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

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("生成列表 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();
var nolist = new List<string>();
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;
nolist.Add($"[{item.GID},{item.GVALUE}]");
cdc.OP_LOGICINFO.Add(newrec);
}
cdc.SaveChanges();
}
var str= string.Join(",", nolist);
log.Debug(str);
log.Debug("生成列表 end");
}
catch (Exception ex)
{
log.Debug($"catch{ex.Message}");
log.Error(ex.Message);
log.Error(ex.StackTrace);
}
}
}
}