From 25761054a2e94a7082a7c33a5ac40045ab5b0ba6 Mon Sep 17 00:00:00 2001 From: Eyeeco <1911362549@qq.com> Date: Wed, 17 Jan 2018 23:16:29 -0800 Subject: [PATCH] =?UTF-8?q?[#17]=20=E9=87=87=E8=B4=AD=E6=A8=A1=E5=9D=97=20?= =?UTF-8?q?(#284)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * [#17] 采购模块 重写合同金额部分 * 修改合同金额获得方式 * 合同金额优化 * 修改了一个模型字段 * 修改字段 --- Procurement/__init__.py | 14 +++++++++++ .../migrations/0008_auto_20180118_2250.py | 24 +++++++++++++++++++ Procurement/models/bidding.py | 1 + Procurement/models/procurement.py | 7 ++++-- Procurement/serializers/procurement.py | 6 ++--- 5 files changed, 47 insertions(+), 5 deletions(-) create mode 100644 Procurement/migrations/0008_auto_20180118_2250.py diff --git a/Procurement/__init__.py b/Procurement/__init__.py index d7f3cf8..babdf8f 100644 --- a/Procurement/__init__.py +++ b/Procurement/__init__.py @@ -196,3 +196,17 @@ (SUPPLIER_REL_C_ENTITY, '实体'), (SUPPLIER_REL_C_TRADE, '贸易'), ) + +PROCUREMENT_MATERIAL_WAITED = 0 +PROCUREMENT_MATERIAL_ADDED_SUMMARY = 1 +PROCUREMENT_MATERIAL_ADDED_ORDER = 2 +PROCUREMENT_MATERIAL_ADDED_EXECUTION = 3 +PROCUREMENT_MATERIAL_EXECUTION_FINISHED = 4 + +PROCUREMENT_MATERIAL_STATUS = ( + (PROCUREMENT_MATERIAL_WAITED, '材料待处理'), + (PROCUREMENT_MATERIAL_ADDED_SUMMARY, '已加入物料汇总'), + (PROCUREMENT_MATERIAL_ADDED_ORDER, '已加入订购单'), + (PROCUREMENT_MATERIAL_ADDED_EXECUTION, '已加入材料执行'), + (PROCUREMENT_MATERIAL_EXECUTION_FINISHED, '材料执行完成'), +) diff --git a/Procurement/migrations/0008_auto_20180118_2250.py b/Procurement/migrations/0008_auto_20180118_2250.py new file mode 100644 index 0000000..3f1779e --- /dev/null +++ b/Procurement/migrations/0008_auto_20180118_2250.py @@ -0,0 +1,24 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.6 on 2018-01-18 14:50 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('Procurement', '0007_auto_20171230_1819'), + ] + + operations = [ + migrations.RemoveField( + model_name='procurementmaterial', + name='add_to_detail', + ), + migrations.AddField( + model_name='procurementmaterial', + name='status', + field=models.IntegerField(choices=[(0, '材料待处理'), (1, '已加入物料汇总'), (2, '已加入订购单'), (3, '已加入材料执行'), (4, '材料执行完成')], default=0, verbose_name='物料状态'), + ), + ] diff --git a/Procurement/models/bidding.py b/Procurement/models/bidding.py index e542edb..5051573 100644 --- a/Procurement/models/bidding.py +++ b/Procurement/models/bidding.py @@ -32,6 +32,7 @@ ) +# TODO: BiddingSheet and Contract ? class BiddingSheet(models.Model, metaclass=TransitionMeta): """ 标单 diff --git a/Procurement/models/procurement.py b/Procurement/models/procurement.py index 587f2a6..6806aed 100644 --- a/Procurement/models/procurement.py +++ b/Procurement/models/procurement.py @@ -9,6 +9,8 @@ PURCHASE_ORDER_STATUS_BEGIN, PURCHASE_ORDER_STATUS_ESTABLISHMENT, PURCHASE_ORDER_STATUS_AUDIT, PURCHASE_ORDER_STATUS_APPROVED, PURCHASE_ORDER_STATUS_FINISH) +from Procurement import ( + PROCUREMENT_MATERIAL_WAITED, PROCUREMENT_MATERIAL_STATUS) from Core.utils.fsm import transition, TransitionMeta @@ -115,8 +117,9 @@ class ProcurementMaterial(models.Model): category = models.CharField(verbose_name='材料分类', max_length=50, blank=True, default='') finished = models.BooleanField(verbose_name='是否结束', default=False) - add_to_detail = models.BooleanField(verbose_name='已加入物料汇总', - default=False) + status = models.IntegerField(verbose_name='物料状态', + choices=PROCUREMENT_MATERIAL_STATUS, + default=PROCUREMENT_MATERIAL_WAITED) count = models.IntegerField(verbose_name='数量') weight = models.FloatField(verbose_name='重量') diff --git a/Procurement/serializers/procurement.py b/Procurement/serializers/procurement.py index af5262d..10b5906 100644 --- a/Procurement/serializers/procurement.py +++ b/Procurement/serializers/procurement.py @@ -13,7 +13,7 @@ class Meta: fields = ( 'id', 'process_material', 'merged_material', 'purchase_order', 'sub_order', 'inventory_type', 'batch_number', 'material_number', - 'delivery_dt', 'category', 'finished', 'add_to_detail', 'count', + 'delivery_dt', 'category', 'finished', 'status', 'count', 'weight') @@ -27,7 +27,7 @@ class Meta(BaseProcurementMaterialSerializer.Meta): fields = ( 'id', 'process_material', 'merged_material', 'purchase_order', 'sub_order', 'inventory_type', 'batch_number', 'material_number', - 'delivery_dt', 'category', 'finished', 'add_to_detail', 'count', + 'delivery_dt', 'category', 'finished', 'status', 'count', 'weight') @@ -42,7 +42,7 @@ class Meta(BaseProcurementMaterialSerializer.Meta): fields = ( 'id', 'process_material', 'merged_material', 'purchase_order', 'sub_order', 'inventory_type', 'batch_number', 'material_number', - 'delivery_dt', 'category', 'finished', 'add_to_detail', 'count', + 'delivery_dt', 'category', 'finished', 'status', 'count', 'weight', 'total_weight') def get_total_weight(self, obj):