-- 未入库不合格品的直接采购退货;不生成库存出入库,也不占用已入库退货数量。 CREATE TABLE IF NOT EXISTS `mes_qc_purchase_return` ( `id` bigint NOT NULL AUTO_INCREMENT, `code` varchar(64) NOT NULL, `ncr_id` bigint NOT NULL, `iqc_id` bigint NOT NULL, `notice_id` bigint NOT NULL, `notice_line_id` bigint NOT NULL, `purchase_order_id` bigint NOT NULL, `purchase_order_item_id` bigint NOT NULL, `vendor_id` bigint NOT NULL, `item_id` bigint NOT NULL, `vendor_batch` varchar(100) DEFAULT NULL, `quantity` decimal(20,4) NOT NULL, `status` tinyint NOT NULL DEFAULT 0 COMMENT '0待仓库退货 1已确认退货', `confirmed_by` bigint DEFAULT NULL, `confirmed_at` datetime DEFAULT NULL, `confirmation_remark` varchar(500) DEFAULT NULL, `creator` varchar(64) DEFAULT '', `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, `updater` varchar(64) DEFAULT '', `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `deleted` bit(1) NOT NULL DEFAULT b'0', `tenant_id` bigint NOT NULL DEFAULT 0, PRIMARY KEY (`id`), UNIQUE KEY `uk_qc_purchase_return_ncr` (`ncr_id`), UNIQUE KEY `uk_qc_purchase_return_iqc` (`iqc_id`), KEY `idx_qc_purchase_return_order_item` (`purchase_order_item_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='待入库来料不合格采购退货';