diff --git a/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/settle/detail.js b/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/settle/detail.js index 485eb189..5ab133b6 100644 --- a/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/settle/detail.js +++ b/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/settle/detail.js @@ -57,7 +57,7 @@ export default function (businessType, type) { title: "是否退货", type: "boolean", }, - isMaidan: { + isMaiDan: { title: "是否买单", type: "boolean", }, diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/BBAC_NOT_SA_DTO.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/BBAC_NOT_SA_DTO.cs index 5845e3a0..8e60e612 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/BBAC_NOT_SA_DTO.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/BBAC_NOT_SA_DTO.cs @@ -1,4 +1,5 @@ using System; +using System.ComponentModel.DataAnnotations; using Magicodes.ExporterAndImporter.Core; using Volo.Abp.Application.Dtos; using Win.Sfs.SettleAccount.Bases; @@ -58,9 +59,19 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Dtos /// 厂内零件号 /// public string PartCode { get; set; } + /// + ///是否退货 + /// + [ExporterHeader(DisplayName = "是否退货")] + public string IsReturn { get; set; } + /// + /// 是否是买单件 + /// + [ExporterHeader(DisplayName = "是否是买单件")] + public bool IsMaiDan { get; set; } } - public class BBAC_NOT_SA_DETAIL_EXP_DTO + public class BBAC_NOT_SA_DETAIL_EXP_DTO:EntityDto { /// @@ -84,9 +95,16 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Dtos [ExporterHeader(DisplayName = "是否退货")] public string IsReturn { get; set; } /// - /// 是否退货 + /// 是否是买单件 /// - [ExporterHeader(DisplayName = "是否退货")] + [ExporterHeader(DisplayName = "是否是买单件")] + public bool IsMaiDan { get; set; } + [ExporterHeader(DisplayName = "原始生产码")] + public string RealPN { get; set; } + /// + /// 版本 + /// + [ExporterHeader(DisplayName = "版本")] public int Version { get; set; } [ExporterHeader(DisplayName = "单价")] public decimal Price { get; set; } diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/HBPO_NOT_SA_DTO.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/HBPO_NOT_SA_DTO.cs index bd136af0..951bb0b2 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/HBPO_NOT_SA_DTO.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/HBPO_NOT_SA_DTO.cs @@ -63,7 +63,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Dtos public string PartCode { get; set; } } - public class HBPO_NOT_SA_DETAIL_EXP_DTO + public class HBPO_NOT_SA_DETAIL_EXP_DTO : EntityDto { /// @@ -79,13 +79,17 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Dtos /// ///业务类别 /// - //[ExporterHeader(DisplayName = "业务类别")] - //public string Category { get; set; } + [ExporterHeader(DisplayName = "业务类别")] + public string Category { get; set; } /// ///是否退货 /// //[ExporterHeader(DisplayName = "是否退货")] //public string IsReturn { get; set; } + //[ExporterHeader(DisplayName = "是否买单")] + //public string IsMaiDan { get; set; } + [ExporterHeader(DisplayName = "原始生产码")] + public string RealPN { get; set; } [ExporterHeader(DisplayName = "期间")] public int Version { get; set; } [ExporterHeader(DisplayName = "单价")] diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Bases/NOT_SA_SERVICE.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Bases/NOT_SA_SERVICE.cs index 26102046..4371bbc2 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Bases/NOT_SA_SERVICE.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Bases/NOT_SA_SERVICE.cs @@ -10,14 +10,17 @@ using Magicodes.ExporterAndImporter.Csv; using Magicodes.ExporterAndImporter.Excel; using Microsoft.AspNetCore.Mvc; using SettleAccount.Bases; +using ShardingCore.Extensions; using Shouldly; using Volo.Abp.Application.Dtos; +using Volo.Abp.Data; using Win.Abp.Snowflakes; using Win.Sfs.BaseData.ImportExcelCommon; using Win.Sfs.SettleAccount.Bases.DomainServices; using Win.Sfs.SettleAccount.CommonManagers; using Win.Sfs.SettleAccount.Entities.Prices; using Win.Sfs.SettleAccount.ExportReports; +using Win.Sfs.Shared.Filter; using Win.Sfs.Shared.RepositoryBase; namespace Win.Sfs.SettleAccount.Bases @@ -53,9 +56,28 @@ namespace Win.Sfs.SettleAccount.Bases //[Route("detailquery")] public virtual async Task> DetailQueryAsync(TRequestDetailInput input) { + var ls = input.Filters.Where(p => p.Column == "businessType").ToList(); + if (ls.Count > 0) + { + var entiy = input.Filters.Where(p => p.Column == "businessType").FirstOrDefault(); + var value = entiy.Value; + //if (value == "JisBBAC") + //{ + // input.Filters.Add(new Shared.Filter.FilterCondition() { Column = "businessType", Action = EnumFilterAction.Equal, Logic = EnumFilterLogic.Or, Value = "MaiDanJianBBAC" }); + //} + //else + //{ + // input.Filters.Add(new Shared.Filter.FilterCondition() { Column = "businessType", Action = EnumFilterAction.Equal, Logic = EnumFilterLogic.Or, Value = "MaiDanJianHBPO" }); + //} + + input.Filters.Remove(entiy); + } + var entitys = await _detailRepository.GetListByFilterAsync(input.Filters, input.Sorting, input.MaxResultCount, input.SkipCount).ConfigureAwait(false); var totalCount = await _detailRepository.GetCountByFilterAsync(input.Filters).ConfigureAwait(false); var dtos = ObjectMapper.Map, List>(entitys); + + return new PagedResultDto(totalCount, dtos); } @@ -120,7 +142,10 @@ namespace Win.Sfs.SettleAccount.Bases IExporter _excel = new ExcelExporter(); Stopwatch sw = Stopwatch.StartNew(); var entities = await _detailRepository.GetListByFilterAsync(input.Filters, input.Sorting, int.MaxValue, 0, true).ConfigureAwait(false); + var dtoDetails = ObjectMapper.Map, List>(entities); + + var classDisplayName = typeof(TEntityDetailExportDto).GetCustomAttribute()?.Name ?? typeof(TEntityDetailExportDto).Name; string _fileName = $"{classDisplayName}_{Guid.NewGuid().ToString()}.xlsx"; byte[] result = null; @@ -144,6 +169,9 @@ namespace Win.Sfs.SettleAccount.Bases //#endif } + + + /// /// 生成可计算单 /// diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_NOT_SA_SERVICE.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_NOT_SA_SERVICE.cs index 0f3c16cb..bdcd9fd1 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_NOT_SA_SERVICE.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_NOT_SA_SERVICE.cs @@ -1,14 +1,12 @@ using System; using System.Collections.Generic; -using System.Linq.Dynamic.Core; -using System.Text.Json; using System.Threading.Tasks; +using Magicodes.ExporterAndImporter.Core; +using Magicodes.ExporterAndImporter.Csv; +using Magicodes.ExporterAndImporter.Excel; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using SettleAccount.Domain.BQ; -using SettleAccount.Job.Services; -using TaskJob.EventArgs; -using Volo.Abp; using Win.Abp.Snowflakes; using Win.Sfs.BaseData.ImportExcelCommon; using Win.Sfs.SettleAccount.Bases; @@ -17,8 +15,6 @@ using Win.Sfs.SettleAccount.CommonManagers; using Win.Sfs.SettleAccount.Constant; using Win.Sfs.SettleAccount.Entities.BQ.Dtos; using Win.Sfs.SettleAccount.Entities.BQ.Managers; -using Win.Sfs.SettleAccount.Entities.BQ.Syncs; -using Win.Sfs.SettleAccount.Entities.TaskJobs; using Win.Sfs.SettleAccount.ExportReports; using Win.Sfs.Shared.RepositoryBase; @@ -47,6 +43,90 @@ namespace Win.Sfs.SettleAccount.Entities.BQ _bbacNotMng = bbacNotMng; _service = service; } + + + [HttpPost] + //[Route("export")] + public override async Task ExportAsync(BBAC_NOT_SA_DETAIL_REQ_DTO input) + { + var ls = input.Filters.Where(p => p.Column == "businessType").ToList(); + if (ls.Count > 0) + { + var entiy = input.Filters.Where(p => p.Column == "businessType").FirstOrDefault(); + var value = entiy.Value; + + input.Filters.Remove(entiy); + } + + IExporter _csv = new CsvExporter(); + IExporter _excel = new ExcelExporter(); + var entities = await _detailRepository.GetListByFilterAsync(input.Filters, input.Sorting, int.MaxValue, 0, true).ConfigureAwait(false); + + var dtoDetails = ObjectMapper.Map, List>(entities); + + var inner = from d in entities + join p in dtoDetails on d.Id equals p.Id + + select + new BBAC_NOT_SA_DETAIL_EXP_DTO() + { + SettleBillNum=d.SettleBillNum, + Site=d.Site, + Category=p.Category, + IsReturn=p.IsReturn, + IsMaiDan=p.IsMaiDan, + RealPN = d.GetProperty("RealPN", ""), + InvGroupNum=p.InvGroupNum, + SettleDate = d.SettleDate, + LU = d.LU, + PN = d.PN, + Qty = d.Qty, + GroupNum = d.GroupNum, + KeyCode = d.KeyCode, + Price = p.Price, + }; + + //dtoDetails.ForEach(dtoDetail => + //{ + // var item= entities.FirstOrDefault(e => e.Id == dtoDetail.Id); + // dtoDetail.RealPN = item.GetProperty("RealPN", ""); + + //}); + + + var classDisplayName = typeof(BBAC_NOT_SA_DETAIL_EXP_DTO).GetCustomAttribute()?.Name ?? typeof(BBAC_NOT_SA_DETAIL_EXP_DTO).Name; + string _fileName = $"{classDisplayName}_{Guid.NewGuid().ToString()}.xlsx"; + byte[] result = null; + + //switch (input.FileType) + //{ + // case 0: + // result = await _csv.ExportAsByteArray(dtoDetails).ConfigureAwait(false); + // break; + // case 1: + // result = await _excel.ExportAsByteArray(dtoDetails).ConfigureAwait(false); + // break; + //} + + result = await _excel.ExportAsByteArray(inner.ToList()).ConfigureAwait(false); + result.ShouldNotBeNull(); + + //保存导出文件到服务器存成二进制 + await _excelImportService.SaveBlobAsync( + new SaveExcelImportInputDto + { + Name = _fileName, + Content = result + } + ).ConfigureAwait(false); + return _fileName; + } + + + + + + [HttpPost] public override async Task GenerateSettlementOrder(BBAC_NOT_SA_DETAIL_REQ_DTO input) { diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_SA_SERVICE.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_SA_SERVICE.cs index e379bdd8..bc16cd6a 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_SA_SERVICE.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_SA_SERVICE.cs @@ -160,6 +160,8 @@ namespace Win.Sfs.SettleAccount.Entities.BQ importBBACSaDetail.Version = Version; importBBACSaDetail.Site = Site; importBBACSaDetail.BusinessType = importBBACSaDetail.PN.Contains("R0") ? EnumBusinessType.MaiDanJianBBAC : EnumBusinessType.JisBBAC; + //importBBACSaDetail.RealPN = importBBACSaDetail.PN; + importBBACSaDetail.ExtraProperties.TryAdd("RealPN", importBBACSaDetail.PN); }); var jisSaDetails = importBBACSaDetails.FindAll(t => t.BusinessType == EnumBusinessType.JisBBAC); @@ -171,6 +173,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ */ maiDanSaDetails.ForEach(maiDanSaDetail => { + //maiDanSaDetail.RealPN = maiDanSaDetail.PN; maiDanSaDetail.ProductionCodeType = maiDanSaDetail.PN[^2..]; maiDanSaDetail.PN = maiDanSaDetail.PN[..7]; }); @@ -477,6 +480,15 @@ namespace Win.Sfs.SettleAccount.Entities.BQ } if (bbacNotSaDetails.Count > 0) { + bbacNotSaDetails.ForEach(bbacNotSaDetail => + { + if(bbacNotSaDetail.BusinessType==EnumBusinessType.MaiDanJianBBAC) + { + bbacNotSaDetail.IsMaiDan = true; + } + + }); + await _bbacNotSaDetailRepository.DbContext.BulkInsertAsync(bbacNotSaDetails).ConfigureAwait(false); } if (materialRelationships.Count > 0) diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/HBPO_NOT_SA_SERVICE.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/HBPO_NOT_SA_SERVICE.cs index bf3328c5..fde08cdd 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/HBPO_NOT_SA_SERVICE.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/HBPO_NOT_SA_SERVICE.cs @@ -1,14 +1,9 @@ using System; using System.Collections.Generic; -using System.Linq.Dynamic.Core; -using System.Text.Json; using System.Threading.Tasks; -using DocumentFormat.OpenXml.Bibliography; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using SettleAccount.Domain.BQ; -using SettleAccount.Job.Services; -using TaskJob.EventArgs; using Win.Abp.Snowflakes; using Win.Sfs.BaseData.ImportExcelCommon; using Win.Sfs.SettleAccount.Bases; @@ -51,6 +46,82 @@ namespace Win.Sfs.SettleAccount.Entities.BQ _hbpoNotMng = hbpoNotMng; } + [HttpPost] + //[Route("export")] + public override async Task ExportAsync(HBPO_NOT_SA_DETAIL_REQ_DTO input) + { + var ls = input.Filters.Where(p => p.Column == "businessType").ToList(); + if (ls.Count > 0) + { + var entiy = input.Filters.Where(p => p.Column == "businessType").FirstOrDefault(); + var value = entiy.Value; + + input.Filters.Remove(entiy); + } + + IExporter _csv = new CsvExporter(); + IExporter _excel = new ExcelExporter(); + var entities = await _detailRepository.GetListByFilterAsync(input.Filters, input.Sorting, int.MaxValue, 0, true).ConfigureAwait(false); + + var dtoDetails = ObjectMapper.Map, List>(entities); + + var inner = from d in entities + join p in dtoDetails on d.Id equals p.Id + + select + new HBPO_NOT_SA_DETAIL_EXP_DTO() + { + SettleBillNum = d.SettleBillNum, + Site = d.Site, + Category = d.BusinessType.ToString(), + RealPN = d.GetProperty("RealPN", ""), + InvGroupNum = p.InvGroupNum, + SettleDate = d.SettleDate, + LU = d.LU, + PN = d.PN, + Qty = d.Qty, + GroupNum = d.GroupNum, + KeyCode = d.KeyCode, + Price = p.Price, + }; + + //dtoDetails.ForEach(dtoDetail => + //{ + // var item= entities.FirstOrDefault(e => e.Id == dtoDetail.Id); + // dtoDetail.RealPN = item.GetProperty("RealPN", ""); + + //}); + + + var classDisplayName = typeof(HBPO_NOT_SA_DETAIL_EXP_DTO).GetCustomAttribute()?.Name ?? typeof(HBPO_NOT_SA_DETAIL_EXP_DTO).Name; + string _fileName = $"{classDisplayName}_{Guid.NewGuid().ToString()}.xlsx"; + byte[] result = null; + + //switch (input.FileType) + //{ + // case 0: + // result = await _csv.ExportAsByteArray(dtoDetails).ConfigureAwait(false); + // break; + // case 1: + // result = await _excel.ExportAsByteArray(dtoDetails).ConfigureAwait(false); + // break; + //} + + result = await _excel.ExportAsByteArray(inner.ToList()).ConfigureAwait(false); + result.ShouldNotBeNull(); + + //保存导出文件到服务器存成二进制 + await _excelImportService.SaveBlobAsync( + new SaveExcelImportInputDto + { + Name = _fileName, + Content = result + } + ).ConfigureAwait(false); + return _fileName; + } + + public override async Task GenerateSettlementOrder(HBPO_NOT_SA_DETAIL_REQ_DTO input) { diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/HBPO_SA_SERVICE.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/HBPO_SA_SERVICE.cs index 6b10a5f3..1def0478 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/HBPO_SA_SERVICE.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/HBPO_SA_SERVICE.cs @@ -265,9 +265,11 @@ namespace Win.Sfs.SettleAccount.Entities.BQ var luAssemble = lus.Select(t => t.Replace(" ", "")); hbpoSaDetail.LU += luAssemble.Aggregate(new string(' ', 6), (current, index) => current + index); } + hbpoSaDetail.PN = Regex.Replace(hbpoSaDetail.PN, "['‘’]", ""); hbpoSaDetail.CustomerPartCodeNoSpace = hbpoSaDetail.LU.Replace(" ", ""); hbpoSaDetail.Version = Version; + hbpoSaDetail.ExtraProperties.TryAdd("RealPN", hbpoSaDetail.PN); }); return hbpoSaDetails; } diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_SA_SERVICE.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_SA_SERVICE.cs index 566b9700..f77cd77d 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_SA_SERVICE.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_SA_SERVICE.cs @@ -685,7 +685,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ //不可结算 结算分组号码(根据价格区分结算、不可结算) var pubNotSaGroupNums = pubSaDetails.FindAll(t => t.Price == default(decimal)).Select(t => t.GroupNum).Distinct(); pubSaDetailsCanSes = pubSaDetails.FindAll(t => pubNotSaGroupNums.Contains(t.GroupNum) == false); - pubSaDetailsNotCanSes = pubSaDetails.FindAll(t => pubNotSaGroupNums.Contains(t.GroupNum) == true && t.Price== default(decimal)); + pubSaDetailsNotCanSes = pubSaDetails.FindAll(t => pubNotSaGroupNums.Contains(t.GroupNum) == true || t.Price== default(decimal)); } //可结算明细 diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/JisBBACSeEdiCompareAppService.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/JisBBACSeEdiCompareAppService.cs index ffbfc794..b92abe84 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/JisBBACSeEdiCompareAppService.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/JisBBACSeEdiCompareAppService.cs @@ -124,6 +124,22 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs await db.BulkUpdateAsync(ediFlagErrEntities).ConfigureAwait(false); } } + + var seReturnUpdateQuery = db.Set().FromSqlRaw("select distinct b.* from (select * FROM [BQ_SA].[dbo].[Set_BBAC_SE_DETAIL] where TransType=-1 and Remark is null and BusinessType=1) a left join [BQ_SA].[dbo].[Set_BBAC_SE_DETAIL] b on a.PN=b.PN and a.LU=b.LU where b.TransType=1 and b.BusinessType=1 and b.ProType in (3,7,0) and b.IsDeleted=0"); + var seReturnUpdateEntities = seReturnUpdateQuery.ToList(); + if (seReturnUpdateEntities.Count > 0) + { + seReturnUpdateEntities.ForEach(t => t.IsDeleted = true); + await db.BulkUpdateAsync(seReturnUpdateEntities).ConfigureAwait(false); + } + + var hbpoReturnUpdateQuery = db.Set().FromSqlRaw("select distinct b.* from (select * FROM [BQ_SA].[dbo].[Set_HBPO_SE_DETAIL] where TransType=-1 and Remark is null and BusinessType=2) a left join [BQ_SA].[dbo].[Set_HBPO_SE_DETAIL] b on a.PN=b.PN and a.LU=b.LU where b.TransType=1 and b.BusinessType=2 and b.ProType in (3,7,0) and b.IsDeleted=0"); + var hbpoReturnUpdateEntities = hbpoReturnUpdateQuery.ToList(); + if (hbpoReturnUpdateEntities.Count > 0) + { + hbpoReturnUpdateEntities.ForEach(t => t.IsDeleted = true); + await db.BulkUpdateAsync(hbpoReturnUpdateEntities).ConfigureAwait(false); + } } /// diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/JisHBPOSeSyncBaseAppService.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/JisHBPOSeSyncBaseAppService.cs index a98d982d..bb102506 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/JisHBPOSeSyncBaseAppService.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/JisHBPOSeSyncBaseAppService.cs @@ -197,6 +197,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs t.BusinessType = EnumBusinessType.MaiDanJianHBPO; } } + t.PartCode = t.RealPartCode; t.CreateTime = dateTimeNow; t.CreationTime = dateTimeNow; diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Bases/EntityBase.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Bases/EntityBase.cs index 430f2947..7feca1aa 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Bases/EntityBase.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Bases/EntityBase.cs @@ -341,6 +341,10 @@ namespace SettleAccount.Bases /// 生產號 /// public virtual string PN { get; set; } + ///// + ///// 真实生產號 + ///// + //public virtual string RealPN { get; set; } /// /// 組合鍵值(LU+PN) /// @@ -407,6 +411,10 @@ namespace SettleAccount.Bases /// 生產號 /// public string PN { get; set; } + ///// + ///// 真实生產號 + ///// + //public virtual string RealPN { get; set; } /// /// 組合鍵值(LU+PN) /// @@ -485,6 +493,10 @@ namespace SettleAccount.Bases /// 生產號 /// public string PN { get; set; } + ///// + ///// 真实生產號 + ///// + //public virtual string RealPN { get; set; } /// /// 組合鍵值(LU+PN) /// diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/SaSeEdiCompareDetailReport.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/SaSeEdiCompareDetailReport.cs index df896c36..ccac730d 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/SaSeEdiCompareDetailReport.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/SaSeEdiCompareDetailReport.cs @@ -169,6 +169,7 @@ namespace Win.Sfs.SettleAccount.Reports [ValueMapping("当期数据", true)] [ValueMapping("", false)] public bool IsCurrent { get; set; } + /// /// 地点 /// diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/JisBBACSaSeEdiCompareExportService.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/JisBBACSaSeEdiCompareExportService.cs index ec4cdc0d..56d714ab 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/JisBBACSaSeEdiCompareExportService.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/JisBBACSaSeEdiCompareExportService.cs @@ -76,19 +76,25 @@ namespace SettleAccount.Job.Services.Report HandleSaSeEdiCompareDiffList(saSeEdiCompareDiffs); + //var sa1 = saSeEdiCompareDiffs.FindAll(t => t.PN == "3819841").ToList(); + //var sa2 = sa1.FindAll(t => t.SaCustomerPartCode == "A2068808405").ToList(); + + //saSeEdiCompareDiffs = saSeEdiCompareDiffs.FindAll(t => t.PN == "3819841").ToList(); + + #region 二次对比 //二次匹配上的记录 - var secondMatchHaveSaHaveSes = HandleSecondCompare(saSeEdiCompareDiffs, businessType); - if (secondMatchHaveSaHaveSes.Any()) - { - //二次匹配 匹配上的厂内零件号、PN - var secondMatchFPartCodePNs = secondMatchHaveSaHaveSes.Select(t => new { t.ReplaceFactoryPartCode, t.PN }); - saSeEdiCompareDiffs.RemoveAll(t => secondMatchFPartCodePNs.Contains(new { t.ReplaceFactoryPartCode, t.PN })); - saSeEdiCompareDiffs.AddRange(secondMatchHaveSaHaveSes); - //二次对比比对上的数据入库 - var seCDetailEntitys = _objectMapper.Map, List>(secondMatchHaveSaHaveSes); - _settleAccountDbContext.Set().AddRange(seCDetailEntitys); - } + //var secondMatchHaveSaHaveSes = HandleSecondCompare(saSeEdiCompareDiffs, businessType); + //if (secondMatchHaveSaHaveSes.Any()) + //{ + // //二次匹配 匹配上的厂内零件号、PN + // var secondMatchFPartCodePNs = secondMatchHaveSaHaveSes.Select(t => new { t.ReplaceFactoryPartCode, t.PN }); + // saSeEdiCompareDiffs.RemoveAll(t => secondMatchFPartCodePNs.Contains(new { t.ReplaceFactoryPartCode, t.PN })); + // saSeEdiCompareDiffs.AddRange(secondMatchHaveSaHaveSes); + // //二次对比比对上的数据入库 + // var seCDetailEntitys = _objectMapper.Map, List>(secondMatchHaveSaHaveSes); + // _settleAccountDbContext.Set().AddRange(seCDetailEntitys); + //} #endregion #region 结算数据处理 @@ -140,8 +146,23 @@ namespace SettleAccount.Job.Services.Report public List GetEdiSeSaCompareData(int version, DateTime seStartDateTime, DateTime seEndDateTime) { //结算 - var saGroup = from sa in _settleAccountDbContext.Set() - where sa.BusinessType == businessType && sa.Version == version + //var saGroup = from sa in _settleAccountDbContext.Set() + // where sa.BusinessType == businessType && sa.Version == version + // group sa by new { sa.PN, sa.CustomerPartCodeNoSpace } into groupItem + // select new + // { + // groupItem.Key.PN, + // groupItem.Key.CustomerPartCodeNoSpace, + // Qty = groupItem.Sum(t => t.Qty), + // Version = groupItem.Max(t => t.Version), + // LU = groupItem.Max(t => t.LU), + // SettleDate = groupItem.Max(t => t.SettleDate), + // PartCode = groupItem.Max(t => t.PartCode), + // Site = groupItem.Max(t => t.Site), + // Price = groupItem.Max(t => t.Price), + // }; + var saGroup = from sa in _settleAccountDbContext.Set() + where sa.BusinessType == businessType group sa by new { sa.PN, sa.CustomerPartCodeNoSpace } into groupItem select new { @@ -156,8 +177,23 @@ namespace SettleAccount.Job.Services.Report Price = groupItem.Max(t => t.Price), }; //发运 - var seGroup = (from se in _settleAccountDbContext.Set() - where se.BusinessType == businessType && se.BillTime >= seStartDateTime && se.BillTime <= seEndDateTime && se.State==0 + //var seGroup = (from se in _settleAccountDbContext.Set() + // where se.BusinessType == businessType && se.BillTime >= seStartDateTime && se.BillTime <= seEndDateTime && se.State==0 && se.IsDeleted == false + // group se by new { se.PN, se.CustomerPartCodeNoSpace } into groupItem + // select new + // { + // groupItem.Key.PN, + // groupItem.Key.CustomerPartCodeNoSpace, + // Qty = groupItem.Sum(t => t.Qty), + // LU = groupItem.Max(t => t.LU), + // WmsBillNum = groupItem.Max(t => t.WmsBillNum), + // ShippingDate = groupItem.Max(t => t.ShippingDate), + // FactoryPartCode = groupItem.Max(t => t.FactoryPartCode), + // ToLoc = groupItem.Max(t => t.ToLoc), + // ErpToLoc = groupItem.Max(t => t.ErpToLoc) + // }).Where(t => t.Qty != 0M); + var seGroup = (from se in _settleAccountDbContext.Set() + where se.BusinessType == businessType group se by new { se.PN, se.CustomerPartCodeNoSpace } into groupItem select new { @@ -170,10 +206,20 @@ namespace SettleAccount.Job.Services.Report FactoryPartCode = groupItem.Max(t => t.FactoryPartCode), ToLoc = groupItem.Max(t => t.ToLoc), ErpToLoc = groupItem.Max(t => t.ErpToLoc) - }).Where(t => t.Qty != 0M); + }).Where(t => t.Qty > 0M); //Edi + //var ediGroup = from edi in _settleAccountDbContext.Set() + // where edi.IsDeleted == false && edi.IsHaveSeData == true && edi.State == 0 + // group edi by new { edi.PN, edi.CustomerPartCodeNoSpace } into groupItem + // select new + // { + // groupItem.Key.PN, + // groupItem.Key.CustomerPartCodeNoSpace, + // Qty = groupItem.Sum(t => t.Qty), + // LU = groupItem.Max(t => t.LU) + // }; var ediGroup = from edi in _settleAccountDbContext.Set() - where edi.IsDeleted == false && edi.IsHaveSeData == true && edi.State == 0 + where edi.IsDeleted == false && edi.IsHaveSeData == true group edi by new { edi.PN, edi.CustomerPartCodeNoSpace } into groupItem select new { diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/JisHBPOSaSeEdiCompareExportService.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/JisHBPOSaSeEdiCompareExportService.cs index 2702a544..0997ee53 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/JisHBPOSaSeEdiCompareExportService.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/JisHBPOSaSeEdiCompareExportService.cs @@ -78,17 +78,17 @@ namespace SettleAccount.Job.Services.Report #region 二次对比 //二次匹配上的记录 - var secondMatchHaveSaHaveSes = HandleSecondCompare(saSeEdiCompareDiffs, businessType); - if (secondMatchHaveSaHaveSes.Any()) - { - //二次匹配 匹配上的厂内零件号、PN - var secondMatchFPartCodePNs = secondMatchHaveSaHaveSes.Select(t => new { t.ReplaceFactoryPartCode, t.PN }); - saSeEdiCompareDiffs.RemoveAll(t => secondMatchFPartCodePNs.Contains(new { t.ReplaceFactoryPartCode, t.PN })); - saSeEdiCompareDiffs.AddRange(secondMatchHaveSaHaveSes); - //二次对比比对上的数据入库 - var seCDetailEntitys = _objectMapper.Map, List>(secondMatchHaveSaHaveSes); - _settleAccountDbContext.Set().AddRange(seCDetailEntitys); - } + //var secondMatchHaveSaHaveSes = HandleSecondCompare(saSeEdiCompareDiffs, businessType); + //if (secondMatchHaveSaHaveSes.Any()) + //{ + // //二次匹配 匹配上的厂内零件号、PN + // var secondMatchFPartCodePNs = secondMatchHaveSaHaveSes.Select(t => new { t.ReplaceFactoryPartCode, t.PN }); + // saSeEdiCompareDiffs.RemoveAll(t => secondMatchFPartCodePNs.Contains(new { t.ReplaceFactoryPartCode, t.PN })); + // saSeEdiCompareDiffs.AddRange(secondMatchHaveSaHaveSes); + // //二次对比比对上的数据入库 + // var seCDetailEntitys = _objectMapper.Map, List>(secondMatchHaveSaHaveSes); + // _settleAccountDbContext.Set().AddRange(seCDetailEntitys); + //} #endregion #region 结算数据处理 @@ -135,8 +135,24 @@ namespace SettleAccount.Job.Services.Report public List GetSaSeEdiCompareData(int version, DateTime seStartDateTime, DateTime seEndDateTime) { //结算 + //var saGroup = from sa in _settleAccountDbContext.Set() + // where sa.BusinessType == businessType && sa.Version == version + // group sa by new { sa.PN, sa.CustomerPartCodeNoSpace } into groupItem + // select new + // { + // groupItem.Key.PN, + // groupItem.Key.CustomerPartCodeNoSpace, + // Qty = groupItem.Sum(t => t.Qty), + // Version = groupItem.Max(t => t.Version), + // LU = groupItem.Max(t => t.LU), + // SettleDate = groupItem.Max(t => t.SettleDate), + // PartCode = groupItem.Max(t => t.PartCode), + // Site = groupItem.Max(t => t.Site), + // Price = groupItem.Max(t => t.Price) + // }; + var saGroup = from sa in _settleAccountDbContext.Set() - where sa.BusinessType == businessType && sa.Version == version + where sa.BusinessType == businessType group sa by new { sa.PN, sa.CustomerPartCodeNoSpace } into groupItem select new { @@ -150,9 +166,26 @@ namespace SettleAccount.Job.Services.Report Site = groupItem.Max(t => t.Site), Price = groupItem.Max(t => t.Price) }; + //发运 + //var seGroup = (from se in _settleAccountDbContext.Set() + // where se.BusinessType == businessType && se.BillTime >= seStartDateTime && se.BillTime <= seEndDateTime && se.State == 0 && se.IsDeleted == false + // group se by new { se.PN, se.CustomerPartCodeNoSpace } into groupItem + // select new + // { + // groupItem.Key.PN, + // groupItem.Key.CustomerPartCodeNoSpace, + // Qty = groupItem.Sum(t => t.Qty), + // LU = groupItem.Max(t => t.LU), + // WmsBillNum = groupItem.Max(t => t.WmsBillNum), + // ShippingDate = groupItem.Max(t => t.ShippingDate), + // FactoryPartCode = groupItem.Max(t => t.FactoryPartCode), + // ToLoc = groupItem.Max(t => t.ToLoc), + // ErpToLoc = groupItem.Max(t => t.ErpToLoc) + // }).Where(t => t.Qty != 0M); + var seGroup = (from se in _settleAccountDbContext.Set() - where se.BusinessType == businessType && se.BillTime >= seStartDateTime && se.BillTime <= seEndDateTime && se.State == 0 + where se.BusinessType == businessType group se by new { se.PN, se.CustomerPartCodeNoSpace } into groupItem select new { @@ -165,10 +198,21 @@ namespace SettleAccount.Job.Services.Report FactoryPartCode = groupItem.Max(t => t.FactoryPartCode), ToLoc = groupItem.Max(t => t.ToLoc), ErpToLoc = groupItem.Max(t => t.ErpToLoc) - }).Where(t => t.Qty != 0M); + }).Where(t => t.Qty > 0M); + //Edi + //var ediGroup = from edi in _settleAccountDbContext.Set() + // where edi.IsDeleted == false && edi.IsHaveSeData == true && edi.State == 0 + // group edi by new { edi.PN, edi.CustomerPartCodeNoSpace } into groupItem + // select new + // { + // groupItem.Key.PN, + // groupItem.Key.CustomerPartCodeNoSpace, + // Qty = groupItem.Sum(t => t.Qty), + // LU = groupItem.Max(t => t.LU) + // }; var ediGroup = from edi in _settleAccountDbContext.Set() - where edi.IsDeleted == false && edi.IsHaveSeData == true && edi.State == 0 + where edi.IsDeleted == false && edi.IsHaveSeData == true group edi by new { edi.PN, edi.CustomerPartCodeNoSpace } into groupItem select new { @@ -177,6 +221,7 @@ namespace SettleAccount.Job.Services.Report Qty = groupItem.Sum(t => t.Qty), LU = groupItem.Max(t => t.LU) }; + var seEdiGroup = from se in seGroup join edi in ediGroup on new { se.PN, se.CustomerPartCodeNoSpace } equals new { edi.PN, edi.CustomerPartCodeNoSpace } diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/SaSeEdiCompareExportBaseService.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/SaSeEdiCompareExportBaseService.cs index 9e1f301b..c88f3af0 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/SaSeEdiCompareExportBaseService.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/SaSeEdiCompareExportBaseService.cs @@ -1,3 +1,4 @@ +using System; using System.Collections.Generic; using System.Linq; using EFCore.BulkExtensions; @@ -259,11 +260,15 @@ namespace SettleAccount.Job.Services.Report SEQty = p.Sum(t => t.SEQty), EdiQty = p.Sum(t => t.EdiQty) }).ToList(); + //有结算无发运 + var haveSaNotHaveSeExport = saSeEdiCompareDetailExports.FindAll(t => new EnumSaSeEdiCompareCategory[] { EnumSaSeEdiCompareCategory.HaveSaNotHaveSeHaveEdi, EnumSaSeEdiCompareCategory.HaveSaNotHaveSeNotHaveEdi }.Contains(t.Category)); //有结算有发运 var haveSaHaveSeExports = saSeEdiCompareDetailExports.FindAll(t => new EnumSaSeEdiCompareCategory[] { EnumSaSeEdiCompareCategory.HaveSaHaveSeHaveEdi, EnumSaSeEdiCompareCategory.HaveSaHaveSeNotHaveEdi }.Contains(t.Category)); + + var haveSaHaveSeExport = haveSaHaveSeExports.FindAll(t => t.IsCurrent==true); //有结算有发运汇总 - var haveSaHaveSeSumExports = haveSaHaveSeExports.GroupBy(p => p.ReplaceFactoryPartCode).Select(p => new SaSeEdiCompareSumReport() + var haveSaHaveSeSumExports = haveSaHaveSeExport.GroupBy(p => p.ReplaceFactoryPartCode).Select(p => new SaSeEdiCompareSumReport() { FactoryPartCode = p.Key, PartCodeDesc = p.FirstOrDefault().PartCodeDesc, @@ -295,26 +300,33 @@ namespace SettleAccount.Job.Services.Report }).ToList(); var excelExporter = new ExcelExporter(); - //结算核对明细输出 - excelExporter.Append(saSeEdiCompareDetailExports.Take(detailMaxRowNumberOnASheet).ToList(), $"{businessTypeDisplayName}结算核对明细输出"); - for (var i = 1; i < saSeEdiCompareDetailExports.Count / detailMaxRowNumberOnASheet + ((saSeEdiCompareDetailExports.Count % detailMaxRowNumberOnASheet) > 0 ? 1 : 0); i++) + //有结算无发运 + excelExporter.Append(haveSaNotHaveSeExport.Take(detailMaxRowNumberOnASheet).ToList(), $"{businessTypeDisplayName}有结算无发运"); + for (var i = 1; i < haveSaNotHaveSeExport.Count / detailMaxRowNumberOnASheet + ((haveSaNotHaveSeExport.Count % detailMaxRowNumberOnASheet) > 0 ? 1 : 0); i++) { - var sheetDataItems = saSeEdiCompareDetailExports.Skip(i * detailMaxRowNumberOnASheet).Take(detailMaxRowNumberOnASheet).ToList(); - excelExporter.Append(sheetDataItems, $"{businessTypeDisplayName}结算核对明细输出-{i}"); + var sheetDataItems = haveSaNotHaveSeExport.Skip(i * detailMaxRowNumberOnASheet).Take(detailMaxRowNumberOnASheet).ToList(); + excelExporter.Append(sheetDataItems, $"{businessTypeDisplayName}有结算无发运-{i}"); } - //结算核对汇总输出 - excelExporter.Append(saSeEdiCompareSumExports.Take(sumMaxRowNumberOnASheet).ToList(), $"{businessTypeDisplayName}结算核对汇总输出"); - for (var i = 1; i < saSeEdiCompareSumExports.Count / sumMaxRowNumberOnASheet + ((saSeEdiCompareSumExports.Count % sumMaxRowNumberOnASheet) > 0 ? 1 : 0); i++) + //无结算有发运 + excelExporter.Append(notHaveSaHaveSeExports.Take(detailMaxRowNumberOnASheet).ToList(), $"{businessTypeDisplayName}无结算有发运"); + for (var i = 1; i < notHaveSaHaveSeExports.Count / detailMaxRowNumberOnASheet + ((notHaveSaHaveSeExports.Count % detailMaxRowNumberOnASheet) > 0 ? 1 : 0); i++) { - var sheetDataItems = saSeEdiCompareSumExports.Skip(i * sumMaxRowNumberOnASheet).Take(sumMaxRowNumberOnASheet).ToList(); ; - excelExporter.Append(sheetDataItems, $"{businessTypeDisplayName}结算核对汇总输出-{i}"); + var sheetDataItems = notHaveSaHaveSeExports.Skip(i * detailMaxRowNumberOnASheet).Take(detailMaxRowNumberOnASheet).ToList(); + excelExporter.Append(sheetDataItems, $"{businessTypeDisplayName}无结算有发运-{i}"); } + ////结算核对汇总输出 + //excelExporter.Append(saSeEdiCompareSumExports.Take(sumMaxRowNumberOnASheet).ToList(), $"{businessTypeDisplayName}结算核对汇总输出"); + //for (var i = 1; i < saSeEdiCompareSumExports.Count / sumMaxRowNumberOnASheet + ((saSeEdiCompareSumExports.Count % sumMaxRowNumberOnASheet) > 0 ? 1 : 0); i++) + //{ + // var sheetDataItems = saSeEdiCompareSumExports.Skip(i * sumMaxRowNumberOnASheet).Take(sumMaxRowNumberOnASheet).ToList(); ; + // excelExporter.Append(sheetDataItems, $"{businessTypeDisplayName}结算核对汇总输出-{i}"); + //} //有结算有发货明细输出 - excelExporter.Append(haveSaHaveSeExports.Take(detailMaxRowNumberOnASheet).ToList(), $"{businessTypeDisplayName}有结算有发货明细输出"); - for (var i = 1; i < haveSaHaveSeExports.Count / detailMaxRowNumberOnASheet + ((haveSaHaveSeExports.Count % detailMaxRowNumberOnASheet) > 0 ? 1 : 0); i++) + excelExporter.Append(haveSaHaveSeExport.Take(detailMaxRowNumberOnASheet).ToList(), $"{businessTypeDisplayName}有结算有发货明细输出"); + for (var i = 1; i < haveSaHaveSeExport.Count / detailMaxRowNumberOnASheet + ((haveSaHaveSeExport.Count % detailMaxRowNumberOnASheet) > 0 ? 1 : 0); i++) { - var sheetDataItems = haveSaHaveSeExports.Skip(i * detailMaxRowNumberOnASheet).Take(detailMaxRowNumberOnASheet).ToList(); + var sheetDataItems = haveSaHaveSeExport.Skip(i * detailMaxRowNumberOnASheet).Take(detailMaxRowNumberOnASheet).ToList(); excelExporter.Append(sheetDataItems, $"{businessTypeDisplayName}有结算有发货明细输出-{i}"); } //有结算有发货汇总输出 @@ -325,20 +337,20 @@ namespace SettleAccount.Job.Services.Report excelExporter.Append(sheetDataItems, $"{businessTypeDisplayName}有结算有发货汇总输出-{i}"); } - //有结算有发货明细输出 - excelExporter.Append(haveSaNotHaveSeExports.Take(detailMaxRowNumberOnASheet).ToList(), $"{businessTypeDisplayName}有结算无发货明细输出"); - for (var i = 1; i < haveSaNotHaveSeExports.Count / detailMaxRowNumberOnASheet + ((haveSaNotHaveSeExports.Count % detailMaxRowNumberOnASheet) > 0 ? 1 : 0); i++) - { - var sheetDataItems = haveSaNotHaveSeExports.Skip(i * detailMaxRowNumberOnASheet).Take(detailMaxRowNumberOnASheet).ToList(); - excelExporter.Append(sheetDataItems, $"{businessTypeDisplayName}有结算无发货明细输出-{i}"); - } - //有结算有发货汇总输出 - excelExporter.Append(haveSaNotHaveSeSumExports.Take(sumMaxRowNumberOnASheet).ToList(), $"{businessTypeDisplayName}有结算无发货汇总输出"); - for (var i = 1; i < haveSaNotHaveSeSumExports.Count / sumMaxRowNumberOnASheet + ((haveSaNotHaveSeSumExports.Count % sumMaxRowNumberOnASheet) > 0 ? 1 : 0); i++) - { - var sheetDataItems = haveSaNotHaveSeSumExports.Skip(i * sumMaxRowNumberOnASheet).Take(sumMaxRowNumberOnASheet).ToList(); - excelExporter.Append(sheetDataItems, $"{businessTypeDisplayName}有结算无发货汇总输出-{i}"); - } + ////有结算无发货明细输出 + //excelExporter.Append(haveSaNotHaveSeExports.Take(detailMaxRowNumberOnASheet).ToList(), $"{businessTypeDisplayName}有结算无发货明细输出"); + //for (var i = 1; i < haveSaNotHaveSeExports.Count / detailMaxRowNumberOnASheet + ((haveSaNotHaveSeExports.Count % detailMaxRowNumberOnASheet) > 0 ? 1 : 0); i++) + //{ + // var sheetDataItems = haveSaNotHaveSeExports.Skip(i * detailMaxRowNumberOnASheet).Take(detailMaxRowNumberOnASheet).ToList(); + // excelExporter.Append(sheetDataItems, $"{businessTypeDisplayName}有结算无发货明细输出-{i}"); + //} + ////有结算无发货汇总输出 + //excelExporter.Append(haveSaNotHaveSeSumExports.Take(sumMaxRowNumberOnASheet).ToList(), $"{businessTypeDisplayName}有结算无发货汇总输出"); + //for (var i = 1; i < haveSaNotHaveSeSumExports.Count / sumMaxRowNumberOnASheet + ((haveSaNotHaveSeSumExports.Count % sumMaxRowNumberOnASheet) > 0 ? 1 : 0); i++) + //{ + // var sheetDataItems = haveSaNotHaveSeSumExports.Skip(i * sumMaxRowNumberOnASheet).Take(sumMaxRowNumberOnASheet).ToList(); + // excelExporter.Append(sheetDataItems, $"{businessTypeDisplayName}有结算无发货汇总输出-{i}"); + //} return excelExporter; } diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/SeEdiCompareExportBaseService.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/SeEdiCompareExportBaseService.cs index c728ad17..56536446 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/SeEdiCompareExportBaseService.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/SeEdiCompareExportBaseService.cs @@ -97,10 +97,11 @@ namespace SettleAccount.Job.Services.Report //无EDI有发运 var notHaveEdiHaveSeList = _settleAccountDbContext.Set() - .Where(t => t.BusinessType == businessType && t.BillTime >= seStartDateTime && t.BillTime <= seEndDateTime) + .Where(t => t.BusinessType == businessType && t.BillTime >= seStartDateTime && t.BillTime <= seEndDateTime && t.TransType == EnumDelTransType.发货) .Where(t=>t.State==0) .Where(t => proType.Contains(t.ProType)) .Where(t => t.IsHaveEdiData == false) + .Where(t => t.IsDeleted == false) .GroupBy(t => new { t.PN, t.CustomerPartCodeNoSpace }) .Select(t => new TCompareReport() { @@ -135,7 +136,7 @@ namespace SettleAccount.Job.Services.Report LineStationCode = groupItem.Max(t => t.LineStationCode) }; var seGroup = from se in _settleAccountDbContext.Set() - where se.BusinessType == businessType && se.IsHaveEdiData == true && se.BillTime >= seStartDateTime && se.BillTime <= seEndDateTime && se.State==0 && proType.Contains(se.ProType) + where se.BusinessType == businessType && se.IsHaveEdiData == true && se.BillTime >= seStartDateTime && se.BillTime <= seEndDateTime && se.State==0 && proType.Contains(se.ProType) && se.IsDeleted == false && se.TransType == EnumDelTransType.发货 group se by new { se.PN, se.CustomerPartCodeNoSpace } into groupItem select new {