Browse Source

结算从表查询接口

master
mahao 1 year ago
parent
commit
dcbe7e9199
  1. 4
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/Startup.cs
  2. 106
      code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/BBAC_SA_DTO.cs
  3. 104
      code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/HBPO_SA_DTO.cs
  4. 158
      code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/PUB_SA_DTO.cs
  5. 91
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_SA_DETAIL_SERVICE.cs
  6. 15
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_SA_SERVICE.cs
  7. 91
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/HBPO_SA_DETAIL_SERVICE.cs
  8. 34
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/HBPO_SA_SERVICE.cs
  9. 15
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_SA_DETAIL_SERVICE.cs
  10. 86
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_SA_SERVICE.cs
  11. 36
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/BBACSeSyncAppService.cs
  12. 117
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/HBPOSeSyncAppService.cs
  13. 50
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/JisBBACSeEdiCompareAppService.cs
  14. 24
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/JisHBPOSeEdiCompareAppService.cs
  15. 19
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/JitSeSyncAppService.cs
  16. 152
      code/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccountApplicationAutoMapperProfile.cs
  17. 13
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/BBAC_SE_DETAIL.cs
  18. 6
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/BBAC_SE_EDI.cs
  19. 6
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/HBPO_SE_EDI.cs

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

@ -29,6 +29,7 @@ public class Startup
options.MimeTypes = ResponseCompressionDefaults.MimeTypes.Concat(new[] { "image/svg+xml" }); options.MimeTypes = ResponseCompressionDefaults.MimeTypes.Concat(new[] { "image/svg+xml" });
}); });
services.AddScheduler(); services.AddScheduler();
services.AddSingleton<JisBBACSeEdiCompareAppService>();
services.AddSingleton<JisHBPOSeEdiCompareAppService>(); services.AddSingleton<JisHBPOSeEdiCompareAppService>();
services.AddSignalR(o => o.EnableDetailedErrors = true); services.AddSignalR(o => o.EnableDetailedErrors = true);
JobHostdService.AddService(services); JobHostdService.AddService(services);
@ -57,7 +58,8 @@ 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<JisHBPOSeEdiCompareAppService>().EverySeconds(10); scheduler.Schedule<JisBBACSeEdiCompareAppService>().EverySeconds(10);
//scheduler.Schedule<JisHBPOSeEdiCompareAppService>().EverySeconds(10);
}); });
var contentTypeProvider = new FileExtensionContentTypeProvider(); var contentTypeProvider = new FileExtensionContentTypeProvider();
contentTypeProvider.Mappings.Add(".mjs", "text/javascript"); contentTypeProvider.Mappings.Add(".mjs", "text/javascript");

106
code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/BBAC_SA_DTO.cs

@ -53,6 +53,49 @@ public class BBAC_SA_DTO : EntityDto<Guid>
public EnumBusinessType BusinessType { get; set; } public EnumBusinessType BusinessType { get; set; }
} }
/// <summary>
/// BBAC结算明细
/// </summary>
public class BBAC_SA_DETAIL_DTO : EntityDto<Guid>
{
/// <summary>
/// 结算单
/// </summary>
public string BillNum { set; get; }
/// <summary>
/// 期间
/// </summary>
public int Version { set; get; }
/// <summary>
/// 结算分组号
/// </summary>
public string GroupNum { get; set; }
/// <summary>
/// 生产号
/// </summary>
public string PN { get; set; }
/// <summary>
/// 客户物料号
/// </summary>
public string LU { get; set; }
/// <summary>
/// 数量
/// </summary>
public string Qty { get; set; }
/// <summary>
/// 结算日期
/// </summary>
public DateTime SettleDate { set; get; }
/// <summary>
/// 单价
/// </summary>
public decimal Price { set; get; }
/// <summary>
/// 厂内物料号
/// </summary>
public string PartCode { get; set; }
}
/// <summary> /// <summary>
/// BBAC结算明细导入 /// BBAC结算明细导入
/// </summary> /// </summary>
@ -79,7 +122,7 @@ public class BBAC_SA_DETAIL_IMPORT_DTO
[Display(Name = "Material")] [Display(Name = "Material")]
[Required(ErrorMessage = "{0}不能为空")] [Required(ErrorMessage = "{0}不能为空")]
[ImporterHeader(Name = "Material")] [ImporterHeader(Name = "Material")]
public string PartCode { get; set; } public string LU { get; set; }
/// <summary> /// <summary>
/// 数量 /// 数量
@ -96,3 +139,64 @@ public class BBAC_SA_DETAIL_IMPORT_DTO
[ImporterHeader(Name = "External Call Number")] [ImporterHeader(Name = "External Call Number")]
public string PN { get; set; } public string PN { get; set; }
} }
/// <summary>
/// 结算明细导出请求
/// </summary>
public class BBAC_SA_DETAIL_EXPORT_REQUEST_DTO
{
/// <summary>
/// 结算单号
/// </summary>
[Display(Name = "结算单号")]
[Required(ErrorMessage = "{0}不能为空")]
public string BillNum { set; get; }
}
/// <summary>
/// 结算明细导出
/// </summary>
public class BBAC_SA_DETAIL_EXPORT_DTO
{
/// <summary>
/// 结算单号
/// </summary>
[Display(Name = "结算单号")]
[ExporterHeader(DisplayName = "结算单号")]
public string BillNum { set; get; }
/// <summary>
/// 结算日期
/// </summary>
[Display(Name = "结算日期")]
[ExporterHeader(DisplayName = "结算日期")]
public DateTime SettleDate { set; get; }
/// <summary>
/// 发货单号
/// </summary>
[Display(Name = "发货单号")]
[ExporterHeader(DisplayName = "发货单号")]
public string PN { get; set; }
/// <summary>
/// 零件号
/// </summary>
[Display(Name = "零件号")]
[ExporterHeader(DisplayName = "零件号")]
public string LU { get; set; }
/// <summary>
/// 数量
/// </summary>
[Display(Name = "数量")]
[ExporterHeader(DisplayName = "数量")]
public decimal Qty { get; set; }
/// <summary>
/// 结算分组
/// </summary>
[Display(Name = "结算分组")]
[ExporterHeader(DisplayName = "结算分组")]
public string GroupNum { get; set; }
}

104
code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/HBPO_SA_DTO.cs

@ -53,6 +53,49 @@ public class HBPO_SA_DTO : EntityDto<Guid>
public EnumBusinessType BusinessType { get; set; } public EnumBusinessType BusinessType { get; set; }
} }
/// <summary>
/// HBPO结算明细
/// </summary>
public class HBPO_SA_DETAIL_DTO : EntityDto<Guid>
{
/// <summary>
/// 结算单
/// </summary>
public string BillNum { set; get; }
/// <summary>
/// 期间
/// </summary>
public int Version { set; get; }
/// <summary>
/// 结算分组号
/// </summary>
public string GroupNum { get; set; }
/// <summary>
/// 生产号
/// </summary>
public string PN { get; set; }
/// <summary>
/// 客户物料号
/// </summary>
public string LU { get; set; }
/// <summary>
/// 数量
/// </summary>
public string Qty { get; set; }
/// <summary>
/// 结算日期
/// </summary>
public DateTime SettleDate { set; get; }
/// <summary>
/// 单价
/// </summary>
public decimal Price { set; get; }
/// <summary>
/// 厂内物料号
/// </summary>
public string PartCode { get; set; }
}
/// <summary> /// <summary>
/// HBPO结算明细导入 /// HBPO结算明细导入
/// </summary> /// </summary>
@ -112,3 +155,64 @@ public class HBPO_SA_DETAIL_IMPORT_DTO
[ImporterHeader(Name = "productionNumber")] [ImporterHeader(Name = "productionNumber")]
public string PN { get; set; } public string PN { get; set; }
} }
/// <summary>
/// 结算明细导出请求
/// </summary>
public class HBPO_SA_DETAIL_EXPORT_REQUEST_DTO
{
/// <summary>
/// 结算单号
/// </summary>
[Display(Name = "结算单号")]
[Required(ErrorMessage = "{0}不能为空")]
public string BillNum { set; get; }
}
/// <summary>
/// 结算明细导出
/// </summary>
public class HBPO_SA_DETAIL_EXPORT_DTO
{
/// <summary>
/// 结算单号
/// </summary>
[Display(Name = "结算单号")]
[ExporterHeader(DisplayName = "结算单号")]
public string BillNum { set; get; }
/// <summary>
/// 结算日期
/// </summary>
[Display(Name = "结算日期")]
[ExporterHeader(DisplayName = "结算日期")]
public DateTime SettleDate { set; get; }
/// <summary>
/// 发货单号
/// </summary>
[Display(Name = "发货单号")]
[ExporterHeader(DisplayName = "发货单号")]
public string PN { get; set; }
/// <summary>
/// 零件号
/// </summary>
[Display(Name = "零件号")]
[ExporterHeader(DisplayName = "零件号")]
public string LU { get; set; }
/// <summary>
/// 数量
/// </summary>
[Display(Name = "数量")]
[ExporterHeader(DisplayName = "数量")]
public decimal Qty { get; set; }
/// <summary>
/// 结算分组
/// </summary>
[Display(Name = "结算分组")]
[ExporterHeader(DisplayName = "结算分组")]
public string GroupNum { get; set; }
}

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

@ -3,6 +3,7 @@ using Microsoft.AspNetCore.Http;
using System; using System;
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using Volo.Abp.Application.Dtos; using Volo.Abp.Application.Dtos;
using Volo.Abp.Domain.Entities.Auditing;
namespace Win.Sfs.SettleAccount.Entities.BQ.Dtos namespace Win.Sfs.SettleAccount.Entities.BQ.Dtos
{ {
@ -198,13 +199,13 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Dtos
/// <summary> /// <summary>
/// 备件导入 /// 备件导入
/// </summary> /// </summary>
public class BeiJianImportDto public class BeiJianImportDto : BeiJianExtraImportDto
{ {
/// <summary> /// <summary>
/// 结算日期 /// 结算日期
/// </summary> /// </summary>
[Display(Name = "结算日期")] [Display(Name = "结算日期")]
[ImporterHeader(IsIgnore = true)] [ImporterHeader(Name = "开票日期")]
public DateTime SettleDate { set; get; } public DateTime SettleDate { set; get; }
/// <summary> /// <summary>
@ -237,6 +238,116 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Dtos
[ImporterHeader(Name = "凭证号")] [ImporterHeader(Name = "凭证号")]
[Required(ErrorMessage = "{0}不能为空")] [Required(ErrorMessage = "{0}不能为空")]
public string GroupNum { get; set; } public string GroupNum { get; set; }
///// <summary>
///// 备件扩展
///// </summary>
//[Display(Name = "备件扩展")]
//public BeiJianExtraImportDto beiJianExtraImportDto { get; set; }
}
/// <summary>
/// 备件扩展
/// </summary>
public class BeiJianExtraImportDto
{
/// <summary>
/// 交货号
/// </summary>
[Display(Name = "交货号")]
[ImporterHeader(Name = "交货号")]
public string DeliveryNumber { set; get; }
/// <summary>
/// 发票号
/// </summary>
[Display(Name = "发票号")]
[ImporterHeader(Name = "发票号")]
public string InvoiceNumber { set; get; }
/// <summary>
/// 供应商代码
/// </summary>
[Display(Name = "供应商代码")]
[ImporterHeader(Name = "供应商代码")]
public string VendorCode { set; get; }
/// <summary>
/// 供应商名称
/// </summary>
[Display(Name = "供应商名称")]
[ImporterHeader(Name = "供应商名称")]
public string VendorName { set; get; }
/// <summary>
/// 采购订单号
/// </summary>
[Display(Name = "采购订单号")]
[ImporterHeader(Name = "采购订单号")]
public string PurchaseOrderNumber { set; get; }
/// <summary>
/// 交付索引号
/// </summary>
[Display(Name = "交付索引号")]
[ImporterHeader(Name = "交付索引号")]
public string DeliveryIndexNumber { set; get; }
/// <summary>
/// 零件名称
/// </summary>
[Display(Name = "零件名称")]
[ImporterHeader(Name = "零件名称")]
public string PartName { set; get; }
/// <summary>
/// 价格
/// </summary>
[Display(Name = "价格")]
[ImporterHeader(Name = "价格")]
public decimal Price { set; get; }
/// <summary>
/// 金额
/// </summary>
[Display(Name = "金额")]
[ImporterHeader(Name = "金额")]
public decimal Amount { set; get; }
/// <summary>
/// 税额
/// </summary>
[Display(Name = "税额")]
[ImporterHeader(Name = "税额")]
public decimal Tallage { set; get; }
/// <summary>
/// 价税合计
/// </summary>
[Display(Name = "价税合计")]
[ImporterHeader(Name = "价税合计")]
public decimal Total { set; get; }
/// <summary>
/// 协议编号
/// </summary>
[Display(Name = "协议编号")]
[ImporterHeader(Name = "协议编号")]
public string ProtocolNumber { set; get; }
/// <summary>
/// 备注
/// </summary>
[Display(Name = "备注")]
[ImporterHeader(Name = "备注")]
public string Remark { set; get; }
/// <summary>
/// 商品组
/// </summary>
[Display(Name = "商品组")]
[ImporterHeader(Name = "商品组")]
public string CommodityGroup { set; get; }
} }
/// <summary> /// <summary>
@ -283,6 +394,49 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Dtos
public string GroupNum { get; set; } public string GroupNum { get; set; }
} }
/// <summary>
/// PUB结算明细
/// </summary>
public class PUB_SA_DETAIL_DTO : AuditedAggregateRoot<Guid>
{
/// <summary>
/// 结算单
/// </summary>
public string BillNum { set; get; }
/// <summary>
/// 期间
/// </summary>
public int Version { set; get; }
/// <summary>
/// 结算分组号
/// </summary>
public string GroupNum { get; set; }
/// <summary>
/// 生产号
/// </summary>
public string PN { get; set; }
/// <summary>
/// 客户物料号
/// </summary>
public string LU { get; set; }
/// <summary>
/// 数量
/// </summary>
public string Qty { get; set; }
/// <summary>
/// 结算日期
/// </summary>
public DateTime SettleDate { set; get; }
/// <summary>
/// 单价
/// </summary>
public decimal Price { set; get; }
/// <summary>
/// 厂内物料号
/// </summary>
public string PartCode { get; set; }
}
/// <summary> /// <summary>
/// 结算明细导出请求 /// 结算明细导出请求
/// </summary> /// </summary>

91
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_SA_DETAIL_SERVICE.cs

@ -1,7 +1,22 @@
using System; using System;
using System.Collections.Generic;
using System.LinqAsync;
using System.Threading.Tasks; 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 Shouldly;
using Volo.Abp;
using Volo.Abp.Application.Dtos;
using Volo.Abp.Caching;
using Win.Abp.Snowflakes;
using Win.Sfs.BaseData.ImportExcelCommon;
using Win.Sfs.SettleAccount.CommonManagers;
using Win.Sfs.SettleAccount.Entities.BQ.Dtos;
using Win.Sfs.SettleAccount.Entities.TaskJobs;
using Win.Sfs.SettleAccount.ExcelImporter;
using Win.Sfs.Shared.Filter;
using Win.Sfs.Shared.RepositoryBase;
namespace Win.Sfs.SettleAccount.Entities.BQ; namespace Win.Sfs.SettleAccount.Entities.BQ;
@ -10,8 +25,82 @@ namespace Win.Sfs.SettleAccount.Entities.BQ;
/// </summary> /// </summary>
[AllowAnonymous] [AllowAnonymous]
[Route("api/settleaccount/[controller]/[action]")] [Route("api/settleaccount/[controller]/[action]")]
public class BBAC_SA_DETAIL_SERVICE public class BBAC_SA_DETAIL_SERVICE : SettleAccountApplicationBase<BBAC_SA_DETAIL>
{ {
/// <summary>
/// BBAC结算明细仓储
/// </summary>
private readonly INormalEfCoreRepository<BBAC_SA_DETAIL, Guid> _bbacSaDetailRepository;
/// <summary>
/// BBAC结算仓储
/// </summary>
private readonly INormalEfCoreRepository<BBAC_SA, Guid> _bbacSaRepository;
/// <summary>
/// 任务服务
/// </summary>
private readonly TaskJobService _taskJobService;
/// <summary>
/// 构造
/// </summary>
public BBAC_SA_DETAIL_SERVICE(INormalEfCoreRepository<BBAC_SA_DETAIL, Guid> bbacSaDetailRepository,
INormalEfCoreRepository<BBAC_SA, Guid> bbacSaRepository,
TaskJobService taskJobService,
IDistributedCache<BBAC_SA_DETAIL> cache,
IExcelImportAppService excelImportService,
ISnowflakeIdGenerator snowflakeIdGenerator,
ICommonManager commonManager
) : base(cache, excelImportService, snowflakeIdGenerator, commonManager)
{
_bbacSaDetailRepository = bbacSaDetailRepository;
_bbacSaRepository = bbacSaRepository;
_taskJobService = taskJobService;
}
#region 导出
/// <summary>
/// 导出
/// </summary>
[HttpPost]
public async Task<string> ExportAsync(BBAC_SA_DETAIL_EXPORT_REQUEST_DTO input)
{
var pubSaEntity = await _bbacSaRepository.FirstOrDefaultAsync(t => t.BillNum == input.BillNum).ConfigureAwait(false);
if (pubSaEntity == null)
{
throw new UserFriendlyException($"导出失败,结算单号不存在!", "400");
}
string fileName = $"JisBBAC的结算数据_{Guid.NewGuid()}.xlsx";
List<FilterCondition> filters = new List<FilterCondition>();
filters.Add(new FilterCondition("BillNum", input.BillNum, EnumFilterAction.Equal, EnumFilterLogic.And));
var entities = await _bbacSaDetailRepository.GetListByFilterAsync(filters).ConfigureAwait(false);
var dtos = ObjectMapper.Map<List<BBAC_SA_DETAIL>, List<BBAC_SA_DETAIL_EXPORT_DTO>>(entities);
ExportImporter _exportImporter = new ExportImporter();
var result = await _exportImporter.ExcelExporter(dtos).ConfigureAwait(false);
result.ShouldNotBeNull();
await _excelImportService.SaveBlobAsync(new SaveExcelImportInputDto { Name = fileName, Content = result }).ConfigureAwait(false);
return fileName;
}
#endregion
#region CURD
/// <summary>
/// 获取列表
/// </summary>
[HttpPost]
public async Task<PagedResultDto<BBAC_SA_DETAIL_DTO>> GetListAsync(RequestDto input)
{
var entities = await _bbacSaDetailRepository.GetListByFilterAsync(input.Filters, input.Sorting, input.MaxResultCount, input.SkipCount, true).ConfigureAwait(false);
var totalCount = await _bbacSaDetailRepository.GetCountByFilterAsync(input.Filters).ConfigureAwait(false);
var dtos = ObjectMapper.Map<List<BBAC_SA_DETAIL>, List<BBAC_SA_DETAIL_DTO>>(entities);
return new PagedResultDto<BBAC_SA_DETAIL_DTO>(totalCount, dtos);
}
#endregion
#region 对比 #region 对比
/// <summary> /// <summary>
/// BBAC结算与发运比对 /// BBAC结算与发运比对

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

@ -312,13 +312,13 @@ public class BBAC_SA_SERVICE : SettleAccountApplicationBase<BBAC_SA>
bbacSaDetails.ForEach(bbacSaDetail => bbacSaDetails.ForEach(bbacSaDetail =>
{ {
List<string> partCodes = bbacSaDetail.PartCode.Split(" ").ToList(); List<string> lus = bbacSaDetail.LU.Split(" ").ToList();
bbacSaDetail.PartCode = partCodes[0].Replace(" ", ""); bbacSaDetail.LU = lus[0].Replace(" ", "");
if (partCodes.Count > 1) if (lus.Count > 1)
{ {
partCodes.RemoveAt(0); lus.RemoveAt(0);
var partCodeAssemble = partCodes.Select(t => t.Replace(" ", "")); var luAssemble = lus.Select(t => t.Replace(" ", ""));
bbacSaDetail.PartCode += partCodeAssemble.Aggregate(" ", (current, index) => current + index); bbacSaDetail.LU += luAssemble.Aggregate(" ", (current, index) => current + index);
} }
bbacSaDetail.BillNum = bbacSaBillNum; bbacSaDetail.BillNum = bbacSaBillNum;
@ -351,8 +351,7 @@ public class BBAC_SA_SERVICE : SettleAccountApplicationBase<BBAC_SA>
var seAllMaterialRelationships = materialRelationshipEntitys.Union(materialRelationships); var seAllMaterialRelationships = materialRelationshipEntitys.Union(materialRelationships);
bbacSaDetails.ForEach(bbacSaDetail => bbacSaDetails.ForEach(bbacSaDetail =>
{ {
bbacSaDetail.LU = seAllMaterialRelationships.FirstOrDefault(t => t.SettleMaterialCode == bbacSaDetail.PartCode)?.ErpMaterialCode ?? bbacSaDetail.PartCode.Replace(" ", "-"); bbacSaDetail.PartCode = seAllMaterialRelationships.FirstOrDefault(t => t.SettleMaterialCode == bbacSaDetail.LU)?.ErpMaterialCode ?? bbacSaDetail.LU.Replace(" ", "-");
bbacSaDetail.KeyCode = bbacSaDetail.PN + bbacSaDetail.LU;
}); });
#endregion #endregion

91
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/HBPO_SA_DETAIL_SERVICE.cs

@ -1,7 +1,22 @@
using System; using System;
using System.Collections.Generic;
using System.LinqAsync;
using System.Threading.Tasks; 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 Shouldly;
using Volo.Abp;
using Volo.Abp.Application.Dtos;
using Volo.Abp.Caching;
using Win.Abp.Snowflakes;
using Win.Sfs.BaseData.ImportExcelCommon;
using Win.Sfs.SettleAccount.CommonManagers;
using Win.Sfs.SettleAccount.Entities.BQ.Dtos;
using Win.Sfs.SettleAccount.Entities.TaskJobs;
using Win.Sfs.SettleAccount.ExcelImporter;
using Win.Sfs.Shared.Filter;
using Win.Sfs.Shared.RepositoryBase;
namespace Win.Sfs.SettleAccount.Entities.BQ; namespace Win.Sfs.SettleAccount.Entities.BQ;
@ -10,8 +25,82 @@ namespace Win.Sfs.SettleAccount.Entities.BQ;
/// </summary> /// </summary>
[AllowAnonymous] [AllowAnonymous]
[Route("api/settleaccount/[controller]/[action]")] [Route("api/settleaccount/[controller]/[action]")]
public class HBPO_SA_DETAIL_SERVICE public class HBPO_SA_DETAIL_SERVICE : SettleAccountApplicationBase<HBPO_SA_DETAIL>
{ {
/// <summary>
/// HBPO结算明细仓储
/// </summary>
private readonly INormalEfCoreRepository<HBPO_SA_DETAIL, Guid> _hbpoSaDetailRepository;
/// <summary>
/// HBPO结算仓储
/// </summary>
private readonly INormalEfCoreRepository<HBPO_SA, Guid> _hbpoSaRepository;
/// <summary>
/// 任务服务
/// </summary>
private readonly TaskJobService _taskJobService;
/// <summary>
/// 构造
/// </summary>
public HBPO_SA_DETAIL_SERVICE(INormalEfCoreRepository<HBPO_SA_DETAIL, Guid> hbpoSaDetailRepository,
INormalEfCoreRepository<HBPO_SA, Guid> hbpoSaRepository,
TaskJobService taskJobService,
IDistributedCache<HBPO_SA_DETAIL> cache,
IExcelImportAppService excelImportService,
ISnowflakeIdGenerator snowflakeIdGenerator,
ICommonManager commonManager
) : base(cache, excelImportService, snowflakeIdGenerator, commonManager)
{
_hbpoSaDetailRepository = hbpoSaDetailRepository;
_hbpoSaRepository = hbpoSaRepository;
_taskJobService = taskJobService;
}
#region 导出
/// <summary>
/// 导出
/// </summary>
[HttpPost]
public async Task<string> ExportAsync(HBPO_SA_DETAIL_EXPORT_REQUEST_DTO input)
{
var pubSaEntity = await _hbpoSaRepository.FirstOrDefaultAsync(t => t.BillNum == input.BillNum).ConfigureAwait(false);
if (pubSaEntity == null)
{
throw new UserFriendlyException($"导出失败,结算单号不存在!", "400");
}
string fileName = $"JisHBPO的结算数据_{Guid.NewGuid()}.xlsx";
List<FilterCondition> filters = new List<FilterCondition>();
filters.Add(new FilterCondition("BillNum", input.BillNum, EnumFilterAction.Equal, EnumFilterLogic.And));
var entities = await _hbpoSaDetailRepository.GetListByFilterAsync(filters).ConfigureAwait(false);
var dtos = ObjectMapper.Map<List<HBPO_SA_DETAIL>, List<HBPO_SA_DETAIL_EXPORT_DTO>>(entities);
ExportImporter _exportImporter = new ExportImporter();
var result = await _exportImporter.ExcelExporter(dtos).ConfigureAwait(false);
result.ShouldNotBeNull();
await _excelImportService.SaveBlobAsync(new SaveExcelImportInputDto { Name = fileName, Content = result }).ConfigureAwait(false);
return fileName;
}
#endregion
#region CURD
/// <summary>
/// 获取列表
/// </summary>
[HttpPost]
public async Task<PagedResultDto<HBPO_SA_DETAIL_DTO>> GetListAsync(RequestDto input)
{
var entities = await _hbpoSaDetailRepository.GetListByFilterAsync(input.Filters, input.Sorting, input.MaxResultCount, input.SkipCount, true).ConfigureAwait(false);
var totalCount = await _hbpoSaDetailRepository.GetCountByFilterAsync(input.Filters).ConfigureAwait(false);
var dtos = ObjectMapper.Map<List<HBPO_SA_DETAIL>, List<HBPO_SA_DETAIL_DTO>>(entities);
return new PagedResultDto<HBPO_SA_DETAIL_DTO>(totalCount, dtos);
}
#endregion
#region 对比 #region 对比
/// <summary> /// <summary>
/// HBPO结算与发运比对 /// HBPO结算与发运比对

34
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/HBPO_SA_SERVICE.cs

@ -319,30 +319,31 @@ public class HBPO_SA_SERVICE : SettleAccountApplicationBase<HBPO_SA>
#region 处理结算数据 #region 处理结算数据
//销售价格 //销售价格
var priceListEntitys = await _priceListRepository.GetAllAsync(); var priceListEntitys = await _priceListRepository.GetAllAsync().ConfigureAwait(false);
hbpoSaDetails.ForEach(hbpoSaDetail => hbpoSaDetails.ForEach(hbpoSaDetail =>
{ {
List<string> partCodes = hbpoSaDetail.PartCode.Split(" ").ToList(); List<string> lus = hbpoSaDetail.LU.Split(" ").ToList();
hbpoSaDetail.PartCode = partCodes[0].Replace(" ", ""); hbpoSaDetail.LU = lus[0].Replace(" ", "");
if (partCodes.Count > 1) if (lus.Count > 1)
{ {
partCodes.RemoveAt(0); lus.RemoveAt(0);
var partCodeAssemble = partCodes.Select(t => t.Replace(" ", "")); var luAssemble = lus.Select(t => t.Replace(" ", ""));
hbpoSaDetail.PartCode += partCodeAssemble.Aggregate(" ", (current, index) => current + index); hbpoSaDetail.LU += luAssemble.Aggregate(" ", (current, index) => current + index);
} }
hbpoSaDetail.BillNum = hbpoSaBillNum; hbpoSaDetail.BillNum = hbpoSaBillNum;
hbpoSaDetail.KeyCode = hbpoSaDetail.PN + hbpoSaDetail.LU;
//根据物料号、结算日期获取价格 //根据物料号、结算日期获取价格
var priceListEntity = priceListEntitys.Find(t => t.LU == hbpoSaDetail.PartCode && hbpoSaDetail.SettleDate > t.BeginTime && hbpoSaDetail.SettleDate < t.EndTime); var priceListEntity = priceListEntitys.Find(t => t.LU == hbpoSaDetail.LU && hbpoSaDetail.SettleDate > t.BeginTime && hbpoSaDetail.SettleDate < t.EndTime);
hbpoSaDetail.Price = priceListEntity?.Price ?? default; hbpoSaDetail.Price = priceListEntity?.Price ?? default;
hbpoSaDetail.BusinessType = _businessType; hbpoSaDetail.BusinessType = _businessType;
}); });
//导入的零件号集合 //导入的零件号集合
var importPubSaLUs = hbpoSaDetails.Select(t => t.LU).Distinct(); var importPubSaLUs = hbpoSaDetails.Select(t => t.LU).Distinct();
var materialRelationshipEntitys = await _materialRelationshipRepository.GetListAsync(t => importPubSaLUs.Contains(t.SettleMaterialCode)); var materialRelationshipEntitys = await _materialRelationshipRepository.GetListAsync(t => importPubSaLUs.Contains(t.SettleMaterialCode)).ConfigureAwait(false);
var materialRelationshipEntitySettleMaterialCodes = materialRelationshipEntitys.Select(t => t.SettleMaterialCode).Distinct(); var materialRelationshipEntitySettleMaterialCodes = materialRelationshipEntitys.Select(t => t.SettleMaterialCode).Distinct();
/* /*
@ -361,8 +362,7 @@ public class HBPO_SA_SERVICE : SettleAccountApplicationBase<HBPO_SA>
var seAllMaterialRelationships = materialRelationshipEntitys.Union(materialRelationships); var seAllMaterialRelationships = materialRelationshipEntitys.Union(materialRelationships);
hbpoSaDetails.ForEach(hbpoSaDetail => hbpoSaDetails.ForEach(hbpoSaDetail =>
{ {
hbpoSaDetail.LU = seAllMaterialRelationships.FirstOrDefault(t => t.SettleMaterialCode == hbpoSaDetail.PartCode)?.ErpMaterialCode ?? hbpoSaDetail.PartCode.Replace(" ", "-"); hbpoSaDetail.PartCode = seAllMaterialRelationships.FirstOrDefault(t => t.SettleMaterialCode == hbpoSaDetail.LU)?.ErpMaterialCode ?? hbpoSaDetail.LU.Replace(" ", "-");
hbpoSaDetail.KeyCode = hbpoSaDetail.PN + hbpoSaDetail.LU;
}); });
#endregion #endregion
@ -378,8 +378,8 @@ public class HBPO_SA_SERVICE : SettleAccountApplicationBase<HBPO_SA>
#endregion #endregion
#region 添加入库 #region 添加入库
await _hbpoSaRepository.InsertAsync(hbpoSa); await _hbpoSaRepository.InsertAsync(hbpoSa).ConfigureAwait(false);
await _hbpoSaDetailRepository.InsertManyAsync(hbpoSaDetails); await _hbpoSaDetailRepository.InsertManyAsync(hbpoSaDetails).ConfigureAwait(false);
if (hbpoCanSaDetails.Count > 0) if (hbpoCanSaDetails.Count > 0)
{ {
hbpoCanSa.InvGroupNum = hbpoCanSaDetails.Count.ToString(); hbpoCanSa.InvGroupNum = hbpoCanSaDetails.Count.ToString();
@ -389,8 +389,8 @@ public class HBPO_SA_SERVICE : SettleAccountApplicationBase<HBPO_SA>
hbpoCanSaDetail.BusinessType = _businessType; hbpoCanSaDetail.BusinessType = _businessType;
}); });
await _hbpoCanSaRepository.InsertAsync(hbpoCanSa); await _hbpoCanSaRepository.InsertAsync(hbpoCanSa).ConfigureAwait(false);
await _hbpoCanSaDetailRepository.InsertManyAsync(hbpoCanSaDetails); await _hbpoCanSaDetailRepository.InsertManyAsync(hbpoCanSaDetails).ConfigureAwait(false);
} }
if (hbpoNotSaDetails.Count > 0) if (hbpoNotSaDetails.Count > 0)
{ {
@ -399,11 +399,11 @@ public class HBPO_SA_SERVICE : SettleAccountApplicationBase<HBPO_SA>
hbpoNotSaDetail.BusinessType = _businessType; hbpoNotSaDetail.BusinessType = _businessType;
}); });
await _hbpoNotSaDetailRepository.InsertManyAsync(hbpoNotSaDetails); await _hbpoNotSaDetailRepository.InsertManyAsync(hbpoNotSaDetails).ConfigureAwait(false);
} }
if (materialRelationships.Count > 0) if (materialRelationships.Count > 0)
{ {
await _materialRelationshipRepository.InsertManyAsync(materialRelationships); await _materialRelationshipRepository.InsertManyAsync(materialRelationships).ConfigureAwait(false);
} }
#endregion #endregion
} }

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

@ -11,6 +11,7 @@ using SettleAccount.Job.Services.Report;
using Shouldly; using Shouldly;
using TaskJob.EventArgs; using TaskJob.EventArgs;
using Volo.Abp; using Volo.Abp;
using Volo.Abp.Application.Dtos;
using Volo.Abp.Caching; using Volo.Abp.Caching;
using Win.Abp.Snowflakes; using Win.Abp.Snowflakes;
using Win.Sfs.BaseData.ImportExcelCommon; using Win.Sfs.BaseData.ImportExcelCommon;
@ -99,6 +100,20 @@ public class PUB_SA_DETAIL_SERVICE : SettleAccountApplicationBase<PUB_SA_DETAIL>
} }
#endregion #endregion
#region CURD
/// <summary>
/// 获取列表
/// </summary>
[HttpPost]
public async Task<PagedResultDto<PUB_SA_DETAIL_DTO>> GetListAsync(RequestDto input)
{
var entities = await _pubSaDetailRepository.GetListByFilterAsync(input.Filters, input.Sorting, input.MaxResultCount, input.SkipCount, true).ConfigureAwait(false);
var totalCount = await _pubSaDetailRepository.GetCountByFilterAsync(input.Filters).ConfigureAwait(false);
var dtos = ObjectMapper.Map<List<PUB_SA_DETAIL>, List<PUB_SA_DETAIL_DTO>>(entities);
return new PagedResultDto<PUB_SA_DETAIL_DTO>(totalCount, dtos);
}
#endregion
#region 对比 #region 对比
/// <summary> /// <summary>
/// Pub结算与发运比对 /// Pub结算与发运比对

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

@ -125,21 +125,21 @@ public class PUB_SA_SERVICE : SettleAccountApplicationBase<PUB_SA>
case EnumBusinessType.JisHBPO: case EnumBusinessType.JisHBPO:
break; break;
case EnumBusinessType.ZhiGongJianBBAC: case EnumBusinessType.ZhiGongJianBBAC:
result = await ImportZhiGongJianBBACAsync(pubSaImportRequestDto.Files); result = await ImportZhiGongJianBBACAsync(pubSaImportRequestDto.Files).ConfigureAwait(false);
break; break;
case EnumBusinessType.ZhiGongJianHBPO: case EnumBusinessType.ZhiGongJianHBPO:
result = await ImportZhiGongJianHBPOAsync(pubSaImportRequestDto.Files); result = await ImportZhiGongJianHBPOAsync(pubSaImportRequestDto.Files).ConfigureAwait(false);
break; break;
case EnumBusinessType.MaiDanJianBBAC: case EnumBusinessType.MaiDanJianBBAC:
break; break;
case EnumBusinessType.MaiDanJianHBPO: case EnumBusinessType.MaiDanJianHBPO:
result = await ImportMaiDanJianHBPOAsync(pubSaImportRequestDto.Files); result = await ImportMaiDanJianHBPOAsync(pubSaImportRequestDto.Files).ConfigureAwait(false);
break; break;
case EnumBusinessType.BeiJian: case EnumBusinessType.BeiJian:
result = await ImportBeiJianAsync(pubSaImportRequestDto.Files); result = await ImportBeiJianAsync(pubSaImportRequestDto.Files).ConfigureAwait(false);
break; break;
case EnumBusinessType.YinDuJian: case EnumBusinessType.YinDuJian:
result = await ImportYinDuJianAsync(pubSaImportRequestDto.Files); result = await ImportYinDuJianAsync(pubSaImportRequestDto.Files).ConfigureAwait(false);
break; break;
default: default:
break; break;
@ -285,20 +285,20 @@ public class PUB_SA_SERVICE : SettleAccountApplicationBase<PUB_SA>
{ {
#region 导入数据转换 #region 导入数据转换
ExportImporter _exportImporter = new ExportImporter(); ExportImporter _exportImporter = new ExportImporter();
var importResults = await _exportImporter.UploadExcelImport<ZhiGongJianBBACImportDto>(files, _excelImportService); var importResults = await _exportImporter.UploadExcelImport<ZhiGongJianBBACImportDto>(files, _excelImportService).ConfigureAwait(false);
var importPubSaDetails = ObjectMapper.Map<List<ZhiGongJianBBACImportDto>, List<PUB_SA_DETAIL>>(importResults); var importPubSaDetails = ObjectMapper.Map<List<ZhiGongJianBBACImportDto>, List<PUB_SA_DETAIL>>(importResults);
#endregion #endregion
#region 数据校验 #region 数据校验
var checkList = await CheckAsync(importPubSaDetails); var checkList = await CheckAsync(importPubSaDetails).ConfigureAwait(false);
if (checkList.Count > 0) if (checkList.Count > 0)
{ {
string fileName = await ExportErrorReportAsync(checkList); string fileName = await ExportErrorReportAsync(checkList).ConfigureAwait(false); ;
return new JsonResult(new { Code = ApplicationConsts.ImportFailCode, fileName = fileName }); return new JsonResult(new { Code = ApplicationConsts.ImportFailCode, fileName = fileName });
} }
#endregion #endregion
return await SaDataHandleAsync(importPubSaDetails, EnumBusinessType.ZhiGongJianBBAC); return await SaDataHandleAsync(importPubSaDetails, EnumBusinessType.ZhiGongJianBBAC).ConfigureAwait(false);
} }
/// <summary> /// <summary>
@ -308,7 +308,7 @@ public class PUB_SA_SERVICE : SettleAccountApplicationBase<PUB_SA>
{ {
#region 导入数据转换 #region 导入数据转换
ExportImporter _exportImporter = new ExportImporter(); ExportImporter _exportImporter = new ExportImporter();
var importResults = await _exportImporter.UploadExcelImport<ZhiGongJianHBPOImportDto>(files, _excelImportService); var importResults = await _exportImporter.UploadExcelImport<ZhiGongJianHBPOImportDto>(files, _excelImportService).ConfigureAwait(false);
//截取结算分组前8位为结算日期 //截取结算分组前8位为结算日期
importResults.ForEach(importResult => importResults.ForEach(importResult =>
@ -328,7 +328,7 @@ public class PUB_SA_SERVICE : SettleAccountApplicationBase<PUB_SA>
} }
#endregion #endregion
return await SaDataHandleAsync(importPubSaDetails, EnumBusinessType.ZhiGongJianHBPO); return await SaDataHandleAsync(importPubSaDetails, EnumBusinessType.ZhiGongJianHBPO).ConfigureAwait(false);
} }
/// <summary> /// <summary>
@ -338,7 +338,7 @@ public class PUB_SA_SERVICE : SettleAccountApplicationBase<PUB_SA>
{ {
#region 导入数据转换 #region 导入数据转换
ExportImporter _exportImporter = new ExportImporter(); ExportImporter _exportImporter = new ExportImporter();
var importResults = await _exportImporter.UploadExcelImport<MaiDanJianHBPOImportDto>(files, _excelImportService); var importResults = await _exportImporter.UploadExcelImport<MaiDanJianHBPOImportDto>(files, _excelImportService).ConfigureAwait(false);
importResults.ForEach(importResult => importResults.ForEach(importResult =>
{ {
@ -357,7 +357,7 @@ public class PUB_SA_SERVICE : SettleAccountApplicationBase<PUB_SA>
} }
#endregion #endregion
return await SaDataHandleAsync(importPubSaDetails, EnumBusinessType.BeiJian); return await SaDataHandleAsync(importPubSaDetails, EnumBusinessType.BeiJian).ConfigureAwait(false);
} }
/// <summary> /// <summary>
@ -367,26 +367,20 @@ public class PUB_SA_SERVICE : SettleAccountApplicationBase<PUB_SA>
{ {
#region 导入数据转换 #region 导入数据转换
ExportImporter _exportImporter = new ExportImporter(); ExportImporter _exportImporter = new ExportImporter();
var importResults = await _exportImporter.UploadExcelImport<BeiJianImportDto>(files, _excelImportService); var importResults = await _exportImporter.UploadExcelImport<BeiJianImportDto>(files, _excelImportService).ConfigureAwait(false);
importResults.ForEach(importResult =>
{
importResult.SettleDate = DateTime.Now;
});
var importPubSaDetails = ObjectMapper.Map<List<BeiJianImportDto>, List<PUB_SA_DETAIL>>(importResults); var importPubSaDetails = ObjectMapper.Map<List<BeiJianImportDto>, List<PUB_SA_DETAIL>>(importResults);
#endregion #endregion
#region 数据校验 #region 数据校验
var checkList = await CheckAsync(importPubSaDetails); var checkList = await CheckAsync(importPubSaDetails).ConfigureAwait(false);
if (checkList.Count > 0) if (checkList.Count > 0)
{ {
string fileName = await ExportErrorReportAsync(checkList); string fileName = await ExportErrorReportAsync(checkList).ConfigureAwait(false);
return new JsonResult(new { Code = ApplicationConsts.ImportFailCode, fileName = fileName }); return new JsonResult(new { Code = ApplicationConsts.ImportFailCode, fileName = fileName });
} }
#endregion #endregion
return await SaDataHandleAsync(importPubSaDetails, EnumBusinessType.BeiJian); return await SaDataHandleAsync(importPubSaDetails, EnumBusinessType.BeiJian).ConfigureAwait(false);
} }
/// <summary> /// <summary>
@ -401,15 +395,15 @@ public class PUB_SA_SERVICE : SettleAccountApplicationBase<PUB_SA>
#endregion #endregion
#region 数据校验 #region 数据校验
var checkList = await CheckAsync(importPubSaDetails); var checkList = await CheckAsync(importPubSaDetails).ConfigureAwait(false);
if (checkList.Count > 0) if (checkList.Count > 0)
{ {
string fileName = await ExportErrorReportAsync(checkList); string fileName = await ExportErrorReportAsync(checkList).ConfigureAwait(false);
return new JsonResult(new { Code = ApplicationConsts.ImportFailCode, fileName = fileName }); return new JsonResult(new { Code = ApplicationConsts.ImportFailCode, fileName = fileName });
} }
#endregion #endregion
return await SaDataHandleAsync(importPubSaDetails, EnumBusinessType.YinDuJian); return await SaDataHandleAsync(importPubSaDetails, EnumBusinessType.YinDuJian).ConfigureAwait(false);
} }
/// <summary> /// <summary>
@ -445,31 +439,32 @@ public class PUB_SA_SERVICE : SettleAccountApplicationBase<PUB_SA>
#region 处理结算数据 #region 处理结算数据
//销售价格 //销售价格
var priceListEntitys = await _priceListRepository.GetAllAsync(); var priceListEntitys = await _priceListRepository.GetAllAsync().ConfigureAwait(false);
pubSaDetails.ForEach(importPubSaDetail => pubSaDetails.ForEach(importPubSaDetail =>
{ {
List<string> partCodes = importPubSaDetail.PartCode.Split(" ").ToList(); List<string> lus = importPubSaDetail.LU.Split(" ").ToList();
importPubSaDetail.PartCode = partCodes[0].Replace(" ", ""); importPubSaDetail.LU = lus[0].Replace(" ", "");
if (partCodes.Count > 1) if (lus.Count > 1)
{ {
partCodes.RemoveAt(0); lus.RemoveAt(0);
var luAssemble = partCodes.Select(t => t.Replace(" ", "")); var luAssemble = lus.Select(t => t.Replace(" ", ""));
importPubSaDetail.PartCode += luAssemble.Aggregate(" ", (current, index) => current + index); importPubSaDetail.LU += luAssemble.Aggregate(" ", (current, index) => current + index);
} }
importPubSaDetail.KeyCode = importPubSaDetail.PN + importPubSaDetail.LU;
importPubSaDetail.Version = _version; importPubSaDetail.Version = _version;
importPubSaDetail.BusinessType = businessType; importPubSaDetail.BusinessType = businessType;
importPubSaDetail.Site = "XX工厂"; importPubSaDetail.Site = "XX工厂";
//根据物料号、结算日期获取价格 //根据物料号、结算日期获取价格
var priceListEntity = priceListEntitys.Find(t => t.LU == importPubSaDetail.PartCode && importPubSaDetail.SettleDate > t.BeginTime && importPubSaDetail.SettleDate < t.EndTime); var priceListEntity = priceListEntitys.Find(t => t.LU == importPubSaDetail.LU && importPubSaDetail.SettleDate > t.BeginTime && importPubSaDetail.SettleDate < t.EndTime);
importPubSaDetail.Price = priceListEntity?.Price ?? 0; importPubSaDetail.Price = priceListEntity?.Price ?? 0;
}); });
//导入的零件号集合 //导入的零件号集合
var importPubSaPartCodes = pubSaDetails.Select(t => t.PartCode).Distinct(); var importPubSaLUs = pubSaDetails.Select(t => t.LU).Distinct();
var materialRelationshipEntitys = await _materialRelationshipRepository.GetListAsync(t => importPubSaPartCodes.Contains(t.SettleMaterialCode)); var materialRelationshipEntitys = await _materialRelationshipRepository.GetListAsync(t => importPubSaLUs.Contains(t.SettleMaterialCode)).ConfigureAwait(false); ;
var materialRelationshipEntitySettleMaterialCodes = materialRelationshipEntitys.Select(t => t.SettleMaterialCode).Distinct(); var materialRelationshipEntitySettleMaterialCodes = materialRelationshipEntitys.Select(t => t.SettleMaterialCode).Distinct();
/* /*
@ -477,7 +472,7 @@ public class PUB_SA_SERVICE : SettleAccountApplicationBase<PUB_SA>
* *
* 6- * 6-
*/ */
var noExistSettleMaterialCodes = importPubSaPartCodes.Except(materialRelationshipEntitySettleMaterialCodes); var noExistSettleMaterialCodes = importPubSaLUs.Except(materialRelationshipEntitySettleMaterialCodes);
noExistSettleMaterialCodes.ForEach(t => noExistSettleMaterialCodes.ForEach(t =>
{ {
@ -488,16 +483,15 @@ public class PUB_SA_SERVICE : SettleAccountApplicationBase<PUB_SA>
var seAllMaterialRelationships = materialRelationshipEntitys.Union(materialRelationships); var seAllMaterialRelationships = materialRelationshipEntitys.Union(materialRelationships);
pubSaDetails.ForEach(pubSaDetail => pubSaDetails.ForEach(pubSaDetail =>
{ {
pubSaDetail.LU = seAllMaterialRelationships.FirstOrDefault(t => t.SettleMaterialCode == pubSaDetail.PartCode)?.ErpMaterialCode ?? pubSaDetail.PartCode.Replace(" ", "-"); pubSaDetail.PartCode = seAllMaterialRelationships.FirstOrDefault(t => t.SettleMaterialCode == pubSaDetail.LU)?.ErpMaterialCode ?? pubSaDetail.LU.Replace(" ", "-");
pubSaDetail.KeyCode = pubSaDetail.PN + pubSaDetail.LU;
}); });
#endregion #endregion
#region 添加入库 #region 添加入库
await SeDataEntryAsync(pubSaDetails); await SeDataEntryAsync(pubSaDetails).ConfigureAwait(false);
if (materialRelationships.Count > 0) if (materialRelationships.Count > 0)
{ {
await _materialRelationshipRepository.InsertManyAsync(materialRelationships); await _materialRelationshipRepository.InsertManyAsync(materialRelationships).ConfigureAwait(false);
} }
#endregion #endregion
@ -586,13 +580,13 @@ public class PUB_SA_SERVICE : SettleAccountApplicationBase<PUB_SA>
//不可结算 //不可结算
List<PUB_NOT_SA_DETAIL> pubNotSaDetails = new List<PUB_NOT_SA_DETAIL>(); List<PUB_NOT_SA_DETAIL> pubNotSaDetails = new List<PUB_NOT_SA_DETAIL>();
var pubSaEntity = await _repository.FirstOrDefaultAsync(t => t.Id.Equals(id)); var pubSaEntity = await _repository.FirstOrDefaultAsync(t => t.Id.Equals(id)).ConfigureAwait(false);
if (pubSaEntity != null) if (pubSaEntity != null)
{ {
//结算单据 //结算单据
string pubSaBillNum = pubSaEntity.BillNum; string pubSaBillNum = pubSaEntity.BillNum;
pubCanSas = await _pubCanSaRepository.GetListAsync(t => t.SettleBillNum == pubSaBillNum); pubCanSas = await _pubCanSaRepository.GetListAsync(t => t.SettleBillNum == pubSaBillNum).ConfigureAwait(false);
//验证可结算主表状态 //验证可结算主表状态
if (pubCanSas.Any() && pubCanSas.Any(t => t.State != SettleBillState.)) if (pubCanSas.Any() && pubCanSas.Any(t => t.State != SettleBillState.))
{ {
@ -600,9 +594,9 @@ public class PUB_SA_SERVICE : SettleAccountApplicationBase<PUB_SA>
} }
pubSas.Add(pubSaEntity); pubSas.Add(pubSaEntity);
pubSaDetails = await _pubSaDetailRepository.GetListAsync(t => t.BillNum == pubSaBillNum); pubSaDetails = await _pubSaDetailRepository.GetListAsync(t => t.BillNum == pubSaBillNum).ConfigureAwait(false);
pubCanSaDetails = await _pubCanSaDetailRepository.GetListAsync(t => t.SettleBillNum == pubSaBillNum); pubCanSaDetails = await _pubCanSaDetailRepository.GetListAsync(t => t.SettleBillNum == pubSaBillNum).ConfigureAwait(false);
pubNotSaDetails = await _pubNotSaDetailRepository.GetListAsync(t => t.SettleBillNum == pubSaBillNum); pubNotSaDetails = await _pubNotSaDetailRepository.GetListAsync(t => t.SettleBillNum == pubSaBillNum).ConfigureAwait(false);
} }
return (pubSas, pubSaDetails, pubCanSas, pubCanSaDetails, pubNotSaDetails); return (pubSas, pubSaDetails, pubCanSas, pubCanSaDetails, pubNotSaDetails);

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

@ -70,13 +70,7 @@ public class BBACSeSyncAppService : ApplicationService, IInvocable, IJobService
//同步表名称 //同步表名称
var syncTableName = "JisBBACSeSync_Jit"; var syncTableName = "JisBBACSeSync_Jit";
//BBAC类型集合 //BBAC类型集合
var EnumDeliverSubBillTypes = new List<EnumDeliverSubBillType> var EnumDeliverSubBillTypes = GetDeliverSubBillTypes();
{
EnumDeliverSubBillType.BBAC,
EnumDeliverSubBillType.BBAC,
EnumDeliverSubBillType.BBAC,
EnumDeliverSubBillType.BBAC
};
Expression<Func<TM_BJBMPT_JIT_RECORD, bool>> predicate = (t) => t.DeliverBillType == EnumDeliverBjBmpBillType.JIS件 && EnumDeliverSubBillTypes.Contains(t.DeliverSubBillType); Expression<Func<TM_BJBMPT_JIT_RECORD, bool>> predicate = (t) => t.DeliverBillType == EnumDeliverBjBmpBillType.JIS件 && EnumDeliverSubBillTypes.Contains(t.DeliverSubBillType);
var syncPositionFlag = await _syncPositionFlagRepository.FindAsync(t => t.TableName == syncTableName); var syncPositionFlag = await _syncPositionFlagRepository.FindAsync(t => t.TableName == syncTableName);
@ -91,7 +85,11 @@ public class BBACSeSyncAppService : ApplicationService, IInvocable, IJobService
var bbacSeDetails = ObjectMapper.Map<List<TM_BJBMPT_JIT_RECORD>, List<BBAC_SE_DETAIL>>(wmsSeRecords); var bbacSeDetails = ObjectMapper.Map<List<TM_BJBMPT_JIT_RECORD>, List<BBAC_SE_DETAIL>>(wmsSeRecords);
if (bbacSeDetails.Any()) if (bbacSeDetails.Any())
{ {
bbacSeDetails.ForEach(bbacSeDetail => bbacSeDetail.KeyCode = bbacSeDetail.PN + bbacSeDetail.LU); bbacSeDetails.ForEach(bbacSeDetail =>
{
bbacSeDetail.KeyCode = bbacSeDetail.PN + bbacSeDetail.LU;
bbacSeDetail.BusinessType = EnumBusinessType.JisBBAC;
});
await _bbacSeDetailRepository.InsertManyAsync(bbacSeDetails); await _bbacSeDetailRepository.InsertManyAsync(bbacSeDetails);
if (syncPositionFlag != null) if (syncPositionFlag != null)
@ -119,13 +117,7 @@ public class BBACSeSyncAppService : ApplicationService, IInvocable, IJobService
//同步表名称 //同步表名称
var syncTableName = "JisBBACSeSync_Jis"; var syncTableName = "JisBBACSeSync_Jis";
//BBAC类型集合 //BBAC类型集合
var EnumDeliverSubBillTypes = new List<EnumDeliverSubBillType> var EnumDeliverSubBillTypes = GetDeliverSubBillTypes();
{
EnumDeliverSubBillType.BBAC,
EnumDeliverSubBillType.BBAC,
EnumDeliverSubBillType.BBAC,
EnumDeliverSubBillType.BBAC
};
Expression<Func<TM_BJBMPT_JIS_RECORD, bool>> predicate = (t) => t.DeliverBillType == EnumDeliverBjBmpBillType.JIS件 && EnumDeliverSubBillTypes.Contains(t.DeliverSubBillType); Expression<Func<TM_BJBMPT_JIS_RECORD, bool>> predicate = (t) => t.DeliverBillType == EnumDeliverBjBmpBillType.JIS件 && EnumDeliverSubBillTypes.Contains(t.DeliverSubBillType);
var syncPositionFlag = await _syncPositionFlagRepository.FindAsync(t => t.TableName == syncTableName); var syncPositionFlag = await _syncPositionFlagRepository.FindAsync(t => t.TableName == syncTableName);
if (syncPositionFlag != null) if (syncPositionFlag != null)
@ -158,4 +150,18 @@ public class BBACSeSyncAppService : ApplicationService, IInvocable, IJobService
} }
} }
} }
/// <summary>
/// 获取BBAC类型集合
/// </summary>
private List<EnumDeliverSubBillType> GetDeliverSubBillTypes()
{
return new List<EnumDeliverSubBillType>
{
EnumDeliverSubBillType.BBAC,
EnumDeliverSubBillType.BBAC,
EnumDeliverSubBillType.BBAC,
EnumDeliverSubBillType.BBAC
};
}
} }

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

@ -37,30 +37,40 @@ public class HBPOSeSyncAppService : ApplicationService, IInvocable, IJobService
/// </summary> /// </summary>
private readonly INormalEfCoreRepository<HBPO_SE_DETAIL, Guid> _hbpoSeDetailRepository; private readonly INormalEfCoreRepository<HBPO_SE_DETAIL, Guid> _hbpoSeDetailRepository;
/// <summary>
/// PUB发运数据仓储
/// </summary>
private readonly INormalEfCoreRepository<PUB_SE_DETAIL, Guid> _pubSeDetailRepository;
/// <summary> /// <summary>
/// 构造 /// 构造
/// </summary> /// </summary>
public HBPOSeSyncAppService( public HBPOSeSyncAppService(
WMSBJBMPTDbContext wmsBJBMPTContext, WMSBJBMPTDbContext wmsBJBMPTContext,
INormalEfCoreRepository<SyncPositionFlag, Guid> syncPositionFlagRepository, INormalEfCoreRepository<SyncPositionFlag, Guid> syncPositionFlagRepository,
INormalEfCoreRepository<HBPO_SE_DETAIL, Guid> hbpoSeDetailRepository) INormalEfCoreRepository<HBPO_SE_DETAIL, Guid> hbpoSeDetailRepository,
INormalEfCoreRepository<PUB_SE_DETAIL, Guid> pubSeDetailRepository)
{ {
_wmsBJBMPTContext = wmsBJBMPTContext; _wmsBJBMPTContext = wmsBJBMPTContext;
_syncPositionFlagRepository = syncPositionFlagRepository; _syncPositionFlagRepository = syncPositionFlagRepository;
_hbpoSeDetailRepository = hbpoSeDetailRepository; _hbpoSeDetailRepository = hbpoSeDetailRepository;
_pubSeDetailRepository = pubSeDetailRepository;
} }
[ApiExplorerSettings(IgnoreApi = true)] [ApiExplorerSettings(IgnoreApi = true)]
public async Task Invoke(IServiceProvider serviceProvider) public async Task Invoke(IServiceProvider serviceProvider)
{ {
await this.Invoke(); await this.Invoke().ConfigureAwait(false);
} }
/// <summary>
/// 执行
/// </summary>
[HttpPost] [HttpPost]
public async Task Invoke() public async Task Invoke()
{ {
await SyncJitRecordAsync(); await SyncJitRecordAsync().ConfigureAwait(false);
await SyncJisRecordAsync(); await SyncJisRecordAsync().ConfigureAwait(false);
} }
/// <summary> /// <summary>
@ -71,42 +81,41 @@ public class HBPOSeSyncAppService : ApplicationService, IInvocable, IJobService
//同步表名称 //同步表名称
var syncTableName = "JisHBPOSeSync_Jit"; var syncTableName = "JisHBPOSeSync_Jit";
//HBPO类型集合 //HBPO类型集合
var EnumDeliverSubBillTypes = new List<EnumDeliverSubBillType> var EnumDeliverSubBillTypes = GetDeliverSubBillTypes();
{
EnumDeliverSubBillType.HBPO,
EnumDeliverSubBillType.HBPO,
EnumDeliverSubBillType.HBPO,
EnumDeliverSubBillType.HBPO
};
Expression<Func<TM_BJBMPT_JIT_RECORD, bool>> predicate = (t) => t.DeliverBillType == EnumDeliverBjBmpBillType.JIS件 && EnumDeliverSubBillTypes.Contains(t.DeliverSubBillType); Expression<Func<TM_BJBMPT_JIT_RECORD, bool>> predicate = (t) => t.DeliverBillType == EnumDeliverBjBmpBillType.JIS件 && EnumDeliverSubBillTypes.Contains(t.DeliverSubBillType);
var syncPositionFlag = await _syncPositionFlagRepository.FindAsync(t => t.TableName == syncTableName); var syncPositionFlag = await _syncPositionFlagRepository.FindAsync(t => t.TableName == syncTableName).ConfigureAwait(false);
if (syncPositionFlag != null) if (syncPositionFlag != null)
{ {
predicate = (t) => t.UID > int.Parse(syncPositionFlag.Position) && t.DeliverBillType == EnumDeliverBjBmpBillType.JIS件 && EnumDeliverSubBillTypes.Contains(t.DeliverSubBillType); predicate = (t) => t.UID > int.Parse(syncPositionFlag.Position) && t.DeliverBillType == EnumDeliverBjBmpBillType.JIS件 && EnumDeliverSubBillTypes.Contains(t.DeliverSubBillType);
} }
//WMS发运数据 //WMS发运数据
var wmsRecords = _wmsBJBMPTContext.TM_BJBMPT_JIT_RECORD.Where(predicate).OrderBy(b => b.UID).ToList(); var wmsSeRecords = _wmsBJBMPTContext.TM_BJBMPT_JIT_RECORD.Where(predicate).OrderBy(b => b.UID).ToList();
if (wmsSeRecords.Any())
var hbpoSeDetails = ObjectMapper.Map<List<TM_BJBMPT_JIT_RECORD>, List<HBPO_SE_DETAIL>>(wmsRecords);
if (hbpoSeDetails.Any())
{ {
hbpoSeDetails.ForEach(hbpoSeDetail => hbpoSeDetail.KeyCode = hbpoSeDetail.PN + hbpoSeDetail.LU); //JisHBPO发运
await _hbpoSeDetailRepository.InsertManyAsync(hbpoSeDetails); var hbpoWmsSeRecords = wmsSeRecords.FindAll(t => t.DeliverSubBillType == EnumDeliverSubBillType.HBPO || t.DeliverSubBillType == EnumDeliverSubBillType.HBPO);
//买单件HBPO发运
var maiDanHBPOWmsSeRecords = wmsSeRecords.FindAll(t => t.DeliverSubBillType == EnumDeliverSubBillType.HBPO || t.DeliverSubBillType == EnumDeliverSubBillType.HBPO);
var hbpoSeDetails = ObjectMapper.Map<List<TM_BJBMPT_JIT_RECORD>, List<HBPO_SE_DETAIL>>(hbpoWmsSeRecords);
var maiDanHBPOSeDetails = ObjectMapper.Map<List<TM_BJBMPT_JIT_RECORD>, List<PUB_SE_DETAIL>>(maiDanHBPOWmsSeRecords);
await SaveSeDataAsync(hbpoSeDetails, maiDanHBPOSeDetails).ConfigureAwait(false);
if (syncPositionFlag != null) if (syncPositionFlag != null)
{ {
syncPositionFlag.Position = wmsRecords.Last().UID.ToString(); syncPositionFlag.Position = wmsSeRecords.Last().UID.ToString();
await _syncPositionFlagRepository.UpdateAsync(syncPositionFlag); await _syncPositionFlagRepository.UpdateAsync(syncPositionFlag).ConfigureAwait(false);
} }
else else
{ {
syncPositionFlag = new SyncPositionFlag() syncPositionFlag = new SyncPositionFlag()
{ {
TableName = syncTableName, TableName = syncTableName,
Position = wmsRecords.Last().UID.ToString() Position = wmsSeRecords.Last().UID.ToString()
}; };
await _syncPositionFlagRepository.InsertAsync(syncPositionFlag); await _syncPositionFlagRepository.InsertAsync(syncPositionFlag).ConfigureAwait(false); ;
} }
} }
} }
@ -119,43 +128,71 @@ public class HBPOSeSyncAppService : ApplicationService, IInvocable, IJobService
//同步表名称 //同步表名称
var syncTableName = "JisHBPOSeSync_Jis"; var syncTableName = "JisHBPOSeSync_Jis";
//BBAC类型集合 //BBAC类型集合
var EnumDeliverSubBillTypes = new List<EnumDeliverSubBillType> var EnumDeliverSubBillTypes = GetDeliverSubBillTypes();
{
EnumDeliverSubBillType.BBAC,
EnumDeliverSubBillType.BBAC,
EnumDeliverSubBillType.BBAC,
EnumDeliverSubBillType.BBAC
};
Expression<Func<TM_BJBMPT_JIS_RECORD, bool>> predicate = (t) => t.DeliverBillType == EnumDeliverBjBmpBillType.JIS件 && EnumDeliverSubBillTypes.Contains(t.DeliverSubBillType); Expression<Func<TM_BJBMPT_JIS_RECORD, bool>> predicate = (t) => t.DeliverBillType == EnumDeliverBjBmpBillType.JIS件 && EnumDeliverSubBillTypes.Contains(t.DeliverSubBillType);
var syncPositionFlag = await _syncPositionFlagRepository.FindAsync(t => t.TableName == syncTableName); var syncPositionFlag = await _syncPositionFlagRepository.FindAsync(t => t.TableName == syncTableName).ConfigureAwait(false);
if (syncPositionFlag != null) if (syncPositionFlag != null)
{ {
predicate = (t) => t.UID > int.Parse(syncPositionFlag.Position) && t.DeliverBillType == EnumDeliverBjBmpBillType.JIS件 && EnumDeliverSubBillTypes.Contains(t.DeliverSubBillType); predicate = (t) => t.UID > int.Parse(syncPositionFlag.Position) && t.DeliverBillType == EnumDeliverBjBmpBillType.JIS件 && EnumDeliverSubBillTypes.Contains(t.DeliverSubBillType);
} }
//WMS发运数据 //WMS发运数据
var wmsRecords = _wmsBJBMPTContext.TM_BJBMPT_JIS_RECORD.Where(predicate).OrderBy(b => b.UID).ToList(); var wmsSeRecords = _wmsBJBMPTContext.TM_BJBMPT_JIS_RECORD.Where(predicate).OrderBy(b => b.UID).ToList();
if (wmsSeRecords.Any())
var hbpoSeDetails = ObjectMapper.Map<List<TM_BJBMPT_JIS_RECORD>, List<HBPO_SE_DETAIL>>(wmsRecords);
if (hbpoSeDetails.Any())
{ {
hbpoSeDetails.ForEach(hbpoSeDetail => hbpoSeDetail.KeyCode = hbpoSeDetail.PN + hbpoSeDetail.LU); //JisHBPO发运
await _hbpoSeDetailRepository.InsertManyAsync(hbpoSeDetails); var hbpoWmsSeRecords = wmsSeRecords.FindAll(t => t.DeliverSubBillType == EnumDeliverSubBillType.HBPO || t.DeliverSubBillType == EnumDeliverSubBillType.HBPO);
//买单件HBPO发运
var maiDanHBPOWmsSeRecords = wmsSeRecords.FindAll(t => t.DeliverSubBillType == EnumDeliverSubBillType.HBPO || t.DeliverSubBillType == EnumDeliverSubBillType.HBPO);
var hbpoSeDetails = ObjectMapper.Map<List<TM_BJBMPT_JIS_RECORD>, List<HBPO_SE_DETAIL>>(hbpoWmsSeRecords);
var maiDanHBPOSeDetails = ObjectMapper.Map<List<TM_BJBMPT_JIS_RECORD>, List<PUB_SE_DETAIL>>(maiDanHBPOWmsSeRecords);
await SaveSeDataAsync(hbpoSeDetails, maiDanHBPOSeDetails).ConfigureAwait(false);
if (syncPositionFlag != null) if (syncPositionFlag != null)
{ {
syncPositionFlag.Position = wmsRecords.Last().UID.ToString(); syncPositionFlag.Position = wmsSeRecords.Last().UID.ToString();
await _syncPositionFlagRepository.UpdateAsync(syncPositionFlag); await _syncPositionFlagRepository.UpdateAsync(syncPositionFlag).ConfigureAwait(false);
} }
else else
{ {
syncPositionFlag = new SyncPositionFlag() syncPositionFlag = new SyncPositionFlag()
{ {
TableName = syncTableName, TableName = syncTableName,
Position = wmsRecords.Last().UID.ToString() Position = wmsSeRecords.Last().UID.ToString()
}; };
await _syncPositionFlagRepository.InsertAsync(syncPositionFlag); await _syncPositionFlagRepository.InsertAsync(syncPositionFlag).ConfigureAwait(false);
} }
} }
} }
/// <summary>
/// 获取HBPO类型集合
/// </summary>
private List<EnumDeliverSubBillType> GetDeliverSubBillTypes()
{
return new List<EnumDeliverSubBillType>
{
EnumDeliverSubBillType.HBPO,
EnumDeliverSubBillType.HBPO,
EnumDeliverSubBillType.HBPO,
EnumDeliverSubBillType.HBPO
};
}
/// <summary>
/// 保存发运树
/// </summary>
private async Task SaveSeDataAsync(List<HBPO_SE_DETAIL> hbpoSeDetails, List<PUB_SE_DETAIL> maiDanHBPOSeDetails)
{
hbpoSeDetails.ForEach(hbpoSeDetail => hbpoSeDetail.KeyCode = hbpoSeDetail.PN + hbpoSeDetail.LU);
maiDanHBPOSeDetails.ForEach(maiDanHBPOSeDetail =>
{
maiDanHBPOSeDetail.KeyCode = maiDanHBPOSeDetail.PN + maiDanHBPOSeDetail.LU;
maiDanHBPOSeDetail.BusinessType = EnumBusinessType.MaiDanJianHBPO;
});
await _hbpoSeDetailRepository.InsertManyAsync(hbpoSeDetails).ConfigureAwait(false);
await _pubSeDetailRepository.InsertManyAsync(maiDanHBPOSeDetails).ConfigureAwait(false);
}
} }

50
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/JisBBACSeEdiCompareAppService.cs

@ -28,17 +28,49 @@ public class JisBBACSeEdiCompareAppService : ApplicationService, IInvocable
/// </summary> /// </summary>
public async Task Invoke() public async Task Invoke()
{ {
await HandDelEdiDataAsync().ConfigureAwait(false);
//using var serviceScope = _serviceProvider.CreateScope();
//var db = serviceScope.ServiceProvider.GetRequiredService<SettleAccountDbContext>();
//var query = db.Set<BBAC_SE_DETAIL>().Join(db.Set<BBAC_SE_EDI>(), a => new { a.PN, a.LU, a.Qty }, b => new { b.PN, b.LU, b.Qty }, (se, edi) => new { se, edi }).Where(t => t.se.IsHaveEdiData == false && t.edi.IsHaveSeData == false && t.edi.IsDeleted == false);
//query.ForEach(t =>
//{
// t.edi.SeId = t.se.Id;
// t.edi.IsHaveSeData = true;
// t.se.IsHaveEdiData = true;
//});
//var ses = query.Select(t => t.se);
//var edis = query.Select(t => t.edi);
//db.Set<BBAC_SE_DETAIL>().UpdateRange(ses);
//db.Set<BBAC_SE_EDI>().UpdateRange(edis);
//await db.SaveChangesAsync().ConfigureAwait(false);
}
/// <summary>
/// 处理删除的EDI数据
/// </summary>
private async Task HandDelEdiDataAsync()
{
/*
*
*
* EDI数据
* EDI数据状态为无发运数据
*/
using var serviceScope = _serviceProvider.CreateScope(); using var serviceScope = _serviceProvider.CreateScope();
var db = serviceScope.ServiceProvider.GetRequiredService<SettleAccountDbContext>(); var db = serviceScope.ServiceProvider.GetRequiredService<SettleAccountDbContext>();
var query = db.Set<BBAC_SE_DETAIL>().Join(db.Set<BBAC_SE_EDI>(), a => new { a.PN, a.LU, a.Qty }, b => new { b.PN, b.LU, b.Qty }, (se, edi) => new { se, edi }).Where(t => t.se.IsHaveEdiData == false && t.edi.IsHaveSeData == false); var query = db.Set<BBAC_SE_EDI>().Join(db.Set<BBAC_SE_DETAIL>(), a => a.SeId, b => b.Id, (edi, se) => new { se, edi }).Where(t => t.edi.IsDeleted == true && t.edi.IsHaveSeData == true);
var ses = query.Select(t => t.se); //query.ForEach(t =>
var edis = query.Select(t => t.edi); //{
// t.edi.SeId = default;
ses.ForEach(t => t.IsHaveEdiData = true); // t.edi.IsHaveSeData = false;
edis.ForEach(t => t.IsHaveSeData = true); // t.se.IsHaveEdiData = false;
//});
//var ses = query.Select(t => t.se);
//var edis = query.Select(t => t.edi);
db.Set<BBAC_SE_DETAIL>().UpdateRange(ses); //db.Set<BBAC_SE_DETAIL>().UpdateRange(ses);
db.Set<BBAC_SE_EDI>().UpdateRange(edis); //db.Set<BBAC_SE_EDI>().UpdateRange(edis);
await db.SaveChangesAsync().ConfigureAwait(false); //await db.SaveChangesAsync().ConfigureAwait(false);
} }
} }

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

@ -66,7 +66,7 @@ public class JisHBPOSeEdiCompareAppService : ApplicationService, IInvocable
// se, // se,
// edi // edi
// }; // };
var query = db.Set<HBPO_SE_DETAIL>().Join(db.Set<HBPO_SE_EDI>(), a => new { a.PN, a.LU, a.Qty }, b => new { b.PN, b.LU, b.Qty }, (se, edi) => new { se, edi }).Where(t => t.se.IsHaveEdiData == false && t.edi.IsHaveSeData == false); var query = db.Set<HBPO_SE_DETAIL>().Join(db.Set<HBPO_SE_EDI>(), a => new { a.PN, a.LU, a.Qty }, b => new { b.PN, b.LU, b.Qty }, (se, edi) => new { se, edi }).Where(t => t.se.IsHaveEdiData == false && t.edi.IsHaveSeData == false && t.edi.IsDeleted == false);
var ses = query.Select(t => t.se); var ses = query.Select(t => t.se);
var edis = query.Select(t => t.edi); var edis = query.Select(t => t.edi);
@ -79,4 +79,26 @@ public class JisHBPOSeEdiCompareAppService : ApplicationService, IInvocable
Debug.WriteLine($"处理数量:{query.Count()}"); Debug.WriteLine($"处理数量:{query.Count()}");
} }
/// <summary>
/// 处理删除的EDI数据
/// </summary>
private async Task HandDelEdiDataAsync()
{
using var serviceScope = _serviceProvider.CreateScope();
var db = serviceScope.ServiceProvider.GetRequiredService<SettleAccountDbContext>();
var query = db.Set<HBPO_SE_EDI>().Join(db.Set<HBPO_SE_DETAIL>(), a => a.SeId, b => b.Id, (edi, se) => new { se, edi }).Where(t => t.edi.IsDeleted == true && t.edi.IsHaveSeData == true);
query.ForEach(t =>
{
t.edi.SeId = default;
t.edi.IsHaveSeData = false;
t.se.IsHaveEdiData = false;
});
var ses = query.Select(t => t.se);
var edis = query.Select(t => t.edi);
db.Set<HBPO_SE_DETAIL>().UpdateRange(ses);
db.Set<HBPO_SE_EDI>().UpdateRange(edis);
await db.SaveChangesAsync().ConfigureAwait(false);
}
} }

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

@ -9,6 +9,7 @@ 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.Entities.BQ.Vmi;
using Win.Sfs.SettleAccount.EntityFrameworkCore; using Win.Sfs.SettleAccount.EntityFrameworkCore;
using Win.Sfs.SettleAccount.MaterialRelationships;
using Win.Sfs.Shared.RepositoryBase; using Win.Sfs.Shared.RepositoryBase;
namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs; namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs;
@ -34,6 +35,11 @@ public class JitSeSyncAppService : ApplicationService, IInvocable
/// </summary> /// </summary>
private readonly INormalEfCoreRepository<PUB_SE_DETAIL, Guid> _pubSeDetailRepository; private readonly INormalEfCoreRepository<PUB_SE_DETAIL, Guid> _pubSeDetailRepository;
/// <summary>
/// 客户零件关系仓储
/// </summary>
private readonly INormalEfCoreRepository<MaterialRelationship, Guid> _materialRelationshipRepository;
private readonly IVmiService _vmiService; private readonly IVmiService _vmiService;
/// <summary> /// <summary>
@ -84,6 +90,19 @@ public class JitSeSyncAppService : ApplicationService, IInvocable
var pubSeDetails = ObjectMapper.Map<List<TM_BJBMPT_OTHER_RECORD>, List<PUB_SE_DETAIL>>(wmsSeRecords); var pubSeDetails = ObjectMapper.Map<List<TM_BJBMPT_OTHER_RECORD>, List<PUB_SE_DETAIL>>(wmsSeRecords);
if (pubSeDetails.Any()) if (pubSeDetails.Any())
{ {
//客户零件号和厂内零件号
var luRePartCodes = pubSeDetails.Select(t => new { t.LU, t.PartCode });
var haveLuRePartCodes = (await _materialRelationshipRepository.GetListAsync(t => luRePartCodes.Contains(new { LU = t.ErpMaterialCode, PartCode = t.SettleMaterialCode })).ConfigureAwait(false)).Select(t => new { LU = t.ErpMaterialCode, PartCode = t.SettleMaterialCode });
var noHaveLuRePartCodes = luRePartCodes.Except(haveLuRePartCodes);
if (noHaveLuRePartCodes.Any())
{
var materialRelationships = noHaveLuRePartCodes.Select(t => new MaterialRelationship(GuidGenerator.Create(), t.LU, "", t.PartCode, ""));
await _materialRelationshipRepository.InsertManyAsync(materialRelationships).ConfigureAwait(false);
}
pubSeDetails.ForEach(t => pubSeDetails.ForEach(t =>
{ {
t.BusinessType = businessType; t.BusinessType = businessType;

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

@ -1,65 +1,57 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Reflection;
using AutoMapper; using AutoMapper;
using Win.Sfs.SettleAccount.EstimatedStockDiffReports; using Newtonsoft.Json;
using SettleAccount.Domain.BQ;
using Win.Sfs.SettleAccount.Boms; using Win.Sfs.SettleAccount.Boms;
using Win.Sfs.SettleAccount.BTNotConsignReports;
using Win.Sfs.SettleAccount.BTSeqKBDiffReports;
using Win.Sfs.SettleAccount.Entities;
using Win.Sfs.SettleAccount.Entities.Boms; using Win.Sfs.SettleAccount.Entities.Boms;
using Win.Sfs.SettleAccount.Entities.BQ.Dtos;
using Win.Sfs.SettleAccount.Entities.BQ.Dtos.SettleAccount.Domain.BQ;
using Win.Sfs.SettleAccount.Entities.BQ.Syncs;
using Win.Sfs.SettleAccount.Entities.CodeSettings; using Win.Sfs.SettleAccount.Entities.CodeSettings;
using Win.Sfs.SettleAccount.FISes;
using Win.Sfs.SettleAccount.Entities.Materials;
using Win.Sfs.SettleAccount.Entities.SettleAccounts;
using Win.Sfs.SettleAccount.Inventories;
using Win.Sfs.SettleAccount.Items;
using Win.Sfs.SettleAccount.MaterialRelationships;
using Win.Sfs.SettleAccount.Entities.SettleAccountVersion;
using Win.Sfs.SettleAccount.Prebatches;
using Win.Sfs.SettleAccount.Entities.Controls; using Win.Sfs.SettleAccount.Entities.Controls;
using Win.Sfs.SettleAccount.SendUnsettledDiffReports; using Win.Sfs.SettleAccount.Entities.Errors;
using Win.Sfs.SettleAccount.StockSettledDiffReports;
using Win.Sfs.SettleAccount.StockUnsettledDiffReports;
using Win.Sfs.SettleAccount.StockFisDiffReports;
using Win.Sfs.SettleAccount.SecondaryActuralAdjustmentReports;
using Win.Sfs.SettleAccount.SecondaryActuralDiffReports;
using Win.Sfs.SettleAccount.Entities.StorageLocations;
using Win.Sfs.SettleAccount.Entities.Inventories;
using Win.Sfs.SettleAccount.Entities.InventoryDetialVersion;
using Win.Sfs.SettleAccount.Entities.Factories; using Win.Sfs.SettleAccount.Entities.Factories;
using Win.Sfs.SettleAccount.SecondaryExportReports;
using System;
using Win.Sfs.SettleAccount.SupplierItemSetUps;
using Win.Sfs.SettleAccount.BTSeqKBDiffReports;
using Win.Sfs.SettleAccount.BTNotConsignReports;
using Win.Sfs.SettleAccount.HQNotConsignReports;
using Win.Sfs.SettleAccount.HQSPNotConsignReports;
using Win.Sfs.SettleAccount.Reports.SendUnsettledDiffReports;
using Win.Sfs.SettleAccount.Entities.ImportMap;
using Win.Sfs.SettleAccount.Entities.ImportColumnMaps; using Win.Sfs.SettleAccount.Entities.ImportColumnMaps;
using Win.Sfs.SettleAccount.Entities.ImportMap;
using Win.Sfs.SettleAccount.Entities.Inventories;
using Win.Sfs.SettleAccount.Entities.InventoryDetialVersion;
using Win.Sfs.SettleAccount.Entities.Invoices; using Win.Sfs.SettleAccount.Entities.Invoices;
using Win.Sfs.SettleAccount.Entities.Invoices.Win.Sfs.SettleAccount.Entities.Invoices; using Win.Sfs.SettleAccount.Entities.Invoices.Win.Sfs.SettleAccount.Entities.Invoices;
using Win.Sfs.SettleAccount.Reports.InvoiceSettledDiffs;
using Win.Sfs.SettleAccount.Entities.Prices;
using Win.Sfs.SettleAccount.Entities.MaterialRelationships;
using Win.Sfs.SettleAccount.Entities.SettlementParts;
using Win.Sfs.SettleAccount.Entities.ItemInvoicePrices; using Win.Sfs.SettleAccount.Entities.ItemInvoicePrices;
using Win.Sfs.SettleAccount.Entities.SettlementPartss; using Win.Sfs.SettleAccount.Entities.MaterialRelationships;
using Win.Sfs.SettleAccount.Entities.SettlementPakAndSparePartss; using Win.Sfs.SettleAccount.Entities.Materials;
using Win.Sfs.SettleAccount.Entities.Prices;
using Win.Sfs.SettleAccount.Entities.SecMatch; using Win.Sfs.SettleAccount.Entities.SecMatch;
using Win.Sfs.SettleAccount.Entities.VWKanBan; using Win.Sfs.SettleAccount.Entities.SettleAccounts;
using Win.Sfs.SettleAccount.Entities.VWKanBanVersion; using Win.Sfs.SettleAccount.Entities.SettleAccountVersion;
using Win.Sfs.SettleAccount.Entities; using Win.Sfs.SettleAccount.Entities.SettlementParts;
using Win.Sfs.SettleAccount.Entities.StorageLocations;
using Win.Sfs.SettleAccount.Entities.UnHQSettleAccounts; using Win.Sfs.SettleAccount.Entities.UnHQSettleAccounts;
using Win.Sfs.SettleAccount.Entities.Wms.WmsSumOutput; using Win.Sfs.SettleAccount.Entities.Wms.WmsSumOutput;
using Win.Sfs.SettleAccount.Errors; using Win.Sfs.SettleAccount.Errors;
using Win.Sfs.SettleAccount.Entities.Errors; using Win.Sfs.SettleAccount.EstimatedStockDiffReports;
using Win.Sfs.SettleAccount.Entities.BQ.Dtos; using Win.Sfs.SettleAccount.FISes;
using SettleAccount.Domain.BQ; using Win.Sfs.SettleAccount.HQNotConsignReports;
using System.ComponentModel.DataAnnotations; using Win.Sfs.SettleAccount.HQSPNotConsignReports;
using System.Reflection; using Win.Sfs.SettleAccount.Inventories;
using Win.Sfs.SettleAccount.Entities.BQ.Syncs; using Win.Sfs.SettleAccount.MaterialRelationships;
using Win.Sfs.SettleAccount.Entities.BQ.Dtos.SettleAccount.Domain.BQ; using Win.Sfs.SettleAccount.Prebatches;
using Win.Sfs.SettleAccount.Reports.InvoiceSettledDiffs;
using Win.Sfs.SettleAccount.Reports.SendUnsettledDiffReports;
using Win.Sfs.SettleAccount.SecondaryActuralAdjustmentReports;
using Win.Sfs.SettleAccount.SecondaryActuralDiffReports;
using Win.Sfs.SettleAccount.SecondaryExportReports;
using Win.Sfs.SettleAccount.SendUnsettledDiffReports;
using Win.Sfs.SettleAccount.StockFisDiffReports;
using Win.Sfs.SettleAccount.StockSettledDiffReports;
using Win.Sfs.SettleAccount.StockUnsettledDiffReports;
using Win.Sfs.SettleAccount.SupplierItemSetUps;
namespace Win.Sfs.SettleAccount namespace Win.Sfs.SettleAccount
{ {
@ -1025,13 +1017,14 @@ namespace Win.Sfs.SettleAccount
/// </summary> /// </summary>
private void CreateMapBBAC_SA_DETAIL() private void CreateMapBBAC_SA_DETAIL()
{ {
CreateMap<BBAC_SA_DETAIL, BBAC_SA_DETAIL_DTO>();
CreateMap<BBAC_SA_DETAIL, BBAC_CAN_SA_DETAIL>() CreateMap<BBAC_SA_DETAIL, BBAC_CAN_SA_DETAIL>()
.ForMember(x => x.SettleBillNum, y => y.MapFrom(d => d.BillNum)); .ForMember(x => x.SettleBillNum, y => y.MapFrom(d => d.BillNum));
CreateMap<BBAC_SA_DETAIL, BBAC_NOT_SA_DETAIL>() CreateMap<BBAC_SA_DETAIL, BBAC_NOT_SA_DETAIL>()
.ForMember(x => x.SettleBillNum, y => y.MapFrom(d => d.BillNum)); .ForMember(x => x.SettleBillNum, y => y.MapFrom(d => d.BillNum));
CreateMap<BBAC_SA_DETAIL, BBAC_SA_DETAIL_EXPORT_DTO>();
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>
@ -1065,11 +1058,12 @@ namespace Win.Sfs.SettleAccount
/// </summary> /// </summary>
private void CreateMapHBPO_SA_DETAIL() private void CreateMapHBPO_SA_DETAIL()
{ {
CreateMap<HBPO_SA_DETAIL, HBPO_SA_DETAIL_DTO>();
CreateMap<HBPO_SA_DETAIL, HBPO_CAN_SA_DETAIL>() CreateMap<HBPO_SA_DETAIL, HBPO_CAN_SA_DETAIL>()
.ForMember(x => x.SettleBillNum, y => y.MapFrom(d => d.BillNum)); .ForMember(x => x.SettleBillNum, y => y.MapFrom(d => d.BillNum));
CreateMap<HBPO_SA_DETAIL, HBPO_NOT_SA_DETAIL>() CreateMap<HBPO_SA_DETAIL, HBPO_NOT_SA_DETAIL>()
.ForMember(x => x.SettleBillNum, y => y.MapFrom(d => d.BillNum)); .ForMember(x => x.SettleBillNum, y => y.MapFrom(d => d.BillNum));
//CreateMap<HBPO_SA_DETAIL, HBPO_SA_DETAIL_EXPORT_DTO>(); CreateMap<HBPO_SA_DETAIL, HBPO_SA_DETAIL_EXPORT_DTO>();
CreateMap<HBPO_SA_DETAIL_IMPORT_DTO, HBPO_SA_DETAIL>(); CreateMap<HBPO_SA_DETAIL_IMPORT_DTO, HBPO_SA_DETAIL>();
} }
@ -1096,6 +1090,8 @@ namespace Win.Sfs.SettleAccount
/// </summary> /// </summary>
private void CreateMapPUB_SA_DETAIL() private void CreateMapPUB_SA_DETAIL()
{ {
CreateMap<PUB_SA_DETAIL, PUB_SA_DETAIL_DTO>();
CreateMap<PUB_SA_DETAIL, PUB_CAN_SA_DETAIL>() CreateMap<PUB_SA_DETAIL, PUB_CAN_SA_DETAIL>()
.ForMember(x => x.SettleBillNum, y => y.MapFrom(d => d.BillNum)); .ForMember(x => x.SettleBillNum, y => y.MapFrom(d => d.BillNum));
CreateMap<PUB_SA_DETAIL, PUB_NOT_SA_DETAIL>() CreateMap<PUB_SA_DETAIL, PUB_NOT_SA_DETAIL>()
@ -1105,7 +1101,25 @@ namespace Win.Sfs.SettleAccount
CreateMap<ZhiGongJianBBACImportDto, PUB_SA_DETAIL>(); CreateMap<ZhiGongJianBBACImportDto, PUB_SA_DETAIL>();
CreateMap<ZhiGongJianHBPOImportDto, PUB_SA_DETAIL>(); CreateMap<ZhiGongJianHBPOImportDto, PUB_SA_DETAIL>();
CreateMap<MaiDanJianHBPOImportDto, PUB_SA_DETAIL>(); CreateMap<MaiDanJianHBPOImportDto, PUB_SA_DETAIL>();
CreateMap<BeiJianImportDto, PUB_SA_DETAIL>(); CreateMap<BeiJianImportDto, PUB_SA_DETAIL>()
.ForMember(x => x.ExtraProperties, y => y.MapFrom(d =>
new Dictionary<string, object>()
{
{ "DeliveryNumber", d.DeliveryNumber},
{ "InvoiceNumber", d.InvoiceNumber},
{ "VendorCode", d.VendorCode},
{ "VendorName", d.VendorName},
{ "PurchaseOrderNumber", d.PurchaseOrderNumber},
{ "DeliveryIndexNumber", d.DeliveryIndexNumber},
{ "PartName", d.PartName},
{ "Price", d.Price},
{ "Amount", d.Amount},
{ "Tallage", d.Tallage},
{ "Total", d.Total},
{ "ProtocolNumber", d.ProtocolNumber},
{ "Remark", d.Remark},
{ "CommodityGroup", d.CommodityGroup}
}));
CreateMap<YinDuJianImportDto, PUB_SA_DETAIL>(); CreateMap<YinDuJianImportDto, PUB_SA_DETAIL>();
} }
@ -1114,6 +1128,16 @@ namespace Win.Sfs.SettleAccount
/// </summary> /// </summary>
private void CreateMapSeSync() private void CreateMapSeSync()
{ {
CreateMap<TM_BJBMPT_JIT_RECORD, BBAC_SE_DETAIL>()
.ForMember(x => x.SeqNumber, y => y.MapFrom(d => d.JISNum))
.ForMember(x => x.AssemblyCode, y => y.MapFrom(d => d.RealPartCode))
.ForMember(x => x.InjectionCode, y => y.MapFrom(d => d.DeliverCode))
.ForMember(x => x.BeginDate, y => y.MapFrom(d => d.BillTime))
.ForMember(x => x.ShippingDate, y => y.MapFrom(d => d.BillTime))
.ForMember(x => x.WmsBillNum, y => y.MapFrom(d => d.BillNum))
.ForMember(x => x.LU, y => y.MapFrom(d => d.PartCode))
.ForMember(x => x.PN, y => y.MapFrom(d => d.VinCode))
.ForMember(x => x.Qty, y => y.MapFrom(d => d.Qty));
CreateMap<TM_BJBMPT_JIT_RECORD, HBPO_SE_DETAIL>() CreateMap<TM_BJBMPT_JIT_RECORD, HBPO_SE_DETAIL>()
.ForMember(x => x.SeqNumber, y => y.MapFrom(d => d.JISNum)) .ForMember(x => x.SeqNumber, y => y.MapFrom(d => d.JISNum))
.ForMember(x => x.AssemblyCode, y => y.MapFrom(d => d.RealPartCode)) .ForMember(x => x.AssemblyCode, y => y.MapFrom(d => d.RealPartCode))
@ -1124,7 +1148,24 @@ namespace Win.Sfs.SettleAccount
.ForMember(x => x.LU, y => y.MapFrom(d => d.PartCode)) .ForMember(x => x.LU, y => y.MapFrom(d => d.PartCode))
.ForMember(x => x.PN, y => y.MapFrom(d => d.VinCode)) .ForMember(x => x.PN, y => y.MapFrom(d => d.VinCode))
.ForMember(x => x.Qty, y => y.MapFrom(d => d.Qty)); .ForMember(x => x.Qty, y => y.MapFrom(d => d.Qty));
CreateMap<TM_BJBMPT_JIT_RECORD, PUB_SE_DETAIL>()
.ForMember(x => x.BeginDate, y => y.MapFrom(d => d.BillTime))
.ForMember(x => x.ShippingDate, y => y.MapFrom(d => d.BillTime))
.ForMember(x => x.WmsBillNum, y => y.MapFrom(d => d.BillNum))
.ForMember(x => x.LU, y => y.MapFrom(d => d.PartCode))
.ForMember(x => x.PN, y => y.MapFrom(d => d.VinCode))
.ForMember(x => x.Qty, y => y.MapFrom(d => d.Qty));
CreateMap<TM_BJBMPT_JIS_RECORD, BBAC_SE_DETAIL>()
.ForMember(x => x.SeqNumber, y => y.MapFrom(d => d.JISNum))
.ForMember(x => x.AssemblyCode, y => y.MapFrom(d => d.RealPartCode))
.ForMember(x => x.InjectionCode, y => y.MapFrom(d => d.DeliverCode))
.ForMember(x => x.BeginDate, y => y.MapFrom(d => d.BillTime))
.ForMember(x => x.ShippingDate, y => y.MapFrom(d => d.BillTime))
.ForMember(x => x.WmsBillNum, y => y.MapFrom(d => d.BillNum))
.ForMember(x => x.LU, y => y.MapFrom(d => d.PartCode))
.ForMember(x => x.PN, y => y.MapFrom(d => d.VinCode))
.ForMember(x => x.Qty, y => y.MapFrom(d => d.Qty));
CreateMap<TM_BJBMPT_JIS_RECORD, HBPO_SE_DETAIL>() CreateMap<TM_BJBMPT_JIS_RECORD, HBPO_SE_DETAIL>()
.ForMember(x => x.SeqNumber, y => y.MapFrom(d => d.JISNum)) .ForMember(x => x.SeqNumber, y => y.MapFrom(d => d.JISNum))
.ForMember(x => x.AssemblyCode, y => y.MapFrom(d => d.RealPartCode)) .ForMember(x => x.AssemblyCode, y => y.MapFrom(d => d.RealPartCode))
@ -1135,6 +1176,13 @@ namespace Win.Sfs.SettleAccount
.ForMember(x => x.LU, y => y.MapFrom(d => d.PartCode)) .ForMember(x => x.LU, y => y.MapFrom(d => d.PartCode))
.ForMember(x => x.PN, y => y.MapFrom(d => d.VinCode)) .ForMember(x => x.PN, y => y.MapFrom(d => d.VinCode))
.ForMember(x => x.Qty, y => y.MapFrom(d => d.Qty)); .ForMember(x => x.Qty, y => y.MapFrom(d => d.Qty));
CreateMap<TM_BJBMPT_JIS_RECORD, PUB_SE_DETAIL>()
.ForMember(x => x.BeginDate, y => y.MapFrom(d => d.BillTime))
.ForMember(x => x.ShippingDate, y => y.MapFrom(d => d.BillTime))
.ForMember(x => x.WmsBillNum, y => y.MapFrom(d => d.BillNum))
.ForMember(x => x.LU, y => y.MapFrom(d => d.PartCode))
.ForMember(x => x.PN, y => y.MapFrom(d => d.VinCode))
.ForMember(x => x.Qty, y => y.MapFrom(d => d.Qty));
CreateMap<TM_BJBMPT_OTHER_RECORD, PUB_SE_DETAIL>() CreateMap<TM_BJBMPT_OTHER_RECORD, PUB_SE_DETAIL>()
.ForMember(x => x.BeginDate, y => y.MapFrom(d => d.DnBillTime)) .ForMember(x => x.BeginDate, y => y.MapFrom(d => d.DnBillTime))

13
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/BBAC_SE_DETAIL.cs

@ -1,16 +1,19 @@
using SettleAccount.Bases;
using System; using System;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using SettleAccount.Bases;
using Win.Sfs.SettleAccount;
namespace SettleAccount.Domain.BQ; namespace SettleAccount.Domain.BQ;
[Display(Name = "BBAC发运单")] [Display(Name = "BBAC发运单")]
public class BBAC_SE_DETAIL:SE_BASE public class BBAC_SE_DETAIL:SE_BASE
{ {
/// <summary>
/// 业务分类
/// </summary>
[Display(Name = "业务分类")]
public EnumBusinessType BusinessType { get; set; }
//[Display(Name = "LU+生产码")] //[Display(Name = "LU+生产码")]
//public string KeyCode { get; set; } = null!; //public string KeyCode { get; set; } = null!;

6
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/BBAC_SE_EDI.cs

@ -50,6 +50,12 @@ public class BBAC_SE_EDI:FullAuditedAggregateRoot<Guid>
[Display(Name = "是否有发运数据")] [Display(Name = "是否有发运数据")]
public bool IsHaveSeData { get; set; } public bool IsHaveSeData { get; set; }
/// <summary>
/// 发运Id
/// </summary>
[Display(Name = "是否有发运数据")]
public Guid SeId { get; set; }
public BBAC_SE_EDI() public BBAC_SE_EDI()
{ } { }
public BBAC_SE_EDI(Guid guid, string keyCode, string version, string lU, string pN, string seqNumber, string assemblyCode, string injectionCode, decimal qty, DateTime beginDate public BBAC_SE_EDI(Guid guid, string keyCode, string version, string lU, string pN, string seqNumber, string assemblyCode, string injectionCode, decimal qty, DateTime beginDate

6
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/HBPO_SE_EDI.cs

@ -53,6 +53,12 @@ public class HBPO_SE_EDI :FullAuditedAggregateRoot<Guid>
[Display(Name = "是否有发运数据")] [Display(Name = "是否有发运数据")]
public bool IsHaveSeData { get; set; } public bool IsHaveSeData { get; set; }
/// <summary>
/// 发运Id
/// </summary>
[Display(Name = "是否有发运数据")]
public Guid SeId { get; set; }
public HBPO_SE_EDI(Guid guid ,string keyCode, int version, string lU, string pN, string seqNumber, string assemblyCode, string injectionCode, decimal qty, DateTime beginDate, string site, string extend1, string extend2, string extend3, string extend4) public HBPO_SE_EDI(Guid guid ,string keyCode, int version, string lU, string pN, string seqNumber, string assemblyCode, string injectionCode, decimal qty, DateTime beginDate, string site, string extend1, string extend2, string extend3, string extend4)
{ {
Id = guid; Id = guid;

Loading…
Cancel
Save