2024-01-15 11:31:03 +00:00
|
|
|
DELIMITER $$
|
2024-08-20 08:06:10 +00:00
|
|
|
CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`catalog_componentPrepare`()
|
2024-01-15 11:31:03 +00:00
|
|
|
BEGIN
|
|
|
|
|
|
|
|
DROP TEMPORARY TABLE IF EXISTS tmp.ticketComponent;
|
|
|
|
CREATE TEMPORARY TABLE tmp.ticketComponent (
|
|
|
|
`warehouseFk` INT UNSIGNED NOT NULL,
|
|
|
|
`itemFk` INT NOT NULL,
|
|
|
|
`componentFk` INT UNSIGNED NOT NULL,
|
|
|
|
`cost` DECIMAL(10,4) NOT NULL,
|
|
|
|
INDEX `itemWarehouse` USING BTREE (`itemFk` ASC, `warehouseFk` ASC),
|
|
|
|
UNIQUE `fkItemWarehouseComponent` (`itemFk` ASC, `warehouseFk` ASC, `componentFk` ASC)
|
|
|
|
)ENGINE=MEMORY DEFAULT CHARSET=utf8;
|
|
|
|
|
|
|
|
DROP TEMPORARY TABLE IF EXISTS tmp.ticketComponentPrice;
|
|
|
|
CREATE TEMPORARY TABLE tmp.ticketComponentPrice (
|
|
|
|
`warehouseFk` INT UNSIGNED NOT NULL,
|
|
|
|
`itemFk` INT NOT NULL,
|
|
|
|
`rate` INT NOT NULL,
|
|
|
|
`grouping` INT UNSIGNED NOT NULL,
|
|
|
|
`price` DECIMAL(10,4) NOT NULL,
|
|
|
|
`priceKg` DECIMAL(10,4),
|
|
|
|
INDEX `itemWarehouse` USING BTREE (`itemFk` ASC, `warehouseFk` ASC),
|
|
|
|
UNIQUE `fkItemWarehouseRate` (`itemFk` ASC, `warehouseFk` ASC, `rate` ASC)
|
|
|
|
)ENGINE=MEMORY DEFAULT CHARSET=utf8;
|
|
|
|
END$$
|
|
|
|
DELIMITER ;
|