et-06. fix reading uom with empty column in excel

This commit is contained in:
Sugiarto 2024-02-02 20:03:51 +07:00
parent c0de7cc45b
commit 9c93b4de13
2 changed files with 13 additions and 6 deletions

View File

@ -179,12 +179,9 @@ def read_DN_excel(filename):
else: else:
data.append(row) data.append(row)
# print (f'data: {data}') print (f'data: {data}')
for idx, x in enumerate(data): for idx, x in enumerate(data):
if x[0].upper() == "ET-06/A1.": ### Change the source from "ET-06/A1." to "ET-06/A1.BOX_100" and replace the UOM from "BOX_100" to "BOX"
x[0] = "ET-06/A1.BOX_100"
x[2] = x[2].replace("BOX_100", "BOX")
for colidx, col in enumerate(x): ### change the empty cell into None for colidx, col in enumerate(x): ### change the empty cell into None
if col == "": if col == "":
data[idx][colidx]=None data[idx][colidx]=None
@ -229,6 +226,13 @@ def read_DN_excel(filename):
print(f'len data={len(data)}') print(f'len data={len(data)}')
for idx, x in enumerate(data):
# print(idx, x)
if x[0] !=None and x[0].upper() == "ET-06/A1.": ### Change the source from "ET-06/A1." to "ET-06/A1.BOX_100" and replace the UOM from "BOX_100" to "BOX"
print(idx, x)
x[0] = "ET-06/A1.BOX_100"
x[2] = x[2].replace("BOX_100", "BOX")
print(idx, x)
newdata=[] newdata=[]

View File

@ -229,6 +229,7 @@ class PurchaseOrderQuery:
_bolfoundrefnum=False _bolfoundrefnum=False
_bol_dictisadded=False _bol_dictisadded=False
Error_msg = None Error_msg = None
for poidx, _po in enumerate(self.PurchaseOrderList): for poidx, _po in enumerate(self.PurchaseOrderList):
if _po['RefNumber']==_dict['RefNum']: if _po['RefNumber']==_dict['RefNum']:
_bolfoundrefnum=True _bolfoundrefnum=True
@ -303,7 +304,9 @@ class PurchaseOrderQuery:
else: else:
_dflist = self.dfDN.to_dict('records') _dflist = self.dfDN.to_dict('records')
# print(self.dfDN) # print(self.dfDN)
# print(f'_dflist:{_dflist}') # print(f'_dflist1:{_dflist}')
# print("")
# print(f'self.PurchaseOrderList: {self.PurchaseOrderList}')
for idx, xdf in enumerate(_dflist): for idx, xdf in enumerate(_dflist):
_boladdDN, _Errormsg = self.addDNQtyToPurchaseOrderList(xdf) _boladdDN, _Errormsg = self.addDNQtyToPurchaseOrderList(xdf)
# print(f'prepareItemReceipt->_Errormsg:{_Errormsg}') # print(f'prepareItemReceipt->_Errormsg:{_Errormsg}')
@ -341,7 +344,7 @@ class PurchaseOrderQuery:
else: else:
dnlist = self.DN dnlist = self.DN
df = pd.DataFrame(dnlist) df = pd.DataFrame(dnlist)
# print(df) print(f'df from dnlist: {df}')
df['RefNum']= df['No.SO'].apply(lambda x: "L"+ x.split("L-")[1]) df['RefNum']= df['No.SO'].apply(lambda x: "L"+ x.split("L-")[1])
# print(df) # print(df)
ext_doc_no=df['RefNum'].unique().tolist() ext_doc_no=df['RefNum'].unique().tolist()