mirror of
https://github.com/bcomsugi/dasaproject.git
synced 2026-01-09 15:32:38 +07:00
fix bug on generalsummaryreportquery and add datarow
This commit is contained in:
parent
f0b1362ad6
commit
99f75ce012
@ -76,7 +76,7 @@ class GeneralSummaryReportQuery(baseQBQuery):
|
||||
print(f'{kwargs = }')
|
||||
super().__init__( )
|
||||
## Required variable
|
||||
self.includeRetElements_allowed = ["ReportTitle", "ReportSubtitle", "ReportBasis", "NumRows", "NumColumns", "NumColTitleRows", "ReportData", ]
|
||||
self.includeRetElements_allowed = ["ReportTitle", "ReportSubtitle", "ReportBasis", "NumRows", "NumColumns", "NumColTitleRows", "ReportData", "DataRow"]
|
||||
self.onError = "stopOnError"
|
||||
self.retName = 'ReportRet'
|
||||
self.defaultFilterKey = "ListID"
|
||||
@ -97,7 +97,7 @@ class GeneralSummaryReportQuery(baseQBQuery):
|
||||
if 'GeneralSummaryReportType' in kwargs:
|
||||
enum=cleanIncludeRetElements(self.ENUM_GeneralSummaryReportType, kwargs['GeneralSummaryReportType'])
|
||||
print(enum)
|
||||
self.QBDict[self.classRq]["GeneralSummaryReportType"]=enum[0]
|
||||
self.QBDict[self.classNameRq]["GeneralSummaryReportType"]=enum[0]
|
||||
else:
|
||||
print("Error -> GeneralSummaryReportType is required")
|
||||
return
|
||||
@ -1094,6 +1094,58 @@ class InvoiceQuery(baseQBQuery):
|
||||
self.runCheck() ### running the qbxml connection to get data ###
|
||||
|
||||
|
||||
@timing
|
||||
def InventoryStockStatusByVendor() -> dict:
|
||||
# g= GeneralSummaryReportQuery(debug=False, GeneralSummaryReportType="ProfitAndLossStandard", ReportDateMacro="ThisYear")
|
||||
g= GeneralSummaryReportQuery(debug=False, GeneralSummaryReportType="InventoryStockStatusByVendor", ReportEntityFilter_FullName='TACO', )
|
||||
# g= GeneralSummaryReportQuery(debug=False, GeneralSummaryReportType="InventoryStockStatusByVendor", ReportItemFilter_FullName=['TACH:RLC:BBS009PO45-500','TACH:RLC:BBS009PO45-400'], ReportEntityFilter_FullName='TACO' )
|
||||
print(g, type(g))
|
||||
# print(type(g.all()))
|
||||
# print(g.all())
|
||||
# print(g.response_string)
|
||||
# print(g.all())
|
||||
# pprint.pprint(g.filter("reportdata").all())
|
||||
# abc = g.filter("reportdata").all()
|
||||
# print(abc)
|
||||
# print()
|
||||
# pprint.pprint(g.filter('datarow').all(abc), sort_dicts=False)
|
||||
datarows = g.filter('datarow').all()
|
||||
# pprint.pprint(datarows, sort_dicts=False)
|
||||
# print(type(datarows))
|
||||
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}
|
||||
# print(f'{dt = }')
|
||||
# print(len(dt))
|
||||
return dt
|
||||
"""
|
||||
{'@rowNumber': '1016',
|
||||
'ColData': [{'@colID': '1',
|
||||
'@value': 'EDG-P1251-1/42'},
|
||||
{'@colID': '2',
|
||||
'@value': 'EDGING 42 X 1 MM P1251'},
|
||||
{'@colID': '5', '@value': '1'}, # QOH
|
||||
{'@colID': '6', '@value': '0'}, # QOSO
|
||||
{'@colID': '7', '@value': '0'}, #assembly
|
||||
{'@colID': '8', '@value': '1'}, # QA(available)(QOH-QOSO-assembly)
|
||||
{'@colID': '9', '@value': 'Roll'}, #base_uom
|
||||
{'@colID': '10', '@value': 'false'},
|
||||
{'@colID': '11', '@value': '0'}, #QOPO
|
||||
{'@colID': '12', '@value': '0'}, #ReorderPoint
|
||||
{'@colID': '14', '@value': '0'}],
|
||||
'RowData': {'@rowType': 'item',
|
||||
'@value': 'TEDG:P142:EDG-P1251-1/42'}},
|
||||
"""
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
@timing
|
||||
|
||||
11
main.py
11
main.py
@ -18,7 +18,7 @@ import pdfexcel4DNwithxlrd
|
||||
from ItemInventoryQuery import ItemInventoryQuery
|
||||
from SO_to_Inv import readSO, CustomerQuery
|
||||
import os
|
||||
from QBClass.QBClasses import SalesOrderAdd
|
||||
from QBClass.QBClasses import SalesOrderAdd, InventoryStockStatusByVendor
|
||||
|
||||
import pprint
|
||||
|
||||
@ -85,6 +85,15 @@ async def get_customer_fullname(maxreturned:Union[int, None] = None):
|
||||
else:
|
||||
return {'Info': f"NOT Saved", 'Status':'ERROR', 'msg':data}
|
||||
|
||||
@app.get('/get-inventorystockstatusbyvendor')
|
||||
async def get_inventorystockstatusbyvendor():
|
||||
items = InventoryStockStatusByVendor()
|
||||
|
||||
if items:
|
||||
data = json.dumps(items)
|
||||
return data
|
||||
else:
|
||||
return {'Info': f"CANNOT Get InventoryStockStatusByVendor TACO", 'Status':'ERROR', 'msg':items}
|
||||
|
||||
@app.post("/upload-file/")
|
||||
async def create_upload_file(uploaded_file: UploadFile):
|
||||
|
||||
Loading…
Reference in New Issue
Block a user