halfChestStorage.blade.php 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  1. @extends('layouts.app')
  2. @section('title')缓存架入库-入库管理@endsection
  3. @section('content')
  4. <div class="container-fluid" id="container">
  5. <div class="row">
  6. <div class="card offset-md-3 col-md-6 col-sm-12">
  7. <div class="card-body">
  8. <div class="form-group text-center">
  9. <span class="font-weight-bold h4">入库信息</span>
  10. <a class="small" href="#" @click="openModal()">溢出减量</a>
  11. </div>
  12. <div class="form-group row">
  13. <label for="asn" class="col-sm-2 col-3 text-right">ASN号:</label>
  14. <input type="text" class="form-control col-8" @change="downSign()" :class="errors.asn ? 'is-invalid' : ''" id="asn" v-model="info.asn" @blur="checkAsn()" placeholder="只需填写后几位,自动补充">
  15. <span class="invalid-feedback offset-2" role="alert" v-if="errors.asn">
  16. <strong>@{{ errors.asn[0] }}</strong>
  17. </span>
  18. </div>
  19. <div class="form-group row">
  20. <label for="station" class="col-sm-2 col-3 text-right">库位:</label>
  21. <input type="text" class="form-control col-8" :class="errors.station ? 'is-invalid' : ''" id="station" v-model="info.station" @blur="checkMaximum()"
  22. placeholder="扫描货架条码">
  23. <span class="invalid-feedback offset-2" role="alert" v-if="errors.station">
  24. <strong>@{{ errors.station[0] }}</strong>
  25. </span>
  26. </div>
  27. <div class="form-group row">
  28. <label for="barCode" class="col-sm-2 col-3 text-right">条码:</label>
  29. <input type="text" class="form-control col-8" @change="downSign()" :class="errors.barCode ? 'is-invalid' : ''" id="barCode" v-model="info.barCode" @blur="checkMaximum()" placeholder="扫描商品条码">
  30. <span class="invalid-feedback offset-2" role="alert" v-if="errors.barCode">
  31. <strong>@{{ errors.barCode[0] }}</strong>
  32. </span>
  33. </div>
  34. <div class="form-group row">
  35. <label for="amount" class="col-sm-2 col-3 text-right">数量:</label>
  36. <input type="number" class="form-control col-8" :class="errors.amount ? 'is-invalid' : ''" id="amount" @blur="checkMaximum()" v-model="info.amount"
  37. :placeholder="info.maximum!==undefined ? '最大可上:'+info.maximum : ''" :max="info.maximum" step="1">
  38. <span class="invalid-feedback offset-2" role="alert" v-if="errors.amount">
  39. <strong>@{{ errors.amount[0] }}</strong>
  40. </span>
  41. </div>
  42. <div class="input-group row mt-5">
  43. <button type="submit" class="btn btn-success offset-2 col-9" @click="checkInfo()">提交</button>
  44. </div>
  45. </div>
  46. </div>
  47. <div class="modal fade" tabindex="-1" role="dialog" id="modal">
  48. <div class="modal-dialog modal-lg modal-dialog-centered modal-dialog-scrollable">
  49. <div class="modal-content">
  50. <div class="modal-header">
  51. <div class="font-weight-bold h4">溢出减量</div>
  52. <button type="button" class="close" data-dismiss="modal">&times;</button>
  53. </div>
  54. <div class="modal-body">
  55. <div class="form-group">
  56. <label for="location">库位码</label>
  57. <input id="location" type="text" v-model="ov.station" class="form-control" placeholder="库位码">
  58. </div>
  59. <div class="form-group">
  60. <label for="ov_amount">溢出数量</label>
  61. <input id="ov_amount" type="number" v-model="ov.amount" min="1" step="1" class="form-control" placeholder="溢出数量">
  62. </div>
  63. </div>
  64. <div class="modal-footer">
  65. <button type="button" class="btn btn-success" @click="overflowRevision()">提交</button>
  66. </div>
  67. </div>
  68. </div>
  69. </div>
  70. </div>
  71. </div>
  72. @stop
  73. @section('lastScript')
  74. <script type="text/javascript">
  75. new Vue({
  76. el:"#container",
  77. data:{
  78. permissionList:[ //允许聚焦许可列表
  79. "asn","station","amount","location","ov_amount"
  80. ],
  81. info:{},
  82. mount:false,
  83. before:{
  84. asn:"",
  85. },
  86. errors:{},
  87. ov:{},//溢出减量数值
  88. checkSign:false;
  89. },
  90. mounted(){
  91. this.codeFocus();
  92. this.globalClick();
  93. this.createBefore();
  94. },
  95. methods:{
  96. //提交溢出减量
  97. overflowRevision(){
  98. if (!this.ov.station || !this.ov.amount){
  99. window.tempTip.show("信息不完整");
  100. return;
  101. }
  102. window.tempTip.postBasicRequest("{{url('store/inStorage/overflowRevision')}}",this.ov,()=>{
  103. $("#modal").modal('hide');
  104. this.ov = {};
  105. return "溢出减量成功!";
  106. });
  107. },
  108. //打开溢出减量模态框
  109. openModal(){
  110. $("#modal").modal("show");
  111. setTimeout(function () {
  112. document.getElementById("location").focus();
  113. },500);
  114. },
  115. //聚焦 白名单
  116. codeFocus(){
  117. if (!this.permissionList.includes(document.activeElement.id)) document.getElementById("barCode").focus();
  118. },
  119. //全局点击聚焦
  120. globalClick(turn = true){
  121. if (turn===this.mount)return;
  122. this.mount = turn;//防止重复挂载事件
  123. if (turn) window.addEventListener("click",this.codeFocus);
  124. else window.removeEventListener("click",this.codeFocus);
  125. },
  126. checkInfo(){
  127. let error = {};
  128. if (!this.info.asn)error.asn = ["ASN号必填"];
  129. if (this.info.asn && this.info.asn.length!==13)error.asn = ["非法ASN号"];
  130. if (!this.info.barCode)error.barCode = ["商品条码必填"];
  131. if (!this.info.station)error.station = ["库位必填"];
  132. if (!this.info.amount && !this.info.maximum)error.amount = ["数量必填"];
  133. if (JSON.stringify(error)!=='{}'){this.errors = error;return;}
  134. if (!this.info.amount && this.info.maximum)this.info.amount = this.info.maximum;
  135. this._exeTask();
  136. },
  137. _exeTask(){
  138. window.tempTip.postBasicRequest("{{url('store/inStorage/acquireBox')}}",this.info,()=>{
  139. this.info = {};
  140. this.errors = {};
  141. return "上架成功!";
  142. });
  143. },
  144. createBefore(){
  145. let now = new Date();
  146. let yy = now.getFullYear().toString().substr(2, 2);
  147. let mm = now.getMonth() + 1;
  148. mm = mm <10 ? '0'+mm : mm.toString();
  149. let dd = now.getDate();
  150. dd = dd <10 ? '0'+dd : dd.toString();
  151. this.before.asn = 'ASN'+yy+mm+dd+'000';
  152. },
  153. checkAsn(){
  154. if(!this.info.asn)return;
  155. let len = this.info.asn.length;
  156. if (len<13)this.info.asn = this.before.asn.substr(0,13-len)+this.info.asn;
  157. if (!this.info.ide)document.getElementById("station").focus();
  158. if (!this.checkSign)this.checkMaximum();
  159. },
  160. downSign(){
  161. this.checkSign = false;
  162. },
  163. checkMaximum(){
  164. if (!this.info.asn || !this.info.barCode)return;
  165. window.tempTip.postBasicRequest("{{url('store/inStorage/checkMaximum')}}",this.info,res=>{
  166. this.info.maximum = res.need;
  167. this.info.material_box_id = res.material_box_id;
  168. this.info.material_box_model_id = res.material_box_model_id;
  169. this.info.commodity_id = res.commodity_id;
  170. this.checkSign = true;
  171. });
  172. },
  173. },
  174. });
  175. </script>
  176. @stop