修改为PositiveIntegerField

This commit is contained in:
caoqianming 2021-12-01 10:12:09 +08:00
parent a1a3bac26d
commit e92bc40493
4 changed files with 50 additions and 4 deletions

View File

@ -0,0 +1,28 @@
# Generated by Django 3.2.9 on 2021-12-01 02:11
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('inm', '0018_alter_fifoitem_subproduction_plan'),
]
operations = [
migrations.AlterField(
model_name='fifoitem',
name='count',
field=models.PositiveIntegerField(default=0, verbose_name='数量'),
),
migrations.AlterField(
model_name='inventory',
name='count',
field=models.PositiveIntegerField(default=0, verbose_name='仓库物料存量'),
),
migrations.AlterField(
model_name='materialbatch',
name='count',
field=models.PositiveIntegerField(default=0, verbose_name='存量'),
),
]

View File

@ -29,7 +29,7 @@ class Inventory(BaseModel):
库存物料
"""
material = models.ForeignKey(Material, on_delete=models.CASCADE, verbose_name='物料信息')
count = models.IntegerField('仓库物料存量', default=0, validators=[MinValueValidator(0)])
count = models.PositiveIntegerField('仓库物料存量', default=0)
warehouse = models.ForeignKey(WareHouse, on_delete=models.CASCADE, verbose_name='所在仓库')
class Meta:
verbose_name = '库存表'
@ -41,7 +41,7 @@ class MaterialBatch(BaseModel):
"""
material = models.ForeignKey(Material, on_delete=models.CASCADE, verbose_name='物料信息')
warehouse = models.ForeignKey(WareHouse, on_delete=models.CASCADE, verbose_name='所在仓库')
count = models.IntegerField('存量', default=0, validators=[MinValueValidator(0)])
count = models.PositiveIntegerField('存量', default=0)
batch = models.CharField('批次号', max_length=100, default='')
expiration_date = models.DateField('有效期', null=True, blank=True)
class Meta:
@ -79,7 +79,7 @@ class FIFOItem(BaseModel):
is_testok = models.BooleanField('是否检测合格', default=False)
warehouse = models.ForeignKey(WareHouse, on_delete=models.CASCADE, verbose_name='仓库')
material = models.ForeignKey(Material, verbose_name='物料类型', on_delete=models.CASCADE)
count = models.IntegerField('数量', default=0, validators=[MinValueValidator(0)])
count = models.PositiveIntegerField('数量', default=0)
batch = models.CharField('批次号', max_length=100, default='')
fifo = models.ForeignKey(FIFO, verbose_name='关联出入库', on_delete=models.CASCADE)
subproduction_plan = models.ForeignKey(SubProductionPlan, verbose_name='关联子生产计划', on_delete=models.CASCADE, null=True, blank=True)

View File

@ -0,0 +1,18 @@
# Generated by Django 3.2.9 on 2021-12-01 02:11
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('wpm', '0024_auto_20211129_1456'),
]
operations = [
migrations.AlterField(
model_name='wmaterial',
name='count',
field=models.PositiveIntegerField(default=0, verbose_name='当前数量'),
),
]

View File

@ -17,7 +17,7 @@ class WMaterial(BaseModel):
subproduction_plan = models.ForeignKey(SubProductionPlan, verbose_name='关联子计划', on_delete=models.CASCADE)
material = models.ForeignKey(Material, verbose_name='关联物料', on_delete=models.CASCADE)
batch = models.CharField('批次号', max_length=100, null=True, blank=True)
count = models.IntegerField('当前数量', default=0, validators=[MinValueValidator(0)])
count = models.PositiveIntegerField('当前数量', default=0)
class WProduct(CommonAModel):