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() {