|
|
@@ -26,19 +26,67 @@
|
|
|
<div class="col-4">
|
|
|
<div class="row">
|
|
|
<div class="col py-3 h4">
|
|
|
- <div>波次号:</div>
|
|
|
- <div class=" text-center">
|
|
|
- <b v-if="task&&task.station_task_batches">
|
|
|
- <div v-for="taskBatch in task.station_task_batches">
|
|
|
- @{{ taskBatch.batch.code }}
|
|
|
+ <div class="row">
|
|
|
+ <div class="col">选择执行波次:</div>
|
|
|
+ </div>
|
|
|
+ <div class="row" v-if="current_stationTaskBatch">
|
|
|
+ <div class="col font-weight-bold text-center position-relative"
|
|
|
+ :style="[
|
|
|
+ {opacity:
|
|
|
+ current_stationTaskBatch.status==='完成'?'0.5':'1'
|
|
|
+ },
|
|
|
+ ]"
|
|
|
+ :class="[
|
|
|
+ (current_stationTaskBatch.runningStatus==='')?'text-info':'',
|
|
|
+ (current_stationTaskBatch.runningStatus==='请求中')?'text-dark':'',
|
|
|
+ (current_stationTaskBatch.runningStatus==='请求失败')?'text-danger':'',
|
|
|
+ (current_stationTaskBatch.runningStatus==='请求成功')?'text-success':'',
|
|
|
+ (current_stationTaskBatch.runningStatus==='请求异常')?'text-danger':'',
|
|
|
+ ]"
|
|
|
+ >
|
|
|
+ <div class="text-center mt-2">@{{ current_stationTaskBatch.batch.code }}</div>
|
|
|
+ <div class="text-center" style="font-size: 12px;">
|
|
|
+ @{{ current_stationTaskBatch.batch.owner.name }}
|
|
|
+ </div>
|
|
|
+ <div class="col text-muted text-left">
|
|
|
+ <img id="barcode" :alt="batchCode">
|
|
|
</div>
|
|
|
- </b>
|
|
|
+ </div>
|
|
|
+ <div class="col text-center">
|
|
|
+ <button class="btn btn-lg mt-4" @click="runTheTaskBatch()"
|
|
|
+ :class="[
|
|
|
+ (current_stationTaskBatch.runningStatus==='')?'btn-info':'',
|
|
|
+ (current_stationTaskBatch.runningStatus==='请求中')?'btn-dark':'',
|
|
|
+ (current_stationTaskBatch.runningStatus==='请求失败')?'btn-danger':'',
|
|
|
+ (current_stationTaskBatch.runningStatus==='请求成功')?'btn-success':'',
|
|
|
+ (current_stationTaskBatch.runningStatus==='请求异常')?'btn-danger':'',
|
|
|
+ ]"
|
|
|
+ >
|
|
|
+ <span v-if="!current_stationTaskBatch.runningStatus">执行</span>
|
|
|
+ <span v-if="current_stationTaskBatch.runningStatus==='请求中'">请求中</span>
|
|
|
+ <span v-if="current_stationTaskBatch.runningStatus==='请求失败'">(失败)重新执行</span>
|
|
|
+ <span v-if="current_stationTaskBatch.runningStatus==='请求成功'">(请求成功)重新执行</span>
|
|
|
+ <span v-if="current_stationTaskBatch.runningStatus==='请求异常'">(请求异常)重新执行</span>
|
|
|
+ </button>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="text-center my-2" style="overflow-y: scroll;max-height:200px;">
|
|
|
+ <div class="flex flex-column flex-wrap" v-if="stationTaskBatches">
|
|
|
+ <button v-for="stationTaskBatch in stationTaskBatches"
|
|
|
+ @click="selectBatch(stationTaskBatch)"
|
|
|
+ class="btn"
|
|
|
+ :class="[
|
|
|
+ (current_stationTaskBatch&¤t_stationTaskBatch.id===stationTaskBatch.id)?'btn-outline-info':'btn-outline-dark',
|
|
|
+ ]"
|
|
|
+ :style="[
|
|
|
+ {opacity:
|
|
|
+ stationTaskBatch.status==='完成'?'0.5':'1'
|
|
|
+ },
|
|
|
+ ]"
|
|
|
+ >
|
|
|
+ @{{stationTaskBatch.batch.code | simplifyBatchCode}}</button>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- <div class="row">
|
|
|
- <div class="col py-3 text-muted text-center">
|
|
|
- <img id="barcode" alt="" :data-refresh="batchCode">
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="row">
|
|
|
@@ -157,7 +205,7 @@
|
|
|
<div class="text-left">
|
|
|
<div >
|
|
|
<div class="btn btn-outline-info" @click="
|
|
|
- (inputs.manuallyTakeBox.visible=true)
|
|
|
+ (inputs.manuallyTakeBox.visible=!inputs.manuallyTakeBox.visible)
|
|
|
&&(inputs.manuallyTakeBox.text='')">手动出库</div>
|
|
|
<div class="position-relative bg-white" v-if="inputs.manuallyTakeBox.visible">
|
|
|
<textarea name="" id="" cols="30" rows="3" class="form-control" v-model="inputs.manuallyTakeBox.text"
|
|
|
@@ -286,16 +334,20 @@
|
|
|
$vue=new Vue({
|
|
|
el:"#container",
|
|
|
data:{
|
|
|
- broadcastName : "{{config('database.redis.options.prefix').'station-'.$station->id}}",
|
|
|
+ taskBroadcastName : "{{config('database.redis.options.prefix').'station-'.$station->id}}",
|
|
|
+ allTaskBroadcastName : "{{config('database.redis.options.prefix').'station-0'}}",
|
|
|
channelName : ".App\\Events\\BroadcastToStation",
|
|
|
error:"",
|
|
|
- station:{!! $station??[] !!},
|
|
|
+ station:{!! $station !!},
|
|
|
inputs:{
|
|
|
manuallyTakeBox:{
|
|
|
visible:false,
|
|
|
text:'',
|
|
|
}
|
|
|
},
|
|
|
+ current_stationTaskBatch: null,
|
|
|
+ stationTask_indexByBatch: [],
|
|
|
+ stationTaskBatch_index: [],
|
|
|
grids:{
|
|
|
single:{status:'',},
|
|
|
half:{
|
|
|
@@ -315,7 +367,9 @@
|
|
|
},
|
|
|
mounted() {
|
|
|
this._makeMenuHiding();
|
|
|
- this._listenBroadcast();
|
|
|
+ initEcho();
|
|
|
+ this._listenTaskBroadcast();
|
|
|
+ this._listenAllTaskBroadcast();
|
|
|
},
|
|
|
methods:{
|
|
|
_makeMenuHiding(){
|
|
|
@@ -327,21 +381,33 @@
|
|
|
$('.navbar,.nav1,.nav2').hide();
|
|
|
});
|
|
|
},
|
|
|
- _listenBroadcast(){
|
|
|
- initEcho();
|
|
|
- window.Echo.channel(this.broadcastName).listen(this.channelName,(msg)=> {
|
|
|
+ _listenTaskBroadcast(){
|
|
|
+ window.Echo.channel(this.taskBroadcastName).listen(this.channelName,(msg)=> {
|
|
|
+ // console.log((new Date()).toTimeString(),msg);
|
|
|
+ let json = JSON.parse(msg.json);
|
|
|
+ if(!json||json.length===0)return;
|
|
|
+ this.task=json;
|
|
|
+ });
|
|
|
+ },
|
|
|
+ _listenAllTaskBroadcast(){
|
|
|
+ window.Echo.channel(this.allTaskBroadcastName).listen(this.channelName,(msg)=> {
|
|
|
console.log((new Date()).toTimeString(),msg);
|
|
|
let json = JSON.parse(msg.json);
|
|
|
if(!json||json.length===0)return;
|
|
|
- this.station['current_station_task']=json;
|
|
|
+ this.task=json;
|
|
|
});
|
|
|
},
|
|
|
+ selectBatch(stationTaskBatch){
|
|
|
+ this.current_stationTaskBatch=stationTaskBatch;
|
|
|
+ if(typeof(this.current_stationTaskBatch.runningStatus)==='undefined')
|
|
|
+ this.current_stationTaskBatch.runningStatus=''
|
|
|
+ },
|
|
|
manuallyTakeBoxOut(){
|
|
|
let text = this.inputs.manuallyTakeBox.text.trim();
|
|
|
if(!text){
|
|
|
alert('请输入料箱号')
|
|
|
return
|
|
|
- };
|
|
|
+ }
|
|
|
axios.post('{{url('/api/thirdPart/haiq/storage/takeOutToULine')}}',{codes:text})
|
|
|
.then(function(response){
|
|
|
tempTip.okWindow(response.data.result,'确定')
|
|
|
@@ -351,36 +417,74 @@
|
|
|
this.inputs.manuallyTakeBox.text='';
|
|
|
})
|
|
|
},
|
|
|
+ runTheTaskBatch(){
|
|
|
+ let _this=this;
|
|
|
+ _this.current_stationTaskBatch.runningStatus='请求中';
|
|
|
+ _this.$forceUpdate();
|
|
|
+ axios.post('{{url('/api/thirdPart/haiq/runTaskBatch')}}',{station_task_batch_id:_this.current_stationTaskBatch.id})
|
|
|
+ .then(function(response){
|
|
|
+ if(!response.data.success){
|
|
|
+ _this.current_stationTaskBatch.runningStatus='请求失败';
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ _this.current_stationTaskBatch.runningStatus='请求成功'
|
|
|
+ }).catch(function(err){
|
|
|
+ _this.current_stationTaskBatch.runningStatus='请求异常'
|
|
|
+ tempTip.okWindow(err+': 服务器代码出错,请联系开发部门负责人','确定')
|
|
|
+ }).finally(function(){
|
|
|
+ _this.$forceUpdate();
|
|
|
+ });
|
|
|
+ },
|
|
|
},
|
|
|
computed:{
|
|
|
task(){
|
|
|
- if(!this.station['current_station_task'])return null;
|
|
|
- return this.station['current_station_task'];
|
|
|
+ if(!this.current_stationTaskBatch||typeof(this.stationTask_indexByBatch['_'+this.current_stationTaskBatch.batch_id])==='undefined')return null;
|
|
|
+ return this.stationTask_indexByBatch['_'+this.current_stationTaskBatch.batch_id];
|
|
|
+ },
|
|
|
+ stationTasks(){
|
|
|
+ if(!this.station)return;
|
|
|
+ return this.station.station_tasks_today;
|
|
|
+ },
|
|
|
+ stationTaskBatches(){
|
|
|
+ if(!this.stationTasks)return;
|
|
|
+ let _this=this;
|
|
|
+ let stationTaskBatches=[];
|
|
|
+ this.stationTasks.forEach(function(stationTask){
|
|
|
+ if(!stationTask.station_task_batches)return;
|
|
|
+ stationTask.station_task_batches.forEach(function(stationTaskBatch){
|
|
|
+ if(typeof(_this.stationTaskBatch_index['_'+stationTaskBatch.batch_id])==='undefined'){
|
|
|
+ // if(stationTaskBatch_index['_'+stationTaskBatch.batch_id]['status']==='完成')return;
|
|
|
+ stationTaskBatches.push(stationTaskBatch)
|
|
|
+ _this.stationTaskBatch_index['_'+stationTaskBatch.batch_id]=stationTaskBatch;
|
|
|
+ _this.stationTask_indexByBatch['_'+stationTaskBatch.batch_id]=stationTask;
|
|
|
+ }
|
|
|
+ })
|
|
|
+ });
|
|
|
+ return stationTaskBatches;
|
|
|
},
|
|
|
batchCode(){
|
|
|
- if(!this.task)return;
|
|
|
- let batches = this.task.station_task_batches;
|
|
|
- if(batches
|
|
|
- && Array.isArray(batches)
|
|
|
- && batches.length>0
|
|
|
+ let _this=this;
|
|
|
+ if(!this.current_stationTaskBatch)return;
|
|
|
+ if(typeof(this.current_stationTaskBatch)!=='undefined'
|
|
|
+ && typeof(this.current_stationTaskBatch.batch)!=='undefined'
|
|
|
){
|
|
|
setTimeout(function (){
|
|
|
- setBarcode(batches[0].batch.code,"#barcode",1,50,false);
|
|
|
+ setBarcode(_this.current_stationTaskBatch.batch.code,"#barcode",1,50,false);
|
|
|
})
|
|
|
}
|
|
|
- return batches[0].batch.code;
|
|
|
+ return this.current_stationTaskBatch.batch.code;
|
|
|
},
|
|
|
taskCommodities(){
|
|
|
if(!this.task)return [];
|
|
|
- return this.station['current_station_task']['station_task_commodities'];
|
|
|
+ return this.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']));
|
|
|
+ this.taskCommoditiesListByBinVar.md5 = md5(JSON.stringify(this.task['station_task_commodities']));
|
|
|
let _this=this;
|
|
|
- this.station['current_station_task']['station_task_commodities']
|
|
|
+ this.task['station_task_commodities']
|
|
|
.forEach(function (taskCommodity) {
|
|
|
if (typeof (_this.taskCommoditiesListByBinVar[taskCommodity['bin_number']]) === 'undefined') {
|
|
|
_this.taskCommoditiesListByBinVar[taskCommodity['bin_number']] = null;
|
|
|
@@ -393,7 +497,7 @@
|
|
|
if((typeof this.taskCommoditiesListByBinVar)==='undefined'||!this.taskCommoditiesListByBinVar){
|
|
|
return reIndexByBin.call(this);
|
|
|
}
|
|
|
- let md5Now = md5(JSON.stringify(this.station['current_station_task']['station_task_commodities']));
|
|
|
+ let md5Now = md5(JSON.stringify(this.task['station_task_commodities']));
|
|
|
|
|
|
if(this.taskCommoditiesListByBinVar.md5!==md5Now){
|
|
|
return reIndexByBin.call(this);
|
|
|
@@ -556,6 +660,12 @@
|
|
|
}
|
|
|
|
|
|
},
|
|
|
+ },
|
|
|
+ filters:{
|
|
|
+ simplifyBatchCode(val){
|
|
|
+ if(!val){return ''}
|
|
|
+ return val.replace(/W\d{6}0*/,'').trim()
|
|
|
+ }
|
|
|
}
|
|
|
});
|
|
|
</script>
|