const { DataTypes, Model, Op } = require('../../azeroth').sequelize; const sequelize = require("../class/db").sequelize; const Table = {}; Table.insert = async (shelveId, row, column) => { let data = await sequelize.query( "INSERT INTO stock_log(user_id, `username`, shelve_id, `row`, `column`, `order_num`, `content`, `preoperation_pic`, `overoperation_pic`, `create_time`) VALUES ( 1, 'wong', '"+ shelveId +"', "+ row +", "+column+", 'SRM015_60246', '{\"old_status\":0,\"new_status\":2,\"new_category\":\"dianshi\",\"new_count\":22}', '2021/03/19/15/3ff16124-be04-4e1a-bbd8-37c9e4cf0878.jpg', '2021/03/19/15/e0fcca5b-66df-4b11-b165-803998125e27.jpg', '2021-03-19 21:39:28');"); } Table.insertSocket = async (shelveId, row, column, status) => { let data = await sequelize.query(`INSERT INTO \`lipo_duoji\`.\`stock\`(\`order_num\`, \`category\`, \`count\`, \`shelve_id\`, \`row\`, \`column\`, \`status\`, \`preoperation_pic\`, \`overoperation_pic\`, \`export_time\`) VALUES ('SRM015_60246', '女装-上装-外套', 500, '${shelveId}', ${row}, ${column}, '${status}', '2021/03/19/15/3ff16124-be04-4e1a-bbd8-37c9e4cf0878.jpg', '2021/03/19/15/e0fcca5b-66df-4b11-b165-803998125e27.jpg', '2021-10-18 11:27:32'); `) } // Table.insert(1,1,1) // for(let shelveId = 1; shelveId <=10; shelveId++) { // if([8].indexOf(shelveId) > -1) { // for(let row = 70; row <=100; row++) { // for(let column = 1; column <=100; column++) { // Table.insert(shelveId, row, column) // } // } // } // } // Table.insertSocket(1, 1, 15, 1) for(let shelveId = 1; shelveId <=10; shelveId++) { if([1,2,4,6,7,8].indexOf(shelveId) > -1) { for(let i=0; i<100;i++) { let row = parseInt(Math.random() * 100); let column = parseInt(Math.random() * 100); let status = Math.random() > 0.2 ? 2 : 1; Table.insertSocket(shelveId, row, column, status) } } }