|
@ -1,10 +1,12 @@ |
|
|
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 NPOI.Util; |
|
|
using SettleAccount.Domain.BQ; |
|
|
using SettleAccount.Domain.BQ; |
|
|
using Shouldly; |
|
|
using Shouldly; |
|
|
using System; |
|
|
using System; |
|
|
using System.Collections.Generic; |
|
|
using System.Collections.Generic; |
|
|
|
|
|
using System.Linq; |
|
|
using System.Threading.Tasks; |
|
|
using System.Threading.Tasks; |
|
|
using Volo.Abp.Application.Dtos; |
|
|
using Volo.Abp.Application.Dtos; |
|
|
using Volo.Abp.Caching; |
|
|
using Volo.Abp.Caching; |
|
@ -23,37 +25,69 @@ namespace Win.Sfs.SettleAccount.Entities.BQ |
|
|
/// </summary>
|
|
|
/// </summary>
|
|
|
[AllowAnonymous] |
|
|
[AllowAnonymous] |
|
|
[Route("api/settleaccount/[controller]/[action]")]
|
|
|
[Route("api/settleaccount/[controller]/[action]")]
|
|
|
public class PUB_SA_SERVICE : SettleAccountApplicationBase<TB_RePartsRelationship> |
|
|
public class PUB_SA_SERVICE : SettleAccountApplicationBase<PUB_SA> |
|
|
{ |
|
|
{ |
|
|
/// <summary>
|
|
|
/// <summary>
|
|
|
/// PUB结算仓储
|
|
|
/// PUB结算仓储
|
|
|
/// </summary>
|
|
|
/// </summary>
|
|
|
private readonly INormalEfCoreRepository<PUB_SA, Guid> _repository; |
|
|
private readonly INormalEfCoreRepository<PUB_SA, Guid> _repository; |
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// PUB结算明细仓储
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
private readonly INormalEfCoreRepository<PUB_SA_DETAIL, Guid> _pubSaDetailRepository; |
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
/// <summary>
|
|
|
/// 构造
|
|
|
/// 构造
|
|
|
/// </summary>
|
|
|
/// </summary>
|
|
|
public PUB_SA_SERVICE(INormalEfCoreRepository<PUB_SA, Guid> repository, |
|
|
public PUB_SA_SERVICE(INormalEfCoreRepository<PUB_SA, Guid> repository, |
|
|
IDistributedCache<TB_RePartsRelationship> cache, |
|
|
INormalEfCoreRepository<PUB_SA_DETAIL, Guid> pubSaDetailRepository, |
|
|
|
|
|
IDistributedCache<PUB_SA> cache, |
|
|
IExcelImportAppService excelImportService, |
|
|
IExcelImportAppService excelImportService, |
|
|
ISnowflakeIdGenerator snowflakeIdGenerator, |
|
|
ISnowflakeIdGenerator snowflakeIdGenerator, |
|
|
ICommonManager commonManager |
|
|
ICommonManager commonManager |
|
|
) : base(cache, excelImportService, snowflakeIdGenerator, commonManager) |
|
|
) : base(cache, excelImportService, snowflakeIdGenerator, commonManager) |
|
|
{ |
|
|
{ |
|
|
_repository = repository; |
|
|
_repository = repository; |
|
|
|
|
|
_pubSaDetailRepository = pubSaDetailRepository; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
#region 直供件
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
#region 导入、导出
|
|
|
#region 导入、导出
|
|
|
/// <summary>
|
|
|
/// <summary>
|
|
|
/// 导入
|
|
|
/// 导入
|
|
|
/// </summary>
|
|
|
/// </summary>
|
|
|
[HttpPost] |
|
|
[HttpPost] |
|
|
public async Task<string> ImportAsync([FromForm] IFormFileCollection files) |
|
|
public async Task<string> ZGJImportAsync([FromForm] IFormFileCollection files) |
|
|
{ |
|
|
{ |
|
|
ExportImporter _exportImporter = new ExportImporter(); |
|
|
ExportImporter _exportImporter = new ExportImporter(); |
|
|
var result = await _exportImporter.UploadExcelImport<PUB_SA_IMPORT_DTO>(files, _excelImportService); |
|
|
var result = await _exportImporter.UploadExcelImport<ZGJ_PUB_SA_DETAIL_IMPORT_DTO>(files, _excelImportService); |
|
|
var _ls = ObjectMapper.Map<List<PUB_SA_IMPORT_DTO>, List<PUB_SA>>(result); |
|
|
var _ls = ObjectMapper.Map<List<ZGJ_PUB_SA_DETAIL_IMPORT_DTO>, List<PUB_SA_DETAIL>>(result); |
|
|
await _repository.InsertManyAsync(_ls); |
|
|
|
|
|
|
|
|
var billNum = GuidGenerator.Create().ToString(); |
|
|
|
|
|
var pubSa = new PUB_SA() |
|
|
|
|
|
{ |
|
|
|
|
|
BillNum = billNum, |
|
|
|
|
|
State = "1" |
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
_ls.ForEach(s => |
|
|
|
|
|
{ |
|
|
|
|
|
string[] luArr = s.LU.Split(" "); |
|
|
|
|
|
var lus = luArr.Reverse(); |
|
|
|
|
|
var result = lus.Aggregate(" ", (current, index) => current + index); |
|
|
|
|
|
|
|
|
|
|
|
//s.LU = s.LU.Replace(" ", "").Replace(" ", " ");
|
|
|
|
|
|
s.BillNum = billNum; |
|
|
|
|
|
s.Site = "直供件"; |
|
|
|
|
|
s.KeyCode = s.LU + s.PN; |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
//await _repository.InsertAsync(pubSa);
|
|
|
|
|
|
//await _pubSaDetailRepository.InsertManyAsync(_ls);
|
|
|
return ApplicationConsts.SuccessStr; |
|
|
return ApplicationConsts.SuccessStr; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|