|
|
|
@ -197,7 +197,7 @@ namespace DSWeb.Service.Output.DS7
|
|
|
|
|
//this.Stop(hostControl);
|
|
|
|
|
|
|
|
|
|
///* 测试时删去前面两个注释号
|
|
|
|
|
#region 订舱业务和删除订舱业务
|
|
|
|
|
#region 订舱业务
|
|
|
|
|
|
|
|
|
|
ConnectionFactory factory = new ConnectionFactory();
|
|
|
|
|
factory.Uri = new Uri(RecMqUri);
|
|
|
|
@ -220,7 +220,7 @@ namespace DSWeb.Service.Output.DS7
|
|
|
|
|
////压缩
|
|
|
|
|
|
|
|
|
|
var strBodyZip = Encoding.UTF8.GetString(body.ToArray());
|
|
|
|
|
logger.Debug($"收到大简云订舱输出压缩数据:{strBodyZip}");
|
|
|
|
|
//logger.Debug($"收到大简云订舱输出压缩数据:{strBodyZip}");
|
|
|
|
|
|
|
|
|
|
var strBody = Decompress(strBodyZip);
|
|
|
|
|
logger.Debug($"收到大简云订舱输出数据:{strBody}");
|
|
|
|
@ -276,11 +276,9 @@ namespace DSWeb.Service.Output.DS7
|
|
|
|
|
//// {
|
|
|
|
|
//// logger.Error(excep.Message);
|
|
|
|
|
//// logger.Error(excep.StackTrace);
|
|
|
|
|
|
|
|
|
|
//// excep = excep.InnerException;
|
|
|
|
|
//// }
|
|
|
|
|
//// }
|
|
|
|
|
|
|
|
|
|
////};
|
|
|
|
|
//////第二个参数控制【是否消费掉队列里的数据】
|
|
|
|
|
////modelDel.BasicConsume($"{QueuePrefix_Del}{CompanyId}", 消费队列数据, consumerDel);
|
|
|
|
@ -1451,46 +1449,7 @@ SELECT @ps_BillNo as N'billno'";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 调用DS6的委托编号存储过程
|
|
|
|
|
///
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="Code">SE加会计期间年月 共8位</param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public static string DS6GetBSNO(string Code)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
//string strConnection = "user id=sa;password=sa;initial catalog=MyTest;Server=YHB;Connect Timeout=30";
|
|
|
|
|
using (SqlConnection conn = new SqlConnection(DS6ConnStr))
|
|
|
|
|
{
|
|
|
|
|
conn.Open();
|
|
|
|
|
using (SqlCommand sqlComm = conn.CreateCommand())
|
|
|
|
|
{
|
|
|
|
|
//设置要调用的存储过程的名称
|
|
|
|
|
sqlComm.CommandText = "p_no_get";
|
|
|
|
|
//指定SqlCommand对象传给数据库的是存储过程的名称而不是sql语句
|
|
|
|
|
sqlComm.CommandType = CommandType.StoredProcedure;
|
|
|
|
|
|
|
|
|
|
SqlParameter username = sqlComm.Parameters.Add(new SqlParameter("@Code", SqlDbType.VarChar, 20));
|
|
|
|
|
//指明"@username"是输入参数
|
|
|
|
|
username.Direction = ParameterDirection.Input;
|
|
|
|
|
//为“@username”参数赋值
|
|
|
|
|
username.Value = Code;
|
|
|
|
|
|
|
|
|
|
SqlParameter Num = sqlComm.Parameters.Add(new SqlParameter("@Num", SqlDbType.VarChar, 20));
|
|
|
|
|
//指定"@password"为输出参数
|
|
|
|
|
Num.Direction = ParameterDirection.Output;
|
|
|
|
|
//执行
|
|
|
|
|
sqlComm.ExecuteNonQuery();
|
|
|
|
|
//得到输出参数的值,把赋值给name,注意,这里得到的是object类型的,要进行相应的类型轮换
|
|
|
|
|
string num = Convert.ToString(sqlComm.Parameters["@Num"].Value);
|
|
|
|
|
|
|
|
|
|
return num;
|
|
|
|
|
//MessageBox.Show(passwrod);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return "";
|
|
|
|
|
}
|
|
|
|
|
#region 大简云通过消息队列发布的订舱数据,保存至DS6 用于合川家业务从大简云发布的消息队列中解析至DS6数据库
|
|
|
|
|
|
|
|
|
|
public static void DingCangToDS6(JArray jarr)
|
|
|
|
@ -1511,13 +1470,15 @@ SELECT @ps_BillNo as N'billno'";
|
|
|
|
|
|
|
|
|
|
//var head = JsonConvert.DeserializeObject<DingCangHead>(itemstr);
|
|
|
|
|
|
|
|
|
|
ThreadSaveDS6_Single SaveThread = new ThreadSaveDS6_Single();
|
|
|
|
|
//ThreadSaveDS6_Single SaveThread = new ThreadSaveDS6_Single();
|
|
|
|
|
//有参调用实例方法,ParameterizedThreadStart是一个委托,input为object,返回值为void
|
|
|
|
|
Thread thread1 = new Thread(new ParameterizedThreadStart(SaveThread.FuncSend));
|
|
|
|
|
//Thread thread1 = new Thread(new ParameterizedThreadStart(SaveThread.FuncSend));
|
|
|
|
|
|
|
|
|
|
thread1.Start(itemstr);
|
|
|
|
|
//thread1.Start(itemstr);
|
|
|
|
|
|
|
|
|
|
//dolist.Add(head);
|
|
|
|
|
|
|
|
|
|
Task.Run(()=> { Do_DingCangToDS6(itemstr); });
|
|
|
|
|
//Do_DingCangToDS6(itemstr);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -1550,9 +1511,10 @@ SELECT @ps_BillNo as N'billno'";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public sealed class 执行中对象2 {
|
|
|
|
|
//执行中列表 已废弃
|
|
|
|
|
/*
|
|
|
|
|
public sealed class 执行中对象2
|
|
|
|
|
{
|
|
|
|
|
private static readonly Lazy<执行中对象2> lazy = new Lazy<执行中对象2>(() => new 执行中对象2());
|
|
|
|
|
public static 执行中对象2 Instance { get { return lazy.Value; } }
|
|
|
|
|
private 执行中对象2() { }
|
|
|
|
@ -1625,16 +1587,16 @@ SELECT @ps_BillNo as N'billno'";
|
|
|
|
|
finally
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
if (执行中idList != null && 执行中idList.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
//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秒业务1;");
|
|
|
|
|
}
|
|
|
|
|
// if (执行中idList.Exists(x => x.StartTime <= DateTime.Now.AddSeconds(-15)))
|
|
|
|
|
// {
|
|
|
|
|
// 执行中idList.RemoveAll(x => x.StartTime <= DateTime.Now.AddSeconds(-15));
|
|
|
|
|
// logger.Debug($"移除超时15秒业务1;");
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
//}
|
|
|
|
|
logger.Debug($"unlock_del:{DJYID};");
|
|
|
|
|
//inworking = false;
|
|
|
|
|
}
|
|
|
|
@ -1665,9 +1627,10 @@ SELECT @ps_BillNo as N'billno'";
|
|
|
|
|
if (执行中idList == null) 执行中idList = new List<执行订舱单>();
|
|
|
|
|
if (执行中idList.Exists(x => x.DJYID == DJYID))
|
|
|
|
|
{
|
|
|
|
|
logger.Debug($"执行中重试(100):{DJYID}");
|
|
|
|
|
Thread.Sleep(100);
|
|
|
|
|
result = false;
|
|
|
|
|
//logger.Debug($"执行中重试(100):{DJYID}");
|
|
|
|
|
//Thread.Sleep(100);
|
|
|
|
|
//result = false;
|
|
|
|
|
result = true;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
@ -1691,22 +1654,22 @@ SELECT @ps_BillNo as N'billno'";
|
|
|
|
|
if (执行中idList != null && 执行中idList.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
if (执行中idList.Exists(x => x.StartTime <= DateTime.Now.AddSeconds(-15)))
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
var delobj = 执行中idList.FirstOrDefault(x => x.StartTime <= DateTime.Now.AddSeconds(-15));
|
|
|
|
|
执行中idList.RemoveAll(x => x.StartTime <= DateTime.Now.AddSeconds(-15));
|
|
|
|
|
//inworking = false;
|
|
|
|
|
logger.Debug($"移除超时15秒业务2;{delobj.DJYID}");
|
|
|
|
|
}
|
|
|
|
|
catch (Exception e)
|
|
|
|
|
{
|
|
|
|
|
//inworking = false;
|
|
|
|
|
var str = JsonConvert.SerializeObject(e);
|
|
|
|
|
logger.Error($"移除超时15秒业务2错误;{str}");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//if (执行中idList.Exists(x => x.StartTime <= DateTime.Now.AddSeconds(-15)))
|
|
|
|
|
//{
|
|
|
|
|
// try
|
|
|
|
|
// {
|
|
|
|
|
// var delobj = 执行中idList.FirstOrDefault(x => x.StartTime <= DateTime.Now.AddSeconds(-15));
|
|
|
|
|
// 执行中idList.RemoveAll(x => x.StartTime <= DateTime.Now.AddSeconds(-15));
|
|
|
|
|
// //inworking = false;
|
|
|
|
|
// logger.Debug($"移除超时15秒业务2;{delobj.DJYID}");
|
|
|
|
|
// }
|
|
|
|
|
// catch (Exception e)
|
|
|
|
|
// {
|
|
|
|
|
// //inworking = false;
|
|
|
|
|
// var str = JsonConvert.SerializeObject(e);
|
|
|
|
|
// logger.Error($"移除超时15秒业务2错误;{str}");
|
|
|
|
|
// }
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
logger.Debug($"unlock:{DJYID};");
|
|
|
|
@ -1734,7 +1697,6 @@ SELECT @ps_BillNo as N'billno'";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//public static class 执行中对象 {
|
|
|
|
|
|
|
|
|
|
// public static void 执行完成(long DJYID)
|
|
|
|
|
// {
|
|
|
|
|
// try
|
|
|
|
@ -1754,7 +1716,7 @@ SELECT @ps_BillNo as N'billno'";
|
|
|
|
|
// }
|
|
|
|
|
// inworking = true;
|
|
|
|
|
// logger.Debug($"lock_del:{DJYID};");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// if (执行中idList != null && 执行中idList.Count > 0)
|
|
|
|
|
// {
|
|
|
|
@ -1912,51 +1874,23 @@ SELECT @ps_BillNo as N'billno'";
|
|
|
|
|
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
public static void Do_DingCangToDS6(string itemstr,int count=0)
|
|
|
|
|
{
|
|
|
|
|
var head = JsonConvert.DeserializeObject<DingCangHead>(itemstr);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (count >= 3) {
|
|
|
|
|
//记录包并return
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
logger.Debug($"重试失败:{itemstr}");
|
|
|
|
|
var dh = 执行中对象2.Instance;
|
|
|
|
|
dh.执行完成(head.Id);
|
|
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static void Do_DingCangToDS6(string itemstr,int count=0)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
decimal mark = 0.0M;
|
|
|
|
|
//logger.Debug($"线程开始:{Thread.CurrentThread.ManagedThreadId}");
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
var dh = 执行中对象2.Instance;
|
|
|
|
|
var _r = dh.添加执行(head.Id);
|
|
|
|
|
if (_r==false)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Do_DingCangToDS6(itemstr, count);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
catch (Exception e)
|
|
|
|
|
{
|
|
|
|
|
var str = JsonConvert.SerializeObject(e);
|
|
|
|
|
logger.Debug($"执行列表错误:{str}");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
finally {
|
|
|
|
|
|
|
|
|
|
if (count > 3) {
|
|
|
|
|
logger.Debug($"重试完结");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var head = JsonConvert.DeserializeObject<DingCangHead>(itemstr);
|
|
|
|
|
|
|
|
|
|
var errorobjstr = "";
|
|
|
|
|
|
|
|
|
|
decimal mark = 0.0m;
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
@ -1965,17 +1899,18 @@ SELECT @ps_BillNo as N'billno'";
|
|
|
|
|
//判断业务是否存在。判断依据为head.
|
|
|
|
|
//如果不存在 则新增
|
|
|
|
|
//如存在,则删除原有箱信息。
|
|
|
|
|
|
|
|
|
|
//logger.Debug($"查询业务:{head.Id}");
|
|
|
|
|
var currentBillList = DS6Data.t_op_seae.Where(x => x.DJYID == head.Id).ToList();
|
|
|
|
|
|
|
|
|
|
if (currentBillList != null && currentBillList.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
//更新当前业务
|
|
|
|
|
|
|
|
|
|
var updrec = currentBillList[0];
|
|
|
|
|
var headid = updrec.编号;
|
|
|
|
|
var newhead = head.GetOpseae();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//过滤权限 20230421 正式使用后不做人员限制
|
|
|
|
|
//var cando = 人员是否具备权限(newhead.录入人, "776");
|
|
|
|
|
//if (!cando)
|
|
|
|
@ -2007,12 +1942,12 @@ SELECT @ps_BillNo as N'billno'";
|
|
|
|
|
newhead.派车日期 = updrec.派车日期;
|
|
|
|
|
|
|
|
|
|
logger.Debug($"开始处理(更新):{newhead.主提单号};{newhead.DJYID}");
|
|
|
|
|
执行中对象2.执行列表数();
|
|
|
|
|
//执行中对象2.执行列表数();
|
|
|
|
|
|
|
|
|
|
Set头表箱封号件重尺(ref newhead, head);
|
|
|
|
|
DS6Data.t_op_seae.AddOrUpdate(newhead);
|
|
|
|
|
DS6Data.SaveChanges();
|
|
|
|
|
|
|
|
|
|
//logger.Debug($"更新业务1:{head.Id}");
|
|
|
|
|
#region 箱信息
|
|
|
|
|
DS6Data = new DS6DataContext();
|
|
|
|
|
var Currctnlist = DS6Data.t_op_ctn.Where(x => x.编号 == headid).ToList();
|
|
|
|
@ -2054,6 +1989,7 @@ SELECT @ps_BillNo as N'billno'";
|
|
|
|
|
mark = 1.11m;
|
|
|
|
|
DS6Data.t_op_ctn.RemoveRange(ctn_dellist);
|
|
|
|
|
DS6Data.SaveChanges();
|
|
|
|
|
//logger.Debug($"更新箱信息1:{head.Id}");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (ctn_addlist.Count > 0)
|
|
|
|
@ -2061,6 +1997,7 @@ SELECT @ps_BillNo as N'billno'";
|
|
|
|
|
mark = 1.112m;
|
|
|
|
|
DS6Data.t_op_ctn.AddRange(ctn_addlist);
|
|
|
|
|
DS6Data.SaveChanges();
|
|
|
|
|
//logger.Debug($"更新箱信息2:{head.Id}");
|
|
|
|
|
}
|
|
|
|
|
//if (ctn_updlist.Count > 0)
|
|
|
|
|
//{
|
|
|
|
@ -2083,7 +2020,7 @@ SELECT @ps_BillNo as N'billno'";
|
|
|
|
|
|
|
|
|
|
mark = 1.12m;
|
|
|
|
|
DS6Data.SaveChanges();
|
|
|
|
|
|
|
|
|
|
//logger.Debug($"更新提单信息:{head.Id}");
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 分单
|
|
|
|
@ -2128,12 +2065,14 @@ SELECT @ps_BillNo as N'billno'";
|
|
|
|
|
mark = 1.13m;
|
|
|
|
|
DS6Data.t_op_seae_assistant.RemoveRange(assistantDelList);
|
|
|
|
|
DS6Data.SaveChanges();
|
|
|
|
|
//logger.Debug($"更新分单信息1:{head.Id}");
|
|
|
|
|
}
|
|
|
|
|
if (assistantAddList.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
mark = 1.132m;
|
|
|
|
|
DS6Data.t_op_seae_assistant.AddRange(assistantAddList);
|
|
|
|
|
DS6Data.SaveChanges();
|
|
|
|
|
//logger.Debug($"更新分单信息2:{head.Id}");
|
|
|
|
|
}
|
|
|
|
|
//if (assistantUpdList.Count > 0)
|
|
|
|
|
//{
|
|
|
|
@ -2181,7 +2120,7 @@ SELECT @ps_BillNo as N'billno'";
|
|
|
|
|
};
|
|
|
|
|
errorobjstr = JsonConvert.SerializeObject(ob);
|
|
|
|
|
|
|
|
|
|
logger.Debug($"更新:{newhead.主提单号};{newhead.DJYID}");
|
|
|
|
|
//logger.Debug($"更新完成:{newhead.主提单号};{newhead.DJYID}");
|
|
|
|
|
|
|
|
|
|
AfterSave(newhead.编号);
|
|
|
|
|
//DS6Data.SaveChanges();
|
|
|
|
@ -2190,15 +2129,14 @@ SELECT @ps_BillNo as N'billno'";
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
//新增业务
|
|
|
|
|
|
|
|
|
|
var newhead = head.GetOpseae();
|
|
|
|
|
//过滤权限
|
|
|
|
|
//var cando = 人员是否具备权限(newhead.录入人, "776");
|
|
|
|
|
//if (!cando) continue;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var dh = new 获取编号Helper();
|
|
|
|
|
var new编号 = dh.DoGet();
|
|
|
|
|
var new编号 = 获取编号Helper.Instance.DoGet();
|
|
|
|
|
|
|
|
|
|
newhead.编号 = new编号;
|
|
|
|
|
newhead.主编号 = new编号;
|
|
|
|
@ -2211,17 +2149,17 @@ SELECT @ps_BillNo as N'billno'";
|
|
|
|
|
newhead.委托标准 = new编号;
|
|
|
|
|
|
|
|
|
|
logger.Debug($"开始处理(新增):{newhead.主提单号};{newhead.DJYID}");
|
|
|
|
|
执行中对象2.执行列表数();
|
|
|
|
|
//执行中对象2.执行列表数();
|
|
|
|
|
|
|
|
|
|
var 业务编号Code = "SE" + ((DateTime)(newhead.会计期间)).Year.ToString() + ((DateTime)(newhead.会计期间)).Month.ToString().PadLeft(2, '0');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
newhead.业务编号 = DS6GetBSNO(业务编号Code);
|
|
|
|
|
newhead.业务编号 = 获取业务编号Helper.Instance. DS6GetBSNO(业务编号Code);
|
|
|
|
|
|
|
|
|
|
Set头表箱封号件重尺(ref newhead, head);
|
|
|
|
|
DS6Data.t_op_seae.Add(newhead);
|
|
|
|
|
mark = 2.1m;
|
|
|
|
|
DS6Data.SaveChanges();
|
|
|
|
|
//logger.Debug($"新增save1:{newhead.主提单号};{newhead.DJYID}");
|
|
|
|
|
newhead = DS6Data.t_op_seae.First(x => x.业务编号 == newhead.业务编号);
|
|
|
|
|
|
|
|
|
|
var headid = newhead.编号;
|
|
|
|
@ -2230,12 +2168,20 @@ SELECT @ps_BillNo as N'billno'";
|
|
|
|
|
if (ctnlist != null && ctnlist.Count > 0)
|
|
|
|
|
DS6Data.t_op_ctn.RemoveRange(ctnlist);
|
|
|
|
|
var newctnList = head.GetCtnList(newhead.编号);
|
|
|
|
|
DS6Data.t_op_ctn.AddRange(newctnList);
|
|
|
|
|
if (newctnList != null && newctnList.Count > 0) {
|
|
|
|
|
DS6Data.t_op_ctn.AddRange(newctnList);
|
|
|
|
|
//logger.Debug($"新增ctn:{newhead.主提单号};{newhead.DJYID}");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var amslist = DS6Data.t_op_ams.Where(x => x.编号 == headid).ToList();
|
|
|
|
|
DS6Data.t_op_ams.RemoveRange(amslist);
|
|
|
|
|
var newamslist = head.GetAmsList(newhead);
|
|
|
|
|
DS6Data.t_op_ams.AddRange(newamslist);
|
|
|
|
|
if (newamslist != null && newamslist.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
DS6Data.t_op_ams.AddRange(newamslist);
|
|
|
|
|
//logger.Debug($"新增ams:{newhead.主提单号};{newhead.DJYID}");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var old_assistantList = DS6Data.t_op_seae_assistant.Where(x => x.编号 == headid).ToList();
|
|
|
|
|
//var assistantUpdList = new List<t_op_seae_assistant_md>();
|
|
|
|
@ -2272,8 +2218,11 @@ SELECT @ps_BillNo as N'billno'";
|
|
|
|
|
// DS6Data.t_op_seae_assistant.Add(upd);
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
if (assistantAddList.Count > 0)
|
|
|
|
|
if (assistantAddList!=null && assistantAddList.Count > 0) {
|
|
|
|
|
DS6Data.t_op_seae_assistant.AddRange(assistantAddList);
|
|
|
|
|
//logger.Debug($"新增assistant:{newhead.主提单号};{newhead.DJYID}");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -2291,6 +2240,7 @@ SELECT @ps_BillNo as N'billno'";
|
|
|
|
|
if (statusList != null && statusList.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
DS6Data.t_op_state.AddRange(statusList);
|
|
|
|
|
//logger.Debug($"新增statusList:{newhead.主提单号};{newhead.DJYID}");
|
|
|
|
|
mark = 3.22m;
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
@ -2299,7 +2249,7 @@ SELECT @ps_BillNo as N'billno'";
|
|
|
|
|
mark = 3.3m;
|
|
|
|
|
|
|
|
|
|
DS6Data.SaveChanges();
|
|
|
|
|
logger.Debug($"新增:{newhead.主提单号};{newhead.DJYID}");
|
|
|
|
|
//logger.Debug($"新增完成:{newhead.主提单号};{newhead.DJYID}");
|
|
|
|
|
AfterSave(newhead.编号);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -2308,19 +2258,15 @@ SELECT @ps_BillNo as N'billno'";
|
|
|
|
|
{
|
|
|
|
|
errorobjstr = JsonConvert.SerializeObject(e);
|
|
|
|
|
logger.Error($"导入订舱信息出错{mark}:{e}//{errorobjstr}");
|
|
|
|
|
logger.Error($"出错重试{count}:{itemstr}");
|
|
|
|
|
DateTime dt1 = DateTime.Now;
|
|
|
|
|
while ((DateTime.Now - dt1).TotalMilliseconds < 3000)
|
|
|
|
|
{
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
Do_DingCangToDS6(itemstr, count + 1);
|
|
|
|
|
logger.Error($"出错重试{count}:{head.Id}");
|
|
|
|
|
Thread.Sleep(100);
|
|
|
|
|
Task.Run(() => { Do_DingCangToDS6(itemstr, count + 1); });
|
|
|
|
|
}
|
|
|
|
|
finally {
|
|
|
|
|
var dh = 执行中对象2.Instance;
|
|
|
|
|
dh.执行完成(head.Id);
|
|
|
|
|
执行中对象2.执行列表数("完成");
|
|
|
|
|
//ThreadSaveDS6_Single.处理完成(head.Id);
|
|
|
|
|
//var dh = 执行中对象2.Instance;
|
|
|
|
|
//dh.执行完成(head.Id);
|
|
|
|
|
//执行中对象2.执行列表数("完成");
|
|
|
|
|
////ThreadSaveDS6_Single.处理完成(head.Id);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -2753,6 +2699,8 @@ SELECT @ps_BillNo as N'billno'";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//删除订舱 已废弃
|
|
|
|
|
/*
|
|
|
|
|
public void DelToDS6(string Ids)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
@ -2820,7 +2768,7 @@ SELECT @ps_BillNo as N'billno'";
|
|
|
|
|
// logger.Error($"删除订舱信息出错:{e}");
|
|
|
|
|
//}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
@ -5088,67 +5036,85 @@ SELECT @ps_BillNo as N'billno'";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public class 获取编号Helper {
|
|
|
|
|
public static bool inwork { get; set; } = false;
|
|
|
|
|
public class 获取编号Helper {
|
|
|
|
|
|
|
|
|
|
private static readonly Lazy<获取编号Helper> lazy = new Lazy<获取编号Helper>(() => new 获取编号Helper());
|
|
|
|
|
public static 获取编号Helper Instance { get { return lazy.Value; } }
|
|
|
|
|
private 获取编号Helper() { }
|
|
|
|
|
|
|
|
|
|
public static int newno { get; set; } = 0;
|
|
|
|
|
public string DoGet() {
|
|
|
|
|
|
|
|
|
|
if (inwork) {
|
|
|
|
|
DateTime dt1 = DateTime.Now;
|
|
|
|
|
while ((DateTime.Now - dt1).TotalMilliseconds < 100) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
return DoGet();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
inwork = true;
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
//logger.Debug("获取编号");
|
|
|
|
|
DS6DataContext DS6Data = new DS6DataContext();
|
|
|
|
|
var 编号 = DS6Data.t_op_seae.Max(m => m.编号);
|
|
|
|
|
if (编号 == null) 编号 = "0";
|
|
|
|
|
var new编号 = (int.Parse(编号) + 1).ToString().PadLeft(10, ' ');
|
|
|
|
|
var newint编号 = int.Parse(new编号.Trim());
|
|
|
|
|
|
|
|
|
|
if (newno == 0)
|
|
|
|
|
{
|
|
|
|
|
if (newint编号 > 0)
|
|
|
|
|
{
|
|
|
|
|
newno = newint编号;
|
|
|
|
|
}
|
|
|
|
|
}else
|
|
|
|
|
|
|
|
|
|
if (newno >= newint编号)
|
|
|
|
|
{
|
|
|
|
|
DateTime dt1 = DateTime.Now;
|
|
|
|
|
while ((DateTime.Now - dt1).TotalMilliseconds < 100)
|
|
|
|
|
{
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
return DoGet();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
newno = newint编号;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
inwork = false;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return new编号;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
logger.Debug("获取编号错误");
|
|
|
|
|
return DoGet();
|
|
|
|
|
}
|
|
|
|
|
finally {
|
|
|
|
|
inwork = false;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
public class 获取业务编号Helper
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
private static readonly Lazy<获取业务编号Helper> lazy = new Lazy<获取业务编号Helper>(() => new 获取业务编号Helper());
|
|
|
|
|
public static 获取业务编号Helper Instance { get { return lazy.Value; } }
|
|
|
|
|
private 获取业务编号Helper() { }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 调用DS6的委托编号存储过程
|
|
|
|
|
///
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="Code">SE加会计期间年月 共8位</param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public string DS6GetBSNO(string Code)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
//string strConnection = "user id=sa;password=sa;initial catalog=MyTest;Server=YHB;Connect Timeout=30";
|
|
|
|
|
using (SqlConnection conn = new SqlConnection(DS6ConnStr))
|
|
|
|
|
{
|
|
|
|
|
conn.Open();
|
|
|
|
|
using (SqlCommand sqlComm = conn.CreateCommand())
|
|
|
|
|
{
|
|
|
|
|
//设置要调用的存储过程的名称
|
|
|
|
|
sqlComm.CommandText = "p_no_get";
|
|
|
|
|
//指定SqlCommand对象传给数据库的是存储过程的名称而不是sql语句
|
|
|
|
|
sqlComm.CommandType = CommandType.StoredProcedure;
|
|
|
|
|
|
|
|
|
|
SqlParameter username = sqlComm.Parameters.Add(new SqlParameter("@Code", SqlDbType.VarChar, 20));
|
|
|
|
|
//指明"@username"是输入参数
|
|
|
|
|
username.Direction = ParameterDirection.Input;
|
|
|
|
|
//为“@username”参数赋值
|
|
|
|
|
username.Value = Code;
|
|
|
|
|
|
|
|
|
|
SqlParameter Num = sqlComm.Parameters.Add(new SqlParameter("@Num", SqlDbType.VarChar, 20));
|
|
|
|
|
//指定"@password"为输出参数
|
|
|
|
|
Num.Direction = ParameterDirection.Output;
|
|
|
|
|
//执行
|
|
|
|
|
sqlComm.ExecuteNonQuery();
|
|
|
|
|
//得到输出参数的值,把赋值给name,注意,这里得到的是object类型的,要进行相应的类型轮换
|
|
|
|
|
string num = Convert.ToString(sqlComm.Parameters["@Num"].Value);
|
|
|
|
|
|
|
|
|
|
return num;
|
|
|
|
|
//MessageBox.Show(passwrod);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return "";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|