Add MQTT runtime control and device data pipeline

This commit is contained in:
zhougf committed 2026-05-31 10:55:22 +08:00
1 parent 96d8309793
commit 8a0aa8f7cb
31 files changed
+30842 -20

No files matched your search

File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,204 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace HHWMS.Web.Migrations
{
public partial class updatetaskmodel : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_ReceiptDetail_ReceiptHeader_HeaderId",
table: "ReceiptDetail");
migrationBuilder.DropForeignKey(
name: "FK_ShipmentDetail_ShipmentHeader_HeaderId",
table: "ShipmentDetail");
migrationBuilder.DropForeignKey(
name: "FK_TaskDetail_TaskHeader_HeaderId",
table: "TaskDetail");
migrationBuilder.DropIndex(
name: "IX_TaskDetail_HeaderId",
table: "TaskDetail");
migrationBuilder.DropIndex(
name: "IX_ShipmentDetail_HeaderId",
table: "ShipmentDetail");
migrationBuilder.DropIndex(
name: "IX_ReceiptDetail_HeaderId",
table: "ReceiptDetail");
migrationBuilder.AlterColumn<string>(
name: "MaterialSpec",
table: "TaskDetailHistory",
type: "varchar(50)",
maxLength: 50,
nullable: true,
comment: "物料规格",
oldClrType: typeof(string),
oldType: "longtext",
oldNullable: true,
oldComment: "物料规格")
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AlterColumn<string>(
name: "MaterialSpec",
table: "TaskDetail",
type: "varchar(50)",
maxLength: 50,
nullable: true,
comment: "物料规格",
oldClrType: typeof(string),
oldType: "longtext",
oldNullable: true,
oldComment: "物料规格")
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<int>(
name: "ShipmentHeaderID",
table: "ShipmentDetail",
type: "int",
nullable: true);
migrationBuilder.AddColumn<int>(
name: "ReceiptHeaderID",
table: "ReceiptDetail",
type: "int",
nullable: true);
migrationBuilder.CreateIndex(
name: "IX_TaskHeaderHistory_TaskNo",
table: "TaskHeaderHistory",
column: "TaskNo",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_ShipmentDetail_ShipmentHeaderID",
table: "ShipmentDetail",
column: "ShipmentHeaderID");
migrationBuilder.CreateIndex(
name: "IX_ReceiptDetail_ReceiptHeaderID",
table: "ReceiptDetail",
column: "ReceiptHeaderID");
migrationBuilder.AddForeignKey(
name: "FK_ReceiptDetail_ReceiptHeader_ReceiptHeaderID",
table: "ReceiptDetail",
column: "ReceiptHeaderID",
principalTable: "ReceiptHeader",
principalColumn: "ID");
migrationBuilder.AddForeignKey(
name: "FK_ShipmentDetail_ShipmentHeader_ShipmentHeaderID",
table: "ShipmentDetail",
column: "ShipmentHeaderID",
principalTable: "ShipmentHeader",
principalColumn: "ID");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_ReceiptDetail_ReceiptHeader_ReceiptHeaderID",
table: "ReceiptDetail");
migrationBuilder.DropForeignKey(
name: "FK_ShipmentDetail_ShipmentHeader_ShipmentHeaderID",
table: "ShipmentDetail");
migrationBuilder.DropIndex(
name: "IX_TaskHeaderHistory_TaskNo",
table: "TaskHeaderHistory");
migrationBuilder.DropIndex(
name: "IX_ShipmentDetail_ShipmentHeaderID",
table: "ShipmentDetail");
migrationBuilder.DropIndex(
name: "IX_ReceiptDetail_ReceiptHeaderID",
table: "ReceiptDetail");
migrationBuilder.DropColumn(
name: "ShipmentHeaderID",
table: "ShipmentDetail");
migrationBuilder.DropColumn(
name: "ReceiptHeaderID",
table: "ReceiptDetail");
migrationBuilder.AlterColumn<string>(
name: "MaterialSpec",
table: "TaskDetailHistory",
type: "longtext",
nullable: true,
comment: "物料规格",
oldClrType: typeof(string),
oldType: "varchar(50)",
oldMaxLength: 50,
oldNullable: true,
oldComment: "物料规格")
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AlterColumn<string>(
name: "MaterialSpec",
table: "TaskDetail",
type: "longtext",
nullable: true,
comment: "物料规格",
oldClrType: typeof(string),
oldType: "varchar(50)",
oldMaxLength: 50,
oldNullable: true,
oldComment: "物料规格")
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateIndex(
name: "IX_TaskDetail_HeaderId",
table: "TaskDetail",
column: "HeaderId");
migrationBuilder.CreateIndex(
name: "IX_ShipmentDetail_HeaderId",
table: "ShipmentDetail",
column: "HeaderId");
migrationBuilder.CreateIndex(
name: "IX_ReceiptDetail_HeaderId",
table: "ReceiptDetail",
column: "HeaderId");
migrationBuilder.AddForeignKey(
name: "FK_ReceiptDetail_ReceiptHeader_HeaderId",
table: "ReceiptDetail",
column: "HeaderId",
principalTable: "ReceiptHeader",
principalColumn: "ID",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_ShipmentDetail_ShipmentHeader_HeaderId",
table: "ShipmentDetail",
column: "HeaderId",
principalTable: "ShipmentHeader",
principalColumn: "ID",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_TaskDetail_TaskHeader_HeaderId",
table: "TaskDetail",
column: "HeaderId",
principalTable: "TaskHeader",
principalColumn: "ID",
onDelete: ReferentialAction.Cascade);
}
}
}
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,75 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace HHWMS.Web.Migrations
{
public partial class updatebillmodel : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_ReceiptDetail_ReceiptHeader_ReceiptHeaderID",
table: "ReceiptDetail");
migrationBuilder.DropForeignKey(
name: "FK_ShipmentDetail_ShipmentHeader_ShipmentHeaderID",
table: "ShipmentDetail");
migrationBuilder.DropIndex(
name: "IX_ShipmentDetail_ShipmentHeaderID",
table: "ShipmentDetail");
migrationBuilder.DropIndex(
name: "IX_ReceiptDetail_ReceiptHeaderID",
table: "ReceiptDetail");
migrationBuilder.DropColumn(
name: "ShipmentHeaderID",
table: "ShipmentDetail");
migrationBuilder.DropColumn(
name: "ReceiptHeaderID",
table: "ReceiptDetail");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<int>(
name: "ShipmentHeaderID",
table: "ShipmentDetail",
type: "int",
nullable: true);
migrationBuilder.AddColumn<int>(
name: "ReceiptHeaderID",
table: "ReceiptDetail",
type: "int",
nullable: true);
migrationBuilder.CreateIndex(
name: "IX_ShipmentDetail_ShipmentHeaderID",
table: "ShipmentDetail",
column: "ShipmentHeaderID");
migrationBuilder.CreateIndex(
name: "IX_ReceiptDetail_ReceiptHeaderID",
table: "ReceiptDetail",
column: "ReceiptHeaderID");
migrationBuilder.AddForeignKey(
name: "FK_ReceiptDetail_ReceiptHeader_ReceiptHeaderID",
table: "ReceiptDetail",
column: "ReceiptHeaderID",
principalTable: "ReceiptHeader",
principalColumn: "ID");
migrationBuilder.AddForeignKey(
name: "FK_ShipmentDetail_ShipmentHeader_ShipmentHeaderID",
table: "ShipmentDetail",
column: "ShipmentHeaderID",
principalTable: "ShipmentHeader",
principalColumn: "ID");
}
}
}
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,70 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace HHWMS.Web.Migrations
{
public partial class addupdateversion : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<int>(
name: "UpdateVersion",
table: "ShipmentHeader",
type: "int",
nullable: false,
defaultValue: 0);
migrationBuilder.AddColumn<int>(
name: "UpdateVersion",
table: "ShipmentDetail",
type: "int",
nullable: false,
defaultValue: 0);
migrationBuilder.AddColumn<int>(
name: "UpdateVersion",
table: "ReceiptHeader",
type: "int",
nullable: false,
defaultValue: 0);
migrationBuilder.AddColumn<int>(
name: "UpdateVersion",
table: "ReceiptDetail",
type: "int",
nullable: false,
defaultValue: 0);
migrationBuilder.AddColumn<int>(
name: "UpdateVersion",
table: "Inventory",
type: "int",
nullable: false,
defaultValue: 0);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "UpdateVersion",
table: "ShipmentHeader");
migrationBuilder.DropColumn(
name: "UpdateVersion",
table: "ShipmentDetail");
migrationBuilder.DropColumn(
name: "UpdateVersion",
table: "ReceiptHeader");
migrationBuilder.DropColumn(
name: "UpdateVersion",
table: "ReceiptDetail");
migrationBuilder.DropColumn(
name: "UpdateVersion",
table: "Inventory");
}
}
}
File diff suppressed because it is too large. Load diff
+691
View File
@@ -0,0 +1,691 @@
using System;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace HHWMS.Web.Migrations
{
public partial class wms3 : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "ZoneCode",
table: "TaskHeaderHistory");
migrationBuilder.DropColumn(
name: "ZoneCode",
table: "TaskHeader");
migrationBuilder.DropColumn(
name: "QRCode",
table: "Material");
migrationBuilder.DropColumn(
name: "SourceCode",
table: "Material");
migrationBuilder.DropColumn(
name: "UniqueCode",
table: "Material");
migrationBuilder.DropColumn(
name: "ZoneCode",
table: "Location");
migrationBuilder.DropColumn(
name: "ZoneCode",
table: "Inventory");
migrationBuilder.AddColumn<int>(
name: "ZoneId",
table: "TaskHeaderHistory",
type: "int",
nullable: false,
defaultValue: 0,
comment: "库区");
migrationBuilder.AddColumn<int>(
name: "ZoneId",
table: "TaskHeader",
type: "int",
nullable: false,
defaultValue: 0,
comment: "库区");
migrationBuilder.AlterColumn<string>(
name: "SupplierCode",
table: "Material",
type: "varchar(100)",
maxLength: 100,
nullable: true,
comment: "供应商",
oldClrType: typeof(string),
oldType: "varchar(50)",
oldMaxLength: 50,
oldNullable: true,
oldComment: "供应商")
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AlterColumn<decimal>(
name: "Qty",
table: "Material",
type: "decimal(12,4)",
nullable: false,
defaultValue: 0m,
comment: "数量",
oldClrType: typeof(decimal),
oldType: "decimal(12,4)",
oldNullable: true,
oldComment: "数量");
migrationBuilder.UpdateData(
table: "Material",
keyColumn: "MaterialType",
keyValue: null,
column: "MaterialType",
value: "");
migrationBuilder.AlterColumn<string>(
name: "MaterialType",
table: "Material",
type: "varchar(50)",
maxLength: 50,
nullable: false,
comment: "物料类型",
oldClrType: typeof(string),
oldType: "varchar(50)",
oldMaxLength: 50,
oldNullable: true,
oldComment: "物料类型")
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.UpdateData(
table: "Material",
keyColumn: "MaterialCode",
keyValue: null,
column: "MaterialCode",
value: "");
migrationBuilder.AlterColumn<string>(
name: "MaterialCode",
table: "Material",
type: "varchar(50)",
maxLength: 50,
nullable: false,
comment: "物料编码",
oldClrType: typeof(string),
oldType: "varchar(50)",
oldMaxLength: 50,
oldNullable: true,
oldComment: "物料编码")
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AlterColumn<short>(
name: "Type",
table: "Location",
type: "smallint",
nullable: false,
comment: "库位类型",
oldClrType: typeof(string),
oldType: "varchar(50)",
oldMaxLength: 50,
oldComment: "库位类型")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AlterColumn<short>(
name: "Status",
table: "Location",
type: "smallint",
nullable: false,
defaultValue: (short)0,
comment: "是否锁定",
oldClrType: typeof(string),
oldType: "varchar(50)",
oldMaxLength: 50,
oldNullable: true,
oldComment: "库位状态")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AlterColumn<short>(
name: "RowFlag",
table: "Location",
type: "smallint",
nullable: false,
defaultValue: (short)0,
comment: "内外标识,0:外仓位,1:里仓位",
oldClrType: typeof(short),
oldType: "smallint",
oldNullable: true,
oldComment: "内外标识,0:外仓位,1:里仓位");
migrationBuilder.AddColumn<string>(
name: "ContainerStatus",
table: "Location",
type: "varchar(50)",
maxLength: 50,
nullable: true,
comment: "库位状态")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<int>(
name: "ZoneId",
table: "Location",
type: "int",
nullable: false,
defaultValue: 0,
comment: "库位编码");
migrationBuilder.AlterColumn<string>(
name: "SupplierCode",
table: "InventoryTransaction",
type: "varchar(100)",
maxLength: 100,
nullable: true,
comment: "供应商",
oldClrType: typeof(string),
oldType: "varchar(50)",
oldMaxLength: 50,
oldNullable: true,
oldComment: "供应商")
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AlterColumn<short>(
name: "TaskStatus",
table: "Inventory",
type: "smallint",
nullable: false,
defaultValue: (short)0,
comment: "任务状态",
oldClrType: typeof(string),
oldType: "varchar(50)",
oldMaxLength: 50,
oldNullable: true,
oldComment: "任务状态")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AlterColumn<string>(
name: "SupplierCode",
table: "Inventory",
type: "varchar(100)",
maxLength: 100,
nullable: true,
comment: "供应商",
oldClrType: typeof(string),
oldType: "varchar(50)",
oldMaxLength: 50,
oldNullable: true,
oldComment: "供应商")
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<int>(
name: "ZoneId",
table: "Inventory",
type: "int",
nullable: false,
defaultValue: 0,
comment: "库区");
migrationBuilder.AddColumn<int>(
name: "ZoneId",
table: "Container",
type: "int",
nullable: false,
defaultValue: 0,
comment: "库区");
migrationBuilder.CreateTable(
name: "Customer",
columns: table => new
{
ID = table.Column<int>(type: "int", nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
Code = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: false, comment: "编码")
.Annotation("MySql:CharSet", "utf8mb4"),
Type = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: true, comment: "类型")
.Annotation("MySql:CharSet", "utf8mb4"),
Name = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: false, comment: "名称")
.Annotation("MySql:CharSet", "utf8mb4"),
CreateTime = table.Column<DateTime>(type: "datetime(6)", nullable: true, comment: ""),
CreateBy = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: true, comment: "")
.Annotation("MySql:CharSet", "utf8mb4"),
UpdateTime = table.Column<DateTime>(type: "datetime(6)", nullable: true, comment: ""),
UpdateBy = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: true, comment: "")
.Annotation("MySql:CharSet", "utf8mb4")
},
constraints: table =>
{
table.PrimaryKey("PK_Customer", x => x.ID);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "LocationZone",
columns: table => new
{
ID = table.Column<int>(type: "int", nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
ZoneCode = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: true, comment: "库区")
.Annotation("MySql:CharSet", "utf8mb4"),
Name = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: true, comment: "名称")
.Annotation("MySql:CharSet", "utf8mb4"),
CreateTime = table.Column<DateTime>(type: "datetime(6)", nullable: true, comment: ""),
CreateBy = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: true, comment: "")
.Annotation("MySql:CharSet", "utf8mb4"),
UpdateTime = table.Column<DateTime>(type: "datetime(6)", nullable: true, comment: ""),
UpdateBy = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: true, comment: "")
.Annotation("MySql:CharSet", "utf8mb4")
},
constraints: table =>
{
table.PrimaryKey("PK_LocationZone", x => x.ID);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "MaterialProcess",
columns: table => new
{
ID = table.Column<int>(type: "int", nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
MaterialCode = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: false, comment: "物料编码")
.Annotation("MySql:CharSet", "utf8mb4"),
ProcessCode = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: false, comment: "工序编码")
.Annotation("MySql:CharSet", "utf8mb4"),
ProcessName = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: false, comment: "工序名称")
.Annotation("MySql:CharSet", "utf8mb4"),
ProcessOrder = table.Column<int>(type: "int", nullable: false, comment: "工序顺序"),
Weight = table.Column<int>(type: "int", nullable: false, comment: "毛重"),
Description = table.Column<string>(type: "varchar(500)", maxLength: 500, nullable: true, comment: "工序描述")
.Annotation("MySql:CharSet", "utf8mb4"),
IsActive = table.Column<bool>(type: "tinyint(1)", nullable: false, comment: "是否启用"),
CreateTime = table.Column<DateTime>(type: "datetime(6)", nullable: true, comment: ""),
CreateBy = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: true, comment: "")
.Annotation("MySql:CharSet", "utf8mb4"),
UpdateTime = table.Column<DateTime>(type: "datetime(6)", nullable: true, comment: ""),
UpdateBy = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: true, comment: "")
.Annotation("MySql:CharSet", "utf8mb4")
},
constraints: table =>
{
table.PrimaryKey("PK_MaterialProcess", x => x.ID);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "ProcessConfig",
columns: table => new
{
ID = table.Column<int>(type: "int", nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
Code = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: false, comment: "工序编码")
.Annotation("MySql:CharSet", "utf8mb4"),
Name = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: false, comment: "工序名称")
.Annotation("MySql:CharSet", "utf8mb4"),
Zone = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: false, comment: "存放区域")
.Annotation("MySql:CharSet", "utf8mb4"),
Port = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: false, comment: "出口")
.Annotation("MySql:CharSet", "utf8mb4"),
Spare1 = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: true, comment: "备用1")
.Annotation("MySql:CharSet", "utf8mb4"),
Spare2 = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: true, comment: "备用2")
.Annotation("MySql:CharSet", "utf8mb4"),
Spare3 = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: true, comment: "备用3")
.Annotation("MySql:CharSet", "utf8mb4"),
CreateTime = table.Column<DateTime>(type: "datetime(6)", nullable: true, comment: ""),
CreateBy = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: true, comment: "")
.Annotation("MySql:CharSet", "utf8mb4"),
UpdateTime = table.Column<DateTime>(type: "datetime(6)", nullable: true, comment: ""),
UpdateBy = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: true, comment: "")
.Annotation("MySql:CharSet", "utf8mb4")
},
constraints: table =>
{
table.PrimaryKey("PK_ProcessConfig", x => x.ID);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateIndex(
name: "IX_TaskHeaderHistory_ZoneId",
table: "TaskHeaderHistory",
column: "ZoneId");
migrationBuilder.CreateIndex(
name: "IX_TaskHeader_ZoneId",
table: "TaskHeader",
column: "ZoneId");
migrationBuilder.CreateIndex(
name: "IX_Location_ZoneId",
table: "Location",
column: "ZoneId");
migrationBuilder.CreateIndex(
name: "IX_Inventory_ZoneId",
table: "Inventory",
column: "ZoneId");
migrationBuilder.CreateIndex(
name: "IX_Container_ZoneId",
table: "Container",
column: "ZoneId");
migrationBuilder.AddForeignKey(
name: "FK_Container_LocationZone_ZoneId",
table: "Container",
column: "ZoneId",
principalTable: "LocationZone",
principalColumn: "ID",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_Inventory_LocationZone_ZoneId",
table: "Inventory",
column: "ZoneId",
principalTable: "LocationZone",
principalColumn: "ID",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_Location_LocationZone_ZoneId",
table: "Location",
column: "ZoneId",
principalTable: "LocationZone",
principalColumn: "ID",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_TaskHeader_LocationZone_ZoneId",
table: "TaskHeader",
column: "ZoneId",
principalTable: "LocationZone",
principalColumn: "ID",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_TaskHeaderHistory_LocationZone_ZoneId",
table: "TaskHeaderHistory",
column: "ZoneId",
principalTable: "LocationZone",
principalColumn: "ID",
onDelete: ReferentialAction.Cascade);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_Container_LocationZone_ZoneId",
table: "Container");
migrationBuilder.DropForeignKey(
name: "FK_Inventory_LocationZone_ZoneId",
table: "Inventory");
migrationBuilder.DropForeignKey(
name: "FK_Location_LocationZone_ZoneId",
table: "Location");
migrationBuilder.DropForeignKey(
name: "FK_TaskHeader_LocationZone_ZoneId",
table: "TaskHeader");
migrationBuilder.DropForeignKey(
name: "FK_TaskHeaderHistory_LocationZone_ZoneId",
table: "TaskHeaderHistory");
migrationBuilder.DropTable(
name: "Customer");
migrationBuilder.DropTable(
name: "LocationZone");
migrationBuilder.DropTable(
name: "MaterialProcess");
migrationBuilder.DropTable(
name: "ProcessConfig");
migrationBuilder.DropIndex(
name: "IX_TaskHeaderHistory_ZoneId",
table: "TaskHeaderHistory");
migrationBuilder.DropIndex(
name: "IX_TaskHeader_ZoneId",
table: "TaskHeader");
migrationBuilder.DropIndex(
name: "IX_Location_ZoneId",
table: "Location");
migrationBuilder.DropIndex(
name: "IX_Inventory_ZoneId",
table: "Inventory");
migrationBuilder.DropIndex(
name: "IX_Container_ZoneId",
table: "Container");
migrationBuilder.DropColumn(
name: "ZoneId",
table: "TaskHeaderHistory");
migrationBuilder.DropColumn(
name: "ZoneId",
table: "TaskHeader");
migrationBuilder.DropColumn(
name: "ContainerStatus",
table: "Location");
migrationBuilder.DropColumn(
name: "ZoneId",
table: "Location");
migrationBuilder.DropColumn(
name: "ZoneId",
table: "Inventory");
migrationBuilder.DropColumn(
name: "ZoneId",
table: "Container");
migrationBuilder.AddColumn<string>(
name: "ZoneCode",
table: "TaskHeaderHistory",
type: "varchar(50)",
maxLength: 50,
nullable: true,
comment: "库区")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<string>(
name: "ZoneCode",
table: "TaskHeader",
type: "varchar(50)",
maxLength: 50,
nullable: true,
comment: "库区")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AlterColumn<string>(
name: "SupplierCode",
table: "Material",
type: "varchar(50)",
maxLength: 50,
nullable: true,
comment: "供应商",
oldClrType: typeof(string),
oldType: "varchar(100)",
oldMaxLength: 100,
oldNullable: true,
oldComment: "供应商")
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AlterColumn<decimal>(
name: "Qty",
table: "Material",
type: "decimal(12,4)",
nullable: true,
comment: "数量",
oldClrType: typeof(decimal),
oldType: "decimal(12,4)",
oldComment: "数量");
migrationBuilder.AlterColumn<string>(
name: "MaterialType",
table: "Material",
type: "varchar(50)",
maxLength: 50,
nullable: true,
comment: "物料类型",
oldClrType: typeof(string),
oldType: "varchar(50)",
oldMaxLength: 50,
oldComment: "物料类型")
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AlterColumn<string>(
name: "MaterialCode",
table: "Material",
type: "varchar(50)",
maxLength: 50,
nullable: true,
comment: "物料编码",
oldClrType: typeof(string),
oldType: "varchar(50)",
oldMaxLength: 50,
oldComment: "物料编码")
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<string>(
name: "QRCode",
table: "Material",
type: "varchar(50)",
maxLength: 50,
nullable: true,
comment: "二维码")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<string>(
name: "SourceCode",
table: "Material",
type: "varchar(50)",
maxLength: 50,
nullable: true,
comment: "上游单号")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<string>(
name: "UniqueCode",
table: "Material",
type: "varchar(50)",
maxLength: 50,
nullable: true,
comment: "唯一码")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AlterColumn<string>(
name: "Type",
table: "Location",
type: "varchar(50)",
maxLength: 50,
nullable: false,
comment: "库位类型",
oldClrType: typeof(short),
oldType: "smallint",
oldComment: "库位类型")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AlterColumn<string>(
name: "Status",
table: "Location",
type: "varchar(50)",
maxLength: 50,
nullable: true,
comment: "库位状态",
oldClrType: typeof(short),
oldType: "smallint",
oldComment: "是否锁定")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AlterColumn<short>(
name: "RowFlag",
table: "Location",
type: "smallint",
nullable: true,
comment: "内外标识,0:外仓位,1:里仓位",
oldClrType: typeof(short),
oldType: "smallint",
oldComment: "内外标识,0:外仓位,1:里仓位");
migrationBuilder.AddColumn<string>(
name: "ZoneCode",
table: "Location",
type: "varchar(50)",
maxLength: 50,
nullable: true,
comment: "库区")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AlterColumn<string>(
name: "SupplierCode",
table: "InventoryTransaction",
type: "varchar(50)",
maxLength: 50,
nullable: true,
comment: "供应商",
oldClrType: typeof(string),
oldType: "varchar(100)",
oldMaxLength: 100,
oldNullable: true,
oldComment: "供应商")
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AlterColumn<string>(
name: "TaskStatus",
table: "Inventory",
type: "varchar(50)",
maxLength: 50,
nullable: true,
comment: "任务状态",
oldClrType: typeof(short),
oldType: "smallint",
oldComment: "任务状态")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AlterColumn<string>(
name: "SupplierCode",
table: "Inventory",
type: "varchar(50)",
maxLength: 50,
nullable: true,
comment: "供应商",
oldClrType: typeof(string),
oldType: "varchar(100)",
oldMaxLength: 100,
oldNullable: true,
oldComment: "供应商")
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<string>(
name: "ZoneCode",
table: "Inventory",
type: "varchar(50)",
maxLength: 50,
nullable: true,
comment: "库区")
.Annotation("MySql:CharSet", "utf8mb4");
}
}
}
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,27 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace HHWMS.Web.Migrations
{
public partial class mqtt4 : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "ParsedData",
table: "MqttMessageRecord",
type: "longtext",
nullable: true,
comment: "解析后数据")
.Annotation("MySql:CharSet", "utf8mb4");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "ParsedData",
table: "MqttMessageRecord");
}
}
}
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,153 @@
using System;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace HHWMS.Web.Migrations
{
public partial class device_data_tables : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "DeviceAlarmRecord",
columns: table => new
{
ID = table.Column<int>(type: "int", nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
DeviceId = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: false, comment: "设备唯一标识")
.Annotation("MySql:CharSet", "utf8mb4"),
AlarmCode = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true, comment: "告警代码")
.Annotation("MySql:CharSet", "utf8mb4"),
AlarmMessage = table.Column<string>(type: "varchar(500)", maxLength: 500, nullable: true, comment: "告警内容")
.Annotation("MySql:CharSet", "utf8mb4"),
StartTime = table.Column<DateTime>(type: "datetime(6)", nullable: false, comment: "告警开始时间"),
EndTime = table.Column<DateTime>(type: "datetime(6)", nullable: true, comment: "告警恢复时间"),
IsActive = table.Column<bool>(type: "tinyint(1)", nullable: false, comment: "是否仍在告警"),
LastSeenTime = table.Column<DateTime>(type: "datetime(6)", nullable: true, comment: "最后出现时间"),
RepeatCount = table.Column<int>(type: "int", nullable: false, comment: "重复出现次数"),
CreateTime = table.Column<DateTime>(type: "datetime(6)", nullable: true, comment: ""),
CreateBy = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: true, comment: "")
.Annotation("MySql:CharSet", "utf8mb4"),
UpdateTime = table.Column<DateTime>(type: "datetime(6)", nullable: true, comment: ""),
UpdateBy = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: true, comment: "")
.Annotation("MySql:CharSet", "utf8mb4")
},
constraints: table =>
{
table.PrimaryKey("PK_DeviceAlarmRecord", x => x.ID);
},
comment: "设备告警记录")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "DeviceCurrentState",
columns: table => new
{
ID = table.Column<int>(type: "int", nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
DeviceId = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: false, comment: "设备唯一标识")
.Annotation("MySql:CharSet", "utf8mb4"),
DeviceName = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true, comment: "设备显示名称")
.Annotation("MySql:CharSet", "utf8mb4"),
DeviceType = table.Column<string>(type: "varchar(30)", maxLength: 30, nullable: true, comment: "设备类型")
.Annotation("MySql:CharSet", "utf8mb4"),
Status = table.Column<string>(type: "varchar(30)", maxLength: 30, nullable: true, comment: "当前状态")
.Annotation("MySql:CharSet", "utf8mb4"),
LastPayloadTime = table.Column<DateTime>(type: "datetime(6)", nullable: true, comment: "最后设备数据时间"),
LastUpdateTime = table.Column<DateTime>(type: "datetime(6)", nullable: true, comment: "最后状态更新时间"),
AlarmSummary = table.Column<string>(type: "varchar(500)", maxLength: 500, nullable: true, comment: "当前告警摘要")
.Annotation("MySql:CharSet", "utf8mb4"),
RealtimeJson = table.Column<string>(type: "longtext", nullable: true, comment: "清洗后的实时数据")
.Annotation("MySql:CharSet", "utf8mb4"),
CreateTime = table.Column<DateTime>(type: "datetime(6)", nullable: true, comment: ""),
CreateBy = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: true, comment: "")
.Annotation("MySql:CharSet", "utf8mb4"),
UpdateTime = table.Column<DateTime>(type: "datetime(6)", nullable: true, comment: ""),
UpdateBy = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: true, comment: "")
.Annotation("MySql:CharSet", "utf8mb4")
},
constraints: table =>
{
table.PrimaryKey("PK_DeviceCurrentState", x => x.ID);
},
comment: "设备当前状态")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "DeviceMetricTrendPoint",
columns: table => new
{
ID = table.Column<int>(type: "int", nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
DeviceId = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: false, comment: "设备唯一标识")
.Annotation("MySql:CharSet", "utf8mb4"),
MetricName = table.Column<string>(type: "varchar(60)", maxLength: 60, nullable: false, comment: "指标名称")
.Annotation("MySql:CharSet", "utf8mb4"),
BucketTime = table.Column<DateTime>(type: "datetime(6)", nullable: false, comment: "聚合时间桶"),
AvgValue = table.Column<decimal>(type: "decimal(18,4)", nullable: false, comment: "平均值"),
MaxValue = table.Column<decimal>(type: "decimal(18,4)", nullable: false, comment: "最大值"),
MinValue = table.Column<decimal>(type: "decimal(18,4)", nullable: false, comment: "最小值"),
SampleCount = table.Column<int>(type: "int", nullable: false, comment: "样本数"),
CreateTime = table.Column<DateTime>(type: "datetime(6)", nullable: true, comment: ""),
CreateBy = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: true, comment: "")
.Annotation("MySql:CharSet", "utf8mb4"),
UpdateTime = table.Column<DateTime>(type: "datetime(6)", nullable: true, comment: ""),
UpdateBy = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: true, comment: "")
.Annotation("MySql:CharSet", "utf8mb4")
},
constraints: table =>
{
table.PrimaryKey("PK_DeviceMetricTrendPoint", x => x.ID);
},
comment: "设备指标趋势聚合点")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "DeviceProductionDaily",
columns: table => new
{
ID = table.Column<int>(type: "int", nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
DeviceId = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: false, comment: "设备唯一标识")
.Annotation("MySql:CharSet", "utf8mb4"),
ProductionDate = table.Column<DateTime>(type: "datetime(6)", nullable: false, comment: "生产日期"),
StartCounter = table.Column<int>(type: "int", nullable: false, comment: "当日开始累计值"),
EndCounter = table.Column<int>(type: "int", nullable: false, comment: "当日结束累计值"),
ProduceCount = table.Column<int>(type: "int", nullable: false, comment: "当日产量"),
RuntimeMinutes = table.Column<int>(type: "int", nullable: false, comment: "运行分钟数"),
CuttimeMinutes = table.Column<int>(type: "int", nullable: false, comment: "加工分钟数"),
AlarmMinutes = table.Column<int>(type: "int", nullable: false, comment: "报警分钟数"),
OfflineMinutes = table.Column<int>(type: "int", nullable: false, comment: "离线分钟数"),
CreateTime = table.Column<DateTime>(type: "datetime(6)", nullable: true, comment: ""),
CreateBy = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: true, comment: "")
.Annotation("MySql:CharSet", "utf8mb4"),
UpdateTime = table.Column<DateTime>(type: "datetime(6)", nullable: true, comment: ""),
UpdateBy = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: true, comment: "")
.Annotation("MySql:CharSet", "utf8mb4")
},
constraints: table =>
{
table.PrimaryKey("PK_DeviceProductionDaily", x => x.ID);
},
comment: "设备日产能汇总")
.Annotation("MySql:CharSet", "utf8mb4");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "DeviceAlarmRecord");
migrationBuilder.DropTable(
name: "DeviceCurrentState");
migrationBuilder.DropTable(
name: "DeviceMetricTrendPoint");
migrationBuilder.DropTable(
name: "DeviceProductionDaily");
}
}
}
File diff suppressed because it is too large. Load diff