Browse Source

Merge branch 'master' of http://dev.ccwin-in.com:3000/BoXu.Zheng/BeiJinSettleAccount

master
wanggang 1 year ago
parent
commit
b9bfc09740
  1. 18
      code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/PUB_SA_DTO.cs
  2. 25
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/HBPO_SA_SERVICE.cs
  3. 51
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_SA_SERVICE.cs

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

@ -179,7 +179,6 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Dtos
[Display(Name = "结算日期")] [Display(Name = "结算日期")]
[ImporterHeader(Name = "零件时间")] [ImporterHeader(Name = "零件时间")]
public DateTime SettleDate { set; get; } public DateTime SettleDate { set; get; }
/// <summary> /// <summary>
/// 客户零件号 /// 客户零件号
/// </summary> /// </summary>
@ -187,7 +186,6 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Dtos
[Required(ErrorMessage = "{0}不能为空")] [Required(ErrorMessage = "{0}不能为空")]
[ImporterHeader(Name = "零件号")] [ImporterHeader(Name = "零件号")]
public string LU { get; set; } public string LU { get; set; }
/// <summary> /// <summary>
/// 生产号 /// 生产号
/// </summary> /// </summary>
@ -195,14 +193,12 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Dtos
[ImporterHeader(Name = "交付识别号")] [ImporterHeader(Name = "交付识别号")]
[Required(ErrorMessage = "{0}不能为空")] [Required(ErrorMessage = "{0}不能为空")]
public string PN { get; set; } public string PN { get; set; }
/// <summary> /// <summary>
/// 数量 /// 数量
/// </summary> /// </summary>
[Display(Name = "数量")] [Display(Name = "数量")]
[ImporterHeader(Name = "数量")] [ImporterHeader(Name = "数量")]
public decimal Qty { get; set; } public decimal Qty { get; set; }
/// <summary> /// <summary>
/// 结算分组号 /// 结算分组号
/// </summary> /// </summary>
@ -210,7 +206,6 @@ 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>
/// 采购订单号 /// 采购订单号
/// </summary> /// </summary>
@ -230,91 +225,78 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Dtos
[Display(Name = "交货号")] [Display(Name = "交货号")]
[ImporterHeader(Name = "交货号")] [ImporterHeader(Name = "交货号")]
public string DeliveryNumber { set; get; } public string DeliveryNumber { set; get; }
/// <summary> /// <summary>
/// 发票号 /// 发票号
/// </summary> /// </summary>
[Display(Name = "发票号")] [Display(Name = "发票号")]
[ImporterHeader(Name = "发票号")] [ImporterHeader(Name = "发票号")]
public string InvoiceNumber { set; get; } public string InvoiceNumber { set; get; }
/// <summary> /// <summary>
/// 开票日期 /// 开票日期
/// </summary> /// </summary>
[Display(Name = "开票日期")] [Display(Name = "开票日期")]
[ImporterHeader(Name = "开票日期")] [ImporterHeader(Name = "开票日期")]
public DateTime? MakeDate { set; get; } public DateTime? MakeDate { set; get; }
/// <summary> /// <summary>
/// 供应商代码 /// 供应商代码
/// </summary> /// </summary>
[Display(Name = "供应商代码")] [Display(Name = "供应商代码")]
[ImporterHeader(Name = "供应商代码")] [ImporterHeader(Name = "供应商代码")]
public string VendorCode { set; get; } public string VendorCode { set; get; }
/// <summary> /// <summary>
/// 供应商名称 /// 供应商名称
/// </summary> /// </summary>
[Display(Name = "供应商名称")] [Display(Name = "供应商名称")]
[ImporterHeader(Name = "供应商名称")] [ImporterHeader(Name = "供应商名称")]
public string VendorName { set; get; } public string VendorName { set; get; }
/// <summary> /// <summary>
/// 交付索引号 /// 交付索引号
/// </summary> /// </summary>
[Display(Name = "交付索引号")] [Display(Name = "交付索引号")]
[ImporterHeader(Name = "交付索引号")] [ImporterHeader(Name = "交付索引号")]
public string DeliveryIndexNumber { set; get; } public string DeliveryIndexNumber { set; get; }
/// <summary> /// <summary>
/// 零件名称 /// 零件名称
/// </summary> /// </summary>
[Display(Name = "零件名称")] [Display(Name = "零件名称")]
[ImporterHeader(Name = "零件名称")] [ImporterHeader(Name = "零件名称")]
public string PartName { set; get; } public string PartName { set; get; }
/// <summary> /// <summary>
/// 价格 /// 价格
/// </summary> /// </summary>
[Display(Name = "价格")] [Display(Name = "价格")]
[ImporterHeader(Name = "价格")] [ImporterHeader(Name = "价格")]
public decimal? Price { set; get; } public decimal? Price { set; get; }
/// <summary> /// <summary>
/// 金额 /// 金额
/// </summary> /// </summary>
[Display(Name = "金额")] [Display(Name = "金额")]
[ImporterHeader(Name = "金额")] [ImporterHeader(Name = "金额")]
public decimal? Amount { set; get; } public decimal? Amount { set; get; }
/// <summary> /// <summary>
/// 税额 /// 税额
/// </summary> /// </summary>
[Display(Name = "税额")] [Display(Name = "税额")]
[ImporterHeader(Name = "税额")] [ImporterHeader(Name = "税额")]
public decimal? Tallage { set; get; } public decimal? Tallage { set; get; }
/// <summary> /// <summary>
/// 价税合计 /// 价税合计
/// </summary> /// </summary>
[Display(Name = "价税合计")] [Display(Name = "价税合计")]
[ImporterHeader(Name = "价税合计")] [ImporterHeader(Name = "价税合计")]
public decimal? Total { set; get; } public decimal? Total { set; get; }
/// <summary> /// <summary>
/// 协议编号 /// 协议编号
/// </summary> /// </summary>
[Display(Name = "协议编号")] [Display(Name = "协议编号")]
[ImporterHeader(Name = "协议编号")] [ImporterHeader(Name = "协议编号")]
public string ProtocolNumber { set; get; } public string ProtocolNumber { set; get; }
/// <summary> /// <summary>
/// 备注 /// 备注
/// </summary> /// </summary>
[Display(Name = "备注")] [Display(Name = "备注")]
[ImporterHeader(Name = "备注")] [ImporterHeader(Name = "备注")]
public string Remark { set; get; } public string Remark { set; get; }
/// <summary> /// <summary>
/// 商品组 /// 商品组
/// </summary> /// </summary>

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

@ -113,6 +113,9 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
/// <summary> /// <summary>
/// 导入 /// 导入
/// </summary> /// </summary>
/// <remarks>
/// JisHBPO、买单件HBPO结算数据导入
/// </remarks>
[HttpPost] [HttpPost]
public async Task<IActionResult> ImportAsync([FromForm] HBPOSaImportRequestDto hbpoSaImportRequestDto) public async Task<IActionResult> ImportAsync([FromForm] HBPOSaImportRequestDto hbpoSaImportRequestDto)
{ {
@ -152,6 +155,12 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
/// <summary> /// <summary>
/// 删除 /// 删除
/// </summary> /// </summary>
/// <remarks>
/// 同时删除
/// 结算主表、明细表
/// 可结算主表、明细表
/// 不可结算明细表(不可结算没主表)
/// </remarks>
[HttpPost] [HttpPost]
public async Task DeleteListAsync(List<Guid> ids) public async Task DeleteListAsync(List<Guid> ids)
{ {
@ -311,6 +320,13 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
/// <summary> /// <summary>
/// Insert结算数据 /// Insert结算数据
/// </summary> /// </summary>
/// <remarks>
/// 匹配价格
/// * 根据客户编码、业务、零件号、时间匹配价格
/// 匹配对应的厂内零件号
/// 结算数据入库
/// * 入库 结算主表、结算明细表、可结算主表、可结算明细表、不可结算明细表
/// </remarks>
private async Task InsertSaDataAsync(List<HBPO_SA_DETAIL> hbpoSaDetails, string place) private async Task InsertSaDataAsync(List<HBPO_SA_DETAIL> hbpoSaDetails, string place)
{ {
var site = "104T"; var site = "104T";
@ -425,6 +441,11 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
/// <summary> /// <summary>
/// 获取结算关联项 /// 获取结算关联项
/// </summary> /// </summary>
/// <remarks>
/// 根据结算主表Id获取关联的结算主表、结算明细表、可结算主表、可结算明细表、不可结算明细表要删除的数据
/// 验证可结算主表状态
/// 只有可结算主表状态为未结状态时才可以删除结算数据
/// </remarks>
private async Task<(List<HBPO_SA> hbpoSas, List<HBPO_SA_DETAIL> hbpoSaDetails, List<HBPO_CAN_SA> hbpoCanSas, List<HBPO_CAN_SA_DETAIL> hbpoCanSaDetails, List<HBPO_NOT_SA_DETAIL> hbpoNotSaDetails)> GetHBPOSaDelItemsAsync(Guid id) private async Task<(List<HBPO_SA> hbpoSas, List<HBPO_SA_DETAIL> hbpoSaDetails, List<HBPO_CAN_SA> hbpoCanSas, List<HBPO_CAN_SA_DETAIL> hbpoCanSaDetails, List<HBPO_NOT_SA_DETAIL> hbpoNotSaDetails)> GetHBPOSaDelItemsAsync(Guid id)
{ {
//结算主表 //结算主表
@ -463,6 +484,10 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
/// <summary> /// <summary>
/// 数据校验 /// 数据校验
/// </summary> /// </summary>
/// <remarks>
/// 验证结算分组号是否已存在
/// 验证导入的零件号在客户-厂内零件号关系表中是否存在
/// </remarks>
private async Task<List<ErrorExportDto>> CheckAsync(List<HBPO_SA_DETAIL> hbpoSaDetails) private async Task<List<ErrorExportDto>> CheckAsync(List<HBPO_SA_DETAIL> hbpoSaDetails)
{ {
#region 数据校验 #region 数据校验

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

@ -176,7 +176,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
/// 同时删除 /// 同时删除
/// 结算主表、明细表 /// 结算主表、明细表
/// 可结算主表、明细表 /// 可结算主表、明细表
/// 不可结算明细表(不可结算没主表) /// 不可结算明细表(不可结算没主表)
/// </remarks> /// </remarks>
[HttpPost] [HttpPost]
public async Task<IActionResult> DeleteListAsync(List<Guid> ids) public async Task<IActionResult> DeleteListAsync(List<Guid> ids)
@ -243,7 +243,6 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
/// <remarks> /// <remarks>
/// 导入数据过滤 /// 导入数据过滤
/// * 筛选 Vendor 为15663496的数据 /// * 筛选 Vendor 为15663496的数据
/// HandleSaDetails方法处理导入的数据
/// </remarks> /// </remarks>
private async Task<IActionResult> ImportZhiGongJianBBACAsync([FromForm] IFormFileCollection files) private async Task<IActionResult> ImportZhiGongJianBBACAsync([FromForm] IFormFileCollection files)
{ {
@ -276,6 +275,9 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
/// <summary> /// <summary>
/// 直供件HBPO导入 /// 直供件HBPO导入
/// </summary> /// </summary>
/// <remarks>
/// 截取结算分组号前8位为结算日期
/// </remarks>
private async Task<IActionResult> ImportZhiGongJianHBPOAsync([FromForm] IFormFileCollection files) private async Task<IActionResult> ImportZhiGongJianHBPOAsync([FromForm] IFormFileCollection files)
{ {
#region 导入数据转换 #region 导入数据转换
@ -343,6 +345,10 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
/// <summary> /// <summary>
/// 印度件导入 /// 印度件导入
/// </summary> /// </summary>
/// <remarks>
/// 导入数据过滤
/// * 筛选 Supplier 为15663496的数据
/// </remarks>
private async Task<IActionResult> ImportYinDuJianAsync([FromForm] IFormFileCollection files) private async Task<IActionResult> ImportYinDuJianAsync([FromForm] IFormFileCollection files)
{ {
#region 导入数据转换 #region 导入数据转换
@ -376,7 +382,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
/// </summary> /// </summary>
/// <remarks> /// <remarks>
/// 验证结算分组号是否已存在 /// 验证结算分组号是否已存在
/// 验证 /// 验证导入的零件号在客户-厂内零件号关系表中是否存在
/// </remarks> /// </remarks>
private async Task<List<ErrorExportDto>> CheckAsync(List<PUB_SA_DETAIL> pubSaDetails) private async Task<List<ErrorExportDto>> CheckAsync(List<PUB_SA_DETAIL> pubSaDetails)
{ {
@ -460,21 +466,18 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
/// <summary> /// <summary>
/// Insert结算数据 /// Insert结算数据
/// </summary> /// </summary>
/// <remarks>
/// 匹配价格
/// * 根据客户编码、业务、零件号、时间匹配价格
/// 匹配对应的厂内零件号
/// </remarks>
private async Task<IActionResult> InsertSaDataAsync(List<PUB_SA_DETAIL> pubSaDetails, EnumBusinessType businessType) private async Task<IActionResult> InsertSaDataAsync(List<PUB_SA_DETAIL> pubSaDetails, EnumBusinessType businessType)
{ {
#region 处理结算数据 #region 处理结算数据
for (var i = 0; i < pubSaDetails.Count; i++) //导入的零件号集合
{
var pubSaDetail = pubSaDetails[i];
pubSaDetail.SetId(GuidGenerator.Create());
pubSaDetail.CustomerPartCodeNoSpace = pubSaDetail.LU.Replace(" ", "");
pubSaDetail.KeyCode = pubSaDetail.PN + pubSaDetail.LU;
pubSaDetail.Version = version;
pubSaDetail.BusinessType = businessType;
pubSaDetail.IndexNum = i;
}
var lus = pubSaDetails.Select(t => t.LU).Distinct().ToList(); var lus = pubSaDetails.Select(t => t.LU).Distinct().ToList();
#region 匹配价格
var clientCode = businessType switch var clientCode = businessType switch
{ {
EnumBusinessType.ZhiGongJianBBAC => site, EnumBusinessType.ZhiGongJianBBAC => site,
@ -521,15 +524,24 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
importPubSaDetail.Price = priceListEntity?.Price ?? 0; importPubSaDetail.Price = priceListEntity?.Price ?? 0;
}); });
} }
#endregion
//导入的零件号集合 // 客户-厂内零件号关系
var importPubSaLUs = pubSaDetails.Select(t => t.LU).Distinct(); var materialRelationshipEntitys = await _materialRelationshipRepository.GetListAsync(t => t.BusinessType == businessType && lus.Contains(t.SettleMaterialCode)).ConfigureAwait(false);
var materialRelationshipEntitys = await _materialRelationshipRepository.GetListAsync(t => t.BusinessType == businessType && importPubSaLUs.Contains(t.SettleMaterialCode)).ConfigureAwait(false);
pubSaDetails.ForEach(pubSaDetail => for (var i = 0; i < pubSaDetails.Count; i++)
{ {
var pubSaDetail = pubSaDetails[i];
pubSaDetail.SetId(GuidGenerator.Create());
//去掉空格的客户零件号(比对需要)
pubSaDetail.CustomerPartCodeNoSpace = pubSaDetail.LU.Replace(" ", "");
pubSaDetail.KeyCode = pubSaDetail.PN + pubSaDetail.LU;
pubSaDetail.Version = version;
pubSaDetail.BusinessType = businessType;
//记录结算数据导入文件中的顺序(发票需要)
pubSaDetail.IndexNum = i;
pubSaDetail.PartCode = materialRelationshipEntitys.FirstOrDefault(t => t.SettleMaterialCode == pubSaDetail.LU)?.ErpMaterialCode; pubSaDetail.PartCode = materialRelationshipEntitys.FirstOrDefault(t => t.SettleMaterialCode == pubSaDetail.LU)?.ErpMaterialCode;
}); }
#endregion #endregion
#region 添加入库 #region 添加入库
@ -542,6 +554,9 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
/// <summary> /// <summary>
/// 结算数据入库 /// 结算数据入库
/// </summary> /// </summary>
/// <remarks>
/// 入库 结算主表、结算明细表、可结算主表、可结算明细表、不可结算明细表
/// </remarks>
private async Task SeDataEntryAsync(List<PUB_SA_DETAIL> pubSaDetails) private async Task SeDataEntryAsync(List<PUB_SA_DETAIL> pubSaDetails)
{ {
//业务类型 //业务类型

Loading…
Cancel
Save