Merge branch 'develop' of https://e.coding.net/ctcdevteam/hberp/hberp into develop
This commit is contained in:
commit
8a83e868b7
|
@ -130,9 +130,15 @@
|
||||||
let imgData = {base64:img};
|
let imgData = {base64:img};
|
||||||
faceLogin(imgData).then((res) => {
|
faceLogin(imgData).then((res) => {
|
||||||
if (res.code >= 200) {
|
if (res.code >= 200) {
|
||||||
let item= {name:res.data.username,token:res.data.access};
|
if(res.data.access){
|
||||||
that.$emit('func',item);
|
let item= {name:res.data.username,token:res.data.access};
|
||||||
that.$message.success("身份认证成功!");
|
that.$emit('func',item);
|
||||||
|
that.$message.success("身份认证成功!");
|
||||||
|
this.closeCamera();
|
||||||
|
}else{
|
||||||
|
that.uploadLock = false;
|
||||||
|
that.$message.error("身份认证失败,请重新进行人脸识别!");
|
||||||
|
}
|
||||||
}else{
|
}else{
|
||||||
// 打开锁
|
// 打开锁
|
||||||
that.uploadLock = false;
|
that.uploadLock = false;
|
||||||
|
@ -141,21 +147,40 @@
|
||||||
}).catch(()=>{
|
}).catch(()=>{
|
||||||
// 打开锁
|
// 打开锁
|
||||||
that.uploadLock = false;
|
that.uploadLock = false;
|
||||||
// this.$message.error('面部识别失败请重新验证');
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
closeCamera () {
|
closeCamera () {
|
||||||
|
debugger;
|
||||||
|
let video = document.getElementById('video');
|
||||||
|
let stream = video.srcObject;
|
||||||
|
console.log(stream);
|
||||||
|
let tracks = stream.getTracks();
|
||||||
|
tracks.forEach(track => {
|
||||||
|
track.stop()
|
||||||
|
});
|
||||||
|
video.srcObject = null;
|
||||||
this.video.srcObject.getTracks()[0].stop();
|
this.video.srcObject.getTracks()[0].stop();
|
||||||
},
|
},
|
||||||
|
},
|
||||||
|
beforeDestroy() {
|
||||||
|
let video = document.getElementById('video');
|
||||||
|
let stream = video.srcObject;
|
||||||
|
console.log(stream);
|
||||||
|
let tracks = stream.getTracks();
|
||||||
|
tracks.forEach(track => {
|
||||||
|
track.stop()
|
||||||
|
});
|
||||||
|
video.srcObject = null;
|
||||||
|
this.video.srcObject.getTracks()[0].stop();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
<style scoped>
|
<style scoped>
|
||||||
.faceLoginWrap{
|
.faceLoginWrap{
|
||||||
padding: 50px;
|
/*padding: 50px;*/
|
||||||
width: 600px;
|
/*width: 600px;*/
|
||||||
height: 600px;
|
/*height: 600px;*/
|
||||||
background: #000000;
|
/*background: #000000;*/
|
||||||
margin:50px auto 0 auto;
|
margin:50px auto 0 auto;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
}
|
}
|
||||||
|
@ -169,7 +194,7 @@
|
||||||
position: relative;
|
position: relative;
|
||||||
width: 500px;
|
width: 500px;
|
||||||
height: 500px;
|
height: 500px;
|
||||||
background: #000000;
|
/*background: #000000;*/
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -144,12 +144,12 @@
|
||||||
</script>
|
</script>
|
||||||
<style scoped>
|
<style scoped>
|
||||||
.faceLoginWrap{
|
.faceLoginWrap{
|
||||||
padding: 50px;
|
/*padding: 50px;*/
|
||||||
width: 600px;
|
/*width: 600px;*/
|
||||||
height: 600px;
|
/*height: 600px;*/
|
||||||
background: #000000;
|
/*background: #000000;*/
|
||||||
margin:50px auto 0 auto;
|
margin:50px auto 0 auto;
|
||||||
box-sizing: border-box;
|
/*box-sizing: border-box;*/
|
||||||
}
|
}
|
||||||
|
|
||||||
#screenshotCanvas {
|
#screenshotCanvas {
|
||||||
|
@ -157,6 +157,8 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.video-box {
|
.video-box {
|
||||||
|
width: 500px;
|
||||||
|
height: 500px;
|
||||||
margin: auto;
|
margin: auto;
|
||||||
position: relative;
|
position: relative;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,11 +2,11 @@
|
||||||
<div class="sidebar-logo-container" :class="{'collapse':collapse}">
|
<div class="sidebar-logo-container" :class="{'collapse':collapse}">
|
||||||
<transition name="sidebarLogoFade">
|
<transition name="sidebarLogoFade">
|
||||||
<router-link v-if="collapse" key="collapse" class="sidebar-logo-link" to="/">
|
<router-link v-if="collapse" key="collapse" class="sidebar-logo-link" to="/">
|
||||||
<img v-if="logo" :src="logo" class="sidebar-logo">
|
<!--<img v-if="logo" :src="logo" class="sidebar-logo">-->
|
||||||
<h1 v-else class="sidebar-title">{{ title }} </h1>
|
<h1 class="sidebar-title">{{ title }} </h1>
|
||||||
</router-link>
|
</router-link>
|
||||||
<router-link v-else key="expand" class="sidebar-logo-link" to="/">
|
<router-link v-else key="expand" class="sidebar-logo-link" to="/">
|
||||||
<img v-if="logo" :src="logo" class="sidebar-logo">
|
<!--<img v-if="logo" :src="logo" class="sidebar-logo">-->
|
||||||
<h1 class="sidebar-title">{{ title }} </h1>
|
<h1 class="sidebar-title">{{ title }} </h1>
|
||||||
</router-link>
|
</router-link>
|
||||||
</transition>
|
</transition>
|
||||||
|
|
|
@ -9,14 +9,14 @@
|
||||||
</div>
|
</div>
|
||||||
<app-main />
|
<app-main />
|
||||||
|
|
||||||
<div class="floatDiv" @click="gotoTicketPage" v-if="count.total_count>0">
|
<!--<div class="floatDiv" @click="gotoTicketPage" v-if="count.total_count>0">
|
||||||
<el-badge :value="count.total_count" class="item ">
|
<el-badge :value="count.total_count" class="item ">
|
||||||
<el-icon class="el-icon-s-management" style="font-size: 30px;color: #409EFF;padding-top: 12px;"></el-icon>
|
<el-icon class="el-icon-s-management" style="font-size: 30px;color: #409EFF;padding-top: 12px;"></el-icon>
|
||||||
</el-badge>
|
</el-badge>
|
||||||
<div class="typeWrap">
|
<div class="typeWrap">
|
||||||
<div class="detailItem" v-for="item in count.details" :key="item.workflow">{{item.workflow__name}}:{{item.count}}</div>
|
<div class="detailItem" v-for="item in count.details" :key="item.workflow">{{item.workflow__name}}:{{item.count}}</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>-->
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -49,7 +49,7 @@
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="完工时间" prop="end_date">
|
<el-table-column label="完工时间" prop="end_date">
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="检验状态">
|
<el-table-column label="首件确认状态">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<span v-if="scope.row.leader_1!==null&&scope.row.leader_2!==null&&scope.row.leader_3!==null">已完成</span>
|
<span v-if="scope.row.leader_1!==null&&scope.row.leader_2!==null&&scope.row.leader_3!==null">已完成</span>
|
||||||
<span v-else>未完成</span>
|
<span v-else>未完成</span>
|
||||||
|
@ -189,6 +189,13 @@
|
||||||
<img style="width: 45%;vertical-align: text-top;" :src="'http://47.95.0.242:2222'+item.field_value"/>
|
<img style="width: 45%;vertical-align: text-top;" :src="'http://47.95.0.242:2222'+item.field_value"/>
|
||||||
</div>
|
</div>
|
||||||
</el-col>
|
</el-col>
|
||||||
|
<el-col :span="12" v-if="achieve">
|
||||||
|
<div class="items">
|
||||||
|
<span class="itemLabel">检验结果:</span>
|
||||||
|
<span v-if="is_testok">检验合格</span>
|
||||||
|
<span v-else>检验不合格</span>
|
||||||
|
</div>
|
||||||
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
<el-row class="reviewWrap" v-if="!achieve">
|
<el-row class="reviewWrap" v-if="!achieve">
|
||||||
<div class="reviewBlock">
|
<div class="reviewBlock">
|
||||||
|
@ -228,6 +235,7 @@
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "firstCheck",
|
name: "firstCheck",
|
||||||
|
inject:['reload'],
|
||||||
components: {Pagination,faceLogin,customForm},
|
components: {Pagination,faceLogin,customForm},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
@ -263,6 +271,7 @@
|
||||||
reviewVisible:false,
|
reviewVisible:false,
|
||||||
recordVisible:false,
|
recordVisible:false,
|
||||||
is_midtesting:false,
|
is_midtesting:false,
|
||||||
|
is_testok:false,
|
||||||
formName:'首件确认检查表',
|
formName:'首件确认检查表',
|
||||||
update_time:'',
|
update_time:'',
|
||||||
first_sign_time:'',
|
first_sign_time:'',
|
||||||
|
@ -332,6 +341,7 @@
|
||||||
that.first_sign_time = scope.row.first_sign_time?scope.row.first_sign_time:'';
|
that.first_sign_time = scope.row.first_sign_time?scope.row.first_sign_time:'';
|
||||||
getTestRecordItem(scope.row.first_test).then((res) => {
|
getTestRecordItem(scope.row.first_test).then((res) => {
|
||||||
that.formName = res.data.form_.name;
|
that.formName = res.data.form_.name;
|
||||||
|
that.is_testok = res.data.is_testok;
|
||||||
that.update_time = res.data.update_time;
|
that.update_time = res.data.update_time;
|
||||||
let fieldList = res.data.record_data;
|
let fieldList = res.data.record_data;
|
||||||
that.fieldList = [...fieldList];
|
that.fieldList = [...fieldList];
|
||||||
|
@ -394,6 +404,29 @@
|
||||||
/*关闭相机*/
|
/*关闭相机*/
|
||||||
closeCamera () {
|
closeCamera () {
|
||||||
this.$refs.faceTracking.closeCamera();
|
this.$refs.faceTracking.closeCamera();
|
||||||
|
let video = document.getElementById('video');
|
||||||
|
let stream = video.srcObject;
|
||||||
|
console.log(stream);
|
||||||
|
let tracks = stream.getTracks();
|
||||||
|
tracks.forEach(track => {
|
||||||
|
track.stop()
|
||||||
|
});
|
||||||
|
video.srcObject = null;
|
||||||
|
/*let firstTestIndex = sessionStorage.getItem('firstTestIndex');
|
||||||
|
let firstTestProcess = sessionStorage.getItem('firstTestProcess');
|
||||||
|
if(firstTestIndex){
|
||||||
|
sessionStorage.removeItem('firstTestIndex');
|
||||||
|
sessionStorage.setItem('firstTestIndex',this.activeIndex);
|
||||||
|
}else{
|
||||||
|
sessionStorage.setItem('firstTestIndex',this.activeIndex);
|
||||||
|
}
|
||||||
|
if(firstTestProcess){
|
||||||
|
sessionStorage.removeItem('firstTestProcess');
|
||||||
|
sessionStorage.setItem('firstTestProcess',this.listQuery.process);
|
||||||
|
}else{
|
||||||
|
sessionStorage.setItem('firstTestProcess',this.listQuery.process);
|
||||||
|
}
|
||||||
|
this.reload();*/
|
||||||
// this.thisVideo.srcObject.getTracks()[0].stop();
|
// this.thisVideo.srcObject.getTracks()[0].stop();
|
||||||
},
|
},
|
||||||
//保存首件检查
|
//保存首件检查
|
||||||
|
@ -482,28 +515,63 @@
|
||||||
//获取人脸数据
|
//获取人脸数据
|
||||||
getMsgFormSon(data){
|
getMsgFormSon(data){
|
||||||
let that =this;
|
let that =this;
|
||||||
if(that.leader==='leader_1'){
|
if(data.token!==''&&data.token!==null&&data.token!==undefined){
|
||||||
that.leader_1=data.name;
|
if(that.leader==='leader_1'){
|
||||||
}else if(that.leader==='leader_2'){
|
that.leader_1=data.name;
|
||||||
that.leader_2=data.name;
|
}else if(that.leader==='leader_2'){
|
||||||
}else if(that.leader==='leader_3'){
|
that.leader_2=data.name;
|
||||||
that.leader_3=data.name;
|
}else if(that.leader==='leader_3'){
|
||||||
}
|
that.leader_3=data.name;
|
||||||
firstAudit(that.planId,{leader:that.leader ,token : data.token}).then(res=>{
|
|
||||||
if(res.code===200){
|
|
||||||
this.limitedPhoto = false;
|
|
||||||
if(that.leader_1!==null&&that.leader_2!==null&&that.leader_3!==null){
|
|
||||||
this.reviewVisible = false;
|
|
||||||
}
|
|
||||||
that.getTableData();
|
|
||||||
}
|
}
|
||||||
})
|
firstAudit(that.planId,{leader:that.leader ,token : data.token}).then(res=>{
|
||||||
|
this.limitedPhoto = false;
|
||||||
|
if(res.code===200){
|
||||||
|
this.limitedPhoto = false;
|
||||||
|
if(that.leader_1!==null&&that.leader_2!==null&&that.leader_3!==null){
|
||||||
|
this.reviewVisible = false;
|
||||||
|
}
|
||||||
|
/* let firstTestIndex = sessionStorage.getItem('firstTestIndex');
|
||||||
|
let firstTestProcess = sessionStorage.getItem('firstTestProcess');
|
||||||
|
if(firstTestIndex){
|
||||||
|
sessionStorage.removeItem('firstTestIndex');
|
||||||
|
sessionStorage.setItem('firstTestIndex',this.activeIndex);
|
||||||
|
}else{
|
||||||
|
sessionStorage.setItem('firstTestIndex',this.activeIndex);
|
||||||
|
}
|
||||||
|
if(firstTestProcess){
|
||||||
|
sessionStorage.removeItem('firstTestProcess');
|
||||||
|
sessionStorage.setItem('firstTestProcess',this.listQuery.process);
|
||||||
|
}else{
|
||||||
|
sessionStorage.setItem('firstTestProcess',this.listQuery.process);
|
||||||
|
}*/
|
||||||
|
that.getTableData();
|
||||||
|
// that.reload();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
mounted() {
|
mounted() {
|
||||||
|
debugger;
|
||||||
this.getProcessList();
|
this.getProcessList();
|
||||||
}
|
/*let that = this;
|
||||||
|
let activeIndex = sessionStorage.getItem('firstTestIndex');
|
||||||
|
let firstTestProcess = sessionStorage.getItem('firstTestProcess');
|
||||||
|
if(activeIndex&&firstTestProcess){
|
||||||
|
this.activeIndex = parseInt(activeIndex);
|
||||||
|
this.listQuery.process = parseInt(firstTestProcess);
|
||||||
|
sessionStorage.removeItem('firstTestIndex');
|
||||||
|
sessionStorage.removeItem('firstTestProcess');
|
||||||
|
this.getTableData();
|
||||||
|
getProcessList({page: 0}).then((response) => {
|
||||||
|
if (response.data) {
|
||||||
|
that.processOption = response.data;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}else{
|
||||||
|
this.getProcessList();
|
||||||
|
}*/
|
||||||
|
},
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,25 @@
|
||||||
|
from __future__ import absolute_import, unicode_literals
|
||||||
|
from rest_framework.response import Response
|
||||||
|
from celery import shared_task
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@shared_task
|
||||||
|
def backup_database():
|
||||||
|
"""
|
||||||
|
备份数据库
|
||||||
|
"""
|
||||||
|
import os
|
||||||
|
ret = os.popen('sudo pg_dump -U postgres -d hberp -f /home/lighthouse/hberp_backup.sql')
|
||||||
|
return Response()
|
||||||
|
|
||||||
|
@shared_task
|
||||||
|
def reload_server():
|
||||||
|
import os # 更新后端
|
||||||
|
os.chdir('/home/lighthouse/hberp')
|
||||||
|
ret = os.popen('sudo git pull && sudo service supervisor reload')
|
||||||
|
return Response(ret.read())
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@ from django.db.models import base
|
||||||
from rest_framework import urlpatterns
|
from rest_framework import urlpatterns
|
||||||
from django.urls import path, include
|
from django.urls import path, include
|
||||||
from rest_framework.routers import DefaultRouter
|
from rest_framework.routers import DefaultRouter
|
||||||
from apps.develop.views import CleanDataView, UpdateCuttingView, UpdateEquipState, UpdateFIFOItem, UpdateFIFONumber, UpdateLastTestResult, UpdateNeedToOrder, UpdateSpg
|
from apps.develop.views import BackupDatabase, CleanDataView, ReloadServer, UpdateCuttingView, UpdateEquipState, UpdateFIFOItem, UpdateFIFONumber, UpdateLastTestResult, UpdateNeedToOrder, UpdateSpg
|
||||||
|
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
path('cleandata/', CleanDataView.as_view()),
|
path('cleandata/', CleanDataView.as_view()),
|
||||||
|
@ -13,6 +13,8 @@ urlpatterns = [
|
||||||
path('update_spg/', UpdateSpg.as_view()),
|
path('update_spg/', UpdateSpg.as_view()),
|
||||||
path('update_equip_state/', UpdateEquipState.as_view()),
|
path('update_equip_state/', UpdateEquipState.as_view()),
|
||||||
path('update_need_to_order/', UpdateNeedToOrder.as_view()),
|
path('update_need_to_order/', UpdateNeedToOrder.as_view()),
|
||||||
path('update_fifo_number/', UpdateFIFONumber.as_view())
|
path('update_fifo_number/', UpdateFIFONumber.as_view()),
|
||||||
|
path('reload_server/', ReloadServer.as_view()),
|
||||||
|
path('backup_database/', BackupDatabase.as_view())
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,7 @@ from rest_framework.decorators import permission_classes
|
||||||
from rest_framework.views import APIView
|
from rest_framework.views import APIView
|
||||||
from rest_framework.permissions import IsAdminUser
|
from rest_framework.permissions import IsAdminUser
|
||||||
from rest_framework.response import Response
|
from rest_framework.response import Response
|
||||||
|
from apps.develop.tasks import backup_database, reload_server
|
||||||
from apps.inm.models import FIFO, FIFOItem, Inventory, MaterialBatch
|
from apps.inm.models import FIFO, FIFOItem, Inventory, MaterialBatch
|
||||||
from apps.mtm.models import Material
|
from apps.mtm.models import Material
|
||||||
from apps.pm.models import ProductionPlan, SubProductionPlan
|
from apps.pm.models import ProductionPlan, SubProductionPlan
|
||||||
|
@ -117,4 +118,15 @@ class UpdateFIFONumber(APIView):
|
||||||
else:
|
else:
|
||||||
i.number = 'CK' + ranstr(7)
|
i.number = 'CK' + ranstr(7)
|
||||||
i.save()
|
i.save()
|
||||||
return Response()
|
return Response()
|
||||||
|
|
||||||
|
class ReloadServer(APIView):
|
||||||
|
permission_classes = [IsAdminUser]
|
||||||
|
def post(self, request):
|
||||||
|
reload_server()
|
||||||
|
|
||||||
|
|
||||||
|
class BackupDatabase(APIView):
|
||||||
|
permission_classes = [IsAdminUser]
|
||||||
|
def post(self, request):
|
||||||
|
backup_database()
|
|
@ -3,7 +3,7 @@ import os
|
||||||
from celery import Celery
|
from celery import Celery
|
||||||
|
|
||||||
# set the default Django settings module for the 'celery' program.
|
# set the default Django settings module for the 'celery' program.
|
||||||
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'server.settings_dev')
|
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'server.settings_pro')
|
||||||
|
|
||||||
app = Celery('server')
|
app = Celery('server')
|
||||||
|
|
||||||
|
|
|
@ -1,15 +0,0 @@
|
||||||
from .settings import *
|
|
||||||
DEBUG = False
|
|
||||||
DATABASES = {
|
|
||||||
'default': {
|
|
||||||
'ENGINE': 'django.db.backends.postgresql',
|
|
||||||
'NAME': 'db',
|
|
||||||
'USER': 'postgres',
|
|
||||||
'PASSWORD': 'password',
|
|
||||||
'HOST': 'localhost',
|
|
||||||
'PORT': '5432',
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
# celery配置
|
|
||||||
CELERY_BEAT_SCHEDULER = 'django_celery_beat.schedulers:DatabaseScheduler'
|
|
|
@ -11,6 +11,6 @@ import os
|
||||||
|
|
||||||
from django.core.wsgi import get_wsgi_application
|
from django.core.wsgi import get_wsgi_application
|
||||||
|
|
||||||
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'server.settings_dev')
|
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'server.settings_pro')
|
||||||
|
|
||||||
application = get_wsgi_application()
|
application = get_wsgi_application()
|
||||||
|
|
Loading…
Reference in New Issue