from django.db import models from apps.utils.models import BaseModel, CommonBModel from apps.mtm.models import Material # Create your models here. class WareHouse(CommonBModel): """ 仓库信息 """ number = models.CharField('仓库编号', max_length=20) name = models.CharField('仓库名称', max_length=20) place = models.CharField('具体地点', max_length=50) class MaterialBatch(BaseModel): """ 物料批次 """ batch = models.CharField('批次号', max_length=100) material = models.ForeignKey( Material, on_delete=models.CASCADE, verbose_name='物料') warehouse = models.ForeignKey( WareHouse, on_delete=models.CASCADE, verbose_name='所在仓库') count = models.PositiveIntegerField('存量', default=0) expiration_date = models.DateField('有效期', null=True, blank=True)