|
@ -5,12 +5,10 @@ using System.Linq; |
|
|
using System.Linq.Dynamic.Core; |
|
|
using System.Linq.Dynamic.Core; |
|
|
using System.Threading.Tasks; |
|
|
using System.Threading.Tasks; |
|
|
using EFCore.BulkExtensions; |
|
|
using EFCore.BulkExtensions; |
|
|
using Magicodes.ExporterAndImporter.Core.Models; |
|
|
|
|
|
using Microsoft.AspNetCore.Authorization; |
|
|
using Microsoft.AspNetCore.Authorization; |
|
|
using Microsoft.AspNetCore.Http; |
|
|
using Microsoft.AspNetCore.Http; |
|
|
using Microsoft.AspNetCore.Mvc; |
|
|
using Microsoft.AspNetCore.Mvc; |
|
|
using Microsoft.EntityFrameworkCore; |
|
|
using Microsoft.EntityFrameworkCore; |
|
|
using OfficeOpenXml; |
|
|
|
|
|
using SettleAccount.Domain.BQ; |
|
|
using SettleAccount.Domain.BQ; |
|
|
using Volo.Abp; |
|
|
using Volo.Abp; |
|
|
using Volo.Abp.Application.Dtos; |
|
|
using Volo.Abp.Application.Dtos; |
|
@ -25,7 +23,6 @@ using Win.Sfs.SettleAccount.Entities.Prices; |
|
|
using Win.Sfs.SettleAccount.ExcelImporter; |
|
|
using Win.Sfs.SettleAccount.ExcelImporter; |
|
|
using Win.Sfs.SettleAccount.ExportReports; |
|
|
using Win.Sfs.SettleAccount.ExportReports; |
|
|
using Win.Sfs.SettleAccount.MaterialRelationships; |
|
|
using Win.Sfs.SettleAccount.MaterialRelationships; |
|
|
using Win.Sfs.Shared.Filter; |
|
|
|
|
|
using Win.Sfs.Shared.RepositoryBase; |
|
|
using Win.Sfs.Shared.RepositoryBase; |
|
|
|
|
|
|
|
|
namespace Win.Sfs.SettleAccount.Entities.BQ; |
|
|
namespace Win.Sfs.SettleAccount.Entities.BQ; |
|
@ -398,13 +395,13 @@ public class PUB_SA_SERVICE : SettleAccountApplicationBase<PUB_SA> |
|
|
{ |
|
|
{ |
|
|
pubSaDetails.ForEach(pubSaDetail => |
|
|
pubSaDetails.ForEach(pubSaDetail => |
|
|
{ |
|
|
{ |
|
|
var lus = pubSaDetail.LU.Split(" ").ToList(); |
|
|
var lus = pubSaDetail.LU.Split(new string(' ', 4)).ToList(); |
|
|
pubSaDetail.LU = lus[0].Replace(" ", ""); |
|
|
pubSaDetail.LU = lus[0].Replace(" ", ""); |
|
|
if (lus.Count > 1) |
|
|
if (lus.Count > 1) |
|
|
{ |
|
|
{ |
|
|
lus.RemoveAt(0); |
|
|
lus.RemoveAt(0); |
|
|
var luAssemble = lus.Select(t => t.Replace(" ", "")); |
|
|
var luAssemble = lus.Select(t => t.Replace(" ", "")); |
|
|
pubSaDetail.LU += luAssemble.Aggregate(" ", (current, index) => current + index); |
|
|
pubSaDetail.LU += luAssemble.Aggregate(new string(' ', 6), (current, index) => current + index); |
|
|
} |
|
|
} |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
@ -440,7 +437,6 @@ public class PUB_SA_SERVICE : SettleAccountApplicationBase<PUB_SA> |
|
|
importPubSaDetail.KeyCode = importPubSaDetail.PN + importPubSaDetail.LU; |
|
|
importPubSaDetail.KeyCode = importPubSaDetail.PN + importPubSaDetail.LU; |
|
|
importPubSaDetail.Version = _version; |
|
|
importPubSaDetail.Version = _version; |
|
|
importPubSaDetail.BusinessType = businessType; |
|
|
importPubSaDetail.BusinessType = businessType; |
|
|
importPubSaDetail.Site = "工厂"; |
|
|
|
|
|
}); |
|
|
}); |
|
|
var lus = pubSaDetails.Select(t => t.LU).Distinct().ToList(); |
|
|
var lus = pubSaDetails.Select(t => t.LU).Distinct().ToList(); |
|
|
if (businessType == EnumBusinessType.BeiJian) |
|
|
if (businessType == EnumBusinessType.BeiJian) |
|
@ -450,7 +446,12 @@ public class PUB_SA_SERVICE : SettleAccountApplicationBase<PUB_SA> |
|
|
pubSaDetails.ForEach(importPubSaDetail => |
|
|
pubSaDetails.ForEach(importPubSaDetail => |
|
|
{ |
|
|
{ |
|
|
//根据物料号、结算日期获取价格
|
|
|
//根据物料号、结算日期获取价格
|
|
|
var priceListEntity = priceListEntitys.Find(t => t.LU == importPubSaDetail.LU && importPubSaDetail.SettleDate >= t.BeginDate && importPubSaDetail.SettleDate <= t.EndDate); |
|
|
var priceListEntity = priceListEntitys |
|
|
|
|
|
.Where(t => t.LU == importPubSaDetail.LU) |
|
|
|
|
|
.Where(t => importPubSaDetail.SettleDate >= t.BeginDate && importPubSaDetail.SettleDate <= t.EndDate) |
|
|
|
|
|
.OrderByDescending(t => t.Date) |
|
|
|
|
|
.ThenByDescending(t => t.CreationTime) |
|
|
|
|
|
.FirstOrDefault(); |
|
|
importPubSaDetail.Price = priceListEntity?.Price ?? 0; |
|
|
importPubSaDetail.Price = priceListEntity?.Price ?? 0; |
|
|
}); |
|
|
}); |
|
|
} |
|
|
} |
|
@ -461,7 +462,11 @@ public class PUB_SA_SERVICE : SettleAccountApplicationBase<PUB_SA> |
|
|
pubSaDetails.ForEach(importPubSaDetail => |
|
|
pubSaDetails.ForEach(importPubSaDetail => |
|
|
{ |
|
|
{ |
|
|
//根据物料号、结算日期获取价格
|
|
|
//根据物料号、结算日期获取价格
|
|
|
var priceListEntity = priceListEntitys.FirstOrDefault(t => t.LU == importPubSaDetail.LU && importPubSaDetail.SettleDate >= t.BeginTime && importPubSaDetail.SettleDate <= t.EndTime); |
|
|
var priceListEntity = priceListEntitys |
|
|
|
|
|
.Where(t => t.LU == importPubSaDetail.LU) |
|
|
|
|
|
.Where(t => importPubSaDetail.SettleDate >= t.BeginTime && importPubSaDetail.SettleDate <= t.EndTime) |
|
|
|
|
|
.OrderByDescending(t => t.Date) |
|
|
|
|
|
.FirstOrDefault(); |
|
|
importPubSaDetail.Price = priceListEntity?.Price ?? 0; |
|
|
importPubSaDetail.Price = priceListEntity?.Price ?? 0; |
|
|
}); |
|
|
}); |
|
|
} |
|
|
} |
|
@ -473,7 +478,7 @@ 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.PartCode = materialRelationshipEntitys.FirstOrDefault(t => t.SettleMaterialCode == pubSaDetail.LU)?.ErpMaterialCode ?? pubSaDetail.LU.Replace(" ", "-"); |
|
|
pubSaDetail.PartCode = materialRelationshipEntitys.FirstOrDefault(t => t.SettleMaterialCode == pubSaDetail.LU)?.ErpMaterialCode ?? pubSaDetail.LU.Replace(new string(' ', 6), "-"); |
|
|
}); |
|
|
}); |
|
|
#endregion
|
|
|
#endregion
|
|
|
|
|
|
|
|
|