accounting/accounting/excep.py
2024-07-31 16:16:21 +08:00

122 lines
3.4 KiB
Python

###################
#exceptions for accounting
####################
class AccountIdNone(Exception):
def __init__(self, accounting_orgid, orgid, subjectname):
self.accounting_orgid = accounting_orgid
self.orgid = orgid
self.subjectname = subjectname
def __str__(self):
return f'AccountIdNone({self.accounting_orgid=}, {self.orgid=}, {self.subjectname=}'
def __expr__(self):
return str(self)
class AccountingAmountIsNone(Exception):
def __init__(self, billid):
self.billid = billid
def __str__(self):
return f'AccountingAmountIsNone({self.billid=}) accounting amount is None'
def __expr__(self):
return str(self)
class AccountOverDraw(Exception):
def __init__(self, accid, balance, transamt):
self.accid = accid
self.balance = balance
self.transamt = transamt
def __str__(self):
return f'AccountOverDraw({self.accid=},{self.balance=}, {self.transamt=}) overdraw'
def __expr__(self):
return str(self)
class AccountNoFound(Exception):
def __init__(self, accid):
self.accid = accid
def __str__(self):
return f'Account({self.accid}) not found'
def __expr__(self):
return str(self)
class OrderNotFound(Exception):
def __init__(self, orderid):
self.orderid = orderid
def __str__(self):
return f'Order({self.orderid}) not found'
def __expr__(self):
return str(self)
class BusinessDateParamsError(Exception):
pass
class AccountingDateNotInBusinessDate(Exception):
def __init__(self, accounting_date, business_date):
self.accounting_date = accounting_date
self.business_date = business_date
def __str__(self):
return f'Accounting date({self.accounting_date}) not in business_date({self.business_date})'
def __expr__(self):
return str(self)
class FutureAccountingExist(Exception):
def __init__(self, accid, accounting_date, future_date):
self.accid = accid
self.accounting_date = accounting_date
self.future_date = future_date
def __str__(self):
return f'Account(id={self.accid}) in acc_balance exist future({self.future_date}) accounting record, curdate={self.accounting_date}'
def __expr__(self):
return str(self)
class GetCustomerPriceError(Exception):
def __init__(self, accounting_orgid, orgid, productid):
self.accounting_orgid = accounting_orgid
self.orgid = orgid
self.productid = productid
def __str__(self):
return f'GetCustomerPriceError({self.accounting_orgid=}, {self.orgid=}, {self.productid=})'
def __expr__(self):
return str(self)
class ProductProtocolNotDefined(Exception):
def __init__(self, offer_orgid, bid_orgid, providerid, productid, curdate):
self.bid_orgid = bid_orgid
self.offer_orgid = offer_orgid
self.providerid = providerid
self.productid = productid
self.curdate = curdate
def __str__(self):
return f'ProductProtocolNotDefined({self.offer_orgid=},{self.bid_orgid=},{self.providerid=},{self.productid=},{self.curdate=})'
def __expr__(self):
return str(self)
class ProductBidProtocolNotDefined(Exception):
def __init__(self, offer_orgid, bid_orgid, providerid, productid, curdate):
self.bid_orgid = bid_orgid
self.offer_orgid = offer_orgid
self.providerid = providerid
self.productid = productid
self.curdate = curdate
def __str__(self):
return f'ProductProtocolNotDefined({self.offer_orgid=},{self.bid_orgid=},{self.providerid=},{self.productid=},{self.curdate=})'
def __expr__(self):
return str(self)