diff --git a/DSWeb.DJYMQ/DS7Service.cs b/DSWeb.DJYMQ/DS7Service.cs index c91ee82e..e39ebe37 100644 --- a/DSWeb.DJYMQ/DS7Service.cs +++ b/DSWeb.DJYMQ/DS7Service.cs @@ -807,7 +807,7 @@ namespace DSWeb.Service.Output.DS7 // var DESTINATIONID = obj.GetValue("DESTINATIONID").ToString(); // var PORTDISCHARGE = obj.GetValue("PORTDISCHARGE").ToString(); // var PORTDISCHARGEID = obj.GetValue("PORTDISCHARGEID").ToString(); - + // var strETD = obj.GetValue("ETD").ToString(); // var ETD = Convert.ToDateTime(strETD); // var CompId = obj.GetValue("CompId").ToString(); @@ -1103,7 +1103,7 @@ namespace DSWeb.Service.Output.DS7 // if (fee == null) { // fee = dS7Data.CustFeeTemplateDetail.AsNoTracking().FirstOrDefault(x => x.CUSTOMERNAME == 委托单位.SHORTNAME && x.FEENAME == FeeShouName); // } - + // if (fee != null ) // { // var feeShou = new ch_fee_md(); @@ -1302,6 +1302,12 @@ namespace DSWeb.Service.Output.DS7 // } //} + public string GetUserRefList(string itemstr) + { + return itemstr; + } + + /// /// 生成编号(从东胜7移植并修改) @@ -1531,21 +1537,92 @@ SELECT @ps_BillNo as N'billno'"; } + + private static List 执行中idList { get; set; } = new List(); + + private static void 执行列表数() { + + var docount = 0; + if (执行中idList != null) + { + try + { + docount = 执行中idList.Count(); + } + catch (Exception e1) + { + + } + } + logger.Debug($"执行列表数:{docount}"); + } + private static bool inworking { get; set; } = false; + public void 执行完成(long DJYID) + { + if (执行中idList != null && 执行中idList.Count > 0) { + + } + } + public static void Do_DingCangToDS6(string itemstr,int count=0) { + var head = JsonConvert.DeserializeObject(itemstr); - if (count >= 3) { - //记录包并return + if (count == 0) + { + if (inworking) + { + logger.Debug($"列表处理中重试(10):{head.mblno};{head.Id}"); + DateTime dt1 = DateTime.Now; + while ((DateTime.Now - dt1).TotalMilliseconds < 10) + { + continue; + } + //var head0 = JsonConvert.DeserializeObject(itemstr); + + Do_DingCangToDS6(itemstr, count); + return; + } + else + { + inworking = true; + } + } + if (count >= 3) { + //记录包并return + logger.Debug($"重试失败:{itemstr}"); + inworking = true; + return; }; - var head = JsonConvert.DeserializeObject(itemstr); + decimal mark = 0.0M; + if (执行中idList.Exists(x => x == 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); + return; + } + else { + 执行中idList.Add(head.Id); + inworking = false; + } + + var errorobjstr = ""; + try { DS6DataContext DS6Data = new DS6DataContext(); @@ -1563,7 +1640,6 @@ SELECT @ps_BillNo as N'billno'"; var headid = updrec.编号; var newhead = head.GetOpseae(); - logger.Debug($"开始处理:{newhead.主提单号};{newhead.DJYID}"); //过滤权限 20230421 正式使用后不做人员限制 //var cando = 人员是否具备权限(newhead.录入人, "776"); @@ -1579,7 +1655,6 @@ SELECT @ps_BillNo as N'billno'"; //newhead.ETD = updrec.ETD; //newhead.开船日期= updrec.开船日期; - newhead.编号 = updrec.编号; newhead.主编号 = updrec.主编号; @@ -1596,10 +1671,15 @@ SELECT @ps_BillNo as N'billno'"; newhead.业务编号 = updrec.业务编号; newhead.派车日期 = updrec.派车日期; + logger.Debug($"开始处理(更新):{newhead.主提单号};{newhead.DJYID}"); + 执行列表数(); + Set头表箱封号件重尺(ref newhead, head); DS6Data.t_op_seae.AddOrUpdate(newhead); + DS6Data.SaveChanges(); #region 箱信息 + DS6Data = new DS6DataContext(); var Currctnlist = DS6Data.t_op_ctn.Where(x => x.编号 == headid).ToList(); var ctn_addlist = new List(); //var ctn_updlist = new List(); @@ -1649,23 +1729,30 @@ SELECT @ps_BillNo as N'billno'"; // DS6Data.t_op_ctn.AddOrUpdate(updctn); // } //} - + + mark = 1.11m; + DS6Data.SaveChanges(); #endregion #region 提单信息 - + DS6Data = new DS6DataContext(); 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); + + mark = 1.12m; + DS6Data.SaveChanges(); + #endregion #region 分单 //分单列表 + DS6Data = new DS6DataContext(); var newassistantList = head.GetAssistantList(newhead); var old_assistantList = DS6Data.t_op_seae_assistant.Where(x => x.编号 == headid).ToList(); - var assistantUpdList = new List(); + //var assistantUpdList = new List(); var assistantAddList = new List(); var assistantDelList = new List(); @@ -1673,78 +1760,84 @@ SELECT @ps_BillNo as N'billno'"; foreach (var assistant in newassistantList) { - if (old_assistantList.Exists(x => x.DJYCHILDRENID == assistant.DJYCHILDRENID)) - { - var curr = old_assistantList.First(x => x.DJYCHILDRENID == assistant.DJYCHILDRENID); - DingCangHead.GetAssistant(ref curr, assistant); - assistantUpdList.Add(curr); - } - else - { + //if (old_assistantList.Exists(x => x.DJYCHILDRENID == assistant.DJYCHILDRENID)) + //{ + // var curr = old_assistantList.First(x => x.DJYCHILDRENID == assistant.DJYCHILDRENID); + // DingCangHead.GetAssistant(ref curr, assistant); + // assistantUpdList.Add(curr); + //} + //else + //{ assistantAddList.Add(assistant); - } + //} } foreach (var old in old_assistantList) { - if (newassistantList.Exists(x => x.DJYCHILDRENID == old.DJYCHILDRENID)) - { + //if (newassistantList.Exists(x => x.DJYCHILDRENID == old.DJYCHILDRENID)) + //{ - } - else - { + //} + //else + //{ assistantDelList.Add(old); - } - } - if (assistantAddList.Count > 0) - { - DS6Data.t_op_seae_assistant.AddRange(assistantAddList); - } - if (assistantUpdList.Count > 0) - { - foreach (var upd in assistantUpdList) - { - DS6Data.t_op_seae_assistant.AddOrUpdate(upd); - } + //} } if (assistantDelList.Count > 0) { DS6Data.t_op_seae_assistant.RemoveRange(assistantDelList); } + if (assistantAddList.Count > 0) + { + DS6Data.t_op_seae_assistant.AddRange(assistantAddList); + } + //if (assistantUpdList.Count > 0) + //{ + // foreach (var upd in assistantUpdList) + // { + // DS6Data.t_op_seae_assistant.AddOrUpdate(upd); + // } + //} + + mark = 1.13m; + DS6Data.SaveChanges(); + #endregion #region 业务状态 + DS6Data = new DS6DataContext(); var Currstatuslist = DS6Data.t_op_state.Where(x => x.编号 == headid).ToList(); if (Currstatuslist != null && Currstatuslist.Count > 0) { DS6Data.t_op_state.RemoveRange(Currstatuslist); - mark = 1.11m; + } var statusList = head.GetOpStatus(newhead); if (statusList != null && statusList.Count > 0) { DS6Data.t_op_state.AddRange(statusList); - mark = 1.12m; + } + DS6Data.SaveChanges(); #endregion mark = 1.2m; - + DS6Data = new DS6DataContext(); var ob = new { head = newhead, ctnlist = ctn_addlist, amslist = newamslist, ass1 = assistantAddList, - ass2 = assistantUpdList, + //ass2 = assistantUpdList, ass3 = assistantDelList, }; errorobjstr = JsonConvert.SerializeObject(ob); logger.Debug($"更新:{newhead.主提单号};{newhead.DJYID}"); - DS6Data.SaveChanges(); + DS6Data.SaveChanges(); } else @@ -1770,6 +1863,9 @@ SELECT @ps_BillNo as N'billno'"; newhead.核销标准 = new编号; newhead.委托标准 = new编号; + logger.Debug($"开始处理(新增):{newhead.主提单号};{newhead.DJYID}"); + 执行列表数(); + var 业务编号Code = "SE" + ((DateTime)(newhead.会计期间)).Year.ToString() + ((DateTime)(newhead.会计期间)).Month.ToString().PadLeft(2, '0'); @@ -1851,6 +1947,8 @@ SELECT @ps_BillNo as N'billno'"; mark = 3.22m; } #endregion + + mark = 3.3m; logger.Debug($"新增:{newhead.主提单号};{newhead.DJYID}"); DS6Data.SaveChanges(); @@ -1861,338 +1959,370 @@ SELECT @ps_BillNo as N'billno'"; catch (Exception e) { logger.Error($"导入订舱信息出错{mark}:{e}//{errorobjstr}"); - logger.Debug($"出错重试{count}:{itemstr}"); + logger.Error($"出错重试{count}:{itemstr}"); + DateTime dt1 = DateTime.Now; + while ((DateTime.Now - dt1).TotalMilliseconds < 3000) + { + continue; + } Do_DingCangToDS6(itemstr, count + 1); } finally { + + if (执行中idList.Exists(x=>x==head.Id)) + { + try { + 执行中idList.RemoveAll(x => x == head.Id); + } catch (Exception e2) { + + } + } + var docount1 = 0; + if (执行中idList != null) + { + try + { + docount1 = 执行中idList.Count(); + } + catch (Exception e1) + { + + } + } + logger.Debug($"执行列表数:{docount1}"); //ThreadSaveDS6_Single.处理完成(head.Id); } } - public static void DingCangToDS6_OLD(JArray jarr) - { - var itemstr = ""; - decimal mark = 0.0M; - var errorobjstr = ""; - try - { - DS6DataContext DS6Data = new DS6DataContext(); - foreach (var item in jarr) - { - var obj = item as JObject; + #region 原保存逻辑 + //public static void DingCangToDS6_OLD(JArray jarr) + //{ + // var itemstr = ""; + // decimal mark = 0.0M; - itemstr = item.ToString(); + // var errorobjstr = ""; - var head = JsonConvert.DeserializeObject(itemstr); + // try + // { + // DS6DataContext DS6Data = new DS6DataContext(); + // foreach (var item in jarr) + // { + // var obj = item as JObject; - //判断业务是否存在。判断依据为head. - //如果不存在 则新增 - //如存在,则删除原有箱信息。 + // itemstr = item.ToString(); - var currentBillList = DS6Data.t_op_seae.Where(x => x.DJYID == head.Id).ToList(); + // var head = JsonConvert.DeserializeObject(itemstr); - if (currentBillList != null && currentBillList.Count > 0) - { - //更新当前业务 - var updrec = currentBillList[0]; - var headid = updrec.编号; - var newhead = head.GetOpseae(); - - //过滤权限 20230421 正式使用后不做人员限制 - //var cando = 人员是否具备权限(newhead.录入人, "776"); - //if (!cando) - //{ - // logger.Debug($"录入人无权限:{newhead.录入人}"); - // continue; + // //判断业务是否存在。判断依据为head. + // //如果不存在 则新增 + // //如存在,则删除原有箱信息。 - //} + // 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) + // //{ + // // logger.Debug($"录入人无权限:{newhead.录入人}"); + // // continue; - //ETD ATD 使用原有数据而不用大简云发布的信息覆盖(已取消) - //newhead.ETD = updrec.ETD; - //newhead.开船日期= updrec.开船日期; + // //} - newhead.编号 = updrec.编号; - newhead.主编号 = updrec.主编号; + // //ETD ATD 使用原有数据而不用大简云发布的信息覆盖(已取消) + // //newhead.ETD = updrec.ETD; + // //newhead.开船日期= updrec.开船日期; - //20230523 改为接收业务状态 - //newhead.业务状态 = updrec.业务状态; - newhead.费用状态 = updrec.费用状态; - newhead.主提单标准 = string.IsNullOrWhiteSpace(head.mblno) ? updrec.编号 : head.mblno; - newhead.报关标准 = updrec.报关标准; - newhead.报检标准 = updrec.报检标准; - newhead.分提单标准 = updrec.分提单标准; - newhead.核销标准 = updrec.核销标准; - newhead.委托标准 = updrec.委托标准; - newhead.业务编号 = updrec.业务编号; - newhead.派车日期 = updrec.派车日期; + // newhead.编号 = updrec.编号; + // newhead.主编号 = updrec.主编号; - Set头表箱封号件重尺(ref newhead, head); - DS6Data.t_op_seae.AddOrUpdate(newhead); + // //20230523 改为接收业务状态 + // //newhead.业务状态 = updrec.业务状态; + // newhead.费用状态 = updrec.费用状态; - #region 箱信息 - var Currctnlist = DS6Data.t_op_ctn.Where(x => x.编号 == headid).ToList(); - var ctn_addlist = new List(); - //var ctn_updlist = new List(); - var ctn_dellist = new List(); + // newhead.主提单标准 = string.IsNullOrWhiteSpace(head.mblno) ? updrec.编号 : head.mblno; + // newhead.报关标准 = updrec.报关标准; + // newhead.报检标准 = updrec.报检标准; + // newhead.分提单标准 = updrec.分提单标准; + // newhead.核销标准 = updrec.核销标准; + // newhead.委托标准 = updrec.委托标准; + // newhead.业务编号 = updrec.业务编号; + // newhead.派车日期 = updrec.派车日期; - var newctnList = head.GetCtnList(newhead.编号); + // Set头表箱封号件重尺(ref newhead, head); + // DS6Data.t_op_seae.AddOrUpdate(newhead); - foreach (var ctn in newctnList) - { - //if (Currctnlist.Exists(x => x.DJYCTNID == ctn.DJYCTNID)) - //{ - // var currctn = Currctnlist.First(x => x.DJYCTNID == ctn.DJYCTNID); - // DingCangHead.GetCtn(ref currctn, ctn); - - // ctn_updlist.Add(currctn); - //} - //else - //{ - ctn_addlist.Add(ctn); - //} - } + // #region 箱信息 + // var Currctnlist = DS6Data.t_op_ctn.Where(x => x.编号 == headid).ToList(); + // var ctn_addlist = new List(); + // //var ctn_updlist = new List(); + // var ctn_dellist = new List(); - foreach (var oldctn in Currctnlist) - { - //if (newctnList.Exists(x => x.DJYCTNID == oldctn.DJYCTNID)) - //{ - - //} - //else - //{ - ctn_dellist.Add(oldctn); - //} - } - if (ctn_dellist.Count > 0) - { - DS6Data.t_op_ctn.RemoveRange(ctn_dellist); - } - if (ctn_addlist.Count > 0) - { - DS6Data.t_op_ctn.AddRange(ctn_addlist); - } - //if (ctn_updlist.Count > 0) - //{ - // foreach (var updctn in ctn_updlist) - // { - // DS6Data.t_op_ctn.AddOrUpdate(updctn); - // } - //} + // var newctnList = head.GetCtnList(newhead.编号); + + // foreach (var ctn in newctnList) + // { + // //if (Currctnlist.Exists(x => x.DJYCTNID == ctn.DJYCTNID)) + // //{ + // // var currctn = Currctnlist.First(x => x.DJYCTNID == ctn.DJYCTNID); + // // DingCangHead.GetCtn(ref currctn, ctn); + + // // ctn_updlist.Add(currctn); + // //} + // //else + // //{ + // ctn_addlist.Add(ctn); + // //} + // } + + // foreach (var oldctn in Currctnlist) + // { + // //if (newctnList.Exists(x => x.DJYCTNID == oldctn.DJYCTNID)) + // //{ + + // //} + // //else + // //{ + // ctn_dellist.Add(oldctn); + // //} + // } + // if (ctn_dellist.Count > 0) + // { + // DS6Data.t_op_ctn.RemoveRange(ctn_dellist); + // } + // if (ctn_addlist.Count > 0) + // { + // DS6Data.t_op_ctn.AddRange(ctn_addlist); + // } + // //if (ctn_updlist.Count > 0) + // //{ + // // foreach (var updctn in ctn_updlist) + // // { + // // DS6Data.t_op_ctn.AddOrUpdate(updctn); + // // } + // //} - #endregion + // #endregion - #region 提单信息 + // #region 提单信息 - 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); - #endregion + // 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); + // #endregion - #region 分单 - //分单列表 - var newassistantList = head.GetAssistantList(newhead); + // #region 分单 + // //分单列表 + // var newassistantList = head.GetAssistantList(newhead); - var old_assistantList = DS6Data.t_op_seae_assistant.Where(x => x.编号 == headid).ToList(); - var assistantUpdList = new List(); - var assistantAddList = new List(); - var assistantDelList = new List(); + // var old_assistantList = DS6Data.t_op_seae_assistant.Where(x => x.编号 == headid).ToList(); + // var assistantUpdList = new List(); + // var assistantAddList = new List(); + // var assistantDelList = new List(); - //DS6Data.t_op_seae_assistant.RemoveRange(amslist); + // //DS6Data.t_op_seae_assistant.RemoveRange(amslist); - foreach (var assistant in newassistantList) - { - if (old_assistantList.Exists(x => x.DJYCHILDRENID == assistant.DJYCHILDRENID)) - { - var curr = old_assistantList.First(x => x.DJYCHILDRENID == assistant.DJYCHILDRENID); - DingCangHead.GetAssistant(ref curr, assistant); - assistantUpdList.Add(curr); - } - else - { - assistantAddList.Add(assistant); - } - } + // foreach (var assistant in newassistantList) + // { + // if (old_assistantList.Exists(x => x.DJYCHILDRENID == assistant.DJYCHILDRENID)) + // { + // var curr = old_assistantList.First(x => x.DJYCHILDRENID == assistant.DJYCHILDRENID); + // DingCangHead.GetAssistant(ref curr, assistant); + // assistantUpdList.Add(curr); + // } + // else + // { + // assistantAddList.Add(assistant); + // } + // } - foreach (var old in old_assistantList) - { - if (newassistantList.Exists(x => x.DJYCHILDRENID == old.DJYCHILDRENID)) - { + // foreach (var old in old_assistantList) + // { + // if (newassistantList.Exists(x => x.DJYCHILDRENID == old.DJYCHILDRENID)) + // { - } - else - { - assistantDelList.Add(old); - } - } - if (assistantAddList.Count > 0) - { - DS6Data.t_op_seae_assistant.AddRange(assistantAddList); - } - if (assistantUpdList.Count > 0) - { - foreach (var upd in assistantUpdList) - { - DS6Data.t_op_seae_assistant.AddOrUpdate(upd); - } - } - if (assistantDelList.Count > 0) - { - DS6Data.t_op_seae_assistant.RemoveRange(assistantDelList); - } - #endregion + // } + // else + // { + // assistantDelList.Add(old); + // } + // } + // if (assistantAddList.Count > 0) + // { + // DS6Data.t_op_seae_assistant.AddRange(assistantAddList); + // } + // if (assistantUpdList.Count > 0) + // { + // foreach (var upd in assistantUpdList) + // { + // DS6Data.t_op_seae_assistant.AddOrUpdate(upd); + // } + // } + // if (assistantDelList.Count > 0) + // { + // DS6Data.t_op_seae_assistant.RemoveRange(assistantDelList); + // } + // #endregion - #region 业务状态 - var Currstatuslist = DS6Data.t_op_state.Where(x => x.编号 == headid).ToList(); - if (Currstatuslist != null && Currstatuslist.Count > 0) - { - DS6Data.t_op_state.RemoveRange(Currstatuslist); - mark = 1.11m; - } - var statusList = head.GetOpStatus(newhead); - if (statusList != null && statusList.Count > 0) - { - DS6Data.t_op_state.AddRange(statusList); - mark = 1.12m; - } - #endregion + // #region 业务状态 + // var Currstatuslist = DS6Data.t_op_state.Where(x => x.编号 == headid).ToList(); + // if (Currstatuslist != null && Currstatuslist.Count > 0) + // { + // DS6Data.t_op_state.RemoveRange(Currstatuslist); + // mark = 1.11m; + // } + // var statusList = head.GetOpStatus(newhead); + // if (statusList != null && statusList.Count > 0) + // { + // DS6Data.t_op_state.AddRange(statusList); + // mark = 1.12m; + // } + // #endregion - mark = 1.2m; + // mark = 1.2m; - var ob = new - { - head = newhead, - ctnlist = ctn_addlist, - amslist = newamslist, - ass1 = assistantAddList, - ass2 = assistantUpdList, - ass3 = assistantDelList, + // var ob = new + // { + // head = newhead, + // ctnlist = ctn_addlist, + // amslist = newamslist, + // ass1 = assistantAddList, + // ass2 = assistantUpdList, + // ass3 = assistantDelList, - }; - errorobjstr = JsonConvert.SerializeObject(ob); + // }; + // errorobjstr = JsonConvert.SerializeObject(ob); - DS6Data.SaveChanges(); + // DS6Data.SaveChanges(); - } - else - { - //新增业务 - var newhead = head.GetOpseae(); - //过滤权限 - //var cando = 人员是否具备权限(newhead.录入人, "776"); - //if (!cando) continue; + // } + // else + // { + // //新增业务 + // var newhead = head.GetOpseae(); + // //过滤权限 + // //var cando = 人员是否具备权限(newhead.录入人, "776"); + // //if (!cando) continue; - var dh = new 获取编号Helper(); - var new编号 = dh.DoGet(); + // var dh = new 获取编号Helper(); + // var new编号 = dh.DoGet(); - newhead.编号 = new编号; - newhead.主编号 = new编号; + // newhead.编号 = new编号; + // newhead.主编号 = new编号; - newhead.主提单标准 = string.IsNullOrWhiteSpace(head.mblno) ? new编号 : head.mblno; - newhead.报关标准 = new编号; - newhead.报检标准 = new编号; - newhead.分提单标准 = new编号; - newhead.核销标准 = new编号; - newhead.委托标准 = new编号; + // newhead.主提单标准 = string.IsNullOrWhiteSpace(head.mblno) ? new编号 : head.mblno; + // newhead.报关标准 = new编号; + // newhead.报检标准 = new编号; + // newhead.分提单标准 = new编号; + // newhead.核销标准 = new编号; + // newhead.委托标准 = new编号; - 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'); - newhead.业务编号 = DS6GetBSNO(业务编号Code); + // newhead.业务编号 = DS6GetBSNO(业务编号Code); - Set头表箱封号件重尺(ref newhead, head); - DS6Data.t_op_seae.Add(newhead); - mark = 2.1m; - DS6Data.SaveChanges(); - newhead = DS6Data.t_op_seae.First(x => x.业务编号 == newhead.业务编号); + // Set头表箱封号件重尺(ref newhead, head); + // DS6Data.t_op_seae.Add(newhead); + // mark = 2.1m; + // DS6Data.SaveChanges(); + // newhead = DS6Data.t_op_seae.First(x => x.业务编号 == newhead.业务编号); - var headid = newhead.编号; + // var headid = newhead.编号; - var ctnlist = DS6Data.t_op_ctn.Where(x => x.编号 == headid).ToList(); - if (ctnlist != null && ctnlist.Count > 0) - DS6Data.t_op_ctn.RemoveRange(ctnlist); - var newctnList = head.GetCtnList(newhead.编号); - DS6Data.t_op_ctn.AddRange(newctnList); + // var ctnlist = DS6Data.t_op_ctn.Where(x => x.编号 == headid).ToList(); + // if (ctnlist != null && ctnlist.Count > 0) + // DS6Data.t_op_ctn.RemoveRange(ctnlist); + // var newctnList = head.GetCtnList(newhead.编号); + // DS6Data.t_op_ctn.AddRange(newctnList); - 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); + // 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); - var old_assistantList = DS6Data.t_op_seae_assistant.Where(x => x.编号 == headid).ToList(); - //var assistantUpdList = new List(); - var assistantAddList = new List(); - var assistantDelList = new List(); + // var old_assistantList = DS6Data.t_op_seae_assistant.Where(x => x.编号 == headid).ToList(); + // //var assistantUpdList = new List(); + // var assistantAddList = new List(); + // var assistantDelList = new List(); - //DS6Data.t_op_seae_assistant.RemoveRange(amslist); - var newassistantList = head.GetAssistantList(newhead); - foreach (var newassis in newassistantList) - { + // //DS6Data.t_op_seae_assistant.RemoveRange(amslist); + // var newassistantList = head.GetAssistantList(newhead); + // foreach (var newassis in newassistantList) + // { - if (old_assistantList != null && old_assistantList.Count > 0) - { - foreach (var oldassis in old_assistantList) - { - if (newassis.BSNO == oldassis.BSNO) - { + // if (old_assistantList != null && old_assistantList.Count > 0) + // { + // foreach (var oldassis in old_assistantList) + // { + // if (newassis.BSNO == oldassis.BSNO) + // { - assistantDelList.Add(oldassis); - } - else - { + // assistantDelList.Add(oldassis); + // } + // else + // { - } - } - } - assistantAddList.Add(newassis); - } - if (assistantDelList.Count > 0) - DS6Data.t_op_seae_assistant.RemoveRange(assistantDelList); - //if (assistantUpdList.Count > 0) - //{ - // foreach (var upd in assistantUpdList) - // DS6Data.t_op_seae_assistant.Add(upd); - //} + // } + // } + // } + // assistantAddList.Add(newassis); + // } + // if (assistantDelList.Count > 0) + // DS6Data.t_op_seae_assistant.RemoveRange(assistantDelList); + // //if (assistantUpdList.Count > 0) + // //{ + // // foreach (var upd in assistantUpdList) + // // DS6Data.t_op_seae_assistant.Add(upd); + // //} - if (assistantAddList.Count > 0) - DS6Data.t_op_seae_assistant.AddRange(assistantAddList); + // if (assistantAddList.Count > 0) + // DS6Data.t_op_seae_assistant.AddRange(assistantAddList); - logger.Debug($"添加数据:{newhead}"); - mark = 3.1m; + // logger.Debug($"添加数据:{newhead}"); + // mark = 3.1m; - #region 业务状态 - var Currstatuslist = DS6Data.t_op_state.Where(x => x.编号 == headid).ToList(); - if (Currstatuslist != null && Currstatuslist.Count > 0) - { + // #region 业务状态 + // var Currstatuslist = DS6Data.t_op_state.Where(x => x.编号 == headid).ToList(); + // if (Currstatuslist != null && Currstatuslist.Count > 0) + // { - DS6Data.t_op_state.RemoveRange(Currstatuslist); - mark = 3.21m; - } - var statusList = head.GetOpStatus(newhead); - if (statusList != null && statusList.Count > 0) - { - DS6Data.t_op_state.AddRange(statusList); - mark = 3.22m; - } - #endregion - mark = 3.3m; + // DS6Data.t_op_state.RemoveRange(Currstatuslist); + // mark = 3.21m; + // } + // var statusList = head.GetOpStatus(newhead); + // if (statusList != null && statusList.Count > 0) + // { + // DS6Data.t_op_state.AddRange(statusList); + // mark = 3.22m; + // } + // #endregion + // mark = 3.3m; - DS6Data.SaveChanges(); - } - } - } - catch (Exception e) - { - logger.Error($"导入订舱信息出错{mark}:{e}//{errorobjstr}"); - } - } + // DS6Data.SaveChanges(); + // } + // } + // } + // catch (Exception e) + // { + // logger.Error($"导入订舱信息出错{mark}:{e}//{errorobjstr}"); + // } + //} + + #endregion public static void Set头表箱封号件重尺(ref t_op_seae_md newhead, DingCangHead head) { var ctnList = head.GetCtnList(newhead.编号); @@ -4209,7 +4339,7 @@ SELECT @ps_BillNo as N'billno'"; { var 派车对象 = (大简云派车)大简云对象; - var currHeadLetterList = ds6.t_op_letter.Where(x => x.编号 == opseae.编号 && x.函电名称 == HeadLetter.函电名称).ToList(); + var currHeadLetterList = ds6.t_op_letter.Where(x => x.编号 == opseae.编号 && x.函电名称 == HeadLetter.函电名称 && x.DJYLETTERID== HeadLetter.DJYLETTERID).ToList(); var currlist = new List(); @@ -4240,7 +4370,22 @@ SELECT @ps_BillNo as N'billno'"; } else { opseae.承运车队 = ((t_op_letter_pc_md)ChildLetter).承运车队; - opseae.派车日期 = 派车对象.main.truckTime; + + var 派车日 =new DateTime(); + try + { + if (派车对象.main.truckTime != null) + { + 派车日 = (DateTime)(派车对象.main.truckTime); + 派车日 = new DateTime(派车日.Year, 派车日.Month, 派车日.Day); + } + } + catch (Exception) + { + } + + opseae.派车日期 = 派车日; + ds6.t_op_seae.AddOrUpdate(opseae); if (currlist != null && currlist.Count > 0) @@ -4560,7 +4705,7 @@ SELECT @ps_BillNo as N'billno'"; 备注 = SetLength(main.remark,200), 陆运费 = main.fee, 结算方式 = main.payMethodName, - DJYLETTERID = main.id, + DJYLETTERID = main.truckId, DJYBOOKINGID = main.bookingId }; var result = 大简云业务函电.getHelper( "派车通知", letterchild); @@ -4839,7 +4984,7 @@ SELECT @ps_BillNo as N'billno'"; #region 逻辑信息子表操作 - #region 将一个dictionary转化为用;;和::隔开的文本 + #region 将一个dictionary转化为用;;和::隔开的文本 public static string DicToStr(Dictionary dic) { var result = ""; @@ -4917,110 +5062,108 @@ SELECT @ps_BillNo as N'billno'"; #endregion - public class ThreadSaveDS6_List - { - public static bool inworking { get; set; } = false; + //public class ThreadSaveDS6_List + //{ + // public static bool inworking { get; set; } = false; - public static List 待处理列表 = new List(); + // public static List 待处理列表 = new List(); - public static List 处理中列表 = new List(); + // public static List 处理中列表 = new List(); - public static List 当前处理中DJYID列表 = new List(); + // public static List 当前处理中DJYID列表 = new List(); - public static void 处理完成(long DJYID) { + // public static void 处理完成(long DJYID) { - if (处理中列表 != null && 处理中列表.Count > 0) { - if (处理中列表.Exists(x => x.Id == DJYID)) { - try { - var delrec = 处理中列表.FirstOrDefault(x => x.Id == DJYID); - 处理中列表.Remove(delrec); - }catch (Exception e) - { - // - } - } - } - } - public void FuncSend(object o) - { - if (inworking == true) return; + // if (处理中列表 != null && 处理中列表.Count > 0) { + // if (处理中列表.Exists(x => x.Id == DJYID)) { + // try { + // var delrec = 处理中列表.FirstOrDefault(x => x.Id == DJYID); + // 处理中列表.Remove(delrec); + // }catch (Exception e) + // { + // // + // } + // } + // } + // } + // public void FuncSend(object o) + // { + // if (inworking == true) return; - inworking = true; + // inworking = true; - if (处理中列表 == null || 处理中列表.Count == 0) - { - 当前处理中DJYID列表 = new List(); - } - else { - 当前处理中DJYID列表 = 处理中列表.Select(s => s.Id).ToList(); - } + // if (处理中列表 == null || 处理中列表.Count == 0) + // { + // 当前处理中DJYID列表 = new List(); + // } + // else { + // 当前处理中DJYID列表 = 处理中列表.Select(s => s.Id).ToList(); + // } - var newrec = (List)o; + // var newrec = (List)o; - foreach (var item in newrec) { - item.StartDatetime=DateTime.Now; - } + // foreach (var item in newrec) { + // item.StartDatetime=DateTime.Now; + // } - 待处理列表.AddRange(newrec); + // 待处理列表.AddRange(newrec); - //var 待处理 + // //var 待处理 - void 执行待处理() { + // void 执行待处理() { - var dellist = new List(); - foreach (var item in 待处理列表) - { - if (当前处理中DJYID列表.Exists(x => x == item.Id)) - { - continue; - } - else - { - dellist.Add(item.Id); - 当前处理中DJYID列表.Add(item.Id); - 处理中列表.Add(item); - //Do_DingCangToDS6(item); - } - } - if (dellist != null && dellist.Count > 0) - { - foreach (var delid in dellist) - { - if (待处理列表.Exists(x => x.Id == delid)) - { - var delrec = 待处理列表.FirstOrDefault(x => x.Id == delid); - 待处理列表.Remove(delrec); - } - } - } - } + // var dellist = new List(); + // foreach (var item in 待处理列表) + // { + // if (当前处理中DJYID列表.Exists(x => x == item.Id)) + // { + // continue; + // } + // else + // { + // dellist.Add(item.Id); + // 当前处理中DJYID列表.Add(item.Id); + // 处理中列表.Add(item); + // //Do_DingCangToDS6(item); + // } + // } + // if (dellist != null && dellist.Count > 0) + // { + // foreach (var delid in dellist) + // { + // if (待处理列表.Exists(x => x.Id == delid)) + // { + // var delrec = 待处理列表.FirstOrDefault(x => x.Id == delid); + // 待处理列表.Remove(delrec); + // } + // } + // } + // } - try - { - while (待处理列表 != null && 待处理列表.Count > 0) { + // try + // { + // while (待处理列表 != null && 待处理列表.Count > 0) { - DateTime dt1 = DateTime.Now; - while ((DateTime.Now - dt1).TotalMilliseconds < 100) - { - continue; - } + // DateTime dt1 = DateTime.Now; + // while ((DateTime.Now - dt1).TotalMilliseconds < 100) + // { + // continue; + // } - 执行待处理(); - } + // 执行待处理(); + // } - } - catch (Exception e) - { + // } + // catch (Exception e) + // { - } - - finally { - inworking = false; - } - } - } - + // } + // finally { + // inworking = false; + // } + // } + //} public class ThreadSaveDS6_Single { @@ -5048,6 +5191,7 @@ SELECT @ps_BillNo as N'billno'"; } } } + }