28 lines
1.0 KiB
SQL
28 lines
1.0 KiB
SQL
|
|
-- bs.inventoryDiscrepancy definition
|
|
USE bs;
|
|
|
|
CREATE TABLE `inventoryDiscrepancy` (
|
|
`id` int(11) NOT NULL AUTO_INCREMENT,
|
|
`warehouseFk` int(11) NOT NULL,
|
|
`timed` timestamp NOT NULL DEFAULT current_timestamp(),
|
|
`alert` int(11) NOT NULL DEFAULT 0,
|
|
`quantity` int(11) NOT NULL,
|
|
PRIMARY KEY (`id`)
|
|
) ENGINE=InnoDB
|
|
COMMENT='This table collects the discrepancies between theorical inventory and located items';
|
|
|
|
-- bs.inventoryDiscrepancyDetail definition
|
|
|
|
CREATE TABLE `inventoryDiscrepancyDetail` (
|
|
`id` int(11) NOT NULL AUTO_INCREMENT,
|
|
`warehouseFk` int(11) NOT NULL,
|
|
`itemFk` int(11) NOT NULL,
|
|
`theorical` int(11) DEFAULT NULL COMMENT 'theorical stock: purchases vs. sales',
|
|
`visible` int(11) DEFAULT NULL COMMENT 'located stock',
|
|
`notPicked` int(11) DEFAULT NULL COMMENT 'sales not picked yet',
|
|
`alert` int(11) DEFAULT NULL COMMENT 'alert level for this discrepancy',
|
|
PRIMARY KEY (`id`),
|
|
UNIQUE KEY `inventoryDiscrepancyDetail_UN` (`warehouseFk`,`itemFk`)
|
|
) ENGINE=InnoDB
|
|
COMMENT='Last discrepancies'; |