zhang_li
3 months ago
18 changed files with 620 additions and 120 deletions
@ -0,0 +1,27 @@ |
|||||
|
<template> |
||||
|
<view class="card_view"> |
||||
|
<text class="card_level">{{ title }}</text> |
||||
|
<text class="card_big_content" style="font-size: 40rpx">{{ getPriorityName1() }}</text> |
||||
|
</view> |
||||
|
</template> |
||||
|
|
||||
|
<script setup lang="ts"> |
||||
|
import { getPriorityName } from '@/common/directory.js' |
||||
|
|
||||
|
const props = defineProps({ |
||||
|
priority: { |
||||
|
type: String, |
||||
|
default: '2' |
||||
|
}, |
||||
|
title: { |
||||
|
type: String, |
||||
|
default: '优先级' |
||||
|
} |
||||
|
}) |
||||
|
|
||||
|
const getPriorityName1 = () => { |
||||
|
return getPriorityName(props.priority) |
||||
|
} |
||||
|
</script> |
||||
|
|
||||
|
<style></style> |
@ -0,0 +1,272 @@ |
|||||
|
<template> |
||||
|
<view> |
||||
|
<uni-popup ref="popup" :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="uni-flex uni-row" style="align-items: center; background-color: #fff; margin-left: 20rpx; margin-right: 20rpx; border-radius: 8rpx; height: 30px"> |
||||
|
<view class="uni-center" style="width: 25%; font-size: 35rpx"> 来源库位 </view> |
||||
|
<!-- style="width: 75%;padding: 8rpx" --> |
||||
|
<view class=""> |
||||
|
<!-- <input v-model="fromLocationCode" placeholder="请扫描来源库位" :focus="locationOnFocus" |
||||
|
placeholder-style="font-size:12px" style="padding: 5px;" @confirm="scanLocation" /> --> |
||||
|
|
||||
|
<view v-if="allowModifyLocation"> |
||||
|
<uni-combox :candidates="fromLocationList" v-model="fromLocationCode" placeholder="请扫描来源库位" @confirm="handleConfirm" style="height: 30rpx; border: 1px solid #fff"></uni-combox> |
||||
|
</view> |
||||
|
<view v-else> |
||||
|
<text style="padding: 5px; font-size: 40rpx"> |
||||
|
{{ fromLocationCode }} |
||||
|
</text> |
||||
|
</view> |
||||
|
</view> |
||||
|
</view> |
||||
|
<view class=""> |
||||
|
<view class=""> |
||||
|
<win-com-scan ref="comscan" :placeholder="title" @getResult="getScanResult" :isShowHistory="isShowHistory" :clearResult="true" :headerType="headerType"></win-com-scan> |
||||
|
</view> |
||||
|
</view> |
||||
|
</view> |
||||
|
</uni-popup> |
||||
|
<balance-select ref="balanceSelect" @onSelectItem="selectBalanceItem"></balance-select> |
||||
|
<!-- 模拟扫描功能 --> |
||||
|
</view> |
||||
|
<comMessage ref="comMessage"></comMessage> |
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
import winComScan from '@/mycomponents/scan/winComScan.vue' |
||||
|
import balanceSelect from '@/mycomponents/balance/balanceSelect.vue' |
||||
|
import { getBalanceByManagementPrecisionByPacking } from '@/common/balance.js' |
||||
|
|
||||
|
import { getBalanceByParams, getBasicItemByCode } from '@/api/request2.js' |
||||
|
|
||||
|
import { getListLocationAreaTypeDesc, checkDirectoryItemExist, getDirectoryItemArray, getLocationAreaTypeName, getInventoryStatusDesc, getListItemTypeDesc, getItemTypeInfo } from '@/common/directory.js' |
||||
|
|
||||
|
export default { |
||||
|
name: 'winScanPack', |
||||
|
emits: ['getBalance', 'onCloseScanPopup'], |
||||
|
components: { |
||||
|
winComScan, |
||||
|
balanceSelect |
||||
|
}, |
||||
|
props: { |
||||
|
title: { |
||||
|
type: String, |
||||
|
default: '箱标签' |
||||
|
}, |
||||
|
isShowHistory: { |
||||
|
type: Boolean, |
||||
|
default: false |
||||
|
}, |
||||
|
headerType: { |
||||
|
type: String, |
||||
|
default: 'HPQ,HMQ' |
||||
|
}, |
||||
|
balanceFromInventoryStatuses: { |
||||
|
// 是否传fromInventoryStatuses |
||||
|
type: Boolean, |
||||
|
default: true |
||||
|
}, |
||||
|
bussinessCode: { |
||||
|
type: String, |
||||
|
default: '' |
||||
|
}, |
||||
|
// 是否允许修改库位 |
||||
|
allowModifyLocation: { |
||||
|
type: Boolean, |
||||
|
default: true |
||||
|
} |
||||
|
}, |
||||
|
data() { |
||||
|
return { |
||||
|
scanResult: {}, |
||||
|
show: false, |
||||
|
scanList: [], |
||||
|
expand: false, |
||||
|
showScanResult: {}, |
||||
|
expendIcon: 'arrow-down', |
||||
|
fromLocationCode: '', |
||||
|
fromLocation: '', |
||||
|
fromLocationList: [], |
||||
|
fromLocationAreaTypeList: [], |
||||
|
locationOnFocus: false, |
||||
|
businessType: {}, |
||||
|
inventoryStatus: [], |
||||
|
managementPrecision: '', |
||||
|
fromInventoryStatuses: [], |
||||
|
itemTypesList: [], |
||||
|
isCheck: false, |
||||
|
resultData: {} |
||||
|
} |
||||
|
}, |
||||
|
created() {}, |
||||
|
methods: { |
||||
|
openScanPopup(businessType) { |
||||
|
this.businessType = businessType |
||||
|
this.fromInventoryStatuses = getDirectoryItemArray(businessType.outInventoryStatuses) |
||||
|
this.fromLocationAreaTypeList = getDirectoryItemArray(businessType.outAreaTypes) |
||||
|
this.itemTypesList = getDirectoryItemArray(businessType.itemTypes) |
||||
|
this.$refs.popup.open('bottom') |
||||
|
}, |
||||
|
|
||||
|
openScanPopupForJob(fromLocationCode, fromLocationList, jobContent) { |
||||
|
this.fromLocationCode = fromLocationCode |
||||
|
this.fromLocationList = fromLocationList |
||||
|
if (fromLocationCode != '') { |
||||
|
this.packGetFocus() |
||||
|
} else if (this.fromLocationList.length == 0) { |
||||
|
this.locationGetFocus() |
||||
|
} else { |
||||
|
this.fromLocationCode = this.fromLocationList[0] |
||||
|
} |
||||
|
|
||||
|
setTimeout((res) => { |
||||
|
this.$refs.popup.open('bottom') |
||||
|
}, 500) |
||||
|
this.fromInventoryStatuses = getDirectoryItemArray(jobContent.outInventoryStatuses) |
||||
|
this.inventoryStatus = getDirectoryItemArray(jobContent.outInventoryStatuses) // 出库库存状态; //出库库存状态 |
||||
|
this.fromLocationAreaTypeList = getDirectoryItemArray(jobContent.fromAreaTypes) // 出库库存状态 |
||||
|
}, |
||||
|
|
||||
|
handleConfirm() { |
||||
|
this.$emit('confirm', this.fromLocationCode) |
||||
|
}, |
||||
|
|
||||
|
getScanResult(result) { |
||||
|
if (this.fromLocationCode == '') { |
||||
|
this.showErrorMessage('请选择来源库位', (res) => {}) |
||||
|
return |
||||
|
} |
||||
|
|
||||
|
this.resultData = result |
||||
|
if (!result.package) { |
||||
|
this.showErrorMessage(`${result.label.code}包装信息为空`) |
||||
|
return |
||||
|
} |
||||
|
// 查询物料信息,然后查询库存 |
||||
|
this.getItemCodeType(result.package.itemCode, (callBack) => { |
||||
|
this.queryBalance(this.resultData) |
||||
|
}) |
||||
|
}, |
||||
|
|
||||
|
queryBalance(result) { |
||||
|
const params = { |
||||
|
locationCode: this.fromLocationCode, |
||||
|
itemCode: result.package.itemCode, |
||||
|
batch: result.label.batch, |
||||
|
packingNumber: result.label.packingNumber, |
||||
|
parentPackingNumber: result.package.parentNumber, |
||||
|
inventoryStatus: this.fromInventoryStatuses, |
||||
|
areaType: this.fromLocationAreaTypeList, |
||||
|
bussinessCode: this.bussinessCode |
||||
|
} |
||||
|
getBalanceByParams(params) |
||||
|
.then((res) => { |
||||
|
uni.hideLoading() |
||||
|
if (res.data.length == 0) { |
||||
|
const status = getInventoryStatusDesc(params.inventoryStatus) |
||||
|
const areaType = getListLocationAreaTypeDesc(params.areaType) |
||||
|
const hint = `按物料号 [${params.itemCode}] <br>` + `包装号 [${params.packingNumber}] <br>` + `批次 [${params.batch}] <br>` + `状态 [${status}] <br>` + `库区 [${areaType}] <br>` + '未查找到库存余额' |
||||
|
this.showErrorMessage(hint) |
||||
|
} else if (res.data.length == 1) { |
||||
|
result.balance = res.data[0] |
||||
|
if (result.label.packingNumber != result.balance.packingNumber) { |
||||
|
result.balance.lableQty = result.label.qty |
||||
|
} |
||||
|
this.$emit('getBalance', result) |
||||
|
// this.closeScanPopup() |
||||
|
} else { |
||||
|
// 多条记录 |
||||
|
this.$refs.balanceSelect.openPopup(res.data) |
||||
|
} |
||||
|
}) |
||||
|
.catch((error) => { |
||||
|
uni.hideLoading() |
||||
|
this.showErrorMessage(error) |
||||
|
}) |
||||
|
}, |
||||
|
getItemCodeType(itemCode, callBack) { |
||||
|
uni.showLoading({ |
||||
|
title: '加载中', |
||||
|
mask: true |
||||
|
}) |
||||
|
getBasicItemByCode(itemCode) |
||||
|
.then((res) => { |
||||
|
if (res.data != null && res.data.list.length > 0) { |
||||
|
const result = res.data.list[0] |
||||
|
const { status } = result |
||||
|
const { type } = result |
||||
|
if (status == 'ENABLE') { |
||||
|
if (checkDirectoryItemExist(this.itemTypesList, type)) { |
||||
|
callBack() |
||||
|
} else { |
||||
|
const hint = getListItemTypeDesc(this.itemTypesList) |
||||
|
uni.hideLoading() |
||||
|
this.showErrorMessage(`扫描物料[${itemCode}]是[${getItemTypeInfo(type).label}],需要的物料类型是[${hint}]`) |
||||
|
} |
||||
|
} else { |
||||
|
uni.hideLoading() |
||||
|
this.showErrorMessage(`物料【${itemCode}】不可用`) |
||||
|
} |
||||
|
} else { |
||||
|
uni.hideLoading() |
||||
|
this.showErrorMessage(`未查找到物料【${itemCode}】`) |
||||
|
} |
||||
|
}) |
||||
|
.catch((error) => { |
||||
|
uni.hideLoading() |
||||
|
this.showErrorMessage(error) |
||||
|
}) |
||||
|
}, |
||||
|
showErrorMessage(message) { |
||||
|
this.$refs.comMessage.showErrorMessage(message, (res) => { |
||||
|
if (res) { |
||||
|
if (this.$refs.comscan) { |
||||
|
this.$refs.comscan.getfocus() |
||||
|
} |
||||
|
} |
||||
|
}) |
||||
|
}, |
||||
|
selectBalanceItem(item) { |
||||
|
this.resultData.balance = item |
||||
|
this.$emit('getBalance', this.resultData) |
||||
|
// this.closeScanPopup() |
||||
|
}, |
||||
|
closeScanPopup() { |
||||
|
this.$refs.popup.close() |
||||
|
this.$emit('onCloseScanPopup') |
||||
|
}, |
||||
|
getfocus() { |
||||
|
if (this.$refs.comscan) { |
||||
|
this.$refs.comscan.getfocus() |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
packGetFocus() { |
||||
|
if (this.$refs.comscan) { |
||||
|
this.$refs.comscan.getfocus() |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
packLoseFocus() { |
||||
|
if (this.$refs.comscan) { |
||||
|
this.$refs.comscan.losefocus() |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
</script> |
||||
|
|
||||
|
<style lang="scss"> |
||||
|
.scroll-view { |
||||
|
overflow-y: scroll; |
||||
|
height: auto; |
||||
|
max-height: 300rpx; |
||||
|
} |
||||
|
</style> |
@ -0,0 +1,140 @@ |
|||||
|
<template> |
||||
|
<view> |
||||
|
<u-popup v-model="show" mode="bottom" :mask-close-able="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="uni-flex uni-row" |
||||
|
style="align-items: center; background-color: #fff; margin-left: 20rpx; margin-right: 20rpx; border-radius: 8rpx"> |
||||
|
<view class="uni-center" style="width: 25%; font-size: 32rpx; font-weight: bold"> 优先级 </view> |
||||
|
<view style="width: 100%"> |
||||
|
<uni-data-select style="padding: 20rpx;" v-model="priorityCode" :localdata="priorityList" @change="change" |
||||
|
:clear="false"></uni-data-select> |
||||
|
</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> |
||||
|
</-popup> |
||||
|
<com-message ref="comMessageRef" /> |
||||
|
</view> |
||||
|
</template> |
||||
|
|
||||
|
<script setup lang="ts"> |
||||
|
import { ref, getCurrentInstance, nextTick } from 'vue' |
||||
|
import { onLoad, onNavigationBarButtonTap, onPullDownRefresh } from '@dcloudio/uni-app' |
||||
|
import { getLabelInfo } from '@/common/label.js' |
||||
|
import winComScan from '@/mycomponents/scan/winComScan.vue' |
||||
|
|
||||
|
const props = defineProps({ |
||||
|
title: { |
||||
|
type: String, |
||||
|
default: '箱标签' |
||||
|
}, |
||||
|
isShowHistory: { |
||||
|
type: Boolean, |
||||
|
default: true |
||||
|
}, |
||||
|
headerType: { |
||||
|
type: String, |
||||
|
default: 'HPQ' |
||||
|
} |
||||
|
}) |
||||
|
const show = ref(false) |
||||
|
const priorityList = ref([ |
||||
|
{ |
||||
|
value: 0, |
||||
|
text: '低' |
||||
|
}, |
||||
|
{ |
||||
|
value: 1, |
||||
|
text: '中' |
||||
|
}, |
||||
|
{ |
||||
|
value: 2, |
||||
|
text: '高' |
||||
|
} |
||||
|
]) |
||||
|
const priorityCode = ref(1) |
||||
|
const comscan = ref() |
||||
|
const simulateScan = (scanMessage) => { |
||||
|
getLabelInfo(scanMessage, headerType.value, (callback) => { |
||||
|
if (callback.success) { |
||||
|
getScanResult(callback) |
||||
|
} else { |
||||
|
showMessage(callback.message) |
||||
|
} |
||||
|
}) |
||||
|
} |
||||
|
const openScanPopup = () => { |
||||
|
setTimeout((res) => { |
||||
|
show.value = true |
||||
|
}, 200) |
||||
|
} |
||||
|
const closeScanPopup = () => { |
||||
|
show.value = false |
||||
|
emit('close', '') |
||||
|
} |
||||
|
|
||||
|
|
||||
|
const scanClick = () => { |
||||
|
if (comscan.value) { |
||||
|
comscan.value.clickScanMsg() |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
|
||||
|
const cancelClick = () => { |
||||
|
if (comscan.value) { |
||||
|
comscan.value.clearScanValue() |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
|
||||
|
const getScanResult = (result) => { |
||||
|
if (result.success) { |
||||
|
result.priorityCode = priorityCode.value |
||||
|
emit('getResult', result) |
||||
|
} else { |
||||
|
showMessage(result.message) |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
|
||||
|
const getfocus = () => { |
||||
|
if (comscan.value != undefined) { |
||||
|
comscan.value.getfocus() |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
|
||||
|
const losefocus = () => { |
||||
|
if (comscan.value != undefined) { |
||||
|
comscan.value.losefocus() |
||||
|
} |
||||
|
} |
||||
|
const showMessage = (message) => { |
||||
|
comMessageRef.value.showMessage(message) |
||||
|
} |
||||
|
const change = (e) => { |
||||
|
console.log(e) |
||||
|
} |
||||
|
</script> |
||||
|
|
||||
|
<style lang="scss"> |
||||
|
.scroll-view { |
||||
|
overflow-y: scroll; |
||||
|
height: auto; |
||||
|
max-height: 300rpx; |
||||
|
} |
||||
|
</style> |
Loading…
Reference in new issue