|
|
@@ -38,65 +38,41 @@
|
|
|
<div class="btn btn-sm btn-outline-danger" v-if="!status.barcodeDisable" @click="status.barcodeDisable=true">扫描输入</div>
|
|
|
</div>
|
|
|
<input type="text" id="barcode" class="form-control"
|
|
|
- :placeholder="status.barcodeDisable ? '扫入条码' : '输入条码'" :disabled="status.barcodeDisable" v-model="inputting.barcode" :class="inputMode=='regular' ? '' : 'mt-4'" {{-- @focusin="focusOutDocument" @focusout="focusDocument" --}}>
|
|
|
+ :placeholder="status.barcodeDisable ? '扫入条码' : '输入条码'" :disabled="status.barcodeDisable" v-model="inputting.barcode" :class="inputMode=='regular' ? '' : 'mt-4'"
|
|
|
+ @focusin="focusOutDocument" @focusout="focusDocument">
|
|
|
|
|
|
<div v-if="inputMode=='regular'">
|
|
|
<div class="card-title">生产日期:</div>
|
|
|
<input type="date" class="form-control mb-2"
|
|
|
- v-model="inputting.produce_date"
|
|
|
- {{-- @focusin="focusOutDocument" @focusout="focusDocument" @keyup="oninputEnter"--}}>
|
|
|
+ v-model="inputting.produce_date" @focusin="focusOutDocument" @focusout="focusDocument" @keyup="oninputEnter">
|
|
|
|
|
|
<div class="card-title">失效日期:</div>
|
|
|
<input type="date" class="form-control mb-2"
|
|
|
- v-model="inputting.valid_date"
|
|
|
- {{-- @focusin="focusOutDocument" @focusout="focusDocument" @keyup="oninputEnter"--}}>
|
|
|
+ v-model="inputting.valid_date" @focusin="focusOutDocument" @focusout="focusDocument" @keyup="oninputEnter">
|
|
|
+
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="col-6">
|
|
|
<div class="card-title" id="amountLabel">手动输入数量:</div>
|
|
|
<div class="input-group mt-n2 mb-2">
|
|
|
<input type="number" id="amount" style='height: 40px;font-size: 1.6em;color:blue;font-weight: bolder;padding: 3px;text-align: center' class="form-control" placeholder=""
|
|
|
- :disabled="status.amountDisable" v-model="inputting.amount"{{-- @focusin="focusOutDocument" @focusout="focusDocument" @keyup="oninputEnter"--}}>
|
|
|
+ :disabled="status.amountDisable" v-model="inputting.amount" @focusin="focusOutDocument" @focusout="focusDocument" @keyup="oninputEnter">
|
|
|
</div>
|
|
|
|
|
|
<div class="card-title">格口号:</div>
|
|
|
<input type="number" id="bin_number" class="form-control mt-n2 mb-2" style='height: 80px;font-size: 5em;color:red;font-weight: bolder;padding: 3px;text-align: center'
|
|
|
- v-model="inputting.bin_number"{{-- :disabled="status.binDisable" @focusin="focusOutDocument" @focusout="focusDocument" @keyup="oninputEnter"--}}>
|
|
|
+ v-model="inputting.bin_number" :disabled="status.binDisable" @focusin="focusOutDocument" @focusout="focusDocument" @keyup="oninputEnter">
|
|
|
|
|
|
<div v-if="inputMode=='regular'">
|
|
|
<div class="card-title">批次号:</div>
|
|
|
<input type="text" class="form-control mb-2"
|
|
|
- v-model="inputting.batch_number"{{-- @focusin="focusOutDocument" @focusout="focusDocument" @keyup="oninputEnter"--}}>
|
|
|
+ v-model="inputting.batch_number" @focusin="focusOutDocument" @focusout="focusDocument" @keyup="oninputEnter">
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="col-12" v-if="status.commitButtonVisible && inputMode=='regular'" >
|
|
|
<button class="btn btn-success btn form-control" @click="commitGoods">确定</button>
|
|
|
</div>
|
|
|
</div>
|
|
|
- <p class="card-text text-muted mt-3 mb-n3 text-center">已完成:</p>
|
|
|
- <hr>
|
|
|
- <table class="table table-sm table-striped" {{--v-if="goodses.length>0"--}}>
|
|
|
- <tr>
|
|
|
- <th>隔口号</th>
|
|
|
- <th>数量</th>
|
|
|
- <th>条码</th>
|
|
|
- <th>生产日期</th>
|
|
|
- <th>失效日期</th>
|
|
|
- <th>批次号</th>
|
|
|
- <th>操作</th>
|
|
|
- </tr>
|
|
|
- {{--<tr v-for="goods in goodses">
|
|
|
- <td>@{{ goods.bin_number }}</td>
|
|
|
- <td>@{{ goods.amount }}</td>
|
|
|
- <td>@{{ goods.barcode }}</td>
|
|
|
- <td>@{{ goods.produce_date }}</td>
|
|
|
- <td>@{{ goods.valid_date }}</td>
|
|
|
- <td>@{{ goods.batch_number }}</td>
|
|
|
- <td><button class="btn btn-outline-danger btn-sm" @click="removeGoods($event,goods.barcode)">删</button></td>
|
|
|
- </tr>--}}
|
|
|
- </table>
|
|
|
- <hr>
|
|
|
- <span class="btn btn-outline-success btn form-control" style="cursor: pointer">确定生成该批盘收</span>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="ml-2 mt-2">
|
|
|
@@ -115,7 +91,6 @@
|
|
|
<tr id="header"></tr>
|
|
|
<tr v-for="(storeCheckingReceiveItem,i) in storeCheckingReceiveItems">
|
|
|
<td>@{{ i+1 }}</td>
|
|
|
- <td>@{{ storeCheckingReceiveItem.id }}</td>
|
|
|
<td>@{{ storeCheckingReceiveItem.bin_number }}</td>
|
|
|
<td>@{{ storeCheckingReceiveItem.commodity_name }}</td>
|
|
|
<td>
|
|
|
@@ -163,6 +138,7 @@
|
|
|
commitButtonVisible:false,
|
|
|
scanEndInputted:false,
|
|
|
amountDisable : false,
|
|
|
+ binDisable : false,
|
|
|
},
|
|
|
focusing : 'document',
|
|
|
inputting:{
|
|
|
@@ -173,14 +149,13 @@
|
|
|
produce_date : '',
|
|
|
valid_date : '',
|
|
|
},
|
|
|
- goodses : [],
|
|
|
+ lastScannedBarcode : '',
|
|
|
},
|
|
|
mounted(){
|
|
|
$('#container').removeClass('d-none');
|
|
|
$(".tooltipTarget").tooltip({'trigger':'hover'});
|
|
|
let column = [
|
|
|
{name:'index',value: '序号', neglect: true},
|
|
|
- {name:'id',value: 'ID', neglect: true},
|
|
|
{name:'bin_number',value: '格口号'},
|
|
|
{name:'commodity_name',value: '商品名'},
|
|
|
{name:'commodity_barcode',value: '商品条码'},
|
|
|
@@ -206,7 +181,7 @@
|
|
|
methods:{
|
|
|
switchMenu(menuName){
|
|
|
this.inputMode = menuName;
|
|
|
- this.inputting.barcode='';
|
|
|
+ this.cleanInputs();
|
|
|
if (menuName === 'regular') {
|
|
|
this.status.amountDisable = false;
|
|
|
$('#amountLabel').text('输入数量:');
|
|
|
@@ -233,11 +208,10 @@
|
|
|
return;
|
|
|
}
|
|
|
_this.status.scanEndInputted = true;
|
|
|
- _this.showCommitButton();
|
|
|
- _this.autoFillBin();
|
|
|
switch(_this.inputMode){
|
|
|
+ case 'regular' : _this.commitGoodsOnRegularMode();break;
|
|
|
case 'increasing': _this.commitGoodsOnIncreasingMode();break;
|
|
|
- case 'multiIncreasing': _this.commitGoodsOnMultiIncreasingMode();break;
|
|
|
+ case 'multiIncreasing': _this.commitGoodsOnIncreasingMode(false);break;
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
@@ -255,14 +229,30 @@
|
|
|
if(!this.inputting.barcode){window.tempTip.show('请扫入条码');return;}
|
|
|
else if(!this.inputting.amount){window.tempTip.show('请输入数量');return;}
|
|
|
else if(!this.inputting.bin_number){window.tempTip.show('请输入隔口号');return;}
|
|
|
- this.recordOrPlusGoods();
|
|
|
- window.tempTip.setDuration(1500);
|
|
|
- window.tempTip.showSuccess('成功提交:' + data.inputting.barcode);
|
|
|
- this.cleanInputs();
|
|
|
- this.audioDing();
|
|
|
+ axios.post('{{url('store/checkingReceive/insertItem')}}',{mission_id : this.storeCheckingReceive.id,goods : this.inputting})
|
|
|
+ .then(res=>{
|
|
|
+ if (res.data.success) {
|
|
|
+ this.lastScannedBarcode = this.inputting.barcode;
|
|
|
+ if (this.inputMode === 'regular')this.cleanInputs();
|
|
|
+ if (res.data.type === 'create'){
|
|
|
+ console.log(res.data.data);
|
|
|
+ this.storeCheckingReceiveItems.unshift(res.data.data);
|
|
|
+ window.tempTip.setDuration(2000);
|
|
|
+ window.tempTip.showSuccess('成功提交:' + this.inputting.barcode);
|
|
|
+ }else{
|
|
|
+
|
|
|
+ }
|
|
|
+ this.audioDing();
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ window.tempTip.setDuration(3000);
|
|
|
+ window.tempTip.show(res.data.data);
|
|
|
+ }).catch(err=>{
|
|
|
+ window.tempTip.setDuration(3000);
|
|
|
+ window.tempTip.show("网络错误:"+err);
|
|
|
+ });
|
|
|
},
|
|
|
cleanInputs: function () {
|
|
|
- this.changeToScanInputBarcode();
|
|
|
this.inputting.barcode='';
|
|
|
this.inputting.amount='';
|
|
|
this.inputting.bin_number='';
|
|
|
@@ -273,115 +263,81 @@
|
|
|
this.status.binDisable=false;
|
|
|
},
|
|
|
autoFillBin: function () {
|
|
|
- let data = this;
|
|
|
- let isNotRepeatingBarcode=this.goodses.every(function(goods){
|
|
|
- if(goods.barcode===data.inputting.barcode){
|
|
|
- data.inputting.bin_number=goods.bin_number;
|
|
|
- data.status.binDisable=true;
|
|
|
- return false;
|
|
|
- }
|
|
|
- return true;
|
|
|
+ let isNotRepeatingBarcode=this.storeCheckingReceiveItems.every(item=>{
|
|
|
+ if (item.commodity_barcodes.length > 0){
|
|
|
+ return item.commodity_barcodes.every(barcode=> {
|
|
|
+ if (barcode.code === this.inputting.barcode){
|
|
|
+ this.inputting.bin_number=item.bin_number;
|
|
|
+ this.status.binDisable=true;
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ return true;
|
|
|
+ });
|
|
|
+ }else return true;
|
|
|
});
|
|
|
- if(isNotRepeatingBarcode){
|
|
|
- data.status.binDisable=false;
|
|
|
- }
|
|
|
+ if(isNotRepeatingBarcode) this.status.binDisable=false;
|
|
|
},
|
|
|
- commitGoodsOnIncreasingMode: function () {
|
|
|
- let data = this;
|
|
|
-
|
|
|
- function doIt() {
|
|
|
- let repeatedBarcode = data.repeatedIncreasingBarcodeFromSaved();
|
|
|
-
|
|
|
- function increase() {
|
|
|
- data.inputting.bin_number = repeatedBarcode.bin_number;
|
|
|
- repeatedBarcode.amount++;
|
|
|
- data.inputting.amount = repeatedBarcode.amount;
|
|
|
- window.tempTip.setDuration(500);
|
|
|
- window.tempTip.showSuccess(repeatedBarcode.amount);
|
|
|
- data.focusDocument();
|
|
|
- data.audioDing();
|
|
|
- }
|
|
|
-
|
|
|
- if (!repeatedBarcode) {
|
|
|
- data.focusOutDocument();
|
|
|
- data.alertVibrate();
|
|
|
- window.tempTip.setInputType('number');
|
|
|
- window.tempTip.inputVal('该商品第一件递增请输入隔口号:', function (bin_number) {
|
|
|
- if (bin_number === '') {
|
|
|
- window.tempTip.setDuration(1500);
|
|
|
- window.tempTip.show('未输入隔口号,请重新扫描');
|
|
|
- data.alertVibrate();
|
|
|
- data.focusDocument();
|
|
|
- return
|
|
|
- }
|
|
|
- data.inputting.bin_number = bin_number;
|
|
|
- data.inputting.amount = 1;
|
|
|
- data.goodses.unshift(JSON.parse(JSON.stringify(data.inputting)));
|
|
|
- data.status.binDisable = true;
|
|
|
- window.tempTip.setDuration(500);
|
|
|
- window.tempTip.showSuccess('保存成功');
|
|
|
- data.focusDocument();
|
|
|
- data.audioDing();
|
|
|
- })
|
|
|
- } else {
|
|
|
- increase();
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- if (data.lastScannedBarcode !== data.inputting.barcode && data.lastScannedBarcode) {
|
|
|
- data.audioWarning_otherBarcode();
|
|
|
- data.focusOutDocument();
|
|
|
- window.tempTip.confirm('扫到其它条码,是否切换至新条码并记录?', doIt, function () {
|
|
|
- data.inputting.barcode = data.lastScannedBarcode;
|
|
|
- data.focusDocument();
|
|
|
- })
|
|
|
- } else {
|
|
|
- doIt()
|
|
|
- }
|
|
|
+ commitGoodsOnRegularMode(){
|
|
|
+ this.showCommitButton();
|
|
|
},
|
|
|
- commitGoodsOnMultiIncreasingMode: function () {
|
|
|
- let data = this;
|
|
|
- let repeatedBarcode=this.repeatedIncreasingBarcodeFromSaved();
|
|
|
- function increase(){
|
|
|
- data.inputting.bin_number=repeatedBarcode.bin_number;
|
|
|
- repeatedBarcode.amount++;
|
|
|
- data.inputting.amount=repeatedBarcode.amount;
|
|
|
- window.tempTip.setDuration(500);
|
|
|
- window.tempTip.showSuccess(repeatedBarcode.amount);
|
|
|
- data.focusDocument();
|
|
|
- data.audioDing();
|
|
|
- }
|
|
|
- if(!repeatedBarcode){
|
|
|
- data.focusOutDocument();
|
|
|
- data.alertVibrate();
|
|
|
+ commitGoodsOnIncreasingMode: function (signIncreasing = true) {
|
|
|
+ let item = this.getItem();
|
|
|
+ let _this = this;
|
|
|
+ if (!item){
|
|
|
+ _this.focusOutDocument();
|
|
|
window.tempTip.setInputType('number');
|
|
|
- window.tempTip.inputVal('该商品第一件递增请输入隔口号:',function(bin_number){
|
|
|
- if(bin_number===''){
|
|
|
+ window.tempTip.inputVal('该商品第一件递增请输入隔口号:', function (bin_number) {
|
|
|
+ if (bin_number === '') {
|
|
|
window.tempTip.setDuration(1500);
|
|
|
window.tempTip.show('未输入隔口号,请重新扫描');
|
|
|
- data.alertVibrate();
|
|
|
- data.focusDocument();return}
|
|
|
- data.inputting.bin_number=bin_number;
|
|
|
- data.inputting.amount=1;
|
|
|
- data.goodses.unshift(JSON.parse(JSON.stringify(data.inputting)));
|
|
|
- data.status.binDisable=true;
|
|
|
- window.tempTip.setDuration(500);
|
|
|
- window.tempTip.showSuccess('保存成功');
|
|
|
- data.focusDocument();
|
|
|
- data.audioDing();
|
|
|
- })
|
|
|
- }else{
|
|
|
- increase();
|
|
|
+ _this.alertVibrate();
|
|
|
+ _this.focusDocument();
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ _this.inputting.bin_number = bin_number;
|
|
|
+ _this.inputting.amount = 1;
|
|
|
+ _this.commitGoods();
|
|
|
+ _this.focusDocument();
|
|
|
+ });
|
|
|
+ return;
|
|
|
}
|
|
|
+ _this.status.binDisable=true;
|
|
|
+ _this.inputting.amount = item.amount;
|
|
|
+ _this.inputting.bin_number = item.bin_number;
|
|
|
+ if (signIncreasing && _this.lastScannedBarcode && _this.lastScannedBarcode !== _this.inputting.barcode) {
|
|
|
+ this.audioWarning_otherBarcode();
|
|
|
+ this.focusOutDocument();
|
|
|
+ window.tempTip.confirm('扫到其它条码,是否切换至新条码并记录?', function (){
|
|
|
+ _this.commitGoods();
|
|
|
+ _this.focusDocument();
|
|
|
+ },function () {
|
|
|
+ _this.focusDocument();
|
|
|
+ });
|
|
|
+ }else this.commitGoods();
|
|
|
+ },
|
|
|
+ getItem: function () {
|
|
|
+ let repeatedGoods=null;
|
|
|
+ this.storeCheckingReceiveItems.every(item=>{
|
|
|
+ if (item.commodity_barcodes.length > 0){
|
|
|
+ return item.commodity_barcodes.every(barcode=> {
|
|
|
+ if (barcode.code === this.inputting.barcode){
|
|
|
+ repeatedGoods = item;
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ return true;
|
|
|
+ });
|
|
|
+ }else return true;
|
|
|
+ });
|
|
|
+ return repeatedGoods;
|
|
|
},
|
|
|
oninputEnter:function(e){
|
|
|
if (e.key === 'Enter') {
|
|
|
this.focusDocument();
|
|
|
+ this.showCommitButton();
|
|
|
}
|
|
|
},
|
|
|
focusDocument: function () {
|
|
|
this.focusing = 'document';
|
|
|
- this.showCommitButton();
|
|
|
},
|
|
|
focusOutDocument: function () {
|
|
|
this.focusing = '';
|
|
|
@@ -410,23 +366,21 @@
|
|
|
}
|
|
|
startVibrate(500);
|
|
|
},
|
|
|
- recordOrPlusGoods: function () {
|
|
|
- if(this.inputMode==='regular'){
|
|
|
- this.addGoods();
|
|
|
- return;
|
|
|
- }
|
|
|
- let isNotRepeating=this.goodses.every(goods => {
|
|
|
- if(goods.barcode===this.inputting.barcode){
|
|
|
- goods.amount=parseInt(goods.amount)+parseInt(this.inputting.amount);
|
|
|
- return false;
|
|
|
+ alertVibrate: function () {
|
|
|
+ function startVibrate(duration) {
|
|
|
+ if (navigator.vibrate) {
|
|
|
+ navigator.vibrate(duration);
|
|
|
+ } else if (navigator.webkitVibrate) {
|
|
|
+ navigator.webkitVibrate(duration);
|
|
|
}
|
|
|
- return true;
|
|
|
- });
|
|
|
- if(isNotRepeating)this.addGoods();
|
|
|
+ }
|
|
|
+ let vibrateInterval = setInterval(function() {
|
|
|
+ startVibrate(150);
|
|
|
+ }, 50);
|
|
|
+ setTimeout(function() {
|
|
|
+ clearInterval(vibrateInterval)
|
|
|
+ }, 2000);
|
|
|
},
|
|
|
- addGoods(){
|
|
|
- this.goodses.unshift(JSON.parse(JSON.stringify(this.inputting)));
|
|
|
- }
|
|
|
},
|
|
|
});
|
|
|
</script>
|