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