Skip to content

Commit

Permalink
[#17] 采购模块 (#284)
Browse files Browse the repository at this point in the history
* [#17] 采购模块
重写合同金额部分

* 修改合同金额获得方式

* 合同金额优化

* 修改了一个模型字段

* 修改字段
  • Loading branch information
eyeeco authored and Time1ess committed Jan 18, 2018
1 parent b920d27 commit 2576105
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 5 deletions.
14 changes: 14 additions & 0 deletions Procurement/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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, '材料执行完成'),
)
24 changes: 24 additions & 0 deletions Procurement/migrations/0008_auto_20180118_2250.py
Original file line number Diff line number Diff line change
@@ -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='物料状态'),
),
]
1 change: 1 addition & 0 deletions Procurement/models/bidding.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
)


# TODO: BiddingSheet and Contract ?
class BiddingSheet(models.Model, metaclass=TransitionMeta):
"""
标单
Expand Down
7 changes: 5 additions & 2 deletions Procurement/models/procurement.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down Expand Up @@ -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='重量')

Expand Down
6 changes: 3 additions & 3 deletions Procurement/serializers/procurement.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')


Expand All @@ -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')


Expand All @@ -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):
Expand Down

0 comments on commit 2576105

Please sign in to comment.