-- ============================================
-- 입고 팩/낱장 코드 테이블
-- ============================================

CREATE TABLE IF NOT EXISTS `bag_receiving_pack_code` (
  `brpc_idx` INT UNSIGNED NOT NULL AUTO_INCREMENT,
  `brpc_br_idx` INT UNSIGNED NOT NULL COMMENT 'bag_receiving FK',
  `brpc_lg_idx` INT UNSIGNED NOT NULL,
  `brpc_bag_code` VARCHAR(50) NOT NULL,
  `brpc_bag_name` VARCHAR(100) NOT NULL DEFAULT '',
  `brpc_lot_no` VARCHAR(50) NOT NULL DEFAULT '',
  `brpc_box_code` VARCHAR(80) NOT NULL DEFAULT '',
  `brpc_pack_code` VARCHAR(80) NOT NULL,
  `brpc_sheet_start_code` VARCHAR(120) NOT NULL,
  `brpc_sheet_end_code` VARCHAR(120) NOT NULL,
  `brpc_sheet_qty` INT UNSIGNED NOT NULL DEFAULT 0,
  `brpc_state` VARCHAR(20) NOT NULL DEFAULT 'in_stock',
  `brpc_regdate` DATETIME NOT NULL,
  PRIMARY KEY (`brpc_idx`),
  UNIQUE KEY `uk_brpc_pack_code` (`brpc_pack_code`),
  KEY `idx_brpc_br_idx` (`brpc_br_idx`),
  KEY `idx_brpc_lg_bag` (`brpc_lg_idx`, `brpc_bag_code`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='입고 팩/낱장 코드';
