|
|
@ -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, |
|
|
@ -520,16 +523,25 @@ namespace Win.Sfs.SettleAccount.Entities.BQ |
|
|
|
.FirstOrDefault(); |
|
|
|
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) |
|
|
|
{ |
|
|
|
//业务类型
|
|
|
|