Browse Source

更新

master
zhaoxinyu 10 months ago
parent
commit
d43713d954
  1. 2
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/settle/detail.js
  2. 24
      code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/BBAC_NOT_SA_DTO.cs
  3. 10
      code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/HBPO_NOT_SA_DTO.cs
  4. 28
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Bases/NOT_SA_SERVICE.cs
  5. 94
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_NOT_SA_SERVICE.cs
  6. 12
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_SA_SERVICE.cs
  7. 81
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/HBPO_NOT_SA_SERVICE.cs
  8. 2
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/HBPO_SA_SERVICE.cs
  9. 2
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_SA_SERVICE.cs
  10. 16
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/JisBBACSeEdiCompareAppService.cs
  11. 1
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/JisHBPOSeSyncBaseAppService.cs
  12. 12
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Bases/EntityBase.cs
  13. 1
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/SaSeEdiCompareDetailReport.cs
  14. 76
      code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/JisBBACSaSeEdiCompareExportService.cs
  15. 75
      code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/JisHBPOSaSeEdiCompareExportService.cs
  16. 68
      code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/SaSeEdiCompareExportBaseService.cs
  17. 5
      code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/SeEdiCompareExportBaseService.cs

2
code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/settle/detail.js

@ -57,7 +57,7 @@ export default function (businessType, type) {
title: "是否退货", title: "是否退货",
type: "boolean", type: "boolean",
}, },
isMaidan: { isMaiDan: {
title: "是否买单", title: "是否买单",
type: "boolean", type: "boolean",
}, },

24
code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/BBAC_NOT_SA_DTO.cs

@ -1,4 +1,5 @@
using System; using System;
using System.ComponentModel.DataAnnotations;
using Magicodes.ExporterAndImporter.Core; using Magicodes.ExporterAndImporter.Core;
using Volo.Abp.Application.Dtos; using Volo.Abp.Application.Dtos;
using Win.Sfs.SettleAccount.Bases; using Win.Sfs.SettleAccount.Bases;
@ -58,9 +59,19 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Dtos
/// 厂内零件号 /// 厂内零件号
/// </summary> /// </summary>
public string PartCode { get; set; } public string PartCode { get; set; }
/// <summary>
///是否退货
/// </summary>
[ExporterHeader(DisplayName = "是否退货")]
public string IsReturn { get; set; }
/// <summary>
/// 是否是买单件
/// </summary>
[ExporterHeader(DisplayName = "是否是买单件")]
public bool IsMaiDan { get; set; }
} }
public class BBAC_NOT_SA_DETAIL_EXP_DTO public class BBAC_NOT_SA_DETAIL_EXP_DTO:EntityDto<Guid>
{ {
/// <summary> /// <summary>
@ -84,9 +95,16 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Dtos
[ExporterHeader(DisplayName = "是否退货")] [ExporterHeader(DisplayName = "是否退货")]
public string IsReturn { get; set; } public string IsReturn { get; set; }
/// <summary> /// <summary>
/// 是否退货 /// 是否是买单件
/// </summary> /// </summary>
[ExporterHeader(DisplayName = "是否退货")] [ExporterHeader(DisplayName = "是否是买单件")]
public bool IsMaiDan { get; set; }
[ExporterHeader(DisplayName = "原始生产码")]
public string RealPN { get; set; }
/// <summary>
/// 版本
/// </summary>
[ExporterHeader(DisplayName = "版本")]
public int Version { get; set; } public int Version { get; set; }
[ExporterHeader(DisplayName = "单价")] [ExporterHeader(DisplayName = "单价")]
public decimal Price { get; set; } public decimal Price { get; set; }

10
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 string PartCode { get; set; }
} }
public class HBPO_NOT_SA_DETAIL_EXP_DTO public class HBPO_NOT_SA_DETAIL_EXP_DTO : EntityDto<Guid>
{ {
/// <summary> /// <summary>
@ -79,13 +79,17 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Dtos
/// <summary> /// <summary>
///业务类别 ///业务类别
/// </summary> /// </summary>
//[ExporterHeader(DisplayName = "业务类别")] [ExporterHeader(DisplayName = "业务类别")]
//public string Category { get; set; } public string Category { get; set; }
/// <summary> /// <summary>
///是否退货 ///是否退货
/// </summary> /// </summary>
//[ExporterHeader(DisplayName = "是否退货")] //[ExporterHeader(DisplayName = "是否退货")]
//public string IsReturn { get; set; } //public string IsReturn { get; set; }
//[ExporterHeader(DisplayName = "是否买单")]
//public string IsMaiDan { get; set; }
[ExporterHeader(DisplayName = "原始生产码")]
public string RealPN { get; set; }
[ExporterHeader(DisplayName = "期间")] [ExporterHeader(DisplayName = "期间")]
public int Version { get; set; } public int Version { get; set; }
[ExporterHeader(DisplayName = "单价")] [ExporterHeader(DisplayName = "单价")]

28
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 Magicodes.ExporterAndImporter.Excel;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using SettleAccount.Bases; using SettleAccount.Bases;
using ShardingCore.Extensions;
using Shouldly; using Shouldly;
using Volo.Abp.Application.Dtos; using Volo.Abp.Application.Dtos;
using Volo.Abp.Data;
using Win.Abp.Snowflakes; using Win.Abp.Snowflakes;
using Win.Sfs.BaseData.ImportExcelCommon; using Win.Sfs.BaseData.ImportExcelCommon;
using Win.Sfs.SettleAccount.Bases.DomainServices; using Win.Sfs.SettleAccount.Bases.DomainServices;
using Win.Sfs.SettleAccount.CommonManagers; using Win.Sfs.SettleAccount.CommonManagers;
using Win.Sfs.SettleAccount.Entities.Prices; using Win.Sfs.SettleAccount.Entities.Prices;
using Win.Sfs.SettleAccount.ExportReports; using Win.Sfs.SettleAccount.ExportReports;
using Win.Sfs.Shared.Filter;
using Win.Sfs.Shared.RepositoryBase; using Win.Sfs.Shared.RepositoryBase;
namespace Win.Sfs.SettleAccount.Bases namespace Win.Sfs.SettleAccount.Bases
@ -53,9 +56,28 @@ namespace Win.Sfs.SettleAccount.Bases
//[Route("detailquery")] //[Route("detailquery")]
public virtual async Task<PagedResultDto<TEntityDetailDto>> DetailQueryAsync(TRequestDetailInput input) public virtual async Task<PagedResultDto<TEntityDetailDto>> 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 entitys = await _detailRepository.GetListByFilterAsync(input.Filters, input.Sorting, input.MaxResultCount, input.SkipCount).ConfigureAwait(false);
var totalCount = await _detailRepository.GetCountByFilterAsync(input.Filters).ConfigureAwait(false); var totalCount = await _detailRepository.GetCountByFilterAsync(input.Filters).ConfigureAwait(false);
var dtos = ObjectMapper.Map<List<TEntityDetail>, List<TEntityDetailDto>>(entitys); var dtos = ObjectMapper.Map<List<TEntityDetail>, List<TEntityDetailDto>>(entitys);
return new PagedResultDto<TEntityDetailDto>(totalCount, dtos); return new PagedResultDto<TEntityDetailDto>(totalCount, dtos);
} }
@ -120,7 +142,10 @@ namespace Win.Sfs.SettleAccount.Bases
IExporter _excel = new ExcelExporter(); IExporter _excel = new ExcelExporter();
Stopwatch sw = Stopwatch.StartNew(); Stopwatch sw = Stopwatch.StartNew();
var entities = await _detailRepository.GetListByFilterAsync(input.Filters, input.Sorting, int.MaxValue, 0, true).ConfigureAwait(false); var entities = await _detailRepository.GetListByFilterAsync(input.Filters, input.Sorting, int.MaxValue, 0, true).ConfigureAwait(false);
var dtoDetails = ObjectMapper.Map<List<TEntityDetail>, List<TEntityDetailExportDto>>(entities); var dtoDetails = ObjectMapper.Map<List<TEntityDetail>, List<TEntityDetailExportDto>>(entities);
var classDisplayName = typeof(TEntityDetailExportDto).GetCustomAttribute<DisplayAttribute>()?.Name ?? typeof(TEntityDetailExportDto).Name; var classDisplayName = typeof(TEntityDetailExportDto).GetCustomAttribute<DisplayAttribute>()?.Name ?? typeof(TEntityDetailExportDto).Name;
string _fileName = $"{classDisplayName}_{Guid.NewGuid().ToString()}.xlsx"; string _fileName = $"{classDisplayName}_{Guid.NewGuid().ToString()}.xlsx";
byte[] result = null; byte[] result = null;
@ -144,6 +169,9 @@ namespace Win.Sfs.SettleAccount.Bases
//#endif //#endif
} }
/// <summary> /// <summary>
/// 生成可计算单 /// 生成可计算单
/// </summary> /// </summary>

94
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_NOT_SA_SERVICE.cs

@ -1,14 +1,12 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq.Dynamic.Core;
using System.Text.Json;
using System.Threading.Tasks; using System.Threading.Tasks;
using Magicodes.ExporterAndImporter.Core;
using Magicodes.ExporterAndImporter.Csv;
using Magicodes.ExporterAndImporter.Excel;
using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using SettleAccount.Domain.BQ; using SettleAccount.Domain.BQ;
using SettleAccount.Job.Services;
using TaskJob.EventArgs;
using Volo.Abp;
using Win.Abp.Snowflakes; using Win.Abp.Snowflakes;
using Win.Sfs.BaseData.ImportExcelCommon; using Win.Sfs.BaseData.ImportExcelCommon;
using Win.Sfs.SettleAccount.Bases; using Win.Sfs.SettleAccount.Bases;
@ -17,8 +15,6 @@ using Win.Sfs.SettleAccount.CommonManagers;
using Win.Sfs.SettleAccount.Constant; using Win.Sfs.SettleAccount.Constant;
using Win.Sfs.SettleAccount.Entities.BQ.Dtos; using Win.Sfs.SettleAccount.Entities.BQ.Dtos;
using Win.Sfs.SettleAccount.Entities.BQ.Managers; 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.SettleAccount.ExportReports;
using Win.Sfs.Shared.RepositoryBase; using Win.Sfs.Shared.RepositoryBase;
@ -47,6 +43,90 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
_bbacNotMng = bbacNotMng; _bbacNotMng = bbacNotMng;
_service = service; _service = service;
} }
[HttpPost]
//[Route("export")]
public override async Task<string> 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<BBAC_NOT_SA_DETAIL>, List<BBAC_NOT_SA_DETAIL_EXP_DTO>>(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<DisplayAttribute>()?.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] [HttpPost]
public override async Task<IActionResult> GenerateSettlementOrder(BBAC_NOT_SA_DETAIL_REQ_DTO input) public override async Task<IActionResult> GenerateSettlementOrder(BBAC_NOT_SA_DETAIL_REQ_DTO input)
{ {

12
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.Version = Version;
importBBACSaDetail.Site = Site; importBBACSaDetail.Site = Site;
importBBACSaDetail.BusinessType = importBBACSaDetail.PN.Contains("R0") ? EnumBusinessType.MaiDanJianBBAC : EnumBusinessType.JisBBAC; 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); var jisSaDetails = importBBACSaDetails.FindAll(t => t.BusinessType == EnumBusinessType.JisBBAC);
@ -171,6 +173,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
*/ */
maiDanSaDetails.ForEach(maiDanSaDetail => maiDanSaDetails.ForEach(maiDanSaDetail =>
{ {
//maiDanSaDetail.RealPN = maiDanSaDetail.PN;
maiDanSaDetail.ProductionCodeType = maiDanSaDetail.PN[^2..]; maiDanSaDetail.ProductionCodeType = maiDanSaDetail.PN[^2..];
maiDanSaDetail.PN = maiDanSaDetail.PN[..7]; maiDanSaDetail.PN = maiDanSaDetail.PN[..7];
}); });
@ -477,6 +480,15 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
} }
if (bbacNotSaDetails.Count > 0) if (bbacNotSaDetails.Count > 0)
{ {
bbacNotSaDetails.ForEach(bbacNotSaDetail =>
{
if(bbacNotSaDetail.BusinessType==EnumBusinessType.MaiDanJianBBAC)
{
bbacNotSaDetail.IsMaiDan = true;
}
});
await _bbacNotSaDetailRepository.DbContext.BulkInsertAsync(bbacNotSaDetails).ConfigureAwait(false); await _bbacNotSaDetailRepository.DbContext.BulkInsertAsync(bbacNotSaDetails).ConfigureAwait(false);
} }
if (materialRelationships.Count > 0) if (materialRelationships.Count > 0)

81
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/HBPO_NOT_SA_SERVICE.cs

@ -1,14 +1,9 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq.Dynamic.Core;
using System.Text.Json;
using System.Threading.Tasks; using System.Threading.Tasks;
using DocumentFormat.OpenXml.Bibliography;
using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using SettleAccount.Domain.BQ; using SettleAccount.Domain.BQ;
using SettleAccount.Job.Services;
using TaskJob.EventArgs;
using Win.Abp.Snowflakes; using Win.Abp.Snowflakes;
using Win.Sfs.BaseData.ImportExcelCommon; using Win.Sfs.BaseData.ImportExcelCommon;
using Win.Sfs.SettleAccount.Bases; using Win.Sfs.SettleAccount.Bases;
@ -51,6 +46,82 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
_hbpoNotMng = hbpoNotMng; _hbpoNotMng = hbpoNotMng;
} }
[HttpPost]
//[Route("export")]
public override async Task<string> 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<HBPO_NOT_SA_DETAIL>, List<HBPO_NOT_SA_DETAIL_EXP_DTO>>(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<DisplayAttribute>()?.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<IActionResult> GenerateSettlementOrder(HBPO_NOT_SA_DETAIL_REQ_DTO input) public override async Task<IActionResult> GenerateSettlementOrder(HBPO_NOT_SA_DETAIL_REQ_DTO input)
{ {

2
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(" ", "")); var luAssemble = lus.Select(t => t.Replace(" ", ""));
hbpoSaDetail.LU += luAssemble.Aggregate(new string(' ', 6), (current, index) => current + index); hbpoSaDetail.LU += luAssemble.Aggregate(new string(' ', 6), (current, index) => current + index);
} }
hbpoSaDetail.PN = Regex.Replace(hbpoSaDetail.PN, "['‘’]", ""); hbpoSaDetail.PN = Regex.Replace(hbpoSaDetail.PN, "['‘’]", "");
hbpoSaDetail.CustomerPartCodeNoSpace = hbpoSaDetail.LU.Replace(" ", ""); hbpoSaDetail.CustomerPartCodeNoSpace = hbpoSaDetail.LU.Replace(" ", "");
hbpoSaDetail.Version = Version; hbpoSaDetail.Version = Version;
hbpoSaDetail.ExtraProperties.TryAdd("RealPN", hbpoSaDetail.PN);
}); });
return hbpoSaDetails; return hbpoSaDetails;
} }

2
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(); var pubNotSaGroupNums = pubSaDetails.FindAll(t => t.Price == default(decimal)).Select(t => t.GroupNum).Distinct();
pubSaDetailsCanSes = pubSaDetails.FindAll(t => pubNotSaGroupNums.Contains(t.GroupNum) == false); 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));
} }
//可结算明细 //可结算明细

16
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<BBAC_SE_EDI>(ediFlagErrEntities).ConfigureAwait(false); await db.BulkUpdateAsync<BBAC_SE_EDI>(ediFlagErrEntities).ConfigureAwait(false);
} }
} }
var seReturnUpdateQuery = db.Set<BBAC_SE_DETAIL>().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<BBAC_SE_DETAIL>(seReturnUpdateEntities).ConfigureAwait(false);
}
var hbpoReturnUpdateQuery = db.Set<HBPO_SE_DETAIL>().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<HBPO_SE_DETAIL>(hbpoReturnUpdateEntities).ConfigureAwait(false);
}
} }
/// <summary> /// <summary>

1
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.BusinessType = EnumBusinessType.MaiDanJianHBPO;
} }
} }
t.PartCode = t.RealPartCode;
t.CreateTime = dateTimeNow; t.CreateTime = dateTimeNow;
t.CreationTime = dateTimeNow; t.CreationTime = dateTimeNow;

12
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Bases/EntityBase.cs

@ -341,6 +341,10 @@ namespace SettleAccount.Bases
/// 生產號 /// 生產號
/// </summary> /// </summary>
public virtual string PN { get; set; } public virtual string PN { get; set; }
///// <summary>
///// 真实生產號
///// </summary>
//public virtual string RealPN { get; set; }
/// <summary> /// <summary>
/// 組合鍵值(LU+PN) /// 組合鍵值(LU+PN)
/// </summary> /// </summary>
@ -407,6 +411,10 @@ namespace SettleAccount.Bases
/// 生產號 /// 生產號
/// </summary> /// </summary>
public string PN { get; set; } public string PN { get; set; }
///// <summary>
///// 真实生產號
///// </summary>
//public virtual string RealPN { get; set; }
/// <summary> /// <summary>
/// 組合鍵值(LU+PN) /// 組合鍵值(LU+PN)
/// </summary> /// </summary>
@ -485,6 +493,10 @@ namespace SettleAccount.Bases
/// 生產號 /// 生產號
/// </summary> /// </summary>
public string PN { get; set; } public string PN { get; set; }
///// <summary>
///// 真实生產號
///// </summary>
//public virtual string RealPN { get; set; }
/// <summary> /// <summary>
/// 組合鍵值(LU+PN) /// 組合鍵值(LU+PN)
/// </summary> /// </summary>

1
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/SaSeEdiCompareDetailReport.cs

@ -169,6 +169,7 @@ namespace Win.Sfs.SettleAccount.Reports
[ValueMapping("当期数据", true)] [ValueMapping("当期数据", true)]
[ValueMapping("", false)] [ValueMapping("", false)]
public bool IsCurrent { get; set; } public bool IsCurrent { get; set; }
/// <summary> /// <summary>
/// 地点 /// 地点
/// </summary> /// </summary>

76
code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/JisBBACSaSeEdiCompareExportService.cs

@ -76,19 +76,25 @@ namespace SettleAccount.Job.Services.Report
HandleSaSeEdiCompareDiffList(saSeEdiCompareDiffs); 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 二次对比 #region 二次对比
//二次匹配上的记录 //二次匹配上的记录
var secondMatchHaveSaHaveSes = HandleSecondCompare(saSeEdiCompareDiffs, businessType); //var secondMatchHaveSaHaveSes = HandleSecondCompare(saSeEdiCompareDiffs, businessType);
if (secondMatchHaveSaHaveSes.Any()) //if (secondMatchHaveSaHaveSes.Any())
{ //{
//二次匹配 匹配上的厂内零件号、PN // //二次匹配 匹配上的厂内零件号、PN
var secondMatchFPartCodePNs = secondMatchHaveSaHaveSes.Select(t => new { t.ReplaceFactoryPartCode, t.PN }); // var secondMatchFPartCodePNs = secondMatchHaveSaHaveSes.Select(t => new { t.ReplaceFactoryPartCode, t.PN });
saSeEdiCompareDiffs.RemoveAll<SaSeEdiCompareDiff>(t => secondMatchFPartCodePNs.Contains(new { t.ReplaceFactoryPartCode, t.PN })); // saSeEdiCompareDiffs.RemoveAll<SaSeEdiCompareDiff>(t => secondMatchFPartCodePNs.Contains(new { t.ReplaceFactoryPartCode, t.PN }));
saSeEdiCompareDiffs.AddRange(secondMatchHaveSaHaveSes); // saSeEdiCompareDiffs.AddRange(secondMatchHaveSaHaveSes);
//二次对比比对上的数据入库 // //二次对比比对上的数据入库
var seCDetailEntitys = _objectMapper.Map<List<SaSeEdiCompareDiff>, List<BBAC_SEC_DETAIL>>(secondMatchHaveSaHaveSes); // var seCDetailEntitys = _objectMapper.Map<List<SaSeEdiCompareDiff>, List<BBAC_SEC_DETAIL>>(secondMatchHaveSaHaveSes);
_settleAccountDbContext.Set<BBAC_SEC_DETAIL>().AddRange(seCDetailEntitys); // _settleAccountDbContext.Set<BBAC_SEC_DETAIL>().AddRange(seCDetailEntitys);
} //}
#endregion #endregion
#region 结算数据处理 #region 结算数据处理
@ -140,8 +146,23 @@ namespace SettleAccount.Job.Services.Report
public List<SaSeEdiCompareDiff> GetEdiSeSaCompareData(int version, DateTime seStartDateTime, DateTime seEndDateTime) public List<SaSeEdiCompareDiff> GetEdiSeSaCompareData(int version, DateTime seStartDateTime, DateTime seEndDateTime)
{ {
//结算 //结算
//var saGroup = from sa in _settleAccountDbContext.Set<BBAC_SA_DETAIL>()
// 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<BBAC_SA_DETAIL>() var saGroup = from sa in _settleAccountDbContext.Set<BBAC_SA_DETAIL>()
where sa.BusinessType == businessType && sa.Version == version where sa.BusinessType == businessType
group sa by new { sa.PN, sa.CustomerPartCodeNoSpace } into groupItem group sa by new { sa.PN, sa.CustomerPartCodeNoSpace } into groupItem
select new select new
{ {
@ -156,8 +177,23 @@ namespace SettleAccount.Job.Services.Report
Price = groupItem.Max(t => t.Price), Price = groupItem.Max(t => t.Price),
}; };
//发运 //发运
//var seGroup = (from se in _settleAccountDbContext.Set<BBAC_SE_DETAIL>()
// 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<BBAC_SE_DETAIL>() var seGroup = (from se in _settleAccountDbContext.Set<BBAC_SE_DETAIL>()
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 group se by new { se.PN, se.CustomerPartCodeNoSpace } into groupItem
select new select new
{ {
@ -170,10 +206,20 @@ namespace SettleAccount.Job.Services.Report
FactoryPartCode = groupItem.Max(t => t.FactoryPartCode), FactoryPartCode = groupItem.Max(t => t.FactoryPartCode),
ToLoc = groupItem.Max(t => t.ToLoc), ToLoc = groupItem.Max(t => t.ToLoc),
ErpToLoc = groupItem.Max(t => t.ErpToLoc) ErpToLoc = groupItem.Max(t => t.ErpToLoc)
}).Where(t => t.Qty != 0M); }).Where(t => t.Qty > 0M);
//Edi //Edi
//var ediGroup = from edi in _settleAccountDbContext.Set<BBAC_SE_EDI>()
// 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<BBAC_SE_EDI>() var ediGroup = from edi in _settleAccountDbContext.Set<BBAC_SE_EDI>()
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 group edi by new { edi.PN, edi.CustomerPartCodeNoSpace } into groupItem
select new select new
{ {

75
code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/JisHBPOSaSeEdiCompareExportService.cs

@ -78,17 +78,17 @@ namespace SettleAccount.Job.Services.Report
#region 二次对比 #region 二次对比
//二次匹配上的记录 //二次匹配上的记录
var secondMatchHaveSaHaveSes = HandleSecondCompare(saSeEdiCompareDiffs, businessType); //var secondMatchHaveSaHaveSes = HandleSecondCompare(saSeEdiCompareDiffs, businessType);
if (secondMatchHaveSaHaveSes.Any()) //if (secondMatchHaveSaHaveSes.Any())
{ //{
//二次匹配 匹配上的厂内零件号、PN // //二次匹配 匹配上的厂内零件号、PN
var secondMatchFPartCodePNs = secondMatchHaveSaHaveSes.Select(t => new { t.ReplaceFactoryPartCode, t.PN }); // var secondMatchFPartCodePNs = secondMatchHaveSaHaveSes.Select(t => new { t.ReplaceFactoryPartCode, t.PN });
saSeEdiCompareDiffs.RemoveAll<SaSeEdiCompareDiff>(t => secondMatchFPartCodePNs.Contains(new { t.ReplaceFactoryPartCode, t.PN })); // saSeEdiCompareDiffs.RemoveAll<SaSeEdiCompareDiff>(t => secondMatchFPartCodePNs.Contains(new { t.ReplaceFactoryPartCode, t.PN }));
saSeEdiCompareDiffs.AddRange(secondMatchHaveSaHaveSes); // saSeEdiCompareDiffs.AddRange(secondMatchHaveSaHaveSes);
//二次对比比对上的数据入库 // //二次对比比对上的数据入库
var seCDetailEntitys = _objectMapper.Map<List<SaSeEdiCompareDiff>, List<HBPO_SEC_DETAIL>>(secondMatchHaveSaHaveSes); // var seCDetailEntitys = _objectMapper.Map<List<SaSeEdiCompareDiff>, List<HBPO_SEC_DETAIL>>(secondMatchHaveSaHaveSes);
_settleAccountDbContext.Set<HBPO_SEC_DETAIL>().AddRange(seCDetailEntitys); // _settleAccountDbContext.Set<HBPO_SEC_DETAIL>().AddRange(seCDetailEntitys);
} //}
#endregion #endregion
#region 结算数据处理 #region 结算数据处理
@ -135,8 +135,24 @@ namespace SettleAccount.Job.Services.Report
public List<SaSeEdiCompareDiff> GetSaSeEdiCompareData(int version, DateTime seStartDateTime, DateTime seEndDateTime) public List<SaSeEdiCompareDiff> GetSaSeEdiCompareData(int version, DateTime seStartDateTime, DateTime seEndDateTime)
{ {
//结算 //结算
//var saGroup = from sa in _settleAccountDbContext.Set<HBPO_SA_DETAIL>()
// 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<HBPO_SA_DETAIL>() var saGroup = from sa in _settleAccountDbContext.Set<HBPO_SA_DETAIL>()
where sa.BusinessType == businessType && sa.Version == version where sa.BusinessType == businessType
group sa by new { sa.PN, sa.CustomerPartCodeNoSpace } into groupItem group sa by new { sa.PN, sa.CustomerPartCodeNoSpace } into groupItem
select new select new
{ {
@ -150,9 +166,26 @@ namespace SettleAccount.Job.Services.Report
Site = groupItem.Max(t => t.Site), Site = groupItem.Max(t => t.Site),
Price = groupItem.Max(t => t.Price) Price = groupItem.Max(t => t.Price)
}; };
//发运 //发运
//var seGroup = (from se in _settleAccountDbContext.Set<HBPO_SE_DETAIL>()
// 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<HBPO_SE_DETAIL>() var seGroup = (from se in _settleAccountDbContext.Set<HBPO_SE_DETAIL>()
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 group se by new { se.PN, se.CustomerPartCodeNoSpace } into groupItem
select new select new
{ {
@ -165,10 +198,21 @@ namespace SettleAccount.Job.Services.Report
FactoryPartCode = groupItem.Max(t => t.FactoryPartCode), FactoryPartCode = groupItem.Max(t => t.FactoryPartCode),
ToLoc = groupItem.Max(t => t.ToLoc), ToLoc = groupItem.Max(t => t.ToLoc),
ErpToLoc = groupItem.Max(t => t.ErpToLoc) ErpToLoc = groupItem.Max(t => t.ErpToLoc)
}).Where(t => t.Qty != 0M); }).Where(t => t.Qty > 0M);
//Edi //Edi
//var ediGroup = from edi in _settleAccountDbContext.Set<HBPO_SE_EDI>()
// 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<HBPO_SE_EDI>() var ediGroup = from edi in _settleAccountDbContext.Set<HBPO_SE_EDI>()
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 group edi by new { edi.PN, edi.CustomerPartCodeNoSpace } into groupItem
select new select new
{ {
@ -177,6 +221,7 @@ namespace SettleAccount.Job.Services.Report
Qty = groupItem.Sum(t => t.Qty), Qty = groupItem.Sum(t => t.Qty),
LU = groupItem.Max(t => t.LU) LU = groupItem.Max(t => t.LU)
}; };
var seEdiGroup = from se in seGroup var seEdiGroup = from se in seGroup
join edi in ediGroup join edi in ediGroup
on new { se.PN, se.CustomerPartCodeNoSpace } equals new { edi.PN, edi.CustomerPartCodeNoSpace } on new { se.PN, se.CustomerPartCodeNoSpace } equals new { edi.PN, edi.CustomerPartCodeNoSpace }

68
code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/SaSeEdiCompareExportBaseService.cs

@ -1,3 +1,4 @@
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using EFCore.BulkExtensions; using EFCore.BulkExtensions;
@ -259,11 +260,15 @@ namespace SettleAccount.Job.Services.Report
SEQty = p.Sum(t => t.SEQty), SEQty = p.Sum(t => t.SEQty),
EdiQty = p.Sum(t => t.EdiQty) EdiQty = p.Sum(t => t.EdiQty)
}).ToList(); }).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 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, FactoryPartCode = p.Key,
PartCodeDesc = p.FirstOrDefault().PartCodeDesc, PartCodeDesc = p.FirstOrDefault().PartCodeDesc,
@ -295,26 +300,33 @@ namespace SettleAccount.Job.Services.Report
}).ToList(); }).ToList();
var excelExporter = new ExcelExporter(); var excelExporter = new ExcelExporter();
//结算核对明细输出 //有结算无发运
excelExporter.Append(saSeEdiCompareDetailExports.Take(detailMaxRowNumberOnASheet).ToList(), $"{businessTypeDisplayName}结算核对明细输出"); excelExporter.Append(haveSaNotHaveSeExport.Take(detailMaxRowNumberOnASheet).ToList(), $"{businessTypeDisplayName}有结算无发运");
for (var i = 1; i < saSeEdiCompareDetailExports.Count / detailMaxRowNumberOnASheet + ((saSeEdiCompareDetailExports.Count % detailMaxRowNumberOnASheet) > 0 ? 1 : 0); i++) for (var i = 1; i < haveSaNotHaveSeExport.Count / detailMaxRowNumberOnASheet + ((haveSaNotHaveSeExport.Count % detailMaxRowNumberOnASheet) > 0 ? 1 : 0); i++)
{ {
var sheetDataItems = saSeEdiCompareDetailExports.Skip(i * detailMaxRowNumberOnASheet).Take(detailMaxRowNumberOnASheet).ToList(); var sheetDataItems = haveSaNotHaveSeExport.Skip(i * detailMaxRowNumberOnASheet).Take(detailMaxRowNumberOnASheet).ToList();
excelExporter.Append(sheetDataItems, $"{businessTypeDisplayName}结算核对明细输出-{i}"); excelExporter.Append(sheetDataItems, $"{businessTypeDisplayName}有结算无发运-{i}");
} }
//结算核对汇总输出 //无结算有发运
excelExporter.Append(saSeEdiCompareSumExports.Take(sumMaxRowNumberOnASheet).ToList(), $"{businessTypeDisplayName}结算核对汇总输出"); excelExporter.Append(notHaveSaHaveSeExports.Take(detailMaxRowNumberOnASheet).ToList(), $"{businessTypeDisplayName}无结算有发运");
for (var i = 1; i < saSeEdiCompareSumExports.Count / sumMaxRowNumberOnASheet + ((saSeEdiCompareSumExports.Count % sumMaxRowNumberOnASheet) > 0 ? 1 : 0); i++) for (var i = 1; i < notHaveSaHaveSeExports.Count / detailMaxRowNumberOnASheet + ((notHaveSaHaveSeExports.Count % detailMaxRowNumberOnASheet) > 0 ? 1 : 0); i++)
{ {
var sheetDataItems = saSeEdiCompareSumExports.Skip(i * sumMaxRowNumberOnASheet).Take(sumMaxRowNumberOnASheet).ToList(); ; var sheetDataItems = notHaveSaHaveSeExports.Skip(i * detailMaxRowNumberOnASheet).Take(detailMaxRowNumberOnASheet).ToList();
excelExporter.Append(sheetDataItems, $"{businessTypeDisplayName}结算核对汇总输出-{i}"); 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}有结算有发货明细输出"); excelExporter.Append(haveSaHaveSeExport.Take(detailMaxRowNumberOnASheet).ToList(), $"{businessTypeDisplayName}有结算有发货明细输出");
for (var i = 1; i < haveSaHaveSeExports.Count / detailMaxRowNumberOnASheet + ((haveSaHaveSeExports.Count % detailMaxRowNumberOnASheet) > 0 ? 1 : 0); i++) 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}"); excelExporter.Append(sheetDataItems, $"{businessTypeDisplayName}有结算有发货明细输出-{i}");
} }
//有结算有发货汇总输出 //有结算有发货汇总输出
@ -325,20 +337,20 @@ namespace SettleAccount.Job.Services.Report
excelExporter.Append(sheetDataItems, $"{businessTypeDisplayName}有结算有发货汇总输出-{i}"); excelExporter.Append(sheetDataItems, $"{businessTypeDisplayName}有结算有发货汇总输出-{i}");
} }
//有结算有发货明细输出 ////有结算无发货明细输出
excelExporter.Append(haveSaNotHaveSeExports.Take(detailMaxRowNumberOnASheet).ToList(), $"{businessTypeDisplayName}有结算无发货明细输出"); //excelExporter.Append(haveSaNotHaveSeExports.Take(detailMaxRowNumberOnASheet).ToList(), $"{businessTypeDisplayName}有结算无发货明细输出");
for (var i = 1; i < haveSaNotHaveSeExports.Count / detailMaxRowNumberOnASheet + ((haveSaNotHaveSeExports.Count % detailMaxRowNumberOnASheet) > 0 ? 1 : 0); i++) //for (var i = 1; i < haveSaNotHaveSeExports.Count / detailMaxRowNumberOnASheet + ((haveSaNotHaveSeExports.Count % detailMaxRowNumberOnASheet) > 0 ? 1 : 0); i++)
{ //{
var sheetDataItems = haveSaNotHaveSeExports.Skip(i * detailMaxRowNumberOnASheet).Take(detailMaxRowNumberOnASheet).ToList(); // var sheetDataItems = haveSaNotHaveSeExports.Skip(i * detailMaxRowNumberOnASheet).Take(detailMaxRowNumberOnASheet).ToList();
excelExporter.Append(sheetDataItems, $"{businessTypeDisplayName}有结算无发货明细输出-{i}"); // excelExporter.Append(sheetDataItems, $"{businessTypeDisplayName}有结算无发货明细输出-{i}");
} //}
//有结算有发货汇总输出 ////有结算无发货汇总输出
excelExporter.Append(haveSaNotHaveSeSumExports.Take(sumMaxRowNumberOnASheet).ToList(), $"{businessTypeDisplayName}有结算无发货汇总输出"); //excelExporter.Append(haveSaNotHaveSeSumExports.Take(sumMaxRowNumberOnASheet).ToList(), $"{businessTypeDisplayName}有结算无发货汇总输出");
for (var i = 1; i < haveSaNotHaveSeSumExports.Count / sumMaxRowNumberOnASheet + ((haveSaNotHaveSeSumExports.Count % sumMaxRowNumberOnASheet) > 0 ? 1 : 0); i++) //for (var i = 1; i < haveSaNotHaveSeSumExports.Count / sumMaxRowNumberOnASheet + ((haveSaNotHaveSeSumExports.Count % sumMaxRowNumberOnASheet) > 0 ? 1 : 0); i++)
{ //{
var sheetDataItems = haveSaNotHaveSeSumExports.Skip(i * sumMaxRowNumberOnASheet).Take(sumMaxRowNumberOnASheet).ToList(); // var sheetDataItems = haveSaNotHaveSeSumExports.Skip(i * sumMaxRowNumberOnASheet).Take(sumMaxRowNumberOnASheet).ToList();
excelExporter.Append(sheetDataItems, $"{businessTypeDisplayName}有结算无发货汇总输出-{i}"); // excelExporter.Append(sheetDataItems, $"{businessTypeDisplayName}有结算无发货汇总输出-{i}");
} //}
return excelExporter; return excelExporter;
} }

5
code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/SeEdiCompareExportBaseService.cs

@ -97,10 +97,11 @@ namespace SettleAccount.Job.Services.Report
//无EDI有发运 //无EDI有发运
var notHaveEdiHaveSeList = _settleAccountDbContext.Set<TSe>() var notHaveEdiHaveSeList = _settleAccountDbContext.Set<TSe>()
.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=>t.State==0)
.Where(t => proType.Contains(t.ProType)) .Where(t => proType.Contains(t.ProType))
.Where(t => t.IsHaveEdiData == false) .Where(t => t.IsHaveEdiData == false)
.Where(t => t.IsDeleted == false)
.GroupBy(t => new { t.PN, t.CustomerPartCodeNoSpace }) .GroupBy(t => new { t.PN, t.CustomerPartCodeNoSpace })
.Select(t => new TCompareReport() .Select(t => new TCompareReport()
{ {
@ -135,7 +136,7 @@ namespace SettleAccount.Job.Services.Report
LineStationCode = groupItem.Max(t => t.LineStationCode) LineStationCode = groupItem.Max(t => t.LineStationCode)
}; };
var seGroup = from se in _settleAccountDbContext.Set<TSe>() var seGroup = from se in _settleAccountDbContext.Set<TSe>()
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 group se by new { se.PN, se.CustomerPartCodeNoSpace } into groupItem
select new select new
{ {

Loading…
Cancel
Save