You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

74 lines
2.8 KiB

3 years ago
using System;
using System.Collections.Generic;
using System.Text;
using Stone.Common;
using Stone.Entity;
using System.Data;
namespace Stone.WinBiz.JISAdmin
{
public class F_Continuous
{
public static bool IsRun = false;
public static void Run()
{
while (IsRun)
{
try
{
if (MyAppconfig.ReadValue("JIS连续检查时间") == "") continue;
DateTime time = Convert.ToDateTime(MyAppconfig.ReadValue("JIS连续检查时间"));
if (time.Hour == DateTime.Now.Hour && time.Minute == DateTime.Now.Minute && time.Second == DateTime.Now.Second)
{
MyLogger.Write("数据连续判断开始...");
IsContinuous();
MyLogger.Write("数据连续判断完成...");
}
}
catch (Exception ex)
{
MyLogger.Write(ex.Message);
}
System.Threading.Thread.Sleep(1000);
}
}
public static void IsContinuous()
{
Entity_t_JIS_Seq5000_All t_JIS_Seq5000_All = new Entity_t_JIS_Seq5000_All();
Entity_t_Sys_AppconfigItem t_Sys_AppconfigItem = new Entity_t_Sys_AppconfigItem();
DataSet dsPackageGroupName = t_Sys_AppconfigItem.GetData("Code='print_group' and Value1 is not null");
string date1 = DateTime.Now.AddDays(1).ToString("yyyy-MM-dd 00:00:00");
string date2 = DateTime.Now.AddDays(4).ToString("yyyy-MM-dd 23:59:59");
foreach (DataRow drPackageGroupName in dsPackageGroupName.Tables[0].Rows)
{
DataSet dsSeq5000 = t_JIS_Seq5000_All.GetData("[CheckSequence]", "[PackageGroupName]='" + drPackageGroupName["Value1"].ToString() + "' and [SwetTime] >='" + date1 + "' and [SwetTime]<='" + date2 + "'", "[SequenceNumber] asc");
if (dsSeq5000.Tables[0].Rows.Count > 0)
{
int count = dsSeq5000.Tables[0].Rows.Count;
int first = Convert.ToInt32(dsSeq5000.Tables[0].Rows[0]["CheckSequence"]);
int last = Convert.ToInt32(dsSeq5000.Tables[0].Rows[count - 1]["CheckSequence"]);
int jg = last - first;
if (jg != count - 1)
{
string message = drPackageGroupName["Value1"].ToString() + "SwetTime【" + date1 + "】到【" + date2 + "】CheckSequence【" + first + "】到【" + last + "】 不连续情况";
MyLogger.Write(message);
//F_Mail.Send(message);
}
}
}
}
}
}