王志国
1 month ago
21 changed files with 608 additions and 176 deletions
@ -0,0 +1,274 @@ |
|||||
|
<template> |
||||
|
<view> |
||||
|
<uni-popup ref="popup" @change="change" :mask-click="false"> |
||||
|
<view class="popup_box"> |
||||
|
<view class="pop_title uni-flex space-between"> |
||||
|
<view class="" style="font-size: 35rpx;"> |
||||
|
扫描{{title}} |
||||
|
</view> |
||||
|
|
||||
|
<view class=""> |
||||
|
<image class="fr icons_scan_close" src="/static/icons/icons_scan_close.svg" |
||||
|
@click="closeScanPopup()"></image> |
||||
|
</view> |
||||
|
</view> |
||||
|
<view class=""> |
||||
|
<view class=""> |
||||
|
<win-com-scan ref="comscan" :placeholder="title" @getResult="getScanResult" |
||||
|
:headerType="headerType" :isShowHistory="isShowHistory" :clearResult="true"></win-com-scan> |
||||
|
</view> |
||||
|
</view> |
||||
|
</view> |
||||
|
</uni-popup> |
||||
|
<!-- 模拟扫描功能 --> |
||||
|
<win-com-scan v-show="false" ref="comscansimulate" @getResult="getScanResult" :headerType="headerType" |
||||
|
:isShowHistory="false" :clearResult="true"></win-com-scan> |
||||
|
<comMessage ref="comMessage" @afterClose="getfocus"></comMessage> |
||||
|
</view> |
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
import winComScan from '@/mycomponents/scan/winComScan.vue' |
||||
|
import { |
||||
|
getBalanceByFilter |
||||
|
} from '@/api/request2.js'; |
||||
|
|
||||
|
export default { |
||||
|
name: 'winScanParentPackage', |
||||
|
components: { |
||||
|
winComScan, |
||||
|
}, |
||||
|
props: { |
||||
|
title: { |
||||
|
type: String, |
||||
|
default: '箱标签' |
||||
|
}, |
||||
|
isShowHistory: { |
||||
|
type: Boolean, |
||||
|
default: true |
||||
|
}, |
||||
|
headerType: { |
||||
|
type: String, |
||||
|
default: 'HPQ,HMQ' |
||||
|
} |
||||
|
}, |
||||
|
data() { |
||||
|
return { |
||||
|
show: false, |
||||
|
businessType: null |
||||
|
} |
||||
|
}, |
||||
|
created() { |
||||
|
|
||||
|
}, |
||||
|
methods: { |
||||
|
simulateScan(item) { |
||||
|
this.$refs.comscansimulate.setItemCodeSimulate(item.copyContent) |
||||
|
this.$refs.comscansimulate.clickScanMsg(); |
||||
|
}, |
||||
|
openScanPopup() { |
||||
|
this.$refs.popup.open('bottom') |
||||
|
setTimeout(res => { |
||||
|
this.getfocus() |
||||
|
}, 500) |
||||
|
}, |
||||
|
|
||||
|
|
||||
|
openScanPopupByBusinessType(businessType) { |
||||
|
this.$refs.popup.open('bottom') |
||||
|
setTimeout(res => { |
||||
|
this.getfocus() |
||||
|
this.businessType = businessType; |
||||
|
}, 500) |
||||
|
}, |
||||
|
|
||||
|
|
||||
|
closeScanPopup() { |
||||
|
this.losefocus() |
||||
|
this.$refs.popup.close(); |
||||
|
this.$emit("close", ''); |
||||
|
}, |
||||
|
|
||||
|
scanClick() { |
||||
|
if (this.$refs.comscan) { |
||||
|
this.$refs.comscan.clickScanMsg(); |
||||
|
} |
||||
|
|
||||
|
}, |
||||
|
|
||||
|
cancelClick() { |
||||
|
if (this.$refs.comscan) { |
||||
|
this.$refs.comscan.clearScanValue(); |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
getScanResult(result) { |
||||
|
if (result.success) { |
||||
|
this.getBalance(result, res => { |
||||
|
result.balance = res; |
||||
|
this.$emit("getResult", result); |
||||
|
}) |
||||
|
} else { |
||||
|
this.showMessage(result.message) |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
getParams(label) { |
||||
|
let filters = [{ |
||||
|
column: "itemCode", |
||||
|
action: "==", |
||||
|
value: label.itemCode |
||||
|
}, { |
||||
|
column: "batch", |
||||
|
action: "==", |
||||
|
value: label.batch |
||||
|
}]; |
||||
|
if (this.businessType.outInventoryStatuses != null) { |
||||
|
filters.push({ |
||||
|
column: "inventoryStatus", |
||||
|
action: "in", |
||||
|
value: this.businessType.outInventoryStatuses |
||||
|
}) |
||||
|
} |
||||
|
if (this.businessType.outAreaTypes != null) { |
||||
|
filters.push({ |
||||
|
column: "areaType", |
||||
|
action: "in", |
||||
|
value: this.businessType.outAreaTypes |
||||
|
}) |
||||
|
} |
||||
|
if (this.businessType.outAreaCodes != null) { |
||||
|
filters.push({ |
||||
|
column: "areaCode", |
||||
|
action: "in", |
||||
|
value: this.businessType.outAreaCodes |
||||
|
}) |
||||
|
} |
||||
|
return filters; |
||||
|
}, |
||||
|
|
||||
|
getBalance(result, callback) { |
||||
|
let filters = []; |
||||
|
let packageInfo = result.package; |
||||
|
let comfilters = this.getParams(packageInfo); |
||||
|
let balance = { |
||||
|
parentBalance: {}, |
||||
|
childBalance: [] |
||||
|
}; |
||||
|
|
||||
|
let parentPackingNumber = packageInfo.parentNumber; |
||||
|
let childPackingNumber = packageInfo.number; |
||||
|
|
||||
|
//packageInfo.subList子包装数量大于0扫描的就是父包装 |
||||
|
//1.当扫描箱时,同时查询箱和托的库存 |
||||
|
if (parentPackingNumber) { |
||||
|
let packingNumber = parentPackingNumber + "," + childPackingNumber; |
||||
|
filters.push({ |
||||
|
column: "packingNumber", |
||||
|
action: "in", |
||||
|
value: packingNumber |
||||
|
}) |
||||
|
} else { |
||||
|
filters.push({ |
||||
|
column: "packingNumber", |
||||
|
action: "==", |
||||
|
value: childPackingNumber |
||||
|
}) |
||||
|
} |
||||
|
|
||||
|
filters = filters.concat(comfilters); |
||||
|
var params = { |
||||
|
filters: filters, |
||||
|
pageNo: 1, |
||||
|
pageSize: 100, |
||||
|
} |
||||
|
getBalanceByFilter(params).then(res => { |
||||
|
res.data.list.forEach(r => { |
||||
|
if (packageInfo.parentNumber) { |
||||
|
r.parentPackingNumber = parentPackingNumber |
||||
|
} else { |
||||
|
r.parentPackingNumber = childPackingNumber |
||||
|
} |
||||
|
}) |
||||
|
//如果扫描的是托标签,按托标签没查找到库存再按托标签下的子标签查询库存 |
||||
|
if (packageInfo.subList.length > 0) { |
||||
|
let packparams = ''; |
||||
|
packageInfo.subList.forEach(pack => { |
||||
|
packparams = packparams + pack.number + ',' |
||||
|
}) |
||||
|
packparams = packparams.trimEnd(','); |
||||
|
filters = []; |
||||
|
filters.push({ |
||||
|
column: "packingNumber", |
||||
|
action: "in", |
||||
|
value: packparams |
||||
|
}) |
||||
|
filters = filters.concat(comfilters); |
||||
|
params.filters = filters; |
||||
|
getBalanceByFilter(params).then(res1 => { |
||||
|
if (res1.data.list.length == 0) { |
||||
|
this.showErrorMessage('未查找到该包装的库存余额', res => { |
||||
|
this.packGetFocus(); |
||||
|
}) |
||||
|
} else { |
||||
|
res1.data.list.forEach(r => r.parentPackingNumber = childPackingNumber) |
||||
|
|
||||
|
balance.parentBalance = res.data.list.filter(r => r.packingNumber == |
||||
|
childPackingNumber) |
||||
|
balance.childBalance = res1.data.list; |
||||
|
|
||||
|
callback(balance); |
||||
|
} |
||||
|
}).catch(err => { |
||||
|
this.showErrorMessage(err.message); |
||||
|
}) |
||||
|
} else { |
||||
|
//扫描的是子包装 |
||||
|
//扫描的是父包装,(新加的) |
||||
|
balance.childBalance = res.data.list.filter(r => r.packingNumber == childPackingNumber) |
||||
|
balance.parentBalance = res.data.list.filter(r => r.packingNumber == parentPackingNumber) |
||||
|
callback(balance); |
||||
|
} |
||||
|
|
||||
|
}).catch(err => { |
||||
|
this.showErrorMessage(err.message); |
||||
|
}) |
||||
|
|
||||
|
}, |
||||
|
|
||||
|
getfocus() { |
||||
|
if (this.$refs.comscan) { |
||||
|
this.$refs.comscan.getfocus(); |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
losefocus() { |
||||
|
if (this.$refs.comscan) { |
||||
|
this.$refs.comscan.losefocus(); |
||||
|
} |
||||
|
}, |
||||
|
showMessage(message) { |
||||
|
this.$refs.comMessage.showMessage(message); |
||||
|
}, |
||||
|
change(e) { |
||||
|
this.show = e.show |
||||
|
}, |
||||
|
showErrorMessage(message) { |
||||
|
this.losefocus() |
||||
|
this.$refs.comMessage.showErrorMessage(message, res => { |
||||
|
if (res) { |
||||
|
this.getfocus(); |
||||
|
} |
||||
|
}); |
||||
|
}, |
||||
|
} |
||||
|
} |
||||
|
</script> |
||||
|
|
||||
|
<style lang="scss"> |
||||
|
.scroll-view { |
||||
|
overflow-y: scroll; |
||||
|
height: auto; |
||||
|
max-height: 300rpx; |
||||
|
} |
||||
|
</style> |
Loading…
Reference in new issue