1 2 3 4 5 6 7 8 9 10 11 12 13 14
| CREATE DEFINER=`root`@`localhost` PROCEDURE `insert_storage_goods`(IN total BIGINT) BEGIN DECLARE start_key BIGINT DEFAULT 0; DECLARE max_id BIGINT DEFAULT 0; SELECT COUNT(1) into max_id from product; WHILE start_key<total DO SET max_id=max_id+1; INSERT INTO `r_sku_storage_goods`(`sku_id`, `storage_id`, `section_id`, `bin_id`, `goods_identity_code`, `processing_plan_receipt_id`, `batch_number`, `expiry_date`, `production_date`, `status`, `purchase_price`, `trace_storage_id`, `consume_time`, `settlement_time`, `create_user`, `create_time`, `update_user`, `update_time`, `remark`) VALUES (FLOOR( 500 + RAND() * (550 - 500)), FLOOR( 800 + RAND() * (1000 - 800)), 0, 0, UUID_SHORT(), 110, DATE_FORMAT(DATE_SUB(now(), INTERVAL FLOOR(RAND() * 1095) DAY),'%Y%m%d'), '2030-08-01', '2020-07-01', 1, 3000.00, 0, NULL, NULL, 12, now(), 12, now(), NULL); SET start_key=start_key+1; COMMIT; END WHILE; END
|