Skip to content

Commit

Permalink
合并dev至master (#181)
Browse files Browse the repository at this point in the history
* [update] update README.md

* [update] Update requirements switch to mysql.

* Dev david (#7)

* [update] #3 Rename model.

* [update] #3 Create new model migrations.

* [update] #1 #2 #3 #4 update testcase and models.

* [update] #5 Upgrade to new design.

* [update] remove not used model.

* [fix] fix Travis CI password.

* [fix] Fix Travis CI database character set.

* [update] Update database to STRICT mode.

* [update] Rebuild migrations.

* [fix] Fix test database charset.

* [update] update README.md. (#8)

update README.md.

* [update] update readme.rst and remove static files (#9)

 update readme.rst and remove static files

* [add] Add api for Core. (#10)

* [add] Add api for Core.

* [fix] Fix PEP-8 style.

* [fix] Fix not formatted str in DynamicHashPath. (#11)

* [add] Add API for Distribution. (#13)

* [add] Add API for Distribution.

* [fix] Fix PEP-8 style.

* [delete] Delete templates.

* 修改了README (#12)

* [update] update README (#20)

* [update] update README (#20)

* 细化经销模块不同API字段要求 (#21)

* [update] update README (#20)

* [update] #15 细化经销模块不同API字段要求.

* Feature distribution tests (#22)

* [update] update README (#20)

* [add] #15 Distribution tests.

* [update] #15 more info returned on product created.

* [update] update migrations.

* [update] Untrack migrations.

* [delete] Untrack migrations.

* [add] #15 add biddingdocuemnt API tests.

* [update] init migrations.

* [update] ignore migrations.

* Feature core transition (#23)

* [update] update README (#20)

* [add] A model Transition to manage workflows.

* [fix] Fix PEP-8 style.

* Feature fsm (#24)

* [update] update README (#20)

* [update] Transition stuffs.

* Improved transition
* Added a metaclass to auto generate 'actions' field for model
* Added a mixin to auto generate 'actions' for Serializer
* Added tests for Transition module.

* [update] Improve tests coverage.

* Update distribution with transition (#25)

* [update] update README (#20)

* [update] 使用新的transition进行状态转移

* [add] Add filter support in query string.

* [update] #28 更新API至users, 完善departments相关API (#29)

* [add] badge css for GET, POST, PATCH, DELETE (#30)

* [update] BiddingDocument upload (#31)

* [update] #15 重新设计经销文件上传API (#32)

* [update] #15 重新设计经销文件上传API

* [fix] Fix PEP-8.

* [update] 修改产品API (#34)

* [update] Update Distribution API

* [fix] Fix PEP-8 style.

* 更新经销模块相关API (#36)

* [update] 修改返回前台的status字段为中文

* [add] 增加对媒体文件的路由处理

* [update] Disable CSRF.

* [update] 打开CSRF, 中文化产品的status内容

* [Fix] 修复由于修改了status显示导致的产品无法更新

* 更新经销API (#37)

* [update] 修改返回前台的status字段为中文

* [add] 增加对媒体文件的路由处理

* [update] Disable CSRF.

* [update] 打开CSRF, 中文化产品的status内容

* [Fix] 修复由于修改了status显示导致的产品无法更新

* [update] 为经销文件添加一个 `path_name`属性, 返回文件的文件名

* 更新经销模块API字段内容 (#39)

* [update] 重新设计产品, 招标文件API

* [fix] Fix PEP-8 Style.

* [add] 追踪迁移文件变化 (#41)

* [update] 更新经销模块API (#40)

* [update] 更新经销模块API

* [fix] Fix PEP-8 style.

* 更新ProcessMaterial字段 (#42)

* [update] Update Material model. (#43)

* Dev evan (#38)

* test

* test_url

* 路由名称(模块名小写加下划线)
文档若干bug

* 更新processmaterial字段 (#44)

* 修改processmaterial字段 (#45)

* 增加工作令API销售类型中文表达 (#47)

* [add] 增加工作令API销售类型中文表达

* [fix] Fix PEP-8 style.

* [update] 更新招标文件可用操作键为中文 (#48)

* [update] 注册所有模型到admin站点 (#49)

* [update] 注册所有模型到admin站点

* [fix] Fix PEP-8 style.

* [update] 去除工作令product字段的editable=False (#50)

* [fix] 追加迁移文件 (#51)

* [update] 更新工序模型 (#52)

* [fix] 重新生成生产模块的迁移文件 (#53)

* [update] 焊材入库单API文档 (#55)

* [fix] 修复文档 (#56)

* [update] 更新文档 (#57)

* [add] 库存模块入库单、入库单明细、库存明细API文档 (#58)

* 完成工艺库导入功能 (#46)

* 增加工艺库查询

* 完成工艺库导入

* 增加requirdment

* 取消idea追踪

* debug

* 重构工艺库导入

* 更改API文档

* 使用parser重构工艺库导入

* 修改格式

* 更新API

* 填写API文档

* 更新API

* flake8

* Updates 修改库存模块焊材模型 (#60)

* [update] 更新库存模型

* [fix] Fix PEP-8

* [update] update travis ci configs.

* [fix] 消除迁移依赖

* 根据api修改相应接口 (#68)

* 根据api修改相应接口

* flake8

* Dev wujie 20171215 1 (#71)

* 修改了README

* 添加按主工作令uid模糊查询 子工作令 api

* 编写采购单和采购物料的API文档

* typo

* pass flake8

* fine

* fine

* [update] 统一更新库存模型 (#77)

* [update] 统一更新库存模型

* [fix] 为迁移文件DateTime部分设置默认值

* [fix] 重新生成库存模型迁移文件

* [update] 更新库存模型,使用DateTimeField (#80)

* [update] 更新库存模型,使用DateTimeField

* [update] 焊材入库API

* [fix] Fix PEP-8

* [add] 库存模块入库API (#86)

* [update] 更新迁移文件 (#87)

* Update api.rst (#88)

* [add] 库存模块库存明细API (#89)

* 增加工艺物料api实现 (#91)

* [add] 按照文档增加领用退库API (#97)

* [fix] 修复遗漏的迁移文件 (#98)

* 修改工艺字段 (#102)

* 修改工艺字段

* flake8

* [add] 库存模块添加其他API (#103)

* [add] 添加库存模块过滤器 (#108)

* Feature 工艺 (#104)

* 完成流转路线模块

* flake8

* 去括号

* 优化

* flake8

* 根据模型修改,修改函数字段 (#112)

* Feature 工艺 (#113)

* 完成流转路线模块

* flake8

* 去括号

* 优化

* flake8

* 完成工序路线

* 更新工艺库导入url (#114)

* [fix] 修复温湿度记录卡str方法 (#115)

* Fix 工艺路由 (#116)

* 更新路由

* 加杠

* 增加总重 (#117)

* 更改datetime“ (#118)

* 更改datetime

* flake8

* datetime-> dt

* 合并文档分支到开发分支 (#121)

* [update] 更新库存模块文档 (#59)

* 更新工艺APi (#63)

* [update] 更新库存文档 (#64)

* 更新api (#65)

* * 完成了以下文档的修改和编写。括号内为子表
**材料代用申请单(材料代用申请单明细、材料代用申请单明细评审意见)
**材料执行表(材料执行表明细)
**供应商(供应商文件、供应商报价单)

* -材料代用申请单(材料代用申请单明细、材料代用申请单明细评审意见)
-材料执行表(材料执行表明细)
-供应商(供应商文件、供应商报价单)

* [update] 库存模块API文档 (#74)

* 编写了采购单和采购物料的文档

* [update] 更新库存文档 (#79)

* [update] 修复过时文档 (#81)

* 更新api (#82)

* 更新api (#84)

* 文档中增加了两个模型 (#83)

* 文档中增加了两个模型
-过程跟踪记录
-合同金额明细
这两张表都依附于标单,list和read也依附与标单,且都不需要修改和删除,只有create方法

* boolean->bool

* 修正API (#92)

* 写了生产计划,台账查询,综合工部的api文档

* 写了生产模块里的生产计划,台账查询,综合工部的api。

* 完善api (#93)

* 更新api

* 添加生产模块api

* [delete] 删除多余文档 (#99)

* Updates 统一文档版本 (#100)

* [update] 统一文档版本

* [delete] 移除开发版本字样

* 修复95 (#101)

* 完成采购模块的api文档

* 修改生产模块api

* [fix] 更正库存文档中的work_order_uid为sub_order_uid (#107)

* 更新api (#110)

* [update] 更新badge (#111)

* fixed issue #96

* [add] 添加库存模块台账API文档 (#120)

* 修改生产模块api (#19)

* 修改模型方法 (#123)

* 修改str (#124)

* process-model (#125)

* process-model

* [update] 去除钢材领用单明细上的子工作令外键 (#126)

* [update] 去除钢材领用单明细上的子工作令外键

* [fix] 去除无用导入(PEP-8)

* [add] 入库台账API (#129)

* [add] 入库台账API

* [fix] Fix PEP-8 style.

* 修改采购模块的DateField字段为DateTimeField (#132)

* 采购模块修改了DateField字段为DateTimeField

* for flake8

* migration

* 更改生产模块datetime数据类型 (#135)

* 更改生产模块datetime数据类型

* 删除Production/tests

* makemigrations Production

* 修复前端类型序列化bug (#136)

* 修复前段类型序列化bug

* flake8

* Feature 库存模块 (#137)

* [add] 添加库存台账API

* [update] 为API添加分页器

* 【采购】材料代用模块 (#138)

* 修改材料代用序列化器的问题
增加了材料代用评审意见

* 修改bug

* 修改bug

* 删除字段 (#140)

* Update 工艺模型 (#141)

* 恢复字段

* make migrations

* 增加related_name (#144)

* Feature 库存模块 (#151)

* [update] 更新viewsets为只读

* [add] 添加出库台账API

* Feature 工艺 (#150)

* 流转卡

* 流转卡完成

* basic_file优化

* flake8

* 流转卡工序完成 (#154)

*  [采购模块] 完成材料执行部分的CRUD操作  (#152)

* 修改材料代用序列化器的问题
增加了材料代用评审意见

* [采购模块] 完成材料执行部分的CRUD操作
修改了材料代用、材料执行用户字段的绑定,在viewset中进行
修改了文档,材料执行部分不需要update逻辑
材料执行部分逻辑待待完善

* 修改bug

* 修改一些格式问题

* [update] 使用signals重构子工作令的创建 (#155)

* Fix 检索字段 (#156)

* 修改查询字段

* flake8

* Ptoduction wb (#157)

* 完成工序详细信息,子工作票

* 完成工序详细信息,子工作票api

* 修改工序详细信息过滤函数

* #19 完成生产计划api (#158)

* 生产模块生产计划listapi

* 完成生产计划api

* 修改格式,删除了不必要的代码

* 修改格式

* 修改格式

*  [采购模块]状态更改记录 (#160)

* 修改材料代用序列化器的问题
增加了材料代用评审意见

* [采购模块] 完成材料执行部分的CRUD操作
修改了材料代用、材料执行用户字段的绑定,在viewset中进行
修改了文档,材料执行部分不需要update逻辑
材料执行部分逻辑待待完善

* [采购模块]状态更改记录
该记录只需要随标单的状态修改创建即可

* 回滚文档

* 元组逗号问题

* Feature 核心模块tests (#161)

* [update] 使用Mock更新测试

* [update] 更新焊材领用台账过滤器方法

* [fix] Fix PEP-8 style.

* [fix] 修复字段错误 (#162)

* [update] 将FSM嵌入serializers的validation以及update过程 (#164)

* #17 [采购模块] (#163)

* 完成材料代用创建主表时对子表的创建
完成材料执行主表创建对子表的绑定
对材料执行子表的筛选显示

* 改名

* #17 [采购模块] 完成供应商和财务管理CRUD操作 (#166)

* 供应商模块(供应商、供应商文件、供应商报价)
财务管理(以标单为主,合同金额明细模型)

* 外键复数

* [fix] 修复README (#167)

* [update] 更新支持继承, 修复无效操作应结束判断 (#168)

* [fix] 修复transitions改为字典存储后的遗留问题 (#169)

* #19 [Production] ledgers台账查询api (#171)

* [Production] 台账查询api

* [Production] Rename

* [add] 增加入库单确认自动生成库存明细逻辑 (#172)

* [update] 领用卡外键到工艺物料而不是采购物料 (#173)

* [update] 重建迁移文件 (#174)

* 完成生产工作组,生产工作人员api,修改工序详细信息api (#175)

* 完成生产工作组,生产工作人员api,修改工序详细信息api

* 修改url

* #19 [Production] 综合工部api (#177)

* #19 [Production] 综合工部api

* #19 [Production] 综合工部api

* #19 [Production] 修改过滤器

* #19 [Production] 修改过滤器

* [update] 文档托管至Github Pages (#180)
  • Loading branch information
Time1ess authored Dec 25, 2017
1 parent 461fa83 commit 803d3ad
Show file tree
Hide file tree
Showing 1,443 changed files with 109,807 additions and 128,588 deletions.
3 changes: 2 additions & 1 deletion .flake8
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ exclude =
old_stuff,
migrations,
settings*.py,
manage.py
manage.py,
tmp,
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,11 @@ ENV/
.mypy_cache/

# ERP
documents/build/
!build/
old_stuff/
static/
media/
htmlcov/
*.swp
tmp/
.idea/
6 changes: 2 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,11 @@ install:
- pip install -r requirements.txt

before_script:
- mysql -e 'CREATE DATABASE IF NOT EXISTS ERP_travisci;'
- mysql -e 'CREATE DATABASE IF NOT EXISTS ERP_travisci character set UTF8;'

script:
- flake8
- python manage.py makemigrations
- python manage.py migrate
- coverage run manage.py test -v 2
- coverage run manage.py test -v 2 --debug-mode

notifications:
email: false
Expand Down
10 changes: 8 additions & 2 deletions Core/admin.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# from django.contrib import admin
from django.contrib import admin

# Register your models here.
from Core.models import UserInfo, Department, WorkOrder, SubWorkOrder


admin.site.register(UserInfo)
admin.site.register(Department)
admin.site.register(WorkOrder)
admin.site.register(SubWorkOrder)
8 changes: 6 additions & 2 deletions Core/api/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
from .users import UserViewSet
from .auth import UserViewSet, DepartmentViewSet
from .work_order import WorkOrderViewSet, SubWorkOrderViewSet


__all__ = ['UserViewSet']
__all__ = [
'UserViewSet', 'DepartmentViewSet',
'WorkOrderViewSet', 'SubWorkOrderViewSet',
]
56 changes: 56 additions & 0 deletions Core/api/auth.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
from django.contrib.auth.models import User

from rest_framework import viewsets
from rest_framework.exceptions import MethodNotAllowed
from rest_framework.decorators import list_route
from rest_framework.response import Response

from Core import serializers
from Core.models import Department
from Core.utils.pagination import SmallResultsSetPagination


class UserViewSet(viewsets.ModelViewSet):
"""
用户信息API
"""
pagination_class = SmallResultsSetPagination
queryset = User.objects.exclude(is_staff=True).order_by('pk')

def destroy(self, request, pk=None):
raise MethodNotAllowed(request.method)

def get_serializer_class(self):
if self.action == 'create':
return serializers.UserCreateSerializer
elif self.action == 'list':
return serializers.UserListSerializer
else:
return serializers.UserSerializer


class DepartmentViewSet(viewsets.ModelViewSet):
"""
部门API
"""
pagination_class = SmallResultsSetPagination
queryset = Department.objects.all().order_by('pk')

def destroy(self, request, pk=None):
raise MethodNotAllowed(request.method)

def get_serializer_class(self):
if self.action == 'list':
return serializers.DepartmentListSerializer
else:
return serializers.DepartmentSerializer

@list_route()
def distribution(self, request):
# TODO: Update to real departments
# I strongly doubt this
departments = Department.objects.all()[:4]
mappings = {}
for dep in departments:
mappings[dep.group.name] = dep.id
return Response(mappings)
77 changes: 0 additions & 77 deletions Core/api/users.py

This file was deleted.

32 changes: 32 additions & 0 deletions Core/api/work_order.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
from rest_framework import viewsets, mixins

from Core.models import WorkOrder, SubWorkOrder
from Core.filters import SubWorkOrderFilter
from Core.serializers import WorkOrderSerializer, SubWorkOrderSerializer
from Core.utils.pagination import SmallResultsSetPagination


class WorkOrderViewSet(mixins.CreateModelMixin,
mixins.UpdateModelMixin,
mixins.ListModelMixin,
mixins.RetrieveModelMixin,
viewsets.GenericViewSet):
"""
工作令API
"""
serializer_class = WorkOrderSerializer
pagination_class = SmallResultsSetPagination
queryset = WorkOrder.objects.all().order_by('-pk')


class SubWorkOrderViewSet(mixins.UpdateModelMixin,
mixins.ListModelMixin,
mixins.RetrieveModelMixin,
viewsets.GenericViewSet):
"""
子工作令API
"""
serializer_class = SubWorkOrderSerializer
pagination_class = SmallResultsSetPagination
queryset = SubWorkOrder.objects.all().order_by('-pk')
filter_class = SubWorkOrderFilter
7 changes: 7 additions & 0 deletions Core/apps.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
from django.apps import AppConfig
from django.db.models.signals import post_save


class CoreConfig(AppConfig):
name = 'Core'

def ready(self):
from Core import signals

post_save.connect(signals.create_sub_work_orders,
sender='Core.WorkOrder')
4 changes: 4 additions & 0 deletions Core/filters/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
from .work_order import SubWorkOrderFilter


__all__ = ['SubWorkOrderFilter']
17 changes: 17 additions & 0 deletions Core/filters/work_order.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
from django_filters import rest_framework as filters

from Core.models import SubWorkOrder


class SubWorkOrderFilter(filters.FilterSet):
"""
用于支持前端请求对子工作令queryset进行筛选的过滤器
"""
work_order_uid = filters.CharFilter(name='work_order__uid',
lookup_expr='icontains')
index = filters.NumberFilter(name='index')
finished = filters.BooleanFilter(name='finished')

class Meta:
model = SubWorkOrder
fields = ('work_order_uid', 'index', 'finished')
8 changes: 4 additions & 4 deletions Core/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.6 on 2017-11-28 04:52
# Generated by Django 1.11.6 on 2017-12-06 03:21
from __future__ import unicode_literals

from django.db import migrations, models
Expand Down Expand Up @@ -40,9 +40,9 @@ class Migration(migrations.Migration):
name='UserInfo',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('phone', models.CharField(blank=True, max_length=20, null=True, verbose_name='电话')),
('mobile', models.CharField(blank=True, max_length=20, null=True, verbose_name='移动电话')),
('gender', models.IntegerField(blank=True, choices=[(0, '男'), (1, '女')], null=True, verbose_name='性别')),
('phone', models.CharField(blank=True, default='', max_length=20, verbose_name='电话')),
('mobile', models.CharField(blank=True, default='', max_length=20, verbose_name='移动电话')),
('gender', models.IntegerField(choices=[(0, '男'), (1, '女')], default=0, verbose_name='性别')),
],
options={
'verbose_name': '个人信息',
Expand Down
52 changes: 0 additions & 52 deletions Core/migrations/0002_auto_20171128_1252.py

This file was deleted.

52 changes: 52 additions & 0 deletions Core/migrations/0002_auto_20171206_1121.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.6 on 2017-12-06 03:21
from __future__ import unicode_literals

from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):

initial = True

dependencies = [
('auth', '0008_alter_user_username_max_length'),
('Distribution', '0001_initial'),
('Core', '0001_initial'),
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]

operations = [
migrations.AddField(
model_name='workorder',
name='product',
field=models.OneToOneField(editable=False, on_delete=django.db.models.deletion.CASCADE, to='Distribution.Product', verbose_name='产品'),
),
migrations.AddField(
model_name='userinfo',
name='user',
field=models.OneToOneField(editable=False, on_delete=django.db.models.deletion.CASCADE, related_name='info', to=settings.AUTH_USER_MODEL, verbose_name='用户'),
),
migrations.AddField(
model_name='subworkorder',
name='work_order',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='Core.WorkOrder', verbose_name='所属工作令'),
),
migrations.AddField(
model_name='department',
name='admin',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to=settings.AUTH_USER_MODEL, verbose_name='部门管理员'),
),
migrations.AddField(
model_name='department',
name='group',
field=models.OneToOneField(editable=False, on_delete=django.db.models.deletion.CASCADE, to='auth.Group', verbose_name='组'),
),
migrations.AddField(
model_name='department',
name='superior',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='Core.Department', verbose_name='上级部门'),
),
]
Loading

0 comments on commit 803d3ad

Please sign in to comment.