mirror of
https://github.com/bcomsugi/dasaproject.git
synced 2026-01-10 07:12:37 +07:00
accomodate blank column
This commit is contained in:
parent
15e510124e
commit
fcdd70c6cc
@ -108,7 +108,19 @@ def read_DN_excel(filename):
|
||||
if not None and row[0]=="Item No" :
|
||||
if firstpage:
|
||||
# print('firstpage')
|
||||
data.append(row)
|
||||
if len(row)==5:
|
||||
data.append(row)
|
||||
elif len(row)>5:
|
||||
temp_ =[]
|
||||
for _ in row:
|
||||
if _ != None:
|
||||
temp_.append(_)
|
||||
if len(row)==5:
|
||||
data.append(temp_)
|
||||
else:
|
||||
print("HEADER ERROR!!!")
|
||||
data.append(['Item No', 'Description', 'QuantityUOM', 'No.SO/Ext.Doc.No.', 'LPN No.'])
|
||||
|
||||
boldataline=True
|
||||
firstpage=False
|
||||
# continue
|
||||
@ -130,7 +142,8 @@ def read_DN_excel(filename):
|
||||
movetonextpage=True
|
||||
continue
|
||||
elif row[3] is not None:
|
||||
if row[3].startswith('Hormat'):
|
||||
# if row[3].startswith('Hormat'):
|
||||
if 'Hormat Kami,' in row:
|
||||
# print('hormatkami found')
|
||||
boldataline=False
|
||||
movetonextpage=True
|
||||
@ -140,7 +153,8 @@ def read_DN_excel(filename):
|
||||
else:
|
||||
data.append(row)
|
||||
elif row[3] is not None:
|
||||
if row[3].startswith('Hormat'):
|
||||
# if row[3].startswith('Hormat'):
|
||||
if 'Hormat Kami,' in row:
|
||||
boldataline=False
|
||||
movetonextpage=True
|
||||
# continue
|
||||
@ -159,25 +173,29 @@ def read_DN_excel(filename):
|
||||
if col == "":
|
||||
data[idx][colidx]=None
|
||||
coly=0
|
||||
lenList = 0
|
||||
xylist=[]
|
||||
for idx, x in enumerate(data):
|
||||
print(idx, x)
|
||||
xylist=[]
|
||||
if len(x)>5 and (idx % 2)==1 :
|
||||
print(idx,x)
|
||||
lenList = len(x)
|
||||
for idy, y in enumerate(x):
|
||||
if y == None:
|
||||
coly=idy
|
||||
|
||||
else:
|
||||
xylist.append(y)
|
||||
if len(xylist)==5:
|
||||
data[idx]=xylist
|
||||
elif coly !=0:
|
||||
elif coly != 0 and lenList == len(x):
|
||||
for idy, y in enumerate(x):
|
||||
if idy!=coly:
|
||||
xylist.append(y)
|
||||
data[idx]=xylist
|
||||
coly=0
|
||||
lenList = 0
|
||||
print(idx, data[idx])
|
||||
|
||||
print(f'len data={len(data)}')
|
||||
@ -188,7 +206,7 @@ def read_DN_excel(filename):
|
||||
templist=[]
|
||||
for idx, dt in enumerate(data):
|
||||
if dt[0] != 'Item No':
|
||||
# print(idx,'not item')
|
||||
# print(idx,'not item', dt)
|
||||
if dt[0] is None:
|
||||
if dt[1]:
|
||||
templist[1]+=" " + dt[1]
|
||||
@ -207,10 +225,11 @@ def read_DN_excel(filename):
|
||||
dt.append(uom)
|
||||
dt[2]=int(dt[2].split(".")[0])
|
||||
templist=dt
|
||||
print(templist)
|
||||
# print(templist)
|
||||
|
||||
for idx, x in enumerate(newdata):
|
||||
print(idx, x)
|
||||
pass
|
||||
# print(idx, x)
|
||||
print(f'len newdata={len(newdata)}')
|
||||
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user