/**
Source Server Version: 8.0.31
Source Database: backendsys
Date: 2023/08/18 12:51:10
*/

DROP TABLE IF EXISTS `b2c_warehouse_operation_record`;
CREATE TABLE `b2c_warehouse_operation_record` (
    PRIMARY KEY (`id`),
    `id` BIGINT AUTO_INCREMENT COMMENT 'ID',
    `warehouse_id` BIGINT NOT NULL COMMENT '仓库ID',
    `warehouse_shelf_id` BIGINT NOT NULL COMMENT '货位ID',
    `good_id` BIGINT NOT NULL COMMENT '商品ID',
    `stock` BIGINT NOT NULL COMMENT '库存',
    `operation_type` TINYINT(1) NOT NULL COMMENT '操作类型 (1入库, 2出库)',
    `reason` TINYINT(1) NOT NULL COMMENT '操作原因 ((入库) 1采购进货, 2退货入库, 3赠品入库, 4转移入库；(出库) 1销售出库, 2报废出库, 3赠品出库, 4转移出库)',
    `user_id` BIGINT NOT NULL COMMENT '系统用户ID (操作人)',
    `notes` VARCHAR(200) COMMENT '备注',
    `create_time` DATETIME DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
    `update_time` DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间'
) ENGINE=INNODB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COMMENT='仓库操作记录表';

INSERT INTO b2c_warehouse_operation_record(warehouse_id, warehouse_shelf_id, good_id, stock, operation_type, reason, user_id, notes) VALUES
    (1, 1, 1, 10, 2, 1, 1, 'Out sell'),
    (1, 1, 1, 20, 2, 2, 1, 'Out scrap'),
    (1, 1, 1, 50, 1, 1, 1, 'In buy'),
    (1, 1, 1, 88, 1, 3, 1, 'In gift')
;
