Commit 3ba92a08 authored by xxx's avatar xxx

修改

parent 1f41c1d7
......@@ -9,7 +9,6 @@
<script src="https://cdn.bootcss.com/eruda/1.5.8/eruda.min.js"></script>
<script>
eruda.init();
console.log('控制台打印信息');
</script>
......
......@@ -99,7 +99,7 @@ export default {
getCoordinate() {
let that = this;
httpGet(screenMapSetUpQuery,{size:9999}).then((res) => {
if(true){;
if(true){
//console.log(res);
let data1 = [];
for(let key in res){
......
......@@ -15,7 +15,18 @@
<script>
import { httpGet, httpPostForJson, putForJson, httpDelForJson} from "@/common/httpBean.js"
import {manualSchedulingQuery,manmadeStatusQuery,vehicleInformationQuery,vehicleInformationUpdate,dingDanBiaoCaoZuo,getZhuangCheDingDanQuery,getXieCheDingDanQuery} from "@/axios/api.js"
import {
manualSchedulingQuery,
manmadeStatusQuery,
vehicleInformationQuery,
vehicleInformationUpdate,
dingDanBiaoCaoZuo,
getZhuangCheDingDanQuery,
getXieCheDingDanQuery,
screenMapSetUpQuery,
carRealTimeLocationQuery2,
} from "@/axios/api.js"
import newOrder from '@/assets/dingdan.mp3'
export default {
......@@ -29,6 +40,8 @@ export default {
sonTimer1:null,
startOrderSrcUrl:'',//来订单语音路径
dingDanId:'',
equipmentName:'',//车载设备编号
xiecheBtnAble:false,//卸车按钮是否能用
}
},
mounted(){
......@@ -42,6 +55,7 @@ export default {
}else{
httpGet(vehicleInformationQuery,{number:this.carnumber,size:1}).then((resSon1) => {
if(resSon1.code == 200){
this.equipmentName = resSon1.data.content[0].equipmentName;
if(resSon1.data.content[0].workStatus == 0){
if(res.data.content[0].orderClass == 0){
this.showDe = true;
......@@ -49,25 +63,42 @@ export default {
this.btnShow2 = false;
this.carDestination = res.data.content[0].destination;
this.dingDanId = res.data.content[0].id;
//启动语音
this.startOrderSrcUrl = newOrder;
let au = document.getElementById('audio1');
au.currentTime = 0;
au.play();
}else{
this.showDe = true;
this.btnShow1 = false;
this.btnShow2 = true;
this.carDestination = res.data.content[0].destination;
this.dingDanId = res.data.content[0].id;
//查询指定目的地围栏以及判读该车是否在围栏里
httpGet(screenMapSetUpQuery,{size:9999,name:this.carDestination}).then((resSon2) => {
let weilanArr1 = [];
resSon2[this.carDestination].forEach((item,index)=>{
let weilanobj1 = {};
weilanobj1.lat = item.lat;
weilanobj1.lng = item.lon;
weilanArr1.push(weilanobj1);
})
httpGet(carRealTimeLocationQuery2,{name:this.equipmentName}).then((resSon3) => {
if(resSon3.code == 200){
let resSon3Obj1 = {};
resSon3Obj1.lat = resSon3.data.lat;
resSon3Obj1.lng = resSon3.data.lon;
this.xiecheBtnAble = this.isPointInPolygon(resSon3Obj1,weilanArr1);
}
});
});
}
}
}
});
}
});
}, 11000)
}, 10000)
},
methods:{
loadData(carnumber){
......@@ -179,23 +210,31 @@ export default {
},
//卸车
finishPaidanFn(){
this.btnShow2 = false;
this.showDe = false;
httpGet(vehicleInformationQuery,{number:this.carnumber}).then((res) => {
if(res.code == 200){
putForJson(vehicleInformationUpdate,{id:res.data.content[0].id,workStatus:0,weightStatus:0,oddStatus:1}).then((res) => {});
}
});
httpGet(manualSchedulingQuery,{sort:'createTime,desc',size:1,carNo:this.carnumber}).then((res) => {
if(res.code == 200){
if(res.data.totalElements == 0){
if(!this.xiecheBtnAble){
this.$notify({
title: '未到卸车区域,不可卸车!',
type: 'warning',
duration: 2500
});
}else{
this.btnShow2 = false;
this.showDe = false;
httpGet(vehicleInformationQuery,{number:this.carnumber}).then((res) => {
if(res.code == 200){
putForJson(vehicleInformationUpdate,{id:res.data.content[0].id,workStatus:0,weightStatus:0,oddStatus:1}).then((res) => {});
}
});
httpGet(manualSchedulingQuery,{sort:'createTime,desc',size:1,carNo:this.carnumber}).then((res) => {
if(res.code == 200){
if(res.data.totalElements == 0){
}else{
putForJson(manualSchedulingQuery,{id:res.data.content[0].id,status:0}).then((res) => {});
}else{
putForJson(manualSchedulingQuery,{id:res.data.content[0].id,status:0}).then((res) => {});
}
}
}
});
httpDelForJson(dingDanBiaoCaoZuo,[this.dingDanId]).then((res) => {});
});
httpDelForJson(dingDanBiaoCaoZuo,[this.dingDanId]).then((res) => {});
}
},
//获取当前时间
currentTime(){
......@@ -230,7 +269,65 @@ export default {
let currentFormatDate = year + "-" + month + "-" + day + " " + hours + ":" + minutes + ":" + seconds;
//console.log(currentFormatDate);
return currentFormatDate;
}
},
//判断卸车是车是否到达了卸区
isPointInPolygon(point,pts){
var N = pts.length; //pts [{lat:xxx,lng:xxx},{lat:xxx,lng:xxx}]
var boundOrVertex = true; //如果点位于多边形的顶点或边上,也算做点在多边形内,直接返回true
var intersectCount = 0;//cross points count of x
var precision = 2e-10; //浮点类型计算时候与0比较时候的容差
var p1, p2;//neighbour bound vertices
var p = point; //point {lat:xxx,lng:xxx}
p1 = pts[0];//left vertex
for(var i = 1; i <= N; ++i){//check all rays
if((p.lat==p1.lat)&&(p.lng==p1.lng)){
return boundOrVertex;//p is an vertex
}
p2 = pts[i % N];//right vertex
if(p.lat < Math.min(p1.lat, p2.lat) || p.lat > Math.max(p1.lat, p2.lat)){//ray is outside of our interests
p1 = p2;
continue;//next ray left point
}
if(p.lat > Math.min(p1.lat, p2.lat) && p.lat < Math.max(p1.lat, p2.lat)){//ray is crossing over by the algorithm (common part of)
if(p.lng <= Math.max(p1.lng, p2.lng)){//x is before of ray
if(p1.lat == p2.lat && p.lng >= Math.min(p1.lng, p2.lng)){//overlies on a horizontal ray
return boundOrVertex;
}
if(p1.lng == p2.lng){//ray is vertical
if(p1.lng == p.lng){//overlies on a vertical ray
return boundOrVertex;
}else{//before ray
++intersectCount;
}
}else{//cross point on the left side
var xinters = (p.lat - p1.lat) * (p2.lng - p1.lng) / (p2.lat - p1.lat) + p1.lng;//cross point of lng
if(Math.abs(p.lng - xinters) < precision){//overlies on a ray
return boundOrVertex;
}
if(p.lng < xinters){//before ray
++intersectCount;
}
}
}
}else{//special case when ray is crossing through the vertex
if(p.lat == p2.lat && p.lng <= p2.lng){//p crossing over p2
var p3 = pts[(i+1) % N]; //next vertex
if(p.lat >= Math.min(p1.lat, p3.lat) && p.lat <= Math.max(p1.lat, p3.lat)){//p.lat lies between p1.lat & p3.lat
++intersectCount;
}else{
intersectCount += 2;
}
}
}
p1 = p2;//next ray left point
}
if(intersectCount % 2 == 0){//偶数在多边形外
return false;
} else { //奇数在多边形内
return true;
}
},
},
beforeDestroy() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment