DS7_JinGang
ddlucky 1 year ago
parent fb1ad1c851
commit 1626e45607

@ -1546,52 +1546,53 @@ SELECT @ps_BillNo as N'billno'";
StartTime = DateTime.Now;
}
}
private static List<> idList { get; set; } = new List<>();
private static void (string name="") {
var docount = 0;
if (idList != null)
public static class {
private static List<> idList { get; set; } = new List<>();
private static bool inworking { get; set; } = false;
public static void (long DJYID)
{
try
{
docount = idList.Count();
}
catch (Exception e1)
if (inworking)
{
}
DateTime dt1 = DateTime.Now;
while ((DateTime.Now - dt1).TotalMilliseconds < 10)
{
continue;
}
logger.Debug($"执行列表数({name}){docount};");
(DJYID);
return;
}
private static bool inworking { get; set; } = false;
public static void (long DJYID)
inworking = true;
if (idList != null && idList.Count > 0)
{
if (idList != null && idList.Count > 0) {
if (idList.Exists(x=>x.DJYID== DJYID))
if (idList.Exists(x => x.DJYID == DJYID))
{
try
{
try {
idList.RemoveAll(x => x.DJYID == DJYID);
logger.Debug($"移除执行:{DJYID};");
} catch (Exception e2) {
}
catch (Exception e2)
{
logger.Error($"移除执行出错:{DJYID};");
}
}
try
{
if (idList != null && idList.Count > 0)
{
if (idList.Exists(x => x.StartTime <= DateTime.Now.AddSeconds(-20)))
{
idList.RemoveAll(x => x.StartTime <= DateTime.Now.AddSeconds(-20));
logger.Debug($"移除超时20秒业务;");
}
}
if (idList != null && idList.Count > 0)
{
@ -1599,42 +1600,132 @@ SELECT @ps_BillNo as N'billno'";
logger.Debug($"剩余执行:{str};");
}
}
catch (Exception e1) {
catch (Exception e1)
{
}
}
}
catch (Exception e)
{
var str = JsonConvert.SerializeObject(e);
logger.Debug($"执行完成失败:{str}");
}
finally
{
public static void Do_DingCangToDS6(string itemstr,int count=0)
if (idList != null && idList.Count > 0)
{
var head = JsonConvert.DeserializeObject<DingCangHead>(itemstr);
if (count == 0)
if (idList.Exists(x => x.StartTime <= DateTime.Now.AddSeconds(-15)))
{
idList.RemoveAll(x => x.StartTime <= DateTime.Now.AddSeconds(-15));
logger.Debug($"移除超时15秒业务1;");
}
}
inworking = false;
}
}
public static bool (long DJYID)
{
if (inworking)
{
logger.Debug($"列表处理中重试(10){head.mblno};{head.Id}");
logger.Debug($"列表处理中重试(10){DJYID}");
DateTime dt1 = DateTime.Now;
while ((DateTime.Now - dt1).TotalMilliseconds < 10)
{
continue;
}
//var head0 = JsonConvert.DeserializeObject<DingCangHead>(itemstr);
Do_DingCangToDS6(itemstr, count);
return;
return (DJYID);
}
else
var result = true;
try
{
inworking = true;
if (idList == null) idList = new List<>();
if (idList.Exists(x => x.DJYID == DJYID))
{
logger.Debug($"执行中重试(500){DJYID}");
DateTime dt1 = DateTime.Now;
while ((DateTime.Now - dt1).TotalMilliseconds < 1000)
{
continue;
}
result =false;
}
else {
idList.Add(new (DJYID));
result = true;
}
return result;
}
catch (Exception e)
{
var str = JsonConvert.SerializeObject(e);
logger.Debug($"添加执行失败:{str}");
result = false;
return result;
}
finally
{
if (idList != null && idList.Count > 0)
{
if (idList.Exists(x => x.StartTime <= DateTime.Now.AddSeconds(-15)))
{
idList.RemoveAll(x => x.StartTime <= DateTime.Now.AddSeconds(-15));
logger.Debug($"移除超时15秒业务2;");
}
}
inworking = false;
}
}
public static void (string name = "")
{
var docount = 0;
if (idList != null)
{
try
{
docount = idList.Count();
}
catch (Exception e1)
{
}
}
logger.Debug($"执行列表数({name}){docount};");
}
}
public static void Do_DingCangToDS6(string itemstr,int count=0)
{
var head = JsonConvert.DeserializeObject<DingCangHead>(itemstr);
if (count >= 3) {
//记录包并return
logger.Debug($"重试失败:{itemstr}");
inworking = false;
.(head.Id);
return;
};
@ -1644,33 +1735,15 @@ SELECT @ps_BillNo as N'billno'";
try
{
if (idList != null && idList.Count > 0)
{
if (idList.Exists(x => x.DJYID == head.Id))
var _r = .(head.Id);
if (_r==false)
{
inworking = false;
logger.Debug($"执行中重试(1000){head.mblno};{head.Id}");
DateTime dt1 = DateTime.Now;
while ((DateTime.Now - dt1).TotalMilliseconds < 1000)
{
continue;
}
Do_DingCangToDS6(itemstr, count);
return;
}
else
{
idList.Add(new (head.Id));
inworking = false;
}
}
else
{
if (idList == null) { idList = new List<>(); }
idList.Add(new (head.Id));
inworking = false;
}
}
catch (Exception e)
{
@ -1678,7 +1751,7 @@ SELECT @ps_BillNo as N'billno'";
logger.Debug($"执行列表错误:{str}");
}
finally {
inworking = false;
}
@ -1734,7 +1807,7 @@ SELECT @ps_BillNo as N'billno'";
newhead. = updrec.;
logger.Debug($"开始处理(更新){newhead.主提单号};{newhead.DJYID}");
();
.();
Set(ref newhead, head);
DS6Data.t_op_seae.AddOrUpdate(newhead);
@ -1926,7 +1999,7 @@ SELECT @ps_BillNo as N'billno'";
newhead. = new;
logger.Debug($"开始处理(新增){newhead.主提单号};{newhead.DJYID}");
();
.();
var Code = "SE" + ((DateTime)(newhead.)).Year.ToString() + ((DateTime)(newhead.)).Month.ToString().PadLeft(2, '0');
@ -2031,8 +2104,8 @@ SELECT @ps_BillNo as N'billno'";
}
finally {
(head.Id);
("完成");
.(head.Id);
.("完成");
//ThreadSaveDS6_Single.处理完成(head.Id);
}
}

Loading…
Cancel
Save