InventoryStockStatusByVendor updated

This commit is contained in:
bcomsugi 2024-10-03 07:26:41 +07:00
parent 99f75ce012
commit b1f313f4fe
2 changed files with 28 additions and 12 deletions

View File

@ -1095,11 +1095,11 @@ class InvoiceQuery(baseQBQuery):
@timing
def InventoryStockStatusByVendor() -> dict:
def InventoryStockStatusByVendor(ReportEntityFilter_FullName:str='TACO') -> dict:
# g= GeneralSummaryReportQuery(debug=False, GeneralSummaryReportType="ProfitAndLossStandard", ReportDateMacro="ThisYear")
g= GeneralSummaryReportQuery(debug=False, GeneralSummaryReportType="InventoryStockStatusByVendor", ReportEntityFilter_FullName='TACO', )
g= GeneralSummaryReportQuery(debug=False, GeneralSummaryReportType="InventoryStockStatusByVendor", ReportEntityFilter_FullName=ReportEntityFilter_FullName, )
# g= GeneralSummaryReportQuery(debug=False, GeneralSummaryReportType="InventoryStockStatusByVendor", ReportItemFilter_FullName=['TACH:RLC:BBS009PO45-500','TACH:RLC:BBS009PO45-400'], ReportEntityFilter_FullName='TACO' )
print(g, type(g))
# print(g, type(g))
# print(type(g.all()))
# print(g.all())
# print(g.response_string)
@ -1113,17 +1113,32 @@ def InventoryStockStatusByVendor() -> dict:
# pprint.pprint(datarows, sort_dicts=False)
# print(type(datarows))
dt = {}
if len(datarows[0]['DataRow'])==0:
return dt
for datarow in datarows[0]['DataRow']:
# print(datarow,)
FullName=datarow['RowData']['@value']
if len(FullName.split(':'))==3:
ShortName=datarow['ColData'][0]['@value']
QOH=datarow['ColData'][2]['@value']
QOSO=datarow['ColData'][3]['@value']
QA=datarow['ColData'][5]['@value']
UOM=datarow['ColData'][6]['@value']
QOPO=datarow['ColData'][8]['@value']
dt[FullName]={'ShortName':ShortName, 'QOH':QOH, 'QOSO':QOSO, 'QA':QA, 'QOPO':QOPO, 'UOM':UOM}
QOH, QOSO, QA, UOM, QOPO, min, max, ND = None, None, None, None, None, None, None, None
for coldata in datarow['ColData']:
if coldata['@colID']=='5':
QOH=coldata['@value']
elif coldata['@colID']=='6':
QOSO=coldata['@value']
elif coldata['@colID']=='8':
QA=coldata['@value']
elif coldata['@colID']=='9':
UOM=coldata['@value']
elif coldata['@colID']=='11':
QOPO=coldata['@value']
elif coldata['@colID']=='3':
min=coldata['@value']
elif coldata['@colID']=='4':
max=coldata['@value']
elif coldata['@colID']=='13':
ND=coldata['@value'] #Next Delivery Date
dt[FullName]={'ShortName':ShortName, 'QOH':QOH, 'QOSO':QOSO, 'QA':QA, 'QOPO':QOPO, 'UOM':UOM, 'min':min, 'max':max, 'ND':ND}
# print(f'{dt = }')
# print(len(dt))
return dt
@ -1140,7 +1155,8 @@ def InventoryStockStatusByVendor() -> dict:
{'@colID': '9', '@value': 'Roll'}, #base_uom
{'@colID': '10', '@value': 'false'},
{'@colID': '11', '@value': '0'}, #QOPO
{'@colID': '12', '@value': '0'}, #ReorderPoint
{'@colID': '12', '@value': '0'}, #ReorderqTY
{'@colID': '13', '@value': '13/04/2022'}, #NextDeliver
{'@colID': '14', '@value': '0'}],
'RowData': {'@rowType': 'item',
'@value': 'TEDG:P142:EDG-P1251-1/42'}},

View File

@ -90,8 +90,8 @@ async def get_inventorystockstatusbyvendor():
items = InventoryStockStatusByVendor()
if items:
data = json.dumps(items)
return data
# data = json.dumps(items)
return items
else:
return {'Info': f"CANNOT Get InventoryStockStatusByVendor TACO", 'Status':'ERROR', 'msg':items}