| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318 |
- @extends('layouts.app')
- @section('title')手持入库-收货详情@endsection
- @section('content')
- <div class="d-none" id="container">
- <div class="card offset-md-3 col-md-6 col-sm-12">
- <div class="card-header text-center mt-2 bg-transparent" id="header_title">
- <span class="font-weight-bold h4">收货</span>
- </div>
- <div class="card-body">
- <div class="form-group row m-1">
- <span class="text-right">
- <span class="fa fa-search fa-lg" aria-hidden="true" @click="selectAsnDetails()"></span>
- <label for="sku" class="text-right text-danger font-weight-bold">产品:</label>
- </span>
- <input type="text" class="form-control form-control-sm col-8" id="sku" autocomplete="off" placeholder="输入商品sku或商品条码"
- :class="errors.sku ? 'is-invalid' : ''" @keydown.enter="enterVal($event)" v-model="info.sku" @blur="checkedSku()">
- <span class="invalid-feedback offset-3" role="alert" v-if="errors.sku">
- <strong>@{{ errors.sku[0] }}</strong>
- </span>
- </div>
- <div v-if="isInit">
- <div class="form-group row m-1">
- <label for="name" class="text-right">品名:</label>
- <span id="name" >@{{ info.name }}</span>
- </div>
- <div class="form-group row m-1">
- <label for="quantity" class="text-right">已收/预收数量:</label>
- <span> </span>
- <span id="quantity">@{{ info.receivedqty??0 }}/@{{ info.expectedqty??0 }}</span>
- </div>
- <div class="form-group row m-1">
- <label for="amount" class="text-right text-danger font-weight-bold">实收数量:</label>
- <input type="number" class="form-control form-control-sm col-8" id="amount" autocomplete="off"
- :class="errors.amount ? 'is-invalid' : ''" v-model="info.amount" @keydown.enter="enterVal($event)">
- <span class="invalid-feedback offset-3" role="alert" v-if="errors.amount">
- <strong>@{{ errors.amount[0] }}</strong>
- </span>
- </div>
- {{-- <div class="form-group row m-1">--}}
- {{-- <label for="location" class="text-right">目标库位:</label>--}}
- {{-- <input type="text" class="form-control form-control-sm col-8" id="location" autocomplete="off"--}}
- {{-- @keydown.enter="enterVal($event)" v-model="info.location">--}}
- {{-- </div>--}}
- <div class="form-group row m-1">
- <label for="trackNumber" class="text-right text-danger font-weight-bold">容器号:</label>
- <input type="text" class="form-control form-control-sm col-8" id="trackNumber" autocomplete="off"
- @keydown.enter="enterVal($event)" :class="errors.trackNumber ? 'is-invalid' : ''" v-model="info.trackNumber">
- <span class="invalid-feedback offset-3" role="alert" v-if="errors.trackNumber">
- <strong>@{{ errors.trackNumber[0] }}</strong>
- </span>
- </div>
- </div>
- <div style="overflow: auto;overflow-x: hidden" id="cardTable" v-if="!isInit">
- <table class="table-sm table-striped table-bordered table-hover mb-3"
- style="background: rgb(255, 255, 255);">
- <tr v-for="(asnDetail,i) in asnDetails" @click="selectTrOne(i,asnDetail.sku)" :class="selectTr===i+1?'focusing' : ''">
- <td style="filter:grayscale(30%);">
- <div>
- <div style="transform:scale(1)" class="pl-0">
- <span><span class="text-danger font-weight-bold">产品:</span><span class="text-black">@{{ asnDetail.sku }}</span></span>
- <span><span class="font-weight-bold">行号:</span><span class="text-lowercase" >@{{ asnDetail.asnlineno }}</span></span>
- <span class="text-right float-right">选中:<input type="checkbox" @click="checked(asnDetail)"></span>
- <span><span class="text-lowercase">品名:</span><span class="text-lowercase">@{{ asnDetail.skudescrc }} </span></span>
- <span><span class="text-black">预期数量:</span><span class="text-black-50">@{{ asnDetail.expectedqty }}</span></span>
- <span><span class="text-black">已收数量:</span><span class="text-black-50">@{{ asnDetail.receivedqty }}</span></span>
- </div>
- </div>
- </td>
- </tr>
- </table>
- </div>
- </div>
- <div class="card-body border-top border-dark" v-if="basSku.lot_id">
- <div class="form-group row">
- <span class="col-6" v-if="basSku.lot_id.lotkey01==='Y'">
- <label for="lotatt01" class=" text-right text-danger">生产日期:</label><br>
- <input type="date" class="form-control form-control-sm"
- :class="errors.lotatt01 ? 'is-invalid' : ''" id="lotatt01" v-model="info.lotatt01">
- <span class="invalid-feedback offset-3" role="alert" v-if="errors.lotatt01">
- <strong>@{{ errors.lotatt01[0] }}</strong>
- </span>
- </span>
- <span class="col-6" v-if="basSku.lot_id.lotkey02==='Y'">
- <label for="lotatt02" class=" text-right text-danger">失效日期:</label>
- <input type="date" class="form-control form-control-sm"
- :class="errors.lotatt02 ? 'is-invalid' : ''" id="lotatt02" v-model="info.lotatt02">
- <span class="invalid-feedback offset-3" role="alert" v-if="errors.lotatt02">
- <strong>@{{ errors.lotatt02[0] }}</strong>
- </span>
- </span>
- </div>
- <div class="form-group row">
- <span class="col-6" v-if="basSku.lot_id.lotkey04==='Y'">
- <label for="lotatt04" class=" text-right text-danger">批号:</label><br>
- <input type="text" class="form-control form-control-sm" :class="errors.lotatt04 ? 'is-invalid' : ''" autocomplete="off"
- id="lotatt04" v-model="info.lotatt04">
- <span class="invalid-feedback offset-3" role="alert" v-if="errors.lotatt04">
- <strong>@{{ errors.lotatt04[0] }}</strong>
- </span>
- </span>
- <span class="col-6" v-if="basSku.lot_id.lotkey05==='Y'">
- <label for="lotatt05" class=" text-right text-danger">属性仓:</label>
- <select class="form-control form-control-sm" :class="errors.lotatt05 ? 'is-invalid' : ''"
- id="lotatt05" v-model="info.lotatt05">
- <option v-for="(attributeLocation,i) in attributeLocations" :value="attributeLocation.code">@{{ attributeLocation.codename_c }}</option>
- </select>
- <span class="invalid-feedback offset-3" role="alert" v-if="errors.lotatt05">
- <strong>@{{ errors.lotatt05[0] }}</strong>
- </span>
- </span>
- </div>
- <div class="form-group row">
- <span class="col-6" v-if="basSku.lot_id.lotkey08==='Y'">
- <label for="lotatt08" class=" text-right text-danger">质量状态:</label>
- <select class="form-control form-control-sm"
- :class="errors.lotatt08 ? 'is-invalid' : ''" id="lotatt08" v-model="info.lotatt08">
- <option v-for="(quality,i) in qualityStatus" :value="quality.code">@{{ quality.codename_c }}</option>
- </select>
- <span class="invalid-feedback offset-3" role="alert" v-if="errors.lotatt08">
- <strong>@{{ errors.lotatt08[0] }}</strong>
- </span>
- </span>
- <span class="col-6" v-if="basSku.lot_id.lotkey03==='Y'">
- <label for="lotatt03" class=" text-right text-danger">入库日期:</label>
- <input type="date" class="form-control form-control-sm"
- :class="errors.lotatt03 ? 'is-invalid' : ''" id="lotatt03" v-model="info.lotatt03">
- <span class="invalid-feedback offset-3" role="alert" v-if="errors.lotatt03">
- <strong>@{{ errors.lotatt03[0] }}</strong>
- </span>
- </span>
- </div>
- </div>
- <div class="card-footer bg-transparent">
- <button type="button" id="confirm" class="btn btn-sm btn-outline-success float-right" @click="ensure()">确定</button>
- <button type="button" id="cancel" class="btn btn-sm btn-outline-info float-left" @click="cancel()">取消</button>
- </div>
- </div>
- </div>
- @stop
- @section('lastScript')
- <script type="text/javascript">
- new Vue({
- el:"#container",
- data:{
- asnno:'{!! $asnno !!}',
- customerid:'{!! $customerid !!}',
- qualityStatus:{!! $qualityStatus !!},
- attributeLocations:{!! $attributeLocations !!},
- basSku:{},
- permissionList:[ //允许聚焦许可列表
- "sku","amount","trackNumber"
- ],
- asnDetails:[],
- info:{},
- errors:{},
- isAndroid:false,
- isInit:true,
- element:[
- "sku","amount",/*"location",*/"trackNumber"
- ],
- selectTr:'',
- },
- mounted(){
- if (navigator.userAgent.indexOf("Android")!==-1)this.isAndroid = true;
- this.pageInit();
- $("#container").removeClass("d-none");
- document.getElementById("sku").focus();
- },
- methods:{
- //页面初始化
- pageInit(){
- if (!this.isAndroid)return;
- let element = document.getElementById("navbarSupportedContent").parentElement;
- element.className = "row";
- element.children[0].className += " col-5";
- element.innerHTML = element.children[0].outerHTML;
- let e1 = document.getElementById("menu");
- let e2 = document.getElementById("demand-div");
- if (e1)e1.remove();
- if (e2)e2.remove();
- },
- selectTrOne(i,sku){
- if (this.selectTr===i+1){
- this.selectTr=0
- }else {
- this.selectTr=i+1;
- }
- },
- checkedSku(){
- if (!this.info.sku)return;
- let url = '{{url('store/handInStorage/getBasSkuWithLot')}}';
- window.axios.post(url,{asnno:this.asnno,customerid:this.customerid,sku:this.info.sku})
- .then(res=>{
- if (res.data.success){
- this.fillInfo(res.data.asnDetail);
- this.basSku=res.data.basSku;
- this.$forceUpdate()
- return;
- }
- this.clearInfo();
- window.tempTip.setDuration(2000);
- window.tempTip.show(res.data.data);
- }).catch(err=>{
- window.tempTip.setDuration(2000);
- window.tempTip.show("网络错误:"+err);
- })
- },
- checked(asnDetail){
- this.isInit=true;
- this.fillInfo(asnDetail);
- let url = '{{url('store/handInStorage/getBasSkuWithLot')}}';
- window.axios.post(url,{asnno:this.asnno,customerid:this.customerid,sku:this.info.sku})
- .then(res=>{
- if (res.data.success){
- this.basSku=res.data.basSku;
- this.$forceUpdate()
- return;
- }
- window.tempTip.setDuration(2000);
- window.tempTip.show(res.data.data);
- }).catch(err=>{
- window.tempTip.setDuration(2000);
- window.tempTip.show("网络错误:"+err);
- })
- },
- clearInfo(){
- this.info.name='';
- this.info.expectedqty=0;
- this.info.receivedqty=0;
- this.$forceUpdate()
- },
- fillInfo(asnDetail){
- this.info.sku=asnDetail.sku;
- this.info.name=asnDetail.skudescrc;
- this.info.expectedqty=asnDetail.expectedqty;
- this.info.receivedqty=asnDetail.receivedqty;
- this.info.amount=Number(this.info.expectedqty)-Number(this.info.receivedqty);
- this.info.asnlineno=asnDetail.asnlineno;
- },
- checkInfo(){
- let error = {};
- if (!this.info.sku)error.sku = ["条码必填"];
- if (!this.info.amount)error.amount = ["实收数量必填"];
- if (!this.info.trackNumber)error.trackNumber = ["容器号必填"];
- if (this.info.amount && ((Number(this.info.amount)+Number(this.info.receivedqty))>Number(this.info.expectedqty)))error.amount = ["总数不能超过预期数"];
- if (this.basSku.lot_id && this.basSku.lot_id.lotkey01==='Y' && !this.info.lotatt01) error.lotatt01=["生产日期为选"];
- if (this.basSku.lot_id && this.basSku.lot_id.lotkey02==='Y' && !this.info.lotatt02) error.lotatt02=["失效日期为选"];
- if (this.basSku.lot_id && this.basSku.lot_id.lotkey03==='Y' && !this.info.lotatt03) error.lotatt03=["入库日期为选"];
- if (this.basSku.lot_id && this.basSku.lot_id.lotkey04==='Y' && !this.info.lotatt04) error.lotatt04=["批号未填"];
- if (this.basSku.lot_id && this.basSku.lot_id.lotkey05==='Y' && !this.info.lotatt05) error.lotatt05=["属性仓未选"];
- if (this.basSku.lot_id && this.basSku.lot_id.lotkey08==='Y' && !this.info.lotatt08) error.lotatt08=["质量状态未选"];
- if (JSON.stringify(error)!=='{}'){this.errors = error;}
- },
- enterVal(e){
- let index = this.element.indexOf(e.target.id)+1;
- let element = document.getElementById(this.element[index]);
- if (element)element.focus();
- e.preventDefault();
- return false;
- },
- selectAsnDetails(){
- this.isInit=false;
- this.info={};
- let url = '{{url('store/handInStorage/selectAsnDetails')}}';
- window.axios.post(url,{asnno:this.asnno})
- .then(res=>{
- if (res.data.success){
- this.asnDetails=res.data.data;
- this.$forceUpdate()
- return;
- }
- window.tempTip.setDuration(2000);
- window.tempTip.show(res.data.data);
- }).catch(err=>{
- window.tempTip.setDuration(2000);
- window.tempTip.show("网络错误:"+err);
- })
- },
- ensure(){
- this.errors={};//初始errors状态
- this.checkInfo();
- this.info.customerid=this.customerid;
- this.info.asnno=this.asnno;
- // if (this.info.trackNumber==''||this.info.trackNumber==null||this.info.trackNumber==undefined)this.info.trackNumber='';
- if (this.info.location==''||this.info.location==null||this.info.location==undefined)this.info.location='';
- if (Number(this.info.receivedqty)===Number(this.info.expectedqty)){
- window.tempTip.setDuration(2000); window.tempTip.show("收货已完成");
- }
- let url = '{{url('store/handInStorage/fluxHandIn')}}';
- if (JSON.stringify(this.errors)==='{}') window.axios.post(url,{info:this.info})
- .then(res=>{
- if (res.data.success){
- window.tempTip.setDuration(2000);
- window.tempTip.showSuccess(res.data.data);
- this.info={};
- this.$forceUpdate();
- document.getElementById("sku").focus();
- return;
- }
- window.tempTip.setDuration(2000);
- window.tempTip.show(res.data.data);
- }).catch(err=>{
- window.tempTip.setDuration(2000);
- window.tempTip.show("网络错误:"+err);
- })
- },
- cancel(){
- setTimeout(function () {
- window.location.reload();
- document.getElementById("sku").focus();
- },100);
- },
- },
- });
- </script>
- @stop
|