From 3abda065f3fbd6142a6a009f8d181130165cfa3f Mon Sep 17 00:00:00 2001 From: wanggang <76527413@qq.com> Date: Tue, 29 Aug 2023 11:59:55 +0800 Subject: [PATCH] up --- .../wwwroot/router/base-data.js | 16 +++--- .../wwwroot/views/settle/_check.js | 13 +++++ .../Entities/BQ/JobHostdService.cs | 50 +++++++++++++------ 3 files changed, 56 insertions(+), 23 deletions(-) diff --git a/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/router/base-data.js b/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/router/base-data.js index 659cd3a5..634b4d0f 100644 --- a/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/router/base-data.js +++ b/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/router/base-data.js @@ -50,10 +50,10 @@ export default [ createButton("export", "title=导出&isTop=true&pattern=paged"), ], }, - { - ...createPage("bom", "title=BOM结构"), - children: [createButton("query", "title=查询&isTop=true"), createButton("export", "title=导出&isTop=true&pattern=paged")], - }, + // { + // ...createPage("bom", "title=BOM结构"), + // children: [createButton("query", "title=查询&isTop=true"), createButton("export", "title=导出&isTop=true&pattern=paged")], + // }, { ...createPage("bei-jian", "title=备件价格单"), children: [createButton("query", "title=查询&isTop=true"), createButton("import", "title=导入&isTop=true"), createButton("export", "title=导出&isTop=true&pattern=paged")], @@ -66,10 +66,10 @@ export default [ ...createPage("xiao-shou", "title=销售价格单"), children: [createButton("query", "title=查询&isTop=true"), createButton("import", "title=导入&isTop=true"), createButton("export", "title=导出&isTop=true&pattern=paged")], }, - { - ...createPage("ke-hu", "title=客户库位关系表"), - children: [createButton("query", "title=查询&isTop=true"), createButton("import", "title=导入&isTop=true"), createButton("export", "title=导出&isTop=true&pattern=paged")], - }, + // { + // ...createPage("ke-hu", "title=客户库位关系表"), + // children: [createButton("query", "title=查询&isTop=true"), createButton("import", "title=导入&isTop=true"), createButton("export", "title=导出&isTop=true&pattern=paged")], + // }, { ...createPage("job-item", "title=定时任务"), children: [ diff --git a/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/views/settle/_check.js b/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/views/settle/_check.js index 87d237fe..384544db 100644 --- a/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/views/settle/_check.js +++ b/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/views/settle/_check.js @@ -246,6 +246,15 @@ export default { type: "object", title: "结算分组零件", properties: { + realInvBillNum: { + type: "string", + title: "金税发票号", + }, + invDate: { + type: "string", + title: "发票日期", + input: "datetime", + }, invGroupNum: { type: "string", title: "发票分组号", @@ -262,6 +271,10 @@ export default { type: "string", title: "状态", }, + qty: { + type: "string", + title: "数量", + }, }, }; const columns4 = { diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/JobHostdService.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/JobHostdService.cs index 18114d42..e5ea8327 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/JobHostdService.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/JobHostdService.cs @@ -1,14 +1,18 @@ using System; using System.Collections.Concurrent; using System.Collections.Generic; +using System.Data.SqlClient; using System.Diagnostics; using System.IO; using System.Linq; +using System.Linq.Dynamic.Core; using System.Net; using System.Threading; using System.Threading.Tasks; using Cronos; using Microsoft.AspNetCore.SignalR; +using Microsoft.EntityFrameworkCore; +using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; using SettleAccount.Job.SignalR; @@ -163,7 +167,7 @@ public class JobHostdService : BackgroundService, IApplicationService } } } - catch(CronFormatException ex) + catch (CronFormatException ex) { Console.WriteLine($"{job.Name},Cron解析失败:{ex.Message},{ex.ToString()}"); } @@ -191,8 +195,10 @@ public class JobHostdService : BackgroundService, IApplicationService private void JobItemFaild(Guid id, Guid jobLogId, Exception ex) { - using var scope = this._serviceProvider.CreateScope(); - var db = scope.ServiceProvider.GetRequiredService(); + var connectionString = this._serviceProvider.GetRequiredService().GetConnectionString("SettleAccountService"); + using var connection = new SqlConnection(connectionString); + var options = new DbContextOptionsBuilder().UseSqlServer(connection).Options; + using var db = new SettleAccountDbContext(options); var entity = db.Set().FirstOrDefault(o => o.Id == id); if (entity != null) { @@ -207,8 +213,10 @@ public class JobHostdService : BackgroundService, IApplicationService private void JobItemSuccess(Guid id, Guid jobLogId) { - using var scope = this._serviceProvider.CreateScope(); - var db = scope.ServiceProvider.GetRequiredService(); + var connectionString = this._serviceProvider.GetRequiredService().GetConnectionString("SettleAccountService"); + using var connection = new SqlConnection(connectionString); + var options = new DbContextOptionsBuilder().UseSqlServer(connection).Options; + using var db = new SettleAccountDbContext(options); var entity = db.Set().FirstOrDefault(o => o.Id == id); if (entity != null) { @@ -225,8 +233,10 @@ public class JobHostdService : BackgroundService, IApplicationService private void JobItemStop(Guid id) { - using var scope = this._serviceProvider.CreateScope(); - var db = scope.ServiceProvider.GetRequiredService(); + var connectionString = this._serviceProvider.GetRequiredService().GetConnectionString("SettleAccountService"); + using var connection = new SqlConnection(connectionString); + var options = new DbContextOptionsBuilder().UseSqlServer(connection).Options; + using var db = new SettleAccountDbContext(options); var entity = db.Set().FirstOrDefault(o => o.Id == id); if (entity != null) { @@ -240,8 +250,10 @@ public class JobHostdService : BackgroundService, IApplicationService private Guid? JobItemStart(Guid id) { - using var scope = this._serviceProvider.CreateScope(); - var db = scope.ServiceProvider.GetRequiredService(); + var connectionString = this._serviceProvider.GetRequiredService().GetConnectionString("SettleAccountService"); + using var connection = new SqlConnection(connectionString); + var options = new DbContextOptionsBuilder().UseSqlServer(connection).Options; + using var db = new SettleAccountDbContext(options); var entity = db.Set().FirstOrDefault(o => o.Id == id); if (entity != null) { @@ -256,14 +268,20 @@ public class JobHostdService : BackgroundService, IApplicationService private JobItem GetJobItem(Guid id) { - using var scope = this._serviceProvider.CreateScope(); - return scope.ServiceProvider.GetRequiredService().Set().FirstOrDefault(o => o.Id == id); + var connectionString = this._serviceProvider.GetRequiredService().GetConnectionString("SettleAccountService"); + using var connection = new SqlConnection(connectionString); + var options = new DbContextOptionsBuilder().UseSqlServer(connection).Options; + using var db = new SettleAccountDbContext(options); + var repo = db.Set(); + return repo.FirstOrDefault(o => o.Id == id); } private void JobItemHeartBeat(Guid id) { - using var scope = this._serviceProvider.CreateScope(); - var db = scope.ServiceProvider.GetRequiredService(); + var connectionString = this._serviceProvider.GetRequiredService().GetConnectionString("SettleAccountService"); + using var connection = new SqlConnection(connectionString); + var options = new DbContextOptionsBuilder().UseSqlServer(connection).Options; + using var db = new SettleAccountDbContext(options); var entity = db.Set().FirstOrDefault(o => o.Id == id); if (entity != null) { @@ -299,8 +317,10 @@ public class JobHostdService : BackgroundService, IApplicationService protected override Task ExecuteAsync(CancellationToken stoppingToken) { this._stoppingToken = stoppingToken; - using var scope = this._serviceProvider.CreateScope(); - var db = scope.ServiceProvider.GetRequiredService(); + var connectionString = this._serviceProvider.GetRequiredService().GetConnectionString("SettleAccountService"); + using var connection = new SqlConnection(connectionString); + var options = new DbContextOptionsBuilder().UseSqlServer(connection).Options; + using var db = new SettleAccountDbContext(options); var jobs = db.Set().ToList(); jobs.ForEach(this.AddJob); return Task.CompletedTask;