From 78bf7fa291b506ff88bc6e7a33677b19f656ff00 Mon Sep 17 00:00:00 2001 From: 44673626 <44673626@qq.com> Date: Thu, 21 Jul 2022 17:32:38 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BA=A2=E6=97=97=E7=BB=93=E7=AE=97=E5=AF=BC?= =?UTF-8?q?=E5=85=A5=EF=BC=8C=E8=87=AA=E5=AE=9A=E4=B9=89=E5=8F=91=E8=B4=A7?= =?UTF-8?q?=E5=AF=BC=E5=85=A5=EF=BC=8C=E7=BA=A2=E6=97=97=E4=B8=80=E8=BD=BF?= =?UTF-8?q?=E5=87=BA=E5=BA=93=E5=8D=95=E5=AF=BC=E5=85=A5=EF=BC=8C=E4=B8=80?= =?UTF-8?q?=E6=AC=A1=E6=80=A7=E5=AF=84=E5=94=AE=E9=94=80=E5=94=AE=E5=AF=BC?= =?UTF-8?q?=E5=85=A5=E5=8A=A0=E5=85=A5=E5=AF=BC=E5=85=A5=E6=97=B6=E6=A3=80?= =?UTF-8?q?=E9=AA=8C=E7=89=A9=E6=96=99=E4=B8=BB=E6=95=B0=E6=8D=AE=E4=B8=AD?= =?UTF-8?q?=E6=98=AF=E5=90=A6=E5=AD=98=E5=9C=A8=E5=AF=BC=E5=85=A5=E7=9A=84?= =?UTF-8?q?=E7=89=A9=E6=96=99=E5=8F=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Entities/HQ_H/HQ_H_PlatformAppService.cs | 21 +++++++---- .../WMS/WMSCusomerKanbanAppService.cs | 18 +++++++--- .../Entities/WMS/WMSJitAppService.cs | 4 +-- .../Entities/WMS/WMSSharePartAppService.cs | 15 ++++---- .../Entities/WMS/WmsHQKBOutputAppService.cs | 36 ++++++++++++------- .../WMS/WmsOneTimeSaleOutputAppService.cs | 24 +++++++++---- .../Report/ErpPartDapperRepository.cs | 10 ++++++ 7 files changed, 90 insertions(+), 38 deletions(-) diff --git a/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/HQ_H/HQ_H_PlatformAppService.cs b/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/HQ_H/HQ_H_PlatformAppService.cs index d2045e8f..5cae35a9 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/HQ_H/HQ_H_PlatformAppService.cs +++ b/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/HQ_H/HQ_H_PlatformAppService.cs @@ -103,15 +103,24 @@ namespace Win.Sfs.SettleAccount.Entities.HQ_H throw new BusinessException("导入模板数据不能为空!"); } - var entityList = ObjectMapper.Map, List>(result); + var entityList_org = ObjectMapper.Map, List>(result); + + var entityList= entityList_org.Where(p => !string.IsNullOrEmpty(p.MaterialCode)).ToList();//过滤掉物料号为空的数据 + + var gethqimportdata = entityList.Select(p => p.MaterialCode).Distinct().ToList(); + var getmaterial = _erpdapperRepository.GetMaterialListCustomerPartCode(); //和物料主数据中SAP物料号检验是否存在 - foreach (var itm in entityList) + var query = from itm in gethqimportdata + join itm1 in getmaterial on itm equals itm1.CustomerPartCode into temp1 + from tm1 in temp1.DefaultIfEmpty() + where tm1 == null + select itm; + + + foreach (var itm in query) { - if (!_erpdapperRepository.GetMaterialList().Any(p => p.CustomerPartCode == itm.MaterialCode)) - { - checkList.Add(new ErrorExportDto(version, "红旗结算导入", string.Empty, string.Empty, itm.MaterialCode, string.Empty, string.Format("物料主数据不存在当前导入的物料号{0}!", itm.MaterialCode), string.Empty)); - } + checkList.Add(new ErrorExportDto(version, "红旗结算导入", string.Empty, string.Empty, itm, string.Empty, string.Format("物料主数据不存在当前导入的物料号{0}!", itm), string.Empty)); } if (checkList.Count > 0) diff --git a/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WMSCusomerKanbanAppService.cs b/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WMSCusomerKanbanAppService.cs index f6516f4a..36ed14d0 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WMSCusomerKanbanAppService.cs +++ b/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WMSCusomerKanbanAppService.cs @@ -486,12 +486,20 @@ namespace Win.Sfs.SettleAccount.Entities.SettleAccounts var filteResult = result.Where(p =>!string.IsNullOrEmpty(p.SapMaterialCode));//过滤掉物料号为空的数据 //和物料主数据中SAP物料号检验是否存在 - foreach (var itm in filteResult) + var gethqimportdata = filteResult.Select(p => p.SapMaterialCode).Distinct().ToList(); + var getmaterial = _erpdapperRepository.GetMaterialList(); + + var queryCheck = from itm in gethqimportdata + join itm1 in getmaterial on itm equals itm1.MaterialCode into temp1 + from tm1 in temp1.DefaultIfEmpty() + where tm1 == null + select itm; + foreach (var itm in queryCheck) { - if (!_erpdapperRepository.GetMaterialList().Any(p => p.MaterialCode == itm.SapMaterialCode)) - { - checkList.Add(new ErrorExportDto(version, "自定义出库单导入", string.Empty, string.Empty, itm.SapMaterialCode, string.Empty, string.Format("物料主数据不存在当前导入的物料号{0}!", itm.SapMaterialCode), string.Empty)); - } + //if (!_erpdapperRepository.GetMaterialList().Any(p => p.MaterialCode == itm.SapMaterialCode)) + //{ + checkList.Add(new ErrorExportDto(version, "自定义出库单导入", string.Empty, string.Empty, itm, string.Empty, string.Format("物料主数据不存在当前导入的物料号{0}!", itm), string.Empty)); + //} } //检验2:导入模板中的结算数据是否为0 diff --git a/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WMSJitAppService.cs b/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WMSJitAppService.cs index 81c5750b..9e06eef9 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WMSJitAppService.cs +++ b/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WMSJitAppService.cs @@ -55,8 +55,8 @@ namespace Win.Sfs.SettleAccount.Entities.SettleAccounts /// /// wms出库 /// - //[Authorize(SettleAccountPermissions.WMSJIT.Default)] - [AllowAnonymous] + [Authorize(SettleAccountPermissions.WMSJIT.Default)] + //[AllowAnonymous] [Route("api/settleaccount/wmsjitoutput")] public class WMSJitAppService : diff --git a/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WMSSharePartAppService.cs b/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WMSSharePartAppService.cs index cfd1c9e6..9721e8a4 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WMSSharePartAppService.cs +++ b/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WMSSharePartAppService.cs @@ -681,14 +681,15 @@ namespace Win.Sfs.SettleAccount.Entities.SettleAccounts } //和物料主数据中SAP物料号检验是否存在 - foreach (var itm in result) - { - if (!_erpdapperRepository.GetMaterialList().Any(p => p.MaterialCode == itm.MaterialCode)) - { - checkList.Add(new ErrorExportDto(version, "大众备件出库单导入", string.Empty, string.Empty, itm.MaterialCode, string.Empty, string.Format("物料主数据不存在当前导入的物料号{0}!", itm.MaterialCode), string.Empty)); - } - } + //foreach (var itm in result) + //{ + // if (!_erpdapperRepository.GetMaterialList().Any(p => p.MaterialCode == itm.MaterialCode)) + // { + // checkList.Add(new ErrorExportDto(version, "大众备件出库单导入", string.Empty, string.Empty, itm.MaterialCode, string.Empty, string.Format("物料主数据不存在当前导入的物料号{0}!", itm.MaterialCode), string.Empty)); + // } + + //} if (checkList.Count > 0) { diff --git a/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WmsHQKBOutputAppService.cs b/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WmsHQKBOutputAppService.cs index fefbdb45..5c42e197 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WmsHQKBOutputAppService.cs +++ b/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WmsHQKBOutputAppService.cs @@ -269,7 +269,7 @@ namespace Win.Sfs.SettleAccount.Entities.WMS throw new BusinessException("导入模板数据不能为空!"); } //物料号不能为空,直接过滤掉,模板的中看不到有空行的情况,但是通过个IE这个插件发现有空行数据导入 - var _list = _listOrgin.Where(p =>!string.IsNullOrEmpty(p.SapMaterialCode)); + var _list = _listOrgin.Where(p => !string.IsNullOrEmpty(p.SapMaterialCode)); foreach (var itm in _list) { @@ -278,7 +278,7 @@ namespace Win.Sfs.SettleAccount.Entities.WMS checkList.Add(new ErrorExportDto(version, "红旗一轿出库单导入", string.Empty, string.Empty, string.Empty, string.Empty, string.Format("导入模板中SAP编码{0}的是否备件及客户号不能为空,影响出库请检查!", itm.SapMaterialCode), string.Empty)); } } - + foreach (var itm in _list) { if (itm.IsBack != "是" && itm.IsBack != "否") @@ -287,14 +287,26 @@ namespace Win.Sfs.SettleAccount.Entities.WMS } } //和物料主数据中SAP物料号检验是否存在 - foreach (var itm in _list) + var gethqimportdata = _list.Select(p => p.SapMaterialCode).Distinct().ToList(); + var getmaterial = _erpdapperRepository.GetMaterialList(); + + var queryCheck = from itm in gethqimportdata + join itm1 in getmaterial on itm equals itm1.MaterialCode into temp1 + from tm1 in temp1.DefaultIfEmpty() + where tm1 == null + select itm; + foreach (var itm in queryCheck) { - if (!_erpdapperRepository.GetMaterialList().Any(p => p.MaterialCode == itm.SapMaterialCode)) - { - checkList.Add(new ErrorExportDto(version, "红旗一轿出库单导入", string.Empty, string.Empty, itm.SapMaterialCode, string.Empty, string.Format("物料主数据不存在当前导入的物料号{0}!", itm.SapMaterialCode), string.Empty)); - } - + checkList.Add(new ErrorExportDto(version, "红旗一轿出库单导入", string.Empty, string.Empty, itm, string.Empty, string.Format("物料主数据不存在当前导入的物料号{0}!", itm), string.Empty)); } + //foreach (var itm in _list) + //{ + // if (!_erpdapperRepository.GetMaterialList().Any(p => p.MaterialCode == itm.SapMaterialCode)) + // { + // checkList.Add(new ErrorExportDto(version, "红旗一轿出库单导入", string.Empty, string.Empty, itm.SapMaterialCode, string.Empty, string.Format("物料主数据不存在当前导入的物料号{0}!", itm.SapMaterialCode), string.Empty)); + // } + + //} if (checkList.Count > 0) { @@ -314,11 +326,11 @@ namespace Win.Sfs.SettleAccount.Entities.WMS } } var getbillName = "HQVSBT";//混合数据 - if(_list.FirstOrDefault().Extend== "100113") + if (_list.FirstOrDefault().Extend == "100113") { getbillName = "BT";//一轿 } - else if(_list.FirstOrDefault().Extend == "100053") + else if (_list.FirstOrDefault().Extend == "100053") { getbillName = "HQKB";//红旗 } @@ -346,14 +358,14 @@ namespace Win.Sfs.SettleAccount.Entities.WMS 0, 0, itm.Price, - Math.Round((itm.Price * itm.Qty),2) + Math.Round((itm.Price * itm.Qty), 2) ); await _wmsRepository.GetDbContext().BulkInsertAsync(query.ToList(), new BulkConfig() { BulkCopyTimeout = 0, BatchSize = 10000 }); int _count = _wmsVersionRepository.Count(p => p.Version == version && p.BillNum == _billNum); if (_count == 0) { - var _version = new WmsHQWithOutKanbanOutPut(GuidGenerator.Create(), version, _billNum, CurrentUser.Email,string.Empty); + var _version = new WmsHQWithOutKanbanOutPut(GuidGenerator.Create(), version, _billNum, CurrentUser.Email, string.Empty); await _wmsVersionRepository.InsertAsync(_version, true); } return ApplicationConsts.SuccessStr; ; diff --git a/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WmsOneTimeSaleOutputAppService.cs b/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WmsOneTimeSaleOutputAppService.cs index 29e2440e..b1198605 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WmsOneTimeSaleOutputAppService.cs +++ b/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WmsOneTimeSaleOutputAppService.cs @@ -234,14 +234,26 @@ namespace Win.Sfs.SettleAccount.Entities.WMS } //和物料主数据中SAP物料号检验是否存在 - foreach (var itm in _list) + var gethqimportdata = _list.Select(p => p.SapMaterialCode).Distinct().ToList(); + var getmaterial = _erpdapperRepository.GetMaterialList(); + + var queryCheck = from itm in gethqimportdata + join itm1 in getmaterial on itm equals itm1.MaterialCode into temp1 + from tm1 in temp1.DefaultIfEmpty() + where tm1 == null + select itm; + foreach (var itm in queryCheck) { - if (!_erpdapperRepository.GetMaterialList().Any(p => p.MaterialCode == itm.SapMaterialCode)) - { - checkList.Add(new ErrorExportDto(version, "一次性寄售销售导入", string.Empty, string.Empty, itm.SapMaterialCode, string.Empty, string.Format("物料主数据不存在当前导入的物料号{0}!", itm.SapMaterialCode), string.Empty)); - } - + checkList.Add(new ErrorExportDto(version, "一次性寄售销售导入", string.Empty, string.Empty, itm, string.Empty, string.Format("物料主数据不存在当前导入的物料号{0}!", itm), string.Empty)); } + //foreach (var itm in _list) + //{ + // if (!_erpdapperRepository.GetMaterialList().Any(p => p.MaterialCode == itm.SapMaterialCode)) + // { + // checkList.Add(new ErrorExportDto(version, "一次性寄售销售导入", string.Empty, string.Empty, itm.SapMaterialCode, string.Empty, string.Format("物料主数据不存在当前导入的物料号{0}!", itm.SapMaterialCode), string.Empty)); + // } + + //} if (checkList.Count > 0) { return await ExportErrorReportAsync(checkList); diff --git a/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/ErpPartDapperRepository.cs b/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/ErpPartDapperRepository.cs index c6433314..f0dd9242 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/ErpPartDapperRepository.cs +++ b/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/ErpPartDapperRepository.cs @@ -57,6 +57,16 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report } + /// + /// 获取客户物料号 + /// + /// + public virtual List GetMaterialListCustomerPartCode() + { + return DbConnection.Query("select max(Id) ID,'' Factory,CustomerPartCode,MaterialDesc,EstimateTypeDesc,EstimateType from Set_material where CustomerPartCode is not null group by CustomerPartCode, MaterialDesc, EstimateTypeDesc, EstimateType ").ToList(); + + } + public virtual List GetErrorBillList() {