-
Notifications
You must be signed in to change notification settings - Fork 0
/
4.仓库表_script.py
44 lines (36 loc) · 1.39 KB
/
4.仓库表_script.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import random
import codecs
import time
# 定义数据源
ent_list = ['彭高镇天花运输有限责任公司','鸡冠山乡吉祥运输公司','东源乡如意运输有限公司','杨岐乡吉祥运输有限公司']
name1_list = ['总厂','药厂','分厂','原料厂','']
name2_list = ['库房','原料仓库','成品仓库','仓库']
name3_list = ['101-1','96-1','101-2','98栋','(虚拟仓库)']
# 获取数组数据长度
lens1 = len(name1_list)-1
lens2 = len(name2_list)-1
lens3 = len(name3_list)-1
lensent = len(ent_list)-1
f = open('4.仓库表数据_data_1000.csv', 'w',encoding='UTF-8')
r = 0
stock_id = 40000000000000000000000000000000
start = time.mktime((2000,1,1,0,0,0,0,0,0)) #生成开始时间戳
end = time.mktime((2017,12,31,23,59,59,0,0,0)) #生成结束时间戳
while r <= 2001:
r += 1
stock_id += 1
entrn = random.randint(0, lensent)
name1rn = random.randint(0, lens1)
name2rn = random.randint(0, lens2)
name3rn = random.randint(0, lens3)
ent = ent_list[entrn]
name1 = name1_list[name1rn]
name2 = name2_list[name2rn]
name3 = name3_list[name3rn]
name = name1 + name2 + name3
stockmax = random.randint(500, 3000)
usedate = time.strftime("%Y-%m-%d", time.localtime(random.randint(start, end)))
print(name)
f.writelines('\n'+'"'+str(stock_id)+'","'+name+'","'+ent+'","'+usedate+'","'+str(stockmax)+'"')
f.flush()
f.close()