|
|
@@ -309,19 +309,22 @@
|
|
|
initEcho();
|
|
|
window.Echo.channel(this.broadcastName).listen(this.channelName,(msg)=> {
|
|
|
let json = JSON.parse(msg.json);
|
|
|
- console.log(json)
|
|
|
+ if(!json||json.length===0)return;
|
|
|
this.station['current_station_task']=json;
|
|
|
});
|
|
|
},
|
|
|
},
|
|
|
computed:{
|
|
|
task(){
|
|
|
+ if(!this.station['current_station_task'])return null;
|
|
|
return this.station['current_station_task'];
|
|
|
},
|
|
|
taskCommodities(){
|
|
|
+ if(!this.task)return [];
|
|
|
return this.station['current_station_task']['station_task_commodities'];
|
|
|
},
|
|
|
taskCommoditiesListByBin(){
|
|
|
+ if(!this.task)return [];
|
|
|
function reIndexByBin() {
|
|
|
this.taskCommoditiesListByBinVar = [];
|
|
|
this.taskCommoditiesListByBinVar.md5 = md5(JSON.stringify(this.station['current_station_task']['station_task_commodities']));
|
|
|
@@ -347,6 +350,7 @@
|
|
|
return this.taskCommoditiesListByBinVar;
|
|
|
},
|
|
|
taskCommoditiesListByWall(){
|
|
|
+ if(!this.task)return [];
|
|
|
let columnLength=this.station.station_type_bin_monitor.bin_column_length,
|
|
|
rowLength=this.station.station_type_bin_monitor.bin_row_length,
|
|
|
wallAmount=this.station.station_type_bin_monitor.bin_wall_amount,
|
|
|
@@ -379,6 +383,7 @@
|
|
|
return walls
|
|
|
},
|
|
|
processedCommodities(){
|
|
|
+ if(!this.task)return 0;
|
|
|
return this.task['station_task_commodities'].reduce(function (item, taskCommodity) {
|
|
|
if (typeof (item) === 'object' && item.status === '完成') {
|
|
|
return item.amount;
|
|
|
@@ -393,12 +398,14 @@
|
|
|
})
|
|
|
},
|
|
|
totalCommodities(){
|
|
|
+ if(!this.task)return 0;
|
|
|
return this.task['station_task_commodities'].reduce(function(item,taskCommodity){
|
|
|
if(typeof(item)==='object')item=item.amount;
|
|
|
return item+taskCommodity.amount;
|
|
|
})
|
|
|
},
|
|
|
processingTaskMaterialBox(){
|
|
|
+ if(!this.task)return [];
|
|
|
let taskMaterialBox=null;
|
|
|
this.task.station_task_material_boxes.some(function(taskMaterialBox_in){
|
|
|
if(taskMaterialBox_in.status==='处理中'){
|
|
|
@@ -407,15 +414,32 @@
|
|
|
});
|
|
|
return taskMaterialBox;
|
|
|
},
|
|
|
- boxIndicator(){
|
|
|
- let gridAmount=this.processingTaskMaterialBox.material_box.grid_amount;
|
|
|
- },
|
|
|
},
|
|
|
watch:{
|
|
|
'station':{
|
|
|
immediate:true,
|
|
|
deep:true,
|
|
|
handler:function(newStation){
|
|
|
+ let grids={
|
|
|
+ single:{status:'',},
|
|
|
+ half:{
|
|
|
+ left:{status:'',},
|
|
|
+ right:{status:'',}
|
|
|
+ },
|
|
|
+ quarter:{
|
|
|
+ left:{top:{status:'',},bottom:{status:'',},},
|
|
|
+ right:{top:{status:'',},bottom:{status:'',},},
|
|
|
+ },
|
|
|
+ sixth:{
|
|
|
+ left:{top:{status:'',},bottom:{status:'',},},
|
|
|
+ mid:{top:{status:'',},bottom:{status:'',},},
|
|
|
+ right:{top:{status:'',},bottom:{status:'',},},
|
|
|
+ },
|
|
|
+ };
|
|
|
+ if(!newStation.current_station_task||newStation.current_station_task.length===0) {
|
|
|
+ this.grids=grids;
|
|
|
+ return;
|
|
|
+ }
|
|
|
let gridsAmount=(function(){
|
|
|
let taskMaterialBox=null;
|
|
|
newStation.current_station_task.station_task_material_boxes.some(function(taskMaterialBox_in){
|
|
|
@@ -436,22 +460,6 @@
|
|
|
});
|
|
|
return positions;
|
|
|
})();
|
|
|
- let grids={
|
|
|
- single:{status:'',},
|
|
|
- half:{
|
|
|
- left:{status:'',},
|
|
|
- right:{status:'',}
|
|
|
- },
|
|
|
- quarter:{
|
|
|
- left:{top:{status:'',},bottom:{status:'',},},
|
|
|
- right:{top:{status:'',},bottom:{status:'',},},
|
|
|
- },
|
|
|
- sixth:{
|
|
|
- left:{top:{status:'',},bottom:{status:'',},},
|
|
|
- mid:{top:{status:'',},bottom:{status:'',},},
|
|
|
- right:{top:{status:'',},bottom:{status:'',},},
|
|
|
- },
|
|
|
- };
|
|
|
switch (gridsAmount){
|
|
|
case 1:
|
|
|
if(positions.length>0){
|