| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179 |
- @extends('layouts.app')
- @section('title')缓存架入库-入库管理@endsection
- @section('content')
- <div class="container-fluid" id="container">
- <div class="row">
- <div class="card offset-md-3 col-md-6 col-sm-12">
- <div class="card-body">
- <div class="form-group text-center">
- <span class="font-weight-bold h4">入库信息</span>
- <a class="small" href="#" @click="openModal()">溢出减量</a>
- </div>
- <div class="form-group row">
- <label for="asn" class="col-sm-2 col-3 text-right">ASN号:</label>
- <input type="text" class="form-control col-8" @change="downSign()" :class="errors.asn ? 'is-invalid' : ''" id="asn" v-model="info.asn" @blur="checkAsn()" placeholder="只需填写后几位,自动补充">
- <span class="invalid-feedback offset-2" role="alert" v-if="errors.asn">
- <strong>@{{ errors.asn[0] }}</strong>
- </span>
- </div>
- <div class="form-group row">
- <label for="station" class="col-sm-2 col-3 text-right">库位:</label>
- <input type="text" class="form-control col-8" :class="errors.station ? 'is-invalid' : ''" id="station" v-model="info.station" @blur="checkMaximum()"
- placeholder="扫描货架条码">
- <span class="invalid-feedback offset-2" role="alert" v-if="errors.station">
- <strong>@{{ errors.station[0] }}</strong>
- </span>
- </div>
- <div class="form-group row">
- <label for="barCode" class="col-sm-2 col-3 text-right">条码:</label>
- <input type="text" class="form-control col-8" @change="downSign()" :class="errors.barCode ? 'is-invalid' : ''" id="barCode" v-model="info.barCode" @blur="checkMaximum()" placeholder="扫描商品条码">
- <span class="invalid-feedback offset-2" role="alert" v-if="errors.barCode">
- <strong>@{{ errors.barCode[0] }}</strong>
- </span>
- </div>
- <div class="form-group row">
- <label for="amount" class="col-sm-2 col-3 text-right">数量:</label>
- <input type="number" class="form-control col-8" :class="errors.amount ? 'is-invalid' : ''" id="amount" @blur="checkMaximum()" v-model="info.amount"
- :placeholder="info.maximum!==undefined ? '最大可上:'+info.maximum : ''" :max="info.maximum" step="1">
- <span class="invalid-feedback offset-2" role="alert" v-if="errors.amount">
- <strong>@{{ errors.amount[0] }}</strong>
- </span>
- </div>
- <div class="input-group row mt-5">
- <button type="submit" class="btn btn-success offset-2 col-9" @click="checkInfo()">提交</button>
- </div>
- </div>
- </div>
- <div class="modal fade" tabindex="-1" role="dialog" id="modal">
- <div class="modal-dialog modal-lg modal-dialog-centered modal-dialog-scrollable">
- <div class="modal-content">
- <div class="modal-header">
- <div class="font-weight-bold h4">溢出减量</div>
- <button type="button" class="close" data-dismiss="modal">×</button>
- </div>
- <div class="modal-body">
- <div class="form-group">
- <label for="location">库位码</label>
- <input id="location" type="text" v-model="ov.station" class="form-control" placeholder="库位码">
- </div>
- <div class="form-group">
- <label for="ov_amount">溢出数量</label>
- <input id="ov_amount" type="number" v-model="ov.amount" min="1" step="1" class="form-control" placeholder="溢出数量">
- </div>
- </div>
- <div class="modal-footer">
- <button type="button" class="btn btn-success" @click="overflowRevision()">提交</button>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
- @stop
- @section('lastScript')
- <script type="text/javascript">
- new Vue({
- el:"#container",
- data:{
- permissionList:[ //允许聚焦许可列表
- "asn","station","amount","location","ov_amount"
- ],
- info:{},
- mount:false,
- before:{
- asn:"",
- },
- errors:{},
- ov:{},//溢出减量数值
- checkSign:false;
- },
- mounted(){
- this.codeFocus();
- this.globalClick();
- this.createBefore();
- },
- methods:{
- //提交溢出减量
- overflowRevision(){
- if (!this.ov.station || !this.ov.amount){
- window.tempTip.show("信息不完整");
- return;
- }
- window.tempTip.postBasicRequest("{{url('store/inStorage/overflowRevision')}}",this.ov,()=>{
- $("#modal").modal('hide');
- this.ov = {};
- return "溢出减量成功!";
- });
- },
- //打开溢出减量模态框
- openModal(){
- $("#modal").modal("show");
- setTimeout(function () {
- document.getElementById("location").focus();
- },500);
- },
- //聚焦 白名单
- codeFocus(){
- if (!this.permissionList.includes(document.activeElement.id)) document.getElementById("barCode").focus();
- },
- //全局点击聚焦
- globalClick(turn = true){
- if (turn===this.mount)return;
- this.mount = turn;//防止重复挂载事件
- if (turn) window.addEventListener("click",this.codeFocus);
- else window.removeEventListener("click",this.codeFocus);
- },
- checkInfo(){
- let error = {};
- if (!this.info.asn)error.asn = ["ASN号必填"];
- if (this.info.asn && this.info.asn.length!==13)error.asn = ["非法ASN号"];
- if (!this.info.barCode)error.barCode = ["商品条码必填"];
- if (!this.info.station)error.station = ["库位必填"];
- if (!this.info.amount && !this.info.maximum)error.amount = ["数量必填"];
- if (JSON.stringify(error)!=='{}'){this.errors = error;return;}
- if (!this.info.amount && this.info.maximum)this.info.amount = this.info.maximum;
- this._exeTask();
- },
- _exeTask(){
- window.tempTip.postBasicRequest("{{url('store/inStorage/acquireBox')}}",this.info,()=>{
- this.info = {};
- this.errors = {};
- return "上架成功!";
- });
- },
- createBefore(){
- let now = new Date();
- let yy = now.getFullYear().toString().substr(2, 2);
- let mm = now.getMonth() + 1;
- mm = mm <10 ? '0'+mm : mm.toString();
- let dd = now.getDate();
- dd = dd <10 ? '0'+dd : dd.toString();
- this.before.asn = 'ASN'+yy+mm+dd+'000';
- },
- checkAsn(){
- if(!this.info.asn)return;
- let len = this.info.asn.length;
- if (len<13)this.info.asn = this.before.asn.substr(0,13-len)+this.info.asn;
- if (!this.info.ide)document.getElementById("station").focus();
- if (!this.checkSign)this.checkMaximum();
- },
- downSign(){
- this.checkSign = false;
- },
- checkMaximum(){
- if (!this.info.asn || !this.info.barCode)return;
- window.tempTip.postBasicRequest("{{url('store/inStorage/checkMaximum')}}",this.info,res=>{
- this.info.maximum = res.need;
- this.info.material_box_id = res.material_box_id;
- this.info.material_box_model_id = res.material_box_model_id;
- this.info.commodity_id = res.commodity_id;
- this.checkSign = true;
- });
- },
- },
- });
- </script>
- @stop
|