Browse Source

销售价格、备件价格

pull/1/head
mahao 1 year ago
parent
commit
50a26ff27c
  1. 7
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/appsettings.json
  2. 21
      code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Bases/RequestInputBase.cs
  3. 354
      code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/Prices/PriceListDtoBase.cs
  4. 150
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Bases/CurdBaseAppService.cs
  5. 41
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Prices/PriceListAppService.cs
  6. 271
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Prices/PriceListAppService.cs
  7. 504
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Prices/PriceListAppServiceBJ.cs
  8. 1
      code/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccount.Application.csproj
  9. 13
      code/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccountApplicationAutoMapperProfile.cs
  10. 35
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/Prices/PriceList.cs
  11. 3750
      code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/20230711014038_20230711-1.Designer.cs
  12. 33
      code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/20230711014038_20230711-1.cs
  13. 6
      code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/SettleAccountDbContextModelSnapshot.cs
  14. 6
      code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountNormalEfCoreRepository.cs

7
code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/appsettings.json

@ -3,13 +3,8 @@
"CorsOrigins": "https://*.abc.com,http://localhost:9528,http://149.223.116.5:8088"
},
"ConnectionStrings": {
"Default": "Server=dev.ccwin-in.com,13319;Database=BJABP;User ID=ccwin-in;Password=Microsoft@2022;Trusted_Connection=False;TrustServerCertificate=True",
"Default": "Server=dev.ccwin-in.com,13319;Database=BQ_SA;User ID=ccwin-in;Password=Microsoft@2022;Trusted_Connection=False;TrustServerCertificate=True",
"SettleAccountService": "Server=dev.ccwin-in.com,13319;Database=BQ_SA;User ID=ccwin-in;Password=Microsoft@2022;Trusted_Connection=False;TrustServerCertificate=True;"
},
"Serilog": {

21
code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Bases/RequestInputBase.cs

@ -0,0 +1,21 @@
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using Volo.Abp.Application.Dtos;
using Win.Sfs.Shared.Filter;
namespace Win.Sfs.SettleAccount.Bases
{
public class RequestInputBase: PagedAndSortedResultRequestDto
{
/// <summary>
/// 导出文件类型
/// </summary>
public int FileType { get; set; }
/// <summary>
/// 高级检索
/// </summary>
[Display(Name = "高级检索")]
public virtual List<FilterCondition> Filters { get; set; } = new List<FilterCondition>();
}
}

354
code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/Prices/PriceListDtoBase.cs

@ -2,10 +2,8 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Volo.Abp.Application.Dtos;
using Win.Sfs.SettleAccount.Bases;
using Win.Sfs.Shared.Filter;
namespace Win.Sfs.SettleAccount.Entities.Prices
@ -50,81 +48,221 @@ namespace Win.Sfs.SettleAccount.Entities.Prices
}
/// <summary>
/// 销售价格单导出
/// </summary>
public class PriceListExportDto
{
/// <summary>
/// 版本
/// 零件号
/// </summary>
[Display(Name = "版本")]
[ExporterHeader(DisplayName = "版本",IsIgnore =true)]
public string Version { set; get; }
[ExporterHeader(DisplayName = "有效从")]
public DateTime BeginDate { get; set; }
[Display(Name = "零件号")]
[ExporterHeader(DisplayName = "零件号")]
public string LU { get; set; }
/// <summary>
///结算时间
/// 价格
/// </summary>
[ExporterHeader(DisplayName = "有效到")]
public DateTime EndDate { get; set; }
[Display(Name = "价格")]
[ExporterHeader(DisplayName = "价格")]
public Decimal Price { set; get; }
/// <summary>
///价格
/// 开始时间
/// </summary>
[ExporterHeader(DisplayName = "*金额")]
public decimal Price { get; set; }
[Display(Name = "开始时间")]
[ExporterHeader(DisplayName = "开始时间")]
public DateTime BeginTime { set; get; }
/// <summary>
///物料编号
/// 结束时间
/// </summary>
[ExporterHeader(DisplayName = "*物料编码")]
public string MaterialCode { get; set; }
[Display(Name = "结束时间")]
[ExporterHeader(DisplayName = "结束时间")]
public DateTime EndTime { set; get; }
/// <summary>
///价格类型
/// 客户编码
/// </summary>
[ExporterHeader(DisplayName = "*分销渠道",IsIgnore =true)]
public int Type { get; set; }
[ExporterHeader(DisplayName = "*客户")]
public string CustomerCode { get; set; }
[Display(Name = "客户编码")]
[ExporterHeader(DisplayName = "客户编码")]
public string ClientCode { get; set; }
}
/// <summary>
/// 销售价格导入
/// </summary>
[ImportProject(Name = SettleAccountModuleName.PriceList)]
public class PriceListImportDto
{
///// <summary>
///// 版本
///// ItemNo
///// </summary>
//[Display(Name = "版本")]
//public string Version { set; get; }
//[ImporterHeader(Name = "ItemNo")]
//public string ItemNo { get; set; }
/// <summary>
///开始时间
/// 零件号
/// </summary>
[ImporterHeader(Name = "有效从")]
public DateTime BeginDate { get; set; }
[ImporterHeader(Name = "Part No.")]
public string PartNo { get; set; }
///// <summary>
///// PartDescription
///// </summary>
//[ImporterHeader(Name = "PartDescription")]
//public string PartDescription { get; set; }
///// <summary>
///// ES1
///// </summary>
//[ImporterHeader(Name = "ES1")]
//public string ES1 { get; set; }
///// <summary>
///// ES2
///// </summary>
//[ImporterHeader(Name = "ES2")]
//public string ES2 { get; set; }
///// <summary>
///// ZGS
///// </summary>
//[ImporterHeader(Name = "ZGS")]
//public string ZGS { get; set; }
///// <summary>
///// UnitOfMeasure
///// </summary>
//[ImporterHeader(Name = "UnitOfMeasure")]
//public string UnitOfMeasure { get; set; }
///// <summary>
///// Currency
///// </summary>
//[ImporterHeader(Name = "Currency")]
//public string Currency { get; set; }
///// <summary>
///// PriceType
///// </summary>
//[ImporterHeader(Name = "PriceType")]
//public string PriceType { get; set; }
/// <summary>
///结算时间
/// 价格
/// </summary>
[ImporterHeader(Name = "有效到")]
public DateTime EndDate { get; set; }
[ImporterHeader(Name = "Total Price")]
public string TotalPrice { get; set; }
///// <summary>
///// Base Price(Old)
///// </summary>
//[ImporterHeader(Name = "Base Price(Old)")]
//public string BasePriceOld { get; set; }
///// <summary>
///// UnitOfOrder
///// </summary>
//[ImporterHeader(Name = "Unit of Order")]
//public string UnitOfOrder { get; set; }
///// <summary>
///// 11000 - BBAC JIS
///// </summary>
//[ImporterHeader(Name = "11000 - BBAC JIS")]
//public string BBACJIS { get; set; }
/// <summary>
///价格
/// 开始时间
/// </summary>
[ImporterHeader(Name = "*金额")]
public decimal Price { get; set; }
[ImporterHeader(Name = "Valid From")]
public string ValidFrom { get; set; }
/// <summary>
///物料编号
/// 结束时间
/// </summary>
[ImporterHeader(Name = "*物料编码")]
public string MaterialCode { get; set; }
[ImporterHeader(Name = "Valid To")]
public string ValidTo { get; set; }
///// <summary>
///// ProductionCountry
///// </summary>
//[ImporterHeader(Name = "Production Country")]
//public string ProductionCountry { get; set; }
/// <summary>
///价格类型
/// 客户编码
/// </summary>
[ImporterHeader(Name = "*分销渠道")]
public int Type { get; set; }
[ImporterHeader(Name = "*客户")]
public string CustomerCode { get; set; }
[ImporterHeader(Name = "Plant")]
public string Plant { get; set; }
}
///// <summary>
///// Transport Term
///// </summary>
//[ImporterHeader(Name = "Transport Term")]
//public string TransportTerm { get; set; }
///// <summary>
///// Transport Term City
///// </summary>
//[ImporterHeader(Name = "Transport Term City")]
//public string TransportTermCity { get; set; }
///// <summary>
///// Transport Term Country
///// </summary>
//[ImporterHeader(Name = "Transport Term Country")]
//public string TransportTermCountry { get; set; }
///// <summary>
///// Shipping Location
///// </summary>
//[ImporterHeader(Name = "Shipping Location")]
//public string ShippingLocation { get; set; }
///// <summary>
///// Production Location
///// </summary>
//[ImporterHeader(Name = "Production Location")]
//public string ProductionLocation { get; set; }
///// <summary>
///// VAT Shipping Country
///// </summary>
//[ImporterHeader(Name = "VAT Shipping Country")]
//public string VATShippingCountry { get; set; }
///// <summary>
///// Minimum Order Quantity
///// </summary>
//[ImporterHeader(Name = "Minimum Order Quantity")]
//public string MinimumOrderQuantity { get; set; }
///// <summary>
///// Payment
///// </summary>
//[ImporterHeader(Name = "Payment")]
//public string Payment { get; set; }
///// <summary>
///// Packaging
///// </summary>
//[ImporterHeader(Name = "Packaging")]
//public string Packaging { get; set; }
///// <summary>
///// Return
///// </summary>
//[ImporterHeader(Name = "Return")]
//public string Return { get; set; }
///// <summary>
///// 3YP
///// </summary>
//[ImporterHeader(Name = "3YP")]
//public string YP3 { get; set; }
}
public class PriceListRequestDto : PagedAndSortedResultRequestDto
{
@ -149,126 +287,76 @@ namespace Win.Sfs.SettleAccount.Entities.Prices
public virtual List<FilterCondition> Filters { get; set; } = new List<FilterCondition>();
}
#region 备件价格
public class PriceListBJDto : EntityDto<Guid>
{
/// <summary>
/// 版本
/// </summary>
[Display(Name = "版本")]
public string Version { set; get; }
/// <summary>
///开始时间
/// </summary>
[Display(Name = "开始时间")]
public DateTime BeginDate { get; set; }
/// <summary>
///结算时间
/// 零件号
/// </summary>
[Display(Name = "结算时间")]
public DateTime EndDate { get; set; }
[Display(Name = "零件号")]
public string LU { get; set; }
/// <summary>
///价格
/// 价格
/// </summary>
[Display(Name = "价格")]
public decimal Price { get; set; }
/// <summary>
///物料编号
/// </summary>
[Display(Name = "物料编号")]
public string MaterialCode { get; set; }
public Decimal Price { set; get; }
/// <summary>
///价格类型
/// 客户编码
/// </summary>
[Display(Name = "价格类型")]
public int Type { get; set; }
public Guid ParentId { set; get; }
[Display(Name = "客户")]
public string CustomerCode { get; set; }
[Display(Name = "客户编码")]
public string ClientCode { get; set; }
}
[Display(Name = "备件价格")]
public class PriceListBJExportDto
{
/// <summary>
/// 版本
/// </summary>
[Display(Name = "版本")]
[ExporterHeader(DisplayName = "版本")]
public string Version { set; get; }
[ImporterHeader(Name = "有效从")]
public DateTime BeginDate { get; set; }
/// <summary>
///结算时间
/// 零件号
/// </summary>
[ImporterHeader(Name = "有效到")]
public DateTime EndDate { get; set; }
[ExporterHeader(DisplayName = "零件号")]
public string LU { get; set; }
/// <summary>
///价格
/// 价格
/// </summary>
[ImporterHeader(Name = "*金额")]
[ExporterHeader(DisplayName = "价格")]
public decimal Price { get; set; }
/// <summary>
///物料编号
///客户编码
/// </summary>
[ImporterHeader(Name = "*物料编码")]
public string MaterialCode { get; set; }
/// <summary>
///价格类型
/// </summary>
[ImporterHeader(Name = "*分销渠道")]
public int Type { get; set; }
[ImporterHeader(Name = "*客户")]
public string CustomerCode { get; set; }
[ExporterHeader(DisplayName = "客户编码")]
public string ClientCode { get; set; }
}
public class PriceListBJImportDto
{
///// <summary>
///// 版本
///// </summary>
//[Display(Name = "版本")]
//public string Version { set; get; }
/// <summary>
///开始时间
/// </summary>
[ImporterHeader(Name = "有效从")]
public DateTime BeginDate { get; set; }
/// <summary>
///结算时间
/// 零件号
/// </summary>
[ImporterHeader(Name = "有效到")]
public DateTime EndDate { get; set; }
[ImporterHeader(Name = "零件号")]
public string LU { get; set; }
/// <summary>
///价格
/// 价格
/// </summary>
[ImporterHeader(Name = "*金额")]
[ImporterHeader(Name = "价格")]
public decimal Price { get; set; }
/// <summary>
///物料编号
/// </summary>
[ImporterHeader(Name = "*物料编码")]
public string MaterialCode { get; set; }
/// <summary>
///价格类型
///客户编码
/// </summary>
[ImporterHeader(Name = "*分销渠道")]
public int Type { get; set; }
[ImporterHeader(Name = "*客户")]
public string CustomerCode { get; set; }
[ImporterHeader(Name = "客户编码")]
public string ClientCode { get; set; }
}
public class PriceListBJRequestDto : PagedAndSortedResultRequestDto
public class PriceListBJRequestDto : RequestInputBase
{
[Display(Name = "开始时间")]
public DateTime BeginDate { get; set; }
[Display(Name = "结算时间")]
@ -288,6 +376,7 @@ namespace Win.Sfs.SettleAccount.Entities.Prices
public virtual List<FilterCondition> Filters { get; set; } = new List<FilterCondition>();
}
#endregion
/// <summary>
/// 列表
@ -389,6 +478,11 @@ namespace Win.Sfs.SettleAccount.Entities.Prices
/// </summary>
[Display(Name = "高级检索")]
public virtual List<FilterCondition> Filters { get; set; } = new List<FilterCondition>();
/// <summary>
/// 导出文件类型
/// </summary>
public int FileType { set; get; }
}
}

150
code/src/Modules/SettleAccount/src/SettleAccount.Application/Bases/CurdBaseAppService.cs

@ -0,0 +1,150 @@
using Castle.Core.Internal;
using Magicodes.ExporterAndImporter.Core;
using Magicodes.ExporterAndImporter.Csv;
using Magicodes.ExporterAndImporter.Excel;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Shouldly;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Reflection;
using System.Threading.Tasks;
using Volo.Abp.Application.Dtos;
using Volo.Abp.Application.Services;
using Volo.Abp.Domain.Entities;
using Win.Sfs.BaseData.ImportExcelCommon;
using Win.Sfs.SettleAccount.Constant;
using Win.Sfs.SettleAccount.Entities.Prices;
using Win.Sfs.SettleAccount.ExcelImporter;
using Win.Sfs.Shared.RepositoryBase;
namespace Win.Sfs.SettleAccount.Bases
{
public abstract class CurdBaseAppService<TEntity, TEntityDto, TRequestInput, TCreateInput, TImportInput, TExportDto> : ApplicationService
where TEntity : class, IEntity<Guid>
where TEntityDto : class, IEntityDto<Guid>, new()
where TRequestInput : RequestInputBase
where TImportInput : class, new()
where TExportDto : class, new()
{
private readonly INormalEfCoreRepository<TEntity, Guid> _repository;
private readonly IExcelImportAppService _excelImportService;
protected CurdBaseAppService(INormalEfCoreRepository<TEntity, Guid> repository, IExcelImportAppService excelImportService)
{
_repository = repository;
_excelImportService = excelImportService;
}
#region 导入、导出
/// <summary>
/// 获取导入模板
/// </summary>
[HttpPost("import-template")]
public virtual async Task<IActionResult> ImportTemplateAsync()
{
await Task.CompletedTask;
return new Microsoft.AspNetCore.Mvc.OkResult();
}
/// <summary>
/// 导入
/// </summary>
[HttpPost]
[Route("Import")]
public virtual async Task<string> ImportAsync([FromForm] IFormFileCollection files, string version)
{
await Task.CompletedTask;
return ApplicationConsts.SuccessStr;
}
/// <summary>
/// 导出
/// </summary>
[HttpPost]
[Route("Export")]
public virtual async Task<string> ExportAsync(TRequestInput input)
{
IExporter _csv = new CsvExporter();
IExporter _excel = new ExcelExporter();
var entities = await _repository.GetListByFilterAsync(input.Filters, input.Sorting, int.MaxValue, 0, true);
var dtoDetails = ObjectMapper.Map<List<TEntity>, List<TExportDto>>(entities);
var classDisplayName = typeof(TExportDto).GetCustomAttribute<DisplayAttribute>()?.Name ?? typeof(TExportDto).Name;
string _fileName = $"{classDisplayName}_{Guid.NewGuid().ToString()}.xlsx";
byte[] result = null;
switch (input.FileType)
{
case 0:
result = await _csv.ExportAsByteArray(dtoDetails);
break;
case 1:
result = await _excel.ExportAsByteArray(dtoDetails);
break;
}
result.ShouldNotBeNull();
//保存导出文件到服务器存成二进制
await _excelImportService.SaveBlobAsync(
new SaveExcelImportInputDto
{
Name = _fileName,
Content = result
}
);
return _fileName;
}
#endregion
#region CURD
/// <summary>
/// 新增
/// </summary>
[HttpPost("")]
public virtual async Task<TEntityDto> CreateAsync(TCreateInput input)
{
var entity = ObjectMapper.Map<TCreateInput, TEntity>(input);
await _repository.InsertAsync(entity, autoSave: true).ConfigureAwait(continueOnCapturedContext: false);
return ObjectMapper.Map<TEntity, TEntityDto > (entity);
}
/// <summary>
/// 获取列表
/// </summary>
[HttpPost]
[Route("list")]
public virtual async Task<PagedResultDto<TEntityDto>> GetListAsync(TRequestInput input)
{
var entitys = await _repository.GetListByFilterAsync(input.Filters, input.Sorting, input.MaxResultCount, input.SkipCount);
var totalCount = await _repository.GetCountByFilterAsync(input.Filters);
var dtos = ObjectMapper.Map<List<TEntity>, List<TEntityDto>>(entitys);
return new PagedResultDto<TEntityDto>(totalCount, dtos);
}
/// <summary>
/// 删除
/// </summary>
[HttpDelete]
[Route("{id}")]
virtual public async Task DeleteAsync(Guid id)
{
await _repository.DeleteAsync(id);
}
/// <summary>
/// 批量删除
/// </summary>
[HttpPost]
[Route("delete")]
virtual public async Task<bool> DeleteListAsync(List<Guid> ids)
{
return await _repository.DeleteListAsync(ids);
}
#endregion
}
}

41
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Prices/PriceListAppService.cs

@ -1,41 +0,0 @@
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Volo.Abp.Application.Services;
using Win.Sfs.BaseData.ImportExcelCommon;
using Win.Sfs.SettleAccount.Entities.ImportMap;
using Win.Sfs.SettleAccount.Entities.Prices;
using Win.Sfs.SettleAccount.Entities.TaskJobs;
namespace Win.Sfs.SettleAccount.Entities.BQ.Prices
{
/// <summary>
/// 标准价格单-相关应用服务
/// </summary>
[Authorize(SettleAccountPermissions.PriceLists.Default)]
[Route("api/SettleAccount/TB_PRICE_LIST_Service")]
public class PriceListAppService : ApplicationService
{
private readonly PriceListManager _mng;
private readonly IExcelImportAppService _excelImportService;
private readonly ISettleAccountBranchEfCoreRepository<ImportColumnMap, Guid> _mapRepository;
private readonly TaskJobService _service;
public PriceListAppService(
IExcelImportAppService excelImportService,
ISettleAccountBranchEfCoreRepository<ImportColumnMap, Guid> mapRepository,
PriceListManager mng,
TaskJobService service
)
{
_mapRepository = mapRepository;
_excelImportService = excelImportService;
_mng = mng;
_service = service;
}
}
}

271
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Prices/PriceListAppService.cs

@ -4,11 +4,16 @@ using Magicodes.ExporterAndImporter.Excel;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.OpenApi.Extensions;
using NPOI.SS.UserModel;
using SettleAccount.Job.Services.Report;
using Shouldly;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using TaskJob.EventArgs;
@ -33,31 +38,116 @@ namespace Win.Sfs.SettleAccount.Entities.Prices
public class PriceListAppService : ApplicationService
/*, IPriceListAppService*/
{
private readonly PriceListManager _mng;
private readonly PriceListManager _priceListManager;
private readonly IExcelImportAppService _excelImportService;
private readonly ISettleAccountBranchEfCoreRepository<ImportColumnMap, Guid> _mapRepository;
private readonly TaskJobService _service;
public PriceListAppService(
IExcelImportAppService excelImportService,
ISettleAccountBranchEfCoreRepository<ImportColumnMap, Guid> mapRepository,
PriceListManager mng,
PriceListManager priceListManager,
TaskJobService service
)
{
_mapRepository = mapRepository;
_excelImportService = excelImportService;
_mng = mng;
_priceListManager = priceListManager;
_service = service;
}
#region 导入、导出
/// <summary>
/// 根据筛选条件获取实体列表
/// 获取导入模板
/// </summary>
[HttpPost("import-template")]
public virtual async Task<IActionResult> ImportTemplateAsync()
{
await Task.CompletedTask;
return new Microsoft.AspNetCore.Mvc.OkResult();
}
/// <summary>
/// 导入
/// </summary>
[HttpPost]
[Route("Import")]
//[Authorize(SettleAccountPermissions.PriceLists.Create)]
public virtual async Task<string> ImportAsync([FromForm] IFormFileCollection files, string version)
{
ExportImporter _exportImporter = new ExportImporter();
var result = await _exportImporter.UploadExcelImport<PriceListImportDto>(files, _excelImportService);
List<string> _checkls = new List<string>();
_checkls.Add("1040");
_checkls.Add("1046");
_checkls.Add("104T");
result = result.Where(p => _checkls.Contains(p.Plant)).ToList();
var entityList = ObjectMapper.Map<List<PriceListImportDto>, List<PriceList>>(result);
var _ls = entityList.OrderByDescending(p => p.BeginTime).GroupBy(p => new { p.LU, p.ClientCode }).Select(p => p.FirstOrDefault());
foreach (var itm in _ls)
{
itm.Update(GuidGenerator.Create(), version);
}
await _priceListManager.ImportAsync(_ls.ToList(), version);
return ApplicationConsts.SuccessStr;
}
/// <summary>
/// 导出
/// </summary>
[HttpPost]
[Route("Export")]
//[Authorize(SettleAccountPermissions.PriceLists.Default)]
public virtual async Task<string> ExportAsync(TB_PRICE_LIST_RequestDto input)
{
IExporter _csv = new CsvExporter();
IExporter _excel = new ExcelExporter();
var entities = await _priceListManager.GetListAsync(input.Filters, input.Sorting, int.MaxValue,
0, true);
var dtoDetails = ObjectMapper.Map<List<PriceList>, List<PriceListExportDto>>(entities);
string _fileName = string.Empty;
//声明导出容器
byte[] result = null;
switch (input.FileType)
{
case 0:
_fileName = string.Format("销售价格单_{0}.xlsx", Guid.NewGuid().ToString());
result = await _csv.ExportAsByteArray(dtoDetails);
break;
case 1:
_fileName = string.Format("销售价格单_{0}.xlsx", Guid.NewGuid().ToString());
result = await _excel.ExportAsByteArray(dtoDetails);
break;
}
result.ShouldNotBeNull();
//保存导出文件到服务器存成二进制
await _excelImportService.SaveBlobAsync(
new SaveExcelImportInputDto
{
Name = _fileName,
Content = result
}
);
return _fileName;
}
#endregion
#region CURD
/// <summary>
/// 获取列表
/// </summary>
/// <remarks>
/// 请求条件包括:筛选条件列表,排序条件,数据数量,页码
/// </remarks>
/// <param name="input">请求条件</param>
/// <returns>实体DTO列表</returns>
[HttpPost]
[Route("list")]
//[Authorize(SettleAccountPermissions.PriceLists.Default)]
@ -67,26 +157,55 @@ namespace Win.Sfs.SettleAccount.Entities.Prices
{
input.Filters.Add(new FilterCondition() { Action = EnumFilterAction.Equal, Column = "Version", Logic = EnumFilterLogic.And, Value = input.Version });
}
var entitys = await _mng.GetListAsync(input.Filters, input.Sorting, input.MaxResultCount, input.SkipCount);
var entitys = await _priceListManager.GetListAsync(input.Filters, input.Sorting, input.MaxResultCount, input.SkipCount);
var totalCount = await GetCountAsync(input);
var dtos = ObjectMapper.Map<List<PriceList>, List<TB_PRICE_LISTDto>>(entitys);
return new PagedResultDto<TB_PRICE_LISTDto>(totalCount, dtos);
}
/// <summary>
/// 删除
/// </summary>
[HttpDelete]
[Route("{id}")]
//[Authorize(SettleAccountPermissions.PriceLists.Delete)]
virtual public async Task DeleteAsync(Guid id)
{
await _priceListManager.DeleteAsync(id);
}
/// <summary>
/// 批量删除
/// </summary>
[HttpPost]
[Route("delete")]
//[Authorize(SettleAccountPermissions.PriceLists.Delete)]
virtual public async Task<bool> DeleteListAsync(List<Guid> ids)
{
return await _priceListManager.DeleteListAsync(ids);
}
#endregion
#region 私有方法
/// <summary>
/// 获取总数
/// </summary>
private async Task<long> GetCountAsync(TB_PRICE_LIST_RequestDto input)
{
return await _mng.GetCountAsync(input.Filters, GuidGenerator.Create());
return await _priceListManager.GetCountAsync(input.Filters, GuidGenerator.Create());
}
#endregion
/// <summary>
/// 获取总数
/// </summary>
private async Task<long> GetCountAsync(PriceListRequestDto input)
{
return await _mng.GetCountAsync(input.Filters, GuidGenerator.Create());
return await _priceListManager.GetCountAsync(input.Filters, GuidGenerator.Create());
}
@ -139,7 +258,7 @@ namespace Win.Sfs.SettleAccount.Entities.Prices
/// [Authorize(SettleAccountPermissions.PriceLists.Default)]
virtual public async Task<PriceListDto> GetAsync(Guid id)
{
var result = await _mng.GetAsync(id); ;
var result = await _priceListManager.GetAsync(id); ;
var dto = ObjectMapper.Map<PriceList, PriceListDto>(result);
return dto;
@ -164,7 +283,7 @@ namespace Win.Sfs.SettleAccount.Entities.Prices
{
var entities = await _mng.GetVersionListAsync(input.Filters, input.Sorting, input.MaxResultCount,input.SkipCount);
var entities = await _priceListManager.GetVersionListAsync(input.Filters, input.Sorting, input.MaxResultCount,input.SkipCount);
var totalCount = await GetCountAsync(input);
var dtos = ObjectMapper.Map<List<PriceListVersion>, List<PriceListVersionDto>>(entities);
return new PagedResultDto<PriceListVersionDto>(totalCount, dtos);
@ -184,7 +303,7 @@ namespace Win.Sfs.SettleAccount.Entities.Prices
//[Authorize(SettleAccountPermissions.PriceLists.Default)]
virtual public async Task<long> GetTotalCountAsync(Guid branchId)
{
return await _mng.GetCountAsync(new List<FilterCondition>(), branchId);
return await _priceListManager.GetCountAsync(new List<FilterCondition>(), branchId);
}
/// <summary>
@ -196,50 +315,11 @@ namespace Win.Sfs.SettleAccount.Entities.Prices
//[Authorize(SettleAccountPermissions.PriceLists.Default)]
virtual public async Task<ListResultDto<PriceListDto>> GetAllAsync(Guid branchId)
{
var entities = await _mng.GetAllAsync(branchId);
var entities = await _priceListManager.GetAllAsync(branchId);
var dtos = ObjectMapper.Map<List<PriceList>, List<PriceListDto>>(entities);
return new ListResultDto<PriceListDto>(dtos);
}
/// <summary>
/// 批量导入实体列表
/// </summary>
/// <remarks>
/// 以ID为依据,数据库中找不到ID的实体会新增,已有ID的实体会修改
/// </remarks>
/// <param name="entities">实体列表</param>
/// <returns>是否导入成功</returns>
[HttpPost]
[Route("ExcelImport-Map")]
//[Authorize(SettleAccountPermissions.PriceLists.Create)]
virtual public async Task<string> ImportAsync([FromForm] IFormFileCollection files,string version)
{
ExportImporter _exportImporter = new ExportImporter();
var result = await _exportImporter.UploadExcelImport<PriceListImportDto>(files, _excelImportService);
List<string> _checkls = new List<string>();
_checkls.Add("100001");
_checkls.Add("100053");
_checkls.Add("100113");
result = result.Where(p => _checkls.Contains(p.CustomerCode)).ToList();
var entityList = ObjectMapper.Map<List<PriceListImportDto>, List<PriceList>>(result);
var _ls = entityList.Where(p=>p.EndTime.ToString().Contains("9999")).OrderByDescending(p => p.BeginTime).GroupBy(p => new { p.MaterialCode, p.CustomerCode,p.Type }).Select(p=>p.FirstOrDefault());
foreach (var itm in _ls)
{
itm.Update(GuidGenerator.Create(),version);
}
await _mng.ImportAsync(_ls.ToList(), version);
return ApplicationConsts.SuccessStr;
}
/// <summary>
/// 修改实体
@ -256,92 +336,13 @@ namespace Win.Sfs.SettleAccount.Entities.Prices
);
var _ent = await _mng.UpdateAsync(id, entity);
var _ent = await _priceListManager.UpdateAsync(id, entity);
var dto = ObjectMapper.Map<PriceList, PriceListDto>(_ent);
return dto;
}
/// <summary>
/// 删除实体
/// </summary>
/// <param name="id">ID</param>
/// <returns>无</returns>
[HttpDelete]
[Route("{id}")]
//[Authorize(SettleAccountPermissions.PriceLists.Delete)]
virtual public async Task DeleteAsync(Guid id)
{
await _mng.DeleteAsync(id);
}
/// <summary>
/// 按IDs删除实体列表
/// </summary>
/// <param name="ids">ID列表</param>
/// <returns>是否执行成功</returns>
[HttpPost]
[Route("delete")]
//[Authorize(SettleAccountPermissions.PriceLists.Delete)]
virtual public async Task<bool> DeleteListAsync(List<Guid> ids)
{
return await _mng.DeleteListAsync(ids);
}
/// <summary>
/// 导出文件
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost]
[Route("Export")]
//[Authorize(SettleAccountPermissions.PriceLists.Default)]
virtual public async Task<string> ExportAsync(PriceListRequestDto input)
{
IExporter _csv = new CsvExporter();
IExporter _excel = new ExcelExporter();
var entities = await _mng.GetListAsync(input.Filters, input.Sorting, int.MaxValue,
0, true);
var dtoDetails = ObjectMapper.Map<List<PriceList>, List<PriceListExportDto>>(entities);
string _fileName = string.Empty;
//声明导出容器
byte[] result = null;
switch (input.FileType)
{
case 0:
_fileName = string.Format("标准价格单_{0}.xlsx", Guid.NewGuid().ToString());
result = await _csv.ExportAsByteArray(dtoDetails);
break;
case 1:
_fileName = string.Format("标准价格单_{0}.xlsx", Guid.NewGuid().ToString());
result = await _excel.ExportAsByteArray(dtoDetails);
break;
}
result.ShouldNotBeNull();
//保存导出文件到服务器存成二进制
await _excelImportService.SaveBlobAsync(
new SaveExcelImportInputDto
{
Name = _fileName,
Content = result
}
);
return _fileName;
}
}
}

504
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Prices/PriceListAppServiceBJ.cs

@ -13,277 +13,313 @@ using System.Threading.Tasks;
using Volo.Abp.Application.Dtos;
using Volo.Abp.Application.Services;
using Win.Sfs.BaseData.ImportExcelCommon;
using Win.Sfs.SettleAccount.Bases;
using Win.Sfs.SettleAccount.Constant;
using Win.Sfs.SettleAccount.Entities.ImportMap;
using Win.Sfs.SettleAccount.ExcelImporter;
using Win.Sfs.SettleAccount.Repository;
using Win.Sfs.Shared.Filter;
using Win.Sfs.Shared.RepositoryBase;
namespace Win.Sfs.SettleAccount.Entities.Prices
{
/// <summary>
/// 标准价格单-相关应用服务
/// 备件价格
/// </summary>
//[Authorize(SettleAccountPermissions.PriceLists.Default)]
[AllowAnonymous]
[Route("api/SettleAccount/PriceListBJ")]
public class PriceListAppServiceBJ : ApplicationService
/*, IPriceListAppService*/
public class PriceListAppServiceBJ : CurdBaseAppService<PriceListBJ, PriceListBJDto, PriceListBJRequestDto, PriceListBJ, PriceListBJExportDto, PriceListBJExportDto>
{
private readonly PriceListManagerBJ _mng;
private readonly INormalEfCoreRepository<PriceListBJ, Guid> _repository;
private readonly PriceListManagerBJ _priceListManagerBJ;
private readonly IExcelImportAppService _excelImportService;
private readonly ISettleAccountBranchEfCoreRepository<ImportColumnMap, Guid> _mapRepository;
public PriceListAppServiceBJ(
INormalEfCoreRepository<PriceListBJ, Guid> repository,
PriceListManagerBJ priceListManagerBJ,
IExcelImportAppService excelImportService,
ISettleAccountBranchEfCoreRepository<ImportColumnMap, Guid> mapRepository,
PriceListManagerBJ mng
)
{
_mapRepository = mapRepository;
_excelImportService = excelImportService;
_mng = mng;
}
/// <summary>
/// 按ID获取唯一实体
/// </summary>
/// <remarks>
/// 返回实体全部属性
/// </remarks>
/// <param name="id">ID</param>
/// <returns>实体DTO</returns>
[HttpGet]
[Route("{id}")]
/// [Authorize(SettleAccountPermissions.PriceLists.Default)]
virtual public async Task<PriceListBJDto> GetAsync(Guid id)
{
var result = await _mng.GetAsync(id); ;
var dto = ObjectMapper.Map<PriceListBJ, PriceListBJDto>(result);
return dto;
}
/// <summary>
/// 根据筛选条件获取实体列表
/// </summary>
/// <remarks>
/// 请求条件包括:筛选条件列表,排序条件,数据数量,页码
/// </remarks>
/// <param name="input">请求条件</param>
/// <returns>实体DTO列表</returns>
[HttpPost]
[Route("list")]
//[Authorize(SettleAccountPermissions.PriceLists.Default)]
virtual public async Task<PagedResultDto<PriceListBJDto>> GetListAsync(PriceListRequestDto input)
{
if (!string.IsNullOrEmpty(input.Version))
{
input.Filters.Add(new FilterCondition() { Action = EnumFilterAction.Equal, Column = "Version", Logic = EnumFilterLogic.And, Value = input.Version });
}
var entities = await _mng.GetListAsync(input.Filters, input.Sorting, input.MaxResultCount,
input.SkipCount);
var totalCount = await GetCountAsync(input);
var dtos = ObjectMapper.Map<List<PriceListBJ>, List<PriceListBJDto>>(entities);
return new PagedResultDto<PriceListBJDto>(totalCount, dtos);
}
/// <summary>
/// 根据筛选条件获取实体列表
/// </summary>
/// <remarks>
/// 请求条件包括:筛选条件列表,排序条件,数据数量,页码
/// </remarks>
/// <param name="input">请求条件</param>
/// <returns>实体DTO列表</returns>
[HttpPost]
[Route("versionlist")]
// [Authorize(SettleAccountPermissions.PriceLists.Default)]
virtual public async Task<PagedResultDto<PriceListVersionBJDto>> GetVersionListAsync(PriceListRequestDto input)
{
var entities = await _mng.GetVersionListAsync(input.Filters, input.Sorting, input.MaxResultCount,input.SkipCount);
var totalCount = await GetCountAsync(input);
var dtos = ObjectMapper.Map<List<PriceListVersionBJ>, List<PriceListVersionBJDto>>(entities);
return new PagedResultDto<PriceListVersionBJDto>(totalCount, dtos);
}
private async Task<long> GetCountAsync(PriceListRequestDto input)
{
return await _mng.GetCountAsync(input.Filters, GuidGenerator.Create());
}
ISettleAccountBranchEfCoreRepository<ImportColumnMap, Guid> mapRepository
/// <summary>
/// 获取实体总数
/// </summary>
/// <returns>实体总数</returns>
[HttpGet]
[Route("count")]
//[Authorize(SettleAccountPermissions.PriceLists.Default)]
virtual public async Task<long> GetTotalCountAsync(Guid branchId)
) :base(repository: repository, excelImportService: excelImportService)
{
return await _mng.GetCountAsync(new List<FilterCondition>(), branchId);
}
_repository = repository;
_priceListManagerBJ = priceListManagerBJ;
_excelImportService = excelImportService;
/// <summary>
/// 获取全部实体列表
/// </summary>
/// <returns>实体DTO列表</returns>
[HttpGet]
[Route("all")]
//[Authorize(SettleAccountPermissions.PriceLists.Default)]
virtual public async Task<ListResultDto<PriceListBJDto>> GetAllAsync(Guid branchId)
{
var entities = await _mng.GetAllAsync(branchId);
var dtos = ObjectMapper.Map<List<PriceListBJ>, List<PriceListBJDto>>(entities);
return new ListResultDto<PriceListBJDto>(dtos);
_mapRepository = mapRepository;
}
#region 导入、导出
/// <summary>
/// 批量导入实体列表
/// 导入
/// </summary>
/// <remarks>
/// 以ID为依据,数据库中找不到ID的实体会新增,已有ID的实体会修改
/// </remarks>
/// <param name="entities">实体列表</param>
/// <returns>是否导入成功</returns>
[HttpPost]
[Route("ExcelImport-Map")]
//[Authorize(SettleAccountPermissions.PriceLists.Create)]
virtual public async Task<string> ImportAsync([FromForm] IFormFileCollection files,string version)
[Route("Import")]
public override async Task<string> ImportAsync([FromForm] IFormFileCollection files, string version)
{
ExportImporter _exportImporter = new ExportImporter();
var result = await _exportImporter.UploadExcelImport<PriceListBJImportDto>(files, _excelImportService);
List<string> _checkls = new List<string>();
_checkls.Add("100001");
_checkls.Add("100053");
_checkls.Add("100113");
// _checkls.Add("200067");
result = result.Where(p => _checkls.Contains(p.CustomerCode)).ToList();
_checkls.Add("1040");
_checkls.Add("1046");
_checkls.Add("104T");
result = result.Where(p => _checkls.Contains(p.ClientCode)).ToList();
var entityList = ObjectMapper.Map<List<PriceListBJImportDto>, List<PriceListBJ>>(result);
var _ls = entityList.Where(p=>p.EndDate.ToString().Contains("9999")).OrderByDescending(p => p.BeginDate).GroupBy(p => new { p.MaterialCode, p.CustomerCode,p.Type }).Select(p=>p.FirstOrDefault());
var _ls = entityList.GroupBy(p => new { p.LU, p.ClientCode }).Select(p => p.FirstOrDefault());
foreach (var itm in _ls)
{
itm.Update(GuidGenerator.Create(),version);
itm.Update(GuidGenerator.Create(), version);
}
_ls=_ls.Where(p => p.Type == 20).ToList();
await _mng.ImportAsync(_ls.ToList(), version);
await _priceListManagerBJ.ImportAsync(_ls.ToList(), version);
return ApplicationConsts.SuccessStr;
}
/// <summary>
/// 修改实体
/// </summary>
/// <param name="id">ID</param>
/// <param name="input">修改实体DTO</param>
/// <returns>实体DTO</returns>
[HttpPut]
[Route("{id}")]
[Authorize(SettleAccountPermissions.PriceLists.Update)]
virtual public async Task<PriceListBJDto> UpdateAsync(Guid id, PriceListBJDto input)
{
var entity = new PriceListBJ(
);
var _ent = await _mng.UpdateAsync(id, entity);
var dto = ObjectMapper.Map<PriceListBJ, PriceListBJDto>(_ent);
return dto;
}
/// <summary>
/// 删除实体
/// </summary>
/// <param name="id">ID</param>
/// <returns>无</returns>
[HttpDelete]
[Route("{id}")]
//[Authorize(SettleAccountPermissions.PriceLists.Delete)]
virtual public async Task DeleteAsync(Guid id)
{
await _mng.DeleteAsync(id);
}
/// <summary>
/// 按IDs删除实体列表
/// </summary>
/// <param name="ids">ID列表</param>
/// <returns>是否执行成功</returns>
[HttpPost]
[Route("delete")]
//[Authorize(SettleAccountPermissions.PriceLists.Delete)]
virtual public async Task<bool> DeleteListAsync(List<Guid> ids)
{
return await _mng.DeleteListAsync(ids);
}
/// <summary>
/// 导出文件
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost]
[Route("Export")]
//[Authorize(SettleAccountPermissions.PriceLists.Default)]
virtual public async Task<string> ExportAsync(PriceListRequestDto input)
{
IExporter _csv = new CsvExporter();
IExporter _excel = new ExcelExporter();
var entities = await _mng.GetListAsync(input.Filters, input.Sorting, int.MaxValue,
0, true);
var dtoDetails = ObjectMapper.Map<List<PriceListBJ>, List<PriceListBJExportDto>>(entities);
string _fileName = string.Empty;
//声明导出容器
byte[] result = null;
switch (input.FileType)
{
case 0:
_fileName = string.Format("备件标准价格单_{0}.xlsx", Guid.NewGuid().ToString());
result = await _csv.ExportAsByteArray(dtoDetails);
break;
case 1:
_fileName = string.Format("备件标准价格单_{0}.xlsx", Guid.NewGuid().ToString());
result = await _excel.ExportAsByteArray(dtoDetails);
break;
}
result.ShouldNotBeNull();
//保存导出文件到服务器存成二进制
await _excelImportService.SaveBlobAsync(
new SaveExcelImportInputDto
{
Name = _fileName,
Content = result
}
);
return _fileName;
}
#endregion
#region 原有的方法之后废弃删除
// /// <summary>
// /// 按ID获取唯一实体
// /// </summary>
// /// <remarks>
// /// 返回实体全部属性
// /// </remarks>
// /// <param name="id">ID</param>
// /// <returns>实体DTO</returns>
// [HttpGet]
// [Route("{id}")]
// /// [Authorize(SettleAccountPermissions.PriceLists.Default)]
// virtual public async Task<PriceListBJDto> GetAsync(Guid id)
// {
// var result = await _mng.GetAsync(id); ;
// var dto = ObjectMapper.Map<PriceListBJ, PriceListBJDto>(result);
// return dto;
// }
// /// <summary>
// /// 根据筛选条件获取实体列表
// /// </summary>
// /// <remarks>
// /// 请求条件包括:筛选条件列表,排序条件,数据数量,页码
// /// </remarks>
// /// <param name="input">请求条件</param>
// /// <returns>实体DTO列表</returns>
// [HttpPost]
// [Route("list")]
// //[Authorize(SettleAccountPermissions.PriceLists.Default)]
// virtual public async Task<PagedResultDto<PriceListBJDto>> GetListAsync(PriceListRequestDto input)
// {
// if (!string.IsNullOrEmpty(input.Version))
// {
// input.Filters.Add(new FilterCondition() { Action = EnumFilterAction.Equal, Column = "Version", Logic = EnumFilterLogic.And, Value = input.Version });
// }
// var entities = await _mng.GetListAsync(input.Filters, input.Sorting, input.MaxResultCount,
//input.SkipCount);
// var totalCount = await GetCountAsync(input);
// var dtos = ObjectMapper.Map<List<PriceListBJ>, List<PriceListBJDto>>(entities);
// return new PagedResultDto<PriceListBJDto>(totalCount, dtos);
// }
// /// <summary>
// /// 根据筛选条件获取实体列表
// /// </summary>
// /// <remarks>
// /// 请求条件包括:筛选条件列表,排序条件,数据数量,页码
// /// </remarks>
// /// <param name="input">请求条件</param>
// /// <returns>实体DTO列表</returns>
// [HttpPost]
// [Route("versionlist")]
// // [Authorize(SettleAccountPermissions.PriceLists.Default)]
// virtual public async Task<PagedResultDto<PriceListVersionBJDto>> GetVersionListAsync(PriceListRequestDto input)
// {
// var entities = await _mng.GetVersionListAsync(input.Filters, input.Sorting, input.MaxResultCount,input.SkipCount);
// var totalCount = await GetCountAsync(input);
// var dtos = ObjectMapper.Map<List<PriceListVersionBJ>, List<PriceListVersionBJDto>>(entities);
// return new PagedResultDto<PriceListVersionBJDto>(totalCount, dtos);
// }
// private async Task<long> GetCountAsync(PriceListRequestDto input)
// {
// return await _mng.GetCountAsync(input.Filters, GuidGenerator.Create());
// }
// /// <summary>
// /// 获取实体总数
// /// </summary>
// /// <returns>实体总数</returns>
// [HttpGet]
// [Route("count")]
// //[Authorize(SettleAccountPermissions.PriceLists.Default)]
// virtual public async Task<long> GetTotalCountAsync(Guid branchId)
// {
// return await _mng.GetCountAsync(new List<FilterCondition>(), branchId);
// }
// /// <summary>
// /// 获取全部实体列表
// /// </summary>
// /// <returns>实体DTO列表</returns>
// [HttpGet]
// [Route("all")]
// //[Authorize(SettleAccountPermissions.PriceLists.Default)]
// virtual public async Task<ListResultDto<PriceListBJDto>> GetAllAsync(Guid branchId)
// {
// var entities = await _mng.GetAllAsync(branchId);
// var dtos = ObjectMapper.Map<List<PriceListBJ>, List<PriceListBJDto>>(entities);
// return new ListResultDto<PriceListBJDto>(dtos);
// }
// /// <summary>
// /// 批量导入实体列表
// /// </summary>
// /// <remarks>
// /// 以ID为依据,数据库中找不到ID的实体会新增,已有ID的实体会修改
// /// </remarks>
// /// <param name="entities">实体列表</param>
// /// <returns>是否导入成功</returns>
// [HttpPost]
// [Route("ExcelImport-Map")]
// //[Authorize(SettleAccountPermissions.PriceLists.Create)]
// virtual public async Task<string> ImportAsync([FromForm] IFormFileCollection files,string version)
// {
// ExportImporter _exportImporter = new ExportImporter();
// var result = await _exportImporter.UploadExcelImport<PriceListBJImportDto>(files, _excelImportService);
// List<string> _checkls = new List<string>();
// _checkls.Add("100001");
// _checkls.Add("100053");
// _checkls.Add("100113");
// // _checkls.Add("200067");
// result = result.Where(p => _checkls.Contains(p.CustomerCode)).ToList();
// var entityList = ObjectMapper.Map<List<PriceListBJImportDto>, List<PriceListBJ>>(result);
// var _ls = entityList.Where(p=>p.EndDate.ToString().Contains("9999")).OrderByDescending(p => p.BeginDate).GroupBy(p => new { p.MaterialCode, p.CustomerCode,p.Type }).Select(p=>p.FirstOrDefault());
// foreach (var itm in _ls)
// {
// itm.Update(GuidGenerator.Create(),version);
// }
// _ls=_ls.Where(p => p.Type == 20).ToList();
// await _mng.ImportAsync(_ls.ToList(), version);
// return ApplicationConsts.SuccessStr;
// }
// /// <summary>
// /// 修改实体
// /// </summary>
// /// <param name="id">ID</param>
// /// <param name="input">修改实体DTO</param>
// /// <returns>实体DTO</returns>
// [HttpPut]
// [Route("{id}")]
// [Authorize(SettleAccountPermissions.PriceLists.Update)]
// virtual public async Task<PriceListBJDto> UpdateAsync(Guid id, PriceListBJDto input)
// {
// var entity = new PriceListBJ(
// );
// var _ent = await _mng.UpdateAsync(id, entity);
// var dto = ObjectMapper.Map<PriceListBJ, PriceListBJDto>(_ent);
// return dto;
// }
// /// <summary>
// /// 删除实体
// /// </summary>
// /// <param name="id">ID</param>
// /// <returns>无</returns>
// [HttpDelete]
// [Route("{id}")]
// //[Authorize(SettleAccountPermissions.PriceLists.Delete)]
// virtual public async Task DeleteAsync(Guid id)
// {
// await _mng.DeleteAsync(id);
// }
// /// <summary>
// /// 按IDs删除实体列表
// /// </summary>
// /// <param name="ids">ID列表</param>
// /// <returns>是否执行成功</returns>
// [HttpPost]
// [Route("delete")]
// //[Authorize(SettleAccountPermissions.PriceLists.Delete)]
// virtual public async Task<bool> DeleteListAsync(List<Guid> ids)
// {
// return await _mng.DeleteListAsync(ids);
// }
// /// <summary>
// /// 导出文件
// /// </summary>
// /// <param name="input"></param>
// /// <returns></returns>
// [HttpPost]
// [Route("Export")]
// //[Authorize(SettleAccountPermissions.PriceLists.Default)]
// virtual public async Task<string> ExportAsync(PriceListRequestDto input)
// {
// IExporter _csv = new CsvExporter();
// IExporter _excel = new ExcelExporter();
// var entities = await _mng.GetListAsync(input.Filters, input.Sorting, int.MaxValue,
// 0, true);
// var dtoDetails = ObjectMapper.Map<List<PriceListBJ>, List<PriceListBJExportDto>>(entities);
// string _fileName = string.Empty;
// //声明导出容器
// byte[] result = null;
// switch (input.FileType)
// {
// case 0:
// _fileName = string.Format("备件标准价格单_{0}.xlsx", Guid.NewGuid().ToString());
// result = await _csv.ExportAsByteArray(dtoDetails);
// break;
// case 1:
// _fileName = string.Format("备件标准价格单_{0}.xlsx", Guid.NewGuid().ToString());
// result = await _excel.ExportAsByteArray(dtoDetails);
// break;
// }
// result.ShouldNotBeNull();
// //保存导出文件到服务器存成二进制
// await _excelImportService.SaveBlobAsync(
// new SaveExcelImportInputDto
// {
// Name = _fileName,
// Content = result
// }
// );
// return _fileName;
// }
#endregion
}
}

1
code/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccount.Application.csproj

@ -125,6 +125,7 @@
<PackageReference Include="Volo.Abp.BackgroundJobs.Abstractions" Version="4.3.3" />
<PackageReference Include="Volo.Abp.BackgroundWorkers" Version="4.3.3" />
<PackageReference Include="Volo.Abp.Dapper" Version="4.3.3" />
<PackageReference Include="Volo.Abp.Ddd.Application" Version="4.3.3" />
<PackageReference Include="Volo.Abp.EventBus.RabbitMQ" Version="4.3.3" />
<PackageReference Include="Volo.Abp.Http.Client.IdentityModel" Version="4.3.3" />
<PackageReference Include="Volo.Abp.Identity.HttpApi.Client" Version="4.3.3" />

13
code/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccountApplicationAutoMapperProfile.cs

@ -306,12 +306,19 @@ namespace Win.Sfs.SettleAccount
/// </summary>
private void CreateMapPriceList()
{
CreateMap<PriceList, TB_PRICE_LISTDto>().ReverseMap();
CreateMap<PriceList, TB_PRICE_LISTDto>();
CreateMap<PriceListImportDto, PriceList>()
.ForMember(x => x.LU, y => y.MapFrom(y => y.PartNo))
.ForMember(x => x.Price, y => y.MapFrom(y => y.TotalPrice))
.ForMember(x => x.BeginTime, y => y.MapFrom(y => y.ValidFrom))
.ForMember(x => x.EndTime, y => y.MapFrom(y => y.ValidTo))
.ForMember(x => x.ClientCode, y => y.MapFrom(y => y.Plant));
CreateMap<PriceList, PriceListExportDto>();
CreateMap<PriceList, PriceListDto>().ReverseMap();
CreateMap<PriceList, PriceListRequestDto>().ReverseMap();
CreateMap<PriceList, PriceListImportDto>().ReverseMap();
CreateMap<PriceList, PriceListExportDto>().ReverseMap();
}
private void CreateMapPriceListBJ()

35
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/Prices/PriceList.cs

@ -119,6 +119,10 @@ namespace Win.Sfs.SettleAccount.Entities.Prices
public Guid ParentId { set; get; }
}
/// <summary>
/// 备件价格
/// </summary>
public class PriceListBJ : FullAuditedAggregateRootBase<Guid>
{
public PriceListBJ()
@ -149,6 +153,31 @@ namespace Win.Sfs.SettleAccount.Entities.Prices
Id = id;
Version = version;
}
/// <summary>
/// 零件号
/// </summary>
[Display(Name = "零件号")]
public string LU { get; set; }
/// <summary>
/// 价格
/// </summary>
[Display(Name = "价格")]
public Decimal Price { set; get; }
/// <summary>
/// 客户编码
/// </summary>
[Display(Name = "客户编码")]
public string ClientCode { get; set; }
[Display(Name = "客户")]
public string CustomerCode { get; set; }
@ -169,11 +198,7 @@ namespace Win.Sfs.SettleAccount.Entities.Prices
/// </summary>
[Display(Name = "结算时间")]
public DateTime EndDate { set; get; }
/// <summary>
/// 价格
/// </summary>
[Display(Name = "价格")]
public Decimal Price { set; get; }
/// <summary>
/// 物料编号

3750
code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/20230711014038_20230711-1.Designer.cs

File diff suppressed because it is too large

33
code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/20230711014038_20230711-1.cs

@ -0,0 +1,33 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace Win.Sfs.SettleAccount.Migrations
{
public partial class _202307111 : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "ClientCode",
table: "Set_PriceListBJ",
type: "nvarchar(max)",
nullable: true);
migrationBuilder.AddColumn<string>(
name: "LU",
table: "Set_PriceListBJ",
type: "nvarchar(max)",
nullable: true);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "ClientCode",
table: "Set_PriceListBJ");
migrationBuilder.DropColumn(
name: "LU",
table: "Set_PriceListBJ");
}
}
}

6
code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/SettleAccountDbContextModelSnapshot.cs

@ -3425,6 +3425,9 @@ namespace Win.Sfs.SettleAccount.Migrations
b.Property<Guid>("BranchId")
.HasColumnType("uniqueidentifier");
b.Property<string>("ClientCode")
.HasColumnType("nvarchar(max)");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasMaxLength(40)
@ -3467,6 +3470,9 @@ namespace Win.Sfs.SettleAccount.Migrations
.HasDefaultValue(false)
.HasColumnName("IsDeleted");
b.Property<string>("LU")
.HasColumnType("nvarchar(max)");
b.Property<DateTime?>("LastModificationTime")
.HasColumnType("datetime2")
.HasColumnName("LastModificationTime");

6
code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountNormalEfCoreRepository.cs

@ -58,12 +58,8 @@ namespace Win.Sfs.SettleAccount.Repository
entities = GetSortingQueryable(entities, sorting);
return await entities.PageBy(skipCount, maxResultCount)
.ToListAsync(GetCancellationToken(cancellationToken));
return await entities.PageBy(skipCount, maxResultCount).ToListAsync(GetCancellationToken(cancellationToken));
}
}
}

Loading…
Cancel
Save