picking.blade.php 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. @extends('layouts.app')
  2. @section('title')波次分拣@endsection
  3. @section('content')
  4. <div id="container" class="d-none container-fluid mt-2">
  5. <div class="card">
  6. <div class="card-header m-0">
  7. <b>波次信息</b>
  8. <button class="btn text-white btn-sm btn-info pull-right" @click="isShow=!isShow" data-toggle="collapse" data-target="#body">@{{ isShow ? '隐藏' : '显示' }}</button>
  9. </div>
  10. <div class="card-body collapse" id="body">
  11. <div v-for="(val,index) in waves" class="mt-2">
  12. <div class="card-title font-weight-bold mb-0">@{{ batch+'-'+(index+1) }}</div>
  13. <div class="card-text text-muted small">
  14. <div v-for="(obj,i) in val" class="row m-0" style="border-bottom: RGB(247,247,247) 1px solid">
  15. <span class="col-6">@{{ obj.barcode }}</span>
  16. <span class="col-6">@{{ obj.qty }}</span>
  17. </div>
  18. </div>
  19. </div>
  20. </div>
  21. <div class="card mt-2">
  22. <div class="card-header row m-0 p-0">
  23. <b class="col-4">分拣信息</b>
  24. <input id="barcode" v-model="barcode" @keydown.13="searchBarcode()" class="form-control form-control-sm rounded-pill col-6 offset-2" placeholder="条码"></input>
  25. </div>
  26. <div class="card-body">
  27. <div class="row border-info p-0" style="height:65vh;overflow-y: auto">
  28. <div class="col-4 m-0 p-1" style="height: 55px;border: 1px solid #aaaaaa;z-index:100;position:relative;" v-for="index in waves.length"
  29. :style="[waveQtyMap['_'+(index-1)] && waveQtyMap['_'+(index-1)].sum>0 ? {boxShadow: colorPool[colorIndex]+' 0 0 5px 5px inset'} : '']">
  30. <div class="text-center small font-weight-bold h-25 text-secondary">@{{ 'W-'+index }}</div>
  31. <div style="display:flex;align-items:center;justify-content:center;" class="w-100 h-50 text-primary font-weight-bold">
  32. @{{ waveQtyMap['_'+(index-1)] ? waveQtyMap['_'+(index-1)].sum : '0' }}
  33. </div>
  34. <div class="text-center small font-weight-bold h-25 text-muted mb-1">@{{ waveQtyMap['_'+(index-1)] ? waveQtyMap['_'+(index-1)].lot : '0' }}</div>
  35. </div>
  36. </div>
  37. </div>
  38. </div>
  39. </div>
  40. <div class="bg-white w-100 row" id="searchBlock" style="position: fixed;top:0;left:0;
  41. width: 100%; text-align: center; border-radius: 3px;">
  42. <div class="position-relative offset-2 col-9 mt-3 mb-3">
  43. <input id="loadBatch" class="form-control form-control-sm w-100 rounded-pill" @keydown.enter="loadBatch()" v-model="batch" type="text" placeholder="波次号"></input>
  44. <a id="search" @click="loadBatch()"><button type="button" class="border btn btn-sm btn-primary text-white rounded-pill position-absolute" style="top: 0;right: 12px;">开始分拣</button></a>
  45. </div>
  46. </div>
  47. </div>
  48. @endsection
  49. @section('lastScript')
  50. <script>
  51. new Vue({
  52. el:"#container",
  53. data:{
  54. batch:"",
  55. barcode:"",
  56. isShow:false,
  57. waves:[],
  58. waveQtyMap:{},
  59. colorIndex:0,
  60. colorPool:[
  61. "RGB(224,41,43)","rgba(19,193,137)","RGB(97,179,233)"
  62. ]
  63. },
  64. mounted:function(){
  65. this.pageInit();
  66. setTimeout(()=>{
  67. $("#container").removeClass('d-none');
  68. },100);
  69. setTimeout(()=>{
  70. $("#loadBatch").focus();
  71. },200);
  72. },
  73. methods:{
  74. //页面初始化
  75. pageInit(){
  76. let element = document.getElementById("navbarSupportedContent").parentElement;
  77. element.className = "row";
  78. element.children[0].className += " col-5";
  79. element.children[0].href = "#";
  80. element.innerHTML = element.children[0].outerHTML;
  81. let e1 = document.getElementById("menu");
  82. let e2 = document.getElementById("demand-div");
  83. //let e3 = document.getElementsByClassName("navbar");
  84. if (e1)e1.remove();
  85. if (e2)e2.remove();
  86. //if (e3.length>0)e3[0].remove();
  87. element = document.getElementById("container");
  88. if (element)element.style.height = (window.innerHeight-100)+"px";
  89. },
  90. loadBatch(){
  91. window.tempTip.postBasicRequest("{{url('order/wave/loadBatch')}}",{code:this.batch},res=>{
  92. this.waves = res;
  93. $("#barcode").focus();
  94. })
  95. },
  96. searchBarcode(){
  97. let waveQtyMap = {};
  98. try {
  99. this.waves.forEach((wave,i)=>{
  100. wave.forEach(order=>{
  101. if (order.barcode === this.barcode){
  102. if (order.scanSign!==undefined){
  103. throw new Error("unique");
  104. }
  105. order.scanSign = true;
  106. if (waveQtyMap['_'+i]===undefined){
  107. waveQtyMap['_'+i] = {"sum":order.qty,"lot":order.location};
  108. } else waveQtyMap['_'+i].sum += order.qty;
  109. }
  110. })
  111. })
  112. }catch (e){
  113. window.tempTip.setDuration(2000);
  114. window.tempTip.setIndex(999);
  115. window.tempTip.show("重复扫描");
  116. return;
  117. }finally {
  118. this.waveQtyMap = waveQtyMap;
  119. let el = $("#barcode");
  120. el.focus();
  121. el.select();
  122. }
  123. if (this.colorIndex===this.colorPool.length-1)this.colorIndex = 0;
  124. else this.colorIndex++;
  125. },
  126. }
  127. });
  128. </script>
  129. @endsection