Browse Source

添加JobItem是否禁用字段

master
wanggang 1 year ago
parent
commit
110750d5a3
  1. 3
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/Startup.cs
  2. 1
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Vmi/JobItem.cs
  3. 4966
      code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/20230727005325_vmi5.Designer.cs
  4. 24
      code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/20230727005325_vmi5.cs
  5. 4
      code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/SettleAccountDbContextModelSnapshot.cs

3
code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/Startup.cs

@ -65,6 +65,8 @@ public class Startup
var jobItemRepository = db.Set<JobItem>();
var jobLogRepository = db.Set<JobLog>();
var jobItem = jobItemRepository.FirstOrDefault(o => o.Id == jobId);
if (!jobItem.IsDisabled)
{
jobItem.IsRunning = true;
db.SaveChanges();
var jobLog = new JobLog { JobId = jobId, Start = DateTime.Now };
@ -85,6 +87,7 @@ public class Startup
jobItem.IsRunning = false;
db.SaveChanges();
}
}
}).Cron(job.Cron);
}
}

1
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Vmi/JobItem.cs

@ -10,6 +10,7 @@ public class JobItem : Entity<Guid>, IHasConcurrencyStamp
this.Id = id;
}
public bool IsDisabled { get; set; }
public string Name { get; set; }
public string Cron { get; set; }
public string Service { get; set; }

4966
code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/20230727005325_vmi5.Designer.cs

File diff suppressed because it is too large

24
code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/20230727005325_vmi5.cs

@ -0,0 +1,24 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace Win.Sfs.SettleAccount.Migrations
{
public partial class vmi5 : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<bool>(
name: "IsDisabled",
table: "Set_JobItem",
type: "bit",
nullable: false,
defaultValue: false);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "IsDisabled",
table: "Set_JobItem");
}
}
}

4
code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/SettleAccountDbContextModelSnapshot.cs

@ -3748,6 +3748,9 @@ namespace Win.Sfs.SettleAccount.Migrations
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<bool>("IsDisabled")
.HasColumnType("bit");
b.Property<bool>("IsRunning")
.HasColumnType("bit");
@ -3773,6 +3776,7 @@ namespace Win.Sfs.SettleAccount.Migrations
{
Id = new Guid("ef3d8e8a-a88e-ca1f-e615-714c6bc48824"),
Cron = "0 0 8 26 *",
IsDisabled = false,
IsRunning = false,
Name = "库存快照",
Service = "Win.Sfs.SettleAccount.Entities.BQ.VmiService"

Loading…
Cancel
Save