Deps updates, handle more tables + LK code

This commit is contained in:
Marcus Lindvall 2021-12-30 12:40:50 +01:00
parent f649b5f953
commit 5fe140714e
14 changed files with 583 additions and 79 deletions

View file

@ -67,8 +67,8 @@ class ArticleUnit(RawBaseModel):
ArtNr = Column(String, ForeignKey('ar.ArtNr'), primary_key=True)
AltEnhetKod = Column(Integer, ForeignKey('xae.AltEnhetKod'), primary_key=True)
ArticleAlternativeUnit = relationship(ArticleAlternativeUnit)
AltEnhetKod = Column(String, ForeignKey('xae.AltEnhetKod'), primary_key=True)
ArticleAlternativeUnit = relationship(ArticleAlternativeUnit, lazy='joined')
class ArticleBalance(RawBaseModel):
@ -89,6 +89,30 @@ class ArticleBalance(RawBaseModel):
ArtNr = Column(Integer, ForeignKey('ar.ArtNr'), primary_key=True)
class ArticleEAN(RawBaseModel):
__tablename__ = 'arean'
__column_map__ = {'ArtNrEAN': 'EAN', 'ArtNr': 'ArticleNumber'}
__to_dict_only__ = ('ArtNr', 'ArtNrEAN', 'ArticleUnit')
ArtNr = Column(String, ForeignKey('ar.ArtNr'), primary_key=True)
ArtNrEAN = Column(String, primary_key=True)
AltEnhetKod = Column(String, ForeignKey('xare.AltEnhetKod'))
ArticleUnit = relationship(ArticleUnit, lazy='joined')
class ArticleShelf(RawBaseModel):
__tablename__ = 'arsh'
__column_map__ = {'LagPlats': 'Shelf',
'LagStalle': 'WarehouseID',
'JAPP_EWMS_zoneid': 'WMSZoneID',
'ArtNr': 'ArticleNumber'}
__to_dict_only__ = ('LagPlats', 'LagStalle', 'JAPP_EWMS_zoneid', 'ArtNr')
LagPlats = Column(String, ForeignKey('ar.ArtNr'), primary_key=True)
LagStalle = Column(String, ForeignKey('ar.ArtNr'), primary_key=True)
class VATRate(RawBaseModel):
__tablename__ = 'X1'
__column_map__ = {'MomsKod': 'VATID', 'MomsSats': 'VATRate'}
@ -200,12 +224,12 @@ class Article(RawBaseModel):
except TypeError:
logger.debug("NoneType error, %s" % self.ArtNr)
@classmethod
def _base_filters(self, obj):
return RawBaseModel._base_filters(
obj,
and_(obj.ItemStatusCode == 0)
)
# @classmethod
# def _base_filters(self, obj):
# return RawBaseModel._base_filters(
# obj,
# and_(obj.ItemStatusCode == 0)
# )
class ContactInformationType(RawBaseModel):
@ -535,3 +559,16 @@ class OrderItem(RawBaseModel):
pers_sign=self['PersSign']).callproc()
self['OrdRadNr'] = row_no
return self
class ItemReplenishmentLevels(RawBaseModel):
# __table_args__ = {'mssql_autoincrement': False, 'extend_existing': True}
# __table_args__ = {'implicit_returning': False, 'extend_existing': True}
__tablename__ = 'JAPP_EWMS_Item_Replenishment_Levels'
__column_map__ = {'ArtNr': 'ArticleNumber', 'LagPlats': 'Shelf', 'LagStalle': 'WarehouseID'}
__to_dict_only__ = ('LagPlats', 'ArtNr')
# Workaround for:
# "Table 'JAPP_EWMS_Item_Replenishment_Levels' does not have the identity property.
# Cannot perform SET operation."
ForetagKod = Column(Integer, primary_key=True, autoincrement=False)