|
|
@@ -7,7 +7,7 @@
|
|
|
@component('station.menu')@endcomponent
|
|
|
@component('station.cachingShelf.menu')@endcomponent
|
|
|
</div>
|
|
|
- <div class="container-fluid" id="list">
|
|
|
+ <div class="container-fluid d-none" id="list">
|
|
|
@include('station.cachingShelf.list._table')
|
|
|
@include('station.cachingShelf.list._fillBox')
|
|
|
</div>
|
|
|
@@ -21,31 +21,32 @@
|
|
|
stations: {!! $stations->toJson() !!}['data'],
|
|
|
selectTr: null,
|
|
|
materialBoxCode: null, // 料箱编码
|
|
|
- currentStation: { // 当前Station
|
|
|
- id:null, // Station->id
|
|
|
- data: [[], [], []], // 任务
|
|
|
+
|
|
|
+ currentStation: { // 当前Station
|
|
|
+ id: null, // Station->id
|
|
|
+ data: [[], [], []], // 格口
|
|
|
},
|
|
|
boxClass: 'modal-sm',
|
|
|
- },
|
|
|
- created() {
|
|
|
|
|
|
+ broadcastName: null,
|
|
|
+ channelName: ".App\\Events\\BroadcastToStation",
|
|
|
},
|
|
|
mounted() {
|
|
|
this.initCacheShelfBox();
|
|
|
this.initModalBox();
|
|
|
- /** 灭灯 */
|
|
|
+ $('#list').removeClass('d-none');
|
|
|
},
|
|
|
methods: {
|
|
|
/** 1初始化缓存架格口 */
|
|
|
- initCacheShelfBox(){
|
|
|
+ initCacheShelfBox() {
|
|
|
this.currentStation.data.forEach(function (item, index, self) {
|
|
|
let boxRow = new Array(3);
|
|
|
for (let i = 0; i < boxRow.length; i++) {
|
|
|
- boxRow[i] ={
|
|
|
- x:index,
|
|
|
- y:i,
|
|
|
- col: 2 - index + 1,
|
|
|
- row: 2 - i + 1,
|
|
|
+ boxRow[i] = {
|
|
|
+ x: index,
|
|
|
+ y: i,
|
|
|
+ row: 2 - index + 1,
|
|
|
+ col: 2 - i + 1,
|
|
|
code: null,
|
|
|
index: index * 3 + i + 1
|
|
|
};
|
|
|
@@ -61,17 +62,30 @@
|
|
|
if (window.screen.width >= 1200) this.boxClass = 'modal-xl';
|
|
|
},
|
|
|
/** 展示modal */
|
|
|
- showFeedBox() {
|
|
|
+ showFeedBox(station) {
|
|
|
+ this.currentStation.id = station['id'];
|
|
|
+ this.broadcastName = "{{config('database.redis.options.prefix')}}" + 'station-' + station['id'];
|
|
|
+ this.initCacheGrid();
|
|
|
$('#box').modal('show');
|
|
|
},
|
|
|
- /** 获取缓存货架上的任务 */
|
|
|
- getStation(id) {
|
|
|
- let url = '{{url('apiLocal/station/cachingShelf')}}' + '/' + id;
|
|
|
+ /** 初始化格口 */
|
|
|
+ initCacheGrid() {
|
|
|
+ let url = '';
|
|
|
window.tempTip.setIndex(1099);
|
|
|
window.tempTip.setDuration(3000);
|
|
|
-
|
|
|
window.axios.get(url).then(res => {
|
|
|
if (res.data.data) {
|
|
|
+ if (!isArray(res.data.data)) return;
|
|
|
+ if (res.data.data.length === 0) return;
|
|
|
+ for (let i = 0; i < res.data.data.length; i++) {
|
|
|
+ let grid = res.data.data[i];
|
|
|
+ let gridIndex = grid['id'];
|
|
|
+ let row = gridIndex / 3;
|
|
|
+ let col = gridIndex % 3;
|
|
|
+ let code = grid['materialBox'] ? grid['materialBox']['code'] : null;
|
|
|
+ this.$set(this.currentStation.data[row][col], 'code', code);
|
|
|
+ }
|
|
|
+ this.$forceUpdate();
|
|
|
return;
|
|
|
}
|
|
|
window.tempTip.show('获取缓存货架信息失败');
|
|
|
@@ -80,44 +94,37 @@
|
|
|
});
|
|
|
},
|
|
|
/** 扫码 2、填写九宫格 */
|
|
|
- // 自动排号和自动发送
|
|
|
- pushBoxToStation(x=null,y=null,$e = null) {
|
|
|
+ pushBoxToStation(x = null, y = null, $e = null) {
|
|
|
+ // 自动排号和自动发送
|
|
|
// 选排
|
|
|
- if(x!==null && y!==null){
|
|
|
+ if (x !== null && y !== null) {
|
|
|
let code = $($e.target).val();
|
|
|
- this.$set(this.currentStation.data[x][y],'code',code);
|
|
|
+ this.$set(this.currentStation.data[x][y], 'code', code);
|
|
|
this.$forceUpdate();
|
|
|
return;
|
|
|
}
|
|
|
-
|
|
|
// 自动排号
|
|
|
let arr = [];
|
|
|
- this.currentStation.data.forEach(function(items){
|
|
|
- items.forEach(function (item){
|
|
|
- if(item['code'] === null){arr.push(item);}
|
|
|
+ this.currentStation.data.forEach(function (items) {
|
|
|
+ items.forEach(function (item) {
|
|
|
+ if (item['code'] === null) {
|
|
|
+ arr.push(item);
|
|
|
+ }
|
|
|
});
|
|
|
})
|
|
|
x = arr[0]['x'];
|
|
|
y = arr[0]['y'];
|
|
|
- this.$set(this.currentStation.data[x][y],'code',this.materialBoxCode);
|
|
|
+ this.$set(this.currentStation.data[x][y], 'code', this.materialBoxCode);
|
|
|
this.$forceUpdate();
|
|
|
},
|
|
|
- /** 手动输入到指定格口 */
|
|
|
- pullBoxToStation(x,y){
|
|
|
- if(this.currentStation.data[x][y]['code']!=null){
|
|
|
- this.$set(this.currentStation.data[x][y],'code',null);
|
|
|
- this.$forceUpdate();
|
|
|
- }
|
|
|
- },
|
|
|
/** 扫码 3、上传等排灯 */
|
|
|
pushTask(data) {
|
|
|
let url = '';
|
|
|
- window.axios.post(url).then(res=>{
|
|
|
+ window.axios.post(url).then(res => {
|
|
|
alert(res.data.success)
|
|
|
- if(res.data.success){
|
|
|
-
|
|
|
+ if (res.data.success) {
|
|
|
}
|
|
|
- }).catch(err=>{
|
|
|
+ }).catch(err => {
|
|
|
alert(err)
|
|
|
});
|
|
|
},
|
|
|
@@ -132,17 +139,13 @@
|
|
|
this.materialBoxCode = null;
|
|
|
},
|
|
|
/** 清空格口号 */
|
|
|
- clearCurrentStation(){
|
|
|
- this.currentStation.data.forEach(function (item,index,items){
|
|
|
- items[index].forEach(function (item,index,self){
|
|
|
- self[index]['code']=null;
|
|
|
+ clearCurrentStation() {
|
|
|
+ this.currentStation.data.forEach(function (item, index, items) {
|
|
|
+ items[index].forEach(function (item, index, self) {
|
|
|
+ self[index]['code'] = null;
|
|
|
})
|
|
|
});
|
|
|
this.$forceUpdate();
|
|
|
- },
|
|
|
- /** 料箱排序 */
|
|
|
- sortMaterialBox() {
|
|
|
-
|
|
|
},
|
|
|
/** 亮灯 */
|
|
|
lightOn() {
|
|
|
@@ -152,20 +155,30 @@
|
|
|
lightOff() {
|
|
|
|
|
|
},
|
|
|
- checkMaterialBoxCodeExist(code){
|
|
|
+ checkMaterialBoxCodeExist(code) {
|
|
|
let bool = false;
|
|
|
for (let x = 0; x < this.currentStation.data.length; x++) {
|
|
|
- if(!isArray(this.currentStation.data[x]) ){
|
|
|
+ if (!isArray(this.currentStation.data[x])) {
|
|
|
continue;
|
|
|
}
|
|
|
- if(this.currentStation.data[x].length > 0){
|
|
|
+ if (this.currentStation.data[x].length > 0) {
|
|
|
for (let y = 0; y < this.currentStation.data[y].length; y++) {
|
|
|
- if(this.currentStation.data[x][y]['code']===code)return true;
|
|
|
+ if (this.currentStation.data[x][y]['code'] === code) return true;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
return bool;
|
|
|
- }
|
|
|
+ },
|
|
|
+ /** 监听 【灭灯】 */
|
|
|
+ _listenBroadcast() {
|
|
|
+ initEcho();
|
|
|
+ window.Echo.channel(this.broadcastName).listen(this.channelName, (msg) => {
|
|
|
+ let json = JSON.parse(msg.json);
|
|
|
+ if (!json || json.length === 0) return;
|
|
|
+ this.station['current_station_task'] = json;
|
|
|
+ console.log((new Date()).toTimeString(), json);
|
|
|
+ });
|
|
|
+ },
|
|
|
}
|
|
|
})
|
|
|
</script>
|