update
This commit is contained in:
parent
85d0f12859
commit
f114130891
|
@ -88,7 +88,7 @@ class CMAViewSet(ModelViewSet):
|
|||
os.chdir(fulldir)
|
||||
rar.extractall()
|
||||
rar.close()
|
||||
CMA.objects.filter(type='sub').delete()
|
||||
# CMA.objects.filter(type='sub').delete()
|
||||
for root, dirs, files in os.walk(fulldir):
|
||||
for f in files:
|
||||
if f.endswith('.xls'):
|
||||
|
@ -98,7 +98,7 @@ class CMAViewSet(ModelViewSet):
|
|||
fulldir = fullpath.replace('.zip','')
|
||||
os.mkdir(fulldir)
|
||||
os.chdir(fulldir)
|
||||
CMA.objects.filter(type='sub').delete()
|
||||
# CMA.objects.filter(type='sub').delete()
|
||||
with zipfile.ZipFile(fullpath,'r') as zzz:
|
||||
zzz.extractall(fulldir)
|
||||
for root, dirs, files in os.walk(fulldir):
|
||||
|
@ -220,6 +220,8 @@ def import_cma2(filename, path):
|
|||
sheet = wb.worksheets[0]
|
||||
datalist = []
|
||||
sszx = filename.split('-')[0]
|
||||
if CMA.objects.filter(sszx=sszx, type='sub').exists():
|
||||
CMA.objects.filter(sszx=sszx, type='sub').delete()
|
||||
i = 3
|
||||
max_row = sheet.max_row
|
||||
while i<max_row+1:
|
||||
|
|
Loading…
Reference in New Issue