From b0a3fba68f33403336c51bc95a73edef30f67793 Mon Sep 17 00:00:00 2001 From: liuyunfeng Date: Wed, 8 May 2024 15:55:55 +0800 Subject: [PATCH] =?UTF-8?q?bug=E4=BF=AE=E6=94=B9=E5=AE=8C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../UserManagement/UserAppService.cs | 3 +- .../Dtos/ImportErpAssemblyGroupDto.cs | 4 +- .../MsgCheck/BillM100s/Dtos/BillM100Dto.cs | 13 + .../BillM100s/Dtos/ResultBillM100Dto.cs | 15 +- .../Dtos/ResultUnknownAssemblyDto.cs | 14 +- .../PrintTable/Dtos/WaitPrintDto.cs | 15 + .../WY.NewJit.Application.Contracts.xml | 42 +- .../AssemblyCfgs/AssemblyCfgErpAppService.cs | 403 +++++++++--------- .../UnknownAssemblyAppService.cs | 4 +- .../PrintTable/WaitPrintAppService.cs | 4 +- .../WY.NewJit.Application.xml | 2 +- .../Services/EdiParseDomainService.cs | 4 + .../Services/HQ_M100DomainService.cs | 4 + .../Services/AssemblyDomainService.cs | 105 ++--- .../MsgCheck/Entitys/BillM100.cs | 9 + .../PrintTable/Entitys/WaitPrint.cs | 10 + .../src/WY.NewJit.Web/appsettings.json | 7 +- 17 files changed, 390 insertions(+), 268 deletions(-) diff --git a/src/Modules/BaseService/BaseService.Application/UserManagement/UserAppService.cs b/src/Modules/BaseService/BaseService.Application/UserManagement/UserAppService.cs index 76539dc..7222645 100644 --- a/src/Modules/BaseService/BaseService.Application/UserManagement/UserAppService.cs +++ b/src/Modules/BaseService/BaseService.Application/UserManagement/UserAppService.cs @@ -198,8 +198,7 @@ namespace BaseService.Systems.UserManagement var branchRoles = await GetUserBranchRolesAsync(CurrentUsers.GetId()); var groupBranchRoles = branchRoles.GroupBy(x => x.BranchId) .Select(y => new {xx = new {BranchId = y.Key}, items = y}); - foreach (var group in groupBranchRoles - ) + foreach (var group in groupBranchRoles) { var mybranchrole = new BranchRoleDto { diff --git a/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application.Contracts/MsgBaseData/AssemblyCfgs/Dtos/ImportErpAssemblyGroupDto.cs b/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application.Contracts/MsgBaseData/AssemblyCfgs/Dtos/ImportErpAssemblyGroupDto.cs index 1b9adb2..5edd2b6 100644 --- a/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application.Contracts/MsgBaseData/AssemblyCfgs/Dtos/ImportErpAssemblyGroupDto.cs +++ b/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application.Contracts/MsgBaseData/AssemblyCfgs/Dtos/ImportErpAssemblyGroupDto.cs @@ -29,11 +29,11 @@ namespace WY.NewJit.MsgBaseData [Required(ErrorMessage = "颜色说明{0}是必填项")] public virtual string ColorExplain { get; set; } /// - /// 物料号 + /// SAP物料号 /// [ExporterHeader(DisplayName = "物料号")] [ImporterHeader(Name = "物料号")] - [Required(ErrorMessage = "物料号{0}是必填项")] + [Required(ErrorMessage = "SAP物料号{0}是必填项")] public virtual string MaterialNum { get; set; } } } diff --git a/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application.Contracts/MsgCheck/BillM100s/Dtos/BillM100Dto.cs b/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application.Contracts/MsgCheck/BillM100s/Dtos/BillM100Dto.cs index eab856e..4305fb4 100644 --- a/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application.Contracts/MsgCheck/BillM100s/Dtos/BillM100Dto.cs +++ b/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application.Contracts/MsgCheck/BillM100s/Dtos/BillM100Dto.cs @@ -124,5 +124,18 @@ namespace WY.NewJit.MsgCheck [ImporterHeader(Name = "手工操作日期")] public DateTime? OperationTime { get; set; } + /// + /// 规格说明:HSC0DRCC0001 + /// + [ExporterHeader(DisplayName = "规格说明")] + [ImporterHeader(Name = "规格说明")] + public virtual string SpecExplain { get; set; } + + /// + /// 颜色说明:车型描述后7位,石墨黑/云杉灰 + /// + [ExporterHeader(DisplayName = "颜色说明")] + [ImporterHeader(Name = "颜色说明")] + public virtual string ColorExplain { get; set; } } } diff --git a/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application.Contracts/MsgCheck/BillM100s/Dtos/ResultBillM100Dto.cs b/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application.Contracts/MsgCheck/BillM100s/Dtos/ResultBillM100Dto.cs index 472937c..659fcdd 100644 --- a/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application.Contracts/MsgCheck/BillM100s/Dtos/ResultBillM100Dto.cs +++ b/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application.Contracts/MsgCheck/BillM100s/Dtos/ResultBillM100Dto.cs @@ -150,8 +150,21 @@ namespace WY.NewJit.MsgCheck [ImporterHeader(IsIgnore = true)] public virtual string PrintBillNum { get; set; } + /// + /// 规格说明:HSC0DRCC0001 + /// + [ExporterHeader(DisplayName = "规格说明")] + [ImporterHeader(Name = "规格说明")] + public virtual string SpecExplain { get; set; } + + /// + /// 颜色说明:车型描述后7位,石墨黑/云杉灰 + /// + [ExporterHeader(DisplayName = "颜色说明")] + [ImporterHeader(Name = "颜色说明")] + public virtual string ColorExplain { get; set; } + - } } diff --git a/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application.Contracts/MsgCheck/UnknownAssemblys/Dtos/ResultUnknownAssemblyDto.cs b/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application.Contracts/MsgCheck/UnknownAssemblys/Dtos/ResultUnknownAssemblyDto.cs index 6fd6e39..f8e5692 100644 --- a/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application.Contracts/MsgCheck/UnknownAssemblys/Dtos/ResultUnknownAssemblyDto.cs +++ b/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application.Contracts/MsgCheck/UnknownAssemblys/Dtos/ResultUnknownAssemblyDto.cs @@ -109,7 +109,19 @@ namespace WY.NewJit.MsgCheck.UnknownAssemblys [ExporterHeader(DisplayName = "单据表描述")] [ImporterHeader(Name = "单据表描述")] public string BillDescription { get; set; } - + /// + /// 规格说明:HSC0DRCC0001 + /// + [ExporterHeader(DisplayName = "规格说明")] + [ImporterHeader(Name = "规格说明")] + public virtual string SpecExplain { get; set; } + + /// + /// 颜色说明:车型描述后7位,石墨黑/云杉灰 + /// + [ExporterHeader(DisplayName = "颜色说明")] + [ImporterHeader(Name = "颜色说明")] + public virtual string ColorExplain { get; set; } } } diff --git a/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application.Contracts/PrintTable/Dtos/WaitPrintDto.cs b/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application.Contracts/PrintTable/Dtos/WaitPrintDto.cs index 4389b64..cfeb60b 100644 --- a/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application.Contracts/PrintTable/Dtos/WaitPrintDto.cs +++ b/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application.Contracts/PrintTable/Dtos/WaitPrintDto.cs @@ -154,5 +154,20 @@ namespace WY.NewJit.PrintTable [ExporterHeader(DisplayName = "R100接收时间")] [ImporterHeader(Name = "R100接收时间")] public DateTime? R100ReceiveTime { get; set; } + + /// + /// 规格说明:HSC0DRCC0001 + /// + [ExporterHeader(DisplayName = "规格说明")] + [ImporterHeader(Name = "规格说明")] + public virtual string SpecExplain { get; set; } + + /// + /// 颜色说明:车型描述后7位,石墨黑/云杉灰 + /// + [ExporterHeader(DisplayName = "颜色说明")] + [ImporterHeader(Name = "颜色说明")] + public virtual string ColorExplain { get; set; } + } } diff --git a/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application.Contracts/WY.NewJit.Application.Contracts.xml b/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application.Contracts/WY.NewJit.Application.Contracts.xml index c0b0ef5..b7f7c4a 100644 --- a/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application.Contracts/WY.NewJit.Application.Contracts.xml +++ b/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application.Contracts/WY.NewJit.Application.Contracts.xml @@ -1440,7 +1440,7 @@ - 物料号 + SAP物料号 @@ -2281,6 +2281,16 @@ 手工操作日期 + + + 规格说明:HSC0DRCC0001 + + + + + 颜色说明:车型描述后7位,石墨黑/云杉灰 + + 零件查询结果DTO @@ -2601,6 +2611,16 @@ 柱护板打印状态(不为空时表示已打印) + + + 规格说明:HSC0DRCC0001 + + + + + 颜色说明:车型描述后7位,石墨黑/云杉灰 + + 生产线 @@ -4007,6 +4027,16 @@ 单据表描述 + + + 规格说明:HSC0DRCC0001 + + + + + 颜色说明:车型描述后7位,石墨黑/云杉灰 + + 是否选中全部 @@ -4440,5 +4470,15 @@ R100接收时间 + + + 规格说明:HSC0DRCC0001 + + + + + 颜色说明:车型描述后7位,石墨黑/云杉灰 + + 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 bef0c11..5b7d382 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 @@ -492,200 +492,201 @@ SELECT top 1 v.Id [DisableRequestSizeLimit] public virtual async Task> ImportErpAssemblyAsync([FromForm] IFormFileCollection files) { - _logger.LogDebug(_errorMessagePrefix + "ImportErpAssemblyAsync 进入"); - ObjectResultDto ret = new ObjectResultDto(); - try - { - List material3Lst = await _materialExtRepository.Where(itm => itm.MaterialType == "3").ToListAsync(); - List partCfgLst = await _partCfgRepository.GetListAsync(); //取结算件信息列表 - List ass2partLst = new List(); - using (var memoryStream = new MemoryStream()) - { - //保存到内存流 - IFormFile file = files[0]; - await file.CopyToAsync(memoryStream); - memoryStream.Seek(0, SeekOrigin.Begin); - StreamReader sr = new StreamReader(memoryStream, Encoding.Default); - string strLine = ""; //记录每次读取的一行记录 - string[] aryLine = null; //记录每行记录中的各字段内容 - int columnCount = 0; //标示列数 - //遍历文件行 - while ((strLine = sr.ReadLine()) != null) - { - if (strLine.IsNullOrEmpty()) - { - continue; - } - if (strLine.Contains('�')) - { - ret.Message = "导入文件的格式不对,请将其转换成utf-8格式后再导入"; - ret.Status = false; - return ret; - } - - aryLine = strLine.Split(" "); - columnCount = aryLine.Count(); - if (columnCount == 0) - { - continue; - } - if (columnCount < 14) - { - ret.Message = "当前行的列数小于14,行号:" + aryLine[0]; - ret.Status = false; - return ret; - } - ErpAssemblyInfo2Part ass2partObj = new ErpAssemblyInfo2Part(); - ass2partObj.ErpAssemblyCode = aryLine[1].Trim(); - ass2partObj.ErpAssemblyName = aryLine[2].Trim(); - //从物料表取车型,操作员导入BOM时已经在SAP中录入物料了 - MaterialExt materialObj = material3Lst.FirstOrDefault(itm => itm.MaterialNum == ass2partObj.ErpAssemblyCode); - if (materialObj != null) - { - ass2partObj.VehicleModel = materialObj.VehicleModel; - ass2partObj.MaterialMemo = materialObj.MaterialMemo?.Replace(" ",""); //SAP分组 - } - - //将模板中的SAP物料号转换成客户零件号 - string sapMaterialNum = aryLine[11].Trim().Replace(" "," "); //取派格SAP物料号 - var partCfgObj = partCfgLst.FirstOrDefault(itm => itm.RelationKey == sapMaterialNum); - if (partCfgObj != null) - { - ass2partObj.PartCode = partCfgObj.PartCode; - ass2partObj.PartCode2 = sapMaterialNum; - } - else - { - ret.Message = $"当前行的SAP物料号在零件信息表没有匹配的客户零件号,行号:{aryLine[0]},SAP物料号:{sapMaterialNum}"; - ret.Status = false; - return ret; - } - ass2partObj.PartNum = aryLine[13].TryToDouble(); - - //数据校验 - if (ass2partObj.ErpAssemblyCode == null || ass2partObj.ErpAssemblyCode.Trim() == "") - { - ret.Message = "当前行的ERP总成代码列是空,行号:" + aryLine[0]; - ret.Status = false; - return ret; - } - if (ass2partObj.PartCode == null || ass2partObj.PartCode.Trim() == "") - { - if (partCfgObj.IsDisable == true) //不参与解析的也进入BOM, 报文解析时排除 - { - } - else - { - ret.Message = "当前行的零件代码列是空,行号:" + aryLine[0] + "对应SAP零件号:" + sapMaterialNum; - ret.Status = false; - return ret; - } - } - if (ass2partObj.PartNum == null || ass2partObj.PartNum == 0) - { - ret.Message = "当前行的零件数量列是空或零,行号:" + aryLine[0]; - ret.Status = false; - return ret; - } - ass2partLst.Add(ass2partObj); - } - } - //取Erp总成 - List erpDataLst = await _assemblyCfgErpRepository.GetListAsync(itm => itm.NewVersionId == null, true); - - //总成编码去重 - List erpAssemblyCodeLst = ass2partLst - .Where(itm => string.IsNullOrEmpty(itm.ErpAssemblyCode) == false) - .Select(itm => itm.ErpAssemblyCode) - .Distinct() - .ToList(); - //校验导入 - string repeatMsg = ""; - foreach (var erpAssemblyCode in erpAssemblyCodeLst) - { - var partLst = ass2partLst.Where(itm => itm.ErpAssemblyCode == erpAssemblyCode).ToList(); - if (partLst.Count() > 0) - { - string erpAssCode = partLst[0].ErpAssemblyCode; - string erpAssName = partLst[0].ErpAssemblyName; - string vehicleModel = partLst[0].VehicleModel; - AssemblyCfgErp erpObj = new AssemblyCfgErp( - GuidGenerator.Create(), - erpAssCode, - erpAssName, - 0, - vehicleModel - ); - foreach (var partObj in partLst) - { - erpObj.AddChildObject( - GuidGenerator.Create(), - partObj.PartCode, - partObj.PartNum, - partObj.PartCode2 - ); - } - List repeatLst = _assemblyDomainService.ReturnRepeatErpAssembly(erpObj, erpDataLst, material3Lst); //返回重复总成 - foreach (var repeatStr in repeatLst) - { - repeatMsg += repeatStr; - } - } - } - if (repeatMsg.Length > 0) - { - ret.Status = false; - ret.Message = repeatMsg; - return ret; - } - - //遍历总成,插入数据库 - int maxVer = _assemblyCfgErpRepository.Any() ? _assemblyCfgErpRepository.Max(itm => itm.ErpAssemblyVersion) : 0; - foreach (var erpAssemblyCode in erpAssemblyCodeLst) - { - var partLst = ass2partLst.Where(itm => itm.ErpAssemblyCode == erpAssemblyCode).ToList(); - if (partLst.Count() > 0) - { - string erpAssCode = partLst[0].ErpAssemblyCode; - string erpAssName = partLst[0].ErpAssemblyName; - string vehicleModel = partLst[0].VehicleModel; - AssemblyCfgErp erpObj = new AssemblyCfgErp( - GuidGenerator.Create(), - erpAssCode, - erpAssName, - ++maxVer, - vehicleModel - ); - foreach (var partObj in partLst) - { - erpObj.AddChildObject( - GuidGenerator.Create(), - partObj.PartCode, - partObj.PartNum, - partObj.PartCode2 - ); - } - AssemblyCfgErp obj2 = await _assemblyCfgErpRepository.InsertAsync(erpObj); - await _assemblyDomainService.RemoveRepeatErpAssembly(obj2, erpDataLst); //删除重复总成 - } - } - - _globalSettingsDomainService.SetSetting(GlobalSettingsNameEnum.刷新报文解析缓存, true); - ret.Status = true; - return ret; - } - catch (Exception ex) - { - ret.Status = false; - ret.Message = _errorMessagePrefix + "ImportErpAssemblyAsync 执行出错:" + ex.Message; - _logger.LogError(ret.Message); - return ret; - } + throw new NotImplementedException(); + //_logger.LogDebug(_errorMessagePrefix + "ImportErpAssemblyAsync 进入"); + //ObjectResultDto ret = new ObjectResultDto(); + //try + //{ + // List material3Lst = await _materialExtRepository.Where(itm => itm.MaterialType == "3").ToListAsync(); + // List partCfgLst = await _partCfgRepository.GetListAsync(); //取结算件信息列表 + // List ass2partLst = new List(); + // using (var memoryStream = new MemoryStream()) + // { + // //保存到内存流 + // IFormFile file = files[0]; + // await file.CopyToAsync(memoryStream); + // memoryStream.Seek(0, SeekOrigin.Begin); + // StreamReader sr = new StreamReader(memoryStream, Encoding.Default); + // string strLine = ""; //记录每次读取的一行记录 + // string[] aryLine = null; //记录每行记录中的各字段内容 + // int columnCount = 0; //标示列数 + // //遍历文件行 + // while ((strLine = sr.ReadLine()) != null) + // { + // if (strLine.IsNullOrEmpty()) + // { + // continue; + // } + // if (strLine.Contains('�')) + // { + // ret.Message = "导入文件的格式不对,请将其转换成utf-8格式后再导入"; + // ret.Status = false; + // return ret; + // } + + // aryLine = strLine.Split(" "); + // columnCount = aryLine.Count(); + // if (columnCount == 0) + // { + // continue; + // } + // if (columnCount < 14) + // { + // ret.Message = "当前行的列数小于14,行号:" + aryLine[0]; + // ret.Status = false; + // return ret; + // } + // ErpAssemblyInfo2Part ass2partObj = new ErpAssemblyInfo2Part(); + // ass2partObj.ErpAssemblyCode = aryLine[1].Trim(); + // ass2partObj.ErpAssemblyName = aryLine[2].Trim(); + // //从物料表取车型,操作员导入BOM时已经在SAP中录入物料了 + // MaterialExt materialObj = material3Lst.FirstOrDefault(itm => itm.MaterialNum == ass2partObj.ErpAssemblyCode); + // if (materialObj != null) + // { + // ass2partObj.VehicleModel = materialObj.VehicleModel; + // ass2partObj.MaterialMemo = materialObj.MaterialMemo?.Replace(" ",""); //SAP分组 + // } + + // //将模板中的SAP物料号转换成客户零件号 + // string sapMaterialNum = aryLine[11].Trim().Replace(" "," "); //取派格SAP物料号 + // var partCfgObj = partCfgLst.FirstOrDefault(itm => itm.RelationKey == sapMaterialNum); + // if (partCfgObj != null) + // { + // ass2partObj.PartCode = partCfgObj.PartCode; + // ass2partObj.PartCode2 = sapMaterialNum; + // } + // else + // { + // ret.Message = $"当前行的SAP物料号在零件信息表没有匹配的客户零件号,行号:{aryLine[0]},SAP物料号:{sapMaterialNum}"; + // ret.Status = false; + // return ret; + // } + // ass2partObj.PartNum = aryLine[13].TryToDouble(); + + // //数据校验 + // if (ass2partObj.ErpAssemblyCode == null || ass2partObj.ErpAssemblyCode.Trim() == "") + // { + // ret.Message = "当前行的ERP总成代码列是空,行号:" + aryLine[0]; + // ret.Status = false; + // return ret; + // } + // if (ass2partObj.PartCode == null || ass2partObj.PartCode.Trim() == "") + // { + // if (partCfgObj.IsDisable == true) //不参与解析的也进入BOM, 报文解析时排除 + // { + // } + // else + // { + // ret.Message = "当前行的零件代码列是空,行号:" + aryLine[0] + "对应SAP零件号:" + sapMaterialNum; + // ret.Status = false; + // return ret; + // } + // } + // if (ass2partObj.PartNum == null || ass2partObj.PartNum == 0) + // { + // ret.Message = "当前行的零件数量列是空或零,行号:" + aryLine[0]; + // ret.Status = false; + // return ret; + // } + // ass2partLst.Add(ass2partObj); + // } + // } + // //取Erp总成 + // List erpDataLst = await _assemblyCfgErpRepository.GetListAsync(itm => itm.NewVersionId == null, true); + + // //总成编码去重 + // List erpAssemblyCodeLst = ass2partLst + // .Where(itm => string.IsNullOrEmpty(itm.ErpAssemblyCode) == false) + // .Select(itm => itm.ErpAssemblyCode) + // .Distinct() + // .ToList(); + // //校验导入 + // string repeatMsg = ""; + // foreach (var erpAssemblyCode in erpAssemblyCodeLst) + // { + // var partLst = ass2partLst.Where(itm => itm.ErpAssemblyCode == erpAssemblyCode).ToList(); + // if (partLst.Count() > 0) + // { + // string erpAssCode = partLst[0].ErpAssemblyCode; + // string erpAssName = partLst[0].ErpAssemblyName; + // string vehicleModel = partLst[0].VehicleModel; + // AssemblyCfgErp erpObj = new AssemblyCfgErp( + // GuidGenerator.Create(), + // erpAssCode, + // erpAssName, + // 0, + // vehicleModel + // ); + // foreach (var partObj in partLst) + // { + // erpObj.AddChildObject( + // GuidGenerator.Create(), + // partObj.PartCode, + // partObj.PartNum, + // partObj.PartCode2 + // ); + // } + // List repeatLst = _assemblyDomainService.ReturnRepeatErpAssembly(erpObj, erpDataLst, material3Lst); //返回重复总成 + // foreach (var repeatStr in repeatLst) + // { + // repeatMsg += repeatStr; + // } + // } + // } + // if (repeatMsg.Length > 0) + // { + // ret.Status = false; + // ret.Message = repeatMsg; + // return ret; + // } + + // //遍历总成,插入数据库 + // int maxVer = _assemblyCfgErpRepository.Any() ? _assemblyCfgErpRepository.Max(itm => itm.ErpAssemblyVersion) : 0; + // foreach (var erpAssemblyCode in erpAssemblyCodeLst) + // { + // var partLst = ass2partLst.Where(itm => itm.ErpAssemblyCode == erpAssemblyCode).ToList(); + // if (partLst.Count() > 0) + // { + // string erpAssCode = partLst[0].ErpAssemblyCode; + // string erpAssName = partLst[0].ErpAssemblyName; + // string vehicleModel = partLst[0].VehicleModel; + // AssemblyCfgErp erpObj = new AssemblyCfgErp( + // GuidGenerator.Create(), + // erpAssCode, + // erpAssName, + // ++maxVer, + // vehicleModel + // ); + // foreach (var partObj in partLst) + // { + // erpObj.AddChildObject( + // GuidGenerator.Create(), + // partObj.PartCode, + // partObj.PartNum, + // partObj.PartCode2 + // ); + // } + // AssemblyCfgErp obj2 = await _assemblyCfgErpRepository.InsertAsync(erpObj); + // await _assemblyDomainService.RemoveRepeatErpAssembly(obj2, erpDataLst); //删除重复总成 + // } + // } + + // _globalSettingsDomainService.SetSetting(GlobalSettingsNameEnum.刷新报文解析缓存, true); + // ret.Status = true; + // return ret; + //} + //catch (Exception ex) + //{ + // ret.Status = false; + // ret.Message = _errorMessagePrefix + "ImportErpAssemblyAsync 执行出错:" + ex.Message; + // _logger.LogError(ret.Message); + // return ret; + //} } /// - /// 总成组导入 + /// 总成组导入【红旗版本】 /// /// /// @@ -830,12 +831,12 @@ SELECT top 1 v.Id var partdists = srcLst.Select(r => r.MaterialNum).Distinct(); - foreach (var material in partdists) + foreach (var sapMaterial in partdists) { - var material3 = material3Lst.FirstOrDefault(r => r.MaterialNum == material); + var material3 = material3Lst.FirstOrDefault(r => r.MaterialNum == sapMaterial); if (material3 == null) { - error += $"零件编号【{material}】系统中不存在,请检查后再导入\r\n"; + error += $"零件编号【{sapMaterial}】系统中不存在,请检查后再导入\r\n"; } } @@ -856,27 +857,27 @@ SELECT top 1 v.Id string arrStr = string.Join(',', arr); var qry = from item in srcLst - group item by item.SpecExplain into g + group item by new { item.SpecExplain, item.ColorExplain } into g select new { - SpecExplain = g.Key, - ColorExplain = g.ElementAt(0).ColorExplain, + SpecExplain = g.Key.SpecExplain, + ColorExplain = g.Key.ColorExplain, Details = g.Select(itm => itm.MaterialNum).ToList() }; foreach (var item in qry) { if (item.Details.Count != 4) { - strBuild.AppendLine($"规格说明{item.SpecExplain}包含的物料号不是4个"); + strBuild.AppendLine($"规格说明{item.SpecExplain}、颜色说明{item.ColorExplain}包含的物料号不是4个"); } //遍历物料号 List strLst = new List(); - foreach (string materialNum in item.Details) + foreach (string sapMaterialNum in item.Details) { - var materialObj = material3Lst.FirstOrDefault(itm => itm.RelationKey == materialNum); + var materialObj = material3Lst.FirstOrDefault(itm => itm.MaterialNum == sapMaterialNum); if (materialObj == null) { - strBuild.AppendLine($"规格说明{item.SpecExplain}:物料号{materialNum}在物料表不存在!"); + strBuild.AppendLine($"规格说明{item.SpecExplain}:物料号{sapMaterialNum}在物料表不存在!"); } else { @@ -886,7 +887,7 @@ SELECT top 1 v.Id } else { - strBuild.AppendLine($"规格说明{item.SpecExplain}:物料号{materialNum}的MaterialType2不是【{arrStr}】其中之一!"); + strBuild.AppendLine($"规格说明{item.SpecExplain}:物料号{sapMaterialNum}的MaterialType2不是【{arrStr}】其中之一!"); } } } diff --git a/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application/MsgCheck/UnknownAssemblys/UnknownAssemblyAppService.cs b/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application/MsgCheck/UnknownAssemblys/UnknownAssemblyAppService.cs index fc577c8..5d6b35e 100644 --- a/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application/MsgCheck/UnknownAssemblys/UnknownAssemblyAppService.cs +++ b/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application/MsgCheck/UnknownAssemblys/UnknownAssemblyAppService.cs @@ -222,7 +222,7 @@ with b as ( -- select Id,HostSN,KNR,'' as VIN,AssemblyID,OnlineTime,ReceiveTime,VehicleModelCode,ProductLine,[Version],BillStatus, Description, SerialNumStr from FisBillR100 where BillStatus =1 -- union all - select Id,HostSN,KNR,VIN,AssemblyID,OnlineTime,ReceiveTime,VehicleModelCode,ProductLine,[Version],BillStatus, Description, SerialNumStr from FisBillM100 where BillStatus =1 + select Id,HostSN,KNR,VIN,AssemblyID,OnlineTime,ReceiveTime,VehicleModelCode,ProductLine,[Version],BillStatus, Description, SerialNumStr, SpecExplain, ColorExplain from FisBillM100 where BillStatus =1 ) ,d as ( @@ -231,7 +231,7 @@ with b as select * from ( select ROW_NUMBER() OVER(order by b.SerialNumStr) as row_number, - a.*, b.HostSN,b.KNR,VIN,b.AssemblyID,b.OnlineTime,b.ReceiveTime,b.VehicleModelCode,b.[Version],b.BillStatus, '' as MessageFileName, b.Description as BillDescription + a.*, b.HostSN,b.KNR,VIN,b.AssemblyID,b.OnlineTime,b.ReceiveTime,b.VehicleModelCode,b.[Version],b.BillStatus, '' as MessageFileName, b.Description as BillDescription, b.SpecExplain, b.ColorExplain from FisUnknownAssembly a join b on a.BillID = b.Id left join d on b.VehicleModelCode = d.DicItemCode 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 d4214c9..ebc41c6 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 @@ -43,7 +43,7 @@ namespace WY.NewJit.PrintTable } } - private const string _providerCode = "0709FAW-VW7XH"; + private const string _providerCode = "LAJ46"; //0709FAW-VW7XH /// /// 柱护板缓存列表(打印柱护板时用到) @@ -454,7 +454,7 @@ namespace WY.NewJit.PrintTable List erpAssemblyLst = GetErpAssemblyListByBill((Guid)billObj.AssemblyID); List erpCodeLst = erpAssemblyLst.Select(itm => itm.ErpAssemblyCode).ToList(); //根据ERP总成编码取对应的物料扩展信息 - List materialExtLst = _materialExtRepository.Where(itm => erpCodeLst.Contains(itm.RelationKey)).ToList(); + List materialExtLst = _materialExtRepository.Where(itm => erpCodeLst.Contains(itm.MaterialNum)).ToList(); if (erpCodeLst.Count != 4) { promMsg += $"*总成数量是{erpCodeLst.Count}*"; 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 c75cad4..fb60a60 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 @@ -409,7 +409,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 8748c7a..0f530be 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 @@ -236,6 +236,8 @@ namespace WY.NewJit.EdiReceive.Services //插入M100、未打印表 m100Obj.SetAssemblyID(vehicleAssemblyResu.Id); m100Obj.SetBillStatus(BillStatusEnum.Match); + m100Obj.SpecExplain = specExplain; + m100Obj.ColorExplain = colorExplain; var insM100Ret = await _hqM100DomainServie.InsertM100(m100Obj, true); if (insM100Ret == null) { @@ -249,6 +251,8 @@ namespace WY.NewJit.EdiReceive.Services //更新单据表 m100Obj.SetAssemblyID(null); m100Obj.SetBillStatus(BillStatusEnum.NotMatch); + m100Obj.SpecExplain = specExplain; + m100Obj.ColorExplain = colorExplain; var succObj1 = await _hqM100DomainServie.InsertM100(m100Obj, true); //不匹配时,插入未知总成 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 892bc07..53ece1d 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 @@ -131,6 +131,8 @@ namespace WY.NewJit.MsgCheck waitPrint.CreatorId = m100Ret.CreatorId; waitPrint.LastModificationTime = m100Ret.LastModificationTime; waitPrint.LastModifierId = m100Ret.LastModifierId; + waitPrint.SpecExplain = m100Ret.SpecExplain; + waitPrint.ColorExplain = m100Ret.ColorExplain; } private void Set_WaitPrint(WaitPrint sourceWaitPrint, WaitPrint targetWaitPrint) @@ -153,6 +155,8 @@ namespace WY.NewJit.MsgCheck targetWaitPrint.CreatorId = sourceWaitPrint.CreatorId; targetWaitPrint.LastModificationTime = sourceWaitPrint.LastModificationTime; targetWaitPrint.LastModifierId = sourceWaitPrint.LastModifierId; + targetWaitPrint.SpecExplain = sourceWaitPrint.SpecExplain; + targetWaitPrint.ColorExplain = sourceWaitPrint.ColorExplain; } public async Task>> GetM100PartDic(List m100IdLst) diff --git a/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Domain/MsgBaseData/Services/AssemblyDomainService.cs b/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Domain/MsgBaseData/Services/AssemblyDomainService.cs index be318dd..17561ed 100644 --- a/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Domain/MsgBaseData/Services/AssemblyDomainService.cs +++ b/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Domain/MsgBaseData/Services/AssemblyDomainService.cs @@ -143,59 +143,60 @@ namespace WY.NewJit.MsgBaseData [UnitOfWork] public virtual async Task SyncErpAssemblyAsync(int takeRecordCount) { - string sql = @" -SELECT AppraisalCategory as RelationKey, ErpMaterialCode, MaterialDesc, SettleMaterialCode, Qty - FROM [SettleAccountService].[dbo].[v_relationship] a - where not exists (select * from [dbo].[FisAssemblyCfgErp] e where a.AppraisalCategory = e.RelationKey) - order by [Version], ErpMaterialCode, MaterialDesc, SettleMaterialCode, Qty -"; - //取ERP总成 最大版本 - int maxVer = _assemblyCfgErpRepository.Any() ? _assemblyCfgErpRepository.Max(itm => itm.ErpAssemblyVersion) : 0; - //初始化ERP总成及结算件数据 - await ClearPub(maxVer); - //取增量数据 - List relationshipLst = await _newJitDapperRepository.GetListBySqlAsync(sql, true); - List keyLst = relationshipLst.Select(itm => itm.RelationKey).Distinct().Take(takeRecordCount).ToList(); + throw new NotImplementedException(); +// string sql = @" +//SELECT AppraisalCategory as RelationKey, ErpMaterialCode, MaterialDesc, SettleMaterialCode, Qty +// FROM [SettleAccountService].[dbo].[v_relationship] a +// where not exists (select * from [dbo].[FisAssemblyCfgErp] e where a.AppraisalCategory = e.RelationKey) +// order by [Version], ErpMaterialCode, MaterialDesc, SettleMaterialCode, Qty +//"; +// //取ERP总成 最大版本 +// int maxVer = _assemblyCfgErpRepository.Any() ? _assemblyCfgErpRepository.Max(itm => itm.ErpAssemblyVersion) : 0; +// //初始化ERP总成及结算件数据 +// await ClearPub(maxVer); +// //取增量数据 +// List relationshipLst = await _newJitDapperRepository.GetListBySqlAsync(sql, true); +// List keyLst = relationshipLst.Select(itm => itm.RelationKey).Distinct().Take(takeRecordCount).ToList(); - foreach (string keyStr in keyLst) - { - List filterLst = relationshipLst.Where(itm => itm.RelationKey == keyStr).ToList(); - //填充erp主实体 - AssemblyCfgErp targetObj = new AssemblyCfgErp( - _guidGenerator.Create(), - filterLst[0].ErpMaterialCode, - filterLst[0].MaterialDesc, - ++maxVer, - null, - filterLst[0].RelationKey - ); - //填充erp子实体 - foreach (V_Relationship filterItm in filterLst) - { - targetObj.AddChildObject( - _guidGenerator.Create(), - filterItm.SettleMaterialCode, - filterItm.Qty, - "", - false - ); - } - //判断结算件配置重复 - List repeatIdLst = await FindRepeatErpAssembly(targetObj); - if (repeatIdLst == null || repeatIdLst.Count == 0) //没有重复,直接插入 - { - AssemblyCfgErp obj2 = await _assemblyCfgErpRepository.InsertAsync(targetObj); - } - else //存在重复 - { - foreach (ErpAssembly2 item in repeatIdLst) - { - //更新历史数据NewVersionId字段 - await UpdateNewVersionId(item.ErpAssemblyId, targetObj.Id); - } - AssemblyCfgErp obj2 = await _assemblyCfgErpRepository.InsertAsync(targetObj); - } - } +// foreach (string keyStr in keyLst) +// { +// List filterLst = relationshipLst.Where(itm => itm.RelationKey == keyStr).ToList(); +// //填充erp主实体 +// AssemblyCfgErp targetObj = new AssemblyCfgErp( +// _guidGenerator.Create(), +// filterLst[0].ErpMaterialCode, +// filterLst[0].MaterialDesc, +// ++maxVer, +// null, +// filterLst[0].RelationKey +// ); +// //填充erp子实体 +// foreach (V_Relationship filterItm in filterLst) +// { +// targetObj.AddChildObject( +// _guidGenerator.Create(), +// filterItm.SettleMaterialCode, +// filterItm.Qty, +// "", +// false +// ); +// } +// //判断结算件配置重复 +// List repeatIdLst = await FindRepeatErpAssembly(targetObj); +// if (repeatIdLst == null || repeatIdLst.Count == 0) //没有重复,直接插入 +// { +// AssemblyCfgErp obj2 = await _assemblyCfgErpRepository.InsertAsync(targetObj); +// } +// else //存在重复 +// { +// foreach (ErpAssembly2 item in repeatIdLst) +// { +// //更新历史数据NewVersionId字段 +// await UpdateNewVersionId(item.ErpAssemblyId, targetObj.Id); +// } +// AssemblyCfgErp obj2 = await _assemblyCfgErpRepository.InsertAsync(targetObj); +// } +// } } /// diff --git a/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Domain/MsgCheck/Entitys/BillM100.cs b/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Domain/MsgCheck/Entitys/BillM100.cs index e45f905..7d95e6c 100644 --- a/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Domain/MsgCheck/Entitys/BillM100.cs +++ b/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Domain/MsgCheck/Entitys/BillM100.cs @@ -134,6 +134,15 @@ namespace WY.NewJit.MsgCheck /// public virtual bool? IsPartSwitch { get; set; } + /// + /// 规格说明:HSC0DRCC0001 + /// + public virtual string SpecExplain { get; set; } + + /// + /// 颜色说明:车型描述后7位,石墨黑/云杉灰 + /// + public virtual string ColorExplain { get; set; } public BillM100() { diff --git a/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Domain/PrintTable/Entitys/WaitPrint.cs b/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Domain/PrintTable/Entitys/WaitPrint.cs index 4a1e405..895cb8c 100644 --- a/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Domain/PrintTable/Entitys/WaitPrint.cs +++ b/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Domain/PrintTable/Entitys/WaitPrint.cs @@ -110,6 +110,16 @@ namespace WY.NewJit.PrintTable /// public Guid? LastModifierId { get; set; } + /// + /// 规格说明:HSC0DRCC0001 + /// + public virtual string SpecExplain { get; set; } + + /// + /// 颜色说明:车型描述后7位,石墨黑/云杉灰 + /// + public virtual string ColorExplain { get; set; } + public WaitPrint() { diff --git a/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Web/appsettings.json b/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Web/appsettings.json index a79662f..025a999 100644 --- a/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Web/appsettings.json +++ b/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Web/appsettings.json @@ -11,10 +11,11 @@ //"Default": "Server=192.168.0.140;Database=ABP;User ID=sa;Password=Microsoft2008;", //"WMS": "Server=192.168.0.140;Database=CPAT_WMS_TEST;User ID=sa;Password=Microsoft2008;" - "NewJitPG": "Server=dev.ccwin-in.com,6208;Database=NewJitPG_HQ;uid=sa;pwd=ChangkeTec@2021;", "Default": "Server=dev.ccwin-in.com,6208;Database=ABP;User ID=sa;Password=ChangkeTec@2021;", - "WMS": "Server=dev.ccwin-in.com,6208;Database=CPAT_WMS;User ID=sa;Password=ChangkeTec@2021;" - + //"NewJitPG": "Server=dev.ccwin-in.com,6208;Database=NewJitPG_HQ;uid=sa;pwd=ChangkeTec@2021;", + //"WMS": "Server=dev.ccwin-in.com,6208;Database=CPAT_WMS;User ID=sa;Password=ChangkeTec@2021;" + "NewJitPG": "Server=192.168.0.68;Database=NewJitPG_HQ;uid=sa;pwd=Microsoft@2022;", + "WMS": "Server=192.168.0.140;Database=CPAT_WMS_TEST;User ID=sa;Password=Microsoft2008;" }, "AuthServer": { "Authority": "http://dev.ccwin-in.com:16077",