/*M!999999\- enable the sandbox mode */ 
-- MariaDB dump 10.19  Distrib 10.11.14-MariaDB, for debian-linux-gnu (x86_64)
--
-- Host: localhost    Database: wms_pro
-- ------------------------------------------------------
-- Server version	10.11.14-MariaDB-0ubuntu0.24.04.1

/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;

--
-- Table structure for table `warehouse_zones`
--

DROP TABLE IF EXISTS `warehouse_zones`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `warehouse_zones` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `warehouse_id` int(10) unsigned NOT NULL,
  `code` varchar(20) NOT NULL,
  `name` varchar(100) NOT NULL,
  `zone_type` enum('RECEIVING','STORAGE','PICKING','SHIPPING','QA','STAGING','RETURNS','DAMAGE') NOT NULL DEFAULT 'STORAGE',
  `is_active` tinyint(1) NOT NULL DEFAULT 1,
  `is_auction` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Zona para productos de remate',
  `is_export` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Zona para productos de exportacion',
  `putaway_priority` int(11) NOT NULL DEFAULT 5 COMMENT 'Prioridad para sugerencia de putaway (1=preferida)',
  `created_at` datetime NOT NULL DEFAULT current_timestamp(),
  `updated_at` datetime NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  PRIMARY KEY (`id`),
  UNIQUE KEY `uq_zone_code` (`warehouse_id`,`code`),
  KEY `idx_zone_auction` (`is_auction`),
  KEY `idx_zone_export` (`is_export`),
  KEY `idx_zone_putaway_pri` (`putaway_priority`),
  CONSTRAINT `fk_zones_warehouse` FOREIGN KEY (`warehouse_id`) REFERENCES `warehouses` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=52 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Zonas lógicas dentro de un almacén';
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `warehouse_zones`
--

LOCK TABLES `warehouse_zones` WRITE;
/*!40000 ALTER TABLE `warehouse_zones` DISABLE KEYS */;
INSERT INTO `warehouse_zones` VALUES
(20,16,'CEN-LIC','Licitaciones-Terceros-Exportación','STORAGE',1,0,0,5,'2026-05-06 19:30:07','2026-05-06 19:30:07'),
(21,16,'CEN-MP','Materia Prima','STORAGE',1,0,0,5,'2026-05-06 19:30:07','2026-05-06 19:30:07'),
(22,16,'CEN-IN','Insumos','STORAGE',1,0,0,5,'2026-05-06 19:30:07','2026-05-06 19:30:07'),
(23,16,'CEN-PT','Productos Terminados','STORAGE',1,0,0,5,'2026-05-06 19:30:07','2026-05-06 19:30:07'),
(25,16,'OPT','OPTICA','STORAGE',1,0,0,5,'2026-05-06 19:49:41','2026-05-06 19:49:41'),
(28,16,'CEN-MPP','Materia Prima - Pequeñas','STORAGE',1,0,0,5,'2026-05-12 20:11:49','2026-05-12 20:11:49'),
(31,16,'CEN-CO','Controlados','STORAGE',1,0,0,5,'2026-05-12 20:11:49','2026-05-12 20:11:49'),
(36,16,'PIC-COSM','PICKING COSMETICOS','PICKING',1,0,0,5,'2026-05-14 16:25:12','2026-05-14 16:25:12'),
(37,16,'PIC-CTRL','PICKING CONTROLADOS','PICKING',1,0,0,5,'2026-05-14 16:25:12','2026-05-14 16:25:12'),
(38,16,'PIC-DIS','PICKING DISP','PICKING',1,0,0,5,'2026-05-14 16:25:12','2026-05-14 16:25:12'),
(39,16,'PIC-FITO','PICKING FITO','PICKING',1,0,0,5,'2026-05-14 16:25:12','2026-05-14 16:25:12'),
(40,16,'PIC-MM','PICKING MUESTRAS','PICKING',1,0,0,5,'2026-05-14 16:25:12','2026-05-14 16:25:12'),
(41,16,'PIC-RX','PICKING RX','PICKING',1,0,0,5,'2026-05-14 16:25:12','2026-05-14 16:25:12'),
(42,16,'PIC-SUP','PICKING SUPLEMENTOS','PICKING',1,0,0,5,'2026-05-14 16:25:12','2026-05-14 16:25:12'),
(43,16,'PK-OTC','PICKING OTC','PICKING',1,0,0,5,'2026-05-14 16:25:12','2026-05-14 16:25:12'),
(44,16,'PK-OTX','PICKING OTX','PICKING',1,0,0,5,'2026-05-14 16:25:12','2026-05-14 16:25:12'),
(45,16,'PK-RX','PICKING RX','PICKING',1,0,0,5,'2026-06-20 21:25:00','2026-06-20 21:25:00'),
(46,16,'PK-CRTL','PICKING CONTROL','PICKING',1,0,0,5,'2026-06-20 21:25:00','2026-06-20 21:25:00'),
(47,16,'PK-COSM','PICKING COSMETICOS','PICKING',1,0,0,5,'2026-06-20 21:25:00','2026-06-20 21:25:00'),
(48,16,'PK-DIS','PICKING DISP','PICKING',1,0,0,5,'2026-06-20 21:25:00','2026-06-20 21:25:00'),
(49,16,'PK-MM','PICKING MUESTRAS','PICKING',1,0,0,5,'2026-06-20 21:25:00','2026-06-20 21:25:00'),
(50,16,'PK-FITO','PICKING FITO','PICKING',1,0,0,5,'2026-06-20 21:25:00','2026-06-20 21:25:00'),
(51,16,'PK-SUPL','PICKING SUPLEMENTO','PICKING',1,0,0,5,'2026-06-20 21:25:00','2026-06-20 21:25:00');
/*!40000 ALTER TABLE `warehouse_zones` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `picking_min_levels`
--

DROP TABLE IF EXISTS `picking_min_levels`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `picking_min_levels` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `item_id` int(10) unsigned NOT NULL,
  `zone_id` int(10) unsigned NOT NULL,
  `min_qty` decimal(15,4) NOT NULL,
  `target_qty` decimal(15,4) DEFAULT NULL,
  `is_active` tinyint(1) NOT NULL DEFAULT 1,
  `created_by` int(10) unsigned DEFAULT NULL,
  `created_at` datetime NOT NULL DEFAULT current_timestamp(),
  `updated_at` datetime NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  PRIMARY KEY (`id`),
  UNIQUE KEY `uk_item_zone` (`item_id`,`zone_id`),
  KEY `k_item` (`item_id`),
  KEY `k_zone` (`zone_id`)
) ENGINE=InnoDB AUTO_INCREMENT=51 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `picking_min_levels`
--

LOCK TABLES `picking_min_levels` WRITE;
/*!40000 ALTER TABLE `picking_min_levels` DISABLE KEYS */;
INSERT INTO `picking_min_levels` VALUES
(1,325,43,500.0000,NULL,1,1,'2026-06-08 23:22:14','2026-06-08 23:22:14'),
(2,331,43,510.0000,NULL,1,1,'2026-06-08 23:22:14','2026-06-08 23:22:14'),
(3,339,44,792.0000,NULL,1,1,'2026-06-08 23:22:14','2026-06-08 23:22:14'),
(4,345,44,1800.0000,NULL,1,1,'2026-06-08 23:22:14','2026-06-08 23:22:14'),
(5,347,44,640.0000,NULL,1,1,'2026-06-08 23:22:14','2026-06-08 23:22:14'),
(6,360,43,332.0000,NULL,1,1,'2026-06-08 23:22:14','2026-06-08 23:22:14'),
(7,365,43,60.0000,NULL,1,1,'2026-06-08 23:22:14','2026-06-08 23:22:14'),
(8,382,44,880.0000,NULL,1,1,'2026-06-08 23:22:14','2026-06-08 23:22:14'),
(9,392,44,400.0000,NULL,1,1,'2026-06-08 23:22:14','2026-06-08 23:22:14'),
(10,2994,41,340.0000,NULL,1,1,'2026-06-08 23:22:14','2026-06-08 23:22:14'),
(11,3009,44,504.0000,NULL,1,1,'2026-06-08 23:22:14','2026-06-08 23:22:14'),
(12,3016,44,1200.0000,NULL,1,1,'2026-06-08 23:22:14','2026-06-08 23:22:14'),
(13,3018,41,680.0000,NULL,1,1,'2026-06-08 23:22:14','2026-06-08 23:22:14'),
(14,3019,41,200.0000,NULL,1,1,'2026-06-08 23:22:14','2026-06-08 23:22:14'),
(15,3020,41,600.0000,NULL,1,1,'2026-06-08 23:22:14','2026-06-08 23:22:14'),
(16,3021,44,1200.0000,NULL,1,1,'2026-06-08 23:22:14','2026-06-08 23:22:14'),
(17,3022,41,680.0000,NULL,1,1,'2026-06-08 23:22:14','2026-06-08 23:22:14'),
(18,3023,44,480.0000,NULL,1,1,'2026-06-08 23:22:14','2026-06-08 23:22:14'),
(19,3024,44,1200.0000,NULL,1,1,'2026-06-08 23:22:14','2026-06-08 23:22:14'),
(20,3026,41,800.0000,NULL,1,1,'2026-06-08 23:22:14','2026-06-08 23:22:14'),
(21,3027,44,2160.0000,NULL,1,1,'2026-06-08 23:22:14','2026-06-08 23:22:14'),
(22,3029,41,680.0000,NULL,1,1,'2026-06-08 23:22:14','2026-06-08 23:22:14'),
(23,3031,41,640.0000,NULL,1,1,'2026-06-08 23:22:14','2026-06-08 23:22:14'),
(24,3034,44,1800.0000,NULL,1,1,'2026-06-08 23:22:14','2026-06-08 23:22:14'),
(25,3035,44,378.0000,NULL,1,1,'2026-06-08 23:22:14','2026-06-08 23:22:14'),
(26,3038,44,960.0000,NULL,1,1,'2026-06-08 23:22:14','2026-06-08 23:22:14'),
(27,3039,41,1360.0000,NULL,1,1,'2026-06-08 23:22:14','2026-06-08 23:22:14'),
(28,3041,41,680.0000,NULL,1,1,'2026-06-08 23:22:14','2026-06-08 23:22:14'),
(29,3042,41,680.0000,NULL,1,1,'2026-06-08 23:22:14','2026-06-08 23:22:14'),
(30,3043,41,680.0000,NULL,1,1,'2026-06-08 23:22:14','2026-06-08 23:22:14'),
(31,3044,41,680.0000,NULL,1,1,'2026-06-08 23:22:14','2026-06-08 23:22:14'),
(32,3047,44,480.0000,NULL,1,1,'2026-06-08 23:22:14','2026-06-08 23:22:14'),
(33,3048,41,640.0000,NULL,1,1,'2026-06-08 23:22:14','2026-06-08 23:22:14'),
(34,3049,41,640.0000,NULL,1,1,'2026-06-08 23:22:14','2026-06-08 23:22:14'),
(35,3051,41,640.0000,NULL,1,1,'2026-06-08 23:22:14','2026-06-08 23:22:14'),
(36,3056,44,1600.0000,NULL,1,1,'2026-06-08 23:22:14','2026-06-08 23:22:14'),
(37,3057,44,360.0000,NULL,1,1,'2026-06-08 23:22:14','2026-06-08 23:22:14'),
(38,3060,44,1360.0000,NULL,1,1,'2026-06-08 23:22:14','2026-06-08 23:22:14'),
(39,3065,44,2640.0000,NULL,1,1,'2026-06-08 23:22:14','2026-06-08 23:22:14'),
(40,3066,44,340.0000,NULL,1,1,'2026-06-08 23:22:14','2026-06-08 23:22:14'),
(41,3072,41,640.0000,NULL,1,1,'2026-06-08 23:22:14','2026-06-08 23:22:14'),
(42,3073,44,68.0000,NULL,1,1,'2026-06-08 23:22:14','2026-06-08 23:22:14'),
(43,3081,41,640.0000,NULL,1,1,'2026-06-08 23:22:14','2026-06-08 23:22:14'),
(44,3082,41,400.0000,NULL,1,1,'2026-06-08 23:22:14','2026-06-08 23:22:14'),
(45,3083,41,360.0000,NULL,1,1,'2026-06-08 23:22:14','2026-06-08 23:22:14'),
(46,3084,41,400.0000,NULL,1,1,'2026-06-08 23:22:14','2026-06-08 23:22:14'),
(47,3086,41,680.0000,NULL,1,1,'2026-06-08 23:22:14','2026-06-08 23:22:14'),
(48,58185,41,680.0000,NULL,1,1,'2026-06-08 23:22:14','2026-06-08 23:22:14'),
(49,72371,43,240.0000,NULL,1,1,'2026-06-08 23:22:14','2026-06-08 23:22:14');
/*!40000 ALTER TABLE `picking_min_levels` ENABLE KEYS */;
UNLOCK TABLES;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;

/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;

-- Dump completed on 2026-06-20 21:36:40
