ALTER DATABASE CHARACTER SET utf8mb4;


CREATE TABLE `Basedata_AQL` (
    `Id` char(36) COLLATE ascii_general_ci NOT NULL,
    `ItemCode` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
    `SupplierCode` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
    `AbcClass` longtext CHARACTER SET utf8mb4 NULL,
    `FloorQty` decimal(18,6) NOT NULL,
    `CeilingQty` decimal(18,6) NOT NULL,
    `SamplePercent` decimal(18,6) NOT NULL,
    `SampleQty` decimal(18,6) NOT NULL,
    `IsUsePercent` tinyint(1) NOT NULL,
    `ExtraProperties` longtext CHARACTER SET utf8mb4 NULL,
    `ConcurrencyStamp` varchar(40) CHARACTER SET utf8mb4 NULL,
    `CreationTime` datetime(6) NOT NULL,
    `CreatorId` char(36) COLLATE ascii_general_ci NULL,
    `LastModificationTime` datetime(6) NULL,
    `LastModifierId` char(36) COLLATE ascii_general_ci NULL,
    `TenantId` char(36) COLLATE ascii_general_ci NULL,
    `Remark` varchar(3072) CHARACTER SET utf8mb4 NULL,
    CONSTRAINT `PK_Basedata_AQL` PRIMARY KEY (`Id`)
) CHARACTER SET=utf8mb4;


CREATE TABLE `Basedata_Area` (
    `Id` char(36) COLLATE ascii_general_ci NOT NULL,
    `Code` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
    `Name` varchar(64) CHARACTER SET utf8mb4 NULL,
    `Description` varchar(1024) CHARACTER SET utf8mb4 NULL,
    `WarehouseCode` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
    `AreaType` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
    `IsFunctional` tinyint(1) NOT NULL,
    `ExtraProperties` longtext CHARACTER SET utf8mb4 NULL,
    `ConcurrencyStamp` varchar(40) CHARACTER SET utf8mb4 NULL,
    `CreationTime` datetime(6) NOT NULL,
    `CreatorId` char(36) COLLATE ascii_general_ci NULL,
    `LastModificationTime` datetime(6) NULL,
    `LastModifierId` char(36) COLLATE ascii_general_ci NULL,
    `TenantId` char(36) COLLATE ascii_general_ci NULL,
    `Remark` varchar(3072) CHARACTER SET utf8mb4 NULL,
    CONSTRAINT `PK_Basedata_Area` PRIMARY KEY (`Id`)
) CHARACTER SET=utf8mb4;


CREATE TABLE `Basedata_Bom` (
    `Id` char(36) COLLATE ascii_general_ci NOT NULL,
    `Product` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
    `Component` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
    `ComponentUom` varchar(64) CHARACTER SET utf8mb4 NULL,
    `ComponentQty` decimal(18,6) NOT NULL,
    `BeginTime` datetime(6) NULL,
    `EndTime` datetime(6) NULL,
    `ERPOp` varchar(64) CHARACTER SET utf8mb4 NULL,
    `Layer` int NOT NULL DEFAULT 1,
    `MFGOp` varchar(64) CHARACTER SET utf8mb4 NULL,
    `DistributionType` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
    `TruncType` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
    `PlannedSplitRule` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
    `ExtraProperties` longtext CHARACTER SET utf8mb4 NULL,
    `ConcurrencyStamp` varchar(40) CHARACTER SET utf8mb4 NULL,
    `CreationTime` datetime(6) NOT NULL,
    `CreatorId` char(36) COLLATE ascii_general_ci NULL,
    `LastModificationTime` datetime(6) NULL,
    `LastModifierId` char(36) COLLATE ascii_general_ci NULL,
    `TenantId` char(36) COLLATE ascii_general_ci NULL,
    `Remark` varchar(3072) CHARACTER SET utf8mb4 NULL,
    CONSTRAINT `PK_Basedata_Bom` PRIMARY KEY (`Id`)
) CHARACTER SET=utf8mb4;


CREATE TABLE `Basedata_Calendar` (
    `Id` char(36) COLLATE ascii_general_ci NOT NULL,
    `Module` varchar(64) CHARACTER SET utf8mb4 NULL,
    `BeginTime` datetime(6) NULL,
    `EndTime` datetime(6) NULL,
    `Status` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
    `ExtraProperties` longtext CHARACTER SET utf8mb4 NULL,
    `ConcurrencyStamp` varchar(40) CHARACTER SET utf8mb4 NULL,
    `CreationTime` datetime(6) NOT NULL,
    `CreatorId` char(36) COLLATE ascii_general_ci NULL,
    `LastModificationTime` datetime(6) NULL,
    `LastModifierId` char(36) COLLATE ascii_general_ci NULL,
    `TenantId` char(36) COLLATE ascii_general_ci NULL,
    `Remark` varchar(3072) CHARACTER SET utf8mb4 NULL,
    CONSTRAINT `PK_Basedata_Calendar` PRIMARY KEY (`Id`)
) CHARACTER SET=utf8mb4;


CREATE TABLE `Basedata_Category` (
    `Id` char(36) COLLATE ascii_general_ci NOT NULL,
    `Code` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
    `Name` varchar(64) CHARACTER SET utf8mb4 NULL,
    `Description` varchar(1024) CHARACTER SET utf8mb4 NULL,
    `ExtraProperties` longtext CHARACTER SET utf8mb4 NULL,
    `ConcurrencyStamp` varchar(40) CHARACTER SET utf8mb4 NULL,
    `CreationTime` datetime(6) NOT NULL,
    `CreatorId` char(36) COLLATE ascii_general_ci NULL,
    `LastModificationTime` datetime(6) NULL,
    `LastModifierId` char(36) COLLATE ascii_general_ci NULL,
    `TenantId` char(36) COLLATE ascii_general_ci NULL,
    `Remark` varchar(3072) CHARACTER SET utf8mb4 NULL,
    CONSTRAINT `PK_Basedata_Category` PRIMARY KEY (`Id`)
) CHARACTER SET=utf8mb4;


CREATE TABLE `Basedata_Currency` (
    `Id` char(36) COLLATE ascii_general_ci NOT NULL,
    `Name` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
    `Code` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
    `Description` varchar(1024) CHARACTER SET utf8mb4 NULL,
    `IsBasicCurrency` tinyint(1) NOT NULL,
    `ExtraProperties` longtext CHARACTER SET utf8mb4 NULL,
    `ConcurrencyStamp` varchar(40) CHARACTER SET utf8mb4 NULL,
    `CreationTime` datetime(6) NOT NULL,
    `CreatorId` char(36) COLLATE ascii_general_ci NULL,
    `LastModificationTime` datetime(6) NULL,
    `LastModifierId` char(36) COLLATE ascii_general_ci NULL,
    `TenantId` char(36) COLLATE ascii_general_ci NULL,
    `Remark` varchar(3072) CHARACTER SET utf8mb4 NULL,
    CONSTRAINT `PK_Basedata_Currency` PRIMARY KEY (`Id`)
) CHARACTER SET=utf8mb4;


CREATE TABLE `Basedata_CurrencyExchange` (
    `Id` char(36) COLLATE ascii_general_ci NOT NULL,
    `CurrencyId` char(36) COLLATE ascii_general_ci NOT NULL,
    `BasicCurrencyId` char(36) COLLATE ascii_general_ci NOT NULL,
    `Rate` decimal(18,6) NOT NULL,
    `EfficetiveTime` datetime(6) NOT NULL,
    `ExpireTime` datetime(6) NOT NULL,
    `ExtraProperties` longtext CHARACTER SET utf8mb4 NULL,
    `ConcurrencyStamp` varchar(40) CHARACTER SET utf8mb4 NULL,
    `CreationTime` datetime(6) NOT NULL,
    `CreatorId` char(36) COLLATE ascii_general_ci NULL,
    `LastModificationTime` datetime(6) NULL,
    `LastModifierId` char(36) COLLATE ascii_general_ci NULL,
    `TenantId` char(36) COLLATE ascii_general_ci NULL,
    `Remark` varchar(3072) CHARACTER SET utf8mb4 NULL,
    CONSTRAINT `PK_Basedata_CurrencyExchange` PRIMARY KEY (`Id`)
) CHARACTER SET=utf8mb4;


CREATE TABLE `Basedata_Customer` (
    `Id` char(36) COLLATE ascii_general_ci NOT NULL,
    `Code` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
    `Name` varchar(64) CHARACTER SET utf8mb4 NULL,
    `ShortName` varchar(64) CHARACTER SET utf8mb4 NULL,
    `Address` varchar(1024) CHARACTER SET utf8mb4 NULL,
    `Country` varchar(64) CHARACTER SET utf8mb4 NULL,
    `City` varchar(64) CHARACTER SET utf8mb4 NULL,
    `Phone` varchar(64) CHARACTER SET utf8mb4 NULL,
    `Fax` varchar(64) CHARACTER SET utf8mb4 NULL,
    `PostID` varchar(64) CHARACTER SET utf8mb4 NULL,
    `Contacts` varchar(64) CHARACTER SET utf8mb4 NULL,
    `Currency` varchar(64) CHARACTER SET utf8mb4 NULL,
    `IsActive` tinyint(1) NOT NULL,
    `Type` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
    `ExtraProperties` longtext CHARACTER SET utf8mb4 NULL,
    `ConcurrencyStamp` varchar(40) CHARACTER SET utf8mb4 NULL,
    `CreationTime` datetime(6) NOT NULL,
    `CreatorId` char(36) COLLATE ascii_general_ci NULL,
    `LastModificationTime` datetime(6) NULL,
    `LastModifierId` char(36) COLLATE ascii_general_ci NULL,
    `TenantId` char(36) COLLATE ascii_general_ci NULL,
    `Remark` varchar(3072) CHARACTER SET utf8mb4 NULL,
    CONSTRAINT `PK_Basedata_Customer` PRIMARY KEY (`Id`)
) CHARACTER SET=utf8mb4;


CREATE TABLE `Basedata_CustomerAddress` (
    `Id` char(36) COLLATE ascii_general_ci NOT NULL,
    `Code` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
    `Name` varchar(64) CHARACTER SET utf8mb4 NULL,
    `CustomerCode` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
    `Address` varchar(1024) CHARACTER SET utf8mb4 NULL,
    `Contact` varchar(64) CHARACTER SET utf8mb4 NULL,
    `WarehouseCode` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
    `City` varchar(64) CHARACTER SET utf8mb4 NULL,
    `LocationCode` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
    `Desc` varchar(1024) CHARACTER SET utf8mb4 NULL,
    `ExtraProperties` longtext CHARACTER SET utf8mb4 NULL,
    `ConcurrencyStamp` varchar(40) CHARACTER SET utf8mb4 NULL,
    `CreationTime` datetime(6) NOT NULL,
    `CreatorId` char(36) COLLATE ascii_general_ci NULL,
    `LastModificationTime` datetime(6) NULL,
    `LastModifierId` char(36) COLLATE ascii_general_ci NULL,
    `TenantId` char(36) COLLATE ascii_general_ci NULL,
    `Remark` varchar(1024) CHARACTER SET utf8mb4 NULL,
    CONSTRAINT `PK_Basedata_CustomerAddress` PRIMARY KEY (`Id`)
) CHARACTER SET=utf8mb4;


CREATE TABLE `Basedata_CustomerItem` (
    `Id` char(36) COLLATE ascii_general_ci NOT NULL,
    `CustomerCode` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
    `ItemCode` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
    `CustomerItemCode` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
    `Version` varchar(1024) CHARACTER SET utf8mb4 NULL,
    `CustomerPackUom` varchar(64) CHARACTER SET utf8mb4 NULL,
    `CustomerPackQty` decimal(18,6) NOT NULL,
    `BeginTime` datetime(6) NULL,
    `EndTime` datetime(6) NULL,
    `ExtraProperties` longtext CHARACTER SET utf8mb4 NULL,
    `ConcurrencyStamp` varchar(40) CHARACTER SET utf8mb4 NULL,
    `CreationTime` datetime(6) NOT NULL,
    `CreatorId` char(36) COLLATE ascii_general_ci NULL,
    `LastModificationTime` datetime(6) NULL,
    `LastModifierId` char(36) COLLATE ascii_general_ci NULL,
    `TenantId` char(36) COLLATE ascii_general_ci NULL,
    `Remark` varchar(3072) CHARACTER SET utf8mb4 NULL,
    CONSTRAINT `PK_Basedata_CustomerItem` PRIMARY KEY (`Id`)
) CHARACTER SET=utf8mb4;


CREATE TABLE `Basedata_Dict` (
    `Id` char(36) COLLATE ascii_general_ci NOT NULL,
    `Code` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
    `Name` varchar(64) CHARACTER SET utf8mb4 NULL,
    `Description` varchar(1024) CHARACTER SET utf8mb4 NULL,
    `ExtraProperties` longtext CHARACTER SET utf8mb4 NULL,
    `ConcurrencyStamp` varchar(40) CHARACTER SET utf8mb4 NULL,
    `CreationTime` datetime(6) NOT NULL,
    `CreatorId` char(36) COLLATE ascii_general_ci NULL,
    `LastModificationTime` datetime(6) NULL,
    `LastModifierId` char(36) COLLATE ascii_general_ci NULL,
    `TenantId` char(36) COLLATE ascii_general_ci NULL,
    `Remark` varchar(3072) CHARACTER SET utf8mb4 NULL,
    CONSTRAINT `PK_Basedata_Dict` PRIMARY KEY (`Id`)
) CHARACTER SET=utf8mb4;


CREATE TABLE `Basedata_Dock` (
    `Id` char(36) COLLATE ascii_general_ci NOT NULL,
    `Code` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
    `Name` varchar(64) CHARACTER SET utf8mb4 NULL,
    `Description` varchar(1024) CHARACTER SET utf8mb4 NULL,
    `WarehouseCode` varchar(64) CHARACTER SET utf8mb4 NULL,
    `DefaultLocationCode` varchar(64) CHARACTER SET utf8mb4 NULL,
    `ExtraProperties` longtext CHARACTER SET utf8mb4 NULL,
    `ConcurrencyStamp` varchar(40) CHARACTER SET utf8mb4 NULL,
    `CreationTime` datetime(6) NOT NULL,
    `CreatorId` char(36) COLLATE ascii_general_ci NULL,
    `LastModificationTime` datetime(6) NULL,
    `LastModifierId` char(36) COLLATE ascii_general_ci NULL,
    `TenantId` char(36) COLLATE ascii_general_ci NULL,
    `Remark` varchar(3072) CHARACTER SET utf8mb4 NULL,
    CONSTRAINT `PK_Basedata_Dock` PRIMARY KEY (`Id`)
) CHARACTER SET=utf8mb4;


CREATE TABLE `Basedata_DocumentSetting` (
    `Id` char(36) COLLATE ascii_general_ci NOT NULL,
    `Code` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
    `Name` varchar(64) CHARACTER SET utf8mb4 NULL,
    `Description` varchar(1024) CHARACTER SET utf8mb4 NULL,
    `TransactionType` varchar(64) CHARACTER SET utf8mb4 NULL,
    `NumberPrefix` varchar(64) CHARACTER SET utf8mb4 NULL,
    `NumberFormat` varchar(64) CHARACTER SET utf8mb4 NULL,
    `NumberSerialLength` int NOT NULL,
    `NumberSeparator` varchar(64) CHARACTER SET utf8mb4 NULL,
    `ExtraProperties` longtext CHARACTER SET utf8mb4 NULL,
    `ConcurrencyStamp` varchar(40) CHARACTER SET utf8mb4 NULL,
    `CreationTime` datetime(6) NOT NULL,
    `CreatorId` char(36) COLLATE ascii_general_ci NULL,
    `LastModificationTime` datetime(6) NULL,
    `LastModifierId` char(36) COLLATE ascii_general_ci NULL,
    `TenantId` char(36) COLLATE ascii_general_ci NULL,
    `Remark` varchar(3072) CHARACTER SET utf8mb4 NULL,
    CONSTRAINT `PK_Basedata_DocumentSetting` PRIMARY KEY (`Id`)
) CHARACTER SET=utf8mb4;


CREATE TABLE `Basedata_ErpLocation` (
    `Id` char(36) COLLATE ascii_general_ci NOT NULL,
    `Code` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
    `Name` varchar(64) CHARACTER SET utf8mb4 NULL,
    `Description` varchar(1024) CHARACTER SET utf8mb4 NULL,
    `Type` varchar(64) CHARACTER SET utf8mb4 NULL,
    `WarehouseCode` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
    `ExtraProperties` longtext CHARACTER SET utf8mb4 NULL,
    `ConcurrencyStamp` varchar(40) CHARACTER SET utf8mb4 NULL,
    `CreationTime` datetime(6) NOT NULL,
    `CreatorId` char(36) COLLATE ascii_general_ci NULL,
    `LastModificationTime` datetime(6) NULL,
    `LastModifierId` char(36) COLLATE ascii_general_ci NULL,
    `TenantId` char(36) COLLATE ascii_general_ci NULL,
    `Remark` varchar(3072) CHARACTER SET utf8mb4 NULL,
    CONSTRAINT `PK_Basedata_ErpLocation` PRIMARY KEY (`Id`)
) CHARACTER SET=utf8mb4;


CREATE TABLE `Basedata_InterfaceCalendar` (
    `Id` char(36) COLLATE ascii_general_ci NOT NULL,
    `Code` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
    `Name` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
    `Year` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
    `Month` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
    `BeginTime` datetime(6) NOT NULL,
    `EndTime` datetime(6) NOT NULL,
    `ConvertToTime` datetime(6) NOT NULL,
    `Description` varchar(64) CHARACTER SET utf8mb4 NULL,
    `ExtraProperties` longtext CHARACTER SET utf8mb4 NULL,
    `ConcurrencyStamp` varchar(40) CHARACTER SET utf8mb4 NULL,
    `CreationTime` datetime(6) NOT NULL,
    `CreatorId` char(36) COLLATE ascii_general_ci NULL,
    `LastModificationTime` datetime(6) NULL,
    `LastModifierId` char(36) COLLATE ascii_general_ci NULL,
    `TenantId` char(36) COLLATE ascii_general_ci NULL,
    `Remark` longtext CHARACTER SET utf8mb4 NULL,
    CONSTRAINT `PK_Basedata_InterfaceCalendar` PRIMARY KEY (`Id`)
) CHARACTER SET=utf8mb4;


CREATE TABLE `Basedata_ItemBasic` (
    `Id` char(36) COLLATE ascii_general_ci NOT NULL,
    `Code` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
    `Name` varchar(64) CHARACTER SET utf8mb4 NULL,
    `Desc1` varchar(1024) CHARACTER SET utf8mb4 NULL,
    `Desc2` varchar(1024) CHARACTER SET utf8mb4 NULL,
    `Status` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
    `CanMake` tinyint(1) NOT NULL,
    `CanBuy` tinyint(1) NOT NULL,
    `CanOutsourcing` tinyint(1) NOT NULL,
    `IsRecycled` tinyint(1) NOT NULL,
    `Type` varchar(64) CHARACTER SET utf8mb4 NULL,
    `Category` varchar(64) CHARACTER SET utf8mb4 NULL,
    `Group` varchar(64) CHARACTER SET utf8mb4 NULL,
    `Color` varchar(64) CHARACTER SET utf8mb4 NULL,
    `Configuration` varchar(64) CHARACTER SET utf8mb4 NULL,
    `BasicUom` longtext CHARACTER SET utf8mb4 NULL,
    `StdPackQty` decimal(18,6) NOT NULL,
    `AbcClass` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
    `Project` longtext CHARACTER SET utf8mb4 NULL,
    `Version` varchar(64) CHARACTER SET utf8mb4 NULL,
    `Eco` varchar(64) CHARACTER SET utf8mb4 NULL,
    `Validity` int NOT NULL,
    `ValidityUnit` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
    `ManageType` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
    `Elevel` varchar(64) CHARACTER SET utf8mb4 NULL,
    `IsPhantom` tinyint(1) NOT NULL,
    `ExtraProperties` longtext CHARACTER SET utf8mb4 NULL,
    `ConcurrencyStamp` varchar(40) CHARACTER SET utf8mb4 NULL,
    `CreationTime` datetime(6) NOT NULL,
    `CreatorId` char(36) COLLATE ascii_general_ci NULL,
    `LastModificationTime` datetime(6) NULL,
    `LastModifierId` char(36) COLLATE ascii_general_ci NULL,
    `TenantId` char(36) COLLATE ascii_general_ci NULL,
    `Remark` varchar(3072) CHARACTER SET utf8mb4 NULL,
    CONSTRAINT `PK_Basedata_ItemBasic` PRIMARY KEY (`Id`)
) CHARACTER SET=utf8mb4;


CREATE TABLE `Basedata_ItemCategory` (
    `Id` char(36) COLLATE ascii_general_ci NOT NULL,
    `ItemCode` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
    `CategoryCode` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
    `Value` varchar(1024) CHARACTER SET utf8mb4 NOT NULL,
    `ExtraProperties` longtext CHARACTER SET utf8mb4 NULL,
    `ConcurrencyStamp` varchar(40) CHARACTER SET utf8mb4 NULL,
    `CreationTime` datetime(6) NOT NULL,
    `CreatorId` char(36) COLLATE ascii_general_ci NULL,
    `LastModificationTime` datetime(6) NULL,
    `LastModifierId` char(36) COLLATE ascii_general_ci NULL,
    `TenantId` char(36) COLLATE ascii_general_ci NULL,
    `Remark` varchar(3072) CHARACTER SET utf8mb4 NULL,
    CONSTRAINT `PK_Basedata_ItemCategory` PRIMARY KEY (`Id`)
) CHARACTER SET=utf8mb4;


CREATE TABLE `Basedata_ItemGuideBook` (
    `Id` char(36) COLLATE ascii_general_ci NOT NULL,
    `ItemCode` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
    `Name` longtext CHARACTER SET utf8mb4 NULL,
    `Desc1` longtext CHARACTER SET utf8mb4 NULL,
    `Desc2` longtext CHARACTER SET utf8mb4 NULL,
    `Step` varchar(1024) CHARACTER SET utf8mb4 NULL,
    `PictureBlobName` longtext CHARACTER SET utf8mb4 NULL,
    `ExtraProperties` longtext CHARACTER SET utf8mb4 NULL,
    `ConcurrencyStamp` varchar(40) CHARACTER SET utf8mb4 NULL,
    `CreationTime` datetime(6) NOT NULL,
    `CreatorId` char(36) COLLATE ascii_general_ci NULL,
    `LastModificationTime` datetime(6) NULL,
    `LastModifierId` char(36) COLLATE ascii_general_ci NULL,
    `TenantId` char(36) COLLATE ascii_general_ci NULL,
    `Remark` varchar(3072) CHARACTER SET utf8mb4 NULL,
    CONSTRAINT `PK_Basedata_ItemGuideBook` PRIMARY KEY (`Id`)
) CHARACTER SET=utf8mb4;


CREATE TABLE `Basedata_ItemPack` (
    `Id` char(36) COLLATE ascii_general_ci NOT NULL,
    `PackCode` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
    `PackName` varchar(64) CHARACTER SET utf8mb4 NULL,
    `PackType` varchar(64) CHARACTER SET utf8mb4 NULL,
    `ItemCode` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
    `BasicUom` varchar(64) CHARACTER SET utf8mb4 NULL,
    `Qty` decimal(18,6) NOT NULL,
    `ExtraProperties` longtext CHARACTER SET utf8mb4 NULL,
    `ConcurrencyStamp` varchar(40) CHARACTER SET utf8mb4 NULL,
    `CreationTime` datetime(6) NOT NULL,
    `CreatorId` char(36) COLLATE ascii_general_ci NULL,
    `LastModificationTime` datetime(6) NULL,
    `LastModifierId` char(36) COLLATE ascii_general_ci NULL,
    `TenantId` char(36) COLLATE ascii_general_ci NULL,
    `Remark` varchar(3072) CHARACTER SET utf8mb4 NULL,
    CONSTRAINT `PK_Basedata_ItemPack` PRIMARY KEY (`Id`)
) CHARACTER SET=utf8mb4;


CREATE TABLE `Basedata_ItemQuality` (
    `Id` char(36) COLLATE ascii_general_ci NOT NULL,
    `ItemCode` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
    `SupplierCode` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
    `Status` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
    `Description` varchar(1024) CHARACTER SET utf8mb4 NULL,
    `InspectType` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
    `ExtraProperties` longtext CHARACTER SET utf8mb4 NULL,
    `ConcurrencyStamp` varchar(40) CHARACTER SET utf8mb4 NULL,
    `CreationTime` datetime(6) NOT NULL,
    `CreatorId` char(36) COLLATE ascii_general_ci NULL,
    `LastModificationTime` datetime(6) NULL,
    `LastModifierId` char(36) COLLATE ascii_general_ci NULL,
    `TenantId` char(36) COLLATE ascii_general_ci NULL,
    `Remark` varchar(3072) CHARACTER SET utf8mb4 NULL,
    CONSTRAINT `PK_Basedata_ItemQuality` PRIMARY KEY (`Id`)
) CHARACTER SET=utf8mb4;


CREATE TABLE `Basedata_ItemSafetyStock` (
    `Id` char(36) COLLATE ascii_general_ci NOT NULL,
    `ItemCode` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
    `WarehouseCode` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
    `StoreRelationType` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
    `StoreValue` varchar(64) CHARACTER SET utf8mb4 NULL,
    `MaxStock` decimal(18,6) NOT NULL,
    `MinStock` decimal(18,6) NOT NULL,
    `SafetyStock` decimal(18,6) NOT NULL,
    `FeedLine` decimal(18,6) NOT NULL,
    `FeedQty` decimal(18,6) NOT NULL,
    `FeedUM` varchar(64) CHARACTER SET utf8mb4 NULL,
    `ExtraProperties` longtext CHARACTER SET utf8mb4 NULL,
    `ConcurrencyStamp` varchar(40) CHARACTER SET utf8mb4 NULL,
    `CreationTime` datetime(6) NOT NULL,
    `CreatorId` char(36) COLLATE ascii_general_ci NULL,
    `LastModificationTime` datetime(6) NULL,
    `LastModifierId` char(36) COLLATE ascii_general_ci NULL,
    `TenantId` char(36) COLLATE ascii_general_ci NULL,
    `Remark` varchar(3072) CHARACTER SET utf8mb4 NULL,
    CONSTRAINT `PK_Basedata_ItemSafetyStock` PRIMARY KEY (`Id`)
) CHARACTER SET=utf8mb4;


CREATE TABLE `Basedata_ItemStoreRelation` (
    `Id` char(36) COLLATE ascii_general_ci NOT NULL,
    `ItemCode` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
    `WarehouseCode` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
    `StoreRelationType` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
    `StoreValue` varchar(64) CHARACTER SET utf8mb4 NULL,
    `Enabled` tinyint(1) NOT NULL,
    `StoreUM` varchar(64) CHARACTER SET utf8mb4 NULL,
    `UmQty` decimal(18,6) NOT NULL,
    `AltUm` varchar(64) CHARACTER SET utf8mb4 NULL,
    `AltUmQty` decimal(18,6) NOT NULL,
    `PramaryUM` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
    `IsFixed` tinyint(1) NOT NULL,
    `MultiLoc` int NOT NULL,
    `ExtraProperties` longtext CHARACTER SET utf8mb4 NULL,
    `ConcurrencyStamp` varchar(40) CHARACTER SET utf8mb4 NULL,
    `CreationTime` datetime(6) NOT NULL,
    `CreatorId` char(36) COLLATE ascii_general_ci NULL,
    `LastModificationTime` datetime(6) NULL,
    `LastModifierId` char(36) COLLATE ascii_general_ci NULL,
    `TenantId` char(36) COLLATE ascii_general_ci NULL,
    `Remark` varchar(3072) CHARACTER SET utf8mb4 NULL,
    CONSTRAINT `PK_Basedata_ItemStoreRelation` PRIMARY KEY (`Id`)
) CHARACTER SET=utf8mb4;


CREATE TABLE `Basedata_Location` (
    `Id` char(36) COLLATE ascii_general_ci NOT NULL,
    `Code` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
    `Name` varchar(64) CHARACTER SET utf8mb4 NULL,
    `Description` varchar(1024) CHARACTER SET utf8mb4 NULL,
    `Type` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
    `ErpLocationCode` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
    `WarehouseCode` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
    `AreaCode` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
    `LocationGroupCode` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
    `WorkGroupCode` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
    `ShelfCode` varchar(64) CHARACTER SET utf8mb4 NULL,
    `RowCode` int NOT NULL DEFAULT 1,
    `ColumnCode` int NOT NULL DEFAULT 1,
    `DefaultInventoryStatus` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
    `PickPriority` int NOT NULL DEFAULT 0,
    `PickOrder` int NOT NULL DEFAULT 0,
    `EnableMixItem` tinyint(1) NOT NULL DEFAULT TRUE,
    `EnableMixLot` tinyint(1) NOT NULL DEFAULT TRUE,
    `EnableMixStatus` tinyint(1) NOT NULL DEFAULT TRUE,
    `EnableNegative` tinyint(1) NOT NULL DEFAULT TRUE,
    `EnableKeepZero` tinyint(1) NOT NULL DEFAULT TRUE,
    `EnableOpportunityCount` tinyint(1) NOT NULL DEFAULT TRUE,
    `EnablePick` tinyint(1) NOT NULL DEFAULT TRUE,
    `EnableOverPick` tinyint(1) NOT NULL DEFAULT TRUE,
    `EnableWholeStore` tinyint(1) NOT NULL DEFAULT TRUE,
    `EnableBreakStore` tinyint(1) NOT NULL DEFAULT TRUE,
    `EnableShip` tinyint(1) NOT NULL DEFAULT TRUE,
    `EnableReceive` tinyint(1) NOT NULL DEFAULT TRUE,
    `EnableReturnToSupplier` tinyint(1) NOT NULL DEFAULT TRUE,
    `EnableReturnFromCustomer` tinyint(1) NOT NULL DEFAULT TRUE,
    `EnableSplitBox` tinyint(1) NOT NULL DEFAULT TRUE,
    `EnableSplitPallet` tinyint(1) NOT NULL DEFAULT TRUE,
    `ExtraProperties` longtext CHARACTER SET utf8mb4 NULL,
    `ConcurrencyStamp` varchar(40) CHARACTER SET utf8mb4 NULL,
    `CreationTime` datetime(6) NOT NULL,
    `CreatorId` char(36) COLLATE ascii_general_ci NULL,
    `LastModificationTime` datetime(6) NULL,
    `LastModifierId` char(36) COLLATE ascii_general_ci NULL,
    `TenantId` char(36) COLLATE ascii_general_ci NULL,
    `Remark` varchar(3072) CHARACTER SET utf8mb4 NULL,
    CONSTRAINT `PK_Basedata_Location` PRIMARY KEY (`Id`)
) CHARACTER SET=utf8mb4;


CREATE TABLE `Basedata_LocationGroup` (
    `Id` char(36) COLLATE ascii_general_ci NOT NULL,
    `Code` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
    `Name` varchar(64) CHARACTER SET utf8mb4 NULL,
    `Description` varchar(1024) CHARACTER SET utf8mb4 NULL,
    `WarehouseCode` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
    `AreaCode` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
    `GroupType` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
    `DefaultInventoryStatus` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
    `PickPriority` int NOT NULL DEFAULT 0,
    `OverflowLocationGroup` varchar(64) CHARACTER SET utf8mb4 NULL,
    `EnableMixItem` tinyint(1) NOT NULL DEFAULT TRUE,
    `EnableMixLot` tinyint(1) NOT NULL DEFAULT TRUE,
    `EnableMixStatus` tinyint(1) NOT NULL DEFAULT TRUE,
    `EnableNegative` tinyint(1) NOT NULL DEFAULT TRUE,
    `EnableKeepZero` tinyint(1) NOT NULL DEFAULT TRUE,
    `EnableOpportunityCount` tinyint(1) NOT NULL DEFAULT TRUE,
    `EnablePick` tinyint(1) NOT NULL DEFAULT TRUE,
    `EnableOverPick` tinyint(1) NOT NULL DEFAULT TRUE,
    `EnableWholeStore` tinyint(1) NOT NULL DEFAULT TRUE,
    `EnableBreakStore` tinyint(1) NOT NULL DEFAULT TRUE,
    `EnableShip` tinyint(1) NOT NULL DEFAULT TRUE,
    `EnableReceive` tinyint(1) NOT NULL DEFAULT TRUE,
    `EnableReturnToSupplier` tinyint(1) NOT NULL DEFAULT TRUE,
    `EnableReturnFromCustomer` tinyint(1) NOT NULL DEFAULT TRUE,
    `EnableSplitBox` tinyint(1) NOT NULL DEFAULT TRUE,
    `EnableSplitPallet` tinyint(1) NOT NULL DEFAULT TRUE,
    `ExtraProperties` longtext CHARACTER SET utf8mb4 NULL,
    `ConcurrencyStamp` varchar(40) CHARACTER SET utf8mb4 NULL,
    `CreationTime` datetime(6) NOT NULL,
    `CreatorId` char(36) COLLATE ascii_general_ci NULL,
    `LastModificationTime` datetime(6) NULL,
    `LastModifierId` char(36) COLLATE ascii_general_ci NULL,
    `TenantId` char(36) COLLATE ascii_general_ci NULL,
    `Remark` varchar(3072) CHARACTER SET utf8mb4 NULL,
    CONSTRAINT `PK_Basedata_LocationGroup` PRIMARY KEY (`Id`)
) CHARACTER SET=utf8mb4;


CREATE TABLE `Basedata_Machine` (
    `Id` char(36) COLLATE ascii_general_ci NOT NULL,
    `ProdLineId` char(36) COLLATE ascii_general_ci NOT NULL,
    `WorkStationId` char(36) COLLATE ascii_general_ci NOT NULL,
    `Name` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
    `Code` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
    `Description` varchar(1024) CHARACTER SET utf8mb4 NULL,
    `Type` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
    `ExtraProperties` longtext CHARACTER SET utf8mb4 NULL,
    `ConcurrencyStamp` varchar(40) CHARACTER SET utf8mb4 NULL,
    `CreationTime` datetime(6) NOT NULL,
    `CreatorId` char(36) COLLATE ascii_general_ci NULL,
    `LastModificationTime` datetime(6) NULL,
    `LastModifierId` char(36) COLLATE ascii_general_ci NULL,
    `TenantId` char(36) COLLATE ascii_general_ci NULL,
    `Remark` varchar(3072) CHARACTER SET utf8mb4 NULL,
    CONSTRAINT `PK_Basedata_Machine` PRIMARY KEY (`Id`)
) CHARACTER SET=utf8mb4;


CREATE TABLE `Basedata_ProductionLine` (
    `Id` char(36) COLLATE ascii_general_ci NOT NULL,
    `Code` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
    `Name` varchar(64) CHARACTER SET utf8mb4 NULL,
    `Description` varchar(1024) CHARACTER SET utf8mb4 NULL,
    `Type` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
    `WorkshopCode` varchar(64) CHARACTER SET utf8mb4 NULL,
    `RawLocationCode` varchar(64) CHARACTER SET utf8mb4 NULL,
    `ProductLocationCode` varchar(64) CHARACTER SET utf8mb4 NULL,
    `RawLocationGroupCode` varchar(64) CHARACTER SET utf8mb4 NULL,
    `ExtraProperties` longtext CHARACTER SET utf8mb4 NULL,
    `ConcurrencyStamp` varchar(40) CHARACTER SET utf8mb4 NULL,
    `CreationTime` datetime(6) NOT NULL,
    `CreatorId` char(36) COLLATE ascii_general_ci NULL,
    `LastModificationTime` datetime(6) NULL,
    `LastModifierId` char(36) COLLATE ascii_general_ci NULL,
    `TenantId` char(36) COLLATE ascii_general_ci NULL,
    `Remark` varchar(3072) CHARACTER SET utf8mb4 NULL,
    CONSTRAINT `PK_Basedata_ProductionLine` PRIMARY KEY (`Id`)
) CHARACTER SET=utf8mb4;


CREATE TABLE `Basedata_ProductionLineItem` (
    `Id` char(36) COLLATE ascii_general_ci NOT NULL,
    `ProdLineCode` varchar(255) CHARACTER SET utf8mb4 NOT NULL,
    `ItemCode` varchar(255) CHARACTER SET utf8mb4 NOT NULL,
    `ExtraProperties` longtext CHARACTER SET utf8mb4 NULL,
    `ConcurrencyStamp` varchar(40) CHARACTER SET utf8mb4 NULL,
    `CreationTime` datetime(6) NOT NULL,
    `CreatorId` char(36) COLLATE ascii_general_ci NULL,
    `LastModificationTime` datetime(6) NULL,
    `LastModifierId` char(36) COLLATE ascii_general_ci NULL,
    `TenantId` char(36) COLLATE ascii_general_ci NULL,
    `Remark` varchar(3072) CHARACTER SET utf8mb4 NULL,
    CONSTRAINT `PK_Basedata_ProductionLineItem` PRIMARY KEY (`Id`)
) CHARACTER SET=utf8mb4;


CREATE TABLE `Basedata_Project` (
    `Id` char(36) COLLATE ascii_general_ci NOT NULL,
    `Code` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
    `Name` varchar(64) CHARACTER SET utf8mb4 NULL,
    `Description` varchar(1024) CHARACTER SET utf8mb4 NULL,
    `CustomerCode` varchar(64) CHARACTER SET utf8mb4 NULL,
    `BeginTime` datetime(6) NULL,
    `EndTime` datetime(6) NULL,
    `ExtraProperties` longtext CHARACTER SET utf8mb4 NULL,
    `ConcurrencyStamp` varchar(40) CHARACTER SET utf8mb4 NULL,
    `CreationTime` datetime(6) NOT NULL,
    `CreatorId` char(36) COLLATE ascii_general_ci NULL,
    `LastModificationTime` datetime(6) NULL,
    `LastModifierId` char(36) COLLATE ascii_general_ci NULL,
    `TenantId` char(36) COLLATE ascii_general_ci NULL,
    `Remark` varchar(3072) CHARACTER SET utf8mb4 NULL,
    CONSTRAINT `PK_Basedata_Project` PRIMARY KEY (`Id`)
) CHARACTER SET=utf8mb4;


CREATE TABLE `Basedata_PurchasePriceSheet` (
    `Id` char(36) COLLATE ascii_general_ci NOT NULL,
    `SupplierId` char(64) COLLATE ascii_general_ci NOT NULL,
    `Code` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
    `Name` varchar(64) CHARACTER SET utf8mb4 NULL,
    `Description` varchar(1024) CHARACTER SET utf8mb4 NULL,
    `CurrencyId` char(64) COLLATE ascii_general_ci NOT NULL,
    `ExtraProperties` longtext CHARACTER SET utf8mb4 NULL,
    `ConcurrencyStamp` varchar(40) CHARACTER SET utf8mb4 NULL,
    `CreationTime` datetime(6) NOT NULL,
    `CreatorId` char(36) COLLATE ascii_general_ci NULL,
    `LastModificationTime` datetime(6) NULL,
    `LastModifierId` char(36) COLLATE ascii_general_ci NULL,
    `TenantId` char(36) COLLATE ascii_general_ci NULL,
    `Remark` varchar(3072) CHARACTER SET utf8mb4 NULL,
    CONSTRAINT `PK_Basedata_PurchasePriceSheet` PRIMARY KEY (`Id`)
) CHARACTER SET=utf8mb4;


CREATE TABLE `Basedata_SalePriceSheet` (
    `Id` char(36) COLLATE ascii_general_ci NOT NULL,
    `CustomerId` char(64) COLLATE ascii_general_ci NOT NULL,
    `Code` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
    `Name` varchar(64) CHARACTER SET utf8mb4 NULL,
    `Description` varchar(1024) CHARACTER SET utf8mb4 NULL,
    `CurrencyId` char(64) COLLATE ascii_general_ci NOT NULL,
    `ExtraProperties` longtext CHARACTER SET utf8mb4 NULL,
    `ConcurrencyStamp` varchar(40) CHARACTER SET utf8mb4 NULL,
    `CreationTime` datetime(6) NOT NULL,
    `CreatorId` char(36) COLLATE ascii_general_ci NULL,
    `LastModificationTime` datetime(6) NULL,
    `LastModifierId` char(36) COLLATE ascii_general_ci NULL,
    `TenantId` char(36) COLLATE ascii_general_ci NULL,
    `Remark` varchar(3072) CHARACTER SET utf8mb4 NULL,
    CONSTRAINT `PK_Basedata_SalePriceSheet` PRIMARY KEY (`Id`)
) CHARACTER SET=utf8mb4;


CREATE TABLE `Basedata_Shift` (
    `Id` char(36) COLLATE ascii_general_ci NOT NULL,
    `Code` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
    `Name` varchar(64) CHARACTER SET utf8mb4 NULL,
    `Description` varchar(1024) CHARACTER SET utf8mb4 NULL,
    `BeginTime` datetime(6) NULL,
    `EndTime` datetime(6) NULL,
    `EndAtNextDay` tinyint(1) NOT NULL,
    `ExtraProperties` longtext CHARACTER SET utf8mb4 NULL,
    `ConcurrencyStamp` varchar(40) CHARACTER SET utf8mb4 NULL,
    `CreationTime` datetime(6) NOT NULL,
    `CreatorId` char(36) COLLATE ascii_general_ci NULL,
    `LastModificationTime` datetime(6) NULL,
    `LastModifierId` char(36) COLLATE ascii_general_ci NULL,
    `TenantId` char(36) COLLATE ascii_general_ci NULL,
    `Remark` varchar(3072) CHARACTER SET utf8mb4 NULL,
    CONSTRAINT `PK_Basedata_Shift` PRIMARY KEY (`Id`)
) CHARACTER SET=utf8mb4;


CREATE TABLE `Basedata_StdCostPriceSheet` (
    `Id` char(36) COLLATE ascii_general_ci NOT NULL,
    `Code` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
    `Name` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
    `SupplierId` char(36) COLLATE ascii_general_ci NOT NULL,
    `Description` varchar(1024) CHARACTER SET utf8mb4 NULL,
    `CurrencyId` char(64) COLLATE ascii_general_ci NOT NULL,
    `ExtraProperties` longtext CHARACTER SET utf8mb4 NULL,
    `ConcurrencyStamp` varchar(40) CHARACTER SET utf8mb4 NULL,
    `CreationTime` datetime(6) NOT NULL,
    `CreatorId` char(36) COLLATE ascii_general_ci NULL,
    `LastModificationTime` datetime(6) NULL,
    `LastModifierId` char(36) COLLATE ascii_general_ci NULL,
    `TenantId` char(36) COLLATE ascii_general_ci NULL,
    `Remark` varchar(3072) CHARACTER SET utf8mb4 NULL,
    CONSTRAINT `PK_Basedata_StdCostPriceSheet` PRIMARY KEY (`Id`)
) CHARACTER SET=utf8mb4;


CREATE TABLE `Basedata_Supplier` (
    `Id` char(36) COLLATE ascii_general_ci NOT NULL,
    `Code` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
    `Name` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
    `ShortName` varchar(64) CHARACTER SET utf8mb4 NULL,
    `Address` varchar(1024) CHARACTER SET utf8mb4 NULL,
    `Country` varchar(64) CHARACTER SET utf8mb4 NULL,
    `City` varchar(64) CHARACTER SET utf8mb4 NULL,
    `Phone` varchar(64) CHARACTER SET utf8mb4 NULL,
    `Fax` varchar(64) CHARACTER SET utf8mb4 NULL,
    `PostID` varchar(64) CHARACTER SET utf8mb4 NULL,
    `Contacts` varchar(64) CHARACTER SET utf8mb4 NULL,
    `Bank` varchar(64) CHARACTER SET utf8mb4 NULL,
    `Currency` varchar(64) CHARACTER SET utf8mb4 NULL,
    `TaxRate` decimal(18,6) NOT NULL,
    `IsActive` tinyint(1) NOT NULL DEFAULT TRUE,
    `Type` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
    `ExtraProperties` longtext CHARACTER SET utf8mb4 NULL,
    `ConcurrencyStamp` varchar(40) CHARACTER SET utf8mb4 NULL,
    `CreationTime` datetime(6) NOT NULL,
    `CreatorId` char(36) COLLATE ascii_general_ci NULL,
    `LastModificationTime` datetime(6) NULL,
    `LastModifierId` char(36) COLLATE ascii_general_ci NULL,
    `TenantId` char(36) COLLATE ascii_general_ci NULL,
    `Remark` varchar(3072) CHARACTER SET utf8mb4 NULL,
    CONSTRAINT `PK_Basedata_Supplier` PRIMARY KEY (`Id`)
) CHARACTER SET=utf8mb4;


CREATE TABLE `Basedata_SupplierItem` (
    `Id` char(36) COLLATE ascii_general_ci NOT NULL,
    `SupplierCode` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
    `SupplierSimpleName` varchar(64) CHARACTER SET utf8mb4 NULL,
    `ItemCode` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
    `ItemName` varchar(64) CHARACTER SET utf8mb4 NULL,
    `SupplierItemCode` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
    `Version` varchar(64) CHARACTER SET utf8mb4 NULL,
    `SupplierPackUom` varchar(64) CHARACTER SET utf8mb4 NULL,
    `SupplierPackQty` decimal(18,6) NOT NULL,
    `QtyPerPallet` decimal(18,6) NOT NULL,
    `ExtraProperties` longtext CHARACTER SET utf8mb4 NULL,
    `ConcurrencyStamp` varchar(40) CHARACTER SET utf8mb4 NULL,
    `CreationTime` datetime(6) NOT NULL,
    `CreatorId` char(36) COLLATE ascii_general_ci NULL,
    `LastModificationTime` datetime(6) NULL,
    `LastModifierId` char(36) COLLATE ascii_general_ci NULL,
    `TenantId` char(36) COLLATE ascii_general_ci NULL,
    `Remark` varchar(3072) CHARACTER SET utf8mb4 NULL,
    CONSTRAINT `PK_Basedata_SupplierItem` PRIMARY KEY (`Id`)
) CHARACTER SET=utf8mb4;


CREATE TABLE `Basedata_SupplierTimeWindow` (
    `Id` char(36) COLLATE ascii_general_ci NOT NULL,
    `SupplierCode` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
    `SupplierName` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
    `TimeSlot` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
    `Week` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
    `ExtraProperties` longtext CHARACTER SET utf8mb4 NULL,
    `ConcurrencyStamp` varchar(40) CHARACTER SET utf8mb4 NULL,
    `CreationTime` datetime(6) NOT NULL,
    `CreatorId` char(36) COLLATE ascii_general_ci NULL,
    `LastModificationTime` datetime(6) NULL,
    `LastModifierId` char(36) COLLATE ascii_general_ci NULL,
    `TenantId` char(36) COLLATE ascii_general_ci NULL,
    `Remark` varchar(3072) CHARACTER SET utf8mb4 NULL,
    CONSTRAINT `PK_Basedata_SupplierTimeWindow` PRIMARY KEY (`Id`)
) CHARACTER SET=utf8mb4;


CREATE TABLE `Basedata_Team` (
    `Id` char(36) COLLATE ascii_general_ci NOT NULL,
    `Code` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
    `Name` varchar(64) CHARACTER SET utf8mb4 NULL,
    `Description` varchar(64) CHARACTER SET utf8mb4 NULL,
    `Members` varchar(64) CHARACTER SET utf8mb4 NULL,
    `ExtraProperties` longtext CHARACTER SET utf8mb4 NULL,
    `ConcurrencyStamp` varchar(40) CHARACTER SET utf8mb4 NULL,
    `CreationTime` datetime(6) NOT NULL,
    `CreatorId` char(36) COLLATE ascii_general_ci NULL,
    `LastModificationTime` datetime(6) NULL,
    `LastModifierId` char(36) COLLATE ascii_general_ci NULL,
    `TenantId` char(36) COLLATE ascii_general_ci NULL,
    `Remark` varchar(3072) CHARACTER SET utf8mb4 NULL,
    CONSTRAINT `PK_Basedata_Team` PRIMARY KEY (`Id`)
) CHARACTER SET=utf8mb4;


CREATE TABLE `Basedata_TransactionType` (
    `Id` char(36) COLLATE ascii_general_ci NOT NULL,
    `TransType` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
    `TransSubType` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
    `Description` varchar(1024) CHARACTER SET utf8mb4 NOT NULL,
    `InLocationTypes` varchar(64) CHARACTER SET utf8mb4 NULL,
    `OutLocationTypes` varchar(64) CHARACTER SET utf8mb4 NULL,
    `InLocationAreas` longtext CHARACTER SET utf8mb4 NULL,
    `OutLocationAreas` longtext CHARACTER SET utf8mb4 NULL,
    `ItemStatuses` varchar(64) CHARACTER SET utf8mb4 NULL,
    `ItemTypes` varchar(64) CHARACTER SET utf8mb4 NULL,
    `InInventoryStatuses` varchar(64) CHARACTER SET utf8mb4 NULL,
    `OutInventoryStatuses` varchar(64) CHARACTER SET utf8mb4 NULL,
    `AutoSubmitRequest` tinyint(1) NOT NULL,
    `AutoAgreeRequest` tinyint(1) NOT NULL,
    `AutoHandleRequest` tinyint(1) NOT NULL,
    `AutoCompleteJob` tinyint(1) NOT NULL,
    `DirectCreateNote` tinyint(1) NOT NULL,
    `Enabled` tinyint(1) NOT NULL,
    `ExtraProperties` longtext CHARACTER SET utf8mb4 NULL,
    `ConcurrencyStamp` varchar(40) CHARACTER SET utf8mb4 NULL,
    `CreationTime` datetime(6) NOT NULL,
    `CreatorId` char(36) COLLATE ascii_general_ci NULL,
    `LastModificationTime` datetime(6) NULL,
    `LastModifierId` char(36) COLLATE ascii_general_ci NULL,
    `TenantId` char(36) COLLATE ascii_general_ci NULL,
    `Remark` varchar(3072) CHARACTER SET utf8mb4 NULL,
    CONSTRAINT `PK_Basedata_TransactionType` PRIMARY KEY (`Id`)
) CHARACTER SET=utf8mb4;


CREATE TABLE `Basedata_Uom` (
    `Id` char(36) COLLATE ascii_general_ci NOT NULL,
    `Name` varchar(64) CHARACTER SET utf8mb4 NULL,
    `Code` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
    `Description` varchar(1024) CHARACTER SET utf8mb4 NULL,
    `Type` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
    `ExtraProperties` longtext CHARACTER SET utf8mb4 NULL,
    `ConcurrencyStamp` varchar(40) CHARACTER SET utf8mb4 NULL,
    `CreationTime` datetime(6) NOT NULL,
    `CreatorId` char(36) COLLATE ascii_general_ci NULL,
    `LastModificationTime` datetime(6) NULL,
    `LastModifierId` char(36) COLLATE ascii_general_ci NULL,
    `TenantId` char(36) COLLATE ascii_general_ci NULL,
    `Remark` varchar(3072) CHARACTER SET utf8mb4 NULL,
    CONSTRAINT `PK_Basedata_Uom` PRIMARY KEY (`Id`)
) CHARACTER SET=utf8mb4;


CREATE TABLE `Basedata_Warehouse` (
    `Id` char(36) COLLATE ascii_general_ci NOT NULL,
    `Code` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
    `Name` varchar(64) CHARACTER SET utf8mb4 NULL,
    `Description` varchar(1024) CHARACTER SET utf8mb4 NULL,
    `ExtraProperties` longtext CHARACTER SET utf8mb4 NULL,
    `ConcurrencyStamp` varchar(40) CHARACTER SET utf8mb4 NULL,
    `CreationTime` datetime(6) NOT NULL,
    `CreatorId` char(36) COLLATE ascii_general_ci NULL,
    `LastModificationTime` datetime(6) NULL,
    `LastModifierId` char(36) COLLATE ascii_general_ci NULL,
    `TenantId` char(36) COLLATE ascii_general_ci NULL,
    `Remark` varchar(3072) CHARACTER SET utf8mb4 NULL,
    CONSTRAINT `PK_Basedata_Warehouse` PRIMARY KEY (`Id`)
) CHARACTER SET=utf8mb4;


CREATE TABLE `Basedata_WorkGroup` (
    `Id` char(36) COLLATE ascii_general_ci NOT NULL,
    `Code` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
    `Name` varchar(64) CHARACTER SET utf8mb4 NULL,
    `Description` varchar(1024) CHARACTER SET utf8mb4 NULL,
    `WarehouseCode` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
    `ExtraProperties` longtext CHARACTER SET utf8mb4 NULL,
    `ConcurrencyStamp` varchar(40) CHARACTER SET utf8mb4 NULL,
    `CreationTime` datetime(6) NOT NULL,
    `CreatorId` char(36) COLLATE ascii_general_ci NULL,
    `LastModificationTime` datetime(6) NULL,
    `LastModifierId` char(36) COLLATE ascii_general_ci NULL,
    `TenantId` char(36) COLLATE ascii_general_ci NULL,
    `Remark` varchar(3072) CHARACTER SET utf8mb4 NULL,
    CONSTRAINT `PK_Basedata_WorkGroup` PRIMARY KEY (`Id`)
) CHARACTER SET=utf8mb4;


CREATE TABLE `Basedata_WorkShop` (
    `Id` char(36) COLLATE ascii_general_ci NOT NULL,
    `Code` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
    `Name` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
    `Description` varchar(1024) CHARACTER SET utf8mb4 NULL,
    `ExtraProperties` longtext CHARACTER SET utf8mb4 NULL,
    `ConcurrencyStamp` varchar(40) CHARACTER SET utf8mb4 NULL,
    `CreationTime` datetime(6) NOT NULL,
    `CreatorId` char(36) COLLATE ascii_general_ci NULL,
    `LastModificationTime` datetime(6) NULL,
    `LastModifierId` char(36) COLLATE ascii_general_ci NULL,
    `TenantId` char(36) COLLATE ascii_general_ci NULL,
    `Remark` varchar(3072) CHARACTER SET utf8mb4 NULL,
    CONSTRAINT `PK_Basedata_WorkShop` PRIMARY KEY (`Id`)
) CHARACTER SET=utf8mb4;


CREATE TABLE `Basedata_WorkStation` (
    `Id` char(36) COLLATE ascii_general_ci NOT NULL,
    `Code` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
    `Name` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
    `Description` varchar(1024) CHARACTER SET utf8mb4 NULL,
    `ProductionLineCode` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
    `RawLocationCode` varchar(64) CHARACTER SET utf8mb4 NULL,
    `ProductLocationCode` varchar(64) CHARACTER SET utf8mb4 NULL,
    `Type` varchar(64) CHARACTER SET utf8mb4 NULL,
    `ExtraProperties` longtext CHARACTER SET utf8mb4 NULL,
    `ConcurrencyStamp` varchar(40) CHARACTER SET utf8mb4 NULL,
    `CreationTime` datetime(6) NOT NULL,
    `CreatorId` char(36) COLLATE ascii_general_ci NULL,
    `LastModificationTime` datetime(6) NULL,
    `LastModifierId` char(36) COLLATE ascii_general_ci NULL,
    `TenantId` char(36) COLLATE ascii_general_ci NULL,
    `Remark` varchar(3072) CHARACTER SET utf8mb4 NULL,
    CONSTRAINT `PK_Basedata_WorkStation` PRIMARY KEY (`Id`)
) CHARACTER SET=utf8mb4;


CREATE TABLE `Basedata_DictItem` (
    `Id` char(36) COLLATE ascii_general_ci NOT NULL,
    `MasterId` char(36) COLLATE ascii_general_ci NOT NULL,
    `Code` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
    `Name` varchar(64) CHARACTER SET utf8mb4 NULL,
    `Value` varchar(64) CHARACTER SET utf8mb4 NULL,
    `Description` varchar(1024) CHARACTER SET utf8mb4 NULL,
    `Enabled` tinyint(1) NOT NULL,
    `Remark` varchar(3072) CHARACTER SET utf8mb4 NULL,
    `TenantId` char(36) COLLATE ascii_general_ci NULL,
    `CreationTime` datetime(6) NOT NULL,
    `CreatorId` char(36) COLLATE ascii_general_ci NULL,
    `LastModificationTime` datetime(6) NULL,
    `LastModifierId` char(36) COLLATE ascii_general_ci NULL,
    CONSTRAINT `PK_Basedata_DictItem` PRIMARY KEY (`Id`),
    CONSTRAINT `FK_Basedata_DictItem_Basedata_Dict_MasterId` FOREIGN KEY (`MasterId`) REFERENCES `Basedata_Dict` (`Id`) ON DELETE CASCADE
) CHARACTER SET=utf8mb4;


CREATE UNIQUE INDEX `IX_Basedata_AQL_SupplierCode_ItemCode_FloorQty` ON `Basedata_AQL` (`SupplierCode`, `ItemCode`, `FloorQty`);


CREATE UNIQUE INDEX `IX_Basedata_Area_Code` ON `Basedata_Area` (`Code`);


CREATE UNIQUE INDEX `IX_Basedata_Bom_Product_Component` ON `Basedata_Bom` (`Product`, `Component`);


CREATE UNIQUE INDEX `IX_Basedata_Calendar_Module` ON `Basedata_Calendar` (`Module`);


CREATE UNIQUE INDEX `IX_Basedata_Category_Code` ON `Basedata_Category` (`Code`);


CREATE UNIQUE INDEX `IX_Basedata_Currency_Code` ON `Basedata_Currency` (`Code`);


CREATE UNIQUE INDEX `IX_Basedata_CurrencyExchange_CurrencyId_BasicCurrencyId` ON `Basedata_CurrencyExchange` (`CurrencyId`, `BasicCurrencyId`);


CREATE UNIQUE INDEX `IX_Basedata_Customer_Code` ON `Basedata_Customer` (`Code`);


CREATE UNIQUE INDEX `IX_Basedata_CustomerAddress_Code_CustomerCode` ON `Basedata_CustomerAddress` (`Code`, `CustomerCode`);


CREATE UNIQUE INDEX `IX_Basedata_CustomerItem_CustomerCode_ItemCode` ON `Basedata_CustomerItem` (`CustomerCode`, `ItemCode`);


CREATE UNIQUE INDEX `IX_Basedata_Dict_Code` ON `Basedata_Dict` (`Code`);


CREATE INDEX `IX_Basedata_DictItem_MasterId` ON `Basedata_DictItem` (`MasterId`);


CREATE UNIQUE INDEX `IX_Basedata_Dock_Code` ON `Basedata_Dock` (`Code`);


CREATE UNIQUE INDEX `IX_Basedata_DocumentSetting_Code` ON `Basedata_DocumentSetting` (`Code`);


CREATE UNIQUE INDEX `IX_Basedata_ErpLocation_Code` ON `Basedata_ErpLocation` (`Code`);


CREATE UNIQUE INDEX `IX_Basedata_InterfaceCalendar_Code` ON `Basedata_InterfaceCalendar` (`Code`);


CREATE UNIQUE INDEX `IX_Basedata_ItemBasic_Code` ON `Basedata_ItemBasic` (`Code`);


CREATE UNIQUE INDEX `IX_Basedata_ItemCategory_CategoryCode_ItemCode` ON `Basedata_ItemCategory` (`CategoryCode`, `ItemCode`);


CREATE UNIQUE INDEX `IX_Basedata_ItemGuideBook_ItemCode` ON `Basedata_ItemGuideBook` (`ItemCode`);


CREATE UNIQUE INDEX `IX_Basedata_ItemPack_ItemCode_PackCode` ON `Basedata_ItemPack` (`ItemCode`, `PackCode`);


CREATE UNIQUE INDEX `IX_Basedata_ItemQuality_ItemCode_SupplierCode` ON `Basedata_ItemQuality` (`ItemCode`, `SupplierCode`);


CREATE UNIQUE INDEX `IX_Basedata_ItemSafetyStock_ItemCode_WarehouseCode_StoreRelatio~` ON `Basedata_ItemSafetyStock` (`ItemCode`, `WarehouseCode`, `StoreRelationType`, `StoreValue`);


CREATE UNIQUE INDEX `IX_Basedata_ItemStoreRelation_ItemCode_StoreRelationType_StoreV~` ON `Basedata_ItemStoreRelation` (`ItemCode`, `StoreRelationType`, `StoreValue`);


CREATE UNIQUE INDEX `IX_Basedata_Location_Code` ON `Basedata_Location` (`Code`);


CREATE UNIQUE INDEX `IX_Basedata_LocationGroup_Code` ON `Basedata_LocationGroup` (`Code`);


CREATE UNIQUE INDEX `IX_Basedata_Machine_Code` ON `Basedata_Machine` (`Code`);


CREATE UNIQUE INDEX `IX_Basedata_ProductionLine_Code` ON `Basedata_ProductionLine` (`Code`);


CREATE UNIQUE INDEX `IX_Basedata_ProductionLineItem_ProdLineCode_ItemCode` ON `Basedata_ProductionLineItem` (`ProdLineCode`, `ItemCode`);


CREATE UNIQUE INDEX `IX_Basedata_Project_Code` ON `Basedata_Project` (`Code`);


CREATE UNIQUE INDEX `IX_Basedata_PurchasePriceSheet_Code` ON `Basedata_PurchasePriceSheet` (`Code`);


CREATE UNIQUE INDEX `IX_Basedata_SalePriceSheet_Code_CustomerId` ON `Basedata_SalePriceSheet` (`Code`, `CustomerId`);


CREATE UNIQUE INDEX `IX_Basedata_Shift_Code` ON `Basedata_Shift` (`Code`);


CREATE UNIQUE INDEX `IX_Basedata_StdCostPriceSheet_Code_SupplierId` ON `Basedata_StdCostPriceSheet` (`Code`, `SupplierId`);


CREATE UNIQUE INDEX `IX_Basedata_Supplier_Code` ON `Basedata_Supplier` (`Code`);


CREATE UNIQUE INDEX `IX_Basedata_SupplierItem_SupplierCode_ItemCode` ON `Basedata_SupplierItem` (`SupplierCode`, `ItemCode`);


CREATE UNIQUE INDEX `IX_Basedata_SupplierTimeWindow_SupplierCode_TimeSlot_Week` ON `Basedata_SupplierTimeWindow` (`SupplierCode`, `TimeSlot`, `Week`);


CREATE UNIQUE INDEX `IX_Basedata_Team_Code` ON `Basedata_Team` (`Code`);


CREATE UNIQUE INDEX `IX_Basedata_TransactionType_TransType_TransSubType` ON `Basedata_TransactionType` (`TransType`, `TransSubType`);


CREATE UNIQUE INDEX `IX_Basedata_Uom_Code` ON `Basedata_Uom` (`Code`);


CREATE UNIQUE INDEX `IX_Basedata_Warehouse_Code` ON `Basedata_Warehouse` (`Code`);


CREATE UNIQUE INDEX `IX_Basedata_WorkGroup_Code` ON `Basedata_WorkGroup` (`Code`);


CREATE UNIQUE INDEX `IX_Basedata_WorkShop_Code` ON `Basedata_WorkShop` (`Code`);


CREATE UNIQUE INDEX `IX_Basedata_WorkStation_Code` ON `Basedata_WorkStation` (`Code`);


