diff --git a/src/mycomponents/scan/winCheckFgLabel.vue b/src/mycomponents/scan/winCheckFgLabel.vue index de227a24..b1bb5606 100644 --- a/src/mycomponents/scan/winCheckFgLabel.vue +++ b/src/mycomponents/scan/winCheckFgLabel.vue @@ -75,16 +75,16 @@ const comscanCustomerLabel = ref() const comMessageRef = ref() const openScanPopupForType = (customerCodeParams) => { customerCode.value = customerCodeParams - if (fromLocationCode.value != '') { - packGetFocus() - } else { - locationGetFocus() - } fromInventoryStatuses.value = getDirectoryItemArray(businessType.value.outInventoryStatuses) inventoryStatus.value = getDirectoryItemArray(businessType.value.outInventoryStatuses) // 出库库存状态 fromLocationAreaTypeList.value = getDirectoryItemArray(businessType.value.fromLocationAreaTypeList) // 出库库区 - setTimeout((res) => { - show.value = true + show.value = true + setTimeout(() => { + if (fromLocationCode.value != '') { + packGetFocus(); + } else { + locationGetFocus(); + } }, 500) } @@ -92,15 +92,19 @@ const openScanPopupForType = (customerCodeParams) => { const openScanPopupForJob = (fromLocationCode, fromLocationList, jobContent) => { fromLocationCode.value = fromLocationCode fromLocationList.value = fromLocationList - if (fromLocationCode != '') { - packGetFocus() - } else if (fromLocationList.value.length == 0) { - locationGetFocus() - } else { - fromLocationCode.value = fromLocationList.value[0] - } + fromInventoryStatuses.value = getDirectoryItemArray(businessType.value.outInventoryStatuses) + inventoryStatus.value = getDirectoryItemArray(businessType.value.outInventoryStatuses) // 出库库存状态 + fromLocationAreaTypeList.value = getDirectoryItemArray(businessType.value.fromLocationAreaTypeList) // 出库库区 + show.value = true setTimeout((res) => { - show.value = true + if (fromLocationCode != '') { + packGetFocus() + } else if (fromLocationList.value.length == 0) { + locationGetFocus() + } else { + fromLocationCode.value = fromLocationList.value[0] + packGetFocus() + } }, 500) fromInventoryStatuses.value = getDirectoryItemArray(jobContent.outInventoryStatuses) inventoryStatus.value = getDirectoryItemArray(jobContent.outInventoryStatuses) // 出库库存状态; //出库库存状态 diff --git a/src/mycomponents/scan/winComScan.vue b/src/mycomponents/scan/winComScan.vue index 9e186513..32933097 100644 --- a/src/mycomponents/scan/winComScan.vue +++ b/src/mycomponents/scan/winComScan.vue @@ -4,12 +4,15 @@ - + - + @@ -59,10 +62,10 @@ const props = defineProps({ type: Boolean, default: true }, - boxFocus: { - type: Boolean, - default: true - }, + // boxFocus: { + // type: Boolean, + // default: true + // }, isShowHistory: { type: Boolean, default: true @@ -84,16 +87,7 @@ const cursorIndex = ref(0) const comMessageRef = ref('') placeholderValue.value = `请扫描${props.placeholder}` onMounted(() => { - boxfocus.value = true - // uni.hideKeyboard() - // // #ifdef H5 - // if (document.querySelector('textarea') != null) { - // document.querySelector('textarea').setAttribute('inputmode', 'none') - // } - // // #endif - // hide() - // document.querySelector('textarea').setAttribute('inputmode', 'none') }) // 监视属性 watch( @@ -124,6 +118,7 @@ const setValue = (val) => { } const clearScanValue = () => { scanMsg.value = '' + // this.cursorIndex = 0 getfocus() } const clickScanMsg = () => { @@ -132,14 +127,13 @@ const clickScanMsg = () => { } const handelScanMsg = () => { // 点击了回车 - const index = scanMsg.value.indexOf('\n') - if (index >= 0) { + if (scanMsg.value.indexOf('\n')) { // that.scanMsg = 'HPQ;V1.0;ICE115F11161AG;PP20230427000027;B20230427002;Q50'; setTimeout(() => { losefocus() const content = scanMsg.value.trim() if (content == '') { - getfocus() + // getfocus() comMessageRef.value.showErrorMessage('扫描内容为空,请重新扫描', (res) => { if (res) { scanMsg.value = '' @@ -161,6 +155,7 @@ const handelScanMsg = () => { emit('getResult', scanResult) } else { clear() + losefocus() comMessageRef.value.showErrorMessage(scanResult.message, (res) => { if (res) { getfocus() @@ -168,9 +163,16 @@ const handelScanMsg = () => { }) } }) - }, 500) + }, 200) } } +const handleFocus = ()=> {} + +const handleBlur = ()=> { + // setTimeout(res=>{ + // uni.hideKeyboard(); + // },200) +} const getfocus = () => { nextTick((r) => { boxfocus.value = true @@ -184,8 +186,10 @@ const losefocus = () => { }) } const clear = () => { - cursorIndex.value = 0 - scanMsg.value = '' + if(props.clearResult){ + cursorIndex.value = 0 + scanMsg.value = '' + } } const iconClick = (type) => { emit('clearResult', scanMsg.value) diff --git a/src/mycomponents/scan/winComScanBalance.vue b/src/mycomponents/scan/winComScanBalance.vue index b4e30fa8..e123cd76 100644 --- a/src/mycomponents/scan/winComScanBalance.vue +++ b/src/mycomponents/scan/winComScanBalance.vue @@ -118,6 +118,9 @@ export default { this.toLocationAreaTypeList = getDirectoryItemArray(businessType.inAreaTypes) this.itemTypesList = getDirectoryItemArray(businessType.itemTypes) this.$refs.popup.open('bottom') + setTimeout(res=>{ + this.getfocus() + },500) }, getScanResult(result) { @@ -128,7 +131,7 @@ export default { } this.getItemCodeType(result.package.itemCode, callBack => { if(this.isCheckLocationBalance){ - this.getToLocationBalance(this.resultData) + this.queryBalance(this.resultData); }else { this.queryBalance(this.resultData) } @@ -214,11 +217,11 @@ export default { var status = getInventoryStatusDesc(params.inventoryStatus) var areaType = getListLocationAreaTypeDesc(params.areaType) var hint = - "按物料号 [" + params.itemCode + "]
" + - "包装号 [" + params.packingNumber + "]
" + - "批次 [" + params.batch + "]
" + - "状态 [" + status + "]
" + - "库区 [" + areaType + "]
" + + "按物料号 [" + params.itemCode + "] \n" + + "包装号 [" + params.packingNumber + "] \n" + + "批次 [" + params.batch + "] \n" + + "状态 [" + status + "] \n" + + "库区 [" + areaType + "] \n" + "未查找到库存余额" this.showErrorMessage(hint) } else if (res.data.length == 1) { diff --git a/src/mycomponents/scan/winComScanBalanceLocation.vue b/src/mycomponents/scan/winComScanBalanceLocation.vue index bd92ec30..c874d59a 100644 --- a/src/mycomponents/scan/winComScanBalanceLocation.vue +++ b/src/mycomponents/scan/winComScanBalanceLocation.vue @@ -47,7 +47,7 @@ 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' - +import {getLabelInfo} from '@/common/label.js'; export default { name: 'winScanPack', emits: ['getBalance', 'onCloseScanPopup'], @@ -113,25 +113,54 @@ export default { this.fromLocationAreaTypeList = getDirectoryItemArray(businessType.outAreaTypes) this.itemTypesList = getDirectoryItemArray(businessType.itemTypes) this.$refs.popup.open('bottom') + setTimeout(res=>{ + this.packGetFocus() + },500) }, 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') + this.fromLocationCode = fromLocationCode; + this.fromLocationList = fromLocationList; + this.fromInventoryStatuses = getDirectoryItemArray(jobContent.outInventoryStatuses) + this.inventoryStatus = getDirectoryItemArray(jobContent.outInventoryStatuses); //出库库存状态; //出库库存状态 + this.fromLocationAreaTypeList = getDirectoryItemArray(jobContent.fromAreaTypes); //出库库存状态 + this.$refs.popup.open('bottom') + setTimeout(res => { + if (this.fromLocationCode != '') { + this.packGetFocus(); + } else { + if (this.fromLocationList.length == 0) { + this.locationGetFocus(); + } else { + this.fromLocationCode = this.fromLocationList[0]; + this.packGetFocus(); + } + } }, 500) + }, + //模拟扫描 + openScanPopupForJobSimulate(fromLocationCode, fromLocationList, jobContent, scanMessage) { + this.fromLocationCode = fromLocationCode; + this.fromLocationList = fromLocationList; + if (!fromLocationCode) { + if (this.fromLocationList.length == 0) { + // this.locationGetFocus(); + alert('没有来源库位:List') + } else { + this.fromLocationCode = this.fromLocationList[0]; + } + } this.fromInventoryStatuses = getDirectoryItemArray(jobContent.outInventoryStatuses) - this.inventoryStatus = getDirectoryItemArray(jobContent.outInventoryStatuses) // 出库库存状态; //出库库存状态 - this.fromLocationAreaTypeList = getDirectoryItemArray(jobContent.fromAreaTypes) // 出库库存状态 + this.inventoryStatus = getDirectoryItemArray(jobContent.outInventoryStatuses); //出库库存状态; //出库库存状态 + this.fromLocationAreaTypeList = getDirectoryItemArray(jobContent.fromAreaTypes); //出库库存状态 + getLabelInfo(scanMessage, this.headerType, callback => { + if (callback.success) { + this.getScanResult(callback); + } else { + this.showErrorMessage(callback.message, res => {}) + } + }) }, handleConfirm() { @@ -172,7 +201,12 @@ export default { if (res.data.length == 0) { const status = getInventoryStatusDesc(params.inventoryStatus) const areaType = getListLocationAreaTypeDesc(params.areaType) - const hint = `按物料号 [${params.itemCode}]
` + `包装号 [${params.packingNumber}]
` + `批次 [${params.batch}]
` + `状态 [${status}]
` + `库区 [${areaType}]
` + '未查找到库存余额' + const hint = `按物料号 [${params.itemCode}] \n` + + `包装号 [${params.packingNumber}] \n` + + `批次 [${params.batch}] \n` + + `状态 [${status}] \n` + + `库区 [${areaType}] \n` + + '未查找到库存余额' this.showErrorMessage(hint) } else if (res.data.length == 1) { result.balance = res.data[0] @@ -225,6 +259,7 @@ export default { }) }, showErrorMessage(message) { + this.packLoseFocus(); this.$refs.comMessage.showErrorMessage(message, (res) => { if (res) { if (this.$refs.comscan) { diff --git a/src/mycomponents/scan/winComScanFg.vue b/src/mycomponents/scan/winComScanFg.vue index a5de7a1e..84289795 100644 --- a/src/mycomponents/scan/winComScanFg.vue +++ b/src/mycomponents/scan/winComScanFg.vue @@ -5,11 +5,15 @@ - + - + @@ -47,9 +51,7 @@ diff --git a/src/mycomponents/scan/winScanItem.vue b/src/mycomponents/scan/winScanItem.vue index 4c6cd96f..0495941d 100644 --- a/src/mycomponents/scan/winScanItem.vue +++ b/src/mycomponents/scan/winScanItem.vue @@ -52,8 +52,9 @@ const scan = ref() const expendIcon = ref('arrow-down') const comMessageRef = ref() const openScanPopup = () => { + isShow.value = true setTimeout((res) => { - isShow.value = true + getfocus() }, 500) } const closeScanPopup = () => { diff --git a/src/mycomponents/scan/winScanJobNumber.vue b/src/mycomponents/scan/winScanJobNumber.vue index ac0a4925..45b47000 100644 --- a/src/mycomponents/scan/winScanJobNumber.vue +++ b/src/mycomponents/scan/winScanJobNumber.vue @@ -41,8 +41,9 @@ const scanList = ref([]) const expendIcon = ref('arrow-down') const scan = ref() const openScanPopup = () => { + isShow.value = true setTimeout((res) => { - isShow.value = true + getfocus() }, 500) } const closeScanPopup = () => { @@ -52,7 +53,7 @@ const closeScanPopup = () => { isShow.value = false } const getfocus = () => { - if (isShow.value) { + if (scan.value) { scan.value.getfocus() } } diff --git a/src/mycomponents/scan/winScanLocation.vue b/src/mycomponents/scan/winScanLocation.vue index 2b21d6ae..01368ef5 100644 --- a/src/mycomponents/scan/winScanLocation.vue +++ b/src/mycomponents/scan/winScanLocation.vue @@ -48,8 +48,9 @@ const scan = ref() const comMessageRef = ref() const comscansimulate = ref() const openScanPopup = () => { + show.value = true setTimeout((res) => { - show.value = true + getfocus() }, 500) } const openScanPopupSimulate = (location) => { diff --git a/src/mycomponents/scan/winScanPack.vue b/src/mycomponents/scan/winScanPack.vue index 913770e1..cf008d7f 100644 --- a/src/mycomponents/scan/winScanPack.vue +++ b/src/mycomponents/scan/winScanPack.vue @@ -55,8 +55,9 @@ const simulateScan = (scanMessage) => { }) } const openScanPopup = () => { + show.value = true setTimeout((res) => { - show.value = true + getfocus() }, 200) } diff --git a/src/mycomponents/scan/winScanPackAndCont.vue b/src/mycomponents/scan/winScanPackAndCont.vue index f0ab27fd..932b4be0 100644 --- a/src/mycomponents/scan/winScanPackAndCont.vue +++ b/src/mycomponents/scan/winScanPackAndCont.vue @@ -52,8 +52,9 @@ export default { created() {}, methods: { openScanPopup() { - setTimeout((res) => { - this.$refs.popup.open('bottom') + this.$refs.popup.open('bottom') + setTimeout(res => { + this.getfocus() }, 500) }, diff --git a/src/mycomponents/scan/winScanPackAndLocation.vue b/src/mycomponents/scan/winScanPackAndLocation.vue index 9e4bc27a..eca60627 100644 --- a/src/mycomponents/scan/winScanPackAndLocation.vue +++ b/src/mycomponents/scan/winScanPackAndLocation.vue @@ -48,6 +48,7 @@ import { getBasicLocationByCode } from '@/api/request2.js' import { getListLocationAreaTypeDesc, checkDirectoryItemExist, getDirectoryItemArray, getLocationAreaTypeName, getInventoryStatusDesc } from '@/common/directory.js' import { getLabelInfo } from '@/common/label.js' +import {a} from "unocss-preset-weapp/dist/utilities-322cd311"; const { proxy } = getCurrentInstance() const props = defineProps({ @@ -90,7 +91,11 @@ const props = defineProps({ // 是否传fromInventoryStatuses type: Boolean, default: true - } + }, + toLocationCode: { + type: String, + default: "" + }, }) const scanResult = ref({}) const show = ref(false) @@ -112,7 +117,7 @@ const balanceSelectRef = ref() const comscan = ref() const comMessageRef = ref() const location = ref() - +const chooseWhich = ref('1') const handleConfirm = () => { emit('confirm', fromLocationCode.value) } @@ -120,38 +125,38 @@ const handleConfirm = () => { const openScanPopupForType = (fromLocationCodeParams, businessTypeParams) => { businessType.value = businessTypeParams fromLocationCode.value = fromLocationCodeParams - if (fromLocationCodeParams != '') { - packGetFocus() - } else { - locationGetFocus() - } + fromInventoryStatuses.value = getDirectoryItemArray(businessType.value.outInventoryStatuses) inventoryStatus.value = getDirectoryItemArray(businessType.value.outInventoryStatuses) // 出库库存状态 fromLocationAreaTypeList.value = getDirectoryItemArray(businessType.value.outAreaTypes) // 出库库区 - if (!show.value) { - setTimeout((res) => { - show.value = true - }, 500) - } + show.value = true + setTimeout((res) => { + if (fromLocationCodeParams != '') { + packGetFocus() + } else { + locationGetFocus() + } + }, 500) } // 在任务中扫描 const openScanPopupForJob = (fromLocationCodePrams, fromLocationListPrams, jobContent) => { fromLocationCode.value = fromLocationCodePrams fromLocationList.value = fromLocationListPrams - if (fromLocationCodePrams != '') { - packGetFocus() - } else if (fromLocationList.value.length == 0) { - locationGetFocus() - } else { - fromLocationCode.value = fromLocationList.value[0] - } - setTimeout((res) => { - show.value = true - }, 500) fromInventoryStatuses.value = getDirectoryItemArray(jobContent.outInventoryStatuses) inventoryStatus.value = getDirectoryItemArray(jobContent.outInventoryStatuses) // 出库库存状态; //出库库存状态 fromLocationAreaTypeList.value = getDirectoryItemArray(jobContent.fromAreaTypes) // 出库库存状态 + show.value = true + setTimeout((res) => { + if (fromLocationCodePrams != '') { + packGetFocus() + } else if (fromLocationList.value.length == 0) { + locationGetFocus() + } else { + fromLocationCode.value = fromLocationList.value[0] + } + }, 500) + } // 模拟扫描 const openScanPopupForJobSimulate = (fromLocationCodeParams, fromLocationListParams, jobContent, item) => { @@ -169,7 +174,12 @@ const openScanPopupForJobSimulate = (fromLocationCodeParams, fromLocationListPar fromInventoryStatuses.value = getDirectoryItemArray(jobContent.outInventoryStatuses) inventoryStatus.value = getDirectoryItemArray(jobContent.outInventoryStatuses) // 出库库存状态; //出库库存状态 fromLocationAreaTypeList.value = getDirectoryItemArray(jobContent.fromAreaTypes) // 出库库存状态 + uni.showLoading({ + title: "获取标签信息", + mask: true + }) getLabelInfo(scanMessage, headerType.value, (callback) => { + uni.hideLoading() if (callback.success) { getScanResult(callback) } else { @@ -255,7 +265,7 @@ const getScanResult = (result) => { // this.checkPackage(result); // } } -const checkPackage = (result) => { +const checkPackage = async (result) => { if (result.label != null) { scanResult.value = result // uni.showLoading({ @@ -263,11 +273,21 @@ const checkPackage = (result) => { // mask: true // }) if (props.queryBalance == true) { - getBalanceByManagementPrecisionByPacking(result.label, fromLocationCode.value, props.balanceFromInventoryStatuses ? fromInventoryStatuses.value : undefined, (res) => { + await getBalanceByManagementPrecisionByPacking(result.label, fromLocationCode.value, props.balanceFromInventoryStatuses ? fromInventoryStatuses.value : undefined, (res) => { uni.hideLoading() if (res.success) { managementPrecision.value = res.managementPrecision - afterQueryBalance(res.data.list) + if (managementPrecision.value == 'BY_BATCH') { + res.data.list.forEach(item => { + item.packingNumber = '' + }) + } + chooseWhich.value = '2' + if (res.data && res.data.list && res.data.list.length > 1) { + showBalanceSelect(res.data.list); + } else { + afterQueryBalance(res.data.list); + } } else { showErrorMessage(res.message, (res) => { packGetFocus() @@ -298,9 +318,9 @@ const afterQueryBalance = (datas) => { uni.hideLoading() } // 允许无库存 -const allowNoneBalance = (datas) => { +const allowNoneBalance = async (datas) => { if (datas.length == 0) { - packCallBack(null) + await packCallBack(null) } else { showErrorMessage(`在来源库位[${fromLocationCode.value}],已经查找到该包装的库存记录,请重新扫描`, (res) => { packGetFocus() @@ -311,7 +331,7 @@ const allowNoneBalance = (datas) => { const mustHavaBalance = (datas) => { if (datas.length == 0) { - showErrorMessage(`${getQueryCondition()}
未查找到库存记录`, (res) => { + showErrorMessage(`${getQueryCondition()}\n未查找到库存记录`, (res) => { packGetFocus() }) } else if (datas.length == 1) { @@ -330,13 +350,18 @@ const mustHavaBalance = (datas) => { // } } else { showBalanceSelect(datas) + chooseWhich.value = '1' } } const showBalanceSelect = (items) => { balanceSelectRef.value.openPopup(items) } const selectBalanceItem = (balance) => { - packCallBack(balance) + if (chooseWhich.value == 1) { + packCallBack(balance); + } else { + countCallBack(balance); + } // 因为盘点时有负库存,暂时去掉判断 2023年12月28日 // if (balance.qty > 0) { // this.packCallBack(balance); @@ -361,12 +386,17 @@ const countCallBack = (datas) => { balance: datas, fromLocationCode: fromLocationCode.value } - packGetFocus() - emit('getResult', data) + // this.packGetFocus(); + // 如果管理精度是批次或者数量,给父组件多返回一个参数 + if (managementPrecision.value == 'BY_BATCH' || managementPrecision.value == 'BY_QUANTITY') { + emit("getResult", data, managementPrecision.value); + } else { + emit("getResult", data); + } emit('getCountScanResult', data) } -const packCallBack = (item) => { +const packCallBack = async (item) => { if (comscan.value) { comscan.value.clear() } @@ -378,10 +408,15 @@ const packCallBack = (item) => { fromLocationCode: fromLocationCode.value } packGetFocus() - emit('getResult', data) + // 如果管理精度是批次或者数量,给父组件多返回一个参数 + if (managementPrecision.value == 'BY_BATCH' || managementPrecision.value == 'BY_QUANTITY') { + emit("getResult", data, managementPrecision.value); + } else { + emit("getResult", data); + } } const packGetFocus = () => { - if (comscan.value != undefined) { + if (comscan.value) { comscan.value.getfocus() } } @@ -395,16 +430,20 @@ const locationGetFocus = () => { locationOnFocus.value = true } const getQueryCondition = () => { - let condition = '按照以下条件:
' + let condition = '按照以下条件:\n' const { label } = scanResult.value - const status = getInventoryStatusDesc(inventoryStatus.value) + let isShowStatus = props.balanceFromInventoryStatuses ? fromInventoryStatuses.value : undefined + let status = '' + if (isShowStatus) { + status = getInventoryStatusDesc(isShowStatus); + } switch (managementPrecision.value) { case 'BY_PACKAGING': - condition = `${condition}物料号=[${label.itemCode}]
箱码=[${label.packingNumber}]
批次=[${label.batch}]
库位=[${fromLocationCode.value}]` + condition = `${condition}物料号=[${label.itemCode}]\n箱码=[${label.packingNumber}]\n批次=[${label.batch}]\n库位=[${fromLocationCode.value}]` break case 'BY_BATCH': - condition = `${condition}物料号=[${label.itemCode}]
批次=[${label.batch}]
库位=[${fromLocationCode.value}]` + condition = `${condition}物料号=[${label.itemCode}]\n批次=[${label.batch}]\n库位=[${fromLocationCode.value}]` break case 'BY_QUANTITY': condition = `${condition}物料号=[${label.itemCode}]
库位=[${fromLocationCode.value}]` @@ -413,7 +452,7 @@ const getQueryCondition = () => { condition = `${condition}物料号=[${label.itemCode}]` break } - if (inventoryStatus.value.length > 0) { + if (status) { condition = `${condition}
库存状态=[${status}]` } return condition diff --git a/src/mycomponents/scan/winScanPackAndLocationNoBalance.vue b/src/mycomponents/scan/winScanPackAndLocationNoBalance.vue index c5514548..f2fef961 100644 --- a/src/mycomponents/scan/winScanPackAndLocationNoBalance.vue +++ b/src/mycomponents/scan/winScanPackAndLocationNoBalance.vue @@ -100,35 +100,37 @@ const comMessageRef = ref() const openScanPopupForType = (fromLocationCodeParms, businessTypeParms) => { businessType.value = businessTypeParms fromLocationCode.value = fromLocationCodeParms - if (fromLocationCodeParms != '') { - packGetFocus() - } else { - locationGetFocus() - } fromInventoryStatuses.value = getDirectoryItemArray(businessType.value.outInventoryStatuses) inventoryStatus.value = getDirectoryItemArray(businessType.value.outInventoryStatuses) // 出库库存状态 fromLocationTypeArray.value = getDirectoryItemArray(businessType.value.outLocationTypes) // 出库库存状态 + show.value = true setTimeout((res) => { - show.value = true + if (fromLocationCodeParms != '') { + packGetFocus() + } else { + locationGetFocus() + } }, 500) } // 在任务中扫描 const openScanPopupForJob = (fromLocationCodeParms, fromLocationListParms, jobContent) => { fromLocationCode.value = fromLocationCodeParms fromLocationList.value = fromLocationListParms - if (fromLocationListParms != '') { - packGetFocus() - } else if (fromLocationList.value.length == 0) { - locationGetFocus() - } else { - fromLocationCode.value = tfromLocationList.value[0] - } - setTimeout((res) => { - show.value = true - }, 500) fromInventoryStatuses.value = getDirectoryItemArray(jobContent.outInventoryStatuses) inventoryStatus.value = getDirectoryItemArray(jobContent.outInventoryStatuses) // 出库库存状态; //出库库存状态 fromLocationTypeArray.value = getDirectoryItemArray(jobContent.fromLocationTypes) // 出库库存状态 + show.value = true + setTimeout((res) => { + if (fromLocationListParms != '') { + packGetFocus() + } else if (fromLocationList.value.length == 0) { + locationGetFocus() + } else { + fromLocationCode.value = fromLocationList.value[0] + packGetFocus() + } + }, 500) + } const closeScanPopup = (content) => { packLoseFocus() @@ -176,7 +178,7 @@ const getScanResult = (scanResult) => { } else { uni.hideLoading() const hint = getListLocationTypeDesc(fromLocationTypeArray.value) - showErrorMessage(`库位[${fromLocationCode.value}]是${getLocationTypeName(type)},
需要的库位类型是[${hint}]`, (callback) => { + showErrorMessage(`库位[${fromLocationCode.value}]是${getLocationTypeName(type)},\n需要的库位类型是[${hint}]`, (callback) => { locationGetFocus() }) } diff --git a/src/mycomponents/scan/winScanPackAndPosition.vue b/src/mycomponents/scan/winScanPackAndPosition.vue index 97e1482b..23f9b3f2 100644 --- a/src/mycomponents/scan/winScanPackAndPosition.vue +++ b/src/mycomponents/scan/winScanPackAndPosition.vue @@ -81,8 +81,9 @@ const openScanPopup = () => { showErrorMessage(error) }) } + isShow.value = true setTimeout((res) => { - isShow.value = true + getfocus() }, 500) } diff --git a/src/mycomponents/scan/winScanPackJob.vue b/src/mycomponents/scan/winScanPackJob.vue index 4afb9ece..2309a5e8 100644 --- a/src/mycomponents/scan/winScanPackJob.vue +++ b/src/mycomponents/scan/winScanPackJob.vue @@ -46,6 +46,9 @@ const show = ref(false) // 弹出 const openScanPopup = () => { show.value = true + setTimeout(()=>{ + packGetFocus() + },500) } // 关闭 const closeScanPopup = (content) => { @@ -59,13 +62,13 @@ const getScanResult = (result) => { emit('getResult', result) } const packGetFocus = () => { - if (comscan.value != undefined) { + if (comscan.value) { comscan.value.getfocus() } } const packLoseFocus = () => { - if (comscan.value != undefined) { + if (comscan.value) { comscan.value.losefocus() } } diff --git a/src/mycomponents/scan/winScanPackLevel.vue b/src/mycomponents/scan/winScanPackLevel.vue index a422d5fc..b8b28b1f 100644 --- a/src/mycomponents/scan/winScanPackLevel.vue +++ b/src/mycomponents/scan/winScanPackLevel.vue @@ -78,8 +78,9 @@ }) } const openScanPopup = () => { + show.value = true setTimeout((res) => { - show.value = true + getfocus() }, 200) } const closeScanPopup = () => { @@ -114,14 +115,14 @@ const getfocus = () => { - if (comscan.value != undefined) { + if (comscan.value) { comscan.value.getfocus() } } const losefocus = () => { - if (comscan.value != undefined) { + if (comscan.value) { comscan.value.losefocus() } } diff --git a/src/mycomponents/scan/winScanPackage.vue b/src/mycomponents/scan/winScanPackage.vue index 545c2e21..06a4ddfb 100644 --- a/src/mycomponents/scan/winScanPackage.vue +++ b/src/mycomponents/scan/winScanPackage.vue @@ -26,7 +26,11 @@ import { ref, getCurrentInstance, onMounted, nextTick, watch } from 'vue' import winComScan from '@/mycomponents/scan/winComScan.vue' import { getBalanceByFilter } from '@/api/request2.js' - +import { + getInventoryStatusDesc, + getDirectoryItemArray, + getLocationAreaTypeName +} from '@/common/directory.js'; const props = defineProps({ title: { type: String, @@ -46,13 +50,15 @@ const comscansimulate = ref() const comscan = ref() const comMessageRef = ref() const businessType = ref(null) +const scanResult = ref({}) const simulateScan = (item) => { comscansimulate.value.setItemCodeSimulate(item.copyContent) comscansimulate.value.clickScanMsg() } const openScanPopup = () => { + show.value = true setTimeout((res) => { - show.value = true + getfocus() }, 200) } @@ -62,10 +68,11 @@ const closeScanPopup = () => { emit('close', '') } const openScanPopupByBusinessType = (businessTypeParams) => { + show.value = false setTimeout((res) => { - show.value = false + getfocus() businessType.value = businessTypeParams - }, 200) + }, 500) } const scanClick = () => { if (comscan.value) { @@ -81,6 +88,7 @@ const cancelClick = () => { const getScanResult = (result) => { if (result.success) { + scanResult.value = result getBalance(result, (res) => { result.balance = res emit('getResult', result) @@ -122,6 +130,29 @@ const getParams = (label)=> { } return filters; } +const getQueryCondition = ()=> { + let condition = '按照以下条件:\n'; + let label = scanResult.value.label; + let status = getInventoryStatusDesc(getDirectoryItemArray(businessType.value.outInventoryStatuses)); + let areaType = getLocationAreaTypeName(businessType.value.outAreaTypes) + condition = condition + '物料号=[' + label.itemCode + + ']\n箱码=[' + label.packingNumber + + ']\n批次=[' + + label.batch + + ']' + + if (status) { + condition = condition + '\n库存状态=[' + status + ']' + } + + if (areaType) { + condition = condition + '\n库区类型=[' + areaType + ']' + } + if (businessType.value.outAreaCodes) { + condition = condition + '\n库区代码=[' + businessType.value.outAreaCodes + ']' + } + return condition; +} const getBalance = (result, callback) => { let filters = [] const { label } = result @@ -156,7 +187,7 @@ const getBalance = (result, callback) => { .then((res) => { if (res.data.list.length > 0) { res.data.list.forEach(r => { - if (packageInfo.parentNumber !== null) { + if (packageInfo.parentNumber) { r.parentPackingNumber = packageInfo.parentNumber } else { r.parentPackingNumber = packageInfo.number @@ -181,9 +212,7 @@ const getBalance = (result, callback) => { params.filters = filters; getBalanceByFilter(params).then(res1 => { if (res1.data.list.length == 0) { - this.showErrorMessage('未查找到该包装的库存余额', res => { - this.packGetFocus(); - }) + showErrorMessage(getQueryCondition()+'\n未查找到该包装的库存余额') } else { res1.data.list.forEach(r => r.parentPackingNumber = packageInfo.number) callback(res1.data.list) @@ -192,9 +221,7 @@ const getBalance = (result, callback) => { this.showErrorMessage(err.message); }) } else { - this.showErrorMessage('未查找到该包装的库存余额', res => { - this.packGetFocus(); - }) + showErrorMessage(getQueryCondition()+'\n未查找到该包装的库存余额') } } }) @@ -203,13 +230,13 @@ const getBalance = (result, callback) => { }) } const getfocus = () => { - if (comscan.value != undefined) { + if (comscan.value) { comscan.value.getfocus() } } const losefocus = () => { - if (comscan.value != undefined) { + if (comscan.value) { comscan.value.losefocus() } } @@ -218,8 +245,10 @@ const showMessage = (message) => { comMessageRef.value.showMessage(message) } const showErrorMessage = (message) => { + losefocus() comMessageRef.value.showErrorMessage(message, (res) => { if (res) { + getfocus() } }) } diff --git a/src/mycomponents/scan/winScanParentPackage.vue b/src/mycomponents/scan/winScanParentPackage.vue new file mode 100644 index 00000000..45d4ce23 --- /dev/null +++ b/src/mycomponents/scan/winScanParentPackage.vue @@ -0,0 +1,274 @@ + + + + + \ No newline at end of file