Browse Source

改字段长度填表

master
赵新宇 4 weeks ago
parent
commit
db412fa30f
  1. 18
      API/TaskManager.Entity/Entity.cs
  2. 19
      API/TaskManager.EntityFramework/JobDbContext.cs
  3. 10332
      API/TaskManager.EntityFramework/Migrations/20250624060542_z202506240001.Designer.cs
  4. 101
      API/TaskManager.EntityFramework/Migrations/20250624060542_z202506240001.cs
  5. 75
      API/TaskManager.EntityFramework/Migrations/JobDbContextModelSnapshot.cs
  6. 2
      API/Wood.Service/Controllers/CherySupplierProMaterialStockService.cs
  7. 2
      API/Wood.Service/Controllers/TaskConifgureController.cs

18
API/TaskManager.Entity/Entity.cs

@ -4201,12 +4201,18 @@ namespace TaskManager.Entity
}
[Table("DynamicTables")]
public class DynamicTable:BaseEntity
{
public string TableName { get; set; }
public string SchemaJson { get; set; } // 存储表结构的JSON
}
[Table("DynamicTableRecords")]
public class DynamicTableRecord:BaseEntity
{
public long TableId { get; set; }
public string RecordJson { get; set; } // 存储记录的JSON
}
}

19
API/TaskManager.EntityFramework/JobDbContext.cs

@ -66,15 +66,15 @@ namespace TaskManager.EntityFramework
// // 配置SQL Server连接
// optionsBuilder.UseSqlServer("Server=192.168.1.228;Database=TaskManager;User ID=sa;Password=ChangkeTec@2021;TrustServerCertificate=True");
//}
//#if DEBUG
// optionsBuilder.UseSqlServer("Server = 192.168.1.228; Database = TaskManager2; User ID = sa; Password = ChangkeTec@2021; TrustServerCertificate = True");
//#else
// optionsBuilder.UseSqlServer(GlobalContext.SystemConfig.CustomerDb);
#if DEBUG
optionsBuilder.UseSqlServer("Server = 192.168.1.228; Database = TaskManager2; User ID = sa; Password = ChangkeTec@2021; TrustServerCertificate = True");
#else
optionsBuilder.UseSqlServer(GlobalContext.SystemConfig.CustomerDb);
//#endif
#endif
optionsBuilder.UseSqlServer(GlobalContext.SystemConfig.CustomerDb);
/// optionsBuilder.UseSqlServer(GlobalContext.SystemConfig.CustomerDb);
@ -429,6 +429,13 @@ namespace TaskManager.EntityFramework
public DbSet<SUPPLIER_PRO_PROCESS_EQUIPMENT_DT> SUPPLIER_PRO_PROCESS_EQUIPMENT_DT { get; set; }
#endregion
public DbSet<DynamicTable> DynamicTables { get; set; }
public DbSet<DynamicTableRecord> DynamicTableRecords { get; set; }
// 配置实体映射
protected override void OnModelCreating(ModelBuilder modelBuilder)
{

10332
API/TaskManager.EntityFramework/Migrations/20250624060542_z202506240001.Designer.cs

File diff suppressed because it is too large

101
API/TaskManager.EntityFramework/Migrations/20250624060542_z202506240001.cs

@ -0,0 +1,101 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace TaskManager.EntityFramework.Migrations
{
/// <inheritdoc />
public partial class z202506240001 : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<DateTime>(
name: "CreationTime",
table: "TaskLogs",
type: "datetime2",
nullable: false,
defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
oldClrType: typeof(DateTime),
oldType: "datetime2",
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "DeadLine",
table: "SUPPLIER_PRO_MATERIAL_STOCK",
type: "VARCHAR(30)",
maxLength: 30,
nullable: false,
oldClrType: typeof(string),
oldType: "VARCHAR(10)",
oldMaxLength: 10);
migrationBuilder.CreateTable(
name: "DynamicTableRecords",
columns: table => new
{
UId = table.Column<long>(type: "bigint", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
TableId = table.Column<long>(type: "bigint", nullable: false),
RecordJson = table.Column<string>(type: "nvarchar(max)", nullable: false),
WriteState = table.Column<bool>(type: "bit", nullable: false),
ReadState = table.Column<bool>(type: "bit", nullable: false),
CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
Remark = table.Column<string>(type: "nvarchar(max)", nullable: true),
TaskId = table.Column<Guid>(type: "uniqueidentifier", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_DynamicTableRecords", x => x.UId);
});
migrationBuilder.CreateTable(
name: "DynamicTables",
columns: table => new
{
UId = table.Column<long>(type: "bigint", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
TableName = table.Column<string>(type: "nvarchar(max)", nullable: false),
SchemaJson = table.Column<string>(type: "nvarchar(max)", nullable: false),
WriteState = table.Column<bool>(type: "bit", nullable: false),
ReadState = table.Column<bool>(type: "bit", nullable: false),
CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
Remark = table.Column<string>(type: "nvarchar(max)", nullable: true),
TaskId = table.Column<Guid>(type: "uniqueidentifier", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_DynamicTables", x => x.UId);
});
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "DynamicTableRecords");
migrationBuilder.DropTable(
name: "DynamicTables");
migrationBuilder.AlterColumn<DateTime>(
name: "CreationTime",
table: "TaskLogs",
type: "datetime2",
nullable: true,
oldClrType: typeof(DateTime),
oldType: "datetime2");
migrationBuilder.AlterColumn<string>(
name: "DeadLine",
table: "SUPPLIER_PRO_MATERIAL_STOCK",
type: "VARCHAR(10)",
maxLength: 10,
nullable: false,
oldClrType: typeof(string),
oldType: "VARCHAR(30)",
oldMaxLength: 30);
}
}
}

75
API/TaskManager.EntityFramework/Migrations/JobDbContextModelSnapshot.cs

@ -22,6 +22,77 @@ namespace TaskManager.EntityFramework.Migrations
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
modelBuilder.Entity("TaskManager.Entity.DynamicTable", b =>
{
b.Property<long>("UId")
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<long>("UId"));
b.Property<DateTime>("CreationTime")
.HasColumnType("datetime2");
b.Property<bool>("ReadState")
.HasColumnType("bit");
b.Property<string>("Remark")
.HasColumnType("nvarchar(max)");
b.Property<string>("SchemaJson")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("TableName")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<Guid>("TaskId")
.HasColumnType("uniqueidentifier");
b.Property<bool>("WriteState")
.HasColumnType("bit");
b.HasKey("UId");
b.ToTable("DynamicTables");
});
modelBuilder.Entity("TaskManager.Entity.DynamicTableRecord", b =>
{
b.Property<long>("UId")
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<long>("UId"));
b.Property<DateTime>("CreationTime")
.HasColumnType("datetime2");
b.Property<bool>("ReadState")
.HasColumnType("bit");
b.Property<string>("RecordJson")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("Remark")
.HasColumnType("nvarchar(max)");
b.Property<long>("TableId")
.HasColumnType("bigint");
b.Property<Guid>("TaskId")
.HasColumnType("uniqueidentifier");
b.Property<bool>("WriteState")
.HasColumnType("bit");
b.HasKey("UId");
b.ToTable("DynamicTableRecords");
});
modelBuilder.Entity("TaskManager.Entity.Entitys.SUPPLIER_CON_DATE", b =>
{
b.Property<long>("UId")
@ -7975,7 +8046,7 @@ namespace TaskManager.EntityFramework.Migrations
b.Property<string>("DeadLine")
.IsRequired()
.HasMaxLength(10)
.HasMaxLength(30)
.HasColumnType("VARCHAR");
b.Property<string>("DeviceCode")
@ -10133,7 +10204,7 @@ namespace TaskManager.EntityFramework.Migrations
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<long>("UId"));
b.Property<DateTime?>("CreationTime")
b.Property<DateTime>("CreationTime")
.HasColumnType("datetime2");
b.Property<string>("Info")

2
API/Wood.Service/Controllers/CherySupplierProMaterialStockService.cs

@ -7,7 +7,7 @@ namespace TaskManager.Controllers
/// <summary>
/// 来料检验数据
/// </summary>
public class SupplierProMaterialStockService : CheryRecurringJobInputPageExtendController<SUPPLIER_PRO_MATERIAL_STOCK, SUPPLIER_PRO_MATERIAL_STOCK_DTO, SUPPLIER_PRO_MATERIAL_STOCK_LOGS>
public class SupplierProMaterialStockService : CheryRecurringJobInputPageController<SUPPLIER_PRO_MATERIAL_STOCK, SUPPLIER_PRO_MATERIAL_STOCK_DTO, SUPPLIER_PRO_MATERIAL_STOCK_LOGS>
{
public SupplierProMaterialStockService(HttpClient httpClient, JobDbContext jobDbContext, LogController log, IRepository<SUPPLIER_PRO_MATERIAL_STOCK> repository) : base(httpClient, jobDbContext, log, repository)
{

2
API/Wood.Service/Controllers/TaskConifgureController.cs

@ -126,7 +126,7 @@ namespace TaskManager.Controllers
case "来料检验数据":
BackgroundJob.Schedule<SupplierProMaterialStockService>(
//"materialstock",
x => x.CustomInvokeAsync(taskName, client, taskId),
x => x.CustomInvokeAsync(taskName, client ),
TimeSpan.FromSeconds(10)
);
break;

Loading…
Cancel
Save