# 盘点单码表 DROP TABLE IF EXISTS `inv_count_codes`; CREATE TABLE `inv_count_codes` ( `id` int(0) NOT NULL AUTO_INCREMENT COMMENT 'id', `orderIdFk` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '盘点单ID', `productId` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '产品ID', `code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '码', `status` tinyint(1) NULL DEFAULT NULL COMMENT '条码状态(多码或少码) 0:少 1:多', PRIMARY KEY (`id`) USING BTREE ) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '盘点单据码表' ROW_FORMAT = Dynamic; # 盘点单据表 DROP TABLE IF EXISTS `inv_count_order`; CREATE TABLE `inv_count_order` ( `id` int(0) NOT NULL AUTO_INCREMENT COMMENT 'id', `orderId` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '盘点单号', `invStorageCode` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '仓库号', `invWarehouseCode` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '分库号', `invSpaceCode` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '货位号', `createUser` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '盘点用户ID', `createTime` datetime(0) NULL DEFAULT NULL COMMENT '创建时间', `updateTime` datetime(0) NULL DEFAULT NULL COMMENT '更新时间', `auditUser` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '审核用户ID', `auditTime` datetime(0) NULL DEFAULT NULL COMMENT '审核时间', `status` tinyint(1) NULL DEFAULT NULL COMMENT '状态', `remark` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '备注字段', `inOrderIds` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '入库扫码单据号,多个使用 , 隔开', `outOrderIds` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '出库扫码单据号,多个使用 , 隔开', `countType` tinyint(1) NULL DEFAULT NULL COMMENT '盘点类型,0:整库盘点 1:按货位盘点 2:部分盘点', PRIMARY KEY (`id`) USING BTREE ) ENGINE = InnoDB AUTO_INCREMENT = 10 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '盘点单据表' ROW_FORMAT = Dynamic; SET FOREIGN_KEY_CHECKS = 1; # 盘点单据详情表 DROP TABLE IF EXISTS `inv_count_order_detail`; CREATE TABLE `inv_count_order_detail` ( `id` int(0) NOT NULL AUTO_INCREMENT COMMENT 'id', `orderIdFk` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '盘点单号', `productId` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '产品ID', `nameCode` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '产品DI', `batchNo` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '批次号', `produceDate` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '生产日期', `expireDate` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '失效日期', `serialNo` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '序列号', `countNum` int(0) NULL DEFAULT NULL COMMENT '盘点数量', `invNum` int(0) NULL DEFAULT NULL COMMENT '账面数量', `profitNum` int(0) NULL DEFAULT NULL COMMENT '盘盈数量', `lossNum` int(0) NULL DEFAULT NULL COMMENT '盘亏数量', `status` tinyint(1) NULL DEFAULT NULL COMMENT '盈亏状态 0:亏损 1:盈利', PRIMARY KEY (`id`) USING BTREE ) ENGINE = InnoDB AUTO_INCREMENT = 5 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '盘点单详情' ROW_FORMAT = Dynamic; SET FOREIGN_KEY_CHECKS = 1; # 货位字典表 DROP TABLE IF EXISTS `inv_space`; CREATE TABLE `inv_space` ( `id` int(0) NOT NULL AUTO_INCREMENT COMMENT 'ID', `code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '货位码', `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '货位名称', `type` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '货位分类', `invStorageCode` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '所属仓库', `invWarehouseCode` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '所属分库', `status` tinyint(1) NULL DEFAULT NULL COMMENT '状态', `createTime` datetime(0) NULL DEFAULT NULL COMMENT '创建时间', `updateTime` datetime(0) NULL DEFAULT NULL COMMENT '更新时间', `createUser` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '创建人', `updateUser` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '更新人', `remark` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '备注', PRIMARY KEY (`id`) USING BTREE ) ENGINE = InnoDB AUTO_INCREMENT = 6 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '货位字典表' ROW_FORMAT = Dynamic; SET FOREIGN_KEY_CHECKS = 1; # 库存详情表添加货位号字段 ALTER TABLE `udiwms`.`inv_product_detail` ADD COLUMN `invSpaceCode` varchar(255) NULL COMMENT '货位号' AFTER `invWarehouseCode`; # 盘点设置表 DROP TABLE IF EXISTS `inv_count_setting`; CREATE TABLE `inv_count_setting` ( `id` int(0) NOT NULL AUTO_INCREMENT COMMENT 'ID', `inAction` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '盘点入库转单类型', `outAction` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '盘点出库转单类型', PRIMARY KEY (`id`) USING BTREE ) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '盘点设置表' ROW_FORMAT = Dynamic; SET FOREIGN_KEY_CHECKS = 1; # 盘点码表添加批次号字段 ALTER TABLE `udiwms`.`inv_count_codes` ADD COLUMN `batchNo` varchar(255) NULL COMMENT '批次号' AFTER `status`; ALTER TABLE `udiwms`.`inv_count_codes` ADD COLUMN `count` int NULL COMMENT '扫码数量' AFTER `batchNo`;