|
|
@ -1,7 +1,5 @@ |
|
|
|
using Microsoft.AspNetCore.Authorization; |
|
|
|
using Microsoft.AspNetCore.Http; |
|
|
|
using Microsoft.AspNetCore.Mvc; |
|
|
|
using Microsoft.EntityFrameworkCore; |
|
|
|
using Shouldly; |
|
|
|
using System; |
|
|
|
using System.Collections.Generic; |
|
|
@ -10,16 +8,8 @@ using Volo.Abp.Application.Dtos; |
|
|
|
using Volo.Abp.Caching; |
|
|
|
using Win.Abp.Snowflakes; |
|
|
|
using Win.Sfs.BaseData.ImportExcelCommon; |
|
|
|
using Win.Sfs.SettleAccount.Boms; |
|
|
|
using Win.Sfs.SettleAccount.CommonManagers; |
|
|
|
using Win.Sfs.SettleAccount.Constant; |
|
|
|
using Win.Sfs.SettleAccount.Entities.Boms; |
|
|
|
using Win.Sfs.SettleAccount.Entities.ImportMap; |
|
|
|
using Win.Sfs.SettleAccount.Entities.Prices; |
|
|
|
using Win.Sfs.SettleAccount.Entities.TaskJobs; |
|
|
|
using Win.Sfs.SettleAccount.ExcelImporter; |
|
|
|
using Win.Sfs.SettleAccount.ExportReports; |
|
|
|
using Win.Sfs.SettleAccount.MaterialRelationships; |
|
|
|
using Win.Sfs.Shared.RepositoryBase; |
|
|
|
|
|
|
|
namespace Win.Sfs.SettleAccount.Entities.Materials |
|
|
@ -27,50 +17,27 @@ namespace Win.Sfs.SettleAccount.Entities.Materials |
|
|
|
/// <summary>
|
|
|
|
/// 物料主数据
|
|
|
|
/// </summary>
|
|
|
|
//[Authorize(SettleAccountPermissions.Materials.Default)]
|
|
|
|
[AllowAnonymous] |
|
|
|
[Route("api/settleaccount/MaterialAppService")] |
|
|
|
public class MaterialAppService : SettleAccountApplicationBase<Material> |
|
|
|
{ |
|
|
|
private readonly IExcelImportAppService _excelImportService; |
|
|
|
/// <summary>
|
|
|
|
/// 物料主数据仓储
|
|
|
|
/// </summary>
|
|
|
|
private readonly INormalEfCoreRepository<Material, Guid> _repository; |
|
|
|
|
|
|
|
private readonly ISettleAccountBranchEfCoreRepository<Bom, Guid> _bomRepository; |
|
|
|
private readonly ISettleAccountBranchEfCoreRepository<BomVersion, Guid> _bomversionRepository; |
|
|
|
private readonly ISettleAccountBranchEfCoreRepository<PriceList, Guid> _priceRepository; |
|
|
|
private readonly ISettleAccountBranchEfCoreRepository<PriceListVersion, Guid> _priceversionRepository; |
|
|
|
private readonly ISettleAccountBranchEfCoreRepository<ImportColumnMap, Guid> _mapRepository; |
|
|
|
private readonly ISettleAccountBranchEfCoreRepository<MaterialRelationship, Guid> _relationshipRepository; |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// 构建方法
|
|
|
|
/// 构造
|
|
|
|
/// </summary>
|
|
|
|
public MaterialAppService( |
|
|
|
INormalEfCoreRepository<Material, Guid> repository, |
|
|
|
ISettleAccountBranchEfCoreRepository<ImportColumnMap, Guid> mapRepository, |
|
|
|
ISettleAccountBranchEfCoreRepository<Bom, Guid> bomRepository, |
|
|
|
ISettleAccountBranchEfCoreRepository<BomVersion, Guid> bomversionRepository, |
|
|
|
TaskJobService service, |
|
|
|
ISettleAccountBranchEfCoreRepository<MaterialRelationship, Guid> relationshipRepository, |
|
|
|
ISettleAccountBranchEfCoreRepository<PriceList, Guid> priceRepository, |
|
|
|
ISettleAccountBranchEfCoreRepository<PriceListVersion, Guid> priceversionRepository, |
|
|
|
|
|
|
|
IDistributedCache<Material> cache, |
|
|
|
IDistributedCache<Material> cache, |
|
|
|
IExcelImportAppService excelImportService, |
|
|
|
ISnowflakeIdGenerator snowflakeIdGenerator, |
|
|
|
ICommonManager commonManager |
|
|
|
|
|
|
|
) : base(cache,excelImportService,snowflakeIdGenerator,commonManager) |
|
|
|
) : base(cache,excelImportService,snowflakeIdGenerator,commonManager) |
|
|
|
{ |
|
|
|
_priceRepository = priceRepository; |
|
|
|
_priceversionRepository = priceversionRepository; |
|
|
|
_bomRepository = bomRepository; |
|
|
|
_excelImportService = excelImportService; |
|
|
|
_repository = repository; |
|
|
|
_relationshipRepository = relationshipRepository; |
|
|
|
_mapRepository = mapRepository; |
|
|
|
_bomversionRepository = bomversionRepository; |
|
|
|
|
|
|
|
_repository = repository; |
|
|
|
} |
|
|
|
|
|
|
|
#region 导入、导出
|
|
|
@ -79,7 +46,6 @@ namespace Win.Sfs.SettleAccount.Entities.Materials |
|
|
|
/// </summary>
|
|
|
|
[HttpPost] |
|
|
|
[Route("Export")] |
|
|
|
//[Authorize(SettleAccountPermissions.Materials.Default)]
|
|
|
|
public virtual async Task<string> ExportAsync(MaterialRequestDto input) |
|
|
|
{ |
|
|
|
string _fileName = string.Format("物料主数据_{0}.xlsx", DateTime.Now.ToString("yyyyMMdd")); |
|
|
@ -112,7 +78,6 @@ namespace Win.Sfs.SettleAccount.Entities.Materials |
|
|
|
/// </summary>
|
|
|
|
[HttpPost] |
|
|
|
[Route("list")] |
|
|
|
//[Authorize(SettleAccountPermissions.Materials.Default)]
|
|
|
|
virtual public async Task<PagedResultDto<MaterialDto>> GetListAsync(MaterialRequestDto input) |
|
|
|
{ |
|
|
|
var entities = await _repository.GetListByFilterAsync(input.Filters, input.Sorting, input.MaxResultCount, |
|
|
|