ALTER DATABASE CHARACTER SET utf8mb4;


CREATE TABLE `Inventory_Balance` (
    `Id` char(36) COLLATE ascii_general_ci NOT NULL,
    `PackingCode` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
    `ItemName` varchar(64) CHARACTER SET utf8mb4 NULL,
    `ItemDesc1` varchar(64) CHARACTER SET utf8mb4 NULL,
    `ItemDesc2` varchar(64) CHARACTER SET utf8mb4 NULL,
    `ItemCode` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
    `SupplierBatch` varchar(64) CHARACTER SET utf8mb4 NULL,
    `ArriveDate` datetime(6) NOT NULL,
    `ProduceDate` datetime(6) NOT NULL,
    `ExpireDate` datetime(6) NOT NULL,
    `Lot` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
    `SerialNumber` varchar(64) CHARACTER SET utf8mb4 NULL,
    `Uom` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
    `Qty` decimal(18,6) NOT NULL,
    `StdPackQty` decimal(18,6) NOT NULL,
    `Status` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
    `WarehouseCode` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
    `LocationCode` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
    `LocationArea` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
    `LocationGroup` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
    `LocationErpCode` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
    `PutInTime` datetime(6) NOT NULL,
    `ContainerCode` varchar(64) CHARACTER SET utf8mb4 NULL,
    `LastCountTime` datetime(6) NOT NULL,
    `LastCountPlanNumber` varchar(64) CHARACTER SET utf8mb4 NULL,
    `LastCountLabel` varchar(64) CHARACTER SET utf8mb4 NULL,
    `IsActive` tinyint(1) NOT NULL DEFAULT FALSE,
    `ManageType` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
    `LastTransType` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
    `LastTransNumber` 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_Inventory_Balance` PRIMARY KEY (`Id`)
) CHARACTER SET=utf8mb4;


CREATE TABLE `Inventory_Container` (
    `Id` char(36) COLLATE ascii_general_ci NOT NULL,
    `ContainerCode` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
    `LocationCode` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
    `Type` varchar(64) CHARACTER SET utf8mb4 NULL,
    `Capacity` decimal(18,6) NOT NULL,
    `ProjectCode` longtext CHARACTER SET utf8mb4 NULL,
    `SeqNo` longtext CHARACTER SET utf8mb4 NULL,
    `BusinessStatus` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
    `Status` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
    `WarehouseCode` 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,
    `Worker` longtext CHARACTER SET utf8mb4 NULL,
    `Number` longtext CHARACTER SET utf8mb4 NULL,
    CONSTRAINT `PK_Inventory_Container` PRIMARY KEY (`Id`)
) CHARACTER SET=utf8mb4;


CREATE TABLE `Inventory_ErpBalance` (
    `Id` char(36) COLLATE ascii_general_ci NOT NULL,
    `ItemCode` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
    `Lot` varchar(64) CHARACTER SET utf8mb4 NULL,
    `Uom` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
    `Qty` decimal(18,6) NOT NULL,
    `Status` varchar(255) CHARACTER SET utf8mb4 NOT NULL,
    `LocationCode` 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_Inventory_ErpBalance` PRIMARY KEY (`Id`)
) CHARACTER SET=utf8mb4;


CREATE TABLE `Inventory_ExpectIn` (
    `Id` char(36) COLLATE ascii_general_ci NOT NULL,
    `PackingCode` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
    `ItemName` varchar(64) CHARACTER SET utf8mb4 NULL,
    `ItemDesc1` varchar(64) CHARACTER SET utf8mb4 NULL,
    `ItemDesc2` varchar(64) CHARACTER SET utf8mb4 NULL,
    `ItemCode` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
    `SupplierBatch` varchar(64) CHARACTER SET utf8mb4 NULL,
    `ArriveDate` datetime(6) NOT NULL,
    `ProduceDate` datetime(6) NOT NULL,
    `ExpireDate` datetime(6) NOT NULL,
    `Lot` varchar(64) CHARACTER SET utf8mb4 NULL,
    `SerialNumber` varchar(64) CHARACTER SET utf8mb4 NULL,
    `Status` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
    `Uom` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
    `Qty` decimal(18,6) NOT NULL,
    `JobNumber` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
    `LocationCode` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
    `LocationArea` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
    `LocationGroup` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
    `LocationErpCode` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
    `ContainerCode` 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_Inventory_ExpectIn` PRIMARY KEY (`Id`)
) CHARACTER SET=utf8mb4;


CREATE TABLE `Inventory_ExpectOut` (
    `Id` char(36) COLLATE ascii_general_ci NOT NULL,
    `PackingCode` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
    `ItemName` varchar(64) CHARACTER SET utf8mb4 NULL,
    `ItemDesc1` varchar(64) CHARACTER SET utf8mb4 NULL,
    `ItemDesc2` varchar(64) CHARACTER SET utf8mb4 NULL,
    `ItemCode` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
    `SupplierBatch` varchar(64) CHARACTER SET utf8mb4 NULL,
    `ArriveDate` datetime(6) NOT NULL,
    `ProduceDate` datetime(6) NOT NULL,
    `ExpireDate` datetime(6) NOT NULL,
    `Lot` varchar(64) CHARACTER SET utf8mb4 NULL,
    `SerialNumber` varchar(64) CHARACTER SET utf8mb4 NULL,
    `Uom` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
    `Qty` decimal(18,6) NOT NULL,
    `Status` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
    `LocationCode` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
    `LocationArea` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
    `LocationGroup` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
    `LocationErpCode` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
    `JobNumber` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
    `ContainerCode` 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_Inventory_ExpectOut` PRIMARY KEY (`Id`)
) CHARACTER SET=utf8mb4;


CREATE TABLE `Inventory_LocationCapacity` (
    `Id` char(36) COLLATE ascii_general_ci NOT NULL,
    `LocationCode` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
    `UsedCapacity` decimal(18,6) NOT NULL,
    `AvailableCapacity` decimal(18,6) NOT NULL,
    `BearableOverloadCapacity` decimal(18,6) NOT NULL,
    `IsInfinity` 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_Inventory_LocationCapacity` PRIMARY KEY (`Id`)
) CHARACTER SET=utf8mb4;


CREATE TABLE `Inventory_Snapshot` (
    `Id` char(36) COLLATE ascii_general_ci NOT NULL,
    `SnapshotDate` datetime(6) NOT NULL,
    `SnapshotTime` datetime(6) NOT NULL,
    `PackingCode` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
    `ItemName` varchar(64) CHARACTER SET utf8mb4 NULL,
    `ItemDesc1` varchar(64) CHARACTER SET utf8mb4 NULL,
    `ItemDesc2` varchar(64) CHARACTER SET utf8mb4 NULL,
    `ItemCode` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
    `SupplierBatch` varchar(64) CHARACTER SET utf8mb4 NULL,
    `ArriveDate` datetime(6) NOT NULL,
    `ProduceDate` datetime(6) NOT NULL,
    `ExpireDate` datetime(6) NOT NULL,
    `Lot` varchar(64) CHARACTER SET utf8mb4 NULL,
    `SerialNumber` varchar(64) CHARACTER SET utf8mb4 NULL,
    `Uom` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
    `Qty` decimal(18,6) NOT NULL,
    `Status` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
    `LocationCode` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
    `LocationArea` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
    `LocationGroup` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
    `LocationErpCode` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
    `PutInTime` datetime(6) NOT NULL,
    `ContainerCode` 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_Inventory_Snapshot` PRIMARY KEY (`Id`)
) CHARACTER SET=utf8mb4;


CREATE TABLE `Inventory_Transaction` (
    `Id` char(36) COLLATE ascii_general_ci NOT NULL,
    `TransNumber` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
    `TransType` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
    `TransSubType` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
    `TransInOut` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
    `PackingCode` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
    `ItemName` varchar(64) CHARACTER SET utf8mb4 NULL,
    `ItemDesc1` varchar(64) CHARACTER SET utf8mb4 NULL,
    `ItemDesc2` varchar(64) CHARACTER SET utf8mb4 NULL,
    `ItemCode` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
    `SupplierBatch` varchar(64) CHARACTER SET utf8mb4 NULL,
    `ArriveDate` datetime(6) NOT NULL,
    `ProduceDate` datetime(6) NOT NULL,
    `ExpireDate` datetime(6) NOT NULL,
    `Lot` varchar(64) CHARACTER SET utf8mb4 NULL,
    `Uom` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
    `Qty` decimal(18,6) NOT NULL,
    `StdPackQty` decimal(18,6) NOT NULL,
    `Status` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
    `WarehouseCode` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
    `LocationCode` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
    `LocationArea` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
    `LocationGroup` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
    `LocationErpCode` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
    `ContainerCode` varchar(64) CHARACTER SET utf8mb4 NULL,
    `ActiveDate` datetime(6) NOT NULL,
    `TransTime` datetime(6) NOT NULL,
    `Worker` varchar(64) CHARACTER SET utf8mb4 NULL,
    `JobNumber` varchar(64) CHARACTER SET utf8mb4 NULL,
    `DocNumber` varchar(64) CHARACTER SET utf8mb4 NULL,
    `ManageType` 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_Inventory_Transaction` PRIMARY KEY (`Id`)
) CHARACTER SET=utf8mb4;


CREATE TABLE `Inventory_TransferLog` (
    `Id` char(36) COLLATE ascii_general_ci NOT NULL,
    `TransferNumber` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
    `FromPackingCode` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
    `ToPackingCode` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
    `ItemName` varchar(64) CHARACTER SET utf8mb4 NULL,
    `ItemDesc1` varchar(64) CHARACTER SET utf8mb4 NULL,
    `ItemDesc2` varchar(64) CHARACTER SET utf8mb4 NULL,
    `ItemCode` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
    `Uom` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
    `Qty` decimal(18,6) NOT NULL,
    `StdPackQty` decimal(18,6) NOT NULL,
    `FromTransNumber` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
    `SupplierBatch` varchar(64) CHARACTER SET utf8mb4 NULL,
    `ArriveDate` datetime(6) NOT NULL,
    `ProduceDate` datetime(6) NOT NULL,
    `ExpireDate` datetime(6) NOT NULL,
    `FromLot` varchar(64) CHARACTER SET utf8mb4 NULL,
    `FromStatus` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
    `FromWarehouseCode` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
    `FromLocationCode` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
    `FromLocationArea` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
    `FromLocationGroup` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
    `FromLocationErpCode` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
    `FromContainerCode` varchar(64) CHARACTER SET utf8mb4 NULL,
    `ToTransNumber` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
    `ToLot` varchar(64) CHARACTER SET utf8mb4 NULL,
    `ToStatus` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
    `ToWarehouseCode` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
    `ToLocationCode` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
    `ToLocationArea` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
    `ToLocationGroup` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
    `ToLocationErpCode` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
    `ToContainerCode` varchar(64) CHARACTER SET utf8mb4 NULL,
    `TransType` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
    `TransSubType` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
    `ActiveDate` datetime(6) NOT NULL,
    `TransferTime` datetime(6) NOT NULL,
    `Worker` varchar(64) CHARACTER SET utf8mb4 NULL,
    `JobNumber` varchar(64) CHARACTER SET utf8mb4 NULL,
    `DocNumber` 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_Inventory_TransferLog` PRIMARY KEY (`Id`)
) CHARACTER SET=utf8mb4;


CREATE TABLE `Inventory_ContainerDetail` (
    `Id` char(36) COLLATE ascii_general_ci NOT NULL,
    `ContainerCode` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
    `PackingCode` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
    `ItemName` varchar(64) CHARACTER SET utf8mb4 NULL,
    `ItemDesc1` varchar(64) CHARACTER SET utf8mb4 NULL,
    `ItemDesc2` varchar(64) CHARACTER SET utf8mb4 NULL,
    `ItemCode` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
    `SupplierBatch` varchar(64) CHARACTER SET utf8mb4 NULL,
    `ArriveDate` datetime(6) NOT NULL,
    `ProduceDate` datetime(6) NOT NULL,
    `ExpireDate` datetime(6) NOT NULL,
    `Lot` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
    `Uom` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
    `Qty` decimal(18,6) NOT NULL,
    `Status` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
    `Year` longtext CHARACTER SET utf8mb4 NULL,
    `ProductNo` longtext CHARACTER SET utf8mb4 NULL,
    `ProjectCode` longtext CHARACTER SET utf8mb4 NULL,
    `Position` longtext CHARACTER SET utf8mb4 NULL,
    `SeqNo` longtext 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,
    `MasterID` char(36) COLLATE ascii_general_ci NOT NULL,
    `TenantId` char(36) COLLATE ascii_general_ci NULL,
    `Number` longtext CHARACTER SET utf8mb4 NULL,
    `Remark` varchar(3072) CHARACTER SET utf8mb4 NULL,
    CONSTRAINT `PK_Inventory_ContainerDetail` PRIMARY KEY (`Id`),
    CONSTRAINT `FK_Inventory_ContainerDetail_Inventory_Container_MasterID` FOREIGN KEY (`MasterID`) REFERENCES `Inventory_Container` (`Id`) ON DELETE CASCADE
) CHARACTER SET=utf8mb4;


CREATE UNIQUE INDEX `IX_Inventory_Balance_PackingCode_Status_LocationCode_ItemCode_L~` ON `Inventory_Balance` (`PackingCode`, `Status`, `LocationCode`, `ItemCode`, `Lot`, `ContainerCode`);


CREATE UNIQUE INDEX `IX_Inventory_Container_ContainerCode` ON `Inventory_Container` (`ContainerCode`);


CREATE INDEX `IX_Inventory_ContainerDetail_MasterID` ON `Inventory_ContainerDetail` (`MasterID`);


CREATE UNIQUE INDEX `IX_Inventory_ContainerDetail_PackingCode_Lot_ItemCode` ON `Inventory_ContainerDetail` (`PackingCode`, `Lot`, `ItemCode`);


CREATE UNIQUE INDEX `IX_Inventory_ErpBalance_ItemCode_Lot_LocationCode_Status` ON `Inventory_ErpBalance` (`ItemCode`, `Lot`, `LocationCode`, `Status`);


CREATE UNIQUE INDEX `IX_Inventory_ExpectIn_PackingCode_LocationCode_ItemCode_JobNumb~` ON `Inventory_ExpectIn` (`PackingCode`, `LocationCode`, `ItemCode`, `JobNumber`);


CREATE UNIQUE INDEX `IX_Inventory_ExpectOut_PackingCode_Status_ItemCode_LocationCode~` ON `Inventory_ExpectOut` (`PackingCode`, `Status`, `ItemCode`, `LocationCode`, `Lot`, `JobNumber`);


CREATE UNIQUE INDEX `IX_Inventory_LocationCapacity_LocationCode` ON `Inventory_LocationCapacity` (`LocationCode`);


CREATE UNIQUE INDEX `IX_Inventory_Snapshot_SnapshotDate_SnapshotTime_PackingCode` ON `Inventory_Snapshot` (`SnapshotDate`, `SnapshotTime`, `PackingCode`);


CREATE UNIQUE INDEX `IX_Inventory_Transaction_TransNumber` ON `Inventory_Transaction` (`TransNumber`);


CREATE UNIQUE INDEX `IX_Inventory_TransferLog_TransferNumber` ON `Inventory_TransferLog` (`TransferNumber`);


