You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
47 lines
2.0 KiB
47 lines
2.0 KiB
# -*- coding: utf-8 -*-
|
|
# @Time : 2023/11/21 10:20
|
|
# @Author : tx
|
|
# @File : drug_item.py
|
|
# @Description : 盒装药剂明细
|
|
|
|
from enum import IntEnum
|
|
|
|
from tortoise import fields, models
|
|
|
|
|
|
|
|
class DrugItemStateEnum(IntEnum):
|
|
# 0 = 待入库, 1 = 在库, 2 = 出库, 3 = 空瓶, 4 = 报废
|
|
INITIAL = 0
|
|
IN = 1
|
|
OUT = 2
|
|
EMPTY = 3
|
|
SCRAP = 4
|
|
|
|
|
|
class DrugItem(models.Model):
|
|
id = fields.UUIDField(pk=True)
|
|
dictionary = fields.ForeignKeyField('rms.Dictionary', null=True, to_field='id')
|
|
drug = fields.ForeignKeyField('rms.Drug', null=True, to_field='id')
|
|
rfid = fields.CharField(max_length=255, description='电子标签')
|
|
barcode = fields.CharField(null=True, max_length=255, description='标签条码')
|
|
state = fields.IntEnumField(DrugItemStateEnum, default=DrugItemStateEnum.INITIAL,
|
|
description='0=待入库,1=在库,2=出库,3=空瓶,4=报废')
|
|
name = fields.CharField(max_length=255, description="名称")
|
|
fill_json_content = fields.JSONField(null=True, description='扩展字段')
|
|
bind = fields.ForeignKeyField('rms.User', related_name="item_bind", null=True, description='绑定人')
|
|
bind_at = fields.DatetimeField(null=True, description='绑定时间')
|
|
storage = fields.ForeignKeyField('rms.User', related_name="item_storage", null=True, description='入库人')
|
|
storage_at = fields.DatetimeField(null=True, description='入库时间')
|
|
last_receive = fields.ForeignKeyField('rms.User', related_name="item_last_receive", null=True, description='最后领用人')
|
|
last_receive_at = fields.DatetimeField(null=True, description='最后领用时间')
|
|
expired_at = fields.DatetimeField(null=True, description='过期时间')
|
|
open_date = fields.DatetimeField(null=True, description='开封日期')
|
|
|
|
created_at = fields.DatetimeField(auto_now_add=True)
|
|
updated_at = fields.DatetimeField(auto_now=True)
|
|
|
|
class Meta:
|
|
table = 'drug_items'
|
|
table_description = '盒装药剂明细表'
|