|
@ -1,6 +1,6 @@ |
|
|
<template> |
|
|
<template> |
|
|
<view> |
|
|
<view> |
|
|
<uni-popup ref="popup" :mask-click="false"> |
|
|
<u-popup v-model="show" mode="bottom"> |
|
|
<view class="popup_box"> |
|
|
<view class="popup_box"> |
|
|
<view class="pop_title uni-flex space-between"> |
|
|
<view class="pop_title uni-flex space-between"> |
|
|
<view class="" style="font-size: 35rpx"> 扫描{{ title }} </view> |
|
|
<view class="" style="font-size: 35rpx"> 扫描{{ title }} </view> |
|
@ -28,18 +28,18 @@ |
|
|
</view> |
|
|
</view> |
|
|
<view class=""> |
|
|
<view class=""> |
|
|
<view class=""> |
|
|
<view class=""> |
|
|
<win-com-scan ref="comscan" :placeholder="title" @getResult="getScanResult" :isShowHistory="isShowHistory" :clearResult="true" :headerType="headerType"></win-com-scan> |
|
|
<win-com-scan ref="comscanRef" :placeholder="title" @getResult="getScanResult" :isShowHistory="isShowHistory" :clearResult="true" :headerType="headerType"></win-com-scan> |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
|
</uni-popup> |
|
|
</u-popup> |
|
|
<balance-select ref="balanceSelect" @onSelectItem="selectBalanceItem"></balance-select> |
|
|
<balance-select ref="balanceSelect" @onSelectItem="selectBalanceItem"></balance-select> |
|
|
<!-- 模拟扫描功能 --> |
|
|
<!-- 模拟扫描功能 --> |
|
|
</view> |
|
|
</view> |
|
|
<comMessage ref="comMessage"></comMessage> |
|
|
<comMessage ref="comMessageRef"></comMessage> |
|
|
</template> |
|
|
</template> |
|
|
|
|
|
|
|
|
<script> |
|
|
<script setup> |
|
|
import winComScan from '@/mycomponents/scan/winComScan.vue' |
|
|
import winComScan from '@/mycomponents/scan/winComScan.vue' |
|
|
import balanceSelect from '@/mycomponents/balance/balanceSelect.vue' |
|
|
import balanceSelect from '@/mycomponents/balance/balanceSelect.vue' |
|
|
import { getBalanceByManagementPrecisionByPacking } from '@/common/balance.js' |
|
|
import { getBalanceByManagementPrecisionByPacking } from '@/common/balance.js' |
|
@ -48,14 +48,11 @@ import { getBalanceByParams, getBasicItemByCode } from '@/api/request2.js' |
|
|
|
|
|
|
|
|
import { getListLocationAreaTypeDesc, checkDirectoryItemExist, getDirectoryItemArray, getLocationAreaTypeName, getInventoryStatusDesc, getListItemTypeDesc, getItemTypeInfo } from '@/common/directory.js' |
|
|
import { getListLocationAreaTypeDesc, checkDirectoryItemExist, getDirectoryItemArray, getLocationAreaTypeName, getInventoryStatusDesc, getListItemTypeDesc, getItemTypeInfo } from '@/common/directory.js' |
|
|
import {getLabelInfo} from '@/common/label.js'; |
|
|
import {getLabelInfo} from '@/common/label.js'; |
|
|
export default { |
|
|
|
|
|
name: 'winScanPack', |
|
|
|
|
|
emits: ['getBalance', 'onCloseScanPopup'], |
|
|
import { ref, onMounted, watch } from 'vue'; |
|
|
components: { |
|
|
|
|
|
winComScan, |
|
|
const props = defineProps({ |
|
|
balanceSelect |
|
|
|
|
|
}, |
|
|
|
|
|
props: { |
|
|
|
|
|
title: { |
|
|
title: { |
|
|
type: String, |
|
|
type: String, |
|
|
default: '箱标签' |
|
|
default: '箱标签' |
|
@ -69,7 +66,6 @@ export default { |
|
|
default: 'HPQ,HMQ' |
|
|
default: 'HPQ,HMQ' |
|
|
}, |
|
|
}, |
|
|
balanceFromInventoryStatuses: { |
|
|
balanceFromInventoryStatuses: { |
|
|
// 是否传fromInventoryStatuses |
|
|
|
|
|
type: Boolean, |
|
|
type: Boolean, |
|
|
default: true |
|
|
default: true |
|
|
}, |
|
|
}, |
|
@ -77,226 +73,217 @@ export default { |
|
|
type: String, |
|
|
type: String, |
|
|
default: '' |
|
|
default: '' |
|
|
}, |
|
|
}, |
|
|
// 是否允许修改库位 |
|
|
|
|
|
allowModifyLocation: { |
|
|
allowModifyLocation: { |
|
|
type: Boolean, |
|
|
type: Boolean, |
|
|
default: true |
|
|
default: true |
|
|
} |
|
|
} |
|
|
}, |
|
|
}); |
|
|
data() { |
|
|
|
|
|
return { |
|
|
const businessType = ref({}); |
|
|
scanResult: {}, |
|
|
const fromInventoryStatuses = ref([]); |
|
|
show: false, |
|
|
const fromLocationAreaTypeList = ref([]); |
|
|
scanList: [], |
|
|
const itemTypesList = ref([]); |
|
|
expand: false, |
|
|
const fromLocationCode = ref(''); |
|
|
showScanResult: {}, |
|
|
const fromLocationList = ref([]); |
|
|
expendIcon: 'arrow-down', |
|
|
const inventoryStatus = ref([]); |
|
|
fromLocationCode: '', |
|
|
const resultData = ref({}); |
|
|
fromLocation: '', |
|
|
const show = ref(false) |
|
|
fromLocationList: [], |
|
|
|
|
|
fromLocationAreaTypeList: [], |
|
|
const comMessageRef = ref(null); |
|
|
locationOnFocus: false, |
|
|
const comscanRef = ref(null); |
|
|
businessType: {}, |
|
|
|
|
|
inventoryStatus: [], |
|
|
const openScanPopup = (businessTypeValue) => { |
|
|
managementPrecision: '', |
|
|
businessType.value = businessTypeValue; |
|
|
fromInventoryStatuses: [], |
|
|
fromInventoryStatuses.value = getDirectoryItemArray(businessTypeValue.outInventoryStatuses); |
|
|
itemTypesList: [], |
|
|
fromLocationAreaTypeList.value = getDirectoryItemArray(businessTypeValue.outAreaTypes); |
|
|
isCheck: false, |
|
|
itemTypesList.value = getDirectoryItemArray(businessTypeValue.itemTypes); |
|
|
resultData: {} |
|
|
show.value = true |
|
|
} |
|
|
setTimeout(() => { |
|
|
}, |
|
|
packGetFocus(); |
|
|
created() {}, |
|
|
}, 500); |
|
|
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') |
|
|
|
|
|
setTimeout(res=>{ |
|
|
|
|
|
this.packGetFocus() |
|
|
|
|
|
},500) |
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
openScanPopupForJob(fromLocationCode, fromLocationList, jobContent) { |
|
|
const openScanPopupForJob = (fromLocationCodeValue, fromLocationListValue, jobContent) => { |
|
|
this.fromLocationCode = fromLocationCode |
|
|
fromLocationCode.value = fromLocationCodeValue; |
|
|
this.fromLocationCode = fromLocationCode; |
|
|
fromLocationList.value = fromLocationListValue; |
|
|
this.fromLocationList = fromLocationList; |
|
|
fromInventoryStatuses.value = getDirectoryItemArray(jobContent.outInventoryStatuses); |
|
|
this.fromInventoryStatuses = getDirectoryItemArray(jobContent.outInventoryStatuses) |
|
|
inventoryStatus.value = getDirectoryItemArray(jobContent.outInventoryStatuses); |
|
|
this.inventoryStatus = getDirectoryItemArray(jobContent.outInventoryStatuses); //出库库存状态; //出库库存状态 |
|
|
fromLocationAreaTypeList.value = getDirectoryItemArray(jobContent.fromAreaTypes); |
|
|
this.fromLocationAreaTypeList = getDirectoryItemArray(jobContent.fromAreaTypes); //出库库存状态 |
|
|
show.value = true |
|
|
this.$refs.popup.open('bottom') |
|
|
setTimeout(() => { |
|
|
setTimeout(res => { |
|
|
if (fromLocationCode.value !== '') { |
|
|
if (this.fromLocationCode != '') { |
|
|
packGetFocus(); |
|
|
this.packGetFocus(); |
|
|
|
|
|
} else { |
|
|
} else { |
|
|
if (this.fromLocationList.length == 0) { |
|
|
if (fromLocationList.value.length === 0) { |
|
|
this.locationGetFocus(); |
|
|
// locationGetFocus(); |
|
|
} else { |
|
|
} else { |
|
|
this.fromLocationCode = this.fromLocationList[0]; |
|
|
fromLocationCode.value = fromLocationList.value[0]; |
|
|
this.packGetFocus(); |
|
|
packGetFocus(); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
}, 500) |
|
|
}, 500); |
|
|
}, |
|
|
}; |
|
|
//模拟扫描 |
|
|
|
|
|
openScanPopupForJobSimulate(fromLocationCode, fromLocationList, jobContent, scanMessage) { |
|
|
const openScanPopupForJobSimulate = (fromLocationCodeValue, fromLocationListValue, jobContent, scanMessage) => { |
|
|
this.fromLocationCode = fromLocationCode; |
|
|
fromLocationCode.value = fromLocationCodeValue; |
|
|
this.fromLocationList = fromLocationList; |
|
|
fromLocationList.value = fromLocationListValue; |
|
|
if (!fromLocationCode) { |
|
|
if (!fromLocationCodeValue) { |
|
|
if (this.fromLocationList.length == 0) { |
|
|
if (fromLocationList.value.length === 0) { |
|
|
// this.locationGetFocus(); |
|
|
alert('没有来源库位:List'); |
|
|
alert('没有来源库位:List') |
|
|
|
|
|
} else { |
|
|
} else { |
|
|
this.fromLocationCode = this.fromLocationList[0]; |
|
|
fromLocationCode.value = fromLocationList.value[0]; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
this.fromInventoryStatuses = getDirectoryItemArray(jobContent.outInventoryStatuses) |
|
|
fromInventoryStatuses.value = getDirectoryItemArray(jobContent.outInventoryStatuses); |
|
|
this.inventoryStatus = getDirectoryItemArray(jobContent.outInventoryStatuses); //出库库存状态; //出库库存状态 |
|
|
inventoryStatus.value = getDirectoryItemArray(jobContent.outInventoryStatuses); |
|
|
this.fromLocationAreaTypeList = getDirectoryItemArray(jobContent.fromAreaTypes); //出库库存状态 |
|
|
fromLocationAreaTypeList.value = getDirectoryItemArray(jobContent.fromAreaTypes); |
|
|
getLabelInfo(scanMessage, this.headerType, callback => { |
|
|
getLabelInfo(scanMessage, props.headerType, (callback) => { |
|
|
if (callback.success) { |
|
|
if (callback.success) { |
|
|
this.getScanResult(callback); |
|
|
getScanResult(callback); |
|
|
} else { |
|
|
} else { |
|
|
this.showErrorMessage(callback.message, res => {}) |
|
|
showErrorMessage(callback.message, () => {}); |
|
|
} |
|
|
} |
|
|
}) |
|
|
}); |
|
|
}, |
|
|
}; |
|
|
|
|
|
|
|
|
handleConfirm() { |
|
|
const handleConfirm = () => { |
|
|
this.$emit('confirm', this.fromLocationCode) |
|
|
emit('confirm', fromLocationCode.value); |
|
|
}, |
|
|
}; |
|
|
|
|
|
|
|
|
getScanResult(result) { |
|
|
const getScanResult = (result) => { |
|
|
if (this.fromLocationCode == '') { |
|
|
if (fromLocationCode.value === '') { |
|
|
this.showErrorMessage('请选择来源库位', (res) => {}) |
|
|
showErrorMessage('请选择来源库位', () => {}); |
|
|
return |
|
|
return; |
|
|
} |
|
|
} |
|
|
|
|
|
resultData.value = result; |
|
|
this.resultData = result |
|
|
|
|
|
if (!result.package) { |
|
|
if (!result.package) { |
|
|
this.showErrorMessage(`${result.label.code}包装信息为空`) |
|
|
showErrorMessage(`${result.label.code}包装信息为空`); |
|
|
return |
|
|
return; |
|
|
} |
|
|
} |
|
|
// 查询物料信息,然后查询库存 |
|
|
getItemCodeType(result.package.itemCode, () => { |
|
|
this.getItemCodeType(result.package.itemCode, (callBack) => { |
|
|
queryBalance(resultData.value); |
|
|
this.queryBalance(this.resultData) |
|
|
}); |
|
|
}) |
|
|
}; |
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
queryBalance(result) { |
|
|
const queryBalance = (result) => { |
|
|
const params = { |
|
|
const params = { |
|
|
locationCode: this.fromLocationCode, |
|
|
locationCode: fromLocationCode.value, |
|
|
itemCode: result.package.itemCode, |
|
|
itemCode: result.package.itemCode, |
|
|
batch: result.label.batch, |
|
|
batch: result.label.batch, |
|
|
packingNumber: result.label.packingNumber, |
|
|
packingNumber: result.label.packingNumber, |
|
|
parentPackingNumber: result.package.parentNumber, |
|
|
parentPackingNumber: result.package.parentNumber, |
|
|
inventoryStatus: this.fromInventoryStatuses, |
|
|
inventoryStatus: fromInventoryStatuses.value, |
|
|
areaType: this.fromLocationAreaTypeList, |
|
|
areaType: fromLocationAreaTypeList.value, |
|
|
bussinessCode: this.bussinessCode |
|
|
bussinessCode: props.bussinessCode |
|
|
} |
|
|
}; |
|
|
|
|
|
uni.showLoading({ |
|
|
|
|
|
title: '查询中', |
|
|
|
|
|
mask: true |
|
|
|
|
|
}); |
|
|
getBalanceByParams(params) |
|
|
getBalanceByParams(params) |
|
|
.then((res) => { |
|
|
.then((res) => { |
|
|
uni.hideLoading() |
|
|
uni.hideLoading(); |
|
|
if (res.data.length == 0) { |
|
|
if (res.data.length === 0) { |
|
|
const status = getInventoryStatusDesc(params.inventoryStatus) |
|
|
const status = getInventoryStatusDesc(params.inventoryStatus); |
|
|
const areaType = getListLocationAreaTypeDesc(params.areaType) |
|
|
const areaType = getListLocationAreaTypeDesc(params.areaType); |
|
|
const hint = `按物料号 [${params.itemCode}] \n` + |
|
|
const hint = `按物料号 [${params.itemCode}] \n` + |
|
|
`包装号 [${params.packingNumber}] \n` + |
|
|
`包装号 [${params.packingNumber}] \n` + |
|
|
`批次 [${params.batch}] \n` + |
|
|
`批次 [${params.batch}] \n` + |
|
|
`状态 [${status}] \n` + |
|
|
`状态 [${status}] \n` + |
|
|
`库区 [${areaType}] \n` + |
|
|
`库区 [${areaType}] \n` + |
|
|
'未查找到库存余额' |
|
|
'未查找到库存余额'; |
|
|
this.showErrorMessage(hint) |
|
|
showErrorMessage(hint); |
|
|
} else if (res.data.length == 1) { |
|
|
} else if (res.data.length === 1) { |
|
|
result.balance = res.data[0] |
|
|
result.balance = res.data[0]; |
|
|
if (result.label.packingNumber != result.balance.packingNumber) { |
|
|
if (result.label.packingNumber !== result.balance.packingNumber) { |
|
|
result.balance.lableQty = result.label.qty |
|
|
result.balance.lableQty = result.label.qty; |
|
|
} |
|
|
} |
|
|
this.$emit('getBalance', result) |
|
|
emit('getBalance', result); |
|
|
// this.closeScanPopup() |
|
|
|
|
|
} else { |
|
|
} else { |
|
|
// 多条记录 |
|
|
show.value = true |
|
|
this.$refs.balanceSelect.openPopup(res.data) |
|
|
|
|
|
} |
|
|
} |
|
|
}) |
|
|
}) |
|
|
.catch((error) => { |
|
|
.catch((error) => { |
|
|
uni.hideLoading() |
|
|
uni.hideLoading(); |
|
|
this.showErrorMessage(error) |
|
|
showErrorMessage(error); |
|
|
}) |
|
|
}); |
|
|
}, |
|
|
}; |
|
|
getItemCodeType(itemCode, callBack) { |
|
|
|
|
|
|
|
|
const getItemCodeType = (itemCode, callBack) => { |
|
|
uni.showLoading({ |
|
|
uni.showLoading({ |
|
|
title: '加载中', |
|
|
title: '加载中', |
|
|
mask: true |
|
|
mask: true |
|
|
}) |
|
|
}); |
|
|
getBasicItemByCode(itemCode) |
|
|
getBasicItemByCode(itemCode) |
|
|
.then((res) => { |
|
|
.then((res) => { |
|
|
if (res.data != null && res.data.list.length > 0) { |
|
|
if (res.data != null && res.data.list.length > 0) { |
|
|
const result = res.data.list[0] |
|
|
const result = res.data.list[0]; |
|
|
const status = result.available |
|
|
const status = result.available; |
|
|
const { type } = result |
|
|
const { type } = result; |
|
|
if (status == 'TRUE') { |
|
|
if (status === 'TRUE') { |
|
|
if (checkDirectoryItemExist(this.itemTypesList, type)) { |
|
|
if (checkDirectoryItemExist(itemTypesList.value, type)) { |
|
|
callBack() |
|
|
callBack(); |
|
|
} else { |
|
|
} else { |
|
|
const hint = getListItemTypeDesc(this.itemTypesList) |
|
|
const hint = getListItemTypeDesc(itemTypesList.value); |
|
|
uni.hideLoading() |
|
|
uni.hideLoading(); |
|
|
this.showErrorMessage(`扫描物料[${itemCode}]是[${getItemTypeInfo(type).label}],需要的物料类型是[${hint}]`) |
|
|
showErrorMessage(`扫描物料[${itemCode}]是[${getItemTypeInfo(type).label}],需要的物料类型是[${hint}]`); |
|
|
} |
|
|
} |
|
|
} else { |
|
|
} else { |
|
|
uni.hideLoading() |
|
|
uni.hideLoading(); |
|
|
this.showErrorMessage(`物料【${itemCode}】不可用`) |
|
|
showErrorMessage(`物料【${itemCode}】不可用`); |
|
|
} |
|
|
} |
|
|
} else { |
|
|
} else { |
|
|
uni.hideLoading() |
|
|
uni.hideLoading(); |
|
|
this.showErrorMessage(`未查找到物料【${itemCode}】`) |
|
|
showErrorMessage(`未查找到物料【${itemCode}】`); |
|
|
} |
|
|
} |
|
|
}) |
|
|
}) |
|
|
.catch((error) => { |
|
|
.catch((error) => { |
|
|
uni.hideLoading() |
|
|
uni.hideLoading(); |
|
|
this.showErrorMessage(error) |
|
|
showErrorMessage(error); |
|
|
}) |
|
|
}); |
|
|
}, |
|
|
}; |
|
|
showErrorMessage(message) { |
|
|
|
|
|
this.packLoseFocus(); |
|
|
const showErrorMessage = (message) => { |
|
|
this.$refs.comMessage.showErrorMessage(message, (res) => { |
|
|
packLoseFocus(); |
|
|
|
|
|
comMessageRef.value.showErrorMessage(message, (res) => { |
|
|
if (res) { |
|
|
if (res) { |
|
|
if (this.$refs.comscan) { |
|
|
if (comscanRef.value) { |
|
|
this.$refs.comscan.getfocus() |
|
|
comscanRef.value.getfocus(); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
}) |
|
|
}); |
|
|
}, |
|
|
}; |
|
|
selectBalanceItem(item) { |
|
|
|
|
|
this.resultData.balance = item |
|
|
|
|
|
this.$emit('getBalance', this.resultData) |
|
|
|
|
|
// this.closeScanPopup() |
|
|
|
|
|
}, |
|
|
|
|
|
closeScanPopup() { |
|
|
|
|
|
this.packLoseFocus() |
|
|
|
|
|
this.$refs.popup.close() |
|
|
|
|
|
this.$emit('onCloseScanPopup') |
|
|
|
|
|
}, |
|
|
|
|
|
getfocus() { |
|
|
|
|
|
if (this.$refs.comscan) { |
|
|
|
|
|
this.$refs.comscan.getfocus() |
|
|
|
|
|
} |
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
packGetFocus() { |
|
|
const selectBalanceItem = (item) => { |
|
|
if (this.$refs.comscan) { |
|
|
resultData.value.balance = item; |
|
|
this.$refs.comscan.getfocus() |
|
|
emit('getBalance', resultData.value); |
|
|
} |
|
|
}; |
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
packLoseFocus() { |
|
|
const closeScanPopup = () => { |
|
|
if (this.$refs.comscan) { |
|
|
packLoseFocus(); |
|
|
this.$refs.comscan.losefocus() |
|
|
show.value = false |
|
|
|
|
|
emit('onCloseScanPopup'); |
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
const getfocus = () => { |
|
|
|
|
|
if (comscanRef.value) { |
|
|
|
|
|
comscanRef.value.getfocus(); |
|
|
} |
|
|
} |
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
const packGetFocus = () => { |
|
|
|
|
|
if (comscanRef.value) { |
|
|
|
|
|
comscanRef.value.getfocus(); |
|
|
} |
|
|
} |
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
const packLoseFocus = () => { |
|
|
|
|
|
if (comscanRef.value) { |
|
|
|
|
|
comscanRef.value.losefocus(); |
|
|
} |
|
|
} |
|
|
} |
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
const emit = defineEmits(['confirm', 'getBalance', 'onCloseScanPopup']); |
|
|
</script> |
|
|
</script> |
|
|
|
|
|
|
|
|
<style lang="scss"> |
|
|
<style lang="scss"> |
|
|