-
-
预制管
-
390件
+
+
光纤预制管
+
{{ currentData.count_guan }}件
+
-
-
预制棒
-
390件
+
+
光纤预制棒
+
{{ currentData.count_bang }}件
+
+
+
+
配粉重量
+
{{ currentData.count }}kg
+
@@ -192,7 +203,7 @@ import * as BABYLON from "babylonjs";
import * as BABYLON_GUI from "babylonjs-gui";
import * as BABYLON_GRID from "@/utils/gridMaterial";
import * as BABYLON_MATERIAL from "@/utils/babylonMaterial";
-BABYLON.DracoCompression.Configuration.decoder.wasmUrl ='./draco_wasm_wrapper_gltf.js'
+BABYLON.DracoCompression.Configuration.decoder.wasmUrl = './draco_wasm_wrapper_gltf.js'
BABYLON.DracoCompression.Configuration.decoder.wasmBinaryUrl = './draco_decoder_gltf.wasm'
BABYLON.DracoCompression.Configuration.decoder.fallbackUrl = './draco_decoder_gltf.js'
import 'babylonjs-loaders';
@@ -218,13 +229,13 @@ export default {
],
blockHeight: null,
taskBoard: {
- header: ['名称','数量'],
+ header: ['名称', '数量'],
headerBGC: 'rgb(10,63,68)',
// waitTime: 1000,
// columnWidth: [4, 1],
data: [],
index: true,
- columnWidth: [50,180],
+ columnWidth: [50, 180],
align: ['center'],
loadedPercent: 0,
percentage: 0,
@@ -255,12 +266,13 @@ export default {
currentWeek: '',
currentDay: '',
timerTime: null,
+ timerData: null,
start_date: '',
end_date: '',
dialogData: {
deptName: ''
},
- currentObj: {
+ currentData: {
deptName: ''
},
deptName: '10车间',
@@ -309,7 +321,8 @@ export default {
label: {
minMargin: 10,
edgeDistance: 10,
- fontSize: '12px'
+ fontSize: '12px',
+ formatter: '{b}: {c}'
},
labelLine: {
lineStyle: {
@@ -330,7 +343,28 @@ export default {
data: []
}
},
- yesterday:''
+ yesterday: '',
+ dept6Obj: {
+ deptName: '光学精密加工车间',
+ percentage: 100,
+ count_bang: 0,
+ count_guan: 0,
+ },
+ dept7Obj: {
+ deptName: '光纤预制棒生产车间',
+ percentage: 100,
+ count_bang: 0,
+ },
+ dept8Obj: {
+ deptName: '玻璃配合料制备车间',
+ percentage: 100,
+ count: 0,
+ },
+ dept10Obj: {
+ deptName: '光纤预制管生产车间',
+ percentage: 100,
+ count_guan: 0,
+ },
}
},
mounted() {
@@ -342,6 +376,7 @@ export default {
this.blockTableHeight = height1 + 'px';
document.getElementById('scrollTable').style.height = height1 + 'px'
this.showTime();
+ this.getDeptDetail();
this.$nextTick(() => {
that.getsaleOut();
that.initDomStyle();
@@ -351,7 +386,7 @@ export default {
}, 1000);
that.notokTimer = setInterval(() => {
let pieDom = document.getElementById('pie');
- if(pieDom){
+ if (pieDom) {
if (that.deptName == '10车间') {
that.deptName = '7车间'
} else {
@@ -365,48 +400,45 @@ export default {
}
that.pieoption.series.data = deptData;
let pieoption = that.pieoption;
-
+
let pieChart = echarts.init(pieDom);
pieChart.clear();
pieChart.setOption(pieoption, true);
}
}, 5000);
-
+ that.timerData = setInterval(() => {
+ that.getDeptDetail();
+ }, 60000);
that.initChart();
})
//一天的毫秒数
const ondDayTime = 86400000
let cDate = new Date();
- let yesterday = new Date(cDate.getTime()-ondDayTime);
+ let yesterday = new Date(cDate.getTime() - ondDayTime);
let week = yesterday.getDay();//当前时间的week数
console.log(week);
let weekFirst = week - 1;//第一天对应的天数
let weekLast = 7 - week;//最后一天对应的天数
- if(week==0){
+ if (week == 0) {
weekFirst = 6;
weekLast = 0;//周日特殊处理
- }else{
+ } else {
weekFirst = week - 1;
weekLast = 7 - week;
}
- // let time = ' 星期' + '日一二三四五六'.charAt(week);//当前时间周几
-
let first = new Date(new Date(yesterday.getTime() - (weekFirst * ondDayTime)));//本周周一
let last = new Date(new Date(yesterday.getTime() + (weekLast * ondDayTime)));//本周周日
let dateArr = [];
- for(let i=0;i<7;i++){
- let itemDate = new Date(first.getTime()+i*ondDayTime);
- let item = itemDate.getDate();
+ for (let i = 0; i < 7; i++) {
+ let itemDate = new Date(first.getTime() + i * ondDayTime);
+ let item = itemDate.getDate();
dateArr.push(item);
}
this.weekDateList = dateArr;
this.start_date = first.getFullYear() + '-' + (first.getMonth() + 1) + '-' + first.getDate();
this.end_date = last.getFullYear() + '-' + (last.getMonth() + 1) + '-' + last.getDate();
- // let yesterday = new Date(cDate.getTime()-ondDayTime);
- this.yesterday = yesterday.getFullYear()+"-" + (yesterday.getMonth()+1) + "-" + yesterday.getDate();
- console.log(this.start_date);
- console.log(this.end_date);
- console.log(this.yesterday);
+ this.yesterday = yesterday.getFullYear() + "-" + (yesterday.getMonth() + 1) + "-" + yesterday.getDate();
+
this.getsaleOut();
this.getPlanRate();
this.getMaterialList();
@@ -416,15 +448,15 @@ export default {
getsaleOut() {
let that = this;
let obj = {
- query: { start_date: that.start_date, end_date: that.end_date,mio_type: 'sale_out',material_id:'' },
+ query: { start_date: that.start_date, end_date: that.end_date, mio_type: 'sale_out', material_id: '' },
};
that.$API.bi.dataset.exec.req('saleOutDay', obj).then((res6) => {
let list = res6.data2.ds0;
let saleOutdept6 = [0, 0, 0, 0, 0, 0, 0];//棒管交付数
if (list.length > 0) {
list.forEach(item => {
- for(let i=0;i
{
- let list = res.data2.ds0;
- let countOkDept7 = [0,0,0,0,0,0,0],countRateDept7 = [0,0,0,0,0,0,0];
- let countOk_dept7=0;
- if(list.length>0){
+ let list = res.data2.ds0;
+ let countOkDept7 = [0, 0, 0, 0, 0, 0, 0], countRateDept7 = [0, 0, 0, 0, 0, 0, 0];
+ let countOk_dept7 = 0;
+ if (list.length > 0) {
list.forEach(item => {
- let date = item.年+'-'+item.月+'-'+item.日;
- for(let i=0;i {
- let list = res.data2.ds0;
- let countOkDept10 = [0,0,0,0,0,0,0],countRateDept10 = [0,0,0,0,0,0,0];
- let countOk_dept10=0;
- if(list.length>0){
+ let list = res.data2.ds0;
+ let countOkDept10 = [0, 0, 0, 0, 0, 0, 0], countRateDept10 = [0, 0, 0, 0, 0, 0, 0];
+ let countOk_dept10 = 0;
+ if (list.length > 0) {
console.log(this.weekDateList)
list.forEach(item => {
let index = that.weekDateList.indexOf(item.日);
countOkDept10[index] = item.合格数;
countRateDept10[index] = Math.round(item.合格率);
- countOk_dept10 = countOk_dept10+item.合格数;
- });
- }
+ countOk_dept10 = countOk_dept10 + item.合格数;
+ });
+ }
that.countOkDept10 = countOkDept10;
that.countRateDept10 = countRateDept10;
that.countOk_dept10 = countOk_dept10;
@@ -679,7 +711,7 @@ export default {
let PlanRate = [0, 0, 0, 0, 0, 0, 0];
if (list.length > 0) {
list.forEach(item => {
- let index = this.weekDateList.indexOf( item.日);
+ let index = this.weekDateList.indexOf(item.日);
PlanRate[index] = Math.round((item.合格数 / item.任务数) * 100);
});
}
@@ -810,56 +842,11 @@ export default {
line3Chart.setOption(line3option);
})
},
- // deptNameChange(deptName) {
- // let that = this;
- // let obj = {
- // query: { start_date: that.start_date, end_date: that.end_date, dept_name: deptName },
- // };
- // that.$API.bi.dataset.exec.req('lineDay', obj).then((res) => {
- // let list = res.data2.ds0;
- // let deptData = [];
- // if (list.length > 0) {
- // list.forEach(item => {
- // if (that.deptName == '7车间') {
- // that.dept7Data[0].value = that.dept7Data[0].value + item.炸纹;
- // that.dept7Data[1].value = that.dept7Data[1].value + item.条纹;
- // that.dept7Data[2].value = that.dept7Data[2].value + item.气泡;
- // that.dept7Data[3].value = that.dept7Data[3].value + item.弯曲;
- // that.dept7Data[4].value = that.dept7Data[4].value + item.其他;
- // that.dept7Data[5].value = that.dept7Data[5].value + item.合格数;
- // deptData = that.dept7Data;
- // } else {
- // that.dept10Data[0].value = that.dept10Data[0].value + item.弯曲;
- // that.dept10Data[1].value = that.dept10Data[1].value + item.大小头;
- // that.dept10Data[2].value = that.dept10Data[2].value + item.偏壁;
- // that.dept10Data[3].value = that.dept10Data[3].value + item.结石;
- // that.dept10Data[4].value = that.dept10Data[4].value + item.气线;
- // that.dept10Data[5].value = that.dept10Data[5].value + item.合格数;
- // deptData = that.dept10Data;
- // }
- // });
- // } else {
- // if (that.deptName == '7车间') {
- // deptData = that.dept7Data;
- // } else {
- // deptData = that.dept10Data;
- // }
- // }
- // that.deptData = deptData;
- // that.pieoption.series.data = deptData;
- // let pieoption = that.pieoption;
- // let pieDom = document.getElementById('pie');
- // let pieChart = echarts.init(pieDom);
- // pieChart.clear();
- // pieChart.setOption(pieoption, true);
- // });
- // },
- //库存情况
getMaterialList() {
let that = this;
- this.$API.mtm.material.list.req({ page: 0, type: 10 ,count__gte:1 }).then(res => {
- let data = [];
- if(res.length>0){
+ this.$API.mtm.material.list.req({ page: 0, type: 10, count__gte: 1 }).then(res => {
+ let data = [];
+ if (res.length > 0) {
res.forEach(item => {
let arr = [];
let colorText = '';
@@ -868,7 +855,7 @@ export default {
} else {
colorText = '' + item.count + ''
}
- arr[0] = item.name+'|'+item.specification+'|'+item.model;
+ arr[0] = item.name + '|' + item.specification + '|' + item.model;
arr[1] = item.count;
data.push(arr)
});
@@ -999,50 +986,6 @@ export default {
//关闭灯光
// scene.lights[1].setEnabled(false);
engine.hideLoadingUI()
- // let arrKey = [];
- // for (let key in that.nodesLists) {
- // arrKey.push(key);
- // }
- // let heightI = 0;
- // that.heightTimer = setInterval(() => {
- // let heightKey = arrKey[heightI];
- // const meshTimer = scene.getMeshByName(heightKey);
- // const hl1Timer = new BABYLON.HighlightLayer("hl1Timer", scene);
-
- // if (meshTimer) {
- // if (that.nodesLists[heightKey]) {
- // hl1Timer.removeAllMeshes();
- // if (highlightLayer) {
- // highlightLayer.removeAllMeshes();
- // }
- // that.getDeptDetail(that.nodesLists[heightKey])
- // // 在选中的 meshTimer 上添加高亮效果
- // highlightLayer.addMesh(meshTimer, new BABYLON.Color3(0.1, 0.9, 0.9));
- // that.currentLightMesh = meshTimer;
- // mesh_rect.linkWithMesh(meshTimer);
- // let name = meshTimer.name.split('_')[0];
- // mesh_name.text = name;
- // that.infoVisibel = true;
- // hl1Timer.addMesh(meshTimer, new BABYLON.Color3(12 / 255, 250 / 255, 252 / 255), true);
- // hl1Timer.blurVerticalSize = 5;
- // hl1Timer.blurHorizontalSize = 5;
- // function worldToScreen(point, camera, scene, engine) {
- // return BABYLON.Vector3.Project(point,
- // BABYLON.Matrix.Identity(),
- // scene.getTransformMatrix(),
- // camera.viewport.toGlobal(engine.getRenderWidth(), engine.getRenderHeight()));
- // }
- // var pos = worldToScreen(meshTimer.absolutePosition, camera, scene, engine);
- // let infoBlock = document.getElementById('inforBlock');
- // infoBlock.style.left = (Math.floor(pos.x)) + 'px';
- // infoBlock.style.top = (Math.floor(pos.y) - 250) + 'px';
- // }
- // }
- // heightI+=1;
- // // if(heightI>4){
- // // heightI=0
- // // }
- // }, 1000);
},
//进度条
function (evt) {
@@ -1097,7 +1040,8 @@ export default {
if (that.nodesLists[key]) {
hl1.removeAllMeshes();
highlightLayer.removeAllMeshes();
- that.getDeptDetail(that.nodesLists[key])
+ that.getDeptData(that.nodesLists[key])
+ that.dialogData.deptName = that.nodesLists[key];
//单身宿舍.003_primitive3
// 在选中的 mesh 上添加高亮效果
highlightLayer.addMesh(mesh, new BABYLON.Color3(0.1, 0.9, 0.9));
@@ -1132,14 +1076,14 @@ export default {
const mesh = pickResult.pickedMesh;
console.log('mesh', mesh)
if (that.nodesLists[mesh.name]) {
+ that.getDeptClickData(that.nodesLists[mesh.name])
hl1Click.removeAllMeshes();
highlightLayer.removeAllMeshes();
-
highlightLayer.addMesh(mesh, new BABYLON.Color3(0.1, 0.9, 0.9));
hl1Click.addMesh(mesh, new BABYLON.Color3(12 / 255, 250 / 255, 252 / 255), true);
hl1Click.blurVerticalSize = 5;
hl1Click.blurHorizontalSize = 5;
- that.currentObj.deptName = that.nodesLists[mesh.name];
+ that.currentData.deptName = that.nodesLists[mesh.name];
if (camera.target != mesh.position) {
that.clickVisible = true;
// 计算新的相机位置
@@ -1169,33 +1113,94 @@ export default {
});
this.engine = engine;
this.scene = scene;
- // console.log('scene:',scene)
window.addEventListener("resize", function () {
engine.resize();
});
},
- getDeptDetail(name) {
- let that = this;
- if (that.currentObj.deptName == name && that.clickVisible) {
- that.dialogData.deptName = name;
- } else {
- that.infoVisibel = true;
- that.dialogData.deptName = name;
+ getDeptData(name) {
+ this.infoVisibel = true;
+ console.log('hoverName', name)
+ if (name == '光学精密加工车间') { //6
+ this.dialogData = this.dept6Obj;
+ } else if (name == '光纤预制棒生产车间') {//7
+ this.dialogData = this.dept7Obj;
+ } else if (name == '光纤预制管生产车间') {//8
+ this.dialogData = this.dept8Obj;
+ } else if (name == '玻璃配合料制备车间') {//10
+ this.dialogData = this.dept10Obj;
}
- let obj = {
- query: { start_date: that.yesterday, end_date: that.yesterday, dept_name: name },
- };
- that.$API.bi.dataset.exec.req('lineDay', obj).then((res1) => {
- console.log('生产车间按日统计:', res1);
- let list1 = res1.data2.ds0;
- if (name == '6车间') {
- that.currentObj = list1[0];
- that.currentObj = list1[0]
- } else if (name == '7车间' || name == '10车间') {
- that.currentObj = list1[0];
+ },
+ getDeptClickData(name) {
+ console.log('clickName', name)
+ if (name == '光学精密加工车间') { //6
+ this.currentData = this.dept6Obj;
+ } else if (name == '光纤预制棒生产车间') {//7
+ this.currentData = this.dept7Obj;
+ } else if (name == '玻璃配合料制备车间') {//8
+ this.currentData = this.dept8Obj;
+ } else if (name == '光纤预制管生产车间') {//10
+ this.currentData = this.dept10Obj;
+ }
+ },
+ getDeptDetail() {
+ let that = this;
+ let obj6 = { query: { start_date: that.yesterday, end_date: that.yesterday, dept_name: '6车间' } };
+ let obj7 = { query: { start_date: that.yesterday, end_date: that.yesterday, dept_name: '7车间' } };
+ let obj8 = { handle_date: that.yesterday, page: 0, mgroup__belong_dept__name: '8车间' };
+ let obj10 = { query: { start_date: that.yesterday, end_date: that.yesterday, dept_name: '10车间' } };
+ that.$API.bi.dataset.exec.req('lineDay', obj6).then((res6) => {
+ // console.log('6生产车间昨日统计:', res6);
+ let data = res6.data2.ds0;
+ let count = 0, count_real = 0;
+ if (data.length > 0) {
+ data.forEach((item) => {
+ if (item.物料名.indexOf('棒')) {
+ that.dept6Obj.count_bang = item.合格数;
+ count += item.合格数;
+ count_real += item.生产数;
+ }
+ if (item.物料名.indexOf('管')) {
+ that.dept6Obj.count_guan = item.合格数;
+ count += item.合格数;
+ count_real += item.生产数;
+ }
+ })
+ if (count_real !== 0) {
+ that.dept6Obj.percentage = (count / count_real).toFixed(2) * 100 + '%';
+ }
+ }
+ });
+ that.$API.bi.dataset.exec.req('lineDay', obj7).then((res7) => {
+ // console.log('7生产车间昨日统计:', res7);
+ let data = res7.data2.ds0;
+ if (data.length > 0) {
+ that.dept7Obj.count_bang = data[0].合格数;
+ if (data[0].生产数 !== 0) {
+ that.dept7Obj.percentage = (data[0].合格数 / data[0].生产数).toFixed(2) * 100 + '%';
+ }
+ }
+ });
+ //8车间配粉接口调用
+ that.$API.wpm.mlog.list.req(obj8).then((res8) => {
+ // console.log('8生产车间昨日统计:', res8);
+ let count = 0;
+ if (res8.length > 0) {
+ res8.forEach((item) => {
+ let itemcount = item.count_real * item.count_real_eweight;
+ count += itemcount;
+ })
+ }
+ that.dept8Obj.count = count;
+ });
+ that.$API.bi.dataset.exec.req('lineDay', obj10).then((res10) => {
+ // console.log('10生产车间昨日统计:', res10);
+ let data = res10.data2.ds0;
+ if (data.length > 0) {
+ that.dept10Obj.count_guan = data[0].合格数;
+ if (data[0].生产数 !== 0) {
+ that.dept10Obj.percentage = (data[0].合格数 / data[0].生产数).toFixed(2) * 100 + '%';
+ }
}
-
- debugger;
});
},
initChart() {
@@ -1611,21 +1616,25 @@ export default {
},
circleClose() {
this.clickVisible = false;
- this.currentObj.deptName = '';
+ this.currentData.deptName = '';
},
},
beforeUnmount() {
let that = this;
clearInterval(that.timerTime);
+ clearInterval(that.timerData);
clearInterval(that.notokTimer);
that.timerTime = null;
+ that.timerData = null;
that.notokTimer = null;
},
beforeDestoryed() {
let that = this;
clearInterval(that.timerTime);
+ clearInterval(that.timerData);
clearInterval(that.notokTimer);
that.timerTime = null;
+ that.timerData = null;
that.notokTimer = null;
},