From ac9a1ada5538d5fefe5f3666265bf0255d113182 Mon Sep 17 00:00:00 2001 From: liuyunfeng Date: Tue, 16 Apr 2024 15:39:24 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E4=BF=AE=E6=94=B9bug=20=E5=AF=BC=E5=85=A5?= =?UTF-8?q?=E6=80=BB=E6=88=90=E6=97=B6=EF=BC=8C=E6=A0=A1=E9=AA=8C=E8=A7=84?= =?UTF-8?q?=E6=A0=BC=E8=AF=B4=E6=98=8E=E5=8C=85=E5=90=AB=E7=9A=844?= =?UTF-8?q?=E4=B8=AA=E7=89=A9=E6=96=99=E5=8F=B7=E5=88=86=E5=88=AB=E6=98=AF?= =?UTF-8?q?1001,1002,1003,1004?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AssemblyCfgs/AssemblyCfgErpAppService.cs | 69 ++++++++++++++++++- .../WY.NewJit.Application.xml | 8 +++ 2 files changed, 76 insertions(+), 1 deletion(-) diff --git a/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application/MsgBaseData/AssemblyCfgs/AssemblyCfgErpAppService.cs b/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application/MsgBaseData/AssemblyCfgs/AssemblyCfgErpAppService.cs index b2c88c0..bef0c11 100644 --- a/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application/MsgBaseData/AssemblyCfgs/AssemblyCfgErpAppService.cs +++ b/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application/MsgBaseData/AssemblyCfgs/AssemblyCfgErpAppService.cs @@ -741,6 +741,14 @@ SELECT top 1 v.Id ret.Status = false; return ret; } + var err2 = CheckMaterialRepeatByAssembly(srcLst, material3Lst); + if (!string.IsNullOrEmpty(err2)) + { + ret.Message = err2; + ret.Status = false; + return ret; + } + #endregion #region 插入数据 List assemblyCfgGroups = new List(); @@ -835,7 +843,66 @@ SELECT top 1 v.Id return error; } - + /// + /// 导入总成时,校验规格说明包含的4个物料号分别是1001,1002,1003,1004 + /// + /// 导入总成list + /// 总成物料list + /// + private string CheckMaterialRepeatByAssembly(List srcLst, List material3Lst) + { + StringBuilder strBuild = new StringBuilder(); + string[] arr = new string[4] { "1001", "1002", "1003", "1004" }; + string arrStr = string.Join(',', arr); + + var qry = from item in srcLst + group item by item.SpecExplain into g + select new + { + SpecExplain = g.Key, + ColorExplain = g.ElementAt(0).ColorExplain, + Details = g.Select(itm => itm.MaterialNum).ToList() + }; + foreach (var item in qry) + { + if (item.Details.Count != 4) + { + strBuild.AppendLine($"规格说明{item.SpecExplain}包含的物料号不是4个"); + } + //遍历物料号 + List strLst = new List(); + foreach (string materialNum in item.Details) + { + var materialObj = material3Lst.FirstOrDefault(itm => itm.RelationKey == materialNum); + if (materialObj == null) + { + strBuild.AppendLine($"规格说明{item.SpecExplain}:物料号{materialNum}在物料表不存在!"); + } + else + { + if (arr.Contains(materialObj.MaterialType2) == true) + { + strLst.Add(materialObj.MaterialType2); + } + else + { + strBuild.AppendLine($"规格说明{item.SpecExplain}:物料号{materialNum}的MaterialType2不是【{arrStr}】其中之一!"); + } + } + } + if (string.IsNullOrEmpty(strBuild.ToString())) + { + if (strLst.Count != strLst.Distinct().Count()) + { + string repeatLst = string.Join(',', strLst); + strBuild.AppendLine($"规格说明{item.SpecExplain}包含的配置号重复{repeatLst}"); + } + } + } + return strBuild.ToString(); + } + + //[UnitOfWork] //[HttpPost] //[Route("check")] diff --git a/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application/WY.NewJit.Application.xml b/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application/WY.NewJit.Application.xml index fcee04f..86da4d8 100644 --- a/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application/WY.NewJit.Application.xml +++ b/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application/WY.NewJit.Application.xml @@ -414,6 +414,14 @@ + + + 导入总成时,校验规格说明包含的4个物料号分别是1001,1002,1003,1004 + + 导入总成list + 总成物料list + + 系统初始化时使用,去掉重复的ERP总成 From 9195f1ca22d40e7803926c45e17e816a8d389291 Mon Sep 17 00:00:00 2001 From: liuyunfeng Date: Wed, 17 Apr 2024 17:32:50 +0800 Subject: [PATCH 2/4] =?UTF-8?q?bug=E5=AE=8C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../EdiReceive/ImportRecordAppService.cs | 47 +++++++++++-------- .../PrintTable/WaitPrintAppService.cs | 6 +-- .../WY.NewJit.Application.xml | 2 +- .../Services/EdiParseDomainService.cs | 6 ++- 4 files changed, 37 insertions(+), 24 deletions(-) diff --git a/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application/EdiReceive/ImportRecordAppService.cs b/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application/EdiReceive/ImportRecordAppService.cs index 12e9e0c..1af9f3f 100644 --- a/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application/EdiReceive/ImportRecordAppService.cs +++ b/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application/EdiReceive/ImportRecordAppService.cs @@ -78,6 +78,9 @@ namespace WY.NewJit.EdiReceive } } + private readonly IUnitOfWorkManager _unitOfWorkManager; + + #endregion @@ -91,7 +94,8 @@ namespace WY.NewJit.EdiReceive IBlobContainer blobContainer, DicDomainService dicDomainService, EdiParseDomainService ediParseDomainService, - Microsoft.Extensions.Configuration.IConfiguration configuration) + Microsoft.Extensions.Configuration.IConfiguration configuration, + IUnitOfWorkManager unitOfWorkManager) { _importRecordRepository = importRecordRepository; _logger = logger; @@ -100,6 +104,7 @@ namespace WY.NewJit.EdiReceive _dicDomainService = dicDomainService; _ediParseDomainService = ediParseDomainService; _configuration = configuration; + _unitOfWorkManager = unitOfWorkManager; } #region 私有方法 @@ -423,7 +428,7 @@ namespace WY.NewJit.EdiReceive /// 导入文件 /// 校验出错时,是否强制执行 /// 执行成功返回真 - [UnitOfWork] + [UnitOfWork(IsDisabled =true)] [HttpPost] [Route("import")] [DisableRequestSizeLimit] @@ -465,25 +470,29 @@ namespace WY.NewJit.EdiReceive return ret; } - var srcLst = impResult.Data.AsEnumerable().ToList(); - var tarLst = ObjectMapper.Map, List>(srcLst); - foreach (var tar in tarLst) - { - //tar.CreatePerson = "导入"; - tar.CreateTime = ServerHelper.CurrentDateTime; - } - //报文解析 - ObjectResultDto ret2 = await _ediParseDomainService.ParseEdi(tarLst, forceExecute); - if (ret2.Status == false) - { - return ret2; - } - if (ret2.Status == true && ret2.Message.HasValue()) + using (var uow = _unitOfWorkManager.Begin()) { - return ret2; + var srcLst = impResult.Data.AsEnumerable().ToList(); + var tarLst = ObjectMapper.Map, List>(srcLst); + foreach (var tar in tarLst) + { + //tar.CreatePerson = "导入"; + tar.CreateTime = ServerHelper.CurrentDateTime; + } + //报文解析 + ObjectResultDto ret2 = await _ediParseDomainService.ParseEdi(tarLst, forceExecute); + if (ret2.Status == false) + { + return ret2; + } + if (ret2.Status == true && ret2.Message.HasValue()) + { + return ret2; + } + await uow.CompleteAsync(); + ret.Status = true; + return ret; } - ret.Status = true; - return ret; } catch (Exception ex) { diff --git a/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application/PrintTable/WaitPrintAppService.cs b/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application/PrintTable/WaitPrintAppService.cs index 68f6af9..d4214c9 100644 --- a/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application/PrintTable/WaitPrintAppService.cs +++ b/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application/PrintTable/WaitPrintAppService.cs @@ -830,7 +830,7 @@ namespace WY.NewJit.PrintTable && itm.PrintType == PrintTypeEnum.OrderPrint //顺序打印 ).MinAsync(itm => itm.HostSN2); int minHostSN = minHostSN2 % 100000; - if (input.BeginHostSN != minHostSN) + if (input.BeginHostSN != minHostSN2) { retLst.Add($"输入的大众起始大众顺序号{input.BeginHostSN}和未打印表中的最小大众顺序号{minHostSN2}不相等!"); return new ListResultDto(retLst); @@ -853,7 +853,7 @@ namespace WY.NewJit.PrintTable string breakNumStr = string.Join(" ", breakNumLst); // string breakNumStr = string.Concat(breakNumLst); retLst.Add($"存在断号:{breakNumStr}"); - return new ListResultDto(retLst); + //return new ListResultDto(retLst); } //判断未知总成 bool containNotMatch = billLst.Any(itm => itm.BillStatus == BillStatusEnum.NotMatch); @@ -863,7 +863,7 @@ namespace WY.NewJit.PrintTable string str = string.Join(" ", lst); //string str = string.Concat(lst); retLst.Add($"存在未知总成:{str}"); - return new ListResultDto(retLst); + //return new ListResultDto(retLst); } return new ListResultDto(retLst); diff --git a/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application/WY.NewJit.Application.xml b/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application/WY.NewJit.Application.xml index 86da4d8..6d2a50c 100644 --- a/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application/WY.NewJit.Application.xml +++ b/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application/WY.NewJit.Application.xml @@ -49,7 +49,7 @@ 错误信息前缀 - + 构造函数 diff --git a/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Domain/EdiReceive/Services/EdiParseDomainService.cs b/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Domain/EdiReceive/Services/EdiParseDomainService.cs index f4f7401..fc99fdc 100644 --- a/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Domain/EdiReceive/Services/EdiParseDomainService.cs +++ b/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Domain/EdiReceive/Services/EdiParseDomainService.cs @@ -400,10 +400,14 @@ namespace WY.NewJit.EdiReceive.Services int curVal = notRepeatOrder[curIdx].HostSN; int priorIdx = curIdx - 1; int priorVal = notRepeatOrder[priorIdx].HostSN; - if (curVal - priorVal != 1) + if (curVal - priorVal > 1) { sb.AppendLine($"流水号{priorVal}和{curVal}之间存在断号"); } + else if (curVal - priorVal == 0) + { + sb.AppendLine($"流水号{priorVal}和{curVal}之间存在重复"); + } } return sb.ToString(); } From 5d3b517c4378c9e47f0963df14b2d195048f93f3 Mon Sep 17 00:00:00 2001 From: liuyunfeng Date: Thu, 18 Apr 2024 13:03:36 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E4=BA=8C=E8=BD=AE=E6=B5=8B=E8=AF=95?= =?UTF-8?q?=E4=BF=AE=E6=94=B9bug=E5=AE=8C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../MsgCheck/BillM100s/MenBanPackingRecService.cs | 2 +- .../MsgCheck/BillM100s/ZhuHuBanPackingRecService.cs | 2 +- .../EdiReceive/Services/EdiParseDomainService.cs | 5 ++++- .../EdiReceive/Services/HQ_M100DomainService.cs | 12 ++++++++++++ 4 files changed, 18 insertions(+), 3 deletions(-) diff --git a/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application/MsgCheck/BillM100s/MenBanPackingRecService.cs b/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application/MsgCheck/BillM100s/MenBanPackingRecService.cs index a733982..7a58b0b 100644 --- a/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application/MsgCheck/BillM100s/MenBanPackingRecService.cs +++ b/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application/MsgCheck/BillM100s/MenBanPackingRecService.cs @@ -360,7 +360,7 @@ namespace Win.Sfs.SettleAccount.FISes { if (alreadyPrintItem.BillStatus == BillStatusEnum.BreakNum && waitPrintLst[0].BillStatus == BillStatusEnum.BreakNum) { - throw new BusinessException("1001", "未打印列表和已打印列表出现都是断号的情况号码未【" + alreadyPrintItem.HostSN2 + "】,不能报废!"); + throw new BusinessException("1001", "未打印列表和已打印列表出现都是断号状态【" + alreadyPrintItem.HostSN2 + "】,不能报废!"); } //未打印有一条补打的记录,忽略已打印的对应记录,将未打印记录的补打状态改成顺序打印状态 if (waitPrintLst[0].PrintType == WY.NewJit.PrintTable.PrintTypeEnum.ReplenishPrint) diff --git a/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application/MsgCheck/BillM100s/ZhuHuBanPackingRecService.cs b/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application/MsgCheck/BillM100s/ZhuHuBanPackingRecService.cs index 54f364c..272a18e 100644 --- a/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application/MsgCheck/BillM100s/ZhuHuBanPackingRecService.cs +++ b/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application/MsgCheck/BillM100s/ZhuHuBanPackingRecService.cs @@ -396,7 +396,7 @@ namespace Win.Sfs.SettleAccount.FISes { if (alreadyPrintItem.BillStatus == BillStatusEnum.BreakNum && waitPrintLst[0].BillStatus == BillStatusEnum.BreakNum) { - throw new BusinessException("1001", "未打印列表和已打印列表出现都是断号的情况号码未【" + alreadyPrintItem.HostSN2 + "】,不能报废!"); + throw new BusinessException("1001", "未打印列表和已打印列表出现都是柱护板断号状态【" + alreadyPrintItem.HostSN2 + "】,不能报废!"); } //未打印有一条补打的记录,忽略已打印的对应记录,将未打印记录的补打状态改成顺序打印状态 if (waitPrintLst[0].PrintType == WY.NewJit.PrintTable.PrintTypeEnum.ReplenishPrint) diff --git a/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Domain/EdiReceive/Services/EdiParseDomainService.cs b/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Domain/EdiReceive/Services/EdiParseDomainService.cs index fc99fdc..8748c7a 100644 --- a/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Domain/EdiReceive/Services/EdiParseDomainService.cs +++ b/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Domain/EdiReceive/Services/EdiParseDomainService.cs @@ -311,8 +311,11 @@ namespace WY.NewJit.EdiReceive.Services { throw new Exception($"{_errorMessagePrefix}更新M100失败:{m100Obj.HostSN2}"); } + + bool hasBeforeNotPrint = await _hqM100DomainServie.BeforeNotPrint((int)(m100Obj.HostSN2)); + bool isReplenishPrint = hasBeforeNotPrint ? false : true; //未打印表包含重新解析之前的记录,设置成正常打印,否则设置成补打 //判断未打印表是否有数据,有则更新,没有则插入 - ObjectResultDto wpRet = await _hqM100DomainServie.InsertOrUpdateWaitPrintByM100(m100Ret, false, true); + ObjectResultDto wpRet = await _hqM100DomainServie.InsertOrUpdateWaitPrintByM100(m100Ret, false, isReplenishPrint); if (wpRet.Status == false) { throw new Exception(wpRet.Message); diff --git a/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Domain/EdiReceive/Services/HQ_M100DomainService.cs b/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Domain/EdiReceive/Services/HQ_M100DomainService.cs index 68e7220..892bc07 100644 --- a/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Domain/EdiReceive/Services/HQ_M100DomainService.cs +++ b/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Domain/EdiReceive/Services/HQ_M100DomainService.cs @@ -195,5 +195,17 @@ namespace WY.NewJit.MsgCheck } return ret; } + + /// + /// 根据传入参数hostSN2,判断存在小于hostSN2的未打印记录 + /// + /// + /// + public async Task BeforeNotPrint(int hostSN2) + { + var qry = await _waitPrintRepository.GetQueryableAsync(); + bool hasBeforeNotPrint = qry.Any(itm => itm.HostSN2 < hostSN2 && itm.PrintType == PrintTypeEnum.OrderPrint && itm.BillStatus == BillStatusEnum.Match); + return hasBeforeNotPrint; + } } } From 9312425ed44ad5130fd45de779eeda4aaddce4ad Mon Sep 17 00:00:00 2001 From: liuyunfeng Date: Mon, 22 Apr 2024 13:24:32 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=86=85=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../WY.NewJit.Application/MsgBaseData/Dics/DicAppService.cs | 4 ++-- .../PrintTemplateConfigurationService.cs | 4 ++-- .../src/WY.NewJit.Application/WY.NewJit.Application.xml | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application/MsgBaseData/Dics/DicAppService.cs b/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application/MsgBaseData/Dics/DicAppService.cs index c34b702..e05fa78 100644 --- a/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application/MsgBaseData/Dics/DicAppService.cs +++ b/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application/MsgBaseData/Dics/DicAppService.cs @@ -34,7 +34,7 @@ namespace WY.NewJit.MsgBaseData /// /// 日志 /// - private ILogger _logger; + private ILogger _logger; /// /// 错误信息前缀 @@ -52,7 +52,7 @@ namespace WY.NewJit.MsgBaseData /// public DicAppService( DicDomainService dicDomainService, - ILogger logger + ILogger logger ) { _dicDomainService = dicDomainService; diff --git a/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application/MsgBaseData/PrintTemplateConfiguration/PrintTemplateConfigurationService.cs b/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application/MsgBaseData/PrintTemplateConfiguration/PrintTemplateConfigurationService.cs index 7b17bba..c39cdde 100644 --- a/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application/MsgBaseData/PrintTemplateConfiguration/PrintTemplateConfigurationService.cs +++ b/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application/MsgBaseData/PrintTemplateConfiguration/PrintTemplateConfigurationService.cs @@ -37,7 +37,7 @@ namespace WY.NewJit.MsgBaseData /// /// 日志 /// - private ILogger _logger; + private ILogger _logger; /// /// Dapper仓储 @@ -70,7 +70,7 @@ namespace WY.NewJit.MsgBaseData /// public PrintTemplateConfigurationService( IRepository repository, - ILogger logger, + ILogger logger, NewJitDapperRepository newJitDapperRepository, IBlobContainer blobContainer, DicDomainService dicDomainService diff --git a/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application/WY.NewJit.Application.xml b/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application/WY.NewJit.Application.xml index 6d2a50c..c75cad4 100644 --- a/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application/WY.NewJit.Application.xml +++ b/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application/WY.NewJit.Application.xml @@ -637,7 +637,7 @@ 错误信息前缀 - + 构造函数 @@ -1114,7 +1114,7 @@ 错误信息前缀 - + 构造函数