| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202 |
- @extends('layouts.app')
- @section('title')缓存架入库-入库管理@endsection
- @section('content')
- <div class="container-fluid" id="container">
- <div class="row">
- <div class="card offset-md-1 col-md-5 col-sm-12">
- <div class="card-body">
- <div class="form-group text-center font-weight-bold h4">
- 入库信息
- </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" :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="ide" class="col-sm-2 col-3 text-right">料箱号:</label>
- <input type="text" class="form-control col-8" :class="errors.ide ? 'is-invalid' : ''" id="ide" v-model="info.ide" @blur="checkIde()" placeholder="只需填写后几位,自动补充">
- <span class="invalid-feedback offset-2" role="alert" v-if="errors.ide">
- <strong>@{{ errors.ide[0] }}</strong>
- </span>
- </div>
- <div class="input-group row">
- <label for="barCode" class="col-sm-2 col-3 text-right">条码:</label>
- <input type="text" class="form-control rounded col-sm-5 col-8 ml-sm-1 ml-2" :class="errors.barCode ? 'is-invalid' : ''" id="barCode" @blur="codeBlur()" @keydown.enter="checkInfo()" v-model="info.barCode">
- <div class="input-group-append mt-sm-0 mt-4">
- <span class="input-group-text d-none d-sm-block">@数量</span>
- <label for="amount" class="d-sm-none col-4 text-right">数量:</label>
- <span class="input-group-text p-0 border-0">
- <input class="form-control" type="number" :class="errors.amount ? 'is-invalid' : ''" step="1" min="1" id="amount" v-model="info.amount">
- </span>
- </div>
- <span class="invalid-feedback offset-2" role="alert" v-if="errors.barCode">
- <strong>@{{ errors.barCode[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="card col-md-5 col-sm-12">
- <div class="card-body">
- <div class="mt-1 text-center">
- <button class="btn btn-primary" @click="submitBox()">为选中格口手动补充料箱</button>
- </div>
- <div class="mt-2 h-75">
- <table class="table table-sm table-bordered border-dark w-100 h-100 text-center" style="cursor: pointer">
- <tr>
- <th :class="[shelfOccupy['HAIB1-03-03'] ? 'bg-danger' : 'bg-success',selectedBox['HAIB1-03-03'] ? 'box-shadow-dark' : '']"
- @click="fillingBox('HAIB1-03-03')">HAIB1-03-03</th>
- <th :class="[shelfOccupy['HAIB1-02-03'] ? 'bg-danger' : 'bg-success',selectedBox['HAIB1-02-03'] ? 'box-shadow-dark' : '']"
- @click="fillingBox('HAIB1-02-03')">HAIB1-02-03</th>
- <th :class="[shelfOccupy['HAIB1-01-03'] ? 'bg-danger' : 'bg-success',selectedBox['HAIB1-01-03'] ? 'box-shadow-dark' : '']"
- @click="fillingBox('HAIB1-01-03')">HAIB1-01-03</th>
- </tr>
- <tr>
- <th :class="[shelfOccupy['HAIB1-03-02'] ? 'bg-danger' : 'bg-success',selectedBox['HAIB1-03-02'] ? 'box-shadow-dark' : '']"
- @click="fillingBox('HAIB1-03-02')">HAIB1-03-02</th>
- <th :class="[shelfOccupy['HAIB1-02-02'] ? 'bg-danger' : 'bg-success',selectedBox['HAIB1-02-02'] ? 'box-shadow-dark' : '']"
- @click="fillingBox('HAIB1-02-02')">HAIB1-02-02</th>
- <th :class="[shelfOccupy['HAIB1-01-02'] ? 'bg-danger' : 'bg-success',selectedBox['HAIB1-01-02'] ? 'box-shadow-dark' : '']"
- @click="fillingBox('HAIB1-01-02')">HAIB1-01-02</th>
- </tr>
- <tr>
- <th :class="[shelfOccupy['HAIB1-03-01'] ? 'bg-danger' : 'bg-success',selectedBox['HAIB1-03-01'] ? 'box-shadow-dark' : '']"
- @click="fillingBox('HAIB1-03-01')">HAIB1-03-01</th>
- <th :class="[shelfOccupy['HAIB1-02-01'] ? 'bg-danger' : 'bg-success',selectedBox['HAIB1-02-01'] ? 'box-shadow-dark' : '']"
- @click="fillingBox('HAIB1-02-01')">HAIB1-02-01</th>
- <th :class="[shelfOccupy['HAIB1-01-01'] ? 'bg-danger' : 'bg-success',selectedBox['HAIB1-01-01'] ? 'box-shadow-dark' : '']"
- @click="fillingBox('HAIB1-01-01')">HAIB1-01-01</th>
- </tr>
- </table>
- </div>
- </div>
- </div>
- </div>
- </div>
- @stop
- @section('lastScript')
- <script type="text/javascript">
- new Vue({
- el:"#container",
- data:{
- permissionList:[ //允许聚焦许可列表
- "asn","ide","amount"
- ],
- info:{},
- mount:false,
- before:{
- asn:"",
- ide:"",
- },
- errors:{},
- shelfOccupy:{},
- selectedBox:{},
- },
- mounted(){
- @foreach($storages as $storage)this.$set(this.shelfOccupy,"{{$storage->station->code}}",true);@endforeach
- this.codeFocus();
- this.globalClick();
- this.createBefore();
- },
- methods:{
- //选中填充料箱
- fillingBox(ideCode){
- this.$set(this.selectedBox,ideCode,this.selectedBox[ideCode] ? !this.selectedBox[ideCode] : true);
- },
- //提交填充料箱
- submitBox(){
- window.tempTip.setDuration(3000);
- if (JSON.stringify(this.selectedBox)==='{}'){window.tempTip.show("未选中格口");return;}
- window.tempTip.confirm("确定选中格口已无料箱存在?",()=>{
- let boxes = [];
- for (let key in this.selectedBox)if (this.selectedBox[key]) boxes.push(key);
- window.tempTip.postBasicRequest("{{url('store/inStorage/resetCacheShelf')}}",{boxes:boxes},res=>{
- for (let i=0;i<res.boxes.length;i++){
- this.$set(this.shelfOccupy,res.boxes[i],true);
- this.$set(this.selectedBox,res.boxes[i],true);
- }
- if (res.data){
- window.tempTip.show(res.data);
- return;
- }
- return "手动补充成功";
- },true);
- })
- },
- //聚焦 白名单
- 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);
- },
- codeBlur(){
- if (this.info.asn && this.info.ide && !this.info.amount){
- this.globalClick(false);
- window.tempTip.inputVal('请输入数量:',(amount)=>{
- this.$set(this.info,'amount',amount);
- if (this.info.asn && this.info.ide && this.info.barCode && this.info.amount)this.checkInfo();
- this.globalClick();
- });
- }
- },
- 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.ide)error.ide = ["料箱号必填"];
- if (this.info.ide && this.info.ide.length!==10)error.ide = ["非法料箱号"];
- if (!this.info.barCode)error.barCode = ["商品条码必填"];
- if (!this.info.amount)error.amount = ["数量必填"];
- if (JSON.stringify(error)!=='{}'){this.errors = error;return;}
- this._exeTask();
- },
- _exeTask(){
- window.tempTip.postBasicRequest("{{url('store/inStorage/putShelf')}}",this.info,res=>{
- if (!res.maximum){
- window.tempTip.inputVal('商品首入,请输入预估最大可放入数:',(maximum)=>{
- res.maximum = maximum;
- window.tempTip.postBasicRequest("{{url('store/inStorage/setMaximum')}}",res,()=>{});
- });
- }
- 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';
- this.before.ide = 'IDE000000';
- },
- 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("ide").focus();
- },
- checkIde(){
- if(!this.info.ide)return;
- let len = this.info.ide.length;
- if (len<10)this.info.ide = this.before.ide.substr(0,10-len)+this.info.ide;
- }
- },
- });
- </script>
- @stop
|