wanggang 1 year ago
parent
commit
bfb732fd04
  1. 12
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/Startup.cs
  2. 53
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/appsettings.json
  3. 18
      code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/PUB_SA_DTO.cs
  4. 72
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Bases/BA_SERVICE.cs
  5. 9
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_SA_SERVICE.cs
  6. 2
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_SA_DETAIL_SERVICE.cs
  7. 24
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_SA_SERVICE.cs
  8. 2
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PURCHASE_PRICE_SERVICE.cs
  9. 11
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/BBACSeSyncAppService.cs
  10. 10
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/BeiSeSyncAppService.cs
  11. 11
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/HBPOSeSyncAppService.cs
  12. 5
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/JitSeSyncAppService.cs
  13. 10
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/YinDuSeSyncAppService.cs
  14. 10
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/ZhiGongBBACSeSyncAppService.cs
  15. 10
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/ZhiGongHBPOSeSyncAppService.cs
  16. 1
      code/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccountApplicationAutoMapperProfile.cs
  17. 9
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/HBPO_CAN_SA_MNG.cs
  18. 655
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/INV_MNG.cs
  19. 9
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/PUB_CAN_SA_MNG.cs
  20. 169
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/PubSaSeCompareDiff.cs
  21. 60
      code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/EntityFrameworkCore/SettleAccountDbContextModelCreatingExtensions.cs
  22. 5279
      code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/20230808023302_202308080001.Designer.cs
  23. 106
      code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/20230808023302_202308080001.cs
  24. 5288
      code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/20230808055821_20230808-1.Designer.cs
  25. 38
      code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/20230808055821_20230808-1.cs
  26. 5333
      code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/20230808062331_20230808-2.Designer.cs
  27. 79
      code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/20230808062331_20230808-2.cs
  28. 278
      code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/SettleAccountDbContextModelSnapshot.cs
  29. 17
      code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/PubSaSeCompareDapperRepository.cs
  30. 270
      code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/PubSaSeCompareExportService.cs
  31. 6
      code/src/Modules/SettleAccount/src/SettleAccount.Job/SettleAccountJobAutoMapperProfile.cs

12
code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/Startup.cs

@ -33,12 +33,6 @@ public class Startup
JobHostdService.AddService(services); JobHostdService.AddService(services);
services.AddSingleton<JobHostdService>(); services.AddSingleton<JobHostdService>();
services.AddHostedService(o => o.GetRequiredService<JobHostdService>()); services.AddHostedService(o => o.GetRequiredService<JobHostdService>());
services.AddTransient<HBPOSeSyncAppService>();
services.AddTransient<BBACSeSyncAppService>();
services.AddTransient<ZhiGongBBACSeSyncAppService>();
services.AddTransient<ZhiGongHBPOSeSyncAppService>();
services.AddTransient<BeiSeSyncAppService>();
services.AddTransient<YinDuSeSyncAppService>();
services.AddRouting(options => options.ConstraintMap["slugify"] = typeof(SlugifyParameterTransformer)); services.AddRouting(options => options.ConstraintMap["slugify"] = typeof(SlugifyParameterTransformer));
services.AddMvc(options => options.Conventions.Add(new RouteTokenTransformerConvention(new SlugifyParameterTransformer()))); services.AddMvc(options => options.Conventions.Add(new RouteTokenTransformerConvention(new SlugifyParameterTransformer())));
services.AddApplication<SettleAccountHttpApiHostModule>(); services.AddApplication<SettleAccountHttpApiHostModule>();
@ -62,12 +56,6 @@ public class Startup
app.UseEndpoints(endpoints => endpoints.MapHub<PageHub>("/api/hub")); app.UseEndpoints(endpoints => endpoints.MapHub<PageHub>("/api/hub"));
app.ApplicationServices.UseScheduler(scheduler => app.ApplicationServices.UseScheduler(scheduler =>
{ {
scheduler.Schedule<HBPOSeSyncAppService>().EveryMinute();
scheduler.Schedule<BBACSeSyncAppService>().EveryMinute();
scheduler.Schedule<ZhiGongBBACSeSyncAppService>().EveryMinute();
scheduler.Schedule<ZhiGongHBPOSeSyncAppService>().EveryMinute();
scheduler.Schedule<BeiSeSyncAppService>().EveryMinute();
scheduler.Schedule<YinDuSeSyncAppService>().EveryMinute();
}); });
var contentTypeProvider = new FileExtensionContentTypeProvider(); var contentTypeProvider = new FileExtensionContentTypeProvider();
contentTypeProvider.Mappings.Add(".mjs", "text/javascript"); contentTypeProvider.Mappings.Add(".mjs", "text/javascript");

53
code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/appsettings.json

@ -2,12 +2,25 @@
"App": { "App": {
"CorsOrigins": "https://*.abc.com,http://localhost:9527,http://149.223.116.5:8088" "CorsOrigins": "https://*.abc.com,http://localhost:9527,http://149.223.116.5:8088"
}, },
//"ConnectionStrings": {
// "Default": "Server=LAPTOP-V3U07C2O;Database=ABP;user id=sa;Password=1q2w!@#",
// "SettleAccountService": "Server=LAPTOP-V3U07C2O;Database=SettleAccountService1;user id=sa;Password=1q2w!@#;"
//},
"ConnectionStrings": { "ConnectionStrings": {
"Default": "Server=dev.ccwin-in.com,13319;Database=BJABP;User ID=ccwin-in;Password=Microsoft@2022;Trusted_Connection=False;TrustServerCertificate=True", "Default": "Server=dev.ccwin-in.com,13319;Database=BJABP;User ID=ccwin-in;Password=Microsoft@2022;Trusted_Connection=False;TrustServerCertificate=True",
"SettleAccountService": "Server=dev.ccwin-in.com,13319;Database=BQ_SA;User ID=ccwin-in;Password=Microsoft@2022;Trusted_Connection=False;TrustServerCertificate=True;", "SettleAccountService": "Server=dev.ccwin-in.com,13319;Database=BQ_SA;User ID=ccwin-in;Password=Microsoft@2022;Trusted_Connection=False;TrustServerCertificate=True;"
"WMSBJBMPT": "Server=dev.ccwin-in.com,6208;Database=WMS_BJBMPT_2;User ID=sa;Password=ChangkeTec@2021;Trusted_Connection=False;TrustServerCertificate=True;", //"SettleAccountService": "Server=localhost;Database=BQ_SA;User ID=sa;Password=aA123456!;Trusted_Connection=False;TrustServerCertificate=True",
"questdb": "host=dev.ccwin-in.com;port=10580;username=admin;password=quest;database=vmi;ServerCompatibilityMode=NoTypeLoading;" //"Default": "Server=localhost;Database=BJABP;User ID=sa;Password=aA123456!;Trusted_Connection=False;TrustServerCertificate=True"
}, },
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft": "Warning",
"Microsoft.Hosting.Lifetime": "Information"
}
},
"Serilog": { "Serilog": {
"Using": [], "Using": [],
"MinumumLevel": { "MinumumLevel": {
@ -69,8 +82,15 @@
}, },
"AuthServer": { "AuthServer": {
"Authority": "http://localhost:10582", //"Authority": "http://dev.ccwin-in.com:10580",
"Authority": "http://localhost:44378",
"ClientId": "basic-web", "ClientId": "basic-web",
"ClientSecret": "1q2w3e*" "ClientSecret": "1q2w3e*"
}, },
@ -80,5 +100,28 @@
}, },
"DefaultBranchId": "3FA85F64-5717-4562-B3FC-2C963F66AFA6", "DefaultBranchId": "3FA85F64-5717-4562-B3FC-2C963F66AFA6",
"AllowedHosts": "*" "AllowedHosts": "*",
"ElasticSearch": {
"Url": "http://localhost:9200"
},
"RemoteServices": {
"Default": {
"BaseUrl": "http://149.223.116.5:8091/",
"UseCurrentAccessToken": "true"
}
},
"IdentityClients": {
"Default": {
"GrantType": "client_credentials",
"ClientId": "business-app",
"ClientSecret": "1q2w3e*",
"Authority": "http://149.223.116.5:8066",
"Scope": "InternalGateway IdentityService SettleAccount"
}
}
} }

18
code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/PUB_SA_DTO.cs

@ -52,9 +52,15 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Dtos
public IFormFileCollection Files { get; set; } public IFormFileCollection Files { get; set; }
/// <summary> /// <summary>
/// 是否是备件 /// 业务类别
/// </summary> /// </summary>
public EnumBusinessType BusinessType { get; set; } public EnumBusinessType BusinessType { get; set; }
/// <summary>
/// 期间
/// </summary>
[Display(Name = "期间")]
public int Version { get; set; }
} }
/// <summary> /// <summary>
@ -439,5 +445,15 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Dtos
/// 业务类型 /// 业务类型
/// </summary> /// </summary>
public EnumBusinessType BusinessType { get; set; } public EnumBusinessType BusinessType { get; set; }
/// <summary>
/// 发运开始时间
/// </summary>
public DateTime? SeStartDateTime { get; set; }
/// <summary>
/// 发运结束时间
/// </summary>
public DateTime? SeEndDateTime { get; set; }
} }
} }

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

@ -210,40 +210,46 @@ namespace Win.Sfs.SettleAccount.Bases
[HttpPost] [HttpPost]
[UnitOfWork(false)] [UnitOfWork(false)]
public virtual async Task<string> ReceivedAsync(INVOICE_GRP_REQ_DTO input) public virtual async Task<string> ReceivedAsync(List<string> p_ins)
{ {
var entity = await _invMng.GetMainAsync(input.InvbillNum);
if (entity.InvoiceState == InvoiceBillState.) await _invMng.ReceivedAsync(p_ins);
{
throw new BusinessException("8989", $"发票号{entity.InvbillNum}为报废状态, 不能提交!");
}
if (entity.InvoiceState == InvoiceBillState. )
{ //var entity = await _invMng.GetMainAsync(input.InvbillNum);
throw new BusinessException("8989", $"发票号{entity.InvbillNum}所在发票分组{entity.InvGroupNum}现在为提交状态!"); //if (entity.InvoiceState == InvoiceBillState.报废)
} //{
if (entity.State != SettleBillState.) // throw new BusinessException("8989", $"发票号{entity.InvbillNum}为报废状态, 不能提交!");
{ //}
throw new BusinessException("8989", $"发票号{entity.InvbillNum}所在发票分组{entity.InvGroupNum}不是财务已审核状态,不能收票!"); //if (entity.InvoiceState == InvoiceBillState.提交 )
} //{
if (entity != null) // throw new BusinessException("8989", $"发票号{entity.InvbillNum}所在发票分组{entity.InvGroupNum}现在为提交状态!");
{ //}
List<CustomCondition> customConditionList = new List<CustomCondition>(); //if (entity.State != SettleBillState.财务已审核)
customConditionList.Add(new CustomCondition() { Name = "InvGroupNum", Value = entity.InvGroupNum?? string.Empty }); //{
var invlist= _repository.Where(p => p.InvGroupNum == entity.InvGroupNum).ToList(); // throw new BusinessException("8989", $"发票号{entity.InvbillNum}所在发票分组{entity.InvGroupNum}不是财务已审核状态,不能收票!");
foreach (var inv in invlist) { //}
//if (entity != null)
if (inv.InvoiceState != InvoiceBillState.) //{
{ // List<CustomCondition> customConditionList = new List<CustomCondition>();
inv.InvoiceState = InvoiceBillState.; // customConditionList.Add(new CustomCondition() { Name = "InvGroupNum", Value = entity.InvGroupNum?? string.Empty });
} // var invlist= _repository.Where(p => p.InvGroupNum == entity.InvGroupNum).ToList();
} // foreach (var inv in invlist) {
await _repository.DbContext.BulkUpdateAsync(invlist);
var _taskid = await _service.ExportEnqueueAsync($"发票分组{entity.InvGroupNum}收票任务", ExportExtentsion.Excel, DateTime.Now.ToString("yyyymm"), string.Empty, CurrentUser, typeof(PD_SERVICE), customConditionList, (rs) => // if (inv.InvoiceState != InvoiceBillState.报废)
{ // {
// inv.InvoiceState = InvoiceBillState.提交;
}); // }
return _taskid; // }
} // await _repository.DbContext.BulkUpdateAsync(invlist);
// var _taskid = await _service.ExportEnqueueAsync($"发票分组{entity.InvGroupNum}收票任务", ExportExtentsion.Excel, DateTime.Now.ToString("yyyymm"), string.Empty, CurrentUser, typeof(PD_SERVICE), customConditionList, (rs) =>
// {
// });
// return _taskid;
//}
return ApplicationConsts.SuccessStr; return ApplicationConsts.SuccessStr;
} }
protected virtual async Task<List<INVOICE_MAP_GROUP_DTO>> GetMapGroupAsync(INVOICE_GRP_REQ_DTO input) protected virtual async Task<List<INVOICE_MAP_GROUP_DTO>> GetMapGroupAsync(INVOICE_GRP_REQ_DTO input)

9
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_SA_SERVICE.cs

@ -115,12 +115,13 @@ public class BBAC_SA_SERVICE : SettleAccountApplicationBase<BBAC_SA>
ExportImporter _exportImporter = new ExportImporter(); ExportImporter _exportImporter = new ExportImporter();
var importDtos = await _exportImporter.UploadExcelImport<BBAC_SA_DETAIL_IMPORT_DTO>(files, _excelImportService); var importDtos = await _exportImporter.UploadExcelImport<BBAC_SA_DETAIL_IMPORT_DTO>(files, _excelImportService);
//买单件BBAC
var importMaiDanJianHBOPDtos = importDtos.FindAll(t => t.PN.Contains("R0"));
//JisBBAC //JisBBAC
var importHBOPDtos = importDtos.FindAll(t => t.PN.Contains("R0") == false); var importHBOPDtos = importDtos.FindAll(t => t.PN.Contains("R0") == false);
//买单件BBAC
var importMaiDanJianHBOPDtos = importDtos.FindAll(t => t.PN.Contains("R0"));
var importBBACSaDetails = ObjectMapper.Map<List<BBAC_SA_DETAIL_IMPORT_DTO>, List<BBAC_SA_DETAIL>>(importHBOPDtos); var importBBACSaDetails = ObjectMapper.Map<List<BBAC_SA_DETAIL_IMPORT_DTO>, List<BBAC_SA_DETAIL>>(importHBOPDtos);
var importMaiDanJianBBACSaDetails = ObjectMapper.Map<List<BBAC_SA_DETAIL_IMPORT_DTO>, List<PUB_SA_DETAIL>>(importHBOPDtos);
//数据校验 //数据校验
var checkList = new List<ErrorExportDto>(); var checkList = new List<ErrorExportDto>();
@ -145,7 +146,7 @@ public class BBAC_SA_SERVICE : SettleAccountApplicationBase<BBAC_SA>
if (importBBACSaDetails.Any()) if (importBBACSaDetails.Any())
{ {
//await SaDataHandleAsync(importBBACSaDetails); await SaDataHandleAsync(importBBACSaDetails, importMaiDanJianBBACSaDetails);
} }
return new JsonResult(new { Code = 200, Message = "导入成功" }); return new JsonResult(new { Code = 200, Message = "导入成功" });
@ -285,7 +286,7 @@ public class BBAC_SA_SERVICE : SettleAccountApplicationBase<BBAC_SA>
/// <summary> /// <summary>
/// 结算数据处理 /// 结算数据处理
/// </summary> /// </summary>
private async Task SaDataHandleAsync(List<BBAC_SA_DETAIL> bbacSaDetails) private async Task SaDataHandleAsync(List<BBAC_SA_DETAIL> bbacSaDetails, List<PUB_SA_DETAIL> maiDanJianBBACSaDetails)
{ {
//结算单号 //结算单号
var bbacSaBillNum = OrderNumberGenerator.GenerateOrderNumber("SA"); var bbacSaBillNum = OrderNumberGenerator.GenerateOrderNumber("SA");

2
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_SA_DETAIL_SERVICE.cs

@ -120,6 +120,8 @@ public class PUB_SA_DETAIL_SERVICE : SettleAccountApplicationBase<PUB_SA_DETAIL>
customConditionList.Add(new CustomCondition() { Name = "LU", Value = pubSaSeCompareRequestDto.LU }); customConditionList.Add(new CustomCondition() { Name = "LU", Value = pubSaSeCompareRequestDto.LU });
customConditionList.Add(new CustomCondition() { Name = "PN", Value = pubSaSeCompareRequestDto.PN }); customConditionList.Add(new CustomCondition() { Name = "PN", Value = pubSaSeCompareRequestDto.PN });
customConditionList.Add(new CustomCondition() { Name = "ProjectName", Value = projectName }); customConditionList.Add(new CustomCondition() { Name = "ProjectName", Value = projectName });
customConditionList.Add(new CustomCondition() { Name = "SeStartDateTime", Value = pubSaSeCompareRequestDto.SeStartDateTime?.ToString("yyyy-MM-dd 00:00:00") });
customConditionList.Add(new CustomCondition() { Name = "SeEndDateTime", Value = pubSaSeCompareRequestDto.SeEndDateTime?.ToString("yyyy-MM-dd 23:59:59") });
var _taskid = await _taskJobService.ExportEnqueueAsync(projectName, ExportExtentsion.Excel, pubSaSeCompareRequestDto.Version, string.Empty, CurrentUser, typeof(PubSaSeCompareExportService), customConditionList, (rs) => var _taskid = await _taskJobService.ExportEnqueueAsync(projectName, ExportExtentsion.Excel, pubSaSeCompareRequestDto.Version, string.Empty, CurrentUser, typeof(PubSaSeCompareExportService), customConditionList, (rs) =>
{ {

24
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_SA_SERVICE.cs

@ -102,6 +102,11 @@ public class PUB_SA_SERVICE : SettleAccountApplicationBase<PUB_SA>
_tbRePartsRelationshipRepository = tbRePartsRelationshipRepository; _tbRePartsRelationshipRepository = tbRePartsRelationshipRepository;
} }
/// <summary>
/// 期间
/// </summary>
private int _version;
#region 导入、导出 #region 导入、导出
/// <summary> /// <summary>
/// 导入 /// 导入
@ -110,6 +115,7 @@ public class PUB_SA_SERVICE : SettleAccountApplicationBase<PUB_SA>
public async Task<IActionResult> ImportByBusinessTypeAsync([FromForm] PUB_SAImportRequestDto pubSaImportRequestDto) public async Task<IActionResult> ImportByBusinessTypeAsync([FromForm] PUB_SAImportRequestDto pubSaImportRequestDto)
{ {
IActionResult result = new JsonResult(null); IActionResult result = new JsonResult(null);
_version = pubSaImportRequestDto.Version;
switch (pubSaImportRequestDto.BusinessType) switch (pubSaImportRequestDto.BusinessType)
{ {
case EnumBusinessType.None: case EnumBusinessType.None:
@ -306,7 +312,6 @@ public class PUB_SA_SERVICE : SettleAccountApplicationBase<PUB_SA>
//客户零件关系 //客户零件关系
var materialRelationships = new List<MaterialRelationship>(); var materialRelationships = new List<MaterialRelationship>();
#region 导入数据转换、数据校验 #region 导入数据转换、数据校验
ExportImporter _exportImporter = new ExportImporter(); ExportImporter _exportImporter = new ExportImporter();
var result = await _exportImporter.UploadExcelImport<PUB_SA_DETAIL_IMPORT_DTO>(files, _excelImportService); var result = await _exportImporter.UploadExcelImport<PUB_SA_DETAIL_IMPORT_DTO>(files, _excelImportService);
@ -332,7 +337,6 @@ public class PUB_SA_SERVICE : SettleAccountApplicationBase<PUB_SA>
} }
#endregion #endregion
#region 处理结算数据 #region 处理结算数据
//销售价格 //销售价格
var priceListEntitys = await _priceListRepository.GetAllAsync(); var priceListEntitys = await _priceListRepository.GetAllAsync();
@ -376,7 +380,6 @@ public class PUB_SA_SERVICE : SettleAccountApplicationBase<PUB_SA>
}); });
#endregion #endregion
#region 入库数据赋值 #region 入库数据赋值
//结算明细 //结算明细
pubSaDetails = importPubSaDetails; pubSaDetails = importPubSaDetails;
@ -605,6 +608,7 @@ public class PUB_SA_SERVICE : SettleAccountApplicationBase<PUB_SA>
importPubSaDetail.LU += luAssemble.Aggregate(" ", (current, index) => current + index); importPubSaDetail.LU += luAssemble.Aggregate(" ", (current, index) => current + index);
} }
importPubSaDetail.Version = _version;
importPubSaDetail.BusinessType = businessType; importPubSaDetail.BusinessType = businessType;
importPubSaDetail.Site = "XX工厂"; importPubSaDetail.Site = "XX工厂";
importPubSaDetail.KeyCode = importPubSaDetail.PN + importPubSaDetail.LU; importPubSaDetail.KeyCode = importPubSaDetail.PN + importPubSaDetail.LU;
@ -650,7 +654,7 @@ public class PUB_SA_SERVICE : SettleAccountApplicationBase<PUB_SA>
private async Task SeDataEntryAsync(List<PUB_SA_DETAIL> pubSaDetails) private async Task SeDataEntryAsync(List<PUB_SA_DETAIL> pubSaDetails)
{ {
//业务类型 //业务类型
EnumBusinessType businessType = pubSaDetails.First().BusinessType; var pubSaFirstDetail = pubSaDetails.First();
//结算单号 //结算单号
var pubSaBillNum = OrderNumberGenerator.GenerateOrderNumber("SA"); var pubSaBillNum = OrderNumberGenerator.GenerateOrderNumber("SA");
//结算主表 //结算主表
@ -658,7 +662,8 @@ public class PUB_SA_SERVICE : SettleAccountApplicationBase<PUB_SA>
{ {
BillNum = pubSaBillNum, BillNum = pubSaBillNum,
State = "1", State = "1",
BusinessType = businessType BusinessType = pubSaFirstDetail.BusinessType,
Version = pubSaFirstDetail.Version
}; };
//可结算单号 //可结算单号
var pubCanSaBillNum = OrderNumberGenerator.GenerateOrderNumber("C"); var pubCanSaBillNum = OrderNumberGenerator.GenerateOrderNumber("C");
@ -668,7 +673,8 @@ public class PUB_SA_SERVICE : SettleAccountApplicationBase<PUB_SA>
BillNum = pubCanSaBillNum, BillNum = pubCanSaBillNum,
SettleBillNum = pubSaBillNum, SettleBillNum = pubSaBillNum,
State = SettleBillState., State = SettleBillState.,
BusinessType = businessType BusinessType = pubSa.BusinessType,
Version = pubSa.Version
}; };
#region 入库数据赋值 #region 入库数据赋值
@ -696,7 +702,6 @@ public class PUB_SA_SERVICE : SettleAccountApplicationBase<PUB_SA>
pubCanSaDetails.ForEach(pubCanSaDetail => pubCanSaDetails.ForEach(pubCanSaDetail =>
{ {
pubCanSaDetail.BillNum = pubCanSaDetail.InvGroupNum = pubCanSaBillNum; pubCanSaDetail.BillNum = pubCanSaDetail.InvGroupNum = pubCanSaBillNum;
pubCanSaDetail.BusinessType = businessType;
}); });
await _pubCanSaRepository.InsertAsync(pubCanSa); await _pubCanSaRepository.InsertAsync(pubCanSa);
@ -704,11 +709,6 @@ public class PUB_SA_SERVICE : SettleAccountApplicationBase<PUB_SA>
} }
if (pubNotSaDetails.Count > 0) if (pubNotSaDetails.Count > 0)
{ {
pubNotSaDetails.ForEach(pubNotSaDetail =>
{
pubNotSaDetail.BusinessType = businessType;
});
await _pubNotSaDetailRepository.InsertManyAsync(pubNotSaDetails); await _pubNotSaDetailRepository.InsertManyAsync(pubNotSaDetails);
} }
#endregion #endregion

2
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PURCHASE_PRICE_SERVICE.cs

@ -5,7 +5,9 @@ using System.Threading.Tasks;
using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.SignalR;
using SettleAccount.Domain.BQ; using SettleAccount.Domain.BQ;
using SettleAccount.Job.SignalR;
using Shouldly; using Shouldly;
using Volo.Abp.Application.Dtos; using Volo.Abp.Application.Dtos;
using Volo.Abp.Caching; using Volo.Abp.Caching;

11
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/BBACSeSyncAppService.cs

@ -8,17 +8,18 @@ using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using SettleAccount.Domain.BQ; using SettleAccount.Domain.BQ;
using Volo.Abp.Application.Services; using Volo.Abp.Application.Services;
using Win.Sfs.SettleAccount.Entities.BQ.Vmi;
using Win.Sfs.SettleAccount.EntityFrameworkCore; using Win.Sfs.SettleAccount.EntityFrameworkCore;
using Win.Sfs.Shared.RepositoryBase; using Win.Sfs.Shared.RepositoryBase;
namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs; namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs;
/// <summary> /// <summary>
/// HBPO发运数据同步服务 /// HBPO发运数据同步
/// </summary> /// </summary>
[AllowAnonymous] [AllowAnonymous]
[Route("api/settleaccount/[controller]/[action]")] [Route("api/settleaccount/[controller]/[action]")]
public class BBACSeSyncAppService : ApplicationService, IInvocable public class BBACSeSyncAppService : ApplicationService, IInvocable, IJobService
{ {
/// <summary> /// <summary>
/// WMS数据上下文 /// WMS数据上下文
@ -48,6 +49,12 @@ public class BBACSeSyncAppService : ApplicationService, IInvocable
_bbacSeDetailRepository = bbacSeDetailRepository; _bbacSeDetailRepository = bbacSeDetailRepository;
} }
[ApiExplorerSettings(IgnoreApi = true)]
public async Task Invoke(IServiceProvider serviceProvider)
{
await this.Invoke();
}
[HttpPost] [HttpPost]
public async Task Invoke() public async Task Invoke()
{ {

10
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/BeiSeSyncAppService.cs

@ -1,8 +1,10 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Threading.Tasks;
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 Win.Sfs.SettleAccount.Entities.BQ.Vmi;
using Win.Sfs.SettleAccount.EntityFrameworkCore; using Win.Sfs.SettleAccount.EntityFrameworkCore;
using Win.Sfs.Shared.RepositoryBase; using Win.Sfs.Shared.RepositoryBase;
@ -13,7 +15,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs;
/// </summary> /// </summary>
[AllowAnonymous] [AllowAnonymous]
[Route("api/settleaccount/[controller]/[action]")] [Route("api/settleaccount/[controller]/[action]")]
public class BeiSeSyncAppService : JitSeSyncAppService public class BeiSeSyncAppService : JitSeSyncAppService, IJobService
{ {
/// <summary> /// <summary>
/// 构造 /// 构造
@ -35,4 +37,10 @@ public class BeiSeSyncAppService : JitSeSyncAppService
BusinessType = EnumBusinessType.BeiJian BusinessType = EnumBusinessType.BeiJian
}; };
} }
[ApiExplorerSettings(IgnoreApi = true)]
public async Task Invoke(IServiceProvider serviceProvider)
{
await this.Invoke();
}
} }

11
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/HBPOSeSyncAppService.cs

@ -9,17 +9,18 @@ using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using SettleAccount.Domain.BQ; using SettleAccount.Domain.BQ;
using Volo.Abp.Application.Services; using Volo.Abp.Application.Services;
using Win.Sfs.SettleAccount.Entities.BQ.Vmi;
using Win.Sfs.SettleAccount.EntityFrameworkCore; using Win.Sfs.SettleAccount.EntityFrameworkCore;
using Win.Sfs.Shared.RepositoryBase; using Win.Sfs.Shared.RepositoryBase;
namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs; namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs;
/// <summary> /// <summary>
/// HBPO发运数据同步服务 /// HBPO发运数据同步
/// </summary> /// </summary>
[AllowAnonymous] [AllowAnonymous]
[Route("api/settleaccount/[controller]/[action]")] [Route("api/settleaccount/[controller]/[action]")]
public class HBPOSeSyncAppService : ApplicationService, IInvocable //IJobService public class HBPOSeSyncAppService : ApplicationService, IInvocable, IJobService
{ {
/// <summary> /// <summary>
/// WMS数据上下文 /// WMS数据上下文
@ -49,6 +50,12 @@ public class HBPOSeSyncAppService : ApplicationService, IInvocable //IJobService
_hbpoSeDetailRepository = hbpoSeDetailRepository; _hbpoSeDetailRepository = hbpoSeDetailRepository;
} }
[ApiExplorerSettings(IgnoreApi = true)]
public async Task Invoke(IServiceProvider serviceProvider)
{
await this.Invoke();
}
[HttpPost] [HttpPost]
public async Task Invoke() public async Task Invoke()
{ {

5
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/JitSeSyncAppService.cs

@ -15,7 +15,6 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs;
/// <summary> /// <summary>
/// Jit发运数据同步 /// Jit发运数据同步
/// </summary> /// </summary>
[ApiExplorerSettings(IgnoreApi = true)]
public class JitSeSyncAppService : ApplicationService, IInvocable public class JitSeSyncAppService : ApplicationService, IInvocable
{ {
/// <summary> /// <summary>
@ -54,6 +53,10 @@ public class JitSeSyncAppService : ApplicationService, IInvocable
[HttpPost] [HttpPost]
public async Task Invoke() public async Task Invoke()
{ {
if (SeSyncConfigInfo == null)
{
return;
}
//同步表名称 //同步表名称
var syncTableName = SeSyncConfigInfo.SyncTableName; var syncTableName = SeSyncConfigInfo.SyncTableName;
//同步发运主类型 //同步发运主类型

10
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/YinDuSeSyncAppService.cs

@ -1,8 +1,10 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Threading.Tasks;
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 Win.Sfs.SettleAccount.Entities.BQ.Vmi;
using Win.Sfs.SettleAccount.EntityFrameworkCore; using Win.Sfs.SettleAccount.EntityFrameworkCore;
using Win.Sfs.Shared.RepositoryBase; using Win.Sfs.Shared.RepositoryBase;
@ -13,7 +15,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs;
/// </summary> /// </summary>
[AllowAnonymous] [AllowAnonymous]
[Route("api/settleaccount/[controller]/[action]")] [Route("api/settleaccount/[controller]/[action]")]
public class YinDuSeSyncAppService : JitSeSyncAppService public class YinDuSeSyncAppService : JitSeSyncAppService, IJobService
{ {
/// <summary> /// <summary>
/// 构造 /// 构造
@ -35,4 +37,10 @@ public class YinDuSeSyncAppService : JitSeSyncAppService
BusinessType = EnumBusinessType.YinDuJian BusinessType = EnumBusinessType.YinDuJian
}; };
} }
[ApiExplorerSettings(IgnoreApi = true)]
public async Task Invoke(IServiceProvider serviceProvider)
{
await this.Invoke();
}
} }

10
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/ZhiGongBBACSeSyncAppService.cs

@ -1,8 +1,10 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Threading.Tasks;
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 Win.Sfs.SettleAccount.Entities.BQ.Vmi;
using Win.Sfs.SettleAccount.EntityFrameworkCore; using Win.Sfs.SettleAccount.EntityFrameworkCore;
using Win.Sfs.Shared.RepositoryBase; using Win.Sfs.Shared.RepositoryBase;
@ -13,7 +15,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs;
/// </summary> /// </summary>
[AllowAnonymous] [AllowAnonymous]
[Route("api/settleaccount/[controller]/[action]")] [Route("api/settleaccount/[controller]/[action]")]
public class ZhiGongBBACSeSyncAppService : JitSeSyncAppService public class ZhiGongBBACSeSyncAppService : JitSeSyncAppService, IJobService
{ {
/// <summary> /// <summary>
/// 构造 /// 构造
@ -35,4 +37,10 @@ public class ZhiGongBBACSeSyncAppService : JitSeSyncAppService
BusinessType = EnumBusinessType.ZhiGongJianBBAC BusinessType = EnumBusinessType.ZhiGongJianBBAC
}; };
} }
[ApiExplorerSettings(IgnoreApi = true)]
public async Task Invoke(IServiceProvider serviceProvider)
{
await this.Invoke();
}
} }

10
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/ZhiGongHBPOSeSyncAppService.cs

@ -1,8 +1,10 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Threading.Tasks;
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 Win.Sfs.SettleAccount.Entities.BQ.Vmi;
using Win.Sfs.SettleAccount.EntityFrameworkCore; using Win.Sfs.SettleAccount.EntityFrameworkCore;
using Win.Sfs.Shared.RepositoryBase; using Win.Sfs.Shared.RepositoryBase;
@ -13,7 +15,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs;
/// </summary> /// </summary>
[AllowAnonymous] [AllowAnonymous]
[Route("api/settleaccount/[controller]/[action]")] [Route("api/settleaccount/[controller]/[action]")]
public class ZhiGongHBPOSeSyncAppService : JitSeSyncAppService public class ZhiGongHBPOSeSyncAppService : JitSeSyncAppService, IJobService
{ {
/// <summary> /// <summary>
/// 构造 /// 构造
@ -35,4 +37,10 @@ public class ZhiGongHBPOSeSyncAppService : JitSeSyncAppService
BusinessType = EnumBusinessType.ZhiGongJianHBPO BusinessType = EnumBusinessType.ZhiGongJianHBPO
}; };
} }
[ApiExplorerSettings(IgnoreApi = true)]
public async Task Invoke(IServiceProvider serviceProvider)
{
await this.Invoke();
}
} }

1
code/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccountApplicationAutoMapperProfile.cs

@ -982,6 +982,7 @@ namespace Win.Sfs.SettleAccount
.ForMember(x => x.SettleBillNum, y => y.MapFrom(d => d.BillNum)); .ForMember(x => x.SettleBillNum, y => y.MapFrom(d => d.BillNum));
CreateMap<BBAC_SA_DETAIL_IMPORT_DTO, BBAC_SA_DETAIL>(); CreateMap<BBAC_SA_DETAIL_IMPORT_DTO, BBAC_SA_DETAIL>();
CreateMap<BBAC_SA_DETAIL_IMPORT_DTO, PUB_SA_DETAIL>();
} }
/// <summary> /// <summary>

9
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/HBPO_CAN_SA_MNG.cs

@ -264,6 +264,15 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
} }
/// <summary>
/// 通过发票号获取结算数据
/// </summary>
/// <param name="billNum"></param>
/// <returns></returns>
public virtual async Task<List<HBPO_CAN_SA_DETAIL>> GetDetailByInbillNumAsync(List<string> p_invs)
{
return await _detailRepository.Where(p => p_invs.Contains(p.BillNum)).ToListAsync();
}
} }

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

@ -36,8 +36,9 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
private readonly INormalEfCoreRepository<INVOICE_NOT_SETTLE, Guid> _notRepository; private readonly INormalEfCoreRepository<INVOICE_NOT_SETTLE, Guid> _notRepository;
private readonly INormalEfCoreRepository<PUB_ADJ_DETAIL, Guid> _adjRepository; private readonly INormalEfCoreRepository<PUB_ADJ_DETAIL, Guid> _adjRepository;
private readonly INormalEfCoreRepository<PUB_PD, Guid> _pdRepository; private readonly INormalEfCoreRepository<BBAC_PD, Guid> _pdbbacRepository;
private readonly INormalEfCoreRepository<HBPO_PD, Guid> _pdhbpoRepository;
private readonly INormalEfCoreRepository<PUB_PD, Guid> _pdpubRepository;
private readonly PUB_CAN_SA_MNG _pubMng; private readonly PUB_CAN_SA_MNG _pubMng;
private readonly BBAC_CAN_SA_MNG _bbacMng; private readonly BBAC_CAN_SA_MNG _bbacMng;
private readonly HBPO_CAN_SA_MNG _hbpoMng; private readonly HBPO_CAN_SA_MNG _hbpoMng;
@ -46,15 +47,17 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
PUB_CAN_SA_MNG pubMng, PUB_CAN_SA_MNG pubMng,
BBAC_CAN_SA_MNG bbacMng, BBAC_CAN_SA_MNG bbacMng,
HBPO_CAN_SA_MNG hbpoMng, HBPO_CAN_SA_MNG hbpoMng,
INormalEfCoreRepository<PUB_PD, Guid> pdRepository, INormalEfCoreRepository<BBAC_PD, Guid> pdbbacRepository,
INormalEfCoreRepository<INVOICE_GRP, Guid> repository, INormalEfCoreRepository<HBPO_PD, Guid> pdhbpoRepository,
INormalEfCoreRepository<PUB_PD, Guid> pdpubRepository,
INormalEfCoreRepository<INVOICE_GRP, Guid> repository,
INormalEfCoreRepository<INVOICE_MAP_GROUP, Guid> groupRepository, INormalEfCoreRepository<INVOICE_MAP_GROUP, Guid> groupRepository,
INormalEfCoreRepository<INVOICE_WAIT_DETAIL, Guid> detailRepository, INormalEfCoreRepository<INVOICE_WAIT_DETAIL, Guid> detailRepository,
INormalEfCoreRepository<INVOICE_NOT_SETTLE, Guid> notRepository, INormalEfCoreRepository<INVOICE_NOT_SETTLE, Guid> notRepository,
INormalEfCoreRepository<PUB_ADJ_DETAIL, Guid> adjRepository INormalEfCoreRepository<PUB_ADJ_DETAIL, Guid> adjRepository
) )
{ {
_pdRepository= pdRepository;
//_canRepository = canRepository; //_canRepository = canRepository;
_repository = repository; _repository = repository;
_detailRepository = detailRepository; _detailRepository = detailRepository;
@ -64,6 +67,9 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
_pubMng = pubMng; _pubMng = pubMng;
_bbacMng = bbacMng; _bbacMng = bbacMng;
_hbpoMng = hbpoMng; _hbpoMng = hbpoMng;
_pdbbacRepository=pdbbacRepository;
_pdhbpoRepository=pdhbpoRepository;
_pdpubRepository =pdpubRepository;
} }
public INV_MNG() public INV_MNG()
@ -303,244 +309,437 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
/// <returns></returns> /// <returns></returns>
public virtual async Task<bool> ReceivedAsync(List<string> p_invs) public virtual async Task<bool> ReceivedAsync(List<string> p_invs)
{ {
//var invList = _repository.Where(p =>p_invs.Contains(p.InvbillNum)).ToList();//所有提交发票信息
//int count = invList.Select(p => p.InvGroupNum).Count();
//if (count > 0)
//{
// throw new UserFriendlyException($"发票不属于一个发票分组");
//}
//var parentList = invList.Select(p => p.ParentInvbillNum).ToList();//父发票号
//List<string> oldinvs = new List<string>();
//oldinvs.AddRange(p_invs);
//if (parentList != null && parentList.Count > 0)
//{
// oldinvs.AddRange(parentList);
//}
//List<string> seclist = new List<string>();
//List<string> firstlist = new List<string>();
//var pdlist = _pdRepository.Where(p => oldinvs.Contains(p.BillNum)).ToList();
//if (pdlist != null && pdlist.Count > 0)
//{
// seclist = pdlist.Select(p => p.BillNum).ToList();//那些在待扣减里已经有了属于作废重开
//}
//firstlist = p_invs.Where(p => !seclist.Contains(p)).ToList();
var invList = _repository.Where(p => p_invs.Contains(p.InvbillNum)).ToList();//所有提交发票信息
int count = invList.Select(p => p.InvGroupNum).Distinct().Count();
if (count > 1)
{
throw new UserFriendlyException($"发票不属于一个发票分组");
}
var lostlist = invList.Where(p => p.InvoiceState == InvoiceBillState.).ToList();
if (lostlist.Count > 0)
{
var invs=lostlist.Select(p => p.InvbillNum).ToList();
throw new UserFriendlyException($"发票{string.Join(",",invs)}");
}
//var inv=invList.FirstOrDefault(); var inv = invList.FirstOrDefault();
//if (inv.BusinessType == EnumBusinessType.JisBBAC) if (inv.BusinessType == EnumBusinessType.JisBBAC)
//{ {
// var namelist=invList.Select(p => p.InvbillNum).ToList(); var pdlist = _pdbbacRepository.Where(p => p_invs.Contains(p.BillNum)).ToList();//包含发票号的代扣减单
// var entityDetail = await _bbacMng.GetDetailByInbillNumAsync(namelist);//结算明细 if (pdlist != null && pdlist.Count > 0)
// var adjlist=_adjRepository.Where(p => namelist.Contains(p.OldInvBillNum)).ToList();//调整表明细明细 {
var invs = pdlist.Select(p => p.BillNum).ToList();
throw new UserFriendlyException($"发票{string.Join(",", invs)}已经生成待扣减过不能再次提交");
}
var parentList = invList.Select(p => p.ParentInvbillNum).ToList();//所有发票存在父发票号
List<string> oldinvs = new List<string>();
oldinvs.AddRange(p_invs);
if (parentList != null && parentList.Count > 0)
{
oldinvs.AddRange(parentList);
}
List<string> oldlist = new List<string>();//以前提交过的发票
List<string> newlist = new List<string>();//没有提交过的发票
var pdoldlist = pdlist.Where(p => oldinvs.Contains(p.BillNum)).ToList();
if (pdoldlist != null && pdoldlist.Count > 0)
{
oldlist = pdoldlist.Select(p => p.BillNum).ToList();//已经存在扣减记录,的发票号
}
newlist = p_invs.Where(p => !oldlist.Contains(p)).ToList();//不存在扣减记录的发票号
// if (adjlist != null && adjlist.Count() > 0) List<BBAC_CAN_SA_DETAIL> entityList = new List<BBAC_CAN_SA_DETAIL>();//结算明细
// { var namelist = invList.Select(p => p.InvbillNum).ToList();
// foreach (var itm in adjlist) if (oldlist.Count > 0)
// { {
// entityDetail.Add(new BBAC_CAN_SA_DETAIL( var involdList= invList.Where(p => oldinvs.Contains(p.ParentInvbillNum)).ToList();
// guid: GuidGenerator.Create(), var involdname=involdList.Select(p => p.InvbillNum);
// keyCode: itm.KeyCode, var adjlist=_adjRepository.Where(p => involdname.Contains(p.InvBillNum));
// version: itm.Version,
// billNum: itm.InvGroupNum, if (adjlist != null && adjlist.Count() > 0)
// settleBillNum: itm.SettleBillNum, {
// lU: itm.LU, foreach (var itm in adjlist)
// pN: itm.PN, {
// site: itm.Site, entityList.Add(new BBAC_CAN_SA_DETAIL(
// qty: itm.Qty, guid: GuidGenerator.Create(),
// price: itm.Price, keyCode: itm.KeyCode,
// category: itm.BusinessType, version: itm.Version,
// isReturn: itm.Qty > 0 ? false : true, billNum: itm.InvGroupNum,
// settleDate: itm.SettleDate, settleBillNum: itm.SettleBillNum,
// groupNum: itm.GroupNum, lU: itm.LU,
// invGroupNum: itm.InvGroupNum, pN: itm.PN,
// contactid: itm.Extend1//生产号 site: itm.Site,
// )); qty: itm.Qty,
// } price: 0,
// } category: itm.BusinessType,
isReturn: itm.Qty > 0 ? false : true,
settleDate: itm.SettleDate,
groupNum: itm.GroupNum,
invGroupNum: itm.InvGroupNum,
contactid: itm.Extend1,//生产号
invbillnum: itm.InvBillNum
));
}
}
}
if (newlist.Count > 0)
{
var entitys = invList.Where(p => newlist.Contains(p.InvbillNum)).ToList();
var entityDetail = await _bbacMng.GetDetailByInbillNumAsync(newlist);//结算明细
var adjlist = _adjRepository.Where(p => newlist.Contains(p.InvBillNum)).ToList();//发票关联调整表明细
if (adjlist != null && adjlist.Count() > 0)
{
foreach (var itm in adjlist)
{
entityDetail.Add(new BBAC_CAN_SA_DETAIL(
guid: GuidGenerator.Create(),
keyCode: itm.KeyCode,
version: itm.Version,
billNum: itm.InvGroupNum,
settleBillNum: itm.SettleBillNum,
lU: itm.LU,
pN: itm.PN,
site: itm.Site,
qty: itm.Qty,
price: 0,
category: itm.BusinessType,
isReturn: itm.Qty > 0 ? false : true,
settleDate: itm.SettleDate,
groupNum: itm.GroupNum,
invGroupNum: itm.InvGroupNum,
contactid: itm.Extend1,//生产号
invbillnum: itm.InvBillNum
));
}
}
entityList.AddRange(entityDetail);
//entityDetail.GroupBy(p =>new { }
// p.LU,
// p.PN, var bbacmainlist = new List<BBAC_PD>();
// p.Site, foreach (var itm in invList)
// p.Qty, {
// p.BusinessType var bbac = new BBAC_PD(
//}).Select(p =>new BBAC_PD_DETAIL( guid: itm.Id,
version:int.Parse(DateTime.Now.ToString("yyyyMM")),
billNum: itm.InvbillNum,
settleBillNum: itm.InvGroupNum,
state: SettleBillState.,
invGroupNum: itm.InvGroupNum,
site: string.Empty
);
bbacmainlist.Add( bbac );
// guid: GuidGenerator.Create(), }
// keyCode: p.Key.PN.Trim()+p.Key.LU, var bbacDetail = new List<BBAC_PD_DETAIL>();
// version: p.Key.Version, foreach (var itm in entityList)
// billNum: string.Empty, {
// lU: p.Key.LU, bbacDetail.Add(
// rELU: string.Empty, new BBAC_PD_DETAIL(
// pN: p.Key.PN, guid: itm.Id,
// rEPN: string.Empty, keyCode: itm.KeyCode,
// site: string.Empty, version: itm.Version,
// qty:p.Sum(itm=>itm.Qty), billNum: itm.BillNum,
// price: 0, lU: itm.LU,
// invGroupNum: p.Key., rELU: string.Empty,
// settleDate: p.SettleDate, pN: itm.PN,
// groupNum: p.GroupNum, rEPN: string.Empty,
// extend1: string.Empty, site: itm.Site,
// extend2: string.Empty, qty: itm.Qty,
// extend3: string.Empty, price: 0,
// extend4: string.Empty invGroupNum: itm.InvGroupNum,
settleDate: itm.SettleDate,
groupNum: itm.GroupNum,
extend1: string.Empty,
extend2: string.Empty,
extend3: string.Empty,
extend4: string.Empty
));
}
await _repository.DbContext.BulkInsertAsync(bbacmainlist);
await _repository.DbContext.BulkInsertAsync(bbacDetail);
return true;
}
else if (inv.BusinessType == EnumBusinessType.JisHBPO)
{
var pdlist = _pdhbpoRepository.Where(p => p_invs.Contains(p.BillNum)).ToList();//包含发票号的代扣减单
if (pdlist != null && pdlist.Count > 0)
{
var invs = pdlist.Select(p => p.BillNum).ToList();
throw new UserFriendlyException($"发票{string.Join(",", invs)}已经生成待扣减过不能再次提交");
}
var parentList = invList.Select(p => p.ParentInvbillNum).ToList();//所有发票存在父发票号
List<string> oldinvs = new List<string>();
oldinvs.AddRange(p_invs);
if (parentList != null && parentList.Count > 0)
{
oldinvs.AddRange(parentList);
}
List<string> oldlist = new List<string>();//以前提交过的发票
List<string> newlist = new List<string>();//没有提交过的发票
var pdoldlist = pdlist.Where(p => oldinvs.Contains(p.BillNum)).ToList();
if (pdoldlist != null && pdoldlist.Count > 0)
{
oldlist = pdoldlist.Select(p => p.BillNum).ToList();//已经存在扣减记录,的发票号
}
newlist = p_invs.Where(p => !oldlist.Contains(p)).ToList();//不存在扣减记录的发票号
List<HBPO_CAN_SA_DETAIL> entityList = new List<HBPO_CAN_SA_DETAIL>();//结算明细
var namelist = invList.Select(p => p.InvbillNum).ToList();
if (oldlist.Count > 0)
{
var involdList = invList.Where(p => oldinvs.Contains(p.ParentInvbillNum)).ToList();
var involdname = involdList.Select(p => p.InvbillNum);
var adjlist = _adjRepository.Where(p => involdname.Contains(p.InvBillNum));
if (adjlist != null && adjlist.Count() > 0)
{
foreach (var itm in adjlist)
{
entityList.Add(new HBPO_CAN_SA_DETAIL(
guid: GuidGenerator.Create(),
keyCode: itm.KeyCode,
version: itm.Version,
billNum: itm.InvGroupNum,
settleBillNum: itm.SettleBillNum,
lU: itm.LU,
pN: itm.PN,
site: itm.Site,
qty: itm.Qty,
price: 0,
businessType: itm.BusinessType,
settleDate: itm.SettleDate,
groupNum: itm.GroupNum,
invGroupNum: itm.InvGroupNum,
invbillnum: itm.InvBillNum
));
}
}
}
if (newlist.Count > 0)
{
var entitys = invList.Where(p => newlist.Contains(p.InvbillNum)).ToList();
var entityDetail = await _hbpoMng.GetDetailByInbillNumAsync(newlist);//结算明细
var adjlist = _adjRepository.Where(p => newlist.Contains(p.InvBillNum)).ToList();//发票关联调整表明细
if (adjlist != null && adjlist.Count() > 0)
{
foreach (var itm in adjlist)
{
entityDetail.Add(new HBPO_CAN_SA_DETAIL(
guid: GuidGenerator.Create(),
keyCode: itm.KeyCode,
version: itm.Version,
billNum: itm.InvGroupNum,
settleBillNum: itm.SettleBillNum,
lU: itm.LU,
pN: itm.PN,
site: itm.Site,
qty: itm.Qty,
price: 0,
businessType: itm.BusinessType,
settleDate: itm.SettleDate,
groupNum: itm.GroupNum,
invGroupNum: itm.InvGroupNum,
invbillnum: itm.InvBillNum
));
}
}
entityList.AddRange(entityDetail);
//); }
var bbacmainlist = new List<HBPO_PD>();
foreach (var itm in invList)
{
var bbac = new HBPO_PD(
guid: itm.Id,
version: int.Parse(DateTime.Now.ToString("yyyyMM")),
billNum: itm.InvbillNum,
settleBillNum: itm.InvGroupNum,
state: SettleBillState.,
invGroupNum: itm.InvGroupNum,
site: string.Empty
);
bbacmainlist.Add(bbac);
}
var bbacDetail = new List<HBPO_PD_DETAIL>();
foreach (var itm in entityList)
{
bbacDetail.Add(
new HBPO_PD_DETAIL(
guid: itm.Id,
keyCode: itm.KeyCode,
version: itm.Version,
billNum: itm.BillNum,
lU: itm.LU,
rELU: string.Empty,
pN: itm.PN,
rEPN: string.Empty,
site: itm.Site,
qty: itm.Qty,
price: 0,
invGroupNum: itm.InvGroupNum,
settleDate: itm.SettleDate,
groupNum: itm.GroupNum,
extend1: string.Empty,
extend2: string.Empty,
extend3: string.Empty,
extend4: string.Empty
));
}
await _repository.DbContext.BulkInsertAsync(bbacmainlist);
await _repository.DbContext.BulkInsertAsync(bbacDetail);
return true;
}
else
{
var pdlist = _pdpubRepository.Where(p => p_invs.Contains(p.BillNum)).ToList();//包含发票号的代扣减单
if (pdlist != null && pdlist.Count > 0)
{
var invs = pdlist.Select(p => p.BillNum).ToList();
throw new UserFriendlyException($"发票{string.Join(",", invs)}已经生成待扣减过不能再次提交");
}
var parentList = invList.Select(p => p.ParentInvbillNum).ToList();//所有发票存在父发票号
List<string> oldinvs = new List<string>();
oldinvs.AddRange(p_invs);
if (parentList != null && parentList.Count > 0)
{
oldinvs.AddRange(parentList);
}
List<string> oldlist = new List<string>();//以前提交过的发票
List<string> newlist = new List<string>();//没有提交过的发票
var pdoldlist = pdlist.Where(p => oldinvs.Contains(p.BillNum)).ToList();
if (pdoldlist != null && pdoldlist.Count > 0)
{
oldlist = pdoldlist.Select(p => p.BillNum).ToList();//已经存在扣减记录,的发票号
}
newlist = p_invs.Where(p => !oldlist.Contains(p)).ToList();//不存在扣减记录的发票号
List<PUB_CAN_SA_DETAIL> entityList = new List<PUB_CAN_SA_DETAIL>();//结算明细
var namelist = invList.Select(p => p.InvbillNum).ToList();
if (oldlist.Count > 0)
{
var involdList = invList.Where(p => oldinvs.Contains(p.ParentInvbillNum)).ToList();
var involdname = involdList.Select(p => p.InvbillNum);
var adjlist = _adjRepository.Where(p => involdname.Contains(p.InvBillNum));
if (adjlist != null && adjlist.Count() > 0)
{
foreach (var itm in adjlist)
{
entityList.Add(new PUB_CAN_SA_DETAIL(
guid: GuidGenerator.Create(),
keyCode: itm.KeyCode,
version: itm.Version,
billNum: itm.InvGroupNum,
settleBillNum: itm.SettleBillNum,
lU: itm.LU,
pN: itm.PN,
site: itm.Site,
qty: itm.Qty,
price: 0,
businessType: itm.BusinessType,
settleDate: itm.SettleDate,
groupNum: itm.GroupNum,
invGroupNum: itm.InvGroupNum,
invbillnum: itm.InvBillNum
));
}
}
}
if (newlist.Count > 0)
{
var entitys = invList.Where(p => newlist.Contains(p.InvbillNum)).ToList();
var entityDetail = await _pubMng.GetDetailByInbillNumAsync(newlist);//结算明细
var adjlist = _adjRepository.Where(p => newlist.Contains(p.InvBillNum)).ToList();//发票关联调整表明细
if (adjlist != null && adjlist.Count() > 0)
{
foreach (var itm in adjlist)
{
entityDetail.Add(new PUB_CAN_SA_DETAIL(
guid: GuidGenerator.Create(),
keyCode: itm.KeyCode,
version: itm.Version,
billNum: itm.InvGroupNum,
settleBillNum: itm.SettleBillNum,
lU: itm.LU,
pN: itm.PN,
site: itm.Site,
qty: itm.Qty,
price: 0,
businessType: itm.BusinessType,
settleDate: itm.SettleDate,
groupNum: itm.GroupNum,
invGroupNum: itm.InvGroupNum,
invbillnum: itm.InvBillNum
));
}
}
entityList.AddRange(entityDetail);
// var bbac = new BBAC_PD( }
// guid: entity.Id,
// version: entity.Version,
// billNum: entity.BillNum,
// settleBillNum: entity.SettleBillNum,
// state: SettleBillState.客户已收票,
// invGroupNum: entity.InvGroupNum,
// site: entity.Site
// );
// var bbacDetail = new List<BBAC_PD_DETAIL>();
// foreach (var itm in entityDetail) var bbacmainlist = new List<PUB_PD>();
// { foreach (var itm in invList)
// bbacDetail.Add( {
// new BBAC_PD_DETAIL( var pub = new PUB_PD(
// guid: itm.Id, guid: itm.Id,
// keyCode: itm.KeyCode, version: int.Parse(DateTime.Now.ToString("yyyyMM")),
// version: itm.Version, billNum: itm.InvbillNum,
// billNum: itm.BillNum, settleBillNum: itm.InvGroupNum,
// lU: itm.LU, state: SettleBillState.,
// rELU: string.Empty, invGroupNum: itm.InvGroupNum,
// pN: itm.PN, site: string.Empty
// rEPN: string.Empty, );
// site: itm.Site, bbacmainlist.Add(pub);
// qty: itm.Qty,
// price: itm.Price,
// invGroupNum: itm.InvGroupNum,
// settleDate: itm.SettleDate,
// groupNum: itm.GroupNum,
// extend1: string.Empty,
// extend2: string.Empty,
// extend3: string.Empty,
// extend4: string.Empty
// ));
// await _repository.DbContext.BulkInsertAsync(new List<BBAC_PD>() { bbac });
// await _repository.DbContext.BulkInsertAsync(bbacDetail);
// return true;
// }
//} }
//else if (inv.BusinessType == EnumBusinessType.JisHBPO) var bbacDetail = new List<PUB_PD_DETAIL>();
//{ foreach (var itm in entityList)
// var entity = await _hbpoMng.GetMainAsync(inv.InvGroupNum); {
// if (entity != null) bbacDetail.Add(
// { new PUB_PD_DETAIL(
guid: itm.Id,
keyCode: itm.KeyCode,
version: itm.Version,
billNum: itm.BillNum,
lU: itm.LU,
rELU: string.Empty,
pN: itm.PN,
rEPN: string.Empty,
site: itm.Site,
qty: itm.Qty,
price: 0,
businessType:itm.BusinessType,
invGroupNum: itm.InvGroupNum,
settleDate: itm.SettleDate,
groupNum: itm.GroupNum,
extend1: string.Empty,
extend2: string.Empty,
extend3: string.Empty,
extend4: string.Empty
));
}
await _repository.DbContext.BulkInsertAsync(bbacmainlist);
await _repository.DbContext.BulkInsertAsync(bbacDetail);
return true;
// var entityDetail = await _hbpoMng.GetDetalListAsync(inv.InvGroupNum); }
// if (entityDetail != null && entityDetail.Count() > 0)
// {
// var hbpo = new HBPO_PD(
// guid: entity.Id,
// version: entity.Version,
// billNum: entity.BillNum,
// settleBillNum: entity.SettleBillNum,
// state: SettleBillState.客户已收票,
// invGroupNum: entity.InvGroupNum,
// site: entity.Site
// );
// var hbpoDetail = new List<HBPO_PD_DETAIL>();
// foreach (var itm in entityDetail)
// {
// hbpoDetail.Add(
// new HBPO_PD_DETAIL(
// guid: itm.Id,
// keyCode: itm.KeyCode,
// version: itm.Version,
// billNum: itm.BillNum,
// lU: itm.LU,
// rELU: string.Empty,
// pN: itm.PN,
// rEPN: string.Empty,
// site: itm.Site,
// qty: itm.Qty,
// price: itm.Price,
// invGroupNum: itm.InvGroupNum,
// settleDate: itm.SettleDate,
// groupNum: itm.GroupNum,
// extend1: string.Empty,
// extend2: string.Empty,
// extend3: string.Empty,
// extend4: string.Empty
// ));
// }
// await _repository.DbContext.BulkInsertAsync(new List<HBPO_PD>() { hbpo });
// await _repository.DbContext.BulkInsertAsync(hbpoDetail);
// return true;
// }
// }
//}
//else
//{
// var entity = await _pubMng.GetMainAsync(inv.InvGroupNum);
// if (entity != null)
// {
// var entityDetail = await _pubMng.GetDetalListAsync(inv.InvGroupNum);
// if (entityDetail != null && entityDetail.Count() > 0)
// {
// var pub = new PUB_PD(
// guid: entity.Id,
// version: entity.Version,
// billNum: entity.BillNum,
// settleBillNum: entity.SettleBillNum,
// state: SettleBillState.客户已收票,
// invGroupNum: entity.InvGroupNum,
// site: entity.Site
// );
// var pubDetail = new List<PUB_PD_DETAIL>();
// foreach (var itm in entityDetail)
// {
// pubDetail.Add(
// new PUB_PD_DETAIL(
// guid: itm.Id,
// keyCode: itm.KeyCode,
// version: itm.Version,
// billNum: itm.BillNum,
// lU: itm.LU,
// rELU: string.Empty,
// pN: itm.PN,
// rEPN: string.Empty,
// site: itm.Site,
// qty: itm.Qty,
// price: itm.Price,
// invGroupNum: itm.InvGroupNum,
// settleDate: itm.SettleDate,
// groupNum: itm.GroupNum,
// extend1: string.Empty,
// extend2: string.Empty,
// extend3: string.Empty,
// extend4: string.Empty,
// businessType: itm.BusinessType
// ));
// }
// await _repository.DbContext.BulkInsertAsync(new List<PUB_PD>() { pub });
// await _repository.DbContext.BulkInsertAsync(pubDetail);
// return true;
// }
// }
//}
return false; return false;
} }
public virtual async Task<bool> Reject(INVOICE_GRP p_entity) public virtual async Task<bool> Reject(INVOICE_GRP p_entity)
@ -762,7 +961,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
select itm2; select itm2;
foreach (var itm in query) foreach (var itm in query)
{ {
itm.BillNum = key; itm.InvbillNum = key;
salist.Add(itm); salist.Add(itm);
} }
if (!string.IsNullOrEmpty(p_parentInvBillNum)) if (!string.IsNullOrEmpty(p_parentInvBillNum))
@ -989,10 +1188,8 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
select itm2; select itm2;
foreach (var itm in query) foreach (var itm in query)
{ {
itm.BillNum = key; itm.InvbillNum = key;
salist.Add(itm); salist.Add(itm);
} }
if (!string.IsNullOrEmpty(p_parentInvBillNum)) if (!string.IsNullOrEmpty(p_parentInvBillNum))
{ {
@ -1177,7 +1374,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
var invdetails = p_list.Where(p => ls.Contains(p.GroupNum)).ToList(); var invdetails = p_list.Where(p => ls.Contains(p.GroupNum)).ToList();
foreach (var detail in invdetails) foreach (var detail in invdetails)
{ {
detail.BillNum = key; detail.InvbillNum = key;
salist.Add(detail); salist.Add(detail);
} }
if (!string.IsNullOrEmpty(p_parentInvBillNum)) if (!string.IsNullOrEmpty(p_parentInvBillNum))
@ -1351,12 +1548,12 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
return false; return false;
} }
foreach (var adj in p_adjlist) //foreach (var adj in p_adjlist)
{ //{
adj.InvBillNum = string.Join(",", invlist);//调整单更新发票信息 // adj.InvBillNum = string.Join(",", invlist);//调整单更新发票信息
} //}
_repository.DbContext.BulkUpdate(p_adjlist); //_repository.DbContext.BulkUpdate(p_adjlist);
_repository.DbContext.BulkUpdate(new List<INVOICE_GRP> { inv }); _repository.DbContext.BulkUpdate(new List<INVOICE_GRP> { inv });
return true; return true;
@ -1408,7 +1605,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
//{ //{
// adj.InvBillNum = string.Join(",", invlist); // adj.InvBillNum = string.Join(",", invlist);
//} //}
_repository.DbContext.BulkUpdate(p_adjlist); //_repository.DbContext.BulkUpdate(p_adjlist);
return true; return true;
} }
return false; return false;

9
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/PUB_CAN_SA_MNG.cs

@ -256,6 +256,15 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
/// <summary>
/// 通过发票号获取结算数据
/// </summary>
/// <param name="billNum"></param>
/// <returns></returns>
public virtual async Task<List<PUB_CAN_SA_DETAIL>> GetDetailByInbillNumAsync(List<string> p_invs)
{
return await _detailRepository.Where(p => p_invs.Contains(p.BillNum)).ToListAsync();
}
} }

169
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/PubSaSeCompareDiff.cs

@ -1,5 +1,5 @@
using System.ComponentModel.DataAnnotations;
using System; using System;
using System.ComponentModel.DataAnnotations;
using Magicodes.ExporterAndImporter.Core; using Magicodes.ExporterAndImporter.Core;
using Magicodes.ExporterAndImporter.Excel; using Magicodes.ExporterAndImporter.Excel;
using Win.Sfs.SettleAccount.Enums; using Win.Sfs.SettleAccount.Enums;
@ -290,145 +290,42 @@ public class PubSaSeCompareSumExport
public decimal DiffQty => SAQty - SEQty; public decimal DiffQty => SAQty - SEQty;
} }
/// <summary>
/// 直供件BBAC结算与发运对比明细
/// </summary>
[ExcelExporter(MaxRowNumberOnASheet = 900000)] [ExcelExporter(MaxRowNumberOnASheet = 900000)]
public class PubSaSeCompareDiffExport222 public class PubSaSeCompareDetailExportZhiGongJianBBAC : PubSaSeCompareDetailExport
{ {
/// <summary> }
/// 有结算无发货(无EDI数据)
///有结算无发货(有EDI数据)
///有结算有发货(无EDI数据)
///有结算有发货(无价格信息)
///有结算有发货(有EDI数据)
///无结算有发货(有EDI数据)
///无结算有发货(无EDI数据)
///有结算有发货(有EDI数据)
///有结算有发货(WMS多发)
/// </summary>
[Display(Name = "类别")]
public string Category { get; set; }
[Display(Name = "Wms发货单号")]
public string WmsBillNum { get; set; }
[Display(Name = "发货日期")]
public DateTime ShippingDate { get; set; }
[Display(Name = "生产码")]
public string PN { get; set; }
[Display(Name = "物料号")]
public string MaterialNumber { get; set; }
[Display(Name = "物料描述")]
public string MaterialDes { get; set; }
[Display(Name = "原始LU")]
public string PrimitiveLU { get; set; }
[Display(Name = "替换LU")]
public string ReplaceLU { get; set; }
/// <summary>
/// 结算数据中的过账日期
/// </summary>
[Display(Name = "客户下线时间")]
public DateTime CustomerOfflineTime { get; set; }
[Display(Name = "结算数量")]
public decimal SAQty { get; set; }
[Display(Name = "发货数量")]
public decimal SEQty { get; set; }
/// <summary>
/// 差异数量
/// </summary>
[ExporterHeader(DisplayName = "差异数量")]
public decimal DiffQty { set; get; }
[Display(Name = "匹配类型")]
public string MateType { get; set; }
[Display(Name = "定价")]
public decimal FixPrice { get; set; }
[Display(Name = "PJIS日顺序号")]
public string PJISSeqNumber { get; set; }
[Display(Name = "日顺序号")]
public string SeqNumber { get; set; }
//[Display(Name = "零件号")]
//public string LU { get; set; } = null!;
[Display(Name = "小总成号")]
public string AssemblyCode { get; set; }
[Display(Name = "注塑码")]
public string InjectionCode { get; set; }
[Display(Name = "期间")]
public int Version { get; set; }
[Display(Name = "替换零件号")]
public string RepLU { get; set; }
/// <summary>
/// 零件号
/// </summary>
[ExporterHeader(DisplayName = "零件号")]
public string SeLU { set; get; }
/// <summary>
/// 生产号
/// </summary>
[ExporterHeader(DisplayName = "生产号")]
public string SePN { set; get; }
/// <summary>
/// 零件号
/// </summary>
[ExporterHeader(DisplayName = "零件号")]
public string SaLU { set; get; }
/// <summary>
/// 生产号
/// </summary>
[ExporterHeader(DisplayName = "生产号")]
public string SaPN { set; get; }
/// <summary> /// <summary>
/// 结算数量 /// 直供件HBPO结算与发运对比明细
/// </summary> /// </summary>
[ExporterHeader(DisplayName = "结算数量")] [ExcelExporter(MaxRowNumberOnASheet = 900000)]
public decimal SaQty { set; get; } public class PubSaSeCompareDetailExportZhiGongJianHBPO : PubSaSeCompareDetailExport
{
}
/// <summary> /// <summary>
/// 发运数量 /// 买单件HBPO结算与发运对比明细
/// </summary> /// </summary>
[ExporterHeader(DisplayName = "发运数量")] [ExcelExporter(MaxRowNumberOnASheet = 900000)]
public decimal SeQty { set; get; } public class PubSaSeCompareDetailExportMaiDanJianHBPO : PubSaSeCompareDetailExport
{
}
/// <summary>
/// 备件结算与发运对比明细
/// </summary>
[ExcelExporter(MaxRowNumberOnASheet = 900000)]
public class PubSaSeCompareDetailExportBeiJian : PubSaSeCompareDetailExport
{
}
/// <summary>
/// 印度件结算与发运对比明细
/// </summary>
[ExcelExporter(MaxRowNumberOnASheet = 900000)]
public class PubSaSeCompareDetailExportYinDuJian : PubSaSeCompareDetailExport
{
} }

60
code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/EntityFrameworkCore/SettleAccountDbContextModelCreatingExtensions.cs

@ -107,6 +107,9 @@ namespace Win.Sfs.SettleAccount
builder.ConfigurePUB_ADJ_DETAIL(options); builder.ConfigurePUB_ADJ_DETAIL(options);
builder.ConfigureBBAC_ADJ_DETAIL(options); builder.ConfigureBBAC_ADJ_DETAIL(options);
builder.ConfigureHBPO_ADJ_DETAIL(options); builder.ConfigureHBPO_ADJ_DETAIL(options);
builder.ConfigureBBAC_PD(options);
builder.ConfigureHBPO_PD(options);
builder.ConfigurePUB_PD(options);
//大众发票导入 //大众发票导入
//builder.ConfigureInvoice(options); //builder.ConfigureInvoice(options);
//builder.ConfigureInvoiceVersion(options); //builder.ConfigureInvoiceVersion(options);
@ -1209,6 +1212,57 @@ namespace Win.Sfs.SettleAccount
b.Property(x => x.ConcurrencyStamp).HasMaxLength(50); b.Property(x => x.ConcurrencyStamp).HasMaxLength(50);
}); });
} }
private static void ConfigureBBAC_PD(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options)
{
builder.Entity<BBAC_PD>(b =>
{
b.ToTable($"{options.TablePrefix}_BBAC_PD", options.Schema);
b.ConfigureByConvention();
b.Property(x => x.BillNum).HasMaxLength(50);
b.Property(x => x.SettleBillNum).HasMaxLength(50);
b.Property(x => x.InvGroupNum).HasMaxLength(50);
b.Property(x => x.Site).HasMaxLength(50);
b.Property(x => x.ConcurrencyStamp).HasMaxLength(50);
});
}
private static void ConfigureHBPO_PD(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options)
{
builder.Entity<HBPO_PD>(b =>
{
b.ToTable($"{options.TablePrefix}_HBPO_PD", options.Schema);
b.ConfigureByConvention();
b.Property(x => x.BillNum).HasMaxLength(50);
b.Property(x => x.SettleBillNum).HasMaxLength(50);
b.Property(x => x.InvGroupNum).HasMaxLength(50);
b.Property(x => x.Site).HasMaxLength(50);
b.Property(x => x.ConcurrencyStamp).HasMaxLength(50);
});
}
private static void ConfigurePUB_PD(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options)
{
builder.Entity<PUB_PD>(b =>
{
b.ToTable($"{options.TablePrefix}_PUB_PD", options.Schema);
b.ConfigureByConvention();
b.Property(x => x.BillNum).HasMaxLength(50);
b.Property(x => x.SettleBillNum).HasMaxLength(50);
b.Property(x => x.InvGroupNum).HasMaxLength(50);
b.Property(x => x.Site).HasMaxLength(50);
b.Property(x => x.ConcurrencyStamp).HasMaxLength(50);
});
}
private static void ConfigureBBAC_ADJ_DETAIL(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options) private static void ConfigureBBAC_ADJ_DETAIL(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options)
{ {
@ -1283,6 +1337,12 @@ namespace Win.Sfs.SettleAccount
//seed //seed
builder.Entity<JobItem>().HasData(new JobItem("vmi".ToGuid()) { Name = "库存快照", Cron = "0 0 8 26 *", Service = "Win.Sfs.SettleAccount.Entities.BQ.VmiAppService" }); builder.Entity<JobItem>().HasData(new JobItem("vmi".ToGuid()) { Name = "库存快照", Cron = "0 0 8 26 *", Service = "Win.Sfs.SettleAccount.Entities.BQ.VmiAppService" });
builder.Entity<JobItem>().HasData(new JobItem("BBACSeSync".ToGuid()) { Name = "BBAC发运数据同步", Cron = "0 0/10 * * * ? ", Service = "Win.Sfs.SettleAccount.Entities.BQ.Syncs.BBACSeSyncAppService" });
builder.Entity<JobItem>().HasData(new JobItem("HBPOSeSync".ToGuid()) { Name = "HBPO发运数据同步", Cron = "0 0/10 * * * ? ", Service = "Win.Sfs.SettleAccount.Entities.BQ.Syncs.HBPOSeSyncAppService" });
builder.Entity<JobItem>().HasData(new JobItem("ZhiGongBBACSeSync".ToGuid()) { Name = "直供件BBAC发运同步", Cron = "0 0/10 * * * ? ", Service = "Win.Sfs.SettleAccount.Entities.BQ.Syncs.ZhiGongBBACSeSyncAppService" });
builder.Entity<JobItem>().HasData(new JobItem("ZhiGongHBPOSeSync".ToGuid()) { Name = "直供件HBPO发运同步", Cron = "0 0/10 * * * ? ", Service = "Win.Sfs.SettleAccount.Entities.BQ.Syncs.ZhiGongHBPOSeSyncAppService" });
builder.Entity<JobItem>().HasData(new JobItem("BeiSeSync".ToGuid()) { Name = "备件发运同步", Cron = "0 0/10 * * * ? ", Service = "Win.Sfs.SettleAccount.Entities.BQ.Syncs.BeiSeSyncAppService" });
builder.Entity<JobItem>().HasData(new JobItem("YinDuSeSync".ToGuid()) { Name = "印度件发运同步", Cron = "0 0/10 * * * ? ", Service = "Win.Sfs.SettleAccount.Entities.BQ.Syncs.YinDuSeSyncAppService" });
//builder.Entity<VmiCategory>().HasData(new VmiCategory("发运入库".ToGuid()) { Type = VmiType.In, Name = "发运入库", Number = "100" }); //builder.Entity<VmiCategory>().HasData(new VmiCategory("发运入库".ToGuid()) { Type = VmiType.In, Name = "发运入库", Number = "100" });
//builder.Entity<VmiCategory>().HasData(new VmiCategory("结算出库".ToGuid()) { Type = VmiType.Out, Name = "结算出库", Number = "200" }); //builder.Entity<VmiCategory>().HasData(new VmiCategory("结算出库".ToGuid()) { Type = VmiType.Out, Name = "结算出库", Number = "200" });
//builder.Entity<VmiCategory>().HasData(new VmiCategory("客户退货".ToGuid()) { Type = VmiType.Out, Name = "客户退货", Number = "300" }); //builder.Entity<VmiCategory>().HasData(new VmiCategory("客户退货".ToGuid()) { Type = VmiType.Out, Name = "客户退货", Number = "300" });

5279
code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/20230808023302_202308080001.Designer.cs

File diff suppressed because it is too large

106
code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/20230808023302_202308080001.cs

@ -0,0 +1,106 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
namespace Win.Sfs.SettleAccount.Migrations
{
public partial class _202308080001 : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "Set_BBAC_PD",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
ExtraProperties = table.Column<string>(type: "nvarchar(max)", nullable: true),
ConcurrencyStamp = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
CreatorId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
LastModificationTime = table.Column<DateTime>(type: "datetime2", nullable: true),
LastModifierId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
IsDeleted = table.Column<bool>(type: "bit", nullable: false, defaultValue: false),
DeleterId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
DeletionTime = table.Column<DateTime>(type: "datetime2", nullable: true),
Version = table.Column<int>(type: "int", nullable: false),
BillNum = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
SettleBillNum = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
State = table.Column<int>(type: "int", nullable: false),
InvGroupNum = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
Site = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Set_BBAC_PD", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Set_HBPO_PD",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
ExtraProperties = table.Column<string>(type: "nvarchar(max)", nullable: true),
ConcurrencyStamp = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
CreatorId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
LastModificationTime = table.Column<DateTime>(type: "datetime2", nullable: true),
LastModifierId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
IsDeleted = table.Column<bool>(type: "bit", nullable: false, defaultValue: false),
DeleterId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
DeletionTime = table.Column<DateTime>(type: "datetime2", nullable: true),
Version = table.Column<int>(type: "int", nullable: false),
BillNum = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
SettleBillNum = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
State = table.Column<int>(type: "int", nullable: false),
InvGroupNum = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
Site = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Set_HBPO_PD", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Set_PUB_PD",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
ExtraProperties = table.Column<string>(type: "nvarchar(max)", nullable: true),
ConcurrencyStamp = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
CreatorId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
LastModificationTime = table.Column<DateTime>(type: "datetime2", nullable: true),
LastModifierId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
IsDeleted = table.Column<bool>(type: "bit", nullable: false, defaultValue: false),
DeleterId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
DeletionTime = table.Column<DateTime>(type: "datetime2", nullable: true),
Version = table.Column<int>(type: "int", nullable: false),
BillNum = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
SettleBillNum = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
State = table.Column<int>(type: "int", nullable: false),
InvGroupNum = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
Site = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Set_PUB_PD", x => x.Id);
});
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "Set_BBAC_PD");
migrationBuilder.DropTable(
name: "Set_HBPO_PD");
migrationBuilder.DropTable(
name: "Set_PUB_PD");
}
}
}

5288
code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/20230808055821_20230808-1.Designer.cs

File diff suppressed because it is too large

38
code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/20230808055821_20230808-1.cs

@ -0,0 +1,38 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
namespace Win.Sfs.SettleAccount.Migrations
{
public partial class _202308081 : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.InsertData(
table: "Set_JobItem",
columns: new[] { "Id", "Cron", "HeartBeat", "IsDisabled", "IsRunning", "Name", "Service" },
values: new object[] { new Guid("f306b380-47e5-5c01-b902-67ca4113a8f4"), "0 0/30 * * * ? ", null, false, false, "直供件BBAC发运同步", "Win.Sfs.SettleAccount.Entities.BQ.Syncs.ZhiGongBBACSeSyncAppService" });
migrationBuilder.UpdateData(
table: "Set_VmiBalance",
keyColumn: "Id",
keyValue: new Guid("ea936b34-ecd0-7dbd-85a9-57cd8b730873"),
column: "ConcurrencyStamp",
value: "210607a13a294958a95ea0faddc6eb65");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DeleteData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("f306b380-47e5-5c01-b902-67ca4113a8f4"));
migrationBuilder.UpdateData(
table: "Set_VmiBalance",
keyColumn: "Id",
keyValue: new Guid("ea936b34-ecd0-7dbd-85a9-57cd8b730873"),
column: "ConcurrencyStamp",
value: "f0b58114c8bf4491b657f275bd0631b0");
}
}
}

5333
code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/20230808062331_20230808-2.Designer.cs

File diff suppressed because it is too large

79
code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/20230808062331_20230808-2.cs

@ -0,0 +1,79 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
namespace Win.Sfs.SettleAccount.Migrations
{
public partial class _202308082 : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("f306b380-47e5-5c01-b902-67ca4113a8f4"),
column: "Cron",
value: "0 0/10 * * * ? ");
migrationBuilder.InsertData(
table: "Set_JobItem",
columns: new[] { "Id", "Cron", "HeartBeat", "IsDisabled", "IsRunning", "Name", "Service" },
values: new object[,]
{
{ new Guid("d6d5e1d7-9326-ceea-eed4-fb4039e7ee68"), "0 0/10 * * * ? ", null, false, false, "BBAC发运数据同步", "Win.Sfs.SettleAccount.Entities.BQ.Syncs.BBACSeSyncAppService" },
{ new Guid("d50400b0-b0d4-38d1-fcdf-b1e7ac1d3a68"), "0 0/10 * * * ? ", null, false, false, "HBPO发运数据同步", "Win.Sfs.SettleAccount.Entities.BQ.Syncs.HBPOSeSyncAppService" },
{ new Guid("8f7dc23d-e2e9-3691-cfe9-545bb958e3f2"), "0 0/10 * * * ? ", null, false, false, "直供件HBPO发运同步", "Win.Sfs.SettleAccount.Entities.BQ.Syncs.ZhiGongHBPOSeSyncAppService" },
{ new Guid("c1f71240-1b81-0107-8b23-ddc9811a3efe"), "0 0/10 * * * ? ", null, false, false, "备件发运同步", "Win.Sfs.SettleAccount.Entities.BQ.Syncs.BeiSeSyncAppService" },
{ new Guid("c09c23ea-815f-1b43-4476-2365a8d9a60b"), "0 0/10 * * * ? ", null, false, false, "印度件发运同步", "Win.Sfs.SettleAccount.Entities.BQ.Syncs.YinDuSeSyncAppService" }
});
migrationBuilder.UpdateData(
table: "Set_VmiBalance",
keyColumn: "Id",
keyValue: new Guid("ea936b34-ecd0-7dbd-85a9-57cd8b730873"),
column: "ConcurrencyStamp",
value: "7ee5d3ed981d4f87963af8b5654cd9df");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DeleteData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("8f7dc23d-e2e9-3691-cfe9-545bb958e3f2"));
migrationBuilder.DeleteData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("c09c23ea-815f-1b43-4476-2365a8d9a60b"));
migrationBuilder.DeleteData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("c1f71240-1b81-0107-8b23-ddc9811a3efe"));
migrationBuilder.DeleteData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("d50400b0-b0d4-38d1-fcdf-b1e7ac1d3a68"));
migrationBuilder.DeleteData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("d6d5e1d7-9326-ceea-eed4-fb4039e7ee68"));
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("f306b380-47e5-5c01-b902-67ca4113a8f4"),
column: "Cron",
value: "0 0/30 * * * ? ");
migrationBuilder.UpdateData(
table: "Set_VmiBalance",
keyColumn: "Id",
keyValue: new Guid("ea936b34-ecd0-7dbd-85a9-57cd8b730873"),
column: "ConcurrencyStamp",
value: "210607a13a294958a95ea0faddc6eb65");
}
}
}

278
code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/SettleAccountDbContextModelSnapshot.cs

@ -264,6 +264,79 @@ namespace Win.Sfs.SettleAccount.Migrations
b.ToTable("Set_BBAC_NOT_SA_DETAIL"); b.ToTable("Set_BBAC_NOT_SA_DETAIL");
}); });
modelBuilder.Entity("SettleAccount.Domain.BQ.BBAC_PD", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier");
b.Property<string>("BillNum")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasMaxLength(50)
.HasColumnType("nvarchar(50)")
.HasColumnName("ConcurrencyStamp");
b.Property<DateTime>("CreationTime")
.HasColumnType("datetime2")
.HasColumnName("CreationTime");
b.Property<Guid?>("CreatorId")
.HasColumnType("uniqueidentifier")
.HasColumnName("CreatorId");
b.Property<Guid?>("DeleterId")
.HasColumnType("uniqueidentifier")
.HasColumnName("DeleterId");
b.Property<DateTime?>("DeletionTime")
.HasColumnType("datetime2")
.HasColumnName("DeletionTime");
b.Property<string>("ExtraProperties")
.HasColumnType("nvarchar(max)")
.HasColumnName("ExtraProperties");
b.Property<string>("InvGroupNum")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<bool>("IsDeleted")
.ValueGeneratedOnAdd()
.HasColumnType("bit")
.HasDefaultValue(false)
.HasColumnName("IsDeleted");
b.Property<DateTime?>("LastModificationTime")
.HasColumnType("datetime2")
.HasColumnName("LastModificationTime");
b.Property<Guid?>("LastModifierId")
.HasColumnType("uniqueidentifier")
.HasColumnName("LastModifierId");
b.Property<string>("SettleBillNum")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("Site")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<int>("State")
.HasColumnType("int");
b.Property<int>("Version")
.HasColumnType("int");
b.HasKey("Id");
b.ToTable("Set_BBAC_PD");
});
modelBuilder.Entity("SettleAccount.Domain.BQ.BBAC_PD_DETAIL", b => modelBuilder.Entity("SettleAccount.Domain.BQ.BBAC_PD_DETAIL", b =>
{ {
b.Property<Guid>("Id") b.Property<Guid>("Id")
@ -1311,6 +1384,79 @@ namespace Win.Sfs.SettleAccount.Migrations
b.ToTable("Set_HBPO_NOT_SA_DETAIL"); b.ToTable("Set_HBPO_NOT_SA_DETAIL");
}); });
modelBuilder.Entity("SettleAccount.Domain.BQ.HBPO_PD", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier");
b.Property<string>("BillNum")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasMaxLength(50)
.HasColumnType("nvarchar(50)")
.HasColumnName("ConcurrencyStamp");
b.Property<DateTime>("CreationTime")
.HasColumnType("datetime2")
.HasColumnName("CreationTime");
b.Property<Guid?>("CreatorId")
.HasColumnType("uniqueidentifier")
.HasColumnName("CreatorId");
b.Property<Guid?>("DeleterId")
.HasColumnType("uniqueidentifier")
.HasColumnName("DeleterId");
b.Property<DateTime?>("DeletionTime")
.HasColumnType("datetime2")
.HasColumnName("DeletionTime");
b.Property<string>("ExtraProperties")
.HasColumnType("nvarchar(max)")
.HasColumnName("ExtraProperties");
b.Property<string>("InvGroupNum")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<bool>("IsDeleted")
.ValueGeneratedOnAdd()
.HasColumnType("bit")
.HasDefaultValue(false)
.HasColumnName("IsDeleted");
b.Property<DateTime?>("LastModificationTime")
.HasColumnType("datetime2")
.HasColumnName("LastModificationTime");
b.Property<Guid?>("LastModifierId")
.HasColumnType("uniqueidentifier")
.HasColumnName("LastModifierId");
b.Property<string>("SettleBillNum")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("Site")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<int>("State")
.HasColumnType("int");
b.Property<int>("Version")
.HasColumnType("int");
b.HasKey("Id");
b.ToTable("Set_HBPO_PD");
});
modelBuilder.Entity("SettleAccount.Domain.BQ.HBPO_PD_DETAIL", b => modelBuilder.Entity("SettleAccount.Domain.BQ.HBPO_PD_DETAIL", b =>
{ {
b.Property<Guid>("Id") b.Property<Guid>("Id")
@ -2848,6 +2994,79 @@ namespace Win.Sfs.SettleAccount.Migrations
b.ToTable("Set_PUB_NOT_SA_DETAIL"); b.ToTable("Set_PUB_NOT_SA_DETAIL");
}); });
modelBuilder.Entity("SettleAccount.Domain.BQ.PUB_PD", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier");
b.Property<string>("BillNum")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasMaxLength(50)
.HasColumnType("nvarchar(50)")
.HasColumnName("ConcurrencyStamp");
b.Property<DateTime>("CreationTime")
.HasColumnType("datetime2")
.HasColumnName("CreationTime");
b.Property<Guid?>("CreatorId")
.HasColumnType("uniqueidentifier")
.HasColumnName("CreatorId");
b.Property<Guid?>("DeleterId")
.HasColumnType("uniqueidentifier")
.HasColumnName("DeleterId");
b.Property<DateTime?>("DeletionTime")
.HasColumnType("datetime2")
.HasColumnName("DeletionTime");
b.Property<string>("ExtraProperties")
.HasColumnType("nvarchar(max)")
.HasColumnName("ExtraProperties");
b.Property<string>("InvGroupNum")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<bool>("IsDeleted")
.ValueGeneratedOnAdd()
.HasColumnType("bit")
.HasDefaultValue(false)
.HasColumnName("IsDeleted");
b.Property<DateTime?>("LastModificationTime")
.HasColumnType("datetime2")
.HasColumnName("LastModificationTime");
b.Property<Guid?>("LastModifierId")
.HasColumnType("uniqueidentifier")
.HasColumnName("LastModifierId");
b.Property<string>("SettleBillNum")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("Site")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<int>("State")
.HasColumnType("int");
b.Property<int>("Version")
.HasColumnType("int");
b.HasKey("Id");
b.ToTable("Set_PUB_PD");
});
modelBuilder.Entity("SettleAccount.Domain.BQ.PUB_PD_DETAIL", b => modelBuilder.Entity("SettleAccount.Domain.BQ.PUB_PD_DETAIL", b =>
{ {
b.Property<Guid>("Id") b.Property<Guid>("Id")
@ -3895,6 +4114,9 @@ namespace Win.Sfs.SettleAccount.Migrations
.HasMaxLength(50) .HasMaxLength(50)
.HasColumnType("nvarchar(50)"); .HasColumnType("nvarchar(50)");
b.Property<DateTime?>("HeartBeat")
.HasColumnType("datetime2");
b.Property<bool>("IsDisabled") b.Property<bool>("IsDisabled")
.HasColumnType("bit"); .HasColumnType("bit");
@ -3927,6 +4149,60 @@ namespace Win.Sfs.SettleAccount.Migrations
IsRunning = false, IsRunning = false,
Name = "库存快照", Name = "库存快照",
Service = "Win.Sfs.SettleAccount.Entities.BQ.VmiAppService" Service = "Win.Sfs.SettleAccount.Entities.BQ.VmiAppService"
},
new
{
Id = new Guid("d6d5e1d7-9326-ceea-eed4-fb4039e7ee68"),
Cron = "0 0/10 * * * ? ",
IsDisabled = false,
IsRunning = false,
Name = "BBAC发运数据同步",
Service = "Win.Sfs.SettleAccount.Entities.BQ.Syncs.BBACSeSyncAppService"
},
new
{
Id = new Guid("d50400b0-b0d4-38d1-fcdf-b1e7ac1d3a68"),
Cron = "0 0/10 * * * ? ",
IsDisabled = false,
IsRunning = false,
Name = "HBPO发运数据同步",
Service = "Win.Sfs.SettleAccount.Entities.BQ.Syncs.HBPOSeSyncAppService"
},
new
{
Id = new Guid("f306b380-47e5-5c01-b902-67ca4113a8f4"),
Cron = "0 0/10 * * * ? ",
IsDisabled = false,
IsRunning = false,
Name = "直供件BBAC发运同步",
Service = "Win.Sfs.SettleAccount.Entities.BQ.Syncs.ZhiGongBBACSeSyncAppService"
},
new
{
Id = new Guid("8f7dc23d-e2e9-3691-cfe9-545bb958e3f2"),
Cron = "0 0/10 * * * ? ",
IsDisabled = false,
IsRunning = false,
Name = "直供件HBPO发运同步",
Service = "Win.Sfs.SettleAccount.Entities.BQ.Syncs.ZhiGongHBPOSeSyncAppService"
},
new
{
Id = new Guid("c1f71240-1b81-0107-8b23-ddc9811a3efe"),
Cron = "0 0/10 * * * ? ",
IsDisabled = false,
IsRunning = false,
Name = "备件发运同步",
Service = "Win.Sfs.SettleAccount.Entities.BQ.Syncs.BeiSeSyncAppService"
},
new
{
Id = new Guid("c09c23ea-815f-1b43-4476-2365a8d9a60b"),
Cron = "0 0/10 * * * ? ",
IsDisabled = false,
IsRunning = false,
Name = "印度件发运同步",
Service = "Win.Sfs.SettleAccount.Entities.BQ.Syncs.YinDuSeSyncAppService"
}); });
}); });
@ -4049,7 +4325,7 @@ namespace Win.Sfs.SettleAccount.Migrations
Id = new Guid("ea936b34-ecd0-7dbd-85a9-57cd8b730873"), Id = new Guid("ea936b34-ecd0-7dbd-85a9-57cd8b730873"),
BillTime = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), BillTime = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
BillType = 1, BillType = 1,
ConcurrencyStamp = "2e626de3941048399abf1f76c051f8a4", ConcurrencyStamp = "7ee5d3ed981d4f87963af8b5654cd9df",
DeliverTime = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), DeliverTime = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
ErpToLoc = "ErpToLoc", ErpToLoc = "ErpToLoc",
OrderNum = "OrderNum", OrderNum = "OrderNum",

17
code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/PubSaSeCompareDapperRepository.cs

@ -1,5 +1,3 @@
using System;
using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using Dapper; using Dapper;
@ -24,8 +22,17 @@ public class PubSaSeCompareDapperRepository : DapperRepository<SettleAccountDbCo
/// <summary> /// <summary>
/// 获取差异 /// 获取差异
/// </summary> /// </summary>
public virtual List<PubSaSeCompareDiff> GetDetailDiffReportList(string businessType) public virtual List<PubSaSeCompareDiff> GetDetailDiffReportList(string businessType, string version, string seStartDateTime, string seEndDateTime)
{ {
string strSeWhere = string.Empty;
if (!string.IsNullOrWhiteSpace(seStartDateTime))
{
strSeWhere = $" AND BillTime >= {seStartDateTime} ";
}
if (!string.IsNullOrWhiteSpace(seEndDateTime))
{
strSeWhere = $" AND BillTime <= {seEndDateTime} ";
}
string strSqlText = @$" string strSqlText = @$"
SELECT SELECT
A.WmsBillNum, A.WmsBillNum,
@ -46,8 +53,8 @@ public class PubSaSeCompareDapperRepository : DapperRepository<SettleAccountDbCo
'' MateType, '' MateType,
B.Price FixPrice B.Price FixPrice
FROM FROM
(SELECT SUM(QTY) SEQty,LU,PN,MAX(WmsBillNum) WmsBillNum,MAX(ShippingDate) ShippingDate FROM Set_PUB_SE_DETAIL WHERE BusinessType = {businessType} GROUP BY LU,PN) A (SELECT SUM(QTY) SEQty,LU,PN,MAX(WmsBillNum) WmsBillNum,MAX(ShippingDate) ShippingDate FROM Set_PUB_SE_DETAIL WHERE BusinessType = {businessType} {strSeWhere} GROUP BY LU,PN) A
FULL JOIN (SELECT SUM(QTY) SAQty,LU,PN,MAX(Price) Price,MAX(SettleDate) SettleDate FROM Set_PUB_SA_DETAIL WHERE BusinessType = {businessType} GROUP BY LU,PN) B ON A.LU= B.LU AND A.PN= B.PN FULL JOIN (SELECT SUM(QTY) SAQty,LU,PN,MAX(Price) Price,MAX(SettleDate) SettleDate FROM Set_PUB_SA_DETAIL WHERE BusinessType = {businessType} AND Version = {version} GROUP BY LU,PN) B ON A.LU= B.LU AND A.PN= B.PN
ORDER BY B.SettleDate DESC; ORDER BY B.SettleDate DESC;
"; ";
return DbConnection.Query<PubSaSeCompareDiff>(strSqlText, null, null, true, 1200, null).ToList(); return DbConnection.Query<PubSaSeCompareDiff>(strSqlText, null, null, true, 1200, null).ToList();

270
code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/PubSaSeCompareExportService.cs

@ -2,14 +2,11 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using System.Linq; using System.Linq;
using EmptyFiles;
using Magicodes.ExporterAndImporter.Core;
using Magicodes.ExporterAndImporter.Excel; using Magicodes.ExporterAndImporter.Excel;
using Microsoft.AspNetCore.SignalR;
using Microsoft.OpenApi.Extensions; using Microsoft.OpenApi.Extensions;
using NetTopologySuite.Operation.Buffer;
using OfficeOpenXml.FormulaParsing.Excel.Functions.DateTime;
using OfficeOpenXml.FormulaParsing.Excel.Functions.Math;
using SettleAccount.Domain.BQ; using SettleAccount.Domain.BQ;
using SettleAccount.Job.SignalR;
using Shouldly; using Shouldly;
using TaskJob.EventArgs; using TaskJob.EventArgs;
using TaskJob.Interfaces; using TaskJob.Interfaces;
@ -19,7 +16,6 @@ using Volo.Abp.ObjectMapping;
using Win.Sfs.BaseData.ImportExcelCommon; using Win.Sfs.BaseData.ImportExcelCommon;
using Win.Sfs.SettleAccount; using Win.Sfs.SettleAccount;
using Win.Sfs.SettleAccount.Entities.BQ; using Win.Sfs.SettleAccount.Entities.BQ;
using Win.Sfs.SettleAccount.Entities.BQ.Dtos;
using Win.Sfs.SettleAccount.Enums; using Win.Sfs.SettleAccount.Enums;
using Win.Sfs.SettleAccount.Reports; using Win.Sfs.SettleAccount.Reports;
using Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report; using Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report;
@ -32,6 +28,11 @@ namespace SettleAccount.Job.Services.Report
/// </summary> /// </summary>
public class PubSaSeCompareExportService : ITransientDependency, IExportJob public class PubSaSeCompareExportService : ITransientDependency, IExportJob
{ {
/// <summary>
/// HubContext
/// </summary>
private readonly IHubContext<PageHub> _hubContext;
/// <summary> /// <summary>
/// 替换件关系仓储 /// 替换件关系仓储
/// </summary> /// </summary>
@ -61,12 +62,14 @@ namespace SettleAccount.Job.Services.Report
/// 构造 /// 构造
/// </summary> /// </summary>
public PubSaSeCompareExportService( public PubSaSeCompareExportService(
IHubContext<PageHub> hubContext,
INormalEfCoreRepository<TB_RePartsRelationship, Guid> tbRePartsRelationshipRepository, INormalEfCoreRepository<TB_RePartsRelationship, Guid> tbRePartsRelationshipRepository,
INormalEfCoreRepository<PUB_SEC_DETAIL, Guid> pubSeCDetailRepository, INormalEfCoreRepository<PUB_SEC_DETAIL, Guid> pubSeCDetailRepository,
PubSaSeCompareDapperRepository pubSaSeCompareDapperRepository, PubSaSeCompareDapperRepository pubSaSeCompareDapperRepository,
IBlobContainer<MyFileContainer> fileContainer, IBlobContainer<MyFileContainer> fileContainer,
IObjectMapper objectMapper) IObjectMapper objectMapper)
{ {
_hubContext = hubContext;
_tbRePartsRelationshipRepository = tbRePartsRelationshipRepository; _tbRePartsRelationshipRepository = tbRePartsRelationshipRepository;
_pubSeCDetailRepository = pubSeCDetailRepository; _pubSeCDetailRepository = pubSeCDetailRepository;
_pubSaSeCompareDapperRepository = pubSaSeCompareDapperRepository; _pubSaSeCompareDapperRepository = pubSaSeCompareDapperRepository;
@ -87,18 +90,21 @@ namespace SettleAccount.Job.Services.Report
public string ExportFile(Guid id, List<string> exportName, List<CustomCondition> property) public string ExportFile(Guid id, List<string> exportName, List<CustomCondition> property)
{ {
var version = property.Where(p => p.Name == "Version").FirstOrDefault().Value; var version = property.Where(p => p.Name == "Version").FirstOrDefault().Value;
var businessType = property.Where(t => t.Name == "BusinessType").FirstOrDefault().Value; var strBusinessType = property.Where(t => t.Name == "BusinessType").FirstOrDefault().Value;
var lu = property.Where(p => p.Name == "LU").FirstOrDefault().Value; var lu = property.Where(p => p.Name == "LU").FirstOrDefault().Value;
var pn = property.Where(p => p.Name == "PN").FirstOrDefault().Value; var pn = property.Where(p => p.Name == "PN").FirstOrDefault().Value;
var seStartDateTime = property.Where(p => p.Name == "SeStartDateTime").FirstOrDefault().Value;
var seEndDateTime = property.Where(p => p.Name == "SeEndDateTime").FirstOrDefault().Value;
EnumBusinessType businessType = (EnumBusinessType)Enum.Parse(typeof(EnumBusinessType), strBusinessType);
var businessTypeDisplayName = businessType.ToString(); var businessTypeDisplayName = businessType.ToString();
DisplayAttribute attributeOfType = ((EnumBusinessType)Enum.Parse(typeof(EnumBusinessType), businessType)).GetAttributeOfType<DisplayAttribute>(); DisplayAttribute attributeOfType = businessType.GetAttributeOfType<DisplayAttribute>();
if (attributeOfType != null) if (attributeOfType != null)
{ {
businessTypeDisplayName = attributeOfType.Name; businessTypeDisplayName = attributeOfType.Name;
} }
var filename = exportName.FirstOrDefault(); var filename = exportName.FirstOrDefault();
var pubSaSeCompareDiffs = _pubSaSeCompareDapperRepository.GetDetailDiffReportList(businessType); var pubSaSeCompareDiffs = _pubSaSeCompareDapperRepository.GetDetailDiffReportList(strBusinessType, version, seStartDateTime, seEndDateTime);
pubSaSeCompareDiffs.ForEach(p => pubSaSeCompareDiffs.ForEach(p =>
{ {
@ -127,7 +133,7 @@ namespace SettleAccount.Job.Services.Report
#region 二次对比 #region 二次对比
//二次对比(替换零件号) //二次对比(替换零件号)
var repLUs = notHaveSaHaveSes.Select(t => t.SeLU).Distinct().ToList(); var repLUs = notHaveSaHaveSes.Select(t => t.SeLU).Distinct().ToList();
var tbRePartsRelationships = _tbRePartsRelationshipRepository.GetListAsync(t => repLUs.Contains(t.RepLU) && ((int)t.BusinessType).ToString() == businessType).Result; var tbRePartsRelationships = _tbRePartsRelationshipRepository.GetListAsync(t => repLUs.Contains(t.RepLU) && t.BusinessType == businessType).Result;
tbRePartsRelationships.ForEach(tbRePartsRelationship => tbRePartsRelationships.ForEach(tbRePartsRelationship =>
{ {
@ -192,7 +198,6 @@ namespace SettleAccount.Job.Services.Report
pubSaSeCompareDiffs = pubSaSeCompareDiffs.FindAll(p => p.PN == pn); pubSaSeCompareDiffs = pubSaSeCompareDiffs.FindAll(p => p.PN == pn);
} }
//结算核对明细
var pubSaSeCompareDetailExports = _objectMapper.Map<List<PubSaSeCompareDiff>, List<PubSaSeCompareDetailExport>>(pubSaSeCompareDiffs); var pubSaSeCompareDetailExports = _objectMapper.Map<List<PubSaSeCompareDiff>, List<PubSaSeCompareDetailExport>>(pubSaSeCompareDiffs);
//结算核对汇总 //结算核对汇总
var pubSaSeCompareSumExports = pubSaSeCompareDetailExports.GroupBy(p => p.ReplaceLU).Select(p => new PubSaSeCompareSumExport() var pubSaSeCompareSumExports = pubSaSeCompareDetailExports.GroupBy(p => p.ReplaceLU).Select(p => new PubSaSeCompareSumExport()
@ -234,12 +239,99 @@ namespace SettleAccount.Job.Services.Report
SEQty = p.Sum(t => t.SEQty) SEQty = p.Sum(t => t.SEQty)
}).ToList(); }).ToList();
#region MyRegion ExcelExporter excelExporter = new ExcelExporter();
#endregion switch (businessType)
{
case EnumBusinessType.ZhiGongJianBBAC:
{
var items = _objectMapper.Map<List<PubSaSeCompareDetailExport>, List<PubSaSeCompareDetailExportZhiGongJianBBAC>>(pubSaSeCompareDetailExports);
excelExporter = BindExcelExporter<PubSaSeCompareDetailExportZhiGongJianBBAC>(items, businessTypeDisplayName);
}
break;
case EnumBusinessType.ZhiGongJianHBPO:
{
var items = _objectMapper.Map<List<PubSaSeCompareDetailExport>, List<PubSaSeCompareDetailExportZhiGongJianHBPO>>(pubSaSeCompareDetailExports);
excelExporter = BindExcelExporter<PubSaSeCompareDetailExportZhiGongJianHBPO>(items, businessTypeDisplayName);
}
break;
case EnumBusinessType.MaiDanJianBBAC:
break;
case EnumBusinessType.MaiDanJianHBPO:
{
var items = _objectMapper.Map<List<PubSaSeCompareDetailExport>, List<PubSaSeCompareDetailExportMaiDanJianHBPO>>(pubSaSeCompareDetailExports);
excelExporter = BindExcelExporter<PubSaSeCompareDetailExportMaiDanJianHBPO>(items, businessTypeDisplayName);
}
break;
case EnumBusinessType.BeiJian:
{
var items = _objectMapper.Map<List<PubSaSeCompareDetailExport>, List<PubSaSeCompareDetailExportBeiJian>>(pubSaSeCompareDetailExports);
excelExporter = BindExcelExporter<PubSaSeCompareDetailExportBeiJian>(items, businessTypeDisplayName);
}
break;
case EnumBusinessType.YinDuJian:
{
var items = _objectMapper.Map<List<PubSaSeCompareDetailExport>, List<PubSaSeCompareDetailExportYinDuJian>>(pubSaSeCompareDetailExports);
excelExporter = BindExcelExporter<PubSaSeCompareDetailExportYinDuJian>(items, businessTypeDisplayName);
}
break;
default:
break;
}
var result = excelExporter.ExportAppendDataAsByteArray();
result.ShouldNotBeNull();
_fileContainer.SaveAsync(filename, result.Result, true);
Notify();
return id.ToString();
}
#region 私有方法
public ExcelExporter BindExcelExporter<T>(List<T> pubSaSeCompareDetailExports, string businessTypeDisplayName) where T : PubSaSeCompareDetailExport, new()
{
//结算核对汇总
var pubSaSeCompareSumExports = pubSaSeCompareDetailExports.GroupBy(p => p.ReplaceLU).Select(p => new PubSaSeCompareSumExport()
{
LU = p.Key,
MaterialDes = p.FirstOrDefault().MaterialDes,
SAQty = p.Sum(t => t.SAQty),
SEQty = p.Sum(t => t.SEQty)
}).ToList();
//有结算有发运
var haveSaHaveSeExports = pubSaSeCompareDetailExports.FindAll(t => t.Category == EnumPubSaSeCompareCategory.HaveSaHaveSe);
//有结算有发运汇总
var haveSaHaveSeSumExports = haveSaHaveSeExports.GroupBy(p => p.ReplaceLU).Select(p => new PubSaSeCompareSumExport()
{
LU = p.Key,
MaterialDes = p.FirstOrDefault().MaterialDes,
SAQty = p.Sum(t => t.SAQty),
SEQty = p.Sum(t => t.SEQty)
}).ToList();
//有结算无发运
var haveSaNotHaveSeExports = pubSaSeCompareDetailExports.FindAll(t => t.Category == EnumPubSaSeCompareCategory.HaveSaNotHaveSe);
//有结算无发运
var haveSaNotHaveSeSumExports = haveSaHaveSeExports.GroupBy(p => p.ReplaceLU).Select(p => new PubSaSeCompareSumExport()
{
LU = p.Key,
MaterialDes = p.FirstOrDefault().MaterialDes,
SAQty = p.Sum(t => t.SAQty),
SEQty = p.Sum(t => t.SEQty)
}).ToList();
//无结算有发运
var notHaveSaHaveSeExports = pubSaSeCompareDetailExports.FindAll(t => t.Category == EnumPubSaSeCompareCategory.NotHaveSaHaveSe);
//无结算有发运
var notHaveSaHaveSeSumExports = haveSaHaveSeExports.GroupBy(p => p.ReplaceLU).Select(p => new PubSaSeCompareSumExport()
{
LU = p.Key,
MaterialDes = p.FirstOrDefault().MaterialDes,
SAQty = p.Sum(t => t.SAQty),
SEQty = p.Sum(t => t.SEQty)
}).ToList();
ExcelExporter excelExporter = new ExcelExporter(); ExcelExporter excelExporter = new ExcelExporter();
var result = excelExporter return excelExporter
.Append(pubSaSeCompareDetailExports, $"{businessTypeDisplayName}结算核对明细输出") .Append(pubSaSeCompareDetailExports, $"{businessTypeDisplayName}结算核对明细输出")
.SeparateBySheet() .SeparateBySheet()
.Append(pubSaSeCompareSumExports, $"{businessTypeDisplayName}结算核对汇总输出") .Append(pubSaSeCompareSumExports, $"{businessTypeDisplayName}结算核对汇总输出")
@ -253,155 +345,13 @@ namespace SettleAccount.Job.Services.Report
.Append(haveSaNotHaveSeExports, $"{businessTypeDisplayName}有结算无发货明细输出") .Append(haveSaNotHaveSeExports, $"{businessTypeDisplayName}有结算无发货明细输出")
.SeparateBySheet() .SeparateBySheet()
.Append(haveSaNotHaveSeSumExports, $"{businessTypeDisplayName}有结算无发货汇总输出") .Append(haveSaNotHaveSeSumExports, $"{businessTypeDisplayName}有结算无发货汇总输出")
.SeparateBySheet() .SeparateBySheet();
.ExportAppendDataAsByteArray();
result.ShouldNotBeNull();
_fileContainer.SaveAsync(filename, result.Result, true);
return id.ToString();
} }
/// <summary> private void Notify()
/// 导出(废弃)
/// </summary>
public string ExportFile333(Guid id, List<string> exportName, List<CustomCondition> property)
{ {
return ""; this._hubContext.Clients.All.ServerToClient("Compare", "refresh", "");
// var version = property.Where(p => p.Name == "Version").FirstOrDefault().Value;
// var _filename = exportName.FirstOrDefault();
// var _ls = _dapperRepository.GetDetailDiffReportList(version, materialCode, begin, end, cp7begin, cp7end, kenncode, chassisNumber, materialGroup);
// var diffList = _erpdapperRepository.GetSettleInvoiceDiff(version);
// foreach (var itm in _ls)
// {
// itm.InvoiceAmt = Math.Round(itm.InvoiceQty * itm.InvoicePrice, 2);
// itm.DiffPrice = itm.Price - itm.InvoicePrice;
// itm.DiffSettleFisQty = itm.SettledQty;
// }
// _ls = _ls.OrderBy(p => p.ChassisNumber).ThenBy(p => p.KENNCode).ThenBy(p => p.SapMaterialCode).ToList();
// if (!string.IsNullOrEmpty(materialGroup))
// {
// var _groupList = materialGroup.Split(new char[] { ',' }).Distinct().ToList();
// if (_groupList.Count() > 0)
// {
// _ls = _ls.Where(p => _groupList.Contains(p.MaterialGroup)).ToList();
// }
// }
// if (!string.IsNullOrEmpty(kenncode))
// {
// var _groupList = kenncode.Split(new char[] { '\n' }).Distinct().ToList();
// if (_groupList.Count() > 0)
// {
// _ls = _ls.Where(p => _groupList.Contains(p.KENNCode)).ToList();
// }
// }
// if (!string.IsNullOrEmpty(chassisNumber))
// {
// var _groupList = chassisNumber.Split(new char[] { '\n' }).Distinct().ToList();
// if (_groupList.Count() > 0)
// {
// _ls = _ls.Where(p => _groupList.Contains(p.ChassisNumber)).ToList();
// }
// }
// if (!string.IsNullOrEmpty(sapCode))
// {
// var _groupList = sapCode.Split(new char[] { '\n' }).Distinct().ToList();
// if (_groupList.Count() > 0)
// {
// _ls = _ls.Where(p => _groupList.Contains(p.SapMaterialCode)).ToList();
// }
// }
// if (!string.IsNullOrEmpty(materialCode))
// {
// var _groupList = materialCode.Split(new char[] { '\n' }).Distinct().ToList();
// if (_groupList.Count() > 0)
// {
// _ls = _ls.Where(p => _groupList.Contains(p.MaterialCode)).ToList();
// }
// }
// var _checkList = _erpdapperRepository.GetErrorBillList();
// var query = from itm in _ls
// join itm1 in _checkList on new { ChassisNumber = itm.ChassisNumber, MaterialCode = itm.MaterialCode, WmsBillNum = itm.WmsBillNum }
//equals new { ChassisNumber = itm1.BillNum, MaterialCode = itm1.MaterialCode, WmsBillNum = itm1.WmsBillNum } into temp1
// from tm1 in temp1.DefaultIfEmpty()
// where tm1 == null
// select itm;
// _ls = query.ToList();
// var _lsSum = _ls.GroupBy(p => new { p.MaterialCode, p.SapMaterialCode, p.MaterialGroup, p.InvoicePrice }).Select(p => new UnInvoiceSettledDetailSum
// {
// MaterialCode = p.Key.MaterialCode,
// SapMaterailCode = p.Key.SapMaterialCode,
// MaterialGroup = p.Key.MaterialGroup,
// SettleQty = p.Sum(itm => itm.SettledQty),
// FisQty = 0,
// DiffQty = -p.Sum(itm => itm.SettledQty),
// Price = p.Key.InvoicePrice,
// DiffAmt = p.Sum(itm => itm.SettledQty) * p.Key.InvoicePrice
// }).ToList();
// var _sumTotal = new UnInvoiceSettledDetailSum()
// {
// SettleQty = _lsSum.Sum(p => p.SettleQty),
// DiffQty = _lsSum.Sum(p => p.DiffQty),
// Price = _lsSum.Sum(p => p.Price),
// DiffAmt = _lsSum.Sum(p => p.DiffAmt)
// };
// _lsSum.Add(_sumTotal);
// var _ls1 = DiffPrice(id, exportName, p_list);
// var report1List = _ls1.Where(p => p.DiffPrice != 0).GroupBy(p => new { p.MaterialGroup, p.MaterialCode, p.MaterialDesc, p.Price, p.InvoicePrice, p.DiffPrice, p.SapMaterialCode })
// .Select(t => new SettleDoorPanelExport { MaterialGroup = t.FirstOrDefault().MaterialGroup, MaterialCode = t.FirstOrDefault().MaterialCode, MaterialDesc = t.FirstOrDefault().MaterialDesc, Price = t.FirstOrDefault().Price, InvoicePrice = t.FirstOrDefault().InvoicePrice, InvoiceDiffPrice = t.FirstOrDefault().DiffPrice, SAPCode = t.FirstOrDefault().SapMaterialCode }).ToList();
// var report2List = _ls1.Where(p => p.DiffPrice != 0).Select(p => new { p.MaterialGroup, DiffAmt = p.DiffPrice * p.Qty }).GroupBy(p => new { p.MaterialGroup }).Select(p => new SettleDoorPanelSumExport { MaterialGroup = p.Key.MaterialGroup, InvoiceDiffPrice = p.Sum(itm => itm.DiffAmt), Version = version });
// var list1 = LSettleSum(id, exportName, p_list);
// var report1 = report2List.ToList();
// foreach (var itm in list1)
// {
// itm.MaterialGroup = itm.MaterialGroup + "(漏结)";
// }
// report1.AddRange(list1);
// ExcelExporter _exporter = new ExcelExporter();//导出Excel
// var result = _exporter
// .Append(_ls, "差异明细表")
// .SeparateBySheet()
// .Append(_lsSum, "数量差异汇总表")
// .SeparateBySheet()
// .Append(report1List, "按物料价格差异明细表")
// .SeparateBySheet()
// .Append(report1, "差异汇总验证表")
// .ExportAppendDataAsByteArray();
// result.ShouldNotBeNull();
// _fileContainer.SaveAsync(_filename, result.Result, true);
// //_outputService.Export<InvoiceSettledDetailDiff>(id, string.Format("大众结算未发运核对明细表_{0}.xlsx", Guid.NewGuid().ToString()), _ls);
// return id.ToString();
} }
#endregion
} }
} }

6
code/src/Modules/SettleAccount/src/SettleAccount.Job/SettleAccountJobAutoMapperProfile.cs

@ -20,6 +20,12 @@ namespace SettleAccount.Job
.ForMember(x => x.ReplaceLU, y => y.MapFrom(y => y.ReplaceLU)); .ForMember(x => x.ReplaceLU, y => y.MapFrom(y => y.ReplaceLU));
CreateMap<PubSaSeCompareDiff, PUB_SEC_DETAIL>(); CreateMap<PubSaSeCompareDiff, PUB_SEC_DETAIL>();
CreateMap<PubSaSeCompareDetailExport, PubSaSeCompareDetailExportZhiGongJianBBAC>();
CreateMap<PubSaSeCompareDetailExport, PubSaSeCompareDetailExportZhiGongJianHBPO>();
CreateMap<PubSaSeCompareDetailExport, PubSaSeCompareDetailExportMaiDanJianHBPO>();
CreateMap<PubSaSeCompareDetailExport, PubSaSeCompareDetailExportBeiJian>();
CreateMap<PubSaSeCompareDetailExport, PubSaSeCompareDetailExportYinDuJian>();
} }
} }
} }

Loading…
Cancel
Save