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 = "结算日期")]
[ImporterHeader(Name = "零件时间")]
public DateTime SettleDate { set; get; }
/// <summary>
/// 客户零件号
/// </summary>
@ -187,7 +186,6 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Dtos
[Required(ErrorMessage = "{0}不能为空")]
[ImporterHeader(Name = "零件号")]
public string LU { get; set; }
/// <summary>
/// 生产号
/// </summary>
@ -195,14 +193,12 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Dtos
[ImporterHeader(Name = "交付识别号")]
[Required(ErrorMessage = "{0}不能为空")]
public string PN { get; set; }
/// <summary>
/// 数量
/// </summary>
[Display(Name = "数量")]
[ImporterHeader(Name = "数量")]
public decimal Qty { get; set; }
/// <summary>
/// 结算分组号
/// </summary>
@ -210,7 +206,6 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Dtos
[ImporterHeader(Name = "凭证号")]
[Required(ErrorMessage = "{0}不能为空")]
public string GroupNum { get; set; }
/// <summary>
/// 采购订单号
/// </summary>
@ -230,91 +225,78 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Dtos
[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 DateTime? MakeDate { 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 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>

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>
/// <remarks>
/// JisHBPO、买单件HBPO结算数据导入
/// </remarks>
[HttpPost]
public async Task<IActionResult> ImportAsync([FromForm] HBPOSaImportRequestDto hbpoSaImportRequestDto)
{
@ -152,6 +155,12 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
/// <summary>
/// 删除
/// </summary>
/// <remarks>
/// 同时删除
/// 结算主表、明细表
/// 可结算主表、明细表
/// 不可结算明细表(不可结算没主表)
/// </remarks>
[HttpPost]
public async Task DeleteListAsync(List<Guid> ids)
{
@ -311,6 +320,13 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
/// <summary>
/// Insert结算数据
/// </summary>
/// <remarks>
/// 匹配价格
/// * 根据客户编码、业务、零件号、时间匹配价格
/// 匹配对应的厂内零件号
/// 结算数据入库
/// * 入库 结算主表、结算明细表、可结算主表、可结算明细表、不可结算明细表
/// </remarks>
private async Task InsertSaDataAsync(List<HBPO_SA_DETAIL> hbpoSaDetails, string place)
{
var site = "104T";
@ -425,6 +441,11 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
/// <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)
{
//结算主表
@ -463,6 +484,10 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
/// <summary>
/// 数据校验
/// </summary>
/// <remarks>
/// 验证结算分组号是否已存在
/// 验证导入的零件号在客户-厂内零件号关系表中是否存在
/// </remarks>
private async Task<List<ErrorExportDto>> CheckAsync(List<HBPO_SA_DETAIL> hbpoSaDetails)
{
#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>
[HttpPost]
public async Task<IActionResult> DeleteListAsync(List<Guid> ids)
@ -243,7 +243,6 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
/// <remarks>
/// 导入数据过滤
/// * 筛选 Vendor 为15663496的数据
/// HandleSaDetails方法处理导入的数据
/// </remarks>
private async Task<IActionResult> ImportZhiGongJianBBACAsync([FromForm] IFormFileCollection files)
{
@ -276,6 +275,9 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
/// <summary>
/// 直供件HBPO导入
/// </summary>
/// <remarks>
/// 截取结算分组号前8位为结算日期
/// </remarks>
private async Task<IActionResult> ImportZhiGongJianHBPOAsync([FromForm] IFormFileCollection files)
{
#region 导入数据转换
@ -343,6 +345,10 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
/// <summary>
/// 印度件导入
/// </summary>
/// <remarks>
/// 导入数据过滤
/// * 筛选 Supplier 为15663496的数据
/// </remarks>
private async Task<IActionResult> ImportYinDuJianAsync([FromForm] IFormFileCollection files)
{
#region 导入数据转换
@ -376,7 +382,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
/// </summary>
/// <remarks>
/// 验证结算分组号是否已存在
/// 验证
/// 验证导入的零件号在客户-厂内零件号关系表中是否存在
/// </remarks>
private async Task<List<ErrorExportDto>> CheckAsync(List<PUB_SA_DETAIL> pubSaDetails)
{
@ -460,21 +466,18 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
/// <summary>
/// Insert结算数据
/// </summary>
/// <remarks>
/// 匹配价格
/// * 根据客户编码、业务、零件号、时间匹配价格
/// 匹配对应的厂内零件号
/// </remarks>
private async Task<IActionResult> InsertSaDataAsync(List<PUB_SA_DETAIL> pubSaDetails, EnumBusinessType businessType)
{
#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();
#region 匹配价格
var clientCode = businessType switch
{
EnumBusinessType.ZhiGongJianBBAC => site,
@ -521,15 +524,24 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
importPubSaDetail.Price = priceListEntity?.Price ?? 0;
});
}
#endregion
//导入的零件号集合
var importPubSaLUs = pubSaDetails.Select(t => t.LU).Distinct();
var materialRelationshipEntitys = await _materialRelationshipRepository.GetListAsync(t => t.BusinessType == businessType && importPubSaLUs.Contains(t.SettleMaterialCode)).ConfigureAwait(false);
// 客户-厂内零件号关系
var materialRelationshipEntitys = await _materialRelationshipRepository.GetListAsync(t => t.BusinessType == businessType && lus.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;
});
}
#endregion
#region 添加入库
@ -542,6 +554,9 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
/// <summary>
/// 结算数据入库
/// </summary>
/// <remarks>
/// 入库 结算主表、结算明细表、可结算主表、可结算明细表、不可结算明细表
/// </remarks>
private async Task SeDataEntryAsync(List<PUB_SA_DETAIL> pubSaDetails)
{
//业务类型

Loading…
Cancel
Save