def getaccountbookId(self): self.request = request.Httpcommon() domain = self.domainUrl() accountbookDict = {} url = domain + "chanjet/" + self.appName + "/restlet/v2/web/accountbook/FindAll" reslut = json.loads(self.request.request("GET", url, data=None)) if "resultObj" in str(reslut): for i in range(len(reslut["resultObj"])): bookName = str(reslut["resultObj"][i]["bookName"]) bookId = str(reslut["resultObj"][i]["id"]) accountbookDict[bookName] = {} accountbookDict[bookName]["bookId"] = bookId else: print "获取账套信息失败", reslut return accountbookDict[self.sheetbooknamePath]["bookId"]
def getBalanceInitList(self): self.request = request.Httpcommon() domain = self.domainUrl() subjectDict = {} accountbookId = self.getaccountbookId() url = domain + "chanjet/" + self.appName + "/restlet/v2/web/balance/GetBalanceInitList?ACCOUNTBOOK=" + str( accountbookId) result = json.loads(self.request.request("GET", url, data=None)) if 'resultObj' in str(result): for i in range(len(result["resultObj"])): subjectName = str(result["resultObj"][i]["subjectText"]) subjectId = result["resultObj"][i]["id"] subjectDir = result["resultObj"][i]["dir"] subjectLeaf = result["resultObj"][i]["subjectLeaf"] subjectNo = result["resultObj"][i]["subjectNo"] subjectDict[subjectNo] = {} subjectDict[subjectNo]["subjectId"] = subjectId subjectDict[subjectNo]["subjectDir"] = subjectDir subjectDict[subjectNo]["subjectName"] = subjectName return subjectDict else: print "getBalanceInitListERROR", result return 1
def __init__(self): self.request = request.Httpcommon()
def __init__(self): self.request = request.Httpcommon() self.sheetbooknamePath = "演示账套" self.appName = "accounting"