Browse Source

更新版本

master
学 赵 1 year ago
parent
commit
a2b88fe0c9
  1. 3
      code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/INVOICE_GRP_DTO.cs
  2. 22
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/HBPO_CAN_SA_SERVICE.cs
  3. 23
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_CAN_SA_SERVICE.cs
  4. 95
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/VmiAppService.cs
  5. 13
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/VmiAsyncBalanceService.cs

3
code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/INVOICE_GRP_DTO.cs

@ -94,9 +94,6 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Dtos
[Display(Name = "税率")] [Display(Name = "税率")]
public decimal Tax { get; set; } public decimal Tax { get; set; }
/// <summary> /// <summary>
///发票分组号 ///发票分组号
/// </summary> /// </summary>

22
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/HBPO_CAN_SA_SERVICE.cs

@ -20,6 +20,7 @@ using Win.Sfs.SettleAccount.Entities.BQ.Syncs;
using Win.Sfs.SettleAccount.Entities.BQ.Temp; using Win.Sfs.SettleAccount.Entities.BQ.Temp;
using Win.Sfs.SettleAccount.Entities.Prices; using Win.Sfs.SettleAccount.Entities.Prices;
using Win.Sfs.SettleAccount.Entities.TaskJobs; using Win.Sfs.SettleAccount.Entities.TaskJobs;
using Win.Sfs.SettleAccount.ExportReports;
using Win.Sfs.Shared.RepositoryBase; using Win.Sfs.Shared.RepositoryBase;
namespace Win.Sfs.SettleAccount.Entities.BQ namespace Win.Sfs.SettleAccount.Entities.BQ
@ -88,14 +89,19 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
} }
var entitys = await _hbpoMng.GetDetalListAsync(invbillnum).ConfigureAwait(false); var entitys = await _hbpoMng.GetDetalListAsync(invbillnum).ConfigureAwait(false);
var settleBillList= entitys.Select(p => p.SettleBillNum).Distinct(); #region 是否核对已经完成
List<ERR_EXP_DTO> errors = new List<ERR_EXP_DTO>();
var settleBillList = entitys.Select(p => p.SettleBillNum).Distinct().ToList();
var checklist = _saRepository.Where(p => settleBillList.Contains(p.BillNum) && p.State == "0").ToList();
//_saRepository.Where(p=>settleBillList.Contains(p.BillNum) && p.State==0) foreach (var itm in checklist)
{
errors.Add(new ERR_EXP_DTO() { Remark = $"版本:{itm.Version},结算单:{itm.BillNum}+没进行报表核对!" });
}
if (errors.Count > 0)
{
return new JsonResult(new { Code = ApplicationConsts.ImportFailCode, Message = "错误提示文件已下载,请打开文件查看", fileName = await ExportErrorReportAsync(errors).ConfigureAwait(false) });
}
#endregion
var priceList = _priceRepository.Where(p => p.IsCancel == false).ToList(); //价格单 var priceList = _priceRepository.Where(p => p.IsCancel == false).ToList(); //价格单
var errorList = await CheckInvoiceGenerationRules(entitys, main.Site, priceList, main.BusinessType).ConfigureAwait(false);//校验生成规则 var errorList = await CheckInvoiceGenerationRules(entitys, main.Site, priceList, main.BusinessType).ConfigureAwait(false);//校验生成规则
if (errorList.Count > 0) if (errorList.Count > 0)

23
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_CAN_SA_SERVICE.cs

@ -17,6 +17,7 @@ using Win.Sfs.SettleAccount.Entities.BQ.Dtos;
using Win.Sfs.SettleAccount.Entities.BQ.Managers; using Win.Sfs.SettleAccount.Entities.BQ.Managers;
using Win.Sfs.SettleAccount.Entities.BQ.Temp; using Win.Sfs.SettleAccount.Entities.BQ.Temp;
using Win.Sfs.SettleAccount.Entities.Prices; using Win.Sfs.SettleAccount.Entities.Prices;
using Win.Sfs.SettleAccount.ExportReports;
using Win.Sfs.Shared.RepositoryBase; using Win.Sfs.Shared.RepositoryBase;
namespace Win.Sfs.SettleAccount.Entities.BQ namespace Win.Sfs.SettleAccount.Entities.BQ
@ -44,6 +45,9 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
private readonly INormalEfCoreRepository<PriceListBJ, Guid> _pricebjRepository; private readonly INormalEfCoreRepository<PriceListBJ, Guid> _pricebjRepository;
private readonly INormalEfCoreRepository<PUB_NOT_SA_DETAIL, Guid> _notRepository; private readonly INormalEfCoreRepository<PUB_NOT_SA_DETAIL, Guid> _notRepository;
private readonly INormalEfCoreRepository<PUB_SA, Guid> _saRepository;
public PUB_CAN_SA_SERVICE public PUB_CAN_SA_SERVICE
(IExcelImportAppService excelImportService, (IExcelImportAppService excelImportService,
ISnowflakeIdGenerator snowflakeIdGenerator, ISnowflakeIdGenerator snowflakeIdGenerator,
@ -56,7 +60,8 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
PUB_CAN_SA_MNG pubMng, PUB_CAN_SA_MNG pubMng,
BaseDomainService baseservice, BaseDomainService baseservice,
INormalEfCoreRepository<PUB_NOT_SA_DETAIL, Guid> notRepository, INormalEfCoreRepository<PUB_NOT_SA_DETAIL, Guid> notRepository,
INormalEfCoreRepository<PriceListYinDu, Guid> priceYinDuRepository INormalEfCoreRepository<PriceListYinDu, Guid> priceYinDuRepository,
INormalEfCoreRepository<PUB_SA, Guid> saRepository
) : base(excelImportService, snowflakeIdGenerator, commonManager, repository, detailRepository, invmng, baseservice) ) : base(excelImportService, snowflakeIdGenerator, commonManager, repository, detailRepository, invmng, baseservice)
{ {
@ -65,6 +70,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
_pricebjRepository = pricebjRepository; _pricebjRepository = pricebjRepository;
_notRepository = notRepository; _notRepository = notRepository;
_priceYinDuRepository= priceYinDuRepository; _priceYinDuRepository= priceYinDuRepository;
_saRepository= saRepository;
} }
[HttpPost] [HttpPost]
[UnitOfWork(false)] [UnitOfWork(false)]
@ -122,6 +128,21 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
//{ //{
// priceList = _priceRepository.Where(p => p.IsCancel == false).ToList();//价格单 // priceList = _priceRepository.Where(p => p.IsCancel == false).ToList();//价格单
//} //}
#region 是否对比核对已经完成
List<ERR_EXP_DTO> errors = new List<ERR_EXP_DTO>();
var settleBillList = entitys.Select(p => p.SettleBillNum).Distinct().ToList();
var checklist = _saRepository.Where(p => settleBillList.Contains(p.BillNum) && p.State == "0").ToList();
foreach (var itm in checklist)
{
errors.Add(new ERR_EXP_DTO(){ Remark = $"版本:{itm.Version},结算单:{itm.BillNum}+没进行报表核对!" });
}
if (errors.Count > 0)
{
return new JsonResult(new { Code = ApplicationConsts.ImportFailCode, Message = "错误提示文件已下载,请打开文件查看", fileName = await ExportErrorReportAsync(errors).ConfigureAwait(false) });
}
#endregion
var errorList = await CheckInvoiceGenerationRules(entitys, main.Site, priceList, main.BusinessType).ConfigureAwait(false);//校验生成规则 var errorList = await CheckInvoiceGenerationRules(entitys, main.Site, priceList, main.BusinessType).ConfigureAwait(false);//校验生成规则
if (errorList.Count > 0) if (errorList.Count > 0)
{ {

95
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/VmiAppService.cs

@ -193,18 +193,32 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
[HttpPost] [HttpPost]
public async Task<PagedResultDto<VmiBalanceSumDto>> BalanceSum(RequestDto input) public async Task<PagedResultDto<VmiBalanceSumDto>> BalanceSum(RequestDto input)
{ {
var connectionString = this._serviceProvider.GetRequiredService<IConfiguration>().GetConnectionString("SettleAccountService"); var connectionString = this._serviceProvider.GetRequiredService<IConfiguration>().GetConnectionString("SettleAccountService");
var options = new DbContextOptionsBuilder<SettleAccountDbContext>().UseSqlServer(connectionString).Options; var options = new DbContextOptionsBuilder<SettleAccountDbContext>().UseSqlServer(connectionString).Options;
using var db = new SettleAccountDbContext(options); using var db = new SettleAccountDbContext(options);
var query = db.Set<VmiBalance>().FromSqlRaw("select * from Set_VmiBalance"); var query = db.Set<VmiLog>().FromSqlRaw("select * from Set_VmiLog");
var filters = input.Filters.ToLambda<VmiBalance>(); var filters = input.Filters.ToLambda<VmiLog>();
if (input.Filters.Count > 0) if (input.Filters.Count > 0)
{ {
query = query.Where(input.Filters.ToLambda<VmiBalance>()); query = query.Where(input.Filters.ToLambda<VmiLog>());
} }
query = string.IsNullOrEmpty(input.Sorting) ? query : DynamicQueryableExtensions.OrderBy(query, input.Sorting);
var query2 = query.GroupBy(o => new { o.ErpToLoc, o.RealPartCode }).Select(o => new VmiBalanceSumDto { ErpToLoc = o.Key.ErpToLoc, RealPartCode = o.Key.RealPartCode, Qty = o.Sum(o => o.Qty) }); var query2 = query.GroupBy(o => new { o.ErpToLoc, o.RealPartCode }).Select(o => new VmiBalanceSumDto { ErpToLoc = o.Key.ErpToLoc, RealPartCode = o.Key.RealPartCode, Qty = o.Sum(o => o.Qty) });
var totalCount = query2.Count(); var totalCount = query2.Count();
query2 = string.IsNullOrEmpty(input.Sorting) ? query2 : DynamicQueryableExtensions.OrderBy(query2, input.Sorting);
//var connectionString = this._serviceProvider.GetRequiredService<IConfiguration>().GetConnectionString("SettleAccountService");
//var options = new DbContextOptionsBuilder<SettleAccountDbContext>().UseSqlServer(connectionString).Options;
//using var db = new SettleAccountDbContext(options);
//var query = db.Set<VmiBalance>().FromSqlRaw("select * from Set_VmiBalance");
//var filters = input.Filters.ToLambda<VmiBalance>();
//if (input.Filters.Count > 0)
//{
// query = query.Where(input.Filters.ToLambda<VmiBalance>());
//}
//var query2 = query.GroupBy(o => new { o.ErpToLoc, o.RealPartCode }).Select(o => new VmiBalanceSumDto { ErpToLoc = o.Key.ErpToLoc, RealPartCode = o.Key.RealPartCode, Qty = o.Sum(o => o.Qty) });
//var totalCount = query2.Count();
//query2 = string.IsNullOrEmpty(input.Sorting) ? query2 : DynamicQueryableExtensions.OrderBy(query2, input.Sorting);
var entities = await query2.PageBy(input.SkipCount, input.MaxResultCount).ToListAsync().ConfigureAwait(false); var entities = await query2.PageBy(input.SkipCount, input.MaxResultCount).ToListAsync().ConfigureAwait(false);
return new PagedResultDto<VmiBalanceSumDto>(totalCount, entities); return new PagedResultDto<VmiBalanceSumDto>(totalCount, entities);
} }
@ -215,14 +229,17 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
[HttpPost] [HttpPost]
public async Task<string> BalanceSumExport(RequestDto input) public async Task<string> BalanceSumExport(RequestDto input)
{ {
var connectionString = this._serviceProvider.GetRequiredService<IConfiguration>().GetConnectionString("SettleAccountService"); var connectionString = this._serviceProvider.GetRequiredService<IConfiguration>().GetConnectionString("SettleAccountService");
var options = new DbContextOptionsBuilder<SettleAccountDbContext>().UseSqlServer(connectionString).Options; var options = new DbContextOptionsBuilder<SettleAccountDbContext>().UseSqlServer(connectionString).Options;
using var db = new SettleAccountDbContext(options); using var db = new SettleAccountDbContext(options);
var query = db.Set<VmiBalance>().FromSqlRaw("select * from Set_VmiBalance"); var query = db.Set<VmiLog>().FromSqlRaw("select * from Set_VmiLog");
var filters = input.Filters.ToLambda<VmiBalance>(); var filters = input.Filters.ToLambda<VmiLog>();
if (input.Filters.Count > 0) if (input.Filters.Count > 0)
{ {
query = query.Where(input.Filters.ToLambda<VmiBalance>()); 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 }).Select(o => new VmiBalanceSumDto { ErpToLoc = o.Key.ErpToLoc, RealPartCode = o.Key.RealPartCode, Qty = o.Sum(o => o.Qty) }); var query2 = query.GroupBy(o => new { o.ErpToLoc, o.RealPartCode }).Select(o => new VmiBalanceSumDto { ErpToLoc = o.Key.ErpToLoc, RealPartCode = o.Key.RealPartCode, Qty = o.Sum(o => o.Qty) });
@ -231,8 +248,69 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
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);
return fileName; return fileName;
//var connectionString = this._serviceProvider.GetRequiredService<IConfiguration>().GetConnectionString("SettleAccountService");
//var options = new DbContextOptionsBuilder<SettleAccountDbContext>().UseSqlServer(connectionString).Options;
//using var db = new SettleAccountDbContext(options);
//var query = db.Set<VmiBalance>().FromSqlRaw("select * from Set_VmiBalance");
//var filters = input.Filters.ToLambda<VmiBalance>();
//if (input.Filters.Count > 0)
//{
// query = query.Where(input.Filters.ToLambda<VmiBalance>());
//}
//query = string.IsNullOrEmpty(input.Sorting) ? query : DynamicQueryableExtensions.OrderBy(query, input.Sorting);
//var query2 = query.GroupBy(o => new { o.ErpToLoc, o.RealPartCode }).Select(o => new VmiBalanceSumDto { ErpToLoc = o.Key.ErpToLoc, RealPartCode = o.Key.RealPartCode, Qty = o.Sum(o => o.Qty) });
//var totalCount = query2.Count();
//var entities = await query2.ToListAsync().ConfigureAwait(false); var fileName = $"库存余额_{DateTime.Now.ToString("yyyy-MM-dd_HH-mm-ss")}.xlsx";
//var content = this.GetContent(entities, "库存汇总");
//await _fileContainer.SaveAsync(fileName, content, true).ConfigureAwait(false);
//return fileName;
} }
/// <summary>
/// 1.2库存余额汇总导出
/// </summary>
[HttpPost]
public async Task<string> BalanceSumByLogExport(RequestDto input)
{
var connectionString = this._serviceProvider.GetRequiredService<IConfiguration>().GetConnectionString("SettleAccountService");
var options = new DbContextOptionsBuilder<SettleAccountDbContext>().UseSqlServer(connectionString).Options;
using var db = new SettleAccountDbContext(options);
var query = db.Set<VmiLog>().FromSqlRaw("select * from Set_VmiLog");
var filters = input.Filters.ToLambda<VmiLog>();
if (input.Filters.Count > 0)
{
query = query.Where(input.Filters.ToLambda<VmiLog>());
}
query = string.IsNullOrEmpty(input.Sorting) ? query : DynamicQueryableExtensions.OrderBy(query, input.Sorting);
var query2 = query.GroupBy(o => new { o.ErpToLoc, o.RealPartCode }).Select(o => new VmiBalanceSumDto { ErpToLoc = o.Key.ErpToLoc, RealPartCode = o.Key.RealPartCode, Qty = o.Sum(o => o.Qty) });
var totalCount = query2.Count();
var entities = await query2.ToListAsync().ConfigureAwait(false); var fileName = $"库存余额_{DateTime.Now.ToString("yyyy-MM-dd_HH-mm-ss")}.xlsx";
var content = this.GetContent(entities, "库存汇总");
await _fileContainer.SaveAsync(fileName, content, true).ConfigureAwait(false);
return fileName;
}
/// <summary> /// <summary>
/// 快照列表 /// 快照列表
/// </summary> /// </summary>
@ -1051,4 +1129,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
[Display(Name = "数量", Order = 10)] [Display(Name = "数量", Order = 10)]
public decimal Qty { get; set; } public decimal Qty { get; set; }
} }
} }

13
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/VmiAsyncBalanceService.cs

@ -153,15 +153,14 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
//本地查找 //本地查找
var balance = balanceList.Select(o => o.Item1).FirstOrDefault( var balance = balanceList.Select(o => o.Item1).FirstOrDefault(
o => o =>
//o.DeliverBillType == log.DeliverBillType && o.DeliverBillType == log.DeliverBillType &&
//o.CodeType == log.CodeType && o.CodeType == log.CodeType &&
o.RealPartCode == log.RealPartCode && o.RealPartCode == log.RealPartCode &&
o.VinCode == log.VinCode && o.VinCode == log.VinCode &&
o.ErpToLoc == log.ErpToLoc o.ErpToLoc == log.ErpToLoc&&
//&& o.OrderNum == log.OrderNum &&
//o.OrderNum == log.OrderNum && o.factory == log.factory &&
//o.factory == log.factory && o.Configcode == log.Configcode
//o.Configcode == log.Configcode
); );
//数据库查找 //数据库查找
if (balance == null) if (balance == null)

Loading…
Cancel
Save