diff --git a/Myshipping.Application/Service/TaskManagePlat/Dtos/CalcLaraPageNumbersDto.cs b/Myshipping.Application/Service/TaskManagePlat/Dtos/CalcLaraPageNumbersDto.cs index 805742e0..dee4d66d 100644 --- a/Myshipping.Application/Service/TaskManagePlat/Dtos/CalcLaraPageNumbersDto.cs +++ b/Myshipping.Application/Service/TaskManagePlat/Dtos/CalcLaraPageNumbersDto.cs @@ -29,7 +29,7 @@ namespace Myshipping.Application /// /// 上次结束编号 /// - public Int32 numberTo { get; set; } + public string numberTo { get; set; } /// /// 原始序号 diff --git a/Myshipping.Application/Service/TaskManagePlat/Dtos/LaraPaperRegistPostDto.cs b/Myshipping.Application/Service/TaskManagePlat/Dtos/LaraPaperRegistPostDto.cs index 113b7ab2..1c054645 100644 --- a/Myshipping.Application/Service/TaskManagePlat/Dtos/LaraPaperRegistPostDto.cs +++ b/Myshipping.Application/Service/TaskManagePlat/Dtos/LaraPaperRegistPostDto.cs @@ -59,6 +59,16 @@ namespace Myshipping.Application /// /// 排序值 /// - public int SortNo { get; set; } + public decimal SortNo { get; set; } + + /// + /// + /// + public int DraftNum { get; set; } + + /// + /// + /// + public int LastNumberTo { get; set; } } } diff --git a/Myshipping.Application/Service/TaskManagePlat/TaskManageService.cs b/Myshipping.Application/Service/TaskManagePlat/TaskManageService.cs index 7564674a..6b5d95e4 100644 --- a/Myshipping.Application/Service/TaskManagePlat/TaskManageService.cs +++ b/Myshipping.Application/Service/TaskManagePlat/TaskManageService.cs @@ -97,6 +97,9 @@ namespace Myshipping.Application const string CONST_WEB_LARA_ACCOUNT_TYPE = "LaraWeb"; const string CONST_LARA_DOWN_URL_CODE = "LaraPaperPostUrl"; + //LARA纸计算常量 + const int LARA_PARER_DRAFT_VAR = 3; + public TaskManageService(SqlSugarRepository taskBaseInfoRepository, SqlSugarRepository taskSIFeedBackInfoRepository, SqlSugarRepository taskSIFeedBackContaInfoRepository, @@ -3034,31 +3037,31 @@ namespace Myshipping.Application if (currInfo != null) { - if(!l.SEALNO.Equals(currInfo.SEAL_NO)) + if(l.SEALNO != currInfo.SEAL_NO) { md.compareDiffList.Add(nameof(TaskVgmCompareDto.SealNo)); } - if (!l.CTNCODE.Equals(currInfo.CONTA_TYPE)) + if (l.CTNCODE != currInfo.CONTA_TYPE) { md.compareDiffList.Add(nameof(TaskVgmCompareDto.ContaType)); } - if (!l.CTNALL.Equals(currInfo.CONTA_TYPE_NAME)) + if (l.CTNALL != currInfo.CONTA_TYPE_NAME) { md.compareDiffList.Add(nameof(TaskVgmCompareDto.ContaTypeName)); } - if (!l.KGS.Equals(currInfo.KGS)) + if (l.KGS != currInfo.KGS) { md.compareDiffList.Add(nameof(TaskVgmCompareDto.KGS)); } - if (!l.TAREWEIGHT.Equals(currInfo.TAREWEIGHT)) + if (l.TAREWEIGHT != currInfo.TAREWEIGHT) { md.compareDiffList.Add(nameof(TaskVgmCompareDto.TareWeight)); } - if (!l.WEIGHKGS.Equals(currInfo.WEIGHKGS)) + if (l.WEIGHKGS != currInfo.WEIGHKGS) { md.compareDiffList.Add(nameof(TaskVgmCompareDto.WeighKGs)); } - if (!l.WEIGHTYPE.Equals(currInfo.WEIGHTYPE)) + if (l.WEIGHTYPE != currInfo.WEIGHTYPE) { md.compareDiffList.Add(nameof(TaskVgmCompareDto.WeighType)); } @@ -3088,31 +3091,31 @@ namespace Myshipping.Application if (currInfo != null) { - if (!l.SEAL_NO.Equals(currInfo.SEALNO)) + if (l.SEAL_NO != currInfo.SEALNO) { md.compareDiffList.Add(nameof(TaskVgmCompareDto.SealNo)); } - if (!l.CONTA_TYPE.Equals(currInfo.CTNCODE)) + if (l.CONTA_TYPE != currInfo.CTNCODE) { md.compareDiffList.Add(nameof(TaskVgmCompareDto.ContaType)); } - if (!l.CONTA_TYPE_NAME.Equals(currInfo.CTNALL)) + if (l.CONTA_TYPE_NAME != currInfo.CTNALL) { md.compareDiffList.Add(nameof(TaskVgmCompareDto.ContaTypeName)); } - if (!l.KGS.Equals(currInfo.KGS)) + if (l.KGS != currInfo.KGS) { md.compareDiffList.Add(nameof(TaskVgmCompareDto.KGS)); } - if (!l.TAREWEIGHT.Equals(currInfo.TAREWEIGHT)) + if (l.TAREWEIGHT != currInfo.TAREWEIGHT) { md.compareDiffList.Add(nameof(TaskVgmCompareDto.TareWeight)); } - if (!l.WEIGHKGS.Equals(currInfo.WEIGHKGS)) + if (l.WEIGHKGS != currInfo.WEIGHKGS) { md.compareDiffList.Add(nameof(TaskVgmCompareDto.WeighKGs)); } - if (!l.WEIGHTYPE.Equals(currInfo.WEIGHTYPE)) + if (l.WEIGHTYPE != currInfo.WEIGHTYPE) { md.compareDiffList.Add(nameof(TaskVgmCompareDto.WeighType)); } @@ -3603,9 +3606,22 @@ namespace Myshipping.Application { List list = new List(); + /* + LARA计算方法 + + 1、判断是否为首次加载,model.moveType为空时表示首次加载,触发InitCalcLaraPageNumbers方法。 + 2、如果 model.moveType有值时,判断是调整行位置,根据指定的行位置重新计算编号。 + */ try { - list = model.paperList; + if(string.IsNullOrWhiteSpace(model.moveType)) + { + list = InnerCalcLaraPageNumbers(model,true); + } + else + { + list = InnerCalcLaraPageNumbers(model); + } } catch (Exception ex) { @@ -3615,6 +3631,97 @@ namespace Myshipping.Application return list; } #endregion + + #region 计算LARA纸 + /// + /// 计算LARA纸 + /// + /// 请求LARA纸详情 + /// 是否初始化 true-初始化 + /// + private List InnerCalcLaraPageNumbers(CalcLaraPageNumbersDto model,bool isInit = false) + { + List list = new List(); + + //如果判断不是首次加载,需要将移动的行从列表移动到指定位置后,重新计算。 + if(!isInit) + { + model.paperList = model.paperList.Select(t => + { + if (t.SortNo == model.origIndex.Value) + { + //up + if(model.currIndex < model.origIndex) + { + t.SortNo = (decimal)model.currIndex.Value - 0.1m; + } + else + { + t.SortNo = (decimal)model.currIndex.Value + 0.1m; + } + } + + return t; + }).OrderBy(t => t.SortNo) + .Select((t, idx) => + { + t.SortNo = (decimal)idx + 1; + return t; + + }).ToList(); + } + + var mNumberTo = int.Parse(model.numberTo.TrimStart('0')); + + if (mNumberTo > 0) + { + int lastNumberTo = 0; + int lastNumberFrom = 0; + + model.paperList.OrderBy(t => t.SortNo).ToList().ForEach(t => + { + LaraPaperRegistPostDto info = new LaraPaperRegistPostDto(); + + info.SortNo = t.SortNo; + info.DraftNum = t.DraftNum; + info.TaskId = t.TaskId; + info.ORDNO = t.ORDNO; + info.MBLNO = t.MBLNO; + info.ISSUETYPE = t.ISSUETYPE; + + if (t.SortNo == 1) + { + lastNumberFrom = mNumberTo + 1; + info.NumberFrom = (lastNumberFrom).ToString().PadLeft(9, '0'); + + var currNumberTo = (t.DraftNum * LARA_PARER_DRAFT_VAR) + mNumberTo; + + info.NumberTo = currNumberTo.ToString().PadLeft(9, '0'); + info.PageSum = currNumberTo - lastNumberFrom + 1; + + lastNumberTo = currNumberTo; + } + else + { + lastNumberFrom = lastNumberTo + 1; + info.NumberFrom = (lastNumberFrom).ToString().PadLeft(9, '0'); + + var currNumberTo = (t.DraftNum * LARA_PARER_DRAFT_VAR) + lastNumberTo; + + info.NumberTo = currNumberTo.ToString().PadLeft(9, '0'); + info.PageSum = currNumberTo - lastNumberFrom + 1; + + lastNumberTo = currNumberTo; + } + + + list.Add(info); + }); + } + + return list; + } + #endregion } #region 样本业务提取帮助类