From 169a4bc421f4a5b54d8b325a5f202cfd927f01e5 Mon Sep 17 00:00:00 2001
From: guangyue lu <2984426953@qq.com>
Date: Thu, 25 May 2023 14:05:27 +0800
Subject: [PATCH 1/2] =?UTF-8?q?=E5=AE=8C=E6=88=90=E4=BA=86=E8=A1=A8?=
=?UTF-8?q?=E5=8D=95=E6=98=BE=E7=A4=BA?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
system/LiveStream/settings.py | 2 +-
system/login/urls.py | 4 +-
system/proc/admin.py | 5 ++
system/proc/models.py | 92 ++++++++++++++++++++
system/proc/urls.py | 4 +-
system/proc/views.py | 24 ++++-
system/templates/Procurement/index.html | 55 +++++++-----
system/templates/Procurement/order-page.html | 2 +-
system/templates/Procurement/proc-check.html | 2 +-
system/templates/Procurement/proc-plan.html | 2 +-
system/templates/index.html | 2 +-
11 files changed, 162 insertions(+), 32 deletions(-)
diff --git a/system/LiveStream/settings.py b/system/LiveStream/settings.py
index ac97590..9c0f6f5 100644
--- a/system/LiveStream/settings.py
+++ b/system/LiveStream/settings.py
@@ -84,7 +84,7 @@ DATABASES = {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'livestream',
'USER': 'root',
- 'PASSWORD': '123456',
+ 'PASSWORD': 'lgy7932655',
'HOST': 'localhost',
'PORT': '3306'
}
diff --git a/system/login/urls.py b/system/login/urls.py
index 66911f4..09ce7c8 100644
--- a/system/login/urls.py
+++ b/system/login/urls.py
@@ -1,4 +1,4 @@
-from django.urls import path
+from django.urls import path,include
from django.urls import re_path as url
from . import views
from . import view1
@@ -11,7 +11,7 @@ urlpatterns = [
path('register/', views.register, name='register'),
path('create/', views.create, name='create'),
path('i_graph1/', views.index_graph1, name='i_graph1'),
- path('index1/Proc_index/', views.proc_index, name='proc_index'),
+ path('index1/Proc_index/', include("proc.urls"), name='proc_index'),
path('index1/Sales_index/', views.sale_index, name='sale_index'),
path('index1/Warehouse_index/', views.Warehouse_index, name='warehouse_index'),
path('index1/live_info', views.Stream_info, name='stream_info'),
diff --git a/system/proc/admin.py b/system/proc/admin.py
index 8c38f3f..d3e3c28 100644
--- a/system/proc/admin.py
+++ b/system/proc/admin.py
@@ -1,3 +1,8 @@
from django.contrib import admin
# Register your models here.
+
+from .models import *
+admin.site.register(ProcureOrder)
+admin.site.register(ProcurePlan)
+admin.site.register(ReplenishRequest)
diff --git a/system/proc/models.py b/system/proc/models.py
index 71a8362..204d336 100644
--- a/system/proc/models.py
+++ b/system/proc/models.py
@@ -1,3 +1,95 @@
from django.db import models
+
# Create your models here.
+
+
+class EmployeeInfo(models.Model):
+ eid = models.CharField(primary_key=True, max_length=10)
+ ename = models.CharField(max_length=10, blank=True, null=True)
+ psword = models.CharField(max_length=20, blank=True, null=True)
+ etype = models.CharField(max_length=20, blank=True, null=True)
+
+ class Meta:
+ managed = False
+ db_table = 'employee_info'
+
+
+class ProcureAdmin(models.Model):
+ eid = models.OneToOneField(EmployeeInfo, models.DO_NOTHING, db_column='eid', primary_key=True)
+ pro_name = models.CharField(max_length=10, blank=True, null=True)
+
+ class Meta:
+ managed = False
+ db_table = 'procure_admin'
+
+
+class ProcureOrder(models.Model): # 采购订单
+ procure = models.OneToOneField('ProcurePlan', models.DO_NOTHING,
+ primary_key=True) # The composite primary key (sup_id, procure_id) found, that is not
+ # supported. The first column is selected.
+ sup = models.ForeignKey('SupplyInfo', models.DO_NOTHING)
+ procure_price = models.FloatField()
+ procure_num = models.IntegerField()
+
+ class Meta:
+ managed = False
+ db_table = 'procure_order'
+ unique_together = (('sup', 'procure'),)
+
+
+class ProcurePlan(models.Model): # 采购计划
+ procure = models.OneToOneField('ReplenishRequest', models.DO_NOTHING, primary_key=True)
+ check_status = models.CharField(max_length=8)
+ project_intro = models.CharField(max_length=1024, blank=True, null=True)
+ procure_rule = models.CharField(max_length=1024, blank=True, null=True)
+ procure_content = models.CharField(max_length=1024, blank=True, null=True)
+
+ class Meta:
+ managed = False
+ db_table = 'procure_plan'
+
+
+class ReplenishRequest(models.Model):
+ request_num = models.IntegerField()
+ request_time = models.DateTimeField()
+ procure_id = models.CharField(primary_key=True, max_length=10)
+ eid = models.ForeignKey(ProcureAdmin, models.DO_NOTHING, db_column='eid')
+ goods = models.ForeignKey('StockInfo', models.DO_NOTHING, blank=True, null=True)
+
+ class Meta:
+ managed = False
+ db_table = 'replenish_request'
+
+
+class SupplyInfo(models.Model):
+ sup_id = models.CharField(primary_key=True, max_length=10)
+ sup_name = models.CharField(max_length=20)
+ sup_contact = models.CharField(max_length=15)
+ sup_serve = models.CharField(max_length=1024)
+ sup_level = models.CharField(max_length=10)
+
+ class Meta:
+ managed = False
+ db_table = 'supply_info'
+
+
+class StockInfo(models.Model):
+ goods = models.OneToOneField('GoodsInfo', models.DO_NOTHING, primary_key=True)
+ goods_details = models.CharField(max_length=1024, blank=True, null=True)
+ stock_num = models.IntegerField()
+
+ class Meta:
+ managed = False
+ db_table = 'stock_info'
+
+
+class GoodsInfo(models.Model):
+ goods_id = models.CharField(primary_key=True, max_length=10)
+ goods_name = models.CharField(max_length=20, blank=True, null=True)
+ goods_type = models.CharField(max_length=20, blank=True, null=True)
+ gprice = models.FloatField(blank=True, null=True)
+
+ class Meta:
+ managed = False
+ db_table = 'goods_info'
diff --git a/system/proc/urls.py b/system/proc/urls.py
index ddd8a80..261e24d 100644
--- a/system/proc/urls.py
+++ b/system/proc/urls.py
@@ -1,5 +1,5 @@
from django.urls import path
-from proc import views
+from . import views
app_name='proc'#需要添加app名称,不然include无法找到该model,在html文件里需要加上app名
@@ -8,4 +8,6 @@ urlpatterns = [
path('order', views.proc_order, name='proc_order'),
path('check', views.proc_check, name='proc_check'),
path('plan', views.proc_plan, name='proc_plan'),
+ path('', views.ShowReplenishRequest, name='show_replenish'),
+ # path('', views.ShowProcurePlan, name='show_plan')
]
diff --git a/system/proc/views.py b/system/proc/views.py
index ae7e0ca..df2127a 100644
--- a/system/proc/views.py
+++ b/system/proc/views.py
@@ -1,15 +1,37 @@
from django.shortcuts import render
# Create your views here.
-
+from .models import *
from django.http import HttpResponse
+
def proc_order(request):
return render(request, '../templates/Procurement/order-page.html')
+
def proc_check(request):
return render(request, '../templates/Procurement/proc-check.html')
+
def proc_plan(request):
return render(request, '../templates/Procurement/proc-plan.html')
+
+def ShowReplenishRequest(request):
+ replenish = ReplenishRequest.objects.all()
+ plan = ProcurePlan.objects.all()
+ order = ProcureOrder.objects.all()
+ #goods = GoodsInfo.objects.all()
+ for item in plan:
+ # goods_id = ReplenishRequest.objects.filter(procure_id=item.procure.procure_id).first().goods.goods_id
+ goods_id = item.procure.goods.goods_id
+ item.procure_content = GoodsInfo.objects.filter(goods_id=goods_id).first().goods_name
+ # order = ProcureOrder.objects.select_related("procure")
+ return render(request, '../templates/Procurement/index.html', {"replenish": replenish, "plan": plan, "order":order})
+
+
+'''
+def ShowProcurePlan(request):
+ plan = ProcurePlan.objects.all()
+ return render(request, '../templates/Procurement/index.html', locals())
+'''
diff --git a/system/templates/Procurement/index.html b/system/templates/Procurement/index.html
index 77fb878..56c23aa 100644
--- a/system/templates/Procurement/index.html
+++ b/system/templates/Procurement/index.html
@@ -110,23 +110,26 @@
@@ -141,25 +144,27 @@
@@ -176,21 +181,25 @@
| 订单编号 |
商品品名 |
- 商品代码 |
- 库存量 |
- 本单采购预算 |
+ 商品编号 |
+ 供应商编号 |
+ 采购数量 |
+ 采购价格 |
是否修改内容 |
+ {% for item in order %}
- | ? |
- ? |
- ? |
- ? |
- ? |
+ {{item.procure.procure.procure_id}} |
+ {{item.procure.procure.goods.goods.goods_name}} |
+ {{item.procure.procure.goods.goods_id}} |
+ {{item.sup.sup_id}} |
+ {{item.procure_num}} |
+ {{item.procure_price}} |
|
+ {% endfor %}
diff --git a/system/templates/Procurement/order-page.html b/system/templates/Procurement/order-page.html
index 6366b5d..54467a6 100644
--- a/system/templates/Procurement/order-page.html
+++ b/system/templates/Procurement/order-page.html
@@ -83,7 +83,7 @@