浏览代码

修改小数数目

flower_bs 2 天之前
父节点
当前提交
e469a8df37

+ 69 - 0
bound/migrations/0024_alter_batchlogmodel_goods_qty_and_more.py

@@ -0,0 +1,69 @@
+# Generated by Django 4.1.2 on 2025-07-01 10:21
+
+from decimal import Decimal
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        ('bound', '0023_alter_materialstatistics_total_quantity'),
+    ]
+
+    operations = [
+        migrations.AlterField(
+            model_name='batchlogmodel',
+            name='goods_qty',
+            field=models.DecimalField(decimal_places=3, default=Decimal('0'), max_digits=10, verbose_name='商品数量'),
+        ),
+        migrations.AlterField(
+            model_name='boundbatchmodel',
+            name='goods_in_location_qty',
+            field=models.DecimalField(decimal_places=3, default=Decimal('0'), max_digits=10, verbose_name='库位入库数量'),
+        ),
+        migrations.AlterField(
+            model_name='boundbatchmodel',
+            name='goods_in_qty',
+            field=models.DecimalField(decimal_places=3, default=Decimal('0'), max_digits=10, verbose_name='组盘入库数量'),
+        ),
+        migrations.AlterField(
+            model_name='boundbatchmodel',
+            name='goods_out_qty',
+            field=models.DecimalField(decimal_places=3, default=Decimal('0'), max_digits=10, verbose_name='出库数量'),
+        ),
+        migrations.AlterField(
+            model_name='boundbatchmodel',
+            name='goods_qty',
+            field=models.DecimalField(decimal_places=3, default=Decimal('0'), max_digits=10, verbose_name='商品数量'),
+        ),
+        migrations.AlterField(
+            model_name='boundbatchmodel',
+            name='goods_reserve_qty',
+            field=models.DecimalField(decimal_places=3, default=Decimal('0'), max_digits=10, verbose_name='预定出库数量'),
+        ),
+        migrations.AlterField(
+            model_name='materialstatistics',
+            name='total_demanded_quantity',
+            field=models.DecimalField(decimal_places=3, default=Decimal('0'), max_digits=10, verbose_name='需求数量'),
+        ),
+        migrations.AlterField(
+            model_name='materialstatistics',
+            name='total_quantity',
+            field=models.DecimalField(decimal_places=3, default=Decimal('0'), max_digits=10, verbose_name='在库数量'),
+        ),
+        migrations.AlterField(
+            model_name='outbatchmodel',
+            name='goods_out_qty',
+            field=models.DecimalField(decimal_places=3, default=Decimal('0'), max_digits=10, verbose_name='出库数量'),
+        ),
+        migrations.AlterField(
+            model_name='outbatchmodel',
+            name='goods_qty',
+            field=models.DecimalField(decimal_places=3, default=Decimal('0'), max_digits=10, verbose_name='商品数量'),
+        ),
+        migrations.AlterField(
+            model_name='outbounddemandmodel',
+            name='goods_qty',
+            field=models.DecimalField(decimal_places=3, default=Decimal('0'), max_digits=10, verbose_name='计划数量'),
+        ),
+    ]

+ 12 - 12
bound/models.py

@@ -3,7 +3,7 @@ from erp.models import InboundBill, MaterialDetail, OutboundBill,OutMaterialDeta
 from django.db.models import Sum
 from django.db.models.signals import post_save, post_delete
 from django.dispatch import receiver
-
+from decimal import Decimal
 class BoundListModel(models.Model):
     STATUS =( 
             ("100", '入库申请'), ("101", '入库同意'), ("102", '组盘中'), ("103", '部分入库'), ("104", '已入库'),
@@ -72,12 +72,12 @@ class BoundBatchModel(models.Model):
     goods_desc = models.CharField(max_length=255, verbose_name="商品描述")
     goods_std = models.CharField(default='待填写', max_length=255, verbose_name="商品标准",blank=True, null=True)
     goods_unit = models.CharField(default='待填写', max_length=255, verbose_name="商品单位")
-    goods_qty = models.BigIntegerField(default=0, verbose_name="商品数量")
+    goods_qty = models.DecimalField(max_digits=10, decimal_places=3, default=Decimal('0'),  verbose_name="商品数量")
     goods_package = models.CharField(default='待填写', max_length=255, verbose_name="商品包装")
-    goods_in_qty = models.BigIntegerField(default=0, verbose_name="组盘入库数量")
-    goods_in_location_qty = models.BigIntegerField(default=0, verbose_name="库位入库数量")
-    goods_out_qty = models.BigIntegerField(default=0, verbose_name="出库数量")
-    goods_reserve_qty = models.BigIntegerField(default=0, verbose_name="预定出库数量")
+    goods_in_qty = models.DecimalField(max_digits=10, decimal_places=3, default=Decimal('0'),  verbose_name="组盘入库数量")
+    goods_in_location_qty = models.DecimalField(max_digits=10, decimal_places=3, default=Decimal('0'), verbose_name="库位入库数量")
+    goods_out_qty = models.DecimalField(max_digits=10, decimal_places=3, default=Decimal('0'),  verbose_name="出库数量")
+    goods_reserve_qty = models.DecimalField(max_digits=10, decimal_places=3, default=Decimal('0'),  verbose_name="预定出库数量")
 
     status = models.IntegerField(choices=CONTAINER_STATUS, default=0, verbose_name='批次状态')
     container_number = models.IntegerField( default=0, verbose_name="托盘数目")
@@ -119,7 +119,7 @@ class OutBoundDemandModel(models.Model):
     goods_desc = models.CharField(max_length=255, verbose_name="商品描述")
     goods_std = models.CharField(default='待填写', max_length=255, verbose_name="商品标准",blank=True, null=True)
     goods_unit = models.CharField(default='待填写', max_length=255, verbose_name="商品单位")
-    goods_qty = models.BigIntegerField(default=0, verbose_name="计划数量")
+    goods_qty = models.DecimalField(max_digits=10, decimal_places=3, default=Decimal('0'),  verbose_name="计划数量")
     working = models.BooleanField(default=False, verbose_name="是否在工作")
     creater = models.CharField(default='uesr', max_length=255, verbose_name="Who Created")
     create_time = models.DateTimeField(auto_now_add=True, verbose_name="Create Time")
@@ -138,8 +138,8 @@ class MaterialStatistics(models.Model):
     goods_desc = models.CharField(max_length=255, verbose_name="商品描述")
     goods_std = models.CharField(default='待填写', max_length=255, verbose_name="商品标准", blank=True, null=True)
     goods_unit = models.CharField(default='待填写', max_length=255, verbose_name="商品单位")
-    total_quantity = models.BigIntegerField(default=0, verbose_name="在库数量")
-    total_demanded_quantity = models.BigIntegerField(default=0, verbose_name="需求数量")
+    total_quantity = models.DecimalField(max_digits=10, decimal_places=3, default=Decimal('0'),  verbose_name="在库数量")
+    total_demanded_quantity = models.DecimalField(max_digits=10, decimal_places=3, default=Decimal('0'), verbose_name="需求数量")
 
     def __str__(self):
         return f"{self.goods_code} - {self.goods_desc}"
@@ -215,8 +215,8 @@ class OutBatchModel(models.Model):
     goods_desc = models.CharField(max_length=255, verbose_name="商品描述")
     goods_std = models.CharField(default='待填写', max_length=255, verbose_name="商品标准",blank=True, null=True)
     goods_unit = models.CharField(default='待填写', max_length=255, verbose_name="商品单位")
-    goods_qty = models.BigIntegerField(default=0, verbose_name="商品数量")
-    goods_out_qty = models.BigIntegerField(default=0, verbose_name="出库数量")
+    goods_qty = models.DecimalField(max_digits=10, decimal_places=3, default=Decimal('0'),  verbose_name="商品数量")
+    goods_out_qty = models.DecimalField(max_digits=10, decimal_places=3, default=Decimal('0'),  verbose_name="出库数量")
 
 
     status = models.IntegerField(choices=CONTAINER_STATUS, default=0, verbose_name='批次状态')
@@ -313,7 +313,7 @@ class BatchLogModel(models.Model):
     log_date = models.DateTimeField(verbose_name="日志日期")
     goods_code = models.CharField(max_length=255, verbose_name="商品编码")
     goods_desc = models.CharField(max_length=255, verbose_name="商品描述")
-    goods_qty = models.BigIntegerField(default=0, verbose_name="商品数量")
+    goods_qty = models.DecimalField(max_digits=10, decimal_places=3, default=Decimal('0'), verbose_name="商品数量")
     log_content = models.CharField(max_length=255, verbose_name="日志内容")
     creater = models.CharField(default='uesr', max_length=255, verbose_name="Who Created")
     openid = models.CharField(max_length=255, verbose_name="Openid")

+ 8 - 8
bound/serializers.py

@@ -67,9 +67,9 @@ class BoundBatchGetSerializer(serializers.ModelSerializer):
     goods_code = serializers.CharField(read_only=True, required=False)
     goods_desc = serializers.CharField(read_only=True, required=False)
     goods_std =  serializers.CharField(read_only=True, required=False)
-    goods_qty = serializers.IntegerField(read_only=True, required=False)
-    goods_in_qty = serializers.IntegerField(read_only=True, required=False)
-    goods_out_qty = serializers.IntegerField(read_only=True, required=False)
+    goods_qty = serializers.DecimalField(read_only=False, required=False, max_digits=10, decimal_places=3)
+    goods_in_qty = serializers.DecimalField(read_only=False, required=False, max_digits=10, decimal_places=3)
+    goods_out_qty = serializers.DecimalField(read_only=False, required=False, max_digits=10, decimal_places=3)
     status = serializers.IntegerField(read_only=True, required=False)
     goods_weight = serializers.FloatField(read_only=True, required=False)
     goods_total_weight = serializers.FloatField(read_only=True, required=False)
@@ -95,9 +95,9 @@ class BoundBatchPostSerializer(serializers.ModelSerializer):
     goods_code = serializers.CharField(read_only=False, required=True, validators=[datasolve.data_validate])
     goods_desc = serializers.CharField(read_only=False, required=True, validators=[datasolve.data_validate])
     goods_std =  serializers.CharField(read_only=False, required=False, validators=[datasolve.data_validate])
-    goods_qty = serializers.IntegerField(read_only=False, required=True, validators=[datasolve.data_validate])
-    goods_in_qty = serializers.IntegerField(read_only=False, required=False, validators=[datasolve.data_validate])
-    goods_out_qty = serializers.IntegerField(read_only=False, required=False, validators=[datasolve.data_validate])
+    goods_qty = serializers.DecimalField(read_only=False, required=True, max_digits=10, decimal_places=3, validators=[datasolve.data_validate])
+    goods_in_qty = serializers.DecimalField(read_only=False, required=False, max_digits=10, decimal_places=3,validators=[datasolve.data_validate])
+    goods_out_qty = serializers.DecimalField(read_only=False, required=False, max_digits=10, decimal_places=3, validators=[datasolve.data_validate])
     status = serializers.IntegerField(read_only=False, required=False, validators=[datasolve.data_validate])
     goods_weight = serializers.FloatField(read_only=False, required=True, validators=[datasolve.data_validate])
 
@@ -233,9 +233,9 @@ class OutBatchPostSerializer(serializers.ModelSerializer):
     goods_code = serializers.CharField(read_only=False, required=False, validators=[datasolve.data_validate])
     goods_desc = serializers.CharField(read_only=False, required=False, validators=[datasolve.data_validate])
 
-    goods_qty = serializers.IntegerField(read_only=False, required=False, validators=[datasolve.data_validate])
+    goods_qty = serializers.DecimalField(read_only=False, required=False, max_digits=10, decimal_places=3, validators=[datasolve.data_validate])
 
-    goods_out_qty = serializers.IntegerField(read_only=False, required=False, validators=[datasolve.data_validate])
+    goods_out_qty = serializers.DecimalField(read_only=False, required=False, max_digits=10, decimal_places=3, validators=[datasolve.data_validate])
     creater = serializers.CharField(read_only=False, required=True, validators=[datasolve.data_validate])
 
 

+ 59 - 0
container/migrations/0024_alter_containerdetaillogmodel_new_goods_out_qty_and_more.py

@@ -0,0 +1,59 @@
+# Generated by Django 4.1.2 on 2025-06-30 17:05
+
+from decimal import Decimal
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        ('container', '0023_alter_containerdetaillogmodel_options'),
+    ]
+
+    operations = [
+        migrations.AlterField(
+            model_name='containerdetaillogmodel',
+            name='new_goods_out_qty',
+            field=models.DecimalField(blank=True, decimal_places=3, default=Decimal('0'), max_digits=10, null=True, verbose_name='新出库数量'),
+        ),
+        migrations.AlterField(
+            model_name='containerdetaillogmodel',
+            name='new_goods_qty',
+            field=models.DecimalField(blank=True, decimal_places=3, default=Decimal('0'), max_digits=10, null=True, verbose_name='新数量'),
+        ),
+        migrations.AlterField(
+            model_name='containerdetaillogmodel',
+            name='old_goods_out_qty',
+            field=models.DecimalField(blank=True, decimal_places=3, default=Decimal('0'), max_digits=10, null=True, verbose_name='原出库数量'),
+        ),
+        migrations.AlterField(
+            model_name='containerdetaillogmodel',
+            name='old_goods_qty',
+            field=models.DecimalField(blank=True, decimal_places=3, default=Decimal('0'), max_digits=10, null=True, verbose_name='原数量'),
+        ),
+        migrations.AlterField(
+            model_name='containerdetailmodel',
+            name='goods_out_qty',
+            field=models.DecimalField(decimal_places=3, default=Decimal('0'), max_digits=10, verbose_name='出库数量'),
+        ),
+        migrations.AlterField(
+            model_name='containerdetailmodel',
+            name='goods_qty',
+            field=models.DecimalField(decimal_places=3, default=Decimal('0'), max_digits=10, verbose_name='数量'),
+        ),
+        migrations.AlterField(
+            model_name='containeroperationmodel',
+            name='goods_qty',
+            field=models.DecimalField(decimal_places=3, default=Decimal('0'), max_digits=10, verbose_name='数量'),
+        ),
+        migrations.AlterField(
+            model_name='out_batch_detail',
+            name='last_out_goods_qty',
+            field=models.DecimalField(decimal_places=3, default=Decimal('0'), max_digits=10, verbose_name='上次出库数量'),
+        ),
+        migrations.AlterField(
+            model_name='out_batch_detail',
+            name='out_goods_qty',
+            field=models.DecimalField(decimal_places=3, default=Decimal('0'), max_digits=10, verbose_name='数量'),
+        ),
+    ]

+ 10 - 10
container/models.py

@@ -3,7 +3,7 @@ from bound.models import BoundBatchModel,BoundDetailModel,OutBatchModel,BoundLis
 from django.utils import timezone
 from django.db.models.signals import pre_save, post_save
 from django.dispatch import receiver
-
+from decimal import Decimal
 # Create your models here.
 # 主表:托盘数据
 class ContainerListModel(models.Model):
@@ -48,8 +48,8 @@ class ContainerDetailModel(models.Model):
     goods_class = models.IntegerField(verbose_name='货品类别',choices=BATCH_CLASS, default=1)
     goods_code = models.CharField(max_length=50, verbose_name='货品编码')
     goods_desc = models.CharField(max_length=100, verbose_name='货品描述')
-    goods_qty = models.IntegerField(verbose_name='数量')
-    goods_out_qty = models.IntegerField(verbose_name='出库数量', default=0)
+    goods_qty = models.DecimalField(max_digits=10, decimal_places=3, default=Decimal('0'), verbose_name='数量')
+    goods_out_qty = models.DecimalField(max_digits=10, decimal_places=3, default=Decimal('0'),verbose_name='出库数量')
     goods_weight = models.DecimalField(max_digits=10, decimal_places=3, verbose_name='重量')
     status = models.IntegerField(choices=BATCH_STATUS,default=0, verbose_name='状态')          
     creater = models.CharField(max_length=50, verbose_name='创建人')
@@ -185,8 +185,8 @@ class ContainerDetailLogModel(models.Model):
     )
     
     # 原值
-    old_goods_qty = models.IntegerField(verbose_name='原数量', null=True, blank=True)
-    old_goods_out_qty = models.IntegerField(verbose_name='原出库数量', null=True, blank=True)
+    old_goods_qty = models.DecimalField(max_digits=10, decimal_places=3, default=Decimal('0'),verbose_name='原数量', null=True, blank=True)
+    old_goods_out_qty = models.DecimalField(max_digits=10, decimal_places=3, default=Decimal('0'),verbose_name='原出库数量', null=True, blank=True)
     old_status = models.IntegerField(
         choices=ContainerDetailModel.BATCH_STATUS,
         null=True,
@@ -195,8 +195,8 @@ class ContainerDetailLogModel(models.Model):
     )
     
     # 新值
-    new_goods_qty = models.IntegerField(verbose_name='新数量', null=True, blank=True)
-    new_goods_out_qty = models.IntegerField(verbose_name='新出库数量', null=True, blank=True)
+    new_goods_qty = models.DecimalField(max_digits=10, decimal_places=3, default=Decimal('0'),verbose_name='新数量', null=True, blank=True)
+    new_goods_out_qty = models.DecimalField(max_digits=10, decimal_places=3, default=Decimal('0'),verbose_name='新出库数量', null=True, blank=True)
     new_status = models.IntegerField(
         choices=ContainerDetailModel.BATCH_STATUS,
         null=True,
@@ -290,7 +290,7 @@ class ContainerOperationModel(models.Model):
     batch = models.ForeignKey(BoundBatchModel, on_delete=models.CASCADE, verbose_name='批次',null=True, blank=True)
     goods_code = models.CharField(max_length=50, verbose_name='货品编码')
     goods_desc = models.CharField(max_length=100, verbose_name='货品描述')
-    goods_qty = models.IntegerField(verbose_name='数量')
+    goods_qty = models.DecimalField(max_digits=10, decimal_places=3, default=Decimal('0'),verbose_name='数量')
     goods_weight = models.DecimalField(max_digits=10, decimal_places=3, verbose_name='重量')
 
     operator = models.CharField(max_length=50, verbose_name='操作人')
@@ -376,8 +376,8 @@ class out_batch_detail(models.Model):
     out_bound = models.ForeignKey(BoundListModel, on_delete=models.CASCADE, related_name='out_batch_details')
     container = models.ForeignKey(ContainerListModel, on_delete=models.CASCADE, related_name='out_batch_details')
     container_detail = models.ForeignKey(ContainerDetailModel, on_delete=models.CASCADE, verbose_name='托盘明细')
-    out_goods_qty = models.IntegerField(verbose_name='数量')
-    last_out_goods_qty = models.IntegerField(verbose_name='上次出库数量', default=0)
+    out_goods_qty = models.DecimalField(max_digits=10, decimal_places=3, default=Decimal('0'),verbose_name='数量')
+    last_out_goods_qty = models.DecimalField(max_digits=10, decimal_places=3, default=Decimal('0'),verbose_name='上次出库数量')
     working = models.IntegerField(default = 1,verbose_name='工作状态')
     is_delete = models.BooleanField(default=False, verbose_name='是否删除')
     class Meta:

+ 5 - 5
container/serializers.py

@@ -61,7 +61,7 @@ class ContainerDetailGetSerializer(serializers.ModelSerializer):
     batch = serializers.SerializerMethodField()
     goods_code = serializers.CharField(read_only=True, required=False)
     goods_desc = serializers.CharField(read_only=True, required=False)
-    goods_qty = serializers.IntegerField(read_only=True, required=False)
+    goods_qty = serializers.DecimalField(read_only=False, required=False, max_digits=10, decimal_places=3)
     goods_weight = serializers.DecimalField(read_only=True, required=False, max_digits=10, decimal_places=2)
     goods_class = serializers.IntegerField(read_only=True, required=False)
     status = serializers.IntegerField(read_only=True, required=False)
@@ -107,7 +107,7 @@ class ContainerDetailPostSerializer(serializers.ModelSerializer):
     required=False, validators=[datasolve.data_validate])
     goods_code = serializers.CharField(read_only=False, required=True, validators=[datasolve.data_validate])
     goods_desc = serializers.CharField(read_only=False, required=True, validators=[datasolve.data_validate])
-    goods_qty = serializers.IntegerField(read_only=False, required=True, validators=[datasolve.data_validate])
+    goods_qty = serializers.DecimalField(read_only=False, required=True, max_digits=10, decimal_places=3,validators=[datasolve.data_validate])
     goods_weight = serializers.DecimalField(read_only=False, required=True, max_digits=10, decimal_places=2, validators=[datasolve.data_validate])
     status = serializers.IntegerField(read_only=False, required=False, validators=[datasolve.data_validate])
     creater = serializers.CharField(read_only=False, required=False, validators=[datasolve.data_validate])
@@ -129,7 +129,7 @@ class ContainerOperationGetSerializer(serializers.ModelSerializer):
     batch = serializers.SerializerMethodField()
     goods_code = serializers.CharField(read_only=True, required=False)
     goods_desc = serializers.CharField(read_only=True, required=False)
-    goods_qty = serializers.IntegerField(read_only=True, required=False)
+    goods_qty = serializers.DecimalField(read_only=False, required=False, max_digits=10, decimal_places=3)
     goods_weight = serializers.DecimalField(read_only=True, required=False, max_digits=10, decimal_places=2)
 
     operator = serializers.CharField(read_only=True, required=False)
@@ -176,7 +176,7 @@ class ContainerOperationPostSerializer(serializers.ModelSerializer):
     required=False, validators=[datasolve.data_validate])
     goods_code = serializers.CharField(read_only=False, required=True, validators=[datasolve.data_validate])
     goods_desc = serializers.CharField(read_only=False, required=True, validators=[datasolve.data_validate])
-    goods_qty = serializers.IntegerField(read_only=False, required=True, validators=[datasolve.data_validate])
+    goods_qty = serializers.DecimalField(read_only=False, required=True, max_digits=10, decimal_places=3,validators=[datasolve.data_validate])
     goods_weight = serializers.DecimalField(read_only=False, required=True, max_digits=10, decimal_places=2, validators=[datasolve.data_validate])
 
     operator = serializers.CharField(read_only=False, required=True, validators=[datasolve.data_validate])
@@ -255,7 +255,7 @@ class OutBoundFullDetailSerializer(serializers.ModelSerializer):
     batch = serializers.CharField(source='container_detail.batch.bound_number', read_only=True)
     goods_code = serializers.CharField(source='container_detail.goods_code', read_only=True)
     goods_desc = serializers.CharField(source='container_detail.goods_desc', read_only=True)
-    goods_qty = serializers.IntegerField(source='container_detail.goods_qty', read_only=True)
+    goods_qty = serializers.DecimalField(source='container_detail.goods_qty', read_only=True,max_digits=10, decimal_places=3)
     class Meta:
         model = out_batch_detail
         fields = '__all__'

+ 24 - 0
erp/migrations/0026_alter_materialdetail_plan_qty_and_more.py

@@ -0,0 +1,24 @@
+# Generated by Django 4.1.2 on 2025-06-30 21:23
+
+from decimal import Decimal
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        ('erp', '0025_inboundbill_audit_status_inboundbill_qc_status_and_more'),
+    ]
+
+    operations = [
+        migrations.AlterField(
+            model_name='materialdetail',
+            name='plan_qty',
+            field=models.DecimalField(decimal_places=3, default=Decimal('0'), max_digits=10, verbose_name='计划数量'),
+        ),
+        migrations.AlterField(
+            model_name='outmaterialdetail',
+            name='goods_out_qty',
+            field=models.DecimalField(decimal_places=3, default=Decimal('0'), max_digits=10, verbose_name='计划数量'),
+        ),
+    ]

+ 3 - 3
erp/models.py

@@ -1,5 +1,5 @@
 from django.db import models
-
+from decimal import Decimal
 class InboundBill(models.Model):
     BOUND_TYPE = (
         (1, '生产入库'),
@@ -162,7 +162,7 @@ class MaterialDetail(models.Model):
     goods_name = models.CharField(max_length=100, verbose_name='商品名称')
     goods_std = models.CharField(max_length=50, verbose_name='商品规格')
     goods_weight = models.DecimalField(max_digits=10, decimal_places=2, verbose_name='单件重量', default=1)
-    plan_qty = models.IntegerField(verbose_name='计划数量')
+    plan_qty = models.DecimalField(max_digits=10, decimal_places=3, default=Decimal('0'),verbose_name='计划数量')
     goods_total_weight = models.DecimalField(max_digits=10, decimal_places=2, verbose_name='总重量', null=True)
     goods_unit = models.CharField(max_length=20, verbose_name='计量单位')
     note = models.TextField(blank=True, verbose_name='备注')
@@ -202,7 +202,7 @@ class OutMaterialDetail(models.Model):
     goods_name = models.CharField(max_length=100, verbose_name='商品名称')
 
     goods_weight = models.DecimalField(max_digits=10, decimal_places=2, verbose_name='单件重量', default=1)
-    goods_out_qty = models.IntegerField(verbose_name='计划数量')
+    goods_out_qty = models.DecimalField(max_digits=10, decimal_places=3, default=Decimal('0'),verbose_name='计划数量')
     goods_total_weight = models.DecimalField(max_digits=10, decimal_places=2, verbose_name='总重量', null=True)
     goods_unit = models.CharField(max_length=20, verbose_name='计量单位')
     note = models.TextField(blank=True, verbose_name='备注')

+ 24 - 0
reportcenter/migrations/0002_alter_flowmodel_goods_in_alter_flowmodel_goods_out.py

@@ -0,0 +1,24 @@
+# Generated by Django 4.1.2 on 2025-07-01 10:21
+
+from decimal import Decimal
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        ('reportcenter', '0001_initial'),
+    ]
+
+    operations = [
+        migrations.AlterField(
+            model_name='flowmodel',
+            name='goods_in',
+            field=models.DecimalField(blank=True, decimal_places=3, default=Decimal('0'), max_digits=10, null=True, verbose_name='Goods In'),
+        ),
+        migrations.AlterField(
+            model_name='flowmodel',
+            name='goods_out',
+            field=models.DecimalField(blank=True, decimal_places=3, default=Decimal('0'), max_digits=10, null=True, verbose_name='Goods Out'),
+        ),
+    ]

+ 3 - 2
reportcenter/models.py

@@ -1,4 +1,5 @@
 from django.db import models
+from decimal import Decimal
 
 class flowModel(models.Model):
     
@@ -17,8 +18,8 @@ class flowModel(models.Model):
     in_batch = models.CharField(max_length=255, verbose_name='In Batch', null=True, blank=True)
     out_batch = models.CharField(max_length=255, verbose_name='Out Batch', null=True, blank=True)
     goods_unit = models.CharField(max_length=255,default = '件', verbose_name="Goods Unit", null=True, blank=True)
-    goods_in = models.BigIntegerField(default=0, verbose_name="Goods In",null=True, blank=True)
-    goods_out = models.BigIntegerField(default=0, verbose_name="Goods Out",null=True, blank=True)
+    goods_in = models.DecimalField(max_digits=10, decimal_places=3, default=Decimal('0'),  verbose_name="Goods In",null=True, blank=True)
+    goods_out = models.DecimalField(max_digits=10, decimal_places=3, default=Decimal('0'),  verbose_name="Goods Out",null=True, blank=True)
     goods_notes = models.CharField(max_length=255,default = '待填写', verbose_name="Goods Notes",null=True, blank=True)
     creator = models.CharField(max_length=255, verbose_name='Creator', null=True, blank=True)
 

+ 29 - 0
stock/migrations/0002_alter_stockshelfmodel_goods_in_and_more.py

@@ -0,0 +1,29 @@
+# Generated by Django 4.1.2 on 2025-06-30 21:23
+
+from decimal import Decimal
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        ('stock', '0001_initial'),
+    ]
+
+    operations = [
+        migrations.AlterField(
+            model_name='stockshelfmodel',
+            name='goods_in',
+            field=models.DecimalField(decimal_places=3, default=Decimal('0'), max_digits=10, verbose_name='Goods In'),
+        ),
+        migrations.AlterField(
+            model_name='stockshelfmodel',
+            name='goods_out',
+            field=models.DecimalField(decimal_places=3, default=Decimal('0'), max_digits=10, verbose_name='Goods Out'),
+        ),
+        migrations.AlterField(
+            model_name='stockshelfmodel',
+            name='goods_qty',
+            field=models.DecimalField(decimal_places=3, default=Decimal('0'), max_digits=10, verbose_name='Goods Quantity'),
+        ),
+    ]

+ 4 - 4
stock/models.py

@@ -1,5 +1,5 @@
 from django.db import models
-
+from decimal import Decimal
 class StockshelfModel(models.Model):
     warehouse_code = models.CharField(max_length=255, verbose_name="Warehouse code")
     warehouse_name = models.CharField(max_length=255, verbose_name="Warehouse Name")
@@ -22,13 +22,13 @@ class StockshelfModel(models.Model):
     goods_name = models.CharField(max_length=255,default = '待填写', verbose_name="Goods Name")
     goods_std = models.CharField(max_length=255,default = '待填写', verbose_name="Goods Standard")
     goods_desc = models.CharField(max_length=255,default = '待填写', verbose_name="Goods Description")
-    goods_qty = models.BigIntegerField(default=0, verbose_name="Goods Quantity")
+    goods_qty = models.DecimalField(max_digits=10, decimal_places=3, default=Decimal('0'), verbose_name="Goods Quantity")
     goods_unit = models.CharField(max_length=255,default = '件', verbose_name="Goods Unit")
     goods_price = models.DecimalField(max_digits=10, default=0,decimal_places=2, verbose_name="Goods Price")
     goods_batch = models.CharField(max_length=255,default = '待填写', verbose_name="Goods Batch")
     goods_notes = models.CharField(max_length=255,default = '待填写', verbose_name="Goods Notes")
-    goods_in = models.BigIntegerField(default=0, verbose_name="Goods In")
-    goods_out = models.BigIntegerField(default=0, verbose_name="Goods Out")
+    goods_in = models.DecimalField(max_digits=10, decimal_places=3, default=Decimal('0'),verbose_name="Goods In")
+    goods_out = models.DecimalField(max_digits=10, decimal_places=3, default=Decimal('0'), verbose_name="Goods Out")
 
 
 

+ 7 - 6
stock/serializers.py

@@ -39,13 +39,13 @@ class stockShelfpartialSerializer(serializers.ModelSerializer):
     goods_name = serializers.CharField(read_only=False, required=False)
     goods_std = serializers.CharField(read_only=False, required=False)
     goods_desc = serializers.CharField(read_only=False, required=False)
-    goods_qty = serializers.IntegerField(read_only=False, required=False)
+    goods_qty = serializers.DecimalField(read_only=False, required=False, max_digits=10, decimal_places=3)
     goods_unit = serializers.CharField(read_only=False, required=False)
     goods_price = serializers.DecimalField(read_only=False, required=False, max_digits=10, decimal_places=2)
     goods_batch = serializers.CharField(read_only=False, required=False)
     goods_notes = serializers.CharField(read_only=False, required=False)
-    goods_in = serializers.IntegerField(read_only=False, required=False)
-    goods_out = serializers.IntegerField(read_only=False, required=False)
+    goods_in = serializers.DecimalField(read_only=False, required=False, max_digits=10, decimal_places=3)
+    goods_out = serializers.DecimalField(read_only=False, required=False, max_digits=10, decimal_places=3)
 
     class Meta:
         model = StockshelfModel
@@ -64,9 +64,10 @@ class stocklistSerializer(serializers.ModelSerializer):
     goods_code   = serializers.CharField(read_only=False, required=False)
     goods_name   = serializers.CharField(read_only=False, required=False)
     goods_std    = serializers.CharField(read_only=False, required=False)
-    goods_in     = serializers.IntegerField(read_only=False, required=False)
-    goods_out    = serializers.IntegerField(read_only=False, required=False)
-    goods_qty    = serializers.IntegerField(read_only=False, required=False)
+    goods_in     = serializers.DecimalField(read_only=False, required=False, max_digits=10, decimal_places=3)
+    goods_out    = serializers.DecimalField(read_only=False, required=False, max_digits=10, decimal_places=3)
+    goods_qty    = serializers.DecimalField(read_only=False, required=False, max_digits=10, decimal_places=3)
+
 
     class Meta:
         model = StockshelfModel