44673626 3 years ago
parent
commit
e7717e616d
  1. 17869
      src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/Logs/log-20211103.txt
  2. 9290
      src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/Migrations/SettleAccountHttpApiHostMigrationsDbContextModelSnapshot.cs
  3. 1
      src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/SettleAccount.HttpApi.Host.csproj
  4. 6
      src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/appsettings.Development.json
  5. 39
      src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/Prices/PriceListDtoBase.cs
  6. 61
      src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Prices/PriceListAppService.cs
  7. 8
      src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/Prices/PriceList.cs
  8. 25
      src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/Prices/PriceListManager.cs
  9. 6
      src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/EntityFrameworkCore/SettleAccountDbContextModelCreatingExtensions.cs
  10. BIN
      src/Shared/Win.Abp.Snowflakes/obj/Debug/netcoreapp5/Win.Abp.Snowflakes.csproj.AssemblyReference.cache
  11. BIN
      src/Shared/Win.Sfs.Shared/obj/Debug/netcoreapp5/Win.Sfs.Shared.csproj.AssemblyReference.cache
  12. BIN
      src/Shared/Win.Utils/obj/Debug/netcoreapp5/Win.Utils.csproj.AssemblyReference.cache

17869
src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/Logs/log-20211103.txt

File diff suppressed because one or more lines are too long

9290
src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/Migrations/SettleAccountHttpApiHostMigrationsDbContextModelSnapshot.cs

File diff suppressed because it is too large

1
src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/SettleAccount.HttpApi.Host.csproj

@ -54,6 +54,7 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Folder Include="Migrations\" />
<Folder Include="wwwroot\files\host\my-file-container\" /> <Folder Include="wwwroot\files\host\my-file-container\" />
</ItemGroup> </ItemGroup>

6
src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/appsettings.Development.json

@ -3,8 +3,8 @@
"CorsOrigins": "https://*.abc.com,http://localhost:9528,http://149.223.116.5:8088" "CorsOrigins": "https://*.abc.com,http://localhost:9528,http://149.223.116.5:8088"
}, },
"ConnectionStrings": { "ConnectionStrings": {
"Default": "Server=192.168.0.213;Database=ABP;user id=sa;Password=Microsoft@2021;", "Default": "Server=127.0.0.1;Database=ABP;user id=sa;Password=1",
"SettleAccountService": "Server=192.168.0.213;Database=SettleAccountService;user id=sa;Password=Microsoft@2021;" "SettleAccountService": "Server=127.0.0.1;Database=SettleAccountService;user id=sa;Password=1;"
}, },
"Logging": { "Logging": {
"LogLevel": { "LogLevel": {
@ -13,6 +13,8 @@
"Microsoft.Hosting.Lifetime": "Information" "Microsoft.Hosting.Lifetime": "Information"
} }
}, },
"Serilog": { "Serilog": {
"Using": [], "Using": [],
"MinumumLevel": { "MinumumLevel": {

39
src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/Prices/PriceListDtoBase.cs

@ -44,6 +44,8 @@ namespace Win.Sfs.SettleAccount.Entities.Prices
public int Type { get; set; } public int Type { get; set; }
public Guid ParentId { set; get; } public Guid ParentId { set; get; }
[Display(Name = "客户")]
public string CustomerCode { get; set; }
} }
@ -57,31 +59,30 @@ namespace Win.Sfs.SettleAccount.Entities.Prices
[Display(Name = "版本")] [Display(Name = "版本")]
[ExporterHeader(DisplayName = "版本")] [ExporterHeader(DisplayName = "版本")]
public string Version { set; get; } public string Version { set; get; }
/// <summary> [ImporterHeader(Name = "有效从")]
///开始时间
/// </summary>
[ExporterHeader(DisplayName = "开始时间")]
public DateTime BeginDate { get; set; } public DateTime BeginDate { get; set; }
/// <summary> /// <summary>
///结算时间 ///结算时间
/// </summary> /// </summary>
[ExporterHeader(DisplayName = "结算时间")] [ImporterHeader(Name = "有效到")]
public DateTime EndDate { get; set; } public DateTime EndDate { get; set; }
/// <summary> /// <summary>
///价格 ///价格
/// </summary> /// </summary>
[ExporterHeader(DisplayName = "价格")] [ImporterHeader(Name = "*金额")]
public decimal Price { get; set; } public decimal Price { get; set; }
/// <summary> /// <summary>
///物料编号 ///物料编号
/// </summary> /// </summary>
[ExporterHeader(DisplayName = "物料编号")] [ImporterHeader(Name = "*物料编码")]
public string MaterialCode { get; set; } public string MaterialCode { get; set; }
/// <summary> /// <summary>
///价格类型 ///价格类型
/// </summary> /// </summary>
[ExporterHeader(DisplayName = "价格类型")] [ImporterHeader(Name = "*分销渠道")]
public int Type { get; set; } public int Type { get; set; }
[ImporterHeader(Name = "*客户")]
public string CustomerCode { get; set; }
} }
@ -89,36 +90,38 @@ namespace Win.Sfs.SettleAccount.Entities.Prices
[ImportProject(Name = SettleAccountModuleName.PriceList)] [ImportProject(Name = SettleAccountModuleName.PriceList)]
public class PriceListImportDto public class PriceListImportDto
{ {
/// <summary> ///// <summary>
/// 版本 ///// 版本
/// </summary> ///// </summary>
[Display(Name = "版本")] //[Display(Name = "版本")]
public string Version { set; get; } //public string Version { set; get; }
/// <summary> /// <summary>
///开始时间 ///开始时间
/// </summary> /// </summary>
[ImporterHeader(Name = "开始时间")] [ImporterHeader(Name = "有效从")]
public DateTime BeginDate { get; set; } public DateTime BeginDate { get; set; }
/// <summary> /// <summary>
///结算时间 ///结算时间
/// </summary> /// </summary>
[ImporterHeader(Name = "结算时间")] [ImporterHeader(Name = "有效到")]
public DateTime EndDate { get; set; } public DateTime EndDate { get; set; }
/// <summary> /// <summary>
///价格 ///价格
/// </summary> /// </summary>
[ImporterHeader(Name = "价格")] [ImporterHeader(Name = "*金额")]
public decimal Price { get; set; } public decimal Price { get; set; }
/// <summary> /// <summary>
///物料编号 ///物料编号
/// </summary> /// </summary>
[ImporterHeader(Name = "物料编号")] [ImporterHeader(Name = "*物料编码")]
public string MaterialCode { get; set; } public string MaterialCode { get; set; }
/// <summary> /// <summary>
///价格类型 ///价格类型
/// </summary> /// </summary>
[ImporterHeader(Name = "价格类型")] [ImporterHeader(Name = "*分销渠道")]
public int Type { get; set; } public int Type { get; set; }
[ImporterHeader(Name = "*客户")]
public string CustomerCode { get; set; }
} }

61
src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Prices/PriceListAppService.cs

@ -23,9 +23,9 @@ namespace Win.Sfs.SettleAccount.Entities.Prices
/// <summary> /// <summary>
/// 供应商相关应用服务 /// 供应商相关应用服务
/// </summary> /// </summary>
//[AllowAnonymous] [AllowAnonymous]
[Authorize(SettleAccountPermissions.PriceLists.Default)] //[Authorize(SettleAccountPermissions.PriceLists.Default)]
[Route("api/SettleAccount/PriceList")] [Route("api/SettleAccount/PriceList")]
public class PriceListAppService : ApplicationService public class PriceListAppService : ApplicationService
/*, IPriceListAppService*/ /*, IPriceListAppService*/
@ -162,33 +162,42 @@ namespace Win.Sfs.SettleAccount.Entities.Prices
virtual public async Task<string> ImportAsync([FromForm] IFormFileCollection files,string version) virtual public async Task<string> ImportAsync([FromForm] IFormFileCollection files,string version)
{ {
ExportImporter _exportImporter = new ExportImporter(); ExportImporter _exportImporter = new ExportImporter();
var _mapList= _mapRepository.Where(p => p.ProjectName == SettleAccountModuleName.PriceList).ToList();
var result = await _exportImporter.ExtendExcelImport<PriceListImportDto>(files, _excelImportService,_mapList);
var result = await _exportImporter.UploadExcelImport<PriceListImportDto>(files, _excelImportService);
var entityList = ObjectMapper.Map<List<PriceListImportDto>, List<PriceList>>(result); var entityList = ObjectMapper.Map<List<PriceListImportDto>, List<PriceList>>(result);
var matialCodeList=entityList.Select(p => p.MaterialCode).Distinct().ToList(); var _ls = entityList.Where(p=>p.EndDate.ToString().Contains("9999")).GroupBy(p => new { p.MaterialCode, p.CustomerCode,p.Type }).Select(p=>p.FirstOrDefault());
List<PriceList> _ls = new List<PriceList>();
foreach (var itm in matialCodeList)
{ // List<PriceList> _ls = new List<PriceList>();
var priceList= entityList.Where(p => p.MaterialCode == itm).Distinct().ToList(); //foreach (var itm in matialCodeList)
var _list =priceList.OrderBy(p => p.BeginDate).ToList(); //{
int i = 0;//查询下条记录 // var priceList= entityList.Where(p => p.MaterialCode == itm).Distinct().ToList();
foreach (var price in _list) // var _list =priceList.OrderBy(p => p.BeginDate).ToList();
// int i = 0;//查询下条记录
// foreach (var price in _list)
// {
// i++;
// if (_list.Count == i)
// {
// price.EndDate = DateTime.MaxValue;
// break;
// }
// else
// {
// var _nextPrice = _list[i];
// price.EndDate = _nextPrice.BeginDate.AddDays(-1);
// }
// _ls.Add(price);
// }
//}
foreach (var itm in _ls)
{ {
i++; itm.Update(GuidGenerator.Create(),version);
if (_list.Count == i)
{
price.EndDate = DateTime.MaxValue;
break;
}
else
{
var _nextPrice = _list[i];
price.EndDate = _nextPrice.BeginDate.AddDays(-1);
}
_ls.Add(price);
}
} }
await _mng.ImportAsync(_ls, version); await _mng.ImportAsync(_ls.ToList(), version);
return ApplicationConsts.SuccessStr; return ApplicationConsts.SuccessStr;
} }

8
src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/Prices/PriceList.cs

@ -31,7 +31,13 @@ namespace Win.Sfs.SettleAccount.Entities.Prices
MaterialCode = materialCode; MaterialCode = materialCode;
Type = type; Type = type;
} }
public void Update(Guid id,string version)
{
Id = id;
Version = version;
}
[Display(Name = "客户")]
public string CustomerCode { get; set; }
/// <summary> /// <summary>
///版本 ///版本

25
src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/Prices/PriceListManager.cs

@ -29,6 +29,11 @@ namespace Win.Sfs.SettleAccount.Entities.Prices
return await _repository.GetAsync(id); return await _repository.GetAsync(id);
} }
public virtual List<PriceList> GetPriceList(string version)
{
var entities = _repository.Where(p => p.Version == version);
return entities.ToList();
}
public virtual async Task<List<PriceList>> GetListAsync( public virtual async Task<List<PriceList>> GetListAsync(
@ -71,11 +76,31 @@ namespace Win.Sfs.SettleAccount.Entities.Prices
List<string> _errorList = new List<string>(); List<string> _errorList = new List<string>();
//写校验在这里 //写校验在这里
var pricelist = GetPriceList(version);
List<PriceList> _list = new List<PriceList>();
foreach (var itm in pricelist)
{
var entity = entities.FirstOrDefault(p => p.Type == itm.Type && p.CustomerCode == itm.CustomerCode && p.MaterialCode == p.MaterialCode);
if (entity != null)
{
itm.Price = entity.Price;
entities.Remove(entity);
}
}
await _repository.GetDbContext().BulkInsertAsync<PriceList>(entities); await _repository.GetDbContext().BulkInsertAsync<PriceList>(entities);
var _first = _versionRepository.FirstOrDefault(p => p.Version == version);
if (_first == null)
{
List<PriceListVersion> _versionList = new List<PriceListVersion>() { new PriceListVersion(GuidGenerator.Create(), DateTime.Now.Year.ToString(), DateTime.Now.Month.ToString(), version) }; List<PriceListVersion> _versionList = new List<PriceListVersion>() { new PriceListVersion(GuidGenerator.Create(), DateTime.Now.Year.ToString(), DateTime.Now.Month.ToString(), version) };
await _versionRepository.GetDbContext().BulkInsertAsync(_versionList); await _versionRepository.GetDbContext().BulkInsertAsync(_versionList);
}

6
src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/EntityFrameworkCore/SettleAccountDbContextModelCreatingExtensions.cs

@ -368,11 +368,6 @@ namespace Win.Sfs.SettleAccount
private static void ConfigurePriceList(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options) private static void ConfigurePriceList(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options)
{ {
builder.Entity<PriceList>(b => builder.Entity<PriceList>(b =>
{ {
@ -380,6 +375,7 @@ namespace Win.Sfs.SettleAccount
b.ConfigureByConvention(); b.ConfigureByConvention();
b.Property(x => x.MaterialCode).HasMaxLength(50); b.Property(x => x.MaterialCode).HasMaxLength(50);
b.Property(x => x.CustomerCode).HasMaxLength(50);
}); });
} }

BIN
src/Shared/Win.Abp.Snowflakes/obj/Debug/netcoreapp5/Win.Abp.Snowflakes.csproj.AssemblyReference.cache

Binary file not shown.

BIN
src/Shared/Win.Sfs.Shared/obj/Debug/netcoreapp5/Win.Sfs.Shared.csproj.AssemblyReference.cache

Binary file not shown.

BIN
src/Shared/Win.Utils/obj/Debug/netcoreapp5/Win.Utils.csproj.AssemblyReference.cache

Binary file not shown.
Loading…
Cancel
Save