马昊 2 years ago
parent
commit
2f8b1722f8
  1. 8
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/router/base-data.js
  2. 13
      code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/BBAC_CAN_SA_DTO.cs
  3. 8
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/HBPO_CAN_SA_SERVICE.cs
  4. 46
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/VmiAsyncBalanceService.cs
  5. 51
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/VmiAsyncMessageService.cs

8
code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/router/base-data.js

@ -18,10 +18,10 @@ export default [
...createPage("role", "title=角色管理"), ...createPage("role", "title=角色管理"),
children: [createButton("query", "title=查询&isTop=true"), createButton("create", "title=新建&isTop=true"), createButton("delete", "title=删除&disabled=o => o.isStatic")], children: [createButton("query", "title=查询&isTop=true"), createButton("create", "title=新建&isTop=true"), createButton("delete", "title=删除&disabled=o => o.isStatic")],
}, },
{ // {
...createPage("material", "title=物料主数据"), // ...createPage("material", "title=物料主数据"),
children: [createButton("query", "title=查询&isTop=true"), createButton("export", "title=导出&isTop=true&pattern=paged")], // children: [createButton("query", "title=查询&isTop=true"), createButton("export", "title=导出&isTop=true&pattern=paged")],
}, // },
{ {
...createPage("version", "title=期间设置"), ...createPage("version", "title=期间设置"),
children: [ children: [

13
code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/BBAC_CAN_SA_DTO.cs

@ -43,6 +43,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Dtos
{ {
[ExporterHeader(DisplayName = "关联结算单号")] //全部业务都有显示 [ExporterHeader(DisplayName = "关联结算单号")] //全部业务都有显示
public string SettleBillNum { get; set; } public string SettleBillNum { get; set; }
[ExporterHeader(DisplayName = "发票分组号")] //全部业务都显示 (默认) [ExporterHeader(DisplayName = "发票分组号")] //全部业务都显示 (默认)
@ -67,6 +68,11 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Dtos
public string Site { get; set; } public string Site { get; set; }
[ExporterHeader(DisplayName = "是否退货")] //BBAC-JIS显示 其他没有这个字段 [ExporterHeader(DisplayName = "是否退货")] //BBAC-JIS显示 其他没有这个字段
public string IsReturn { get; set; } public string IsReturn { get; set; }
[ExporterHeader(DisplayName = "合同号")]
public string ContractDocID { set; get; }
/// <summary> /// <summary>
/// 版本 /// 版本
/// </summary> /// </summary>
@ -84,10 +90,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Dtos
/// 金额 /// 金额
/// </summary> /// </summary>
public decimal Amt { get; set; } public decimal Amt { get; set; }
/// <summary>
/// 合同号
/// </summary>
public string ContractDocID { set; get; }
} }
@ -129,6 +132,8 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Dtos
/// </summary> /// </summary>
[ExporterHeader(DisplayName = "版本号")] [ExporterHeader(DisplayName = "版本号")]
public int Version { get; set; } public int Version { get; set; }
[ExporterHeader(DisplayName = "合同号")]
public int ContractDocID { set; get; }
} }
//public class BBAC_CAN_SA_EXP_DTO //public class BBAC_CAN_SA_EXP_DTO

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

@ -15,6 +15,7 @@ using Volo.Abp;
using Volo.Abp.Application.Dtos; using Volo.Abp.Application.Dtos;
using Volo.Abp.Application.Services; using Volo.Abp.Application.Services;
using Volo.Abp.ObjectMapping; using Volo.Abp.ObjectMapping;
using Volo.Abp.Uow;
using Win.Abp.Snowflakes; using Win.Abp.Snowflakes;
using Win.Sfs.BaseData.ImportExcelCommon; using Win.Sfs.BaseData.ImportExcelCommon;
using Win.Sfs.SettleAccount.Bases; using Win.Sfs.SettleAccount.Bases;
@ -74,6 +75,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
/// <param name="input"></param> /// <param name="input"></param>
/// <returns></returns> /// <returns></returns>
[HttpPost] [HttpPost]
[UnitOfWork(false)]
//[Route("generateinvoice")] //[Route("generateinvoice")]
public async override Task<IActionResult> GenerateInvoice([FromBody] string invbillnum) public async override Task<IActionResult> GenerateInvoice([FromBody] string invbillnum)
{ {
@ -161,11 +163,5 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
} }
return new JsonResult(new { Code = 200, Message = "生成成功" }); return new JsonResult(new { Code = 200, Message = "生成成功" });
} }
} }
} }

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

@ -4,15 +4,11 @@ using System.Linq;
using System.Linq.Dynamic.Core; using System.Linq.Dynamic.Core;
using System.Text.Json; using System.Text.Json;
using System.Threading.Tasks; using System.Threading.Tasks;
using EFCore.BulkExtensions;
using Magicodes.ExporterAndImporter.Core.Extension; using Magicodes.ExporterAndImporter.Core.Extension;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.SignalR;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using Omu.ValueInjecter; using Omu.ValueInjecter;
using SettleAccount.Job.SignalR;
using Volo.Abp.Application.Services; using Volo.Abp.Application.Services;
using Volo.Abp.DependencyInjection; using Volo.Abp.DependencyInjection;
using Win.Sfs.SettleAccount.Entities.BQ.Vmi; using Win.Sfs.SettleAccount.Entities.BQ.Vmi;
@ -33,6 +29,8 @@ public class VmiAsyncBalanceService : ApplicationService, IJobService, ITransien
} }
public async Task Invoke(IServiceProvider serviceProvider) public async Task Invoke(IServiceProvider serviceProvider)
{
for (var i = 0; i < 50; i++)
{ {
var connectionString = serviceProvider.GetRequiredService<IConfiguration>().GetConnectionString("SettleAccountService"); var connectionString = serviceProvider.GetRequiredService<IConfiguration>().GetConnectionString("SettleAccountService");
using var connection = new SqlConnection(connectionString); using var connection = new SqlConnection(connectionString);
@ -45,7 +43,11 @@ public class VmiAsyncBalanceService : ApplicationService, IJobService, ITransien
var options = new DbContextOptionsBuilder<SettleAccountDbContext>().UseSqlServer(connection).Options; var options = new DbContextOptionsBuilder<SettleAccountDbContext>().UseSqlServer(connection).Options;
using var context = new SettleAccountDbContext(options); using var context = new SettleAccountDbContext(options);
context.Database.UseTransaction(transaction); context.Database.UseTransaction(transaction);
var messages = context.Set<VmiMessage>().Where(o => !o.isConsumed).OrderBy(o => o.Number).Take(1000 * 100).ToList(); if (!context.Set<VmiMessage>().Any(o => !o.isConsumed))
{
break;
}
var messages = context.Set<VmiMessage>().Where(o => !o.isConsumed).OrderBy(o => o.Number).Take(1000).ToList();
var repo = context.Set<VmiBalance>(); var repo = context.Set<VmiBalance>();
foreach (var message in messages) foreach (var message in messages)
{ {
@ -135,39 +137,7 @@ public class VmiAsyncBalanceService : ApplicationService, IJobService, ITransien
} }
} }
/// <summary> public async Task InvokeInternal(IServiceProvider serviceProvider)
/// 消息表定时清理
/// </summary>
public class VmiAsyncMessageService : Controller, IApplicationService, IJobService, ITransientDependency
{
private readonly IServiceProvider _serviceProvider;
public VmiAsyncMessageService(IServiceProvider serviceProvider)
{
this._serviceProvider = serviceProvider;
}
[NonAction]
public Task Invoke(IServiceProvider serviceProvider)
{ {
using var scope = serviceProvider.CreateScope();
var db = scope.ServiceProvider.GetRequiredService<SettleAccountDbContext>();
db.Set<VmiMessage>().Where(o => o.isConsumed).BatchDelete();
var count = db.Set<VmiMessage>().Where(o => !o.isConsumed).Count();
scope.ServiceProvider.GetService<IHubContext<PageHub>>().Clients.All.ServerToClient("VmiBalance", count.ToString(), "");
return Task.CompletedTask;
}
/// <summary>
/// 未处理消息数量
/// </summary>
/// <returns></returns>
[HttpPost]
public int GetMessageCount()
{
using var scope = this._serviceProvider.CreateScope();
var db = scope.ServiceProvider.GetRequiredService<SettleAccountDbContext>();
var count = db.Set<VmiMessage>().Where(o => !o.isConsumed).Count();
return count;
} }
} }

51
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/VmiAsyncMessageService.cs

@ -0,0 +1,51 @@
using System;
using System.Linq;
using System.Linq.Dynamic.Core;
using System.Threading.Tasks;
using EFCore.BulkExtensions;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.SignalR;
using Microsoft.Extensions.DependencyInjection;
using SettleAccount.Job.SignalR;
using Volo.Abp.Application.Services;
using Volo.Abp.DependencyInjection;
using Win.Sfs.SettleAccount.Entities.BQ.Vmi;
namespace Win.Sfs.SettleAccount.Entities.BQ;
/// <summary>
/// 消息表定时清理
/// </summary>
public class VmiAsyncMessageService : Controller, IApplicationService, IJobService, ITransientDependency
{
private readonly IServiceProvider _serviceProvider;
public VmiAsyncMessageService(IServiceProvider serviceProvider)
{
this._serviceProvider = serviceProvider;
}
[NonAction]
public Task Invoke(IServiceProvider serviceProvider)
{
using var scope = serviceProvider.CreateScope();
var db = scope.ServiceProvider.GetRequiredService<SettleAccountDbContext>();
db.Set<VmiMessage>().Where(o => o.isConsumed).BatchDelete();
var count = db.Set<VmiMessage>().Where(o => !o.isConsumed).Count();
scope.ServiceProvider.GetService<IHubContext<PageHub>>().Clients.All.ServerToClient("VmiBalance", count.ToString(), "");
return Task.CompletedTask;
}
/// <summary>
/// 未处理消息数量
/// </summary>
/// <returns></returns>
[HttpPost]
public int GetMessageCount()
{
using var scope = this._serviceProvider.CreateScope();
var db = scope.ServiceProvider.GetRequiredService<SettleAccountDbContext>();
var count = db.Set<VmiMessage>().Where(o => !o.isConsumed).Count();
return count;
}
}
Loading…
Cancel
Save