From 53a3105f106afc12a72cdfa75576daae90cb6822 Mon Sep 17 00:00:00 2001 From: caoqianming Date: Mon, 17 Mar 2025 10:33:11 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=BD=AC=E6=88=90=20=E5=B0=8F=E6=95=B0?= =?UTF-8?q?=E5=90=8E=E7=9A=84to=5Frepresentation=20bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/wpm/serializers.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/apps/wpm/serializers.py b/apps/wpm/serializers.py index ced00f66..7e035c52 100644 --- a/apps/wpm/serializers.py +++ b/apps/wpm/serializers.py @@ -25,6 +25,7 @@ from apps.qm.serializers import FtestProcessSerializer import logging from apps.qm.models import Defect from apps.utils.snowflake import idWorker +from decimal import Decimal mylogger = logging.getLogger("log") class OtherLogSerializer(CustomModelSerializer): @@ -200,7 +201,7 @@ class WMaterialSerializer(CustomModelSerializer): def to_representation(self, instance): ret = super().to_representation(instance) - ret['count_cando'] = ret['count'] - ret['count_working'] + ret['count_cando'] = str(Decimal(ret['count']) - Decimal(ret['count_working'])) return ret class MlogbDefectSerializer(CustomModelSerializer):