|
|
@@ -24,7 +24,7 @@ from apps.AppInfo.models import (
|
|
|
Hotel_Info, Hotel_Photo, JKdata, MyUser, Pick_Pub, Product, QXZdata,
|
|
|
QXZdata_New, QXZstatus, QXZstatus_New, QXZswitchdata, QXZswitchstatus,
|
|
|
Video_data,GardenArea,Store_Manage,Areacrop,Sell_Manage,Person_Pick,QXZAutoswitch,Sightsee_Info,Pic_Info,
|
|
|
- QXZ_Alarm_Log)
|
|
|
+ QXZ_Alarm_Log,Expert)
|
|
|
from apps.Equipment.all_dict import qxz_dict
|
|
|
|
|
|
|
|
|
@@ -2424,9 +2424,11 @@ class Sell_New(ListView):
|
|
|
money = request.POST.get("money")
|
|
|
time = request.POST.get("time")
|
|
|
s_id = request.POST.get("id")
|
|
|
+ username = request.user.username
|
|
|
+
|
|
|
if s_id:
|
|
|
try:
|
|
|
- farm_obj = FarmList.objects.get(name=farm)
|
|
|
+ farm_obj = FarmList.objects.get(name=farm,user=username)
|
|
|
sell_obj = Sell_Manage.objects.get(id=s_id)
|
|
|
sell_obj.farm = farm_obj
|
|
|
sell_obj.name = name
|
|
|
@@ -2440,7 +2442,7 @@ class Sell_New(ListView):
|
|
|
data = "0"
|
|
|
else:
|
|
|
try:
|
|
|
- farm_obj = FarmList.objects.get(name=farm)
|
|
|
+ farm_obj = FarmList.objects.get(name=farm,user=username)
|
|
|
Sell_Manage.objects.create(farm=farm_obj,name=name,num=num,money=money,upl_time=time)
|
|
|
data = "1"
|
|
|
except Exception as e:
|
|
|
@@ -2479,6 +2481,7 @@ class CropCount(ListView):
|
|
|
def get(self,request):
|
|
|
return render(request, 'backstageNet/production/cropcount.html', context={})
|
|
|
def post(self,request):
|
|
|
+ username = request.user.username
|
|
|
crop_count = request.POST.get('crop_count')
|
|
|
area = request.POST.get('area')
|
|
|
crop_id = request.POST.get('id')
|
|
|
@@ -2489,6 +2492,7 @@ class CropCount(ListView):
|
|
|
print(count)
|
|
|
#修改
|
|
|
if crop_id:
|
|
|
+ print("修改")
|
|
|
try:
|
|
|
crops =GardenArea.objects.get(name=area)
|
|
|
crop = Areacrop.objects.filter(id=crop_id).update(
|
|
|
@@ -2502,6 +2506,7 @@ class CropCount(ListView):
|
|
|
print(e)
|
|
|
data = "0"
|
|
|
else:
|
|
|
+ print("新增")
|
|
|
#新增
|
|
|
try:
|
|
|
crops =GardenArea.objects.get(name=area)
|
|
|
@@ -2532,35 +2537,35 @@ class CropCount_View(ListView):
|
|
|
for i in art:
|
|
|
art_list = Areacrop.objects.filter(area=i)
|
|
|
for x in art_list:
|
|
|
- if x.end_time:
|
|
|
- time = int(x.upl_time.strftime("%Y%m%d"))
|
|
|
- time_now = int(x.end_time.strftime("%Y%m%d"))
|
|
|
- data = time_now-time
|
|
|
- curro = "当前阶段已结束"
|
|
|
- h2 = {"cropname":x.cropname,
|
|
|
- "area":x.area.name,
|
|
|
- "crop_count":x.crop_count,
|
|
|
- "img":x.area.img,
|
|
|
- "time":data,
|
|
|
- "upl_time":x.upl_time.strftime('%Y-%m-%d'),
|
|
|
- "id":x.id
|
|
|
- }
|
|
|
- dat.append({"data":h2,"curro":curro})
|
|
|
- else:
|
|
|
- time = int(x.upl_time.strftime("%Y%m%d"))
|
|
|
- time_now = int(timezone.now().strftime("%Y%m%d"))
|
|
|
- data = time_now-time
|
|
|
- print(data)
|
|
|
- curro = ""
|
|
|
- h2 = {"cropname":x.cropname,
|
|
|
- "area":x.area.name,
|
|
|
- "crop_count":x.crop_count,
|
|
|
- "img":x.area.img,
|
|
|
- "time":data,
|
|
|
- "id":x.id,
|
|
|
- "upl_time":x.upl_time.strftime('%Y-%m-%d')
|
|
|
- }
|
|
|
- dat.append({"data":h2,"curro":curro})
|
|
|
+ # if x.end_time:
|
|
|
+ # time = int(x.upl_time.strftime("%Y%m%d"))
|
|
|
+ # time_now = int(x.end_time.strftime("%Y%m%d"))
|
|
|
+ # data = time_now-time
|
|
|
+ # curro = "当前阶段已结束"
|
|
|
+ # h2 = {"cropname":x.cropname,
|
|
|
+ # "area":x.area.name,
|
|
|
+ # "crop_count":x.crop_count,
|
|
|
+ # "img":x.area.img,
|
|
|
+ # "time":data,
|
|
|
+ # "upl_time":x.upl_time.strftime('%Y-%m-%d'),
|
|
|
+ # "id":x.id
|
|
|
+ # }
|
|
|
+ # dat.append({"data":h2,"curro":curro})
|
|
|
+ # else:
|
|
|
+ time = int(x.upl_time.strftime("%Y%m%d"))
|
|
|
+ time_now = int(timezone.now().strftime("%Y%m%d"))
|
|
|
+ data = time_now-time
|
|
|
+ print(data)
|
|
|
+ curro = ""
|
|
|
+ h2 = {"cropname":x.cropname,
|
|
|
+ "area":x.area.name,
|
|
|
+ "crop_count":x.crop_count,
|
|
|
+ "img":x.area.img,
|
|
|
+ "time":data,
|
|
|
+ "id":x.id,
|
|
|
+ "upl_time":x.upl_time.strftime('%Y-%m-%d')
|
|
|
+ }
|
|
|
+ dat.append({"data":h2,"curro":curro})
|
|
|
nums = len(dat)
|
|
|
dat = dat[(9*(page-1)):(page*9)]
|
|
|
data = json.dumps({"dat":dat,"nums":nums})
|
|
|
@@ -3083,7 +3088,7 @@ class Person_Farm_Edit(ListView):
|
|
|
return HttpResponse(data)
|
|
|
|
|
|
|
|
|
-# 地块发布
|
|
|
+# 园区发布
|
|
|
class Person_Area_Pub(ListView):
|
|
|
def get(self,request):
|
|
|
pass
|
|
|
@@ -3651,4 +3656,51 @@ class Alarm_Record(ListView):
|
|
|
dat = dat[(10*(page-1)):(page*10)]
|
|
|
data = {"dat":dat,"nums":nums}
|
|
|
data = json.dumps(data)
|
|
|
- return HttpResponse(data)
|
|
|
+ return HttpResponse(data)
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+class Expert_Img(ListView):
|
|
|
+ def get(self,request):
|
|
|
+ pass
|
|
|
+ def post(self,request):
|
|
|
+ # e_id = request.POST.get('id')
|
|
|
+ # news_sta = Article.objects.get(id=e_id)
|
|
|
+ guide_photo = request.FILES['upload']
|
|
|
+ if guide_photo:
|
|
|
+ print("新闻图片:", guide_photo)
|
|
|
+ news_photo_dir = 'media/uploads/'
|
|
|
+ end_name = guide_photo.name.split('.')[-1]
|
|
|
+ # 判断如果路径不存在,即创建路径
|
|
|
+ if os.path.exists(news_photo_dir) == False:
|
|
|
+ os.makedirs(news_photo_dir)
|
|
|
+ img = Image.open(guide_photo)
|
|
|
+ now_time = time.strftime('%Y%m%d%H%M%S', time.localtime(time.time()))
|
|
|
+ pic_name = now_time + '.' + end_name
|
|
|
+ print("pic_name:", pic_name)
|
|
|
+ img.save(news_photo_dir + pic_name)
|
|
|
+ news_photo = news_photo_dir + pic_name
|
|
|
+ print("new_photo:",news_photo)
|
|
|
+ data = {"code": 0,"msg": "","data": {"src": news_photo}}
|
|
|
+ else:
|
|
|
+ new_photo = "0"
|
|
|
+ data = {"code": 404,"msg": "","data": {"src": news_photo}}
|
|
|
+ data = json.dumps(data)
|
|
|
+ return HttpResponse(data)
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+class Expert_Info(ListView):
|
|
|
+ def get(self,request):
|
|
|
+ page = int(request.GET.get("page"))
|
|
|
+ expert = Expert.objects.all()
|
|
|
+ nums = expert.count()
|
|
|
+ expert = expert[(10*(page-1)):(page*10)]
|
|
|
+ return render(request, 'backstageNet/limit/expertList.html', context={"expert":expert,"nums":nums})
|
|
|
+ def post(self, request):
|
|
|
+ name = request.POST.get('name')
|
|
|
+ relation = request.POST.get('relation')
|
|
|
+ desc = request.POST.get('desc')
|
|
|
+ pic = request.POST.get('pic')
|
|
|
+ Expert.objects.create(name=name,relation=relation,desc=desc,pic=pic)
|
|
|
+ return HttpResponse("1")
|