wanggang 1 year ago
parent
commit
3abda065f3
  1. 16
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/router/base-data.js
  2. 13
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/views/settle/_check.js
  3. 50
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/JobHostdService.cs

16
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: [

13
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 = {

50
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<SettleAccountDbContext>();
var connectionString = this._serviceProvider.GetRequiredService<IConfiguration>().GetConnectionString("SettleAccountService");
using var connection = new SqlConnection(connectionString);
var options = new DbContextOptionsBuilder<SettleAccountDbContext>().UseSqlServer(connection).Options;
using var db = new SettleAccountDbContext(options);
var entity = db.Set<JobItem>().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<SettleAccountDbContext>();
var connectionString = this._serviceProvider.GetRequiredService<IConfiguration>().GetConnectionString("SettleAccountService");
using var connection = new SqlConnection(connectionString);
var options = new DbContextOptionsBuilder<SettleAccountDbContext>().UseSqlServer(connection).Options;
using var db = new SettleAccountDbContext(options);
var entity = db.Set<JobItem>().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<SettleAccountDbContext>();
var connectionString = this._serviceProvider.GetRequiredService<IConfiguration>().GetConnectionString("SettleAccountService");
using var connection = new SqlConnection(connectionString);
var options = new DbContextOptionsBuilder<SettleAccountDbContext>().UseSqlServer(connection).Options;
using var db = new SettleAccountDbContext(options);
var entity = db.Set<JobItem>().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<SettleAccountDbContext>();
var connectionString = this._serviceProvider.GetRequiredService<IConfiguration>().GetConnectionString("SettleAccountService");
using var connection = new SqlConnection(connectionString);
var options = new DbContextOptionsBuilder<SettleAccountDbContext>().UseSqlServer(connection).Options;
using var db = new SettleAccountDbContext(options);
var entity = db.Set<JobItem>().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<SettleAccountDbContext>().Set<JobItem>().FirstOrDefault(o => o.Id == id);
var connectionString = this._serviceProvider.GetRequiredService<IConfiguration>().GetConnectionString("SettleAccountService");
using var connection = new SqlConnection(connectionString);
var options = new DbContextOptionsBuilder<SettleAccountDbContext>().UseSqlServer(connection).Options;
using var db = new SettleAccountDbContext(options);
var repo = db.Set<JobItem>();
return repo.FirstOrDefault(o => o.Id == id);
}
private void JobItemHeartBeat(Guid id)
{
using var scope = this._serviceProvider.CreateScope();
var db = scope.ServiceProvider.GetRequiredService<SettleAccountDbContext>();
var connectionString = this._serviceProvider.GetRequiredService<IConfiguration>().GetConnectionString("SettleAccountService");
using var connection = new SqlConnection(connectionString);
var options = new DbContextOptionsBuilder<SettleAccountDbContext>().UseSqlServer(connection).Options;
using var db = new SettleAccountDbContext(options);
var entity = db.Set<JobItem>().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<SettleAccountDbContext>();
var connectionString = this._serviceProvider.GetRequiredService<IConfiguration>().GetConnectionString("SettleAccountService");
using var connection = new SqlConnection(connectionString);
var options = new DbContextOptionsBuilder<SettleAccountDbContext>().UseSqlServer(connection).Options;
using var db = new SettleAccountDbContext(options);
var jobs = db.Set<JobItem>().ToList();
jobs.ForEach(this.AddJob);
return Task.CompletedTask;

Loading…
Cancel
Save