diff --git a/hb_server/apps/inm/migrations/0019_auto_20211201_1011.py b/hb_server/apps/inm/migrations/0019_auto_20211201_1011.py new file mode 100644 index 0000000..3b375d9 --- /dev/null +++ b/hb_server/apps/inm/migrations/0019_auto_20211201_1011.py @@ -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='存量'), + ), + ] diff --git a/hb_server/apps/inm/models.py b/hb_server/apps/inm/models.py index dbd87cf..20d87dd 100644 --- a/hb_server/apps/inm/models.py +++ b/hb_server/apps/inm/models.py @@ -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) diff --git a/hb_server/apps/wpm/migrations/0025_alter_wmaterial_count.py b/hb_server/apps/wpm/migrations/0025_alter_wmaterial_count.py new file mode 100644 index 0000000..65eb34e --- /dev/null +++ b/hb_server/apps/wpm/migrations/0025_alter_wmaterial_count.py @@ -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='当前数量'), + ), + ] diff --git a/hb_server/apps/wpm/models.py b/hb_server/apps/wpm/models.py index ebf5ead..327bc80 100644 --- a/hb_server/apps/wpm/models.py +++ b/hb_server/apps/wpm/models.py @@ -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):