|
@ -1,4 +1,4 @@ |
|
|
using System; |
|
|
using System; |
|
|
using System.Collections.Generic; |
|
|
using System.Collections.Generic; |
|
|
using System.ComponentModel.DataAnnotations; |
|
|
using System.ComponentModel.DataAnnotations; |
|
|
using System.Data.SqlClient; |
|
|
using System.Data.SqlClient; |
|
@ -77,9 +77,6 @@ namespace Win.Sfs.SettleAccount.Entities.BQ |
|
|
private readonly TaskJobService _service; |
|
|
private readonly TaskJobService _service; |
|
|
private readonly Volo.Abp.ObjectMapping.IObjectMapper _maper; |
|
|
private readonly Volo.Abp.ObjectMapping.IObjectMapper _maper; |
|
|
protected readonly IExcelImportAppService _excelImportService; |
|
|
protected readonly IExcelImportAppService _excelImportService; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private readonly IConfiguration _config; |
|
|
|
|
|
public VmiAppService(IConfiguration cfg, |
|
|
public VmiAppService(IConfiguration cfg, |
|
|
IServiceProvider serviceProvider, |
|
|
IServiceProvider serviceProvider, |
|
|
IGuidGenerator guidGenerator, |
|
|
IGuidGenerator guidGenerator, |
|
@ -92,13 +89,12 @@ namespace Win.Sfs.SettleAccount.Entities.BQ |
|
|
ICurrentUser currentUser, |
|
|
ICurrentUser currentUser, |
|
|
ILogger<VmiAppService> logger, |
|
|
ILogger<VmiAppService> logger, |
|
|
IExcelImportAppService excelImportService, |
|
|
IExcelImportAppService excelImportService, |
|
|
TaskJobService service, |
|
|
TaskJobService service |
|
|
IConfiguration config |
|
|
|
|
|
|
|
|
|
|
|
) |
|
|
) |
|
|
|
|
|
|
|
|
{ |
|
|
{ |
|
|
_config = config; |
|
|
_maper = maper; |
|
|
this._codeRepository = codeRepository; |
|
|
this._codeRepository = codeRepository; |
|
|
this._cfg = cfg; |
|
|
this._cfg = cfg; |
|
|
this._guidGenerator = guidGenerator; |
|
|
this._guidGenerator = guidGenerator; |
|
@ -112,10 +108,6 @@ namespace Win.Sfs.SettleAccount.Entities.BQ |
|
|
_service = service; |
|
|
_service = service; |
|
|
LinqToDBForEFTools.Initialize(); |
|
|
LinqToDBForEFTools.Initialize(); |
|
|
_excelImportService = excelImportService; |
|
|
_excelImportService = excelImportService; |
|
|
|
|
|
|
|
|
string tax = config["Tax"]; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
/// <summary>
|
|
@ -243,10 +235,10 @@ namespace Win.Sfs.SettleAccount.Entities.BQ |
|
|
query = query.Where(input.Filters.ToLambda<VmiLog>()); |
|
|
query = query.Where(input.Filters.ToLambda<VmiLog>()); |
|
|
} |
|
|
} |
|
|
query = string.IsNullOrEmpty(input.Sorting) ? query : DynamicQueryableExtensions.OrderBy(query, input.Sorting); |
|
|
query = string.IsNullOrEmpty(input.Sorting) ? query : DynamicQueryableExtensions.OrderBy(query, input.Sorting); |
|
|
var query2 = query.GroupBy(o => new { o.ErpToLoc, o.RealPartCode, o.VinCode }).Select(o => new VmiBalanceDto { VinCode = o.Key.VinCode, ErpToLoc = o.Key.ErpToLoc, RealPartCode = o.Key.RealPartCode, Qty = o.Sum(o => o.ChangedQty), LastTime = o.Max(o => o.ChangedTime) }).Where(p=>p.Qty!=0); |
|
|
var query2 = query.GroupBy(o => new { o.ErpToLoc, o.RealPartCode, o.VinCode }).Select(o => new VmiBalanceDto { VinCode = o.Key.VinCode, ErpToLoc = o.Key.ErpToLoc, RealPartCode = o.Key.RealPartCode, Qty = o.Sum(o => o.ChangedQty), LastTime = o.Max(o => o.ChangedTime) }).Where(p => p.Qty != 0); |
|
|
var entities = query2.ToList(); |
|
|
var entities = query2.ToList(); |
|
|
|
|
|
|
|
|
// var entities = await _balanceRepository.GetListByFilterAsync(input.Filters).ConfigureAwait(false);
|
|
|
// var entities = await _balanceRepository.GetListByFilterAsync(input.Filters).ConfigureAwait(false);
|
|
|
var fileName = $"库存余额_{DateTime.Now.ToString("yyyy-MM-dd_HH-mm-ss")}.xlsx"; |
|
|
var fileName = $"库存余额_{DateTime.Now.ToString("yyyy-MM-dd_HH-mm-ss")}.xlsx"; |
|
|
var content = this.GetContent(entities, "库存余额"); |
|
|
var content = this.GetContent(entities, "库存余额"); |
|
|
await _fileContainer.SaveAsync(fileName, content, true).ConfigureAwait(false); |
|
|
await _fileContainer.SaveAsync(fileName, content, true).ConfigureAwait(false); |
|
@ -527,7 +519,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ |
|
|
|
|
|
|
|
|
if (entities.Count > 1000000) |
|
|
if (entities.Count > 1000000) |
|
|
{ |
|
|
{ |
|
|
throw new UserFriendlyException("导出行数超过100W不能导出,请重新录入查询条件导出","400"); |
|
|
throw new UserFriendlyException("导出行数超过100W不能导出,请重新录入查询条件导出", "400"); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
var dtos = _maper.Map<List<VmiLog>, List<VmiLogExportDto>>(entities); |
|
|
var dtos = _maper.Map<List<VmiLog>, List<VmiLogExportDto>>(entities); |
|
@ -550,7 +542,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ |
|
|
public async Task<string> ReplenishedExportAsync(ARequestDto input) |
|
|
public async Task<string> ReplenishedExportAsync(ARequestDto input) |
|
|
{ |
|
|
{ |
|
|
RequestDto inputTemp = new RequestDto(); |
|
|
RequestDto inputTemp = new RequestDto(); |
|
|
var beginDate= DateTime.Parse(input.startBillTime).ToString("yyyy/MM/dd") + " 00:00:00 "; |
|
|
var beginDate = DateTime.Parse(input.startBillTime).ToString("yyyy/MM/dd") + " 00:00:00 "; |
|
|
var endDate = DateTime.Parse(input.endBillTime).ToString("yyyy/MM/dd") + " 23:59:59 "; |
|
|
var endDate = DateTime.Parse(input.endBillTime).ToString("yyyy/MM/dd") + " 23:59:59 "; |
|
|
DateTimeFormatInfo dtFormat = new DateTimeFormatInfo(); |
|
|
DateTimeFormatInfo dtFormat = new DateTimeFormatInfo(); |
|
|
dtFormat.ShortDatePattern = "yyyy/MM/dd HH:mm:ss"; |
|
|
dtFormat.ShortDatePattern = "yyyy/MM/dd HH:mm:ss"; |
|
@ -616,8 +608,8 @@ namespace Win.Sfs.SettleAccount.Entities.BQ |
|
|
// where a.MinChangedTime < b.MinChangedTime && a.SumChangedQty <= b.SumChangedQty
|
|
|
// where a.MinChangedTime < b.MinChangedTime && a.SumChangedQty <= b.SumChangedQty
|
|
|
// select b);
|
|
|
// select b);
|
|
|
|
|
|
|
|
|
var entities = result.Where(p => p.BillTime >= DateTime.Parse(beginDate) && p.BillTime <= DateTime.Parse(endDate) && p.LogType==VmiLogType.Type100).ToList(); |
|
|
var entities = result.Where(p => p.BillTime >= DateTime.Parse(beginDate) && p.BillTime <= DateTime.Parse(endDate) && p.LogType == VmiLogType.Type100).ToList(); |
|
|
// IQueryable<VmiLog> query = _logRepository.WhereIf(input.Filters?.Count != 0, input.Filters.ToLambda<VmiLog>());
|
|
|
// IQueryable<VmiLog> query = _logRepository.WhereIf(input.Filters?.Count != 0, input.Filters.ToLambda<VmiLog>());
|
|
|
var fileName = $"补货数据_{DateTime.Now.ToString("yyyy-MM-dd_HH-mm-ss")}.xlsx"; |
|
|
var fileName = $"补货数据_{DateTime.Now.ToString("yyyy-MM-dd_HH-mm-ss")}.xlsx"; |
|
|
var content = this.GetContent(entities, "补货数据_"); |
|
|
var content = this.GetContent(entities, "补货数据_"); |
|
|
await _fileContainer.SaveAsync(fileName, content, true).ConfigureAwait(false); |
|
|
await _fileContainer.SaveAsync(fileName, content, true).ConfigureAwait(false); |
|
@ -863,7 +855,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ |
|
|
|
|
|
|
|
|
foreach (var itm in logList) |
|
|
foreach (var itm in logList) |
|
|
{ |
|
|
{ |
|
|
itm.Version= GetVersionByBillTime(itm.BillTime.Value, value); |
|
|
itm.Version = GetVersionByBillTime(itm.BillTime.Value, value); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -1136,7 +1128,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
var results = new List<ValidationResult>(); |
|
|
var results = new List<ValidationResult>(); |
|
|
Validator.TryValidateObject(model, new System.ComponentModel.DataAnnotations.ValidationContext (model, null, null), results); |
|
|
Validator.TryValidateObject(model, new System.ComponentModel.DataAnnotations.ValidationContext(model, null, null), results); |
|
|
list.Add(new Tuple<T, List<ValidationResult>>(model, results)); |
|
|
list.Add(new Tuple<T, List<ValidationResult>>(model, results)); |
|
|
} |
|
|
} |
|
|
return list; |
|
|
return list; |
|
|