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