wanggang 1 year ago
parent
commit
ec20482b2f
  1. 57
      code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/INVOICE_GRP_DTO.cs
  2. 4
      code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/PUB_ADJ_DETAIL_DTO.cs
  3. 82
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Bases/BA_SERVICE.cs
  4. 4
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/HBPO_CAN_SA_SERVICE.cs
  5. 81
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/INVOICE_SERVICE.cs
  6. 97
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_SE_DETAIL_SERVICE.cs
  7. 2
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/JisHBPOSeEdiCompareAppService.cs
  8. 75
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/PendingDeductionService.cs
  9. 5
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/INV_MNG.cs
  10. 4
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Vmi/VmiBalanceBase.cs
  11. 2
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/JisBBACEidSeCompareReport.cs
  12. 5
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/SaSeEdiCompareDiff.cs
  13. 21
      code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/JisBBACSeEdiCompareExportService.cs
  14. 90
      code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/SaSeEdiCompareExportBaseService.cs

57
code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/INVOICE_GRP_DTO.cs

@ -231,6 +231,9 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Dtos
/// </summary>
public List<PUB_ADJ_DETAIL_DTO> ADJ_DETAIL { get; set; }
}
public class INVOICE_WAIT_DETAIL_DTO
@ -242,6 +245,14 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Dtos
/// </summary>
[Display(Name = "期间")]
public int Version { get; set; }
[Display(Name = "金税发票号")]
public string RealInvbillNum { get; set; }
[Display(Name = "发票日期")]
public DateTime? InvDate { set; get; }
/// <summary>
///发票号
/// </summary>
@ -264,8 +275,6 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Dtos
[Display(Name = "零件号")]
public string PartCode { get; set; }
/// <summary>
///单价
/// </summary>
@ -314,6 +323,9 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Dtos
}
public class INVOICE_WAIT_DETAIL_REQ_DTO : RequestInputBase
{
[Display(Name = "金税发票")]
public string RealInvBillNum { get; set; }
[Display(Name = "发票号")]
public string InvbillNum { get; set; }
[Display(Name = "发票分组号")]
@ -327,11 +339,14 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Dtos
{
/// <summary>
///期间
/// </summary>
[Display(Name = "期间")]
public int Version { get; set; }
[Display(Name = "金税发票")]
public string RealInvBillNum { get; set; }
[Display(Name = "发票日期")]
public DateTime? InvDate { set; get; }
/// <summary>
///发票号
/// </summary>
@ -420,6 +435,11 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Dtos
public class INVOICE_NOT_SETTLE_DTO
{
[Display(Name = "金税发票")]
public string RealInvBillNum { get; set; }
[Display(Name = "发票日期")]
public DateTime? InvDate { set; get; }
[Display(Name = "发票号")]
public string InvBillNum { get; set; }
@ -438,6 +458,9 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Dtos
/// </summary>
[Display(Name = "零件号")]
public string LU { get; set; }
[Display(Name = "数量")]
public string Qty { get; set; }
/// <summary>
///不可结算零件号
/// </summary>
@ -445,26 +468,6 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Dtos
public string Extend1 { get; set; }
//[Display(Name = "不可结算零件号")]
//public string LU1 { get; set; }
///// <summary>
/////扩展字段1
///// </summary>
//[Display(Name = "扩展字段1")]
//public string Extend1 { get; set; }
///// <summary>
/////扩展字段2
///// </summary>
//[Display(Name = "扩展字段2")]
//public string Extend2 { get; set; }
[Display(Name = "不可结算零件号",AutoGenerateField =false)]
public Dictionary<string, object> ExtraProperties { get; set; }
}

4
code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/PUB_ADJ_DETAIL_DTO.cs

@ -14,6 +14,10 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Dtos;
public class PUB_ADJ_DETAIL_DTO : EntityDto<Guid>
{
[Display(Name = "金税发票")]
public string RealInvBillNum { get; set; }
///// <summary>
/////作废发票号
///// </summary>

82
code/src/Modules/SettleAccount/src/SettleAccount.Application/Bases/BA_SERVICE.cs

@ -1,6 +1,7 @@
using CodeArts.Db.Lts;
using DocumentFormat.OpenXml.Bibliography;
using DocumentFormat.OpenXml.Drawing.Charts;
using DocumentFormat.OpenXml.Wordprocessing;
using EFCore.BulkExtensions;
using Magicodes.ExporterAndImporter.Core;
using Magicodes.ExporterAndImporter.Csv;
@ -147,18 +148,91 @@ namespace Win.Sfs.SettleAccount.Bases
{
INVOICE_GRP_DETAIL_DTO entity = new INVOICE_GRP_DETAIL_DTO();
var invs = await _repository.GetListByFilterAsync(input.Filters, input.Sorting, int.MaxValue, input.SkipCount);
var m = await _mRepository.GetListByFilterAsync(input.Filters, input.Sorting, int.MaxValue, input.SkipCount);
var mdtos = ObjectMapper.Map<List<INVOICE_MAP_GROUP>, List<INVOICE_MAP_GROUP_DTO>>(m);
var w = await _wRepository.GetListByFilterAsync(input.Filters, input.Sorting, int.MaxValue, input.SkipCount);
var wdtos = ObjectMapper.Map<List<INVOICE_WAIT_DETAIL>, List<INVOICE_WAIT_DETAIL_DTO>>(w);
var s = await _sRepository.GetListByFilterAsync(input.Filters, input.Sorting, int.MaxValue, input.SkipCount);
var sdtos = ObjectMapper.Map<List<INVOICE_NOT_SETTLE>, List<INVOICE_NOT_SETTLE_DTO>>(s);
var notquery = from itm in sdtos
join itm1 in invs on itm.InvBillNum equals itm1.InvbillNum
select
new INVOICE_NOT_SETTLE_DTO()
{
InvDate = itm1.CreationTime,
RealInvBillNum = string.IsNullOrEmpty(itm1.RealnvBillNum) ? string.Empty : itm1.RealnvBillNum,
InvBillNum = itm.InvBillNum,
InvGroupNum = itm.InvGroupNum,
SettleGroupNum = itm.SettleGroupNum,
LU = itm.LU,
Qty = itm.Qty,
Extend1 = itm.Extend1,
};
var wquery = from itm in wdtos
join itm1 in invs on itm.InvbillNum equals itm1.InvbillNum
select
new INVOICE_WAIT_DETAIL_DTO()
{
InvDate = itm1.CreationTime,
RealInvbillNum = string.IsNullOrEmpty(itm1.RealnvBillNum) ? string.Empty : itm1.RealnvBillNum,
Version = itm.Version,
InvbillNum = itm.InvbillNum,
InvGroupNum = itm.InvGroupNum,
LU = itm.LU,
PartCode = itm.PartCode,
PRICE = itm.PRICE,
Qty = itm.Qty,
Amt = itm.Amt,
BussiessType = itm.BussiessType,
Extend1 = itm.Extend1,
BeginDate = itm.BeginDate,
EndDate = itm.EndDate,
};
var mquery = from itm in mdtos
join itm1 in invs on itm.InvbillNum equals itm1.InvbillNum
select
new INVOICE_MAP_GROUP_DTO()
{
InvDate = itm1.CreationTime,
RealInvBillNum = string.IsNullOrEmpty(itm1.RealnvBillNum) ? string.Empty : itm1.RealnvBillNum,
InvbillNum = itm.InvbillNum,
InvGroupNum = itm.InvGroupNum,
SettleGroupNum = itm.SettleGroupNum
};
var adjs = await _adjRepository.GetListByFilterAsync(input.Filters);
var adjdtos = ObjectMapper.Map<List<PUB_ADJ_DETAIL>, List<PUB_ADJ_DETAIL_DTO>>(adjs);
entity.INVOICE_NOT_SETTLE = sdtos;
entity.INVOICE_WAIT_DETAIL = wdtos;
entity.INVOICE_MAP_GROUP = mdtos;
entity.ADJ_DETAIL = adjdtos;
var adjQuery = from itm in adjdtos
join itm1 in invs on itm.InvBillNum equals itm1.InvbillNum
select
new PUB_ADJ_DETAIL_DTO()
{
RealInvBillNum = string.IsNullOrEmpty(itm1.RealnvBillNum) ? string.Empty : itm1.RealnvBillNum,
InvBillNum = itm.InvBillNum,
SettleDate = itm.SettleDate,
LU = itm.LU,
PN = itm.PN,
Qty = itm.Qty,
GroupNum = itm.GroupNum,
KeyCode = itm.KeyCode,
Price = itm.Price
};
entity.INVOICE_NOT_SETTLE = notquery.ToList();
entity.INVOICE_WAIT_DETAIL = wquery.ToList();
entity.INVOICE_MAP_GROUP = mquery.ToList();
entity.ADJ_DETAIL = adjQuery.ToList();
return entity;
}
/// <summary>

4
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/HBPO_CAN_SA_SERVICE.cs

@ -77,17 +77,13 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
//[Route("generateinvoice")]
public async override Task<IActionResult> GenerateInvoice([FromBody] string invbillnum)
{
var main =await _hbpoMng.GetMainAsync(invbillnum);
if (main != null)
{
if (main.State != SettleBillState.)
{
return new JsonResult(new { Code = 400, Message = "已创建发票不能重复创建" });
}
if (await _hbpoMng.SetForwardState(main, SettleBillState.))
{
var entitys = await _hbpoMng.GetDetalListAsync(invbillnum);

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

@ -20,6 +20,7 @@ using System.Text;
using System.Threading.Tasks;
using Volo.Abp.Application.Dtos;
using Volo.Abp.Application.Services;
using Volo.Abp.Domain.Entities;
using Volo.Abp.Uow;
using Win.Abp.Snowflakes;
using Win.Sfs.BaseData.ImportExcelCommon;
@ -138,7 +139,12 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
public virtual async Task<INVOICE_GRP_DETAIL_DTO> DetailQueryAsync(INVOICE_GRP_REQ_DTO input)
{
INVOICE_GRP_DETAIL_DTO _entity = new INVOICE_GRP_DETAIL_DTO();
INVOICE_GRP_DETAIL_DTO entity = new INVOICE_GRP_DETAIL_DTO();
var invs = await _repository.GetListByFilterAsync(input.Filters, input.Sorting, int.MaxValue, input.SkipCount);
var m = await _mRepository.GetListByFilterAsync(input.Filters, input.Sorting, int.MaxValue, input.SkipCount);
var mdtos = ObjectMapper.Map<List<INVOICE_MAP_GROUP>, List<INVOICE_MAP_GROUP_DTO>>(m);
var w = await _wRepository.GetListByFilterAsync(input.Filters, input.Sorting, int.MaxValue, input.SkipCount);
@ -147,11 +153,74 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
var sdtos = ObjectMapper.Map<List<INVOICE_NOT_SETTLE>, List<INVOICE_NOT_SETTLE_DTO>>(s);
var adjs =await _adjRepository.GetListByFilterAsync(input.Filters);
var adjdtos = ObjectMapper.Map<List<PUB_ADJ_DETAIL>, List<PUB_ADJ_DETAIL_DTO>>(adjs);
_entity.INVOICE_NOT_SETTLE = sdtos;
_entity.INVOICE_WAIT_DETAIL = wdtos;
_entity.INVOICE_MAP_GROUP = mdtos;
_entity.ADJ_DETAIL = adjdtos;
return _entity;
var notquery = from itm in sdtos
join itm1 in invs on itm.InvBillNum equals itm1.InvbillNum
select
new INVOICE_NOT_SETTLE_DTO()
{
InvDate = itm1.CreationTime,
RealInvBillNum = string.IsNullOrEmpty(itm1.RealnvBillNum) ? string.Empty : itm1.RealnvBillNum,
InvBillNum = itm.InvBillNum,
InvGroupNum = itm.InvGroupNum,
SettleGroupNum = itm.SettleGroupNum,
LU = itm.LU,
Qty = itm.Qty,
Extend1 = itm.Extend1,
};
var wquery = from itm in wdtos
join itm1 in invs on itm.InvbillNum equals itm1.InvbillNum
select
new INVOICE_WAIT_DETAIL_DTO()
{
InvDate = itm1.CreationTime,
RealInvbillNum = string.IsNullOrEmpty(itm1.RealnvBillNum) ? string.Empty : itm1.RealnvBillNum,
Version = itm.Version,
InvbillNum = itm.InvbillNum,
InvGroupNum = itm.InvGroupNum,
LU = itm.LU,
PartCode = itm.PartCode,
PRICE = itm.PRICE,
Qty = itm.Qty,
Amt = itm.Amt,
BussiessType = itm.BussiessType,
Extend1 = itm.Extend1,
BeginDate = itm.BeginDate,
EndDate = itm.EndDate,
};
var mquery = from itm in mdtos
join itm1 in invs on itm.InvbillNum equals itm1.InvbillNum
select
new INVOICE_MAP_GROUP_DTO()
{
InvDate = itm1.CreationTime,
RealInvBillNum = string.IsNullOrEmpty(itm1.RealnvBillNum) ? string.Empty : itm1.RealnvBillNum,
InvbillNum = itm.InvbillNum,
InvGroupNum = itm.InvGroupNum,
SettleGroupNum = itm.SettleGroupNum
};
var adjQuery = from itm in adjdtos
join itm1 in invs on itm.InvBillNum equals itm1.InvbillNum
select
new PUB_ADJ_DETAIL_DTO()
{
RealInvBillNum = string.IsNullOrEmpty(itm1.RealnvBillNum) ? string.Empty : itm1.RealnvBillNum,
InvBillNum = itm.InvBillNum,
SettleDate = itm.SettleDate,
LU = itm.LU,
PN = itm.PN,
Qty = itm.Qty,
GroupNum = itm.GroupNum,
KeyCode = itm.KeyCode,
Price = itm.Price
};
entity.INVOICE_NOT_SETTLE = notquery.ToList();
entity.INVOICE_WAIT_DETAIL = wquery.ToList();
entity.INVOICE_MAP_GROUP = mquery.ToList();
entity.ADJ_DETAIL = adjQuery.ToList();
return entity;
}

97
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_SE_DETAIL_SERVICE.cs

@ -1,6 +1,13 @@
using Castle.Core.Internal;
using DocumentFormat.OpenXml.Office2010.Excel;
using DocumentFormat.OpenXml.Spreadsheet;
using Magicodes.ExporterAndImporter.Core;
using Magicodes.ExporterAndImporter.Excel;
using Magicodes.ExporterAndImporter.Excel.Utility;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.OpenApi.Extensions;
using NPOI.HPSF;
using SettleAccount.Domain.BQ;
using Shouldly;
using SqlSugar;
@ -8,12 +15,15 @@ using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Security.Cryptography;
using System.Threading.Tasks;
using Volo.Abp.Application.Dtos;
using Volo.Abp.Application.Services;
using Volo.Abp.BlobStoring;
using Win.Sfs.BaseData.ImportExcelCommon;
using Win.Sfs.SettleAccount.Entities.BQ.Dtos;
using Win.Sfs.SettleAccount.ExcelImporter;
using Win.Sfs.SettleAccount.Reports;
using Win.Sfs.Shared.Filter;
using Win.Sfs.Shared.RepositoryBase;
namespace Win.Sfs.SettleAccount.Entities.BQ
@ -34,14 +44,19 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
/// excel服务
/// </summary>
private readonly IExcelImportAppService _excelImportService;
/// <summary>
/// 文件容器
/// </summary>
private readonly IBlobContainer<MyFileContainer> _fileContainer;
/// <summary>
/// 构造
/// </summary>
public PUB_SE_DETAIL_SERVICE(INormalEfCoreRepository<PUB_SE_DETAIL, Guid> repository, IExcelImportAppService excelImportService)
public PUB_SE_DETAIL_SERVICE(INormalEfCoreRepository<PUB_SE_DETAIL, Guid> repository, IExcelImportAppService excelImportService, IBlobContainer<MyFileContainer> fileContainer)
{
_repository = repository;
_excelImportService = excelImportService;
_fileContainer = fileContainer;
}
#region 导出
@ -70,6 +85,86 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
await _excelImportService.SaveBlobAsync(new SaveExcelImportInputDto { Name = fileName, Content = result }).ConfigureAwait(false);
return fileName;
}
[HttpGet]
public async Task<string> TextExportAsync()
{
var fileName = $"发运数据_{Guid.NewGuid()}.xlsx";
var haveEdiHaveSeList = new List<JisBBACEidSeCompareExport>();
for (int i = 0; i < 2_000_000; i++)
{
haveEdiHaveSeList.Add(new JisBBACEidSeCompareExport()
{
Category = "JIS",
WmsBillNum = i.ToString(),
CarModeCode = i.ToString(),
LineStationcode = i.ToString(),
SequenceNumber = i.ToString(),
ParType = i.ToString(),
MESConfigCode = i.ToString(),
ShippingDate = DateTime.Now,
PN = i.ToString(),
Seq = i.ToString(),
PjsNum = i.ToString(),
MaterialNumber = i.ToString(),
MaterialDes = i.ToString(),
SEQty = 1,
EdiQty = 1,
AssemblyDate = DateTime.Now,
MatchNumber = i.ToString(),
InjectionCode = i.ToString(),
MateType = "是",
DiffDesc = "WMS有发货EDI有订单"
});
}
var jisBBACEidSeCompareEexcelExporterAttribute = typeof(JisBBACEidSeCompareExport).GetAttribute<ExcelExporterAttribute>();
var jisBBACEidSeCompareEexcelMaxRowNumberOnASheet = 9_000_000;
if (jisBBACEidSeCompareEexcelExporterAttribute != null)
{
jisBBACEidSeCompareEexcelMaxRowNumberOnASheet = jisBBACEidSeCompareEexcelExporterAttribute.MaxRowNumberOnASheet > 0 ? jisBBACEidSeCompareEexcelExporterAttribute.MaxRowNumberOnASheet : jisBBACEidSeCompareEexcelMaxRowNumberOnASheet;
}
ExcelExporter excelExporter = new ExcelExporter();
excelExporter.Append(haveEdiHaveSeList.Take(jisBBACEidSeCompareEexcelMaxRowNumberOnASheet).ToList(), $"BBACEDI数据和发货对比");
var ediSheetCount = (int)(haveEdiHaveSeList.Count / jisBBACEidSeCompareEexcelMaxRowNumberOnASheet) + ((haveEdiHaveSeList.Count % jisBBACEidSeCompareEexcelMaxRowNumberOnASheet) > 0 ? 1 : 0);
if (ediSheetCount > 1)
{
for (int i = 1; i < ediSheetCount; i++)
{
var sheetDataItems = haveEdiHaveSeList.Skip(i * jisBBACEidSeCompareEexcelMaxRowNumberOnASheet)
.Take(jisBBACEidSeCompareEexcelMaxRowNumberOnASheet).ToList();
excelExporter.SeparateBySheet();
excelExporter.Append(sheetDataItems, $"BBACEDI数据和发货对比-{i}");
}
}
excelExporter.Append(haveEdiHaveSeList.Take(jisBBACEidSeCompareEexcelMaxRowNumberOnASheet).ToList(), $"BBAC发货和EDI数据对比");
var seSheetCount = (int)(haveEdiHaveSeList.Count / jisBBACEidSeCompareEexcelMaxRowNumberOnASheet) + ((haveEdiHaveSeList.Count % jisBBACEidSeCompareEexcelMaxRowNumberOnASheet) > 0 ? 1 : 0);
if (seSheetCount > 1)
{
for (int i = 1; i < seSheetCount; i++)
{
var sheetDataItems = haveEdiHaveSeList.Skip(i * jisBBACEidSeCompareEexcelMaxRowNumberOnASheet)
.Take(jisBBACEidSeCompareEexcelMaxRowNumberOnASheet).ToList();
excelExporter.SeparateBySheet();
excelExporter.Append(sheetDataItems, $"BBAC发货和EDI数据对比-{i}");
}
}
//excelExporter
// .Append(haveEdiHaveSeList, $"BBACEDI数据和发货对比");
//.SeparateBySheet()
////.Append(haveEdiHaveSeList, $"BBAC发货和EDI数据对比");
var result = excelExporter.ExportAppendDataAsByteArray();
await result.ShouldNotBeNull().ConfigureAwait(false);
await _fileContainer.SaveAsync(fileName, result.Result, true).ConfigureAwait(false);
return fileName;
}
#endregion
#region 查询

2
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/JisHBPOSeEdiCompareAppService.cs

@ -92,8 +92,6 @@ public class JisHBPOSeEdiCompareAppService : ApplicationService, IInvocable
ediDetails.ForEach(t => t.IsHaveSeData = true);
db.BulkUpdate<HBPO_SE_EDI>(ediDetails);
}
await uow.SaveChangesAsync().ConfigureAwait(false);
//db.SaveChanges();
}
}
catch (Exception)

75
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/PendingDeductionService.cs

@ -36,7 +36,7 @@ public class PendingDeductionService : ApplicationService, ITransientDependency,
_dbcontext = dbcontext;
}
[UnitOfWork(false)]
public string ExportFile(Guid id, List<string> exportName, List<CustomCondition> property)
{
@ -48,22 +48,35 @@ public class PendingDeductionService : ApplicationService, ITransientDependency,
if (type == "JisBBAC")
{
var jisdetail = _dbcontext.Set<BBAC_PD_DETAIL>().Where(p => list.Contains(p.BillNum) && p.BusinessType == EnumBusinessType.JisBBAC);//jis
Sync(jisdetail.ToList(),isout=="out"?true:false);
Sync(jisdetail.ToList(), EnumDeliverBjBmpBillType.JIS件, isout=="out"?true:false);
var mdetail = _dbcontext.Set<BBAC_PD_DETAIL>().Where(p => list.Contains(p.BillNum) && p.BusinessType == EnumBusinessType.MaiDanJianBBAC);//买单件
Sync(mdetail.ToList(), isout == "out" ? true : false);
Sync(mdetail.ToList(), EnumDeliverBjBmpBillType.JIS件, isout == "out" ? true : false);
}
else if (type == "JisHBPO")
{
var detailist = _dbcontext.Set<HBPO_PD_DETAIL>().Where(p => list.Contains(p.BillNum) && p.BusinessType== EnumBusinessType.JisHBPO).ToList();
Sync(detailist, isout == "out" ? true : false);
Sync(detailist, EnumDeliverBjBmpBillType.JIS件, isout == "out" ? true : false);
var mdetail = _dbcontext.Set<HBPO_PD_DETAIL>().Where(p => list.Contains(p.BillNum) && p.BusinessType == EnumBusinessType.MaiDanJianHBPO);//买单件
Sync(mdetail.ToList(),isout == "out" ? true : false);
Sync(mdetail.ToList(), EnumDeliverBjBmpBillType.JIS件, isout == "out" ? true : false);
}
else
else
{
var detailist = _dbcontext.Set<PUB_PD_DETAIL>().Where(p => list.Contains(p.BillNum)).ToList();
Sync(detailist, isout == "out" ? true : false);
var detailist = _dbcontext.Set<PUB_PD_DETAIL>().Where(p => list.Contains(p.BillNum) ).ToList();
var bjlist= detailist.Where(p => p.BusinessType == EnumBusinessType.BeiJian).ToList();
if (bjlist.Count > 0)
{
Sync(detailist, EnumDeliverBjBmpBillType.4S备件, isout == "out" ? true : false);
}
var ydlist = detailist.Where(p => p.BusinessType == EnumBusinessType.YinDuJian).ToList();
if (ydlist.Count > 0)
{
Sync(detailist, EnumDeliverBjBmpBillType., isout == "out" ? true : false);
}
var zglist = detailist.Where(p => p.BusinessType == EnumBusinessType.ZhiGongJianBBAC || p.BusinessType == EnumBusinessType.ZhiGongJianBBAC).ToList();
if (zglist.Count > 0)
{
Sync(detailist, EnumDeliverBjBmpBillType.JIT直供件, isout == "out" ? true : false);
}
}
return id.ToString();
}
@ -83,19 +96,18 @@ public class PendingDeductionService : ApplicationService, ITransientDependency,
return pageCount;
}
public void Sync<T>(List<T> p_ls,bool flag=true) where T : PD_BASE,new()
public void Sync<T>(List<T> p_ls, EnumDeliverBjBmpBillType bussinessType, bool flag=true) where T : PD_BASE,new()
{
var query = from itm in p_ls
select new VmiLog()
{
{
CodeType=string.Empty,
BillTime = DateTime.Now,
ChangedTime = DateTime.Now,
Qty = itm.Qty,
RealPartCode=itm.RELU,
RealPartCode=itm.RELU,//替换件 结算数据 RealPartCode->RELU
RealCode=itm.RELU,
LogType = Entities.BQ.Vmi.VmiLogType.Type200,
ChangedQty =(flag==true)? -itm.Qty:itm.Qty,
ChangedType = VmiType.Out,
@ -103,26 +115,15 @@ public class PendingDeductionService : ApplicationService, ITransientDependency,
//BillType = EnumDeliverBjBmpBillType.JIS件,
CustPartCode = itm.LU,
SettlementVinCode = itm.PN,
DeliverBillType=bussinessType,
VinCode = itm.PN,
OrderNum = itm.GroupNum,
ErpToLoc = string.IsNullOrEmpty(itm.Extend2)?string.Empty:itm.Extend2,
ErpToLoc = string.IsNullOrEmpty(itm.Extend2)?"CC001":itm.Extend2, //寄售库
};
var ls = query.ToList();
var _first= p_ls.FirstOrDefault();
using (var transaction =_dbcontext.Database.BeginTransaction())
{
try
{
// 执行批量数据操作
@ -135,13 +136,12 @@ public class PendingDeductionService : ApplicationService, ITransientDependency,
foreach (var item in ls)
{
item.SetId(GuidGenerator.Create());
}
_dbcontext.BulkInsert(ls);
Task.Delay(500);
}
}
// 提交事务
transaction.Commit();
}
@ -152,21 +152,6 @@ public class PendingDeductionService : ApplicationService, ITransientDependency,
throw;
}
}
;
}

5
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/INV_MNG.cs

@ -1444,6 +1444,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
clientCode: string.Empty,
realAmt: 0
);
invbill.CreationTime = DateTime.Now;
invlist.Add(invbill);
}
@ -1453,7 +1454,6 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
await _repository.DbContext.BulkUpdateAsync(salist,new BulkConfig() { BatchSize=10000 });
}
await _repository.DbContext.BulkInsertAsync(invlist);
await _repository.DbContext.BulkInsertAsync(groupList);
await _repository.DbContext.BulkInsertAsync(detailList);
@ -1686,6 +1686,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
realAmt:0
);
invbill.CreationTime = DateTime.Now;
invlist.Add(invbill);
}
await _repository.DbContext.BulkInsertAsync(invlist);
@ -1909,6 +1910,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
clientCode: string.Empty,
realAmt: 0
);
invbill.CreationTime = DateTime.Now;
invlist.Add(invbill);
}
await _repository.DbContext.BulkInsertAsync(invlist);
@ -2233,6 +2235,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
clientCode: string.Empty,
realAmt: 0
);
invbill.CreationTime = DateTime.Now;
invlist.Add(invbill);
}
await _repository.DbContext.BulkInsertAsync(invlist);

4
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Vmi/VmiBalanceBase.cs

@ -10,13 +10,11 @@ public abstract class VmiBalanceBase : Entity<Guid>
public VmiBalanceBase()
{
}
public VmiBalanceBase(Guid id) : base(id)
{
}
[Display(Name = "LU零件号", Order = 6)]
public string RealPartCode { get; set; }
public string RealPartCode { get; set; }//原始
[Display(Name = "客户零件号", Order = 7)]
public string CustPartCode { get; set; }

2
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/JisBBACEidSeCompareReport.cs

@ -15,7 +15,7 @@ public class JisBBACEidSeCompareReport
/// <summary>
/// JisBBAC Edi、发运对比导出
/// </summary>
[ExcelExporter(MaxRowNumberOnASheet = 900000)]
[ExcelExporter(MaxRowNumberOnASheet = 500_000)]
public class JisBBACEidSeCompareExport
{
/// <summary>

5
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/SaSeEdiCompareDiff.cs

@ -135,7 +135,7 @@ public class SaSeEdiCompareDiff
/// <summary>
/// 结算、发运、Eid对比明细
/// </summary>
[ExcelExporter(MaxRowNumberOnASheet = 900000)]
[ExcelExporter(MaxRowNumberOnASheet = 500_000)]
public class SaSeEdiCompareDetailExport
{
}
@ -192,7 +192,6 @@ public interface ISaSeEdiCompareDetailExport
/// <summary>
/// JisBBAC结算、发运、Eid对比明细
/// </summary>
public class SaSeEdiCompareDetailExportJisBBAC : SaSeEdiCompareDetailExport, ISaSeEdiCompareDetailExport
{
/// <summary>
@ -477,7 +476,7 @@ public class SaSeEdiCompareDetailExportJisHBPO : SaSeEdiCompareDetailExport, ISa
/// <summary>
/// PUB结算与发运对比汇总
/// </summary>
[ExcelExporter(MaxRowNumberOnASheet = 900000)]
[ExcelExporter(MaxRowNumberOnASheet = 500_000)]
public class SaSeEdiCompareSumExport
{
/// <summary>

21
code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/JisBBACSeEdiCompareExportService.cs

@ -71,10 +71,10 @@ namespace SettleAccount.Job.Services.Report
.Select(t => new JisBBACEidSeCompareExport()
{
Category = "JIS",
CarModeCode = default,
LineStationcode = default,
SequenceNumber = t.Max(t => t.SeqNumber),
ParType = "01",
CarModeCode = t.Max(t => t.Extend4),
LineStationcode = t.Max(t => t.LineStationCode),
SequenceNumber = t.Max(t => t.Extend3),
ParType = t.Max(t => t.Extend2),
PN = t.Key.PN,
MaterialNumber = t.Key.LU,
EdiQty = t.Sum(t => t.Qty),
@ -111,7 +111,10 @@ namespace SettleAccount.Job.Services.Report
groupItem.Key.PN,
groupItem.Key.LU,
Qty = groupItem.Sum(t => t.Qty),
SeqNumber = groupItem.Max(t => t.SeqNumber)
Extend2 = groupItem.Max(t => t.Extend2),
Extend3 = groupItem.Max(t => t.Extend3),
Extend4 = groupItem.Max(t => t.Extend4),
LineStationCode = groupItem.Max(t => t.LineStationCode)
};
var seGroup = from se in _settleAccountDbContext.Set<BBAC_SE_DETAIL>()
where se.IsHaveEdiData == true && se.BillTime >= seStartDateTime && se.BillTime <= seEndDateTime
@ -138,10 +141,10 @@ namespace SettleAccount.Job.Services.Report
{
Category = "JIS",
WmsBillNum = se.BillNum,
CarModeCode = default,
LineStationcode = default,
SequenceNumber = edi.SeqNumber,
ParType = "01",
CarModeCode = edi.Extend4,
LineStationcode = edi.LineStationCode,
SequenceNumber = edi.Extend3,
ParType = edi.Extend2,
MESConfigCode = se.MESConfigCode,
ShippingDate = se.BillTime,
PN = se.PN,

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

@ -1,6 +1,7 @@
using System.Collections.Generic;
using System.Linq;
using EFCore.BulkExtensions;
using Magicodes.ExporterAndImporter.Core.Extension;
using Magicodes.ExporterAndImporter.Excel;
using Microsoft.AspNetCore.SignalR;
using SettleAccount.Bases;
@ -116,10 +117,26 @@ namespace SettleAccount.Job.Services.Report
/// <summary>
/// 创建导出文件结构
/// </summary>
public ExcelExporter BindExcelExporter<T>(List<T> pubSaSeCompareDetailExports, string businessTypeDisplayName) where T : SaSeEdiCompareDetailExport, ISaSeEdiCompareDetailExport, new()
public ExcelExporter BindExcelExporter<T>(List<T> saSeEdiCompareDetailExports, string businessTypeDisplayName) where T : SaSeEdiCompareDetailExport, ISaSeEdiCompareDetailExport, new()
{
//详情Sheet行数
var detailMaxRowNumberOnASheet = 500_000;
var detailExportExporterAttribute = typeof(T).GetAttribute<ExcelExporterAttribute>();
if (detailExportExporterAttribute != null)
{
detailMaxRowNumberOnASheet = detailExportExporterAttribute.MaxRowNumberOnASheet > 0 ? detailExportExporterAttribute.MaxRowNumberOnASheet : detailMaxRowNumberOnASheet;
}
//汇总Sheet行数
var sumMaxRowNumberOnASheet = 500_000;
var sumExportExporterAttribute = typeof(SaSeEdiCompareSumExport).GetAttribute<ExcelExporterAttribute>();
if (sumExportExporterAttribute != null)
{
sumMaxRowNumberOnASheet = sumExportExporterAttribute.MaxRowNumberOnASheet > 0 ? sumExportExporterAttribute.MaxRowNumberOnASheet : sumMaxRowNumberOnASheet;
}
//汇总
var pubSaSeCompareSumExports = pubSaSeCompareDetailExports.GroupBy(p => p.ReplaceFactoryPartCode).Select(p => new SaSeEdiCompareSumExport()
var saSeEdiCompareSumExports = saSeEdiCompareDetailExports.GroupBy(p => p.ReplaceFactoryPartCode).Select(p => new SaSeEdiCompareSumExport()
{
FactoryPartCode = p.Key,
PartCodeDesc = p.FirstOrDefault().PartCodeDesc,
@ -129,7 +146,7 @@ namespace SettleAccount.Job.Services.Report
}).ToList();
//有结算有发运
var haveSaHaveSeExports = pubSaSeCompareDetailExports.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 haveSaHaveSeSumExports = haveSaHaveSeExports.GroupBy(p => p.ReplaceFactoryPartCode).Select(p => new SaSeEdiCompareSumExport()
{
@ -140,7 +157,7 @@ namespace SettleAccount.Job.Services.Report
EdiQty = p.Sum(t => t.EdiQty)
}).ToList();
//有结算无发运
var haveSaNotHaveSeExports = pubSaSeCompareDetailExports.FindAll(t => new EnumSaSeEdiCompareCategory[] { EnumSaSeEdiCompareCategory.HaveSaNotHaveSeHaveEdi, EnumSaSeEdiCompareCategory.HaveSaNotHaveSeNotHaveEdi }.Contains(t.Category));
var haveSaNotHaveSeExports = saSeEdiCompareDetailExports.FindAll(t => new EnumSaSeEdiCompareCategory[] { EnumSaSeEdiCompareCategory.HaveSaNotHaveSeHaveEdi, EnumSaSeEdiCompareCategory.HaveSaNotHaveSeNotHaveEdi }.Contains(t.Category));
//有结算无发运
var haveSaNotHaveSeSumExports = haveSaNotHaveSeExports.GroupBy(p => p.ReplaceFactoryPartCode).Select(p => new SaSeEdiCompareSumExport()
{
@ -151,7 +168,7 @@ namespace SettleAccount.Job.Services.Report
EdiQty = p.Sum(t => t.EdiQty)
}).ToList();
//无结算有发运
var notHaveSaHaveSeExports = pubSaSeCompareDetailExports.FindAll(t => new EnumSaSeEdiCompareCategory[] { EnumSaSeEdiCompareCategory.NotHaveSaHaveSeHaveEdi, EnumSaSeEdiCompareCategory.NotHaveSaHaveSeNotHaveEdi }.Contains(t.Category));
var notHaveSaHaveSeExports = saSeEdiCompareDetailExports.FindAll(t => new EnumSaSeEdiCompareCategory[] { EnumSaSeEdiCompareCategory.NotHaveSaHaveSeHaveEdi, EnumSaSeEdiCompareCategory.NotHaveSaHaveSeNotHaveEdi }.Contains(t.Category));
//无结算有发运
var notHaveSaHaveSeSumExports = notHaveSaHaveSeExports.GroupBy(p => p.ReplaceFactoryPartCode).Select(p => new SaSeEdiCompareSumExport()
{
@ -163,20 +180,59 @@ namespace SettleAccount.Job.Services.Report
}).ToList();
ExcelExporter excelExporter = new ExcelExporter();
return excelExporter
.Append(pubSaSeCompareDetailExports, $"{businessTypeDisplayName}结算核对明细输出")
.SeparateBySheet()
.Append(pubSaSeCompareSumExports, $"{businessTypeDisplayName}结算核对汇总输出")
.SeparateBySheet()
//结算核对明细输出
excelExporter.Append(saSeEdiCompareDetailExports.Take(detailMaxRowNumberOnASheet).ToList(), $"{businessTypeDisplayName}结算核对明细输出");
for (var i = 1; i < saSeEdiCompareDetailExports.Count / detailMaxRowNumberOnASheet + ((saSeEdiCompareDetailExports.Count % detailMaxRowNumberOnASheet) > 0 ? 1 : 0); i++)
{
var sheetDataItems = saSeEdiCompareDetailExports.Skip(i * detailMaxRowNumberOnASheet)
.Take(detailMaxRowNumberOnASheet).ToList();
excelExporter.SeparateBySheet();
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.SeparateBySheet();
excelExporter.Append(sheetDataItems, $"{businessTypeDisplayName}结算核对汇总输出-{i}");
}
.Append(haveSaHaveSeExports, $"{businessTypeDisplayName}有结算有发货明细输出")
.SeparateBySheet()
.Append(haveSaHaveSeSumExports, $"{businessTypeDisplayName}有结算有发货汇总输出")
.SeparateBySheet()
//有结算有发货明细输出
excelExporter.Append(haveSaHaveSeExports.Take(detailMaxRowNumberOnASheet).ToList(), $"{businessTypeDisplayName}有结算有发货明细输出");
for (var i = 1; i < haveSaHaveSeExports.Count / detailMaxRowNumberOnASheet + ((haveSaHaveSeExports.Count % detailMaxRowNumberOnASheet) > 0 ? 1 : 0); i++)
{
var sheetDataItems = haveSaHaveSeExports.Skip(i * detailMaxRowNumberOnASheet).Take(detailMaxRowNumberOnASheet).ToList();
excelExporter.SeparateBySheet();
excelExporter.Append(sheetDataItems, $"{businessTypeDisplayName}有结算有发货明细输出-{i}");
}
//有结算有发货汇总输出
excelExporter.Append(haveSaHaveSeSumExports.Take(sumMaxRowNumberOnASheet).ToList(), $"{businessTypeDisplayName}有结算有发货汇总输出");
for (var i = 1; i < haveSaHaveSeSumExports.Count / sumMaxRowNumberOnASheet + ((haveSaHaveSeSumExports.Count % sumMaxRowNumberOnASheet) > 0 ? 1 : 0); i++)
{
var sheetDataItems = haveSaHaveSeSumExports.Skip(i * sumMaxRowNumberOnASheet).Take(sumMaxRowNumberOnASheet).ToList();
excelExporter.SeparateBySheet();
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.SeparateBySheet();
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.SeparateBySheet();
excelExporter.Append(sheetDataItems, $"{businessTypeDisplayName}有结算无发货汇总输出-{i}");
}
.Append(haveSaNotHaveSeExports, $"{businessTypeDisplayName}有结算无发货明细输出")
.SeparateBySheet()
.Append(haveSaNotHaveSeSumExports, $"{businessTypeDisplayName}有结算无发货汇总输出");
return excelExporter;
}
/// <summary>

Loading…
Cancel
Save