forked from erp-dev/erp
feat: backend api
This commit is contained in:
@@ -5,10 +5,73 @@ from flower.common import ModelBase
|
||||
from django.contrib.auth.models import User
|
||||
|
||||
|
||||
# ==================== 常量定义 ====================
|
||||
METER_TO_YARD_RATE = 0.9144
|
||||
YARD_TO_METER_RATE = 1.09361
|
||||
|
||||
|
||||
# ==================== 枚举类定义 ====================
|
||||
|
||||
class MerchantTypeEnum(models.IntegerChoices):
|
||||
"""商户类型枚举"""
|
||||
STORE = 1, '布行'
|
||||
FACTORY = 2, '印花厂'
|
||||
|
||||
class ProductUnitEnum(models.IntegerChoices):
|
||||
"""产品单位枚举"""
|
||||
METER = 1, '米'
|
||||
YARD = 2, '码'
|
||||
KG = 3, '公斤'
|
||||
|
||||
|
||||
class EmployeeTypeEnum(models.TextChoices):
|
||||
"""员工职位类型枚举"""
|
||||
PRINTER = '打纸', '打纸'
|
||||
ROLLING = '滚筒', '滚筒'
|
||||
WARE = '仓库', '仓库'
|
||||
DELIVERY = '送货', '送货'
|
||||
|
||||
|
||||
class EmployeeStatusEnum(models.TextChoices):
|
||||
"""员工状态枚举"""
|
||||
ACTIVE = '在职', '在职'
|
||||
INACTIVE = '离职', '离职'
|
||||
|
||||
|
||||
class DeviceStatusEnum(models.TextChoices):
|
||||
"""设备状态枚举"""
|
||||
ACTIVE = '使用中', '使用中'
|
||||
INACTIVE = '停用', '停用'
|
||||
MAINTENANCE = '维修中', '维修中'
|
||||
|
||||
|
||||
class DeviceTypeEnum(models.TextChoices):
|
||||
"""设备类型枚举"""
|
||||
ROLLING = '滚筒', '滚筒'
|
||||
PRINTER = '打印', '打印'
|
||||
|
||||
|
||||
# ==================== 模型定义 ====================
|
||||
|
||||
|
||||
class Merchant(ModelBase):
|
||||
id = models.BigAutoField(primary_key=True)
|
||||
name = models.CharField(max_length=100, verbose_name='商户名称')
|
||||
type = models.IntegerField(choices=MerchantTypeEnum.choices, verbose_name='商户类型')
|
||||
area = models.CharField(max_length=100, blank=True, null=True, verbose_name='地区')
|
||||
email = models.EmailField(blank=True, null=True, verbose_name='电子邮箱')
|
||||
mobile = models.CharField(max_length=20, blank=True, null=True, verbose_name='手机')
|
||||
contact = models.TextField(blank=True, null=True, verbose_name='联系人')
|
||||
description = models.TextField(blank=True, null=True, verbose_name='备注描述')
|
||||
|
||||
def __str__(self):
|
||||
return self.name
|
||||
|
||||
class Meta:
|
||||
verbose_name = '商户资料'
|
||||
verbose_name_plural = '商户资料'
|
||||
|
||||
|
||||
class VehicleType(ModelBase):
|
||||
id = models.BigAutoField(primary_key=True)
|
||||
name = models.CharField(max_length=50, verbose_name='车辆类型名称')
|
||||
@@ -39,12 +102,6 @@ class WareHouse(ModelBase):
|
||||
verbose_name_plural = '仓库资料'
|
||||
|
||||
|
||||
class ProductUnitEnum(models.IntegerChoices):
|
||||
METER = 1, '米'
|
||||
YARD = 2, '码'
|
||||
KG = 3, '公斤'
|
||||
|
||||
|
||||
class Supplier(ModelBase):
|
||||
id = models.BigAutoField(primary_key=True)
|
||||
name = models.CharField(max_length=100, verbose_name='供应商名称')
|
||||
@@ -189,18 +246,6 @@ class Customer(ModelBase):
|
||||
verbose_name_plural = '客户资料'
|
||||
|
||||
|
||||
class EmployeeTypeEnum(models.TextChoices):
|
||||
PRINTER = '打纸', '打纸'
|
||||
ROLLING = '滚筒', '滚筒'
|
||||
WARE = '仓库', '仓库'
|
||||
DELIVERY = '送货', '送货'
|
||||
|
||||
|
||||
class EmployeeStatusEnum(models.TextChoices):
|
||||
ACTIVE = '在职', '在职'
|
||||
INACTIVE = '离职', '离职'
|
||||
|
||||
|
||||
class Employee(ModelBase):
|
||||
id = models.BigAutoField(primary_key=True)
|
||||
sys_user = models.OneToOneField(
|
||||
@@ -236,17 +281,6 @@ class Employee(ModelBase):
|
||||
verbose_name_plural = '员工资料'
|
||||
|
||||
|
||||
class DeviceStatusEnum(models.TextChoices):
|
||||
ACTIVE = '使用中', '使用中'
|
||||
INACTIVE = '停用', '停用'
|
||||
MAINTENANCE = '维修中', '维修中'
|
||||
|
||||
|
||||
class DeviceTypeEnum(models.TextChoices):
|
||||
ROLLING = '滚筒', '滚筒'
|
||||
PRINTER = '打印', '打印'
|
||||
|
||||
|
||||
class DeviceInfo(ModelBase):
|
||||
id = models.BigAutoField(primary_key=True)
|
||||
name = models.CharField(max_length=100, verbose_name='设备名称')
|
||||
|
||||
Reference in New Issue
Block a user