|
@ -97,9 +97,6 @@ namespace Win.Sfs.SettleAccount.Entities.BQ |
|
|
INormalEfCoreRepository<CodeSetting, Guid> codeRepository, |
|
|
INormalEfCoreRepository<CodeSetting, Guid> codeRepository, |
|
|
INormalEfCoreRepository<VmiBalanceSumDetail, Guid> vmiBalanceSumDetailRepository, |
|
|
INormalEfCoreRepository<VmiBalanceSumDetail, Guid> vmiBalanceSumDetailRepository, |
|
|
INormalEfCoreRepository<BalanceSum, Guid> balanceSumRepository, |
|
|
INormalEfCoreRepository<BalanceSum, Guid> balanceSumRepository, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
IBlobContainer<MyFileContainer> fileContainer, |
|
|
IBlobContainer<MyFileContainer> fileContainer, |
|
|
Volo.Abp.ObjectMapping.IObjectMapper maper, |
|
|
Volo.Abp.ObjectMapping.IObjectMapper maper, |
|
|
IHubContext<PageHub> hubContext, |
|
|
IHubContext<PageHub> hubContext, |
|
@ -178,7 +175,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
/// <summary>
|
|
|
/// 定时备份:0 0 8 26 * ?
|
|
|
/// 定时备份:0 0 8 26 * ?(作废)
|
|
|
/// </summary>
|
|
|
/// </summary>
|
|
|
[HttpPost("invoke")] |
|
|
[HttpPost("invoke")] |
|
|
[DisableValidation] |
|
|
[DisableValidation] |
|
@ -188,7 +185,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ |
|
|
{ |
|
|
{ |
|
|
try |
|
|
try |
|
|
{ |
|
|
{ |
|
|
Invoke(_serviceProvider).Wait(); |
|
|
// Invoke(_serviceProvider).Wait();
|
|
|
return new JsonResult(new { Code = 200, Message = "备份成功" }); |
|
|
return new JsonResult(new { Code = 200, Message = "备份成功" }); |
|
|
} |
|
|
} |
|
|
catch (Exception ex) |
|
|
catch (Exception ex) |
|
@ -330,7 +327,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
/// <summary>
|
|
|
/// 快照列表
|
|
|
/// 快照列表(作废)
|
|
|
/// </summary>
|
|
|
/// </summary>
|
|
|
[HttpPost] |
|
|
[HttpPost] |
|
|
public ListResultDto<VmiSnapshot> Snapshot() |
|
|
public ListResultDto<VmiSnapshot> Snapshot() |
|
@ -343,26 +340,28 @@ namespace Win.Sfs.SettleAccount.Entities.BQ |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
/// <summary>
|
|
|
/// 2.时点库存查询
|
|
|
/// 2.时点库存查询(作废)
|
|
|
/// </summary>
|
|
|
/// </summary>
|
|
|
[HttpPost] |
|
|
[HttpPost] |
|
|
public async Task<PagedResultDto<VmiBalance>> Backup(BackupListRequest input) |
|
|
public async Task<PagedResultDto<VmiBalance>> Backup(BackupListRequest input) |
|
|
{ |
|
|
{ |
|
|
var connectionString = this._serviceProvider.GetRequiredService<IConfiguration>().GetConnectionString("SettleAccountService"); |
|
|
var entities=new List<VmiBalance>(); |
|
|
var options = new DbContextOptionsBuilder<SettleAccountDbContext>().UseSqlServer(connectionString).Options; |
|
|
|
|
|
using var db = new SettleAccountDbContext(options); |
|
|
//var connectionString = this._serviceProvider.GetRequiredService<IConfiguration>().GetConnectionString("SettleAccountService");
|
|
|
var name = input.Name; |
|
|
//var options = new DbContextOptionsBuilder<SettleAccountDbContext>().UseSqlServer(connectionString).Options;
|
|
|
var sql = $"select * from {name}"; |
|
|
//using var db = new SettleAccountDbContext(options);
|
|
|
var query = db.Set<VmiBalance>().FromSqlRaw(sql); |
|
|
//var name = input.Name;
|
|
|
var filters = input.Filters.ToLambda<VmiBalance>(); |
|
|
//var sql = $"select * from {name}";
|
|
|
if (input.Filters.Count > 0) |
|
|
//var query = db.Set<VmiBalance>().FromSqlRaw(sql);
|
|
|
{ |
|
|
//var filters = input.Filters.ToLambda<VmiBalance>();
|
|
|
query = query.Where(input.Filters.ToLambda<VmiBalance>()); |
|
|
//if (input.Filters.Count > 0)
|
|
|
} |
|
|
//{
|
|
|
var totalCount = query.Count(); |
|
|
// query = query.Where(input.Filters.ToLambda<VmiBalance>());
|
|
|
query = string.IsNullOrEmpty(input.Sorting) ? query : DynamicQueryableExtensions.OrderBy(query, input.Sorting); |
|
|
//}
|
|
|
var entities = await query.PageBy(input.SkipCount, input.MaxResultCount).ToListAsync().ConfigureAwait(false); |
|
|
//var totalCount = query.Count();
|
|
|
return new PagedResultDto<VmiBalance>(totalCount, entities); |
|
|
//query = string.IsNullOrEmpty(input.Sorting) ? query : DynamicQueryableExtensions.OrderBy(query, input.Sorting);
|
|
|
|
|
|
//var entities = await query.PageBy(input.SkipCount, input.MaxResultCount).ToListAsync().ConfigureAwait(false);
|
|
|
|
|
|
return new PagedResultDto<VmiBalance>(1, entities); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
/// <summary>
|
|
@ -770,36 +769,40 @@ namespace Win.Sfs.SettleAccount.Entities.BQ |
|
|
/// </summary>
|
|
|
/// </summary>
|
|
|
/// <param name="files"></param>
|
|
|
/// <param name="files"></param>
|
|
|
[HttpPost] |
|
|
[HttpPost] |
|
|
public async Task<IActionResult> ImportSE(List<IFormFile> files, EnumBusinessType businessType) |
|
|
public async Task<IActionResult> ImportSE(IFormFileCollection files , EnumBusinessType businessType) |
|
|
{ |
|
|
{ |
|
|
try |
|
|
try |
|
|
{ |
|
|
{ |
|
|
|
|
|
|
|
|
|
|
|
ExportImporter _exportImporter = new ExportImporter(); |
|
|
|
|
|
var dtos = await _exportImporter.UploadExcelImport<VimLogImportDTO>(files, _excelImportService).ConfigureAwait(false); |
|
|
|
|
|
var logList = _maper.Map<List<VimLogImportDTO>, List<VmiLog>>(dtos); |
|
|
using var ms = new MemoryStream(); |
|
|
using var ms = new MemoryStream(); |
|
|
var file = files.FirstOrDefault(); |
|
|
//var file = files.FirstOrDefault();
|
|
|
await file.OpenReadStream().CopyToAsync(ms).ConfigureAwait(false); |
|
|
//await file.OpenReadStream().CopyToAsync(ms).ConfigureAwait(false);
|
|
|
var data = ms.ToArray(); |
|
|
//var data = ms.ToArray();
|
|
|
var tupleList = this.ImportInternal<VmiLog>(data); |
|
|
//var tupleList = this.ImportInternal<VmiLog>(data);
|
|
|
if (tupleList.Any(o => o.Item2.Count > 0)) |
|
|
//if (tupleList.Any(o => o.Item2.Count > 0))
|
|
|
{ |
|
|
//{
|
|
|
using var workbook = new XLWorkbook(new MemoryStream(data)); |
|
|
// using var workbook = new XLWorkbook(new MemoryStream(data));
|
|
|
var ws = workbook.Worksheets.FirstOrDefault(); |
|
|
// var ws = workbook.Worksheets.FirstOrDefault();
|
|
|
var header = ws.Row(1); |
|
|
// var header = ws.Row(1);
|
|
|
var errorIndex = ws.ColumnsUsed().Count() + 1; |
|
|
// var errorIndex = ws.ColumnsUsed().Count() + 1;
|
|
|
header.Cell(errorIndex).Value = "提示信息"; |
|
|
// header.Cell(errorIndex).Value = "提示信息";
|
|
|
for (int i = 0; i < ws.RowsUsed().Count() - 1; i++) |
|
|
// for (int i = 0; i < ws.RowsUsed().Count() - 1; i++)
|
|
|
{ |
|
|
// {
|
|
|
ws.Row(i + 2).Cell(errorIndex).Value = string.Join(',', tupleList[i].Item2.Select(o => o.ErrorMessage)); |
|
|
// ws.Row(i + 2).Cell(errorIndex).Value = string.Join(',', tupleList[i].Item2.Select(o => o.ErrorMessage));
|
|
|
} |
|
|
// }
|
|
|
SetStyle(ws); |
|
|
// SetStyle(ws);
|
|
|
using var stream = new MemoryStream(); |
|
|
// using var stream = new MemoryStream();
|
|
|
workbook.SaveAs(stream); |
|
|
// workbook.SaveAs(stream);
|
|
|
stream.Seek(0, SeekOrigin.Begin); |
|
|
// stream.Seek(0, SeekOrigin.Begin);
|
|
|
var fileName = $"{file.Name}_错误信息.xlsx"; |
|
|
// var fileName = $"{file.Name}_错误信息.xlsx";
|
|
|
await this._fileContainer.SaveAsync(fileName, stream, true).ConfigureAwait(false); |
|
|
// await this._fileContainer.SaveAsync(fileName, stream, true).ConfigureAwait(false);
|
|
|
return new JsonResult(new { code = 400, message = "输入异常", fileName }); |
|
|
// return new JsonResult(new { code = 400, message = "输入异常", fileName });
|
|
|
} |
|
|
//}
|
|
|
var logList = tupleList.Select(o => o.Item1).ToList(); |
|
|
//var logList = tupleList.Select(o => o.Item1).ToList();
|
|
|
logList.AsParallel().ForEach(Update); |
|
|
// logList.AsParallel().ForEach(Update);
|
|
|
|
|
|
|
|
|
if (businessType == EnumBusinessType.JisBBAC) |
|
|
if (businessType == EnumBusinessType.JisBBAC) |
|
|
{ |
|
|
{ |
|
|